|
@@ -6,9 +6,6 @@ public class FashionShowHomePage : Regist
|
|
|
{
|
|
|
#region Config
|
|
|
|
|
|
- private static int currentPage = 0;
|
|
|
- private static FashionShowType currentType;
|
|
|
-
|
|
|
//StartMark-Used by LabelUtility-Do not remove
|
|
|
private static Text HomeTabButtonText;
|
|
|
private static Text CuteTabButtonText;
|
|
@@ -30,12 +27,17 @@ public class FashionShowHomePage : Regist
|
|
|
private static VirtualScrollRectPlus VividScrollRect;
|
|
|
private static VirtualScrollRectPlus SimpleScrollRect;
|
|
|
private static VirtualScrollRectPlus GloryScrollRect;
|
|
|
- //EndMark-Used by LabelUtility-Do not remove
|
|
|
+ //EndMark-Used by LabelUtility-Do not remove
|
|
|
|
|
|
+ //private static int requestIndex;
|
|
|
+ private static int currentDataIndex;
|
|
|
+ private static int currentPage;
|
|
|
+ private static bool requesting;
|
|
|
+ private static ShowListHttp http;
|
|
|
+ private static FashionShowType currentType;
|
|
|
private static Button CurrentTabButton;
|
|
|
private static VirtualScrollRectPlus CurrentScrollRect;
|
|
|
private static List<GetFashionShowData> CurrentDatas = new List<GetFashionShowData>();
|
|
|
- private static List<GetFashionShowData> CurrentUnusedDatas = new List<GetFashionShowData>();
|
|
|
|
|
|
private static Button OpenHomePageButton;
|
|
|
private static Transform Panel;
|
|
@@ -129,19 +131,12 @@ public class FashionShowHomePage : Regist
|
|
|
SimpleTabButton.onClick.AddListener(() => OnTabButtonClick(SimpleTabButton));
|
|
|
GloryTabButton.onClick.AddListener(() => OnTabButtonClick(GloryTabButton));
|
|
|
|
|
|
- //#NAME.Init()
|
|
|
- //#NAME.OnSaveItem += OnSave#NAMEItem
|
|
|
- //#NAME.OnGetNextItem += OnGetNext#NAMEItem
|
|
|
- //#NAME.OnGetPreviousItem += OnGetPrevious#NAMEItem
|
|
|
- //OnSave#NAMEItem
|
|
|
- //OnGetNext#NAMEItem
|
|
|
- //OnGetPrevious#NAMEItem
|
|
|
- HomeScrollRect.Init(1, 3);
|
|
|
- CuteScrollRect.Init(1, 3);
|
|
|
- GraceScrollRect.Init(1, 3);
|
|
|
- SimpleScrollRect.Init(1, 3);
|
|
|
- VividScrollRect.Init(1, 3);
|
|
|
- GloryScrollRect.Init(1, 3);
|
|
|
+ HomeScrollRect.Init(1, 1000000);
|
|
|
+ CuteScrollRect.Init(1, 1000000);
|
|
|
+ GraceScrollRect.Init(1, 1000000);
|
|
|
+ SimpleScrollRect.Init(1, 1000000);
|
|
|
+ VividScrollRect.Init(1, 1000000);
|
|
|
+ GloryScrollRect.Init(1, 1000000);
|
|
|
HomeScrollRect.OnSaveItem += OnSaveItem;
|
|
|
HomeScrollRect.OnGetNextItem += OnGetNextItem;
|
|
|
HomeScrollRect.OnGetPreviousItem += OnGetPreviousItem;
|
|
@@ -228,13 +223,17 @@ public class FashionShowHomePage : Regist
|
|
|
{
|
|
|
int index = TabButtons.IndexOf(button);
|
|
|
|
|
|
+ requesting = false;
|
|
|
+ currentDataIndex = 0;
|
|
|
currentPage = 0;
|
|
|
currentType = (FashionShowType) index;
|
|
|
-
|
|
|
CurrentTabButton = button;
|
|
|
CurrentScrollRect = ScrollRects[index];
|
|
|
CurrentDatas = TabDatasList[index];
|
|
|
- CurrentUnusedDatas = new List<GetFashionShowData>(CurrentDatas);
|
|
|
+ if (http != null)
|
|
|
+ {
|
|
|
+ http.disable = true;
|
|
|
+ }
|
|
|
|
|
|
AudioManager.PlayClip(ResourceLabel.BtnClip);
|
|
|
for (int i = 0; i < TabButtons.Count; i++)
|
|
@@ -250,6 +249,11 @@ public class FashionShowHomePage : Regist
|
|
|
button.interactable = false;
|
|
|
CurrentScrollRect.transform.parent.SetActive(true);
|
|
|
CurrentScrollRect.SaveAllChild();
|
|
|
+ for (int i = 0; i < Boxes.Count; i++)
|
|
|
+ {
|
|
|
+ DestroyImmediate(Boxes[i].gameObject);
|
|
|
+ }
|
|
|
+ Boxes = new List<FashionShowCloseBox>();
|
|
|
for (int i = 0; i < CurrentDatas.Count; i++)
|
|
|
{
|
|
|
CurrentDatas.RemoveAt(i--);
|
|
@@ -260,7 +264,7 @@ public class FashionShowHomePage : Regist
|
|
|
private static void RefreshCurrentTabPage()
|
|
|
{
|
|
|
if (CurrentScrollRect.content.transform.childCount > 0) return;
|
|
|
- if (CurrentUnusedDatas.Count == 0)
|
|
|
+ if (CurrentDatas.Count == 0)
|
|
|
{
|
|
|
CurrentScrollRect.NextHorizontalPage();
|
|
|
}
|
|
@@ -281,24 +285,30 @@ public class FashionShowHomePage : Regist
|
|
|
|
|
|
private static void OnSaveItem(int index, VirtualScrollRectItem item)
|
|
|
{
|
|
|
- FashionShowCloseBox box = (FashionShowCloseBox) item;
|
|
|
- box.reset();
|
|
|
- Boxes.Remove(box);
|
|
|
- ResourceManager.Save(item);
|
|
|
+ //FashionShowCloseBox box = (FashionShowCloseBox)item;
|
|
|
+ //Boxes.Remove(box);
|
|
|
+ //DestroyImmediate(box.gameObject);
|
|
|
+ //FashionShowCloseBox box = (FashionShowCloseBox) item;
|
|
|
+ //box.reset();
|
|
|
+ //Boxes.Remove(box);
|
|
|
+ //ResourceManager.Save(item);
|
|
|
+ //Debug.Log(Boxes.Count);
|
|
|
}
|
|
|
|
|
|
private static VirtualScrollRectItem OnGetNextItem(int index)
|
|
|
{
|
|
|
- //Debug.Log(CurrentDatas.Count + " " + index);
|
|
|
- if (CurrentUnusedDatas.Count > index)
|
|
|
+ //Debug.LogWarning(Boxes.Count);
|
|
|
+ //Debug.Log(CurrentDatas.Count + " " + currentDataIndex);
|
|
|
+ if (CurrentDatas.Count > currentDataIndex)
|
|
|
{
|
|
|
FashionShowCloseBox closeBox = GetAvailableBox();
|
|
|
+ //Debug.Log(closeBox);
|
|
|
if (closeBox == null)
|
|
|
{
|
|
|
closeBox = ResourceManager.Get(FashionShowCloseBoxLabel.FashionShowCloseBox, Folder.UI, false, CurrentScrollRect.content, false, ObjType.FashionShowCloseBox, typeof(FashionShowCloseBox)).GetComponent<FashionShowCloseBox>();
|
|
|
Boxes.Add(closeBox);
|
|
|
closeBox.Init();
|
|
|
- closeBox.SetNextCell(CurrentUnusedDatas[index]);
|
|
|
+ closeBox.SetNextCell(CurrentDatas[currentDataIndex++]);
|
|
|
if (closeBox.HaveUnusedCell())
|
|
|
{
|
|
|
CurrentScrollRect.NextHorizontalPage();
|
|
@@ -307,7 +317,7 @@ public class FashionShowHomePage : Regist
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- closeBox.SetNextCell(CurrentUnusedDatas[index]);
|
|
|
+ closeBox.SetNextCell(CurrentDatas[currentDataIndex++]);
|
|
|
if (closeBox.HaveUnusedCell())
|
|
|
{
|
|
|
CurrentScrollRect.NextHorizontalPage();
|
|
@@ -317,23 +327,39 @@ public class FashionShowHomePage : Regist
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- List<GetFashionShowData> fashionShowDatas = CurrentDatas;
|
|
|
- ShowListHttp.Get
|
|
|
- (
|
|
|
- HttpManager.GetPlayerId(), currentPage, currentType,
|
|
|
- obj =>
|
|
|
- {
|
|
|
- currentPage++;
|
|
|
- List<GetFashionShowData> datas = (List<GetFashionShowData>) obj;
|
|
|
- RefreshCurrentTabPage();
|
|
|
- fashionShowDatas.AddRange(datas);
|
|
|
- },
|
|
|
- null
|
|
|
- );
|
|
|
+ if (requesting == false)
|
|
|
+ {
|
|
|
+ requesting = true;
|
|
|
+ http = ShowListHttp.Get
|
|
|
+ (
|
|
|
+ HttpManager.GetPlayerId(), currentPage, currentType,
|
|
|
+ OnGetShowListSucceed, OnGetShowListFailed
|
|
|
+ );
|
|
|
+ }
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private static void OnGetShowListSucceed(object obj)
|
|
|
+ {
|
|
|
+ requesting = false;
|
|
|
+ currentPage++;
|
|
|
+ List<GetFashionShowData> datas = (List<GetFashionShowData>) obj;
|
|
|
+ //Debug.Log(datas.Count);
|
|
|
+ RefreshCurrentTabPage();
|
|
|
+ for (int i = 0; i < datas.Count; i++)
|
|
|
+ {
|
|
|
+ GetFashionShowData data = datas[i];
|
|
|
+ CurrentDatas.AddUnique(data, (showData0, showData1) => showData0.showId == showData1.showId);
|
|
|
+ }
|
|
|
+ //Debug.Log(CurrentDatas.Count);
|
|
|
+ }
|
|
|
+
|
|
|
+ private static void OnGetShowListFailed()
|
|
|
+ {
|
|
|
+ requesting = false;
|
|
|
+ }
|
|
|
+
|
|
|
private static VirtualScrollRectItem OnGetPreviousItem(int index)
|
|
|
{
|
|
|
if (index >= 0)
|