using System.Collections; using UnityEngine; using UI.XiuFang; using FairyGUI; using ET; namespace GFGGame { public class XiuFangView : BaseWindow { private UI_XiuFangUI _ui; public override void Dispose() { if (_ui != null) { _ui.Dispose(); _ui = null; } base.Dispose(); } protected override void OnInit() { base.OnInit(); packageName = UI_XiuFangUI.PACKAGE_NAME; _ui = UI_XiuFangUI.Create(); this.viewCom = _ui.target; isfullScreen = true; _ui.m_btnBack.onClick.Add(OnClickBtnBack); _ui.m_component.m_btnClothingShop.target.onClick.Add(OnClickBtnClothingShop); _ui.m_component.m_btnSuitSynthetic.target.onClick.Add(OnClickBtnSuitSynthetic); _ui.m_component.m_btnClothingUpgrade.target.onClick.Add(OnClickBtnClothingUpgrade); _ui.m_component.m_btnDecompose.target.onClick.Add(OnClickBtnDecompose); _ui.m_bg.url = ResPathUtil.GetBgImgPath("xf_bg"); } protected override void AddEventListener() { base.AddEventListener(); EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot); } protected override void OnShown() { base.OnShown(); // _ui.m_component.target.scrollPane.SetPosX(0, false); _ui.m_component.m_btnClothingShop.m_c1.selectedIndex = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(ClothingShopView).Name, false) ? 1 : 0; _ui.m_component.m_btnSuitSynthetic.m_c1.selectedIndex = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(SuitSyntheticView).Name, false) ? 1 : 0; _ui.m_component.m_btnClothingUpgrade.m_c1.selectedIndex = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(ClothingListView).Name, false) ? 1 : 0; _ui.m_component.m_btnDecompose.m_c1.selectedIndex = FunctionOpenDataManager.Instance.CheckIsFunOpenById(typeof(ClothingDecomposeView).Name, false) ? 1 : 0; // GuideCfg cfg = GuideCfgArray.Instance.GetCfg(ConstGuideId.CLOTHING_DECOMPOSE); // if (GuideDataManager.currentGuideId == cfg.id) // { // _ui.m_component.target.scrollPane.SetPosX(400, false); // } UpdateRedDot(); Timers.inst.AddUpdate(CheckGuide); } protected override void OnHide() { base.OnHide(); Timers.inst.Remove(CheckGuide); } protected override void RemoveEventListener() { base.RemoveEventListener(); EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot); } private void OnClickBtnBack() { this.Hide(); ViewManager.GoBackFrom(typeof(XiuFangView).FullName); } private void OnClickBtnClothingShop() { LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.FU_ZHUANG_DIAN, 1); ViewManager.Show(null, new object[] { typeof(XiuFangView).FullName, this.viewData }, true, true); } private void OnClickBtnSuitSynthetic() { LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.FU_ZHUANG_HE_CHENG, 1); ViewManager.Show(null, new object[] { typeof(XiuFangView).FullName, this.viewData }); } private void OnClickBtnClothingUpgrade() { LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.FU_ZHUANG_YANG_CHENG, 1); ViewManager.Show(null, new object[] { typeof(XiuFangView).FullName, this.viewData }, false, true); // PromptController.Instance.ShowFloatTextPrompt("暂未开放", MessageType.WARNING); } private void OnClickBtnDecompose() { LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.FU_ZHUANG_FEN_JIE, 1); ViewManager.Show(null, new object[] { typeof(XiuFangView).FullName, this.viewData }); } private void CheckGuide(object param) { if (GuideDataManager.IsGuideFinish(ConstGuideId.CLOTHING_SYNTHETIC) <= 0 || GuideDataManager.IsGuideFinish(ConstGuideId.CLOTHING_DECOMPOSE) <= 0 || GuideDataManager.IsGuideFinish(ConstGuideId.SUIT_LIST_VIEW) <= 0) { UpdateToCheckGuide(null); } else { Timers.inst.Remove(CheckGuide); } } private void UpdateRedDot() { RedDotController.Instance.SetComRedDot(_ui.m_component.m_btnClothingUpgrade.target, RedDotDataManager.Instance.GetClothingFosterRed(), "", 0, 30); RedDotController.Instance.SetComRedDot(_ui.m_component.m_btnSuitSynthetic.target, RedDotDataManager.Instance.GetClothingSyntheticRed(), "", -20, 25); } protected override void UpdateToCheckGuide(object param) { if (!ViewManager.CheckIsTopView(this.viewCom)) return; GuideController.TryGuide(_ui.m_component.m_btnSuitSynthetic.target, ConstGuideId.CLOTHING_SYNTHETIC, 2, "这里可以查看已获得的服饰图谱。"); GuideController.TryGuide(_ui.m_component.m_btnDecompose.target, ConstGuideId.CLOTHING_DECOMPOSE, 3, "这里可以消耗重复获得的服饰。"); GuideController.TryGuide(_ui.m_component.m_btnClothingUpgrade.target, ConstGuideId.SUIT_LIST_VIEW, 2, ""); } } }