12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- 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("bg_txz");
- _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;
- }
- }
- }
|