| | |
| | | using System;
|
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | |
|
| | | using UnityEngine;
|
| | | namespace Snxxz.UI
|
| | | {
|
| | |
| | | TextMesh condition;
|
| | | DemonDungeonLabel treasureLabel;
|
| | | TreasureThreeDimensionsBehaviour m_ThreeDimensionsBehaviour;
|
| | | HumanThreeDimensionsBehaviour m_HumanThreeDimensions;
|
| | |
|
| | | SFXController treasureEffect;
|
| | | SFXController backLightEffect;
|
| | |
| | |
|
| | | public Treasure3DConfig paramConfig { get; set; }
|
| | |
|
| | | static Dictionary<TreasureCategory, GameObjectPoolManager.GameObjectPool> m_BottomPoolDict = new Dictionary<TreasureCategory, GameObjectPoolManager.GameObjectPool>();
|
| | | static Dictionary<TreasureState, GameObjectPoolManager.GameObjectPool> m_StatePoolDict = new Dictionary<TreasureState, GameObjectPoolManager.GameObjectPool>();
|
| | | static Dictionary<TreasureCategory, GameObjectPoolManager.GameObjectPool> m_ConditionPoolDict = new Dictionary<TreasureCategory, GameObjectPoolManager.GameObjectPool>();
|
| | | static Dictionary<TreasureCategory, GameObjectPoolManager.GameObjectPool> m_LabelPoolDict = new Dictionary<TreasureCategory, GameObjectPoolManager.GameObjectPool>();
|
| | | static GameObjectPoolManager.GameObjectPool m_TreasureCanvaPool;
|
| | | static Dictionary<TreasureCategory, GameObjectPoolManager.GameObjectPool> m_BottomPoolDict
|
| | | = new Dictionary<TreasureCategory, GameObjectPoolManager.GameObjectPool>();
|
| | | static Dictionary<TreasureState, GameObjectPoolManager.GameObjectPool> m_StatePoolDict
|
| | | = new Dictionary<TreasureState, GameObjectPoolManager.GameObjectPool>();
|
| | | static Dictionary<TreasureCategory, GameObjectPoolManager.GameObjectPool> m_ConditionPoolDict
|
| | | = new Dictionary<TreasureCategory, GameObjectPoolManager.GameObjectPool>();
|
| | | static Dictionary<TreasureCategory, GameObjectPoolManager.GameObjectPool> m_LabelPoolDict
|
| | | = new Dictionary<TreasureCategory, GameObjectPoolManager.GameObjectPool>();
|
| | | static Dictionary<TreasureCategory, GameObjectPoolManager.GameObjectPool> m_TreasureCanvaPool
|
| | | = new Dictionary<TreasureCategory, GameObjectPoolManager.GameObjectPool>();
|
| | | static Vector3 m_CacheBottomScale = Vector3.zero;
|
| | |
|
| | | TreasureModel m_Model;
|
| | |
| | | public void RequestName()
|
| | | {
|
| | | RecycleName();
|
| | | if (category == TreasureCategory.King)
|
| | | if (category == TreasureCategory.King || category == TreasureCategory.Human)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
| | | public void RequestTreasureCanva()
|
| | | {
|
| | | RecycleTreasureCanva();
|
| | | if (category != TreasureCategory.King)
|
| | | if (category != TreasureCategory.King
|
| | | && category != TreasureCategory.Human)
|
| | | {
|
| | | return;
|
| | | }
|
| | | if (m_TreasureCanvaPool == null)
|
| | | if (!m_TreasureCanvaPool.ContainsKey(category))
|
| | | {
|
| | | var prefab = UILoader.LoadTreasure("Misc", "TreasureCanva");
|
| | | var prefab = UILoader.LoadTreasure("Misc", "TreasureCanva_" + category.ToString());
|
| | | if (prefab)
|
| | | {
|
| | | m_TreasureCanvaPool = GameObjectPoolManager.Instance.RequestPool(prefab);
|
| | | m_TreasureCanvaPool.Add(category, GameObjectPoolManager.Instance.RequestPool(prefab));
|
| | | }
|
| | | }
|
| | | if (m_TreasureCanvaPool != null)
|
| | | if (m_TreasureCanvaPool.ContainsKey(category))
|
| | | {
|
| | | var go = m_TreasureCanvaPool.Request();
|
| | | var pool = m_TreasureCanvaPool[category];
|
| | | var go = pool.Request();
|
| | | go.SetActive(true);
|
| | | go.transform.SetParent(root);
|
| | | go.transform.localPosition = Vector3.zero;
|
| | | go.transform.localEulerAngles = new Vector3(0, -180, 0);
|
| | | go.transform.localScale = Vector3.one * 0.01f;
|
| | | LayerUtility.SetLayer(go, LayerUtility.DevisableUI, true);
|
| | | m_ThreeDimensionsBehaviour = go.GetComponent<TreasureThreeDimensionsBehaviour>();
|
| | | m_ThreeDimensionsBehaviour.SetCamera(UI3DTreasureSelectStage.Instance.treasureUICamera);
|
| | | m_ThreeDimensionsBehaviour.Display(treasureId);
|
| | |
|
| | | switch (category)
|
| | | {
|
| | | case TreasureCategory.Human:
|
| | | m_HumanThreeDimensions = go.GetComponent<HumanThreeDimensionsBehaviour>();
|
| | | m_HumanThreeDimensions.SetCamera(UI3DTreasureSelectStage.Instance.treasureUICamera);
|
| | | m_HumanThreeDimensions.Display(treasureId); break;
|
| | | case TreasureCategory.King:
|
| | | m_ThreeDimensionsBehaviour = go.GetComponent<TreasureThreeDimensionsBehaviour>();
|
| | | m_ThreeDimensionsBehaviour.SetCamera(UI3DTreasureSelectStage.Instance.treasureUICamera);
|
| | | m_ThreeDimensionsBehaviour.Display(treasureId);
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void RecycleTreasureCanva()
|
| | | {
|
| | | if (m_TreasureCanvaPool != null)
|
| | | if (m_ThreeDimensionsBehaviour != null)
|
| | | {
|
| | | if (m_ThreeDimensionsBehaviour != null)
|
| | | {
|
| | | m_ThreeDimensionsBehaviour.gameObject.SetActive(false);
|
| | | m_TreasureCanvaPool.Release(m_ThreeDimensionsBehaviour.gameObject);
|
| | | m_ThreeDimensionsBehaviour = null;
|
| | | }
|
| | | m_ThreeDimensionsBehaviour.gameObject.SetActive(false);
|
| | | m_TreasureCanvaPool[TreasureCategory.King].Release(m_ThreeDimensionsBehaviour.gameObject);
|
| | | m_ThreeDimensionsBehaviour = null;
|
| | | }
|
| | | if (m_HumanThreeDimensions != null)
|
| | | {
|
| | | m_HumanThreeDimensions.gameObject.SetActive(false);
|
| | | m_TreasureCanvaPool[TreasureCategory.Human].Release(m_HumanThreeDimensions.gameObject);
|
| | | m_HumanThreeDimensions = null;
|
| | | }
|
| | | }
|
| | |
|