| | |
| | | public class FairyCallMemberBehaviour : MonoBehaviour
|
| | | {
|
| | | [SerializeField] Button m_CallMember;
|
| | | [SerializeField] Text m_Timer;
|
| | |
|
| | | long lastTick = 0;
|
| | |
|
| | |
| | | {
|
| | | model.bossGrabHintEvent += BossGrabHintEvent;
|
| | | PlayerDatas.Instance.fairyData.OnRefreshFairyInfo += OnRefreshFairyInfo;
|
| | | GlobalTimeEvent.Instance.secondEvent += DisplayTimer;
|
| | | Display();
|
| | | DisplayTimer();
|
| | | }
|
| | |
|
| | | private void OnDisable()
|
| | | {
|
| | | model.bossGrabHintEvent -= BossGrabHintEvent;
|
| | | PlayerDatas.Instance.fairyData.OnRefreshFairyInfo -= OnRefreshFairyInfo;
|
| | | GlobalTimeEvent.Instance.secondEvent -= DisplayTimer;
|
| | | }
|
| | |
|
| | | private void BossGrabHintEvent()
|
| | |
| | | if (ts.TotalSeconds >= model.callMemberSeconds)
|
| | | {
|
| | | lastTick = DateTime.Now.Ticks;
|
| | | DisplayTimer();
|
| | | CAC05_tagCGCallupFamilyMemberToBoss pak = new CAC05_tagCGCallupFamilyMemberToBoss();
|
| | | pak.NPCID = (uint)bossId;
|
| | | GameNetSystem.Instance.SendInfo(pak);
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | void DisplayTimer()
|
| | | {
|
| | | if (m_CallMember.gameObject.activeInHierarchy)
|
| | | {
|
| | | var ticks = DateTime.Now.Ticks - lastTick;
|
| | | var ts = new TimeSpan(ticks < 0 ? 0 : ticks);
|
| | | var seconds = (int)(model.callMemberSeconds - ts.TotalSeconds);
|
| | | if (seconds <= 0 && m_Timer.gameObject.activeSelf)
|
| | | {
|
| | | m_Timer.gameObject.SetActive(false);
|
| | | }
|
| | | else if (seconds > 0)
|
| | | {
|
| | | if (!m_Timer.gameObject.activeSelf)
|
| | | {
|
| | | m_Timer.gameObject.SetActive(true);
|
| | | }
|
| | | m_Timer.text = StringUtility.Contact(seconds, Language.Get("RealmWin_Bewrite_35"));
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | } |
| | | |