|
@@ -8,6 +8,9 @@ namespace GFGGame
|
|
|
{
|
|
|
public class StudioPropertyView : StudioBaseView
|
|
|
{
|
|
|
+ // private GList _listProperty;
|
|
|
+
|
|
|
+ private Controller _croProperty;
|
|
|
private int _propertySelectIndex = 0;
|
|
|
private int _typeSelectIndex = 0;
|
|
|
private int firstOpenProperty = -1;//第一个开放的副本(打开界面时,如未选择副本,则默认选中第一个开启的副本)
|
|
@@ -21,30 +24,40 @@ namespace GFGGame
|
|
|
{
|
|
|
base.OnInit();
|
|
|
_ui.m_btnBack.onClick.Add(OnClickBtnBack);
|
|
|
- _ui.m_listProperty.itemRenderer = ListPropertyItemRender;
|
|
|
- _ui.m_listProperty.onClickItem.Add(OnClickListProperty);
|
|
|
+ // _ui.m_listProperty.itemRenderer = ListPropertyItemRender;
|
|
|
+ // _ui.m_listProperty.onClickItem.Add(OnClickListProperty);
|
|
|
}
|
|
|
|
|
|
protected override void OnShown()
|
|
|
{
|
|
|
- firstOpenProperty = -1;
|
|
|
- _typeSelectIndex = this.viewData == null ? 1 : (int)(this.viewData as object[])[0];
|
|
|
- _propertySelectIndex = this.viewData == null ? 0 : (int)(this.viewData as object[])[1];
|
|
|
- _ui.m_c1.selectedIndex = _typeSelectIndex;
|
|
|
+ GComponent com = UIPackage.CreateObject(UI_StudioUI.PACKAGE_NAME, "ComProperty").asCom;
|
|
|
+ this.AddChildCom(com);
|
|
|
+ _croProperty = com.GetController("c1");
|
|
|
+ _croProperty.onChanged.Add(OnControllerChange);
|
|
|
+
|
|
|
+ _propertySelectIndex = this.viewData == null ? 0 : (int)this.viewData;
|
|
|
|
|
|
StudioDataManager.Instance.VIEW_NAME = typeof(StudioPropertyView).FullName;
|
|
|
List<StudioCfg> studioCfgs = StudioCfgArray.Instance.GetCfgsByfunId(typeof(StudioPropertyView).Name);
|
|
|
+ firstOpenProperty = -1;
|
|
|
+ for (int i = 0; i < studioCfgs.Count; i++)
|
|
|
+ {
|
|
|
+ GButton btn = com.GetChild("btn" + i).asButton;
|
|
|
+ bool isOpen = TimeUtil.CheckDayOfWeek(studioCfgs[i].timeArr) ? true : false;
|
|
|
+ btn.GetChild("icon").visible = isOpen;
|
|
|
+ if (firstOpenProperty < 0 && isOpen) firstOpenProperty = i;
|
|
|
+ }
|
|
|
|
|
|
- _ui.m_listProperty.numItems = studioCfgs.Count;
|
|
|
_propertySelectIndex = TimeUtil.CheckDayOfWeek(studioCfgs[_propertySelectIndex].timeArr) ? _propertySelectIndex : firstOpenProperty;
|
|
|
- _ui.m_listProperty.selectedIndex = _propertySelectIndex;
|
|
|
+ _croProperty.selectedIndex = _propertySelectIndex;
|
|
|
+ StudioDataManager.Instance.PROPERTY_SELECT_INDEX = _propertySelectIndex;
|
|
|
|
|
|
- this.studioCfg = studioCfgs[_ui.m_listProperty.selectedIndex];
|
|
|
+ this.studioCfg = studioCfgs[_propertySelectIndex];
|
|
|
this.studioData = StudioDataManager.Instance.GetStudioDataById(this.studioCfg.id);
|
|
|
this.storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(this.studioCfg.type, this.studioCfg.subType, this.studioCfg.id);
|
|
|
|
|
|
- _ui.m_list.numItems = this.storyLevelCfgs.Count;
|
|
|
- _ui.m_list.ScrollToView(curIndex);
|
|
|
+ list.numItems = this.storyLevelCfgs.Count;
|
|
|
+ list.ScrollToView(curIndex);
|
|
|
|
|
|
base.OnShown();
|
|
|
|
|
@@ -60,27 +73,55 @@ namespace GFGGame
|
|
|
{
|
|
|
ViewManager.GoBackFrom(typeof(StudioPropertyView).FullName);
|
|
|
}
|
|
|
- private void ListPropertyItemRender(int index, GObject obj)
|
|
|
- {
|
|
|
- List<StudioCfg> studioCfgs = StudioCfgArray.Instance.GetCfgsByfunId(typeof(StudioPropertyView).Name);
|
|
|
- GButton item = obj.asButton;
|
|
|
- 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)
|
|
|
- {
|
|
|
+ // private void ListPropertyItemRender(int index, GObject obj)
|
|
|
+ // {
|
|
|
+ // List<StudioCfg> studioCfgs = StudioCfgArray.Instance.GetCfgsByfunId(typeof(StudioPropertyView).Name);
|
|
|
+ // GButton item = obj.asButton;
|
|
|
+ // 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;
|
|
|
+ // int index = (int)item.data;
|
|
|
+ // List<StudioCfg> studioCfgs = StudioCfgArray.Instance.GetCfgsByfunId(typeof(StudioPropertyView).Name);
|
|
|
+ // StudioCfg studioCfg = studioCfgs[index];
|
|
|
+ // if (!TimeUtil.CheckDayOfWeek(studioCfg.timeArr))
|
|
|
+ // {
|
|
|
+ // _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.GetCfgsBytypeAndsubTypeAndchapterId(this.studioCfg.type, this.studioCfg.subType, this.studioCfg.id);
|
|
|
+ // list.numItems = this.storyLevelCfgs.Count;
|
|
|
+ // list.ScrollToView(curIndex);
|
|
|
+ // UpdateView();
|
|
|
+ // StudioDataManager.Instance.PROPERTY_SELECT_INDEX = _listProperty.selectedIndex;
|
|
|
|
|
|
- GButton item = (context.data as GObject).asButton;
|
|
|
- int index = (int)item.data;
|
|
|
+ // }
|
|
|
+
|
|
|
+ private void OnControllerChange()
|
|
|
+ {
|
|
|
+ // int index = _croProperty.selectedIndex;
|
|
|
List<StudioCfg> studioCfgs = StudioCfgArray.Instance.GetCfgsByfunId(typeof(StudioPropertyView).Name);
|
|
|
- StudioCfg studioCfg = studioCfgs[index];
|
|
|
+ StudioCfg studioCfg = studioCfgs[_croProperty.selectedIndex];
|
|
|
if (!TimeUtil.CheckDayOfWeek(studioCfg.timeArr))
|
|
|
{
|
|
|
- _ui.m_listProperty.selectedIndex = _propertySelectIndex;
|
|
|
string str = "";
|
|
|
for (int i = 0; i < studioCfg.timeArr.Length; i++)
|
|
|
{
|
|
@@ -89,17 +130,17 @@ namespace GFGGame
|
|
|
str += "、";
|
|
|
}
|
|
|
PromptController.Instance.ShowFloatTextPrompt(string.Format("周{0}开放", str));
|
|
|
+ _croProperty.selectedIndex = _croProperty.previsousIndex;
|
|
|
return;
|
|
|
}
|
|
|
- _propertySelectIndex = index;
|
|
|
+ // _propertySelectIndex = index;
|
|
|
this.studioCfg = studioCfg;
|
|
|
this.studioData = StudioDataManager.Instance.GetStudioDataById(this.studioCfg.id);
|
|
|
this.storyLevelCfgs = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(this.studioCfg.type, this.studioCfg.subType, this.studioCfg.id);
|
|
|
- _ui.m_list.numItems = this.storyLevelCfgs.Count;
|
|
|
- _ui.m_list.ScrollToView(curIndex);
|
|
|
+ list.numItems = this.storyLevelCfgs.Count;
|
|
|
+ list.ScrollToView(curIndex);
|
|
|
UpdateView();
|
|
|
- StudioDataManager.Instance.PROPERTY_SELECT_INDEX = _ui.m_listProperty.selectedIndex;
|
|
|
-
|
|
|
+ StudioDataManager.Instance.PROPERTY_SELECT_INDEX = _croProperty.selectedIndex;
|
|
|
}
|
|
|
}
|
|
|
}
|