少年修仙传客户端代码仓库
client_Wu Xijin
2019-04-28 8d06932ebf186837e048da4822bd837dbf90e212
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
 
namespace Snxxz.UI
{
    public class HumanTreasureTaskCell : CellView
    {
        [SerializeField] UIEffect m_EffectAppear;
        [SerializeField] UIEffect m_EffectGoto;
        [SerializeField] UIAlphaTween m_AlphaTween;
        [SerializeField] Text m_ClueName;
        [SerializeField] Transform m_ContainerCollected;
        [SerializeField] Transform m_ContainerCollecting;
        [SerializeField] Button m_Goto;
        [SerializeField] Transform m_ContainerCutline;
 
        public static int lastClue = 0;
 
        TreasureModel model { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } }
        TaskModel taskModel { get { return ModelCenter.Instance.GetModel<TaskModel>(); } }
 
        private void Awake()
        {
            m_Goto.AddListener(Goto);
        }
 
        private void OnDisable()
        {
            StopAllCoroutines();
        }
 
        public void Display(int clue, bool animationStep, float displayTime)
        {
            var config = TreasureConfig.Get(model.selectedTreasure);
            Dictionary<int, List<int>> clues;
            if (!model.TryGetTreasureClues(model.selectedTreasure, out clues)
                || !clues.ContainsKey(clue))
            {
                return;
            }
            var tasks = clues[clue];
            var taskConfig = TaskListConfig.Get(tasks[0]);
            m_ClueName.text = taskConfig.clueName;
 
            var clueState = model.GetClueState(model.selectedTreasure, clue);
 
            m_ContainerCollected.gameObject.SetActive(clueState == 2);
            m_ContainerCollecting.gameObject.SetActive(clueState == 1);
 
            m_ClueName.color = clueState == 0 ? UIHelper.s_Gray : UIHelper.s_LightYellow;
 
            m_ContainerCutline.gameObject.SetActive(lastClue != clue);
 
            if (!animationStep || !gameObject.activeInHierarchy)
            {
                m_AlphaTween.SetEndState();
                m_EffectGoto.gameObject.SetActive(true);
            }
            else
            {
                m_AlphaTween.SetStartState();
                StartCoroutine(Co_Display(displayTime));
                m_EffectGoto.gameObject.SetActive(false);
            }
        }
 
        IEnumerator Co_Display(float time)
        {
            yield return WaitingForSecondConst.GetWaitForSeconds(time);
            m_EffectAppear.Play();
            m_AlphaTween.Play(OnComplete);
        }
 
        private void OnComplete()
        {
            m_EffectGoto.gameObject.SetActive(true);
        }
 
        private void Goto()
        {
            WindowJumpMgr.Instance.ClearJumpData();
            WindowCenter.Instance.Close<TreasureBaseWin>();
            WindowCenter.Instance.Open<MainInterfaceWin>();
            var taskId = taskModel.GetLatestMainTaskId();
            taskModel.TaskMove(taskId);
        }
    }
}