LiuQilin 7 years ago
parent
commit
0a1a459870

BIN
Assets/Resource/Sprite/Editor/SpriteUI/我的搭配秀按钮.png


+ 68 - 0
Assets/Resource/Sprite/Editor/SpriteUI/我的搭配秀按钮.png.meta

@@ -0,0 +1,68 @@
+fileFormatVersion: 2
+guid: 1509e1ae708e353448e67e4775f8ccd1
+timeCreated: 1522743656
+licenseType: Pro
+TextureImporter:
+  fileIDToRecycleName: {}
+  serializedVersion: 4
+  mipmaps:
+    mipMapMode: 0
+    enableMipMap: 0
+    sRGBTexture: 1
+    linearTexture: 0
+    fadeOut: 0
+    borderMipMap: 0
+    mipMapFadeDistanceStart: 1
+    mipMapFadeDistanceEnd: 3
+  bumpmap:
+    convertToNormalMap: 0
+    externalNormalMap: 0
+    heightScale: 0.25
+    normalMapFilter: 0
+  isReadable: 0
+  grayScaleToAlpha: 0
+  generateCubemap: 6
+  cubemapConvolution: 0
+  seamlessCubemap: 0
+  textureFormat: 1
+  maxTextureSize: 2048
+  textureSettings:
+    filterMode: -1
+    aniso: -1
+    mipBias: -1
+    wrapMode: 1
+  nPOTScale: 0
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 1
+  spriteExtrude: 1
+  spriteMeshType: 1
+  alignment: 0
+  spritePivot: {x: 0.5, y: 0.5}
+  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+  spritePixelsToUnits: 100
+  alphaUsage: 1
+  alphaIsTransparency: 1
+  spriteTessellationDetail: -1
+  textureType: 8
+  textureShape: 1
+  maxTextureSizeSet: 0
+  compressionQualitySet: 0
+  textureFormatSet: 0
+  platformSettings:
+  - buildTarget: DefaultTexturePlatform
+    maxTextureSize: 2048
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+  spriteSheet:
+    serializedVersion: 2
+    sprites: []
+    outline: []
+  spritePackingTag: 
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

BIN
Assets/Resource/Xlsx/language_config.xlsx


+ 27 - 0
Assets/Script/Extension/ExtList.cs

@@ -160,6 +160,33 @@ public static class ExtList
     }
 
 
