|
@@ -15,6 +15,7 @@ namespace GFGGame
|
|
|
protected StudioCfg studioCfg;
|
|
|
protected StoryLevelCfg[] storyLevelCfgs;
|
|
|
protected StudioData studioData;
|
|
|
+ private int curIndex = 0;
|
|
|
|
|
|
public override void Dispose()
|
|
|
{
|
|
@@ -38,7 +39,7 @@ namespace GFGGame
|
|
|
_ui.m_btnBuy.onClick.Add(OnCliclBtnBuy);
|
|
|
|
|
|
EventAgent.AddEventListener(ConstMessage.BUY_STUDIO_PLAY_TIMES, UpdateView);
|
|
|
- // EventAgent.AddEventListener(ConstMessage.NOTICE_STUDIO_PLAY_TIMES, UpdateView);
|
|
|
+ EventAgent.AddEventListener(ConstMessage.NOTICE_STUDIO_PLAY_TIMES, UpdateView);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -46,6 +47,7 @@ namespace GFGGame
|
|
|
{
|
|
|
base.OnShown();
|
|
|
_valueBarController.OnShown();
|
|
|
+ _ui.m_list.ScrollToView(curIndex);
|
|
|
UpdateView();
|
|
|
Timers.inst.Add(1, 0, UpdateShowTime);
|
|
|
|
|
@@ -59,10 +61,12 @@ namespace GFGGame
|
|
|
storyLevelCfgs = null;
|
|
|
studioData = null;
|
|
|
Timers.inst.Remove(UpdateShowTime);
|
|
|
+ EventAgent.RemoveEventListener(ConstMessage.BUY_STUDIO_PLAY_TIMES, UpdateView);
|
|
|
+ EventAgent.RemoveEventListener(ConstMessage.NOTICE_STUDIO_PLAY_TIMES, UpdateView);
|
|
|
}
|
|
|
private void UpdateView()
|
|
|
{
|
|
|
- _ui.m_txtNum.text = string.Format("剩余次数:{0}/{1}", this.studioData.TotalPlayTimes - this.studioData.PlayTimes, this.studioData.TotalPlayTimes);
|
|
|
+ _ui.m_txtNum.text = string.Format("剩余次数:{0}/{1}", this.studioData.TotalPlayTimes - this.studioData.PlayTimes, studioCfg.num);
|
|
|
}
|
|
|
private void UpdateShowTime(object param)
|
|
|
{
|
|
@@ -71,23 +75,23 @@ namespace GFGGame
|
|
|
private void ListItemRender(int index, GObject obj)
|
|
|
{
|
|
|
UI_ListItem item = UI_ListItem.Proxy(obj);
|
|
|
- StudioDataManager.Instance.IsCanFight(storyLevelCfgs, storyLevelCfgs[index], out bool canFight, out string content);
|
|
|
+ StudioDataManager.Instance.IsCanFight(storyLevelCfgs, index, out bool canFight, out string content);
|
|
|
|
|
|
ItemData itemData = StoryBonusDataCache.GetBonusData(storyLevelCfgs[index].id).bonusBase[0];
|
|
|
ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(itemData.id);
|
|
|
item.m_loaIcon.url = ResPathUtil.GetIconPath(itemCfg);
|
|
|
-
|
|
|
item.m_star.selectedIndex = InstanceZonesDataManager.GetStarCountHistory(storyLevelCfgs[index].id);
|
|
|
-
|
|
|
item.m_imgLock.visible = canFight ? false : true;
|
|
|
- item.m_txtTitle.text = canFight ? string.Format("{0}{1}", studioCfg.name, index + 1) : content;
|
|
|
- item.target.data = storyLevelCfgs[index];
|
|
|
+ item.m_txtTitle.text = canFight ? storyLevelCfgs[index].name : content;
|
|
|
+ if (canFight) curIndex = index;
|
|
|
+ item.target.data = index;
|
|
|
}
|
|
|
private void OnCliclListItem(EventContext context)
|
|
|
{
|
|
|
UI_ListItem item = UI_ListItem.Proxy(context.data as GObject);
|
|
|
- StoryLevelCfg storyLevelCfg = item.target.data as StoryLevelCfg;
|
|
|
- StudioDataManager.Instance.IsCanFight(storyLevelCfgs, storyLevelCfg, out bool canFight, out string content);
|
|
|
+ int index = (int)item.target.data;
|
|
|
+ StoryLevelCfg storyLevelCfg = storyLevelCfgs[index];
|
|
|
+ StudioDataManager.Instance.IsCanFight(storyLevelCfgs, index, out bool canFight, out string content);
|
|
|
if (!canFight)
|
|
|
{
|
|
|
PromptController.Instance.ShowFloatTextPrompt(content);
|
|
@@ -97,15 +101,6 @@ namespace GFGGame
|
|
|
}
|
|
|
|
|
|
|
|
|
- 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.id);
|