using ET; using UI.Field; using UnityEngine; namespace GFGGame { public class FieldView : BaseWindow { private UI_FieldUI _ui; private FieldCfg _curCfg; private int _curLevelId; public override void Dispose() { base.Dispose(); } protected override void OnInit() { base.OnInit(); packageName = UI_FieldUI.PACKAGE_NAME; _ui = UI_FieldUI.Create(); this.viewCom = _ui.target; isfullScreen = true; _ui.m_btnBack.onClick.Add(OnClickBtnBack); _ui.m_btnGo.onClick.Add(OnClickBtnGo); _ui.m_btnTask.onClick.Add(OnBtnTaskClick); _ui.m_c1.onChanged.Add(OnDifficultyChange); } protected override void OnShown() { base.OnShown(); FieldDataManager.Instance.c_difficulty = _ui.m_c1.selectedIndex; _curCfg = FieldDataManager.Instance.GetFieldCfgByDifficulty(_ui.m_c1.selectedIndex); _curLevelId = FieldDataManager.Instance.GetLevelIdByDifficulty(_ui.m_c1.selectedIndex); FieldCfg[] cfgs = FieldCfgArray.Instance.dataArray; for (int i = 0; i < cfgs.Length; i++) { // bool isPass = InstanceZonesDataManager.CheckLevelPass(cfgs[i].s); // _ui.target.GetChild("btn"+i).asButton.GetChild("imgLock").asImage.visible= } UpdateView(); _ui.m_proTaskReward.max = 100; _ui.m_proTaskReward.value = 88; } protected override void OnHide() { base.OnHide(); } private void OnClickBtnBack() { ViewManager.GoBackFrom(typeof(FieldView).FullName); } private void OnDifficultyChange() { FieldDataManager.Instance.c_difficulty = _ui.m_c1.selectedIndex; _curCfg = FieldDataManager.Instance.GetFieldCfgByDifficulty(_ui.m_c1.selectedIndex); _curLevelId = FieldDataManager.Instance.GetLevelIdByDifficulty(_ui.m_c1.selectedIndex); UpdateView(); } private void UpdateView() { _ui.m_txtScore.text = ConstDressUpScoreType.scoreTypeList()[FieldDataManager.Instance.Theme].ToString(); _ui.m_txtMaxLv.text = string.Format("最高记录:{0}/{1}", 0, _curCfg.num); _ui.m_txtConsume.text = string.Format("x{0}", _curCfg.needPower); } private void OnClickBtnGo() { // ViewManager.Show(); if (GameGlobal.myNumericComponent.GetAsInt(NumericType.Power) < _curCfg.needPower) { PromptController.Instance.ShowFloatTextPrompt("体力不足"); return; } ViewManager.Show(ViewName.DRESS_UP_FIGHT_VIEW, _curLevelId, new object[] { typeof(FieldView).Name, this.viewData }, true); InstanceZonesDataManager.currentLevelCfgId = _curLevelId; } private void OnBtnTaskClick() { ViewManager.Show(); } } }