+    public static bool AddUnique<T>(this List<T> list, T t, Func<T, T, bool> comparer)
+    {
+        if (!list.HasIdentical(t, comparer))
+        {
+            list.Add(t);
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+    public static bool HasIdentical<T>(this List<T> list, T t, Func<T, T, bool> comparer)
+    {
+        for (int i = 0; i < list.Count; i++)
+        {
+            if (comparer.Invoke(list[i], t))
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+
+
+
     public static void ForEach<T>(this List<T> list, Action<T> action, bool remove = false)
     {
         for (int i = 0; i < list.Count; i++)

+ 9 - 4
Assets/Script/Manage/FashionShowHttp/AddShowHttp.cs

@@ -7,7 +7,7 @@ using UnityEngine;
 
 public class AddShowHttp
 {
-    private static Action succeedCallback;
+    private static Action<object> succeedCallback;
     private static Action failedCallback;
 
     public static void Test()
@@ -24,10 +24,10 @@ public class AddShowHttp
         data.skirt = 0;
         data.shoe = 0;
         data.wing = 0;
-        Add(data, ()=> {Debug.Log("Succeed");}, () => { Debug.Log("Failed"); });
+        Add(data, obj=> {Debug.Log("Succeed");}, () => { Debug.Log("Failed"); });
     }
 
-    public static void Add(FashionShowData data, Action succeedCallback, Action failedCallback)
+    public static void Add(FashionShowData data, Action<object> succeedCallback, Action failedCallback)
     {
         AddShowHttp.succeedCallback = succeedCallback;
         AddShowHttp.failedCallback = failedCallback;
@@ -58,8 +58,13 @@ public class AddShowHttp
         int errorCode = (int) data["error"];
         if (errorCode == 0)
         {
+            JsonData showJsonData = data["info"];
+            GetFashionShowData showData = new GetFashionShowData();
+            showData.title = (string) showJsonData["title"];
+            showData.content = (string) showJsonData["content"];
+            showData.showId = int.Parse((string) showJsonData["id"]);
             if (succeedCallback != null)
-                succeedCallback.Invoke();
+                succeedCallback.Invoke(showData);
         }
         else
         {

+ 17 - 6
Assets/Script/Manage/FashionShowHttp/DeleteShowHttp.cs

@@ -24,20 +24,31 @@ public class DeleteShowHttp
         requestData.Add("u", playerId);
         requestData.Add("s", showId);
 
-        //URLRequest.CreateURLRequest(true, HttpManager.AddShowURL, requestData,
-        //    Callback, URLRequest.Method.POST);
-
-        URLRequest.CreateStrURLRequest(true, HttpManager.DeleteShowURL, requestData,
+        URLRequest.CreateURLRequest(true, HttpManager.DeleteShowURL, requestData,
             Callback, URLRequest.Method.POST);
+
+        //URLRequest.CreateStrURLRequest(true, HttpManager.DeleteShowURL, requestData,
+        //    Callback, URLRequest.Method.POST);
     }
 
     private static void Callback(JsonData data)
     {
-        Debug.Log(data.ToJson());
+        //Debug.Log(data.ToJson());
+        int errorCode = (int)data["error"];
+        if (errorCode == 0)
+        {
+            if (succeedCallback != null)
+                succeedCallback.Invoke();
+        }
+        else
+        {
+            if (failedCallback != null)
+                failedCallback.Invoke();
+        }
     }
 
     private static void Callback(string str)
     {
-        Debug.Log(str);
+        //Debug.Log(str);
     }
 }

+ 26 - 0
Assets/Script/Manage/FashionShowHttp/FashionShowData/GetFashionShowData.cs

@@ -23,6 +23,32 @@ public class GetFashionShowData : FashionShowData
         
     }
 
+    public GetFashionShowData(GetFashionShowData data)
+    {
+        playerId = data.playerId;
+        title = data.title;
+        content = data.content;
+        head = data.head;
+        headwear = data.headwear;
+        eye = data.eye;
+        mouth = data.mouth;
+        top = data.top;
+        skirt = data.skirt;
+        shoe = data.shoe;
+        wing = data.wing;
+
+        showId = data.showId;
+        cuteScore = data.cuteScore;
+        vividScore = data.vividScore;
+        simpleScore = data.simpleScore;
+        graceScore = data.graceScore;
+        gloryScore = data.gloryScore;
+        scoreCnt = data.scoreCnt;
+        praiseCnt = data.praiseCnt;
+        praised = data.praised;
+        playerNickName = data.playerNickName;
+    }
+
     public GetFashionShowData(JsonData data)
     {
         playerId = long.Parse((string) data["user_id"]);

+ 54 - 0
Assets/Script/Manage/FashionShowHttp/ModifyShowHttp.cs

@@ -0,0 +1,54 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using LitJson;
+using UnityEngine;
+
+public class ModifyShowHttp
+{
+    private static Action<object> succeedCallback;
+    private static Action failedCallback;
+
+    public static void Modify(GetFashionShowData data, Action<object> succeedCallback, Action failedCallback)
+    {
+        ModifyShowHttp.succeedCallback = succeedCallback;
+        ModifyShowHttp.failedCallback = failedCallback;
+
+        URLRequestData requestData = new URLRequestData();
+        requestData.Add("u", data.playerId);
+        requestData.Add("s", data.showId);
+        requestData.Add("tl", data.title);
+        requestData.Add("ct", data.content);
+
+        URLRequest.CreateURLRequest(true, HttpManager.ModifyShowURL, requestData,
+            Callback, URLRequest.Method.POST);
+
+        //URLRequest.CreateStrURLRequest(true, HttpManager.ModifyShowURL, requestData,
+        //    Callback, URLRequest.Method.POST);
+    }
+
+    private static void Callback(JsonData data)
+    {
+        bool succeed = data.Inst_Object.ContainsKey("info");
+        if (succeed)
+        {
+            JsonData showJsonData = data["info"];
+            GetFashionShowData showData = new GetFashionShowData();
+            showData.title = (string)showJsonData["title"];
+            showData.content = (string)showJsonData["content"];
+            if (succeedCallback != null)
+                succeedCallback.Invoke(showData);
+        }
+        else
+        {
+            if (failedCallback != null)
+                failedCallback.Invoke();
+        }
+    }
+
+    private static void Callback(string str)
+    {
+        Debug.Log(str);
+    }
+}

+ 12 - 0
Assets/Script/Manage/FashionShowHttp/ModifyShowHttp.cs.meta

@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 7419b2ee997bcc4459d676c8b9116d49
+timeCreated: 1522740028
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 15 - 5
Assets/Script/Manage/FashionShowHttp/PraiseShowHttp.cs

@@ -24,16 +24,26 @@ public class PraiseShowHttp
         requestData.Add("u", playerId);
         requestData.Add("s", showId);
 
-        //URLRequest.CreateURLRequest(true, HttpManager.AddShowURL, requestData,
-        //    Callback, URLRequest.Method.POST);
-
-        URLRequest.CreateStrURLRequest(true, HttpManager.PraiseShowURL, requestData,
+        URLRequest.CreateURLRequest(true, HttpManager.PraiseShowURL, requestData,
             Callback, URLRequest.Method.POST);
+
+        //URLRequest.CreateStrURLRequest(true, HttpManager.PraiseShowURL, requestData,
+        //    Callback, URLRequest.Method.POST);
     }
 
     private static void Callback(JsonData data)
     {
-        Debug.Log(data.ToJson());
+        int errorCode = (int)data["error"];
+        if (errorCode == 0)
+        {
+            if (succeedCallback != null)
+                succeedCallback.Invoke();
+        }
+        else
+        {
+            if (failedCallback != null)
+                failedCallback.Invoke();
+        }
     }
 
     private static void Callback(string str)

+ 14 - 4
Assets/Script/Manage/FashionShowHttp/RateShowHttp.cs

@@ -37,16 +37,26 @@ public class RateShowHttp
         requestData.Add("s4", data.simpleRate);
         requestData.Add("s5", data.gloryRate);
 
-        URLRequest.CreateURLRequest(true, HttpManager.AddShowURL, requestData,
+        URLRequest.CreateURLRequest(true, HttpManager.RateShowURL, requestData,
             Callback, URLRequest.Method.POST);
 
-        URLRequest.CreateStrURLRequest(true, HttpManager.RateShowURL, requestData,
-            Callback, URLRequest.Method.POST);
+        //URLRequest.CreateStrURLRequest(true, HttpManager.RateShowURL, requestData,
+        //    Callback, URLRequest.Method.POST);
     }
 
     private static void Callback(JsonData data)
     {
-        Debug.Log(data.ToJson());
+        int errorCode = (int)data["error"];
+        if (errorCode == 0)
+        {
+            if (succeedCallback != null)
+                succeedCallback.Invoke();
+        }
+        else
+        {
+            if (failedCallback != null)
+                failedCallback.Invoke();
+        }
     }
 
     private static void Callback(string str)

+ 34 - 26
Assets/Script/Manage/FashionShowHttp/ShowListHttp.cs

@@ -7,35 +7,18 @@ using UnityEngine;
 
 public class ShowListHttp
 {
-    private static Action<object> succeedCallback;
-    private static Action failedCallback;
+    public bool disable;
 
-    public static void Test()
-    {
-        Get(1, 0, FashionShowType.All, obj => { Debug.Log("Succeed"); }, () => { Debug.Log("Failed"); });
-    }
+    private Action<object> succeedCallback;
+    private Action failedCallback;
 
-    public static void Get(long playerId, int page, FashionShowType type, Action<object> succeedCallback, Action failedCallback)
+    public void Callback(JsonData data)
     {
-        //Debug.Log(page);
-
-        ShowListHttp.succeedCallback = succeedCallback;
-        ShowListHttp.failedCallback = failedCallback;
-
-        URLRequestData requestData = new URLRequestData();
-        requestData.Add("u", playerId);
-        requestData.Add("p", page);
-        requestData.Add("s", type.GetHashCode());
-
-        URLRequest.CreateURLRequest(true, HttpManager.GetShowListURL, requestData,
-            Callback, URLRequest.Method.POST);
-
-        //URLRequest.CreateStrURLRequest(true, HttpManager.GetShowListURL, requestData,
-        //    Callback, URLRequest.Method.POST);
-    }
+        if (disable)
+        {
+            return;
+        }
 
-    private static void Callback(JsonData data)
-    {
         bool succeed = data.Inst_Object.ContainsKey("list");
 
         if (succeed == false)
@@ -58,8 +41,33 @@ public class ShowListHttp
         }
     }
 
-    private static void Callback(string str)
+    public void Callback(string str)
     {
         Debug.Log(str);
     }
+
+    public static void Test()
+    {
+        Get(1, 0, FashionShowType.All, obj => { Debug.Log("Succeed"); }, () => { Debug.Log("Failed"); });
+    }
+
+    public static ShowListHttp Get(long playerId, int page, FashionShowType type, Action<object> succeedCallback, Action failedCallback)
+    {
+        ShowListHttp http = new ShowListHttp();
+        http.succeedCallback = succeedCallback;
+        http.failedCallback = failedCallback;
+
+        URLRequestData requestData = new URLRequestData();
+        requestData.Add("u", playerId);
+        requestData.Add("p", page);
+        requestData.Add("s", type.GetHashCode());
+
+        URLRequest.CreateURLRequest(true, HttpManager.GetShowListURL, requestData,
+            http.Callback, URLRequest.Method.POST);
+
+        //URLRequest.CreateStrURLRequest(true, HttpManager.GetShowListURL, requestData,
+        //    http.Callback, URLRequest.Method.POST);
+
+        return http;
+    }
 }

+ 1 - 0
Assets/Script/Manage/HttpManager.cs

@@ -173,6 +173,7 @@ public class HttpManager : Regist
     public static string GetPrivateMessageURL = NewBaseURL + "/comment/find";
     public static string LoadFileURL = NewBaseURL + "/index/loadfile";
     public static string AddShowURL = NewBaseURL + "/show/add";
+    public static string ModifyShowURL = NewBaseURL + "/show/modify";
     public static string RateShowURL = NewBaseURL + "/show/score";
     public static string PraiseShowURL = NewBaseURL + "/show/like";
     public static string CommentShowURL = NewBaseURL + "/show/comment";

+ 20 - 19
Assets/Script/Social/FashionShowCloseBox.cs

@@ -6,7 +6,7 @@ public class FashionShowCloseCell
 {
     #region Config
 
-    public bool Praised;
+    //public bool Praised;
     public Text PraiseText;
     public Button PraiseButton;
     public Button ShareButton;
@@ -31,15 +31,7 @@ public class FashionShowCloseCell
     public void Init(float scale, GetFashionShowData data)
     {
         FashionShowData = data;
-        Praised = data.praised;
-        if (Praised)
-        {
-            PraiseButton.image.color = Lib.Pink;
-        }
-        else
-        {
-            PraiseButton.image.color = Color.white;
-        }
+        RefreshPraiseButton();
         PraiseText.text = data.praiseCnt.ToString();
         DisplayButton.transform.SetActive(true);
         Player = PlayerManager.Instance.GetRawPlayer();
@@ -72,20 +64,30 @@ public class FashionShowCloseCell
     private void OnPraiseButtonClick()
     {
         AudioManager.PlayClip(ResourceLabel.BtnClip);
-        if (Praised)
+        FashionShowData.praised = !FashionShowData.praised;
+        if (FashionShowData.praised)
         {
-            Praised = false;
-            PraiseButton.image.color = Color.white;
-            PraiseText.text = (int.Parse(PraiseText.text) - 1).ToString();
-            HttpManager.UnpraiseFashionShow(null, null);
+            FashionShowData.praiseCnt++;
         }
         else
         {
-            Praised = true;
+            FashionShowData.praiseCnt--;
+        }
+        RefreshPraiseButton();
+        PraiseShowHttp.Praise(HttpManager.GetPlayerId(), FashionShowData.showId, null, null);
+    }
+
+    private void RefreshPraiseButton()
+    {
+        if (FashionShowData.praised)
+        {
             PraiseButton.image.color = Lib.Pink;
-            PraiseText.text = (int.Parse(PraiseText.text) + 1).ToString();
-            HttpManager.PraiseFashionShow(null, null);
         }
+        else
+        {
+            PraiseButton.image.color = Color.white;
+        }
+        PraiseText.text = FashionShowData.praiseCnt.ToString();
     }
 
     private void OnDisplayButtonClick()
@@ -173,7 +175,6 @@ public class FashionShowCloseBox : VirtualScrollRectItem
 
     public void SetNextCell(GetFashionShowData data)
     {
-        Debug.Log(data.showId);
         float scale = UnusedCells.Count == 5 ? 37.5f : 17.5f;
         FashionShowCloseCell cell = UnusedCells.Forward(0, true);
         cell.Init(scale, data);

+ 81 - 32
Assets/Script/Social/FashionShowEditPage.cs

@@ -77,7 +77,7 @@ public class FashionShowEditPage : Regist
     private static Transform SimpleSliderBg;
     private static Transform GlorySliderBg;
 
-    private static bool Praised;
+    //private static bool Praised;
     private static bool BelongSelf;
     private static bool LeaveToRateMode;
     public static bool LeaveToHomePage;
@@ -317,7 +317,15 @@ public class FashionShowEditPage : Regist
         FashionTitleInputField.interactable = true;
         FashionContentInputField.interactable = true;
 
-        DeleteButton.SetActive(true);
+        if (FashionShowData.showId == -1)
+        {
+            DeleteButton.SetActive(false);
+        }
+        else
+        {
+            DeleteButton.SetActive(true);
+        }
+
         SaveButton.SetActive(true);
         ResetButton.SetActive(true);
         PraiseButton.SetActive(false);
@@ -347,7 +355,10 @@ public class FashionShowEditPage : Regist
         DeleteButton.SetActive(false);
         SaveButton.SetActive(false);
         ResetButton.SetActive(false);
+
         PraiseButton.SetActive(true);
+        RefreshPraiseButton();
+
         ShareButton.SetActive(true);
         CommentButton.SetActive(true);
         DisplayEditButton.SetActive(BelongSelf);
@@ -427,20 +438,30 @@ public class FashionShowEditPage : Regist
     private static void OnPraiseButtonClick()
     {
         AudioManager.PlayClip(ResourceLabel.BtnClip);
-        if (Praised)
+        FashionShowData.praised = !FashionShowData.praised;
+        if (FashionShowData.praised)
         {
-            Praised = false;
-            PraiseButton.image.color = Color.white;
-            PraiseText.text = (int.Parse(PraiseText.text) - 1).ToString();
-            HttpManager.UnpraiseFashionShow(null, null);
+            FashionShowData.praiseCnt++;
         }
         else
         {
-            Praised = true;
+            FashionShowData.praiseCnt--;
+        }
+        RefreshPraiseButton();
+        PraiseShowHttp.Praise(HttpManager.GetPlayerId(), FashionShowData.showId, null, null);
+    }
+
+    private static void RefreshPraiseButton()
+    {
+        if (FashionShowData.praised)
+        {
             PraiseButton.image.color = Lib.Pink;
-            PraiseText.text = (int.Parse(PraiseText.text) + 1).ToString();
-            HttpManager.PraiseFashionShow(null, null);
         }
+        else
+        {
+            PraiseButton.image.color = Color.white;
+        }
+        PraiseText.text = FashionShowData.praiseCnt.ToString();
     }
 
     private static void OnCommentButtonClick()
@@ -497,22 +518,47 @@ public class FashionShowEditPage : Regist
         }
 
         SaveButton.interactable = false;
-        FashionShowData data = new FashionShowData(FashionShowData);
+        GetFashionShowData data = new GetFashionShowData(FashionShowData);
         data.title = FashionTitleInputField.text;
         data.content = FashionContentInputField.text;
-        AddShowHttp.Add(data, OnSaveSucceedCallback, OnSaveFailedCallback);
+        if (data.showId == -1)
+        {
+            AddShowHttp.Add(data, OnAddSucceedCallback, OnAddFailedCallback);
+        }
+        else
+        {
+            ModifyShowHttp.Modify(data, OnModifySucceedCallback, OnModifyFailedCallback);
+        }
     }
 
-    private static void OnSaveFailedCallback()
+    private static void OnAddFailedCallback()
     {
         SaveButton.interactable = true;
         Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_SaveFailed));
     }
 
-    private static void OnSaveSucceedCallback(/*FashionShowData fashionShowData*/)
+    private static void OnAddSucceedCallback(object obj)
     {
-        //FashionShowData.ShowName = fashionShowData.ShowName;
-        //FashionShowData.ShowContent = fashionShowData.ShowName;
+        GetFashionShowData fashionShowData = (GetFashionShowData) obj;
+        FashionShowData.showId = fashionShowData.showId;
+        FashionShowData.title = fashionShowData.title;
+        FashionShowData.content = fashionShowData.content;
+        SaveButton.interactable = true;
+        Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_SaveSucceed));
+        DeleteButton.SetActive(true);
+    }
+
+    private static void OnModifyFailedCallback()
+    {
+        SaveButton.interactable = true;
+        Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_SaveFailed));
+    }
+
+    private static void OnModifySucceedCallback(object obj)
+    {
+        GetFashionShowData fashionShowData = (GetFashionShowData)obj;
+        FashionShowData.title = fashionShowData.title;
+        FashionShowData.content = fashionShowData.content;
         SaveButton.interactable = true;
         Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_SaveSucceed));
     }
