using System; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Snxxz.UI { public class VipExperienceTween : MonoBehaviour { [SerializeField] PositionTween m_PositionTween; [SerializeField] RectTransform m_ContainerVip; private bool lifeBarShow = false; VipModel model { get { return ModelCenter.Instance.GetModel(); } } public void Init() { GA_NpcFightBoss.s_OnSelect += OnShowBossLifeBar; GA_NpcClientFightBoss.s_OnSelect += OnShowBossLifeBar; } private void OnShowBossLifeBar(uint arg0, int arg1, bool show) { lifeBarShow = show; OnCheckContainerVip(); } private void OnCheckContainerVip() { m_PositionTween.SetEndState(); if (lifeBarShow && m_ContainerVip.gameObject.activeInHierarchy) { m_ContainerVip.gameObject.SetActive(false); } else if (!lifeBarShow && model.IsVipExperience() && !m_ContainerVip.gameObject.activeInHierarchy) { m_ContainerVip.gameObject.SetActive(true); m_PositionTween.Play(); } } public void UnInit() { GA_NpcFightBoss.s_OnSelect -= OnShowBossLifeBar; GA_NpcClientFightBoss.s_OnSelect -= OnShowBossLifeBar; } } }