|
@@ -9,9 +9,7 @@ namespace GFGGame
|
|
public class OpenServerStoryView : BaseWindow
|
|
public class OpenServerStoryView : BaseWindow
|
|
{
|
|
{
|
|
private UI_OpenServerStoryUI _ui;
|
|
private UI_OpenServerStoryUI _ui;
|
|
- private int itemIndex = 0;
|
|
|
|
- private List<StoryLevelCfg> _storyLevelCfgs;
|
|
|
|
- private ActivityFightCfg _activityFightCfg;
|
|
|
|
|
|
+ private Dictionary<int,List<StoryLevelCfg>> _storyLevelCfgs = new Dictionary<int, List<StoryLevelCfg>>();
|
|
private int _activityId;
|
|
private int _activityId;
|
|
private int _activityType;
|
|
private int _activityType;
|
|
private ActivityOpenCfg _activityCfg;
|
|
private ActivityOpenCfg _activityCfg;
|
|
@@ -41,6 +39,7 @@ namespace GFGGame
|
|
isReturnView = true;
|
|
isReturnView = true;
|
|
|
|
|
|
_ui.m_btnBack.onClick.Add(OnClickBtnBack);
|
|
_ui.m_btnBack.onClick.Add(OnClickBtnBack);
|
|
|
|
+ _ui.m_list.itemRenderer = RenderListItem;
|
|
}
|
|
}
|
|
|
|
|
|
protected override void AddEventListener()
|
|
protected override void AddEventListener()
|
|
@@ -54,11 +53,11 @@ namespace GFGGame
|
|
_activityType = (int)this.viewData;
|
|
_activityType = (int)this.viewData;
|
|
StudioDataManager.Instance.VIEW_NAME = typeof(OpenServerStoryView).FullName;
|
|
StudioDataManager.Instance.VIEW_NAME = typeof(OpenServerStoryView).FullName;
|
|
StudioDataManager.Instance.PROPERTY_SELECT_INDEX = _activityType;
|
|
StudioDataManager.Instance.PROPERTY_SELECT_INDEX = _activityType;
|
|
- _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("kfhd_sdcy_bg");
|
|
|
|
|
|
+ _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("bg_sdcy_gq");
|
|
_activityId = ActivityDataManager.Instance.GetCurOpenActiveByType(_activityType);
|
|
_activityId = ActivityDataManager.Instance.GetCurOpenActiveByType(_activityType);
|
|
_activityCfg = ActivityOpenCfgArray.Instance.GetCfg(_activityId);
|
|
_activityCfg = ActivityOpenCfgArray.Instance.GetCfg(_activityId);
|
|
- _activityFightCfg = ActivityFightCfgArray.Instance.GetCfg(_activityCfg.params3Arr[0]);
|
|
|
|
- _storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(_activityFightCfg.type, _activityFightCfg.subType, _activityCfg.params3Arr[0]);
|
|
|
|
|
|
+ _storyLevelCfgs.Clear();
|
|
|
|
+ _ui.m_list.numItems = _activityCfg.params4Arr.Length;
|
|
}
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
protected override void OnHide()
|
|
@@ -76,5 +75,42 @@ namespace GFGGame
|
|
ViewManager.GoBackFrom(typeof(OpenServerStoryView).FullName);
|
|
ViewManager.GoBackFrom(typeof(OpenServerStoryView).FullName);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void RenderListItem(int index, GObject obj)
|
|
|
|
+ {
|
|
|
|
+ UI_StoryItem item = UI_StoryItem.Proxy(obj);
|
|
|
|
+
|
|
|
|
+ var activityStoryCfg = ActivityStoryCfgArray.Instance.GetCfg(_activityCfg.params4Arr[index]);
|
|
|
|
+
|
|
|
|
+ item.m_posType.selectedIndex = index % 2;
|
|
|
|
+
|
|
|
|
+ if (index > 0 && !InstanceZonesDataManager.CheckLevelPass(_storyLevelCfgs[index - 1][0].id))
|
|
|
|
+ item.m_storyImageType.selectedIndex = 0;
|
|
|
|
+ else
|
|
|
|
+ item.m_storyImageType.selectedIndex = index+1;
|
|
|
|
+
|
|
|
|
+ var storyLevelCfg = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(activityStoryCfg.type, activityStoryCfg.subType, _activityCfg.params4Arr[index]);
|
|
|
|
+ _storyLevelCfgs.Add(index, storyLevelCfg);
|
|
|
|
+
|
|
|
|
+ if (item.target.data == null)
|
|
|
|
+ item.target.onClick.Add(OnClickBtnPlay);
|
|
|
|
+
|
|
|
|
+ item.target.data = index;
|
|
|
|
+ UI_StoryItem.ProxyEnd();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void OnClickBtnPlay(EventContext context)
|
|
|
|
+ {
|
|
|
|
+ GObject obj = context.sender as GObject;
|
|
|
|
+ int index = (int)obj.data;
|
|
|
|
+ StoryLevelCfg storyLevelCfg = _storyLevelCfgs[index][0];
|
|
|
|
+ if (index > 0 && !InstanceZonesDataManager.CheckLevelPass(_storyLevelCfgs[index - 1][0].id))
|
|
|
|
+ {
|
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("Ðèͨ¹ØÇ°Öùؿ¨");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ MainStoryDataManager.currentLevelCfgId = storyLevelCfg.id;
|
|
|
|
+ InstanceZonesController.ShowLevelView(storyLevelCfg.id, StudioDataManager.Instance.OnFinishStudioStoryLevel);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|