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(); _curCfg = FieldDataManager.Instance.GetFieldCfgByDifficulty(_ui.m_c1.selectedIndex); _curLevelId = FieldDataManager.Instance.GetLevelIdByDifficulty(_ui.m_c1.selectedIndex); } protected override void OnHide() { base.OnHide(); } private void OnClickBtnBack() { ViewManager.GoBackFrom(typeof(FieldView).FullName); } private void OnDifficultyChange() { _curCfg = FieldDataManager.Instance.GetFieldCfgByDifficulty(_ui.m_c1.selectedIndex); _curLevelId = FieldDataManager.Instance.GetLevelIdByDifficulty(_ui.m_c1.selectedIndex); } private void OnClickBtnGo() { 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(); } } }