| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Thursday, October 12, 2017 |
| | | //-------------------------------------------------------- |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using UnityEngine.UI; |
| | | using TableConfig; |
| | | using System; |
| | | |
| | | namespace Snxxz.UI |
| | | { |
| | | |
| | | public class TreasureExhibitionBehaviour : MonoBehaviour |
| | | { |
| | | [SerializeField] UIEffect m_EntranceEffect; |
| | | [SerializeField] UIEffect m_NewTreasureEffect; |
| | | |
| | | Window m_Parent; |
| | | Window parent { get { return m_Parent ?? (m_Parent = this.GetComponentInParent<Window>()); } } |
| | | |
| | | TreasureModel model { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } } |
| | | |
| | | private void Awake() |
| | | { |
| | | ShowCollectingTreasure(); |
| | | WindowCenter.Instance.windowBeforeOpenEvent += OnWindowPreOpen; |
| | | WindowCenter.Instance.windowAfterOpenEvent += OnWindowAfterOpen; |
| | | model.collectingTreasureChangeEvent += OnCollectingTreasureChange; |
| | | EffectToFaBaoWin.EffectToFaBaoEvent += EffectToFaBaoEvent; |
| | | model.treasureStateChangeEvent += TreasureStateChangeEvent; |
| | | WindowCenter.Instance.windowAfterCloseEvent += WindowAfterCloseEvent; |
| | | } |
| | | |
| | | private void OnDestroy() |
| | | { |
| | | WindowCenter.Instance.windowBeforeOpenEvent -= OnWindowPreOpen; |
| | | WindowCenter.Instance.windowAfterOpenEvent -= OnWindowAfterOpen; |
| | | model.collectingTreasureChangeEvent -= OnCollectingTreasureChange; |
| | | EffectToFaBaoWin.EffectToFaBaoEvent -= EffectToFaBaoEvent; |
| | | model.treasureStateChangeEvent -= TreasureStateChangeEvent; |
| | | WindowCenter.Instance.windowAfterCloseEvent -= WindowAfterCloseEvent; |
| | | } |
| | | |
| | | private void OnWindowPreOpen(Window _window) |
| | | { |
| | | if (_window != parent) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | ShowCollectingTreasure(); |
| | | } |
| | | |
| | | private void WindowAfterCloseEvent(Window _window) |
| | | { |
| | | if (!WindowCenter.Instance.CheckOpen<MainInterfaceWin>()) |
| | | { |
| | | return; |
| | | } |
| | | if (_window is TreasureSelectWin || _window is TreasureLevelUpWin) |
| | | { |
| | | if (!m_NewTreasureEffect.IsPlaying) |
| | | { |
| | | m_EntranceEffect.Play(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void OnWindowAfterOpen(Window _window) |
| | | { |
| | | if (_window != parent) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | if (!m_NewTreasureEffect.IsPlaying) |
| | | { |
| | | m_EntranceEffect.Play(); |
| | | } |
| | | } |
| | | |
| | | private void OnCollectingTreasureChange(TreasureCategory _category) |
| | | { |
| | | ShowCollectingTreasure(); |
| | | } |
| | | |
| | | private void ShowCollectingTreasure() |
| | | { |
| | | m_NewTreasureEffect.StopImediatly(); |
| | | var treasureId = 0; |
| | | if (model.treasureCollectingShowId != 0) |
| | | { |
| | | treasureId = model.collectingHuman; |
| | | m_NewTreasureEffect.Play(); |
| | | if (m_EntranceEffect.IsPlaying) |
| | | { |
| | | m_EntranceEffect.StopImediatly(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void EffectToFaBaoEvent() |
| | | { |
| | | var treasureId = 0; |
| | | if ((treasureId = model.GetTreasureUnlockShow(TreasureCategory.Human)) != 0) |
| | | { |
| | | model.treasureCollectingShowId = treasureId; |
| | | ShowCollectingTreasure(); |
| | | if (treasureId == TreasureModel.TREASURE_GUIDE_ID) |
| | | { |
| | | |
| | | NewBieCenter.Instance.StartNewBieGuide(12); |
| | | } |
| | | else if (model.guideTreasures.Contains(treasureId)) |
| | | { |
| | | FunctionalGuideCenter.Instance.StartGuide(59); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void TreasureStateChangeEvent(int _id) |
| | | { |
| | | if (model.treasureCollectingShowId == _id) |
| | | { |
| | | model.treasureCollectingShowId = 0; |
| | | ShowCollectingTreasure(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | //--------------------------------------------------------
|
| | | // [Author]: 第二世界
|
| | | // [ Date ]: Thursday, October 12, 2017
|
| | | //--------------------------------------------------------
|
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | | using UnityEngine.UI;
|
| | | using TableConfig;
|
| | | using System;
|
| | |
|
| | | namespace Snxxz.UI
|
| | | {
|
| | |
|
| | | public class TreasureExhibitionBehaviour : MonoBehaviour
|
| | | {
|
| | | [SerializeField] UIEffect m_EntranceEffect;
|
| | | [SerializeField] UIEffect m_NewTreasureEffect;
|
| | |
|
| | | Window m_Parent;
|
| | | Window parent { get { return m_Parent ?? (m_Parent = this.GetComponentInParent<Window>()); } }
|
| | |
|
| | | TreasureModel model { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } }
|
| | |
|
| | | private void Awake()
|
| | | {
|
| | | ShowCollectingTreasure();
|
| | | WindowCenter.Instance.windowBeforeOpenEvent += OnWindowPreOpen;
|
| | | WindowCenter.Instance.windowAfterOpenEvent += OnWindowAfterOpen;
|
| | | model.collectingTreasureChangeEvent += OnCollectingTreasureChange;
|
| | | EffectToFaBaoWin.EffectToFaBaoEvent += EffectToFaBaoEvent;
|
| | | model.treasureStateChangeEvent += TreasureStateChangeEvent;
|
| | | WindowCenter.Instance.windowAfterCloseEvent += WindowAfterCloseEvent;
|
| | | }
|
| | |
|
| | | private void OnDestroy()
|
| | | {
|
| | | WindowCenter.Instance.windowBeforeOpenEvent -= OnWindowPreOpen;
|
| | | WindowCenter.Instance.windowAfterOpenEvent -= OnWindowAfterOpen;
|
| | | model.collectingTreasureChangeEvent -= OnCollectingTreasureChange;
|
| | | EffectToFaBaoWin.EffectToFaBaoEvent -= EffectToFaBaoEvent;
|
| | | model.treasureStateChangeEvent -= TreasureStateChangeEvent;
|
| | | WindowCenter.Instance.windowAfterCloseEvent -= WindowAfterCloseEvent;
|
| | | }
|
| | |
|
| | | private void OnWindowPreOpen(Window _window)
|
| | | {
|
| | | if (_window != parent)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | ShowCollectingTreasure();
|
| | | }
|
| | |
|
| | | private void WindowAfterCloseEvent(Window _window)
|
| | | {
|
| | | if (!WindowCenter.Instance.CheckOpen<MainInterfaceWin>())
|
| | | {
|
| | | return;
|
| | | }
|
| | | if (_window is TreasureSelectWin || _window is TreasureLevelUpWin)
|
| | | {
|
| | | if (!m_NewTreasureEffect.IsPlaying)
|
| | | {
|
| | | m_EntranceEffect.Play();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnWindowAfterOpen(Window _window)
|
| | | {
|
| | | if (_window != parent)
|
| | | {
|
| | | return;
|
| | | }
|
| | |
|
| | | if (!m_NewTreasureEffect.IsPlaying)
|
| | | {
|
| | | m_EntranceEffect.Play();
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnCollectingTreasureChange(TreasureCategory _category)
|
| | | {
|
| | | ShowCollectingTreasure();
|
| | | }
|
| | |
|
| | | private void ShowCollectingTreasure()
|
| | | {
|
| | | m_NewTreasureEffect.StopImediatly();
|
| | | var treasureId = 0;
|
| | | if (model.treasureCollectingShowId != 0)
|
| | | {
|
| | | treasureId = model.collectingHuman;
|
| | | m_NewTreasureEffect.Play();
|
| | | if (m_EntranceEffect.IsPlaying)
|
| | | {
|
| | | m_EntranceEffect.StopImediatly();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void EffectToFaBaoEvent()
|
| | | {
|
| | | var treasureId = 0;
|
| | | if ((treasureId = model.GetTreasureUnlockShow(TreasureCategory.Human)) != 0)
|
| | | {
|
| | | model.treasureCollectingShowId = treasureId;
|
| | | ShowCollectingTreasure();
|
| | | if (treasureId == TreasureModel.TREASURE_GUIDE_ID)
|
| | | {
|
| | |
|
| | | NewBieCenter.Instance.StartNewBieGuide(12);
|
| | | }
|
| | | else if (model.guideTreasures.Contains(treasureId))
|
| | | {
|
| | | FunctionalGuideCenter.Instance.StartGuide(59);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void TreasureStateChangeEvent(int _id)
|
| | | {
|
| | | if (model.treasureCollectingShowId == _id)
|
| | | {
|
| | | model.treasureCollectingShowId = 0;
|
| | | ShowCollectingTreasure();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|