|
@@ -1,4 +1,5 @@
|
|
|
|
|
|
+using System;
|
|
|
using System.Collections.Generic;
|
|
|
using ET;
|
|
|
using FairyGUI;
|
|
@@ -13,6 +14,7 @@ namespace GFGGame
|
|
|
|
|
|
protected StudioCfg studioCfg;
|
|
|
protected StoryLevelCfg[] storyLevelCfgs;
|
|
|
+ protected StudioData studioData;
|
|
|
|
|
|
public override void Dispose()
|
|
|
{
|
|
@@ -34,6 +36,10 @@ namespace GFGGame
|
|
|
_ui.m_list.SetVirtual();
|
|
|
|
|
|
_ui.m_btnBuy.onClick.Add(OnCliclBtnBuy);
|
|
|
+
|
|
|
+ EventAgent.AddEventListener(ConstMessage.BUY_STUDIO_PLAY_TIMES, UpdateView);
|
|
|
+ EventAgent.AddEventListener(ConstMessage.NOTICE_STUDIO_PLAY_TIMES, UpdateView);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
protected override void OnShown()
|
|
@@ -41,6 +47,8 @@ namespace GFGGame
|
|
|
base.OnShown();
|
|
|
_valueBarController.OnShown();
|
|
|
UpdateView();
|
|
|
+ Timers.inst.Add(1, 0, UpdateShowTime);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
@@ -49,12 +57,12 @@ namespace GFGGame
|
|
|
_valueBarController.OnHide();
|
|
|
studioCfg = null;
|
|
|
storyLevelCfgs = null;
|
|
|
+ studioData = 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);
|
|
|
+ _ui.m_txtNum.text = string.Format("剩余次数:{0}/{1}", this.studioData.TotalPlayTimes - this.studioData.PlayTimes, this.studioData.TotalPlayTimes);
|
|
|
}
|
|
|
private void UpdateShowTime(object param)
|
|
|
{
|
|
@@ -63,24 +71,34 @@ namespace GFGGame
|
|
|
private void ListItemRender(int index, GObject obj)
|
|
|
{
|
|
|
UI_ListItem item = UI_ListItem.Proxy(obj);
|
|
|
- // item.m_loaIcon.url=
|
|
|
- bool isPass = InstanceZonesDataManager.CheckLevelPass(storyLevelCfgs[index].needStoryLevelId);
|
|
|
- bool isRoleLv = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl) >= storyLevelCfgs[index].needRoleLv;
|
|
|
|
|
|
+ StudioDataManager.Instance.IsCanFight(storyLevelCfgs, storyLevelCfgs[index], out bool canFight, out string content);
|
|
|
|
|
|
- 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].order);
|
|
|
- if (!isRoleLv) title = string.Format("主角等级达到{}级解锁", storyLevelCfgs[index].order);
|
|
|
- item.m_txtTitle.text = title;
|
|
|
+ item.m_grpLock.visible = canFight;
|
|
|
+ item.m_txtTitle.text = canFight ? string.Format("{0}{1}", studioCfg.name, index + 1) : content;
|
|
|
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;
|
|
|
+ StoryLevelCfg storyLevelCfg = item.target.data as StoryLevelCfg;
|
|
|
+ StudioDataManager.Instance.IsCanFight(storyLevelCfgs, storyLevelCfg, out bool canFight, out string content);
|
|
|
+ if (!canFight)
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt(content);
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+ private bool GetCanFight(StoryLevelCfg storyLevelCfg)
|
|
|
+ {
|
|
|
+ bool isPass = InstanceZonesDataManager.CheckLevelPass(storyLevelCfg.needStoryLevelId);
|
|
|
+ bool isRoleLv = GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl) >= storyLevelCfg.needRoleLv;
|
|
|
+ return isPass && isRoleLv;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
private void OnCliclBtnBuy()
|
|
|
{
|
|
|
ViewManager.Show<StudioBuyNumView>(this.studioCfg);
|