|
@@ -8,6 +8,9 @@ namespace GFGGame
|
|
|
{
|
|
|
public class StudioPropertyView : StudioBaseView
|
|
|
{
|
|
|
+ private int _propertySelectIndex = 0;
|
|
|
+ private int _typeSelectIndex = 0;
|
|
|
+ private int firstOpenProperty = -1;//第一个开放的副本(打开界面时,如未选择副本,则默认选中第一个开启的副本)
|
|
|
//书画副本
|
|
|
public override void Dispose()
|
|
|
{
|
|
@@ -24,20 +27,25 @@ namespace GFGGame
|
|
|
|
|
|
protected override void OnShown()
|
|
|
{
|
|
|
+ firstOpenProperty = -1;
|
|
|
+ _typeSelectIndex = (int)(this.viewData as object[])[0];
|
|
|
+ _propertySelectIndex = (int)(this.viewData as object[])[1];
|
|
|
+ _ui.m_c1.selectedIndex = _typeSelectIndex;
|
|
|
+
|
|
|
StudioDataManager.Instance.VIEW_NAME = typeof(StudioPropertyView).Name;
|
|
|
StudioCfg[] studioCfgs = StudioCfgArray.Instance.GetCfgs(typeof(StudioPropertyView).Name);
|
|
|
- this.studioCfg = studioCfgs[0];
|
|
|
- this.studioData = StudioDataManager.Instance.GetStudioDataById(this.studioCfg.id);
|
|
|
- this.storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgs(this.studioCfg.type, this.studioCfg.subType, this.studioCfg.id);
|
|
|
-
|
|
|
- _ui.m_c1.selectedIndex = (int)(this.viewData as object[])[0];
|
|
|
- StudioDataManager.Instance.TYPE_SELECT_INDEX = _ui.m_c1.selectedIndex;
|
|
|
|
|
|
_ui.m_listProperty.numItems = studioCfgs.Length;
|
|
|
- _ui.m_listProperty.selectedIndex = (int)(this.viewData as object[])[1];
|
|
|
- StudioDataManager.Instance.PROPERTY_SELECT_INDEX = _ui.m_listProperty.selectedIndex;
|
|
|
+ _propertySelectIndex = TimeUtil.CheckDayOfWeek(studioCfgs[_propertySelectIndex].timeArr) ? _propertySelectIndex : firstOpenProperty;
|
|
|
+ _ui.m_listProperty.selectedIndex = _propertySelectIndex;
|
|
|
+
|
|
|
+ this.studioCfg = studioCfgs[_ui.m_listProperty.selectedIndex];
|
|
|
+ this.studioData = StudioDataManager.Instance.GetStudioDataById(this.studioCfg.id);
|
|
|
+ this.storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgs(this.studioCfg.type, this.studioCfg.subType, this.studioCfg.id);
|
|
|
|
|
|
_ui.m_list.numItems = this.storyLevelCfgs.Length;
|
|
|
+ _ui.m_list.ScrollToView(curIndex);
|
|
|
+
|
|
|
base.OnShown();
|
|
|
|
|
|
}
|
|
@@ -54,18 +62,42 @@ namespace GFGGame
|
|
|
}
|
|
|
private void ListPropertyItemRender(int index, GObject obj)
|
|
|
{
|
|
|
+ StudioCfg[] studioCfgs = StudioCfgArray.Instance.GetCfgs(typeof(StudioPropertyView).Name);
|
|
|
GButton item = obj.asButton;
|
|
|
-
|
|
|
- item.data = StudioCfgArray.Instance.GetCfgs(typeof(StudioPropertyView).Name)[index];
|
|
|
+ item.GetChild("icon0").asLoader.url = string.Format("ui://Studio/gzsltb_{0}", index + 1);
|
|
|
+ item.GetChild("icon1").asLoader.url = string.Format("ui://Studio/gzsatb_{0}", index + 1);
|
|
|
+ item.GetChild("icon2").asLoader.url = string.Format("ui://Studio/gzswtb_{0}", index + 1);
|
|
|
+ item.GetChild("icon2").asLoader.visible = TimeUtil.CheckDayOfWeek(studioCfgs[index].timeArr) ? false : true;
|
|
|
+ if (firstOpenProperty < 0 && TimeUtil.CheckDayOfWeek(studioCfgs[index].timeArr)) firstOpenProperty = index;
|
|
|
+ item.data = index;
|
|
|
}
|
|
|
private void OnClickListProperty(EventContext context)
|
|
|
{
|
|
|
- GButton item = (context.data as GObject).asButton;
|
|
|
|
|
|
- this.studioCfg = item.data as StudioCfg;
|
|
|
+ GButton item = (context.data as GObject).asButton;
|
|
|
+ int index = (int)item.data;
|
|
|
+ StudioCfg[] studioCfgs = StudioCfgArray.Instance.GetCfgs(typeof(StudioPropertyView).Name);
|
|
|
+ StudioCfg studioCfg = studioCfgs[index];
|
|
|
+ if (!TimeUtil.CheckDayOfWeek(studioCfg.timeArr))
|
|
|
+ {
|
|
|
+ _ui.m_listProperty.selectedIndex = _propertySelectIndex;
|
|
|
+ string str = "";
|
|
|
+ for (int i = 0; i < studioCfg.timeArr.Length; i++)
|
|
|
+ {
|
|
|
+ str += NumberUtil.GetChiniseNumberWeekText(studioCfg.timeArr[i]);
|
|
|
+ if (i == studioCfg.timeArr.Length - 1) break;
|
|
|
+ str += "、";
|
|
|
+ }
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt(string.Format("周{0}开放", str));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ _propertySelectIndex = index;
|
|
|
+ this.studioCfg = studioCfg;
|
|
|
this.studioData = StudioDataManager.Instance.GetStudioDataById(this.studioCfg.id);
|
|
|
this.storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgs(this.studioCfg.type, this.studioCfg.subType, this.studioCfg.id);
|
|
|
_ui.m_list.numItems = this.storyLevelCfgs.Length;
|
|
|
+ _ui.m_list.ScrollToView(curIndex);
|
|
|
+ UpdateView();
|
|
|
StudioDataManager.Instance.PROPERTY_SELECT_INDEX = _ui.m_listProperty.selectedIndex;
|
|
|
|
|
|
}
|