using System; using UnityEngine; using UnityEngine.UI; using TableConfig; namespace Snxxz.UI { public class PetAndMountPushWin : Window { [SerializeField] Text titleText; [SerializeField] RawImage rawImag; [SerializeField] Button closeBtn; [SerializeField] RichText m_Goto; StoreModel storeModel { get { return ModelCenter.Instance.GetModel(); } } ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel(); } } protected override void BindController() { closeBtn.AddListener(ClickCloseBtn); } protected override void AddListeners() { m_Goto.OnClick += ClickGoTo; } protected override void OnPreOpen() { storeModel.pushRefreshEvent += UpdatePushInfo; UpdatePushInfo(); } protected override void OnAfterOpen() { } protected override void OnPreClose() { storeModel.pushRefreshEvent -= UpdatePushInfo; } protected override void OnAfterClose() { } private void UpdatePushInfo() { if(storeModel.currentPushId == 0) { CloseImmediately(); } else { StoreConfig storeConfig = Config.Instance.Get(storeModel.currentPushId); ItemConfig itemConfig = Config.Instance.Get(storeConfig.ItemID); rawImag.gameObject.SetActive(true); if(itemConfig != null) { switch (itemConfig.Type) { case 26: titleText.text = Language.Get("StorePetPush"); PetInfoConfig petInfo = tipsModel.unlockPetDict[storeConfig.ItemID]; var config = Config.Instance.Get(petInfo.ID); UI3DModelExhibition.Instance.BeginShowNPC(petInfo.ID, config.UIModeLOffset, config.UIModelRotation,rawImag); break; case 41: titleText.text = Language.Get("StoreMountPush"); HorseConfig horseConfig = tipsModel.unlockMountDict[storeConfig.ItemID]; UI3DModelExhibition.Instance.BeginShowHourse(horseConfig.Model,rawImag); break; } } } } private void ClickGoTo() { CloseImmediately(); WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.StoreFunc3); } private void ClickCloseBtn() { storeModel.RemovePetAndMountPush(storeModel.currentPushId); } } }