| | |
| | | private Transform bottom;
|
| | | private Transform name;
|
| | | private TextMesh condition;
|
| | | private TextMesh treasureLabel;
|
| | |
|
| | | #region 红点
|
| | | private Transform potentialRed;
|
| | |
| | | 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 Vector3 m_CacheBottomScale = Vector3.zero;
|
| | |
|
| | | TreasureModel m_Model;
|
| | |
| | | RecycleCollectingSfx();
|
| | | RecycleRedpoint();
|
| | | RecycleCondition();
|
| | | RecycleTreasureLabel();
|
| | | RecycleHighestEffect();
|
| | | RedpointCenter.Instance.redpointValueChangeEvent -= RedpointValueChangeEvent;
|
| | | }
|
| | |
| | | RequestTreasureEffect();
|
| | | RecycleLockEffect();
|
| | | RecycleCondition();
|
| | | RequestTreasureLabel();
|
| | | break;
|
| | | case TreasureState.Collecting:
|
| | | RequestTreasureEffect();
|
| | | RequestCollectingSfx();
|
| | | RecycleLockEffect();
|
| | | RecycleCondition();
|
| | | RequestTreasureLabel();
|
| | | break;
|
| | | case TreasureState.Locked:
|
| | | RecycleCollectingSfx();
|
| | | RecycleTreasureEffect();
|
| | | RequestLockEffect();
|
| | | RequestCondition();
|
| | | RecycleTreasureLabel();
|
| | | break;
|
| | | }
|
| | | if (model.GetTreasureUnlockShow(UI3DTreasureSelectStage.Instance.currentCategory) == _treasure.id)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | void RequestTreasureLabel()
|
| | | {
|
| | | RecycleTreasureLabel();
|
| | |
|
| | | if (category != TreasureCategory.Demon)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | string displayStr = string.Empty;
|
| | | switch (category)
|
| | | {
|
| | | case TreasureCategory.Demon:
|
| | | Treasure _treasure;
|
| | | if (model.TryGetTreasure(treasureId, out _treasure))
|
| | | {
|
| | | switch (_treasure.state)
|
| | | {
|
| | | case TreasureState.Collected:
|
| | | displayStr = Language.Get("DemonTreasureHighest");
|
| | | break;
|
| | | case TreasureState.Collecting:
|
| | | TreasureDungeon treasureDungeon;
|
| | | if (model.TryGetTreasureDungeon(treasureId, out treasureDungeon))
|
| | | {
|
| | | displayStr = UIHelper.ReplaceNewLine(Language.Get("DemonTreasureChallenge",
|
| | | treasureDungeon.currentLevel, treasureDungeon.maxLevel));
|
| | | }
|
| | | break;
|
| | | case TreasureState.Locked:
|
| | | return;
|
| | | }
|
| | | }
|
| | | break;
|
| | | }
|
| | |
|
| | | if (string.IsNullOrEmpty(displayStr))
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | GameObjectPoolManager.GameObjectPool pool;
|
| | | if (m_LabelPoolDict.TryGetValue(category, out pool) == false)
|
| | | {
|
| | | var _prefab = UILoader.LoadPrefab(StringUtility.Contact(category, "TreasureLabel"));
|
| | | pool = GameObjectPoolManager.Instance.RequestPool(_prefab);
|
| | | m_LabelPoolDict.Add(category, pool);
|
| | | }
|
| | | treasureLabel = pool.Request().GetComponent<TextMesh>();
|
| | | treasureLabel.gameObject.SetActive(true);
|
| | | treasureLabel.transform.SetParent(root);
|
| | | treasureLabel.transform.localPosition = Vector3.zero;
|
| | | treasureLabel.transform.LookAt(UI3DTreasureSelectStage.Instance.center);
|
| | | treasureLabel.transform.localPosition = new Vector3(0, -1.48f, 0f);
|
| | | treasureLabel.transform.localScale = new Vector3(-1, 1, 1);
|
| | | treasureLabel.text = displayStr;
|
| | | LayerUtility.SetLayer(treasureLabel.gameObject, LayerUtility.UILayer, true);
|
| | | }
|
| | |
|
| | | void RecycleTreasureLabel()
|
| | | {
|
| | | if (m_LabelPoolDict.ContainsKey(category) && treasureLabel != null)
|
| | | {
|
| | | var pool = m_LabelPoolDict[category];
|
| | | pool.Release(treasureLabel.gameObject);
|
| | | treasureLabel = null;
|
| | | }
|
| | | }
|
| | |
|
| | | public Vector3 GetAdaptiveDistance(Vector3 _distance)
|
| | | {
|
| | | var normal = Constants.DESIGN_RESOLUTION.x / Constants.DESIGN_RESOLUTION.y;
|
| | |
| | | RecycleLockEffect();
|
| | | RecycleRedpoint();
|
| | | RecycleCondition();
|
| | | RecycleTreasureLabel();
|
| | | RecycleHighestEffect();
|
| | | RequestSpecialEffect();
|
| | |
|
| | |
| | | {
|
| | | RecycleLockEffect();
|
| | | RecycleCondition();
|
| | | RecycleTreasureLabel();
|
| | | try
|
| | | {
|
| | | var _effect = SFXPlayUtility.Instance.Play(category == TreasureCategory.Demon ? 5157 : 5132, treasureRoot);
|