| | |
| | | Coroutine m_CacheCoroutine = null;
|
| | |
|
| | | TreasureModel model { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } }
|
| | | TaskModel taskModel { get { return ModelCenter.Instance.GetModel<TaskModel>(); } }
|
| | |
|
| | | public void Display()
|
| | | {
|
| | |
| | | model.treasureStateChangeEvent += TreasureStateChangeEvent;
|
| | | model.treasureCollectProgressRefresh += TreasureCollectProgressRefresh;
|
| | | WindowCenter.Instance.windowAfterOpenEvent += WindowAfterOpenEvent;
|
| | | WindowCenter.Instance.windowAfterCloseEvent += WindowBeforeCloseEvent;
|
| | |
|
| | | dirty = false;
|
| | | DisplayBase();
|
| | |
| | | StopCoroutine(m_CacheCoroutine);
|
| | | m_CacheCoroutine = null;
|
| | | }
|
| | | m_CacheCoroutine = StartCoroutine(Co_StopEffect());
|
| | | if (gameObject.activeInHierarchy)
|
| | | {
|
| | | m_CacheCoroutine = StartCoroutine(Co_StopEffect());
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | void DisplayBase()
|
| | | {
|
| | | bool isChapterOpen = TreasureChapterWin.displaying;
|
| | | bool isChapterOpen = model.treasureChapterId != 0;
|
| | |
|
| | | m_ContainerUnknown.gameObject.SetActive(displayId == 0 || isChapterOpen);
|
| | | m_ContainerCollect.gameObject.SetActive(displayId != 0 && !isChapterOpen);
|
| | |
| | | return 0;
|
| | | }
|
| | |
|
| | | int GetLostTreasure()
|
| | | {
|
| | | var treasureIds = model.GetTreasureCategory(TreasureCategory.Human);
|
| | |
|
| | | var latestTask = taskModel.GetLatestMainTaskId();
|
| | |
|
| | | foreach (var id in treasureIds)
|
| | | {
|
| | | List<int> tasks;
|
| | | if (model.TryGetTreasureTasks(id, out tasks))
|
| | | {
|
| | | if (latestTask < tasks[0])
|
| | | {
|
| | | return id;
|
| | | }
|
| | | }
|
| | | }
|
| | | return 0;
|
| | | }
|
| | |
|
| | | bool IsAllCompleted()
|
| | | {
|
| | | var treasureIds = model.GetTreasureCategory(TreasureCategory.Human);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private void WindowBeforeCloseEvent(Window window)
|
| | | {
|
| | | if (window is TreasureChapterWin)
|
| | | {
|
| | | DisplayBase();
|
| | | }
|
| | | }
|
| | |
|
| | | private void LateUpdate()
|
| | | {
|
| | | if (dirty)
|
| | |
| | | model.treasureStateChangeEvent -= TreasureStateChangeEvent;
|
| | | model.treasureCollectProgressRefresh -= TreasureCollectProgressRefresh;
|
| | | WindowCenter.Instance.windowAfterOpenEvent -= WindowAfterOpenEvent;
|
| | | WindowCenter.Instance.windowAfterCloseEvent -= WindowBeforeCloseEvent;
|
| | | if (m_CacheCoroutine != null)
|
| | | {
|
| | | StopCoroutine(m_CacheCoroutine);
|