@@ -535,6 +581,7 @@ public class FashionShowEditPage : Regist
             () =>
             {
                 HidePanel();
+                HidePanel();
                 long playerId = HttpManager.GetPlayerId();
                 DeleteShowHttp.Delete(playerId, FashionShowData.showId, null, null);
                 //HttpManager.DeleteFashionShowData();
@@ -588,12 +635,26 @@ public class FashionShowEditPage : Regist
             Bubble.Show(null, Language.GetStr(LanguageLabel.UI__Pg_RateDidntChange));
             return;
         }
+        SubmitRate();
         ShowRateButton();
         AudioManager.PlayClip(ResourceLabel.BtnClip);
         DisableRatePanel();
         ShowRateValue();
     }
 
+    private static void SubmitRate()
+    {
+        ShowRateData data = new ShowRateData();
+        data.showId = FashionShowData.showId;
+        data.playerId = HttpManager.GetPlayerId();
+        data.cuteRate = (int) CuteSlider.value;
+        data.vividRate = (int) VividSlider.value;
+        data.simpleRate = (int) SimpleSlider.value;
+        data.graceRate = (int) GraceSlider.value;
+        data.gloryRate = (int) GlorySlider.value;
+        RateShowHttp.Rate(data, null, null);
+    }
+
     private static bool IsRateChanged()
     {
         if (CuteValue.text == "--")
@@ -607,24 +668,11 @@ public class FashionShowEditPage : Regist
         if (SimpleValue.text == "--")
             return false;
         return true;
-        //int cuteRate = (int) CuteSlider.value;
-        //int vividRate = (int) VividSlider.value;
-        //int gloryRate = (int) GlorySlider.value;
-        //int graceRate = (int) GraceSlider.value;
-        //int simpleRate = (int) SimpleSlider.value;
-        //if (FashionShowData.GetCuteRate() != cuteRate)
-        //    return true;
-        //if (FashionShowData.GetVividRate() != vividRate)
-        //    return true;
-        //if (FashionShowData.GetGloryRate() != gloryRate)
-        //    return true;
-        //if (FashionShowData.GetGraceRate() != graceRate)
-        //    return true;
-        //if (FashionShowData.GetSimpleRate() != simpleRate)
-        //    return true;
-        //return false;
     }
 
+
+
+
     private static void OnResetRateClick()
     {
         ShowRateButton();
@@ -797,6 +845,7 @@ public class FashionShowEditPage : Regist
         AudioManager.PlayClip(ResourceLabel.BtnClip);
 
         GetFashionShowData data = new GetFashionShowData();
+        data.showId = -1;
         data.cuteScore = 0;
         data.gloryScore = 0;
         data.graceScore = 0;

+ 68 - 42
Assets/Script/Social/FashionShowHomePage.cs

@@ -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)