123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- using UI.Task;
- namespace GFGGame
- {
- public class TaskView : BaseWindow
- {
- private UI_TaskUI _ui;
- private ValueBarController _valueBarController;
- public override void Dispose()
- {
- if (_valueBarController != null)
- {
- _valueBarController.Dispose();
- _valueBarController = null;
- }
- if (_ui != null)
- {
- _ui.Dispose();
- _ui = null;
- }
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- packageName = UI_TaskUI.PACKAGE_NAME;
- _ui = UI_TaskUI.Create();
- viewCom = _ui.target;
- isfullScreen = true;
- bringToFontOnClick = false;
- _ui.m_btnBack.onClick.Add(OnBtnBackClick);
- _valueBarController = new ValueBarController(_ui.m_comValueBar);
- _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("lm_beijing2");
- _ui.m_c1.onChanged.Add(OnCtrlChange);
- }
- private void OnBtnBackClick()
- {
- ViewManager.Hide<CombTaskView>();
- ViewManager.Hide<BattlePassTaskView>();
- ViewManager.GoBackFrom(typeof(TaskView).FullName);
- }
- protected override void OnShown()
- {
- base.OnShown();
- _valueBarController.OnShown();
- _ui.m_c1.selectedIndex = viewData == null ? 1 : (int)(viewData as object[])?[0]!;
- }
- protected override void OnHide()
- {
- base.OnHide();
- _valueBarController.OnHide();
- _ui.m_c1.selectedIndex = 0;
- }
- private void OnCtrlChange()
- {
- switch (_ui.m_c1.selectedIndex)
- {
- case 1:
- ViewManager.Show<CombTaskView>();
- ViewManager.Hide<BattlePassTaskView>();
- break;
- case 2:
- ViewManager.Show<BattlePassTaskView>();
- ViewManager.Hide<CombTaskView>();
- break;
- }
- viewData = null;
- }
- }
- }
|