1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- 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.difficulty = _ui.m_c1.selectedIndex;
- _curCfg = FieldDataManager.Instance.GetFieldCfgByDifficulty(_ui.m_c1.selectedIndex);
- _curLevelId = FieldDataManager.Instance.GetLevelIdByDifficulty(_ui.m_c1.selectedIndex);
- 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.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.scoreType].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<FieldFightInfoView>();
- 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<FieldTaskView>();
- }
- }
- }
|