| | |
| | | using System;
|
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | | using TableConfig;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | |
| | |
|
| | | public class BattleHintWin : Window
|
| | | {
|
| | | [SerializeField] Image m_BattleHint;
|
| | | [SerializeField] RectTransform m_ContainerBattleHint;
|
| | | [SerializeField] RectTransform m_ContainerKing;
|
| | | [SerializeField] RectTransform m_ContainerEnemy;
|
| | | [SerializeField] RectTransform m_ContainerAncientRemind;
|
| | | [SerializeField] ScaleTween m_BattleHintTween;
|
| | | [SerializeField, Header("保留时间")] float m_KeepTime = 2f;
|
| | |
|
| | | bool inBattleHint = false;
|
| | | [SerializeField] RectTransform m_ContainerEvenKill;
|
| | | [SerializeField] ScaleTween m_EvenKillTween;
|
| | | [SerializeField] Text m_EvenKill;
|
| | | [SerializeField, Header("保留时间")] float m_EvenKillTime = 2f;
|
| | |
|
| | | bool isBattleHint = false;
|
| | | bool isEvenKill = false;
|
| | |
|
| | | #region Built-in
|
| | | protected override void BindController()
|
| | | {
|
| | |
| | |
|
| | | protected override void OnPreOpen()
|
| | | {
|
| | | inBattleHint = false;
|
| | | m_BattleHintTween.gameObject.SetActive(false);
|
| | | m_ContainerBattleHint.gameObject.SetActive(false);
|
| | | m_ContainerEvenKill.gameObject.SetActive(false);
|
| | | isBattleHint = false;
|
| | | isEvenKill = false;
|
| | | }
|
| | |
|
| | | protected override void OnActived()
|
| | | {
|
| | | base.OnActived();
|
| | | DisplayBattleHint();
|
| | | DisplayEvenKill();
|
| | | BattleHint.Instance.battleHintUpdate += BattleHintUpdate;
|
| | | BattleHint.Instance.evenKillUpdate += EvenKillUpdate;
|
| | | }
|
| | |
|
| | | protected override void OnAfterOpen()
|
| | |
| | | protected override void OnPreClose()
|
| | | {
|
| | | BattleHint.Instance.battleHintUpdate -= BattleHintUpdate;
|
| | | BattleHint.Instance.evenKillUpdate -= EvenKillUpdate;
|
| | | }
|
| | |
|
| | | protected override void OnAfterClose()
|
| | |
| | |
|
| | | private void BattleHintUpdate()
|
| | | {
|
| | | if (!inBattleHint)
|
| | | if (!isBattleHint)
|
| | | {
|
| | | DisplayBattleHint();
|
| | | }
|
| | |
| | |
|
| | | void DisplayBattleHint()
|
| | | {
|
| | | string iconKey = string.Empty;
|
| | | if (BattleHint.Instance.TryGetBattleHint(out iconKey))
|
| | | var ancientType = 0;
|
| | | if (BattleHint.Instance.TryGetBattleHint(out ancientType))
|
| | | {
|
| | | inBattleHint = true;
|
| | | m_BattleHint.SetSprite(iconKey);
|
| | | m_BattleHint.SetNativeSize();
|
| | | m_BattleHintTween.gameObject.SetActive(true);
|
| | | isBattleHint = true;
|
| | | m_ContainerKing.gameObject.SetActive(false);
|
| | | m_ContainerEnemy.gameObject.SetActive(false);
|
| | | m_ContainerAncientRemind.gameObject.SetActive(false);
|
| | | switch (ancientType)
|
| | | {
|
| | | case 1:
|
| | | m_ContainerKing.gameObject.SetActive(true);
|
| | | break;
|
| | | case 2:
|
| | | m_ContainerEnemy.gameObject.SetActive(true);
|
| | | break;
|
| | | case 3:
|
| | | m_ContainerAncientRemind.gameObject.SetActive(true);
|
| | | break;
|
| | | }
|
| | | m_ContainerBattleHint.gameObject.SetActive(true);
|
| | | m_BattleHintTween.SetStartState();
|
| | | m_BattleHintTween.Play(OnBattleHintTweenComplete);
|
| | | }
|
| | |
| | | StartCoroutine(Co_Complete());
|
| | | }
|
| | |
|
| | | private void EvenKillUpdate()
|
| | | {
|
| | | if (!isEvenKill)
|
| | | {
|
| | | DisplayEvenKill();
|
| | | }
|
| | | }
|
| | |
|
| | | void DisplayEvenKill()
|
| | | {
|
| | | string evenKill = string.Empty;
|
| | | if (BattleHint.Instance.TryGetEvenKill(out evenKill))
|
| | | {
|
| | | isEvenKill = true;
|
| | | m_EvenKill.text= evenKill;
|
| | | m_ContainerEvenKill.gameObject.SetActive(true);
|
| | | m_EvenKillTween.SetStartState();
|
| | | m_EvenKillTween.Play(OnEvenKillComplete);
|
| | | }
|
| | | }
|
| | |
|
| | | private void OnEvenKillComplete()
|
| | | {
|
| | | StartCoroutine(Co_EvenKill());
|
| | | }
|
| | |
|
| | | IEnumerator Co_Complete()
|
| | | {
|
| | | yield return WaitingForSecondConst.GetWaitForSeconds(m_KeepTime);
|
| | | inBattleHint = false;
|
| | | m_BattleHintTween.gameObject.SetActive(false);
|
| | | isBattleHint = false;
|
| | | m_ContainerBattleHint.gameObject.SetActive(false);
|
| | | DisplayBattleHint();
|
| | | }
|
| | |
|
| | | IEnumerator Co_EvenKill()
|
| | | {
|
| | | yield return WaitingForSecondConst.GetWaitForSeconds(m_EvenKillTime);
|
| | | isEvenKill = false;
|
| | | m_ContainerEvenKill.gameObject.SetActive(false);
|
| | | DisplayEvenKill();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|