1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- using System.Collections.Generic;
- using ET;
- using FairyGUI;
- using UI.Studio;
- namespace GFGGame
- {
- public class StudioBaseView : BaseWindow
- {
- protected UI_StudioEctypeUI _ui;
- private ValueBarController _valueBarController;
- protected StudioCfg studioCfg;
- protected List<StoryLevelCfg> storyLevelCfgs;
- public override void Dispose()
- {
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- packageName = UI_StudioEctypeUI.PACKAGE_NAME;
- _ui = UI_StudioEctypeUI.Create();
- this.viewCom = _ui.target;
- isfullScreen = true;
- _valueBarController = new ValueBarController(_ui.m_valueBar);
- _ui.m_list.itemRenderer = ListItemRender;
- _ui.m_list.onClickItem.Add(OnCliclListItem);
- _ui.m_list.SetVirtual();
- _ui.m_btnBuy.onClick.Add(OnCliclBtnBuy);
- }
- protected override void OnShown()
- {
- base.OnShown();
- _valueBarController.OnShown();
- UpdateView();
- }
- protected override void OnHide()
- {
- base.OnHide();
- _valueBarController.OnHide();
- studioCfg = null;
- storyLevelCfgs = null;
- Timers.inst.Remove(UpdateShowTime);
- }
- private void UpdateView()
- {
- _ui.m_txtNum.text = string.Format("剩余次数:{0}/{1}", 1, this.studioCfg.num);
- Timers.inst.Add(1, 0, UpdateShowTime);
- }
- private void UpdateShowTime(object param)
- {
- _ui.m_txtTime.text = string.Format("{0}后刷新", TimeUtil.FormattingTime(TimeHelper.ServerNowSecs, GameGlobal.myNumericComponent.GetAsInt(NumericType.DailyResetSecs)));
- }
- private void ListItemRender(int index, GObject obj)
- {
- UI_ListItem item = UI_ListItem.Proxy(obj);
- // item.m_loaIcon.url=
- bool isPass = StoryDataManager.CheckLevelPass(storyLevelCfgs[index].chapterId, storyLevelCfgs[index].level);
- bool isRoleLv = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl) >= storyLevelCfgs[index].roleLv;
- item.m_grpLock.visible = !isPass || !isRoleLv;
- string title = string.Format("{0}{1}", studioCfg.name, index + 1);
- if (!isPass) title = string.Format("完成主线{0}-{1}解锁", storyLevelCfgs[index].chapterId, storyLevelCfgs[index].level);
- if (!isRoleLv) title = string.Format("主角等级达到{}级解锁", storyLevelCfgs[index].level);
- item.m_txtTitle.text = title;
- item.target.data = storyLevelCfgs[index];
- }
- private void OnCliclListItem(EventContext context)
- {
- UI_ListItem item = UI_ListItem.Proxy(context.data as GObject);
- StoryLevelCfg storyLevelCfgs = item.target.data as StoryLevelCfg;
- }
- private void OnCliclBtnBuy()
- {
- ViewManager.Show<StudioBuyNumView>(this.studioCfg);
- }
- }
- }
|