LiuQilin 8 лет назад
Родитель
Сommit
ee4a8183aa

+ 9 - 0
Assets/Editor.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 5fcd7f3618d0f154995b49930421ea1b
+folderAsset: yes
+timeCreated: 1501174341
+licenseType: Pro
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/Plugins/metro/UWP.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: b3a793fc2ce8625488a5576817135789
+folderAsset: yes
+timeCreated: 1501174341
+licenseType: Pro
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 9 - 0
Assets/Plugins/metro/WindowsPhone81.meta

@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: ea89367846fcf554188c49cca742be04
+folderAsset: yes
+timeCreated: 1501174341
+licenseType: Pro
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 1 - 1
Assets/Resource/Logo.unity

@@ -568,7 +568,7 @@ Prefab:
     - target: {fileID: 224814127152008004, guid: 718ebdaed223e93409d6dc7e53a23167,
         type: 2}
       propertyPath: m_RootOrder
-      value: 1
+      value: 0
       objectReference: {fileID: 0}
     - target: {fileID: 224814127152008004, guid: 718ebdaed223e93409d6dc7e53a23167,
         type: 2}

+ 2 - 2
Assets/Resource/Prefab/Object/Chest.prefab

@@ -52,8 +52,8 @@ Transform:
   m_PrefabInternal: {fileID: 100100000}
   m_GameObject: {fileID: 1658220073256390}
   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
-  m_LocalPosition: {x: -6, y: 0.8, z: -5}
-  m_LocalScale: {x: 0.5, y: 0.5, z: 1}
+  m_LocalPosition: {x: 0, y: -0.95, z: -0.1825}
+  m_LocalScale: {x: 0.6, y: 0.6, z: 1}
   m_Children:
   - {fileID: 4645995457566464}
   m_Father: {fileID: 0}

+ 5 - 5
Assets/Resource/Prefab/Object/Page.prefab

@@ -675,7 +675,7 @@ Transform:
   m_PrefabInternal: {fileID: 100100000}
   m_GameObject: {fileID: 1212623043079770}
   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
-  m_LocalPosition: {x: 3.5, y: -2.1, z: -0.1}
+  m_LocalPosition: {x: 3.5, y: -2.1, z: -0.11}
   m_LocalScale: {x: 0.75, y: 0.75, z: 0.75}
   m_Children:
   - {fileID: 4924500101640946}
@@ -744,7 +744,7 @@ Transform:
   m_PrefabInternal: {fileID: 100100000}
   m_GameObject: {fileID: 1232187855820768}
   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
-  m_LocalPosition: {x: 7.1, y: -2.1, z: -0.1}
+  m_LocalPosition: {x: 7.1, y: -2.1, z: -0.11}
   m_LocalScale: {x: 0.75, y: 0.75, z: 0.75}
   m_Children:
   - {fileID: 4270161711280264}
@@ -795,7 +795,7 @@ Transform:
   m_PrefabInternal: {fileID: 100100000}
   m_GameObject: {fileID: 1213102972776782}
   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
-  m_LocalPosition: {x: -3.7, y: -2.1, z: -0.1}
+  m_LocalPosition: {x: -3.7, y: -2.1, z: -0.11}
   m_LocalScale: {x: 0.75, y: 0.75, z: 0.75}
   m_Children:
   - {fileID: 4906063488618624}
@@ -823,7 +823,7 @@ Transform:
   m_PrefabInternal: {fileID: 100100000}
   m_GameObject: {fileID: 1209372422394468}
   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
-  m_LocalPosition: {x: -0.1, y: -2.1, z: -0.1}
+  m_LocalPosition: {x: -0.1, y: -2.1, z: -0.11}
   m_LocalScale: {x: 0.75, y: 0.75, z: 0.75}
   m_Children:
   - {fileID: 4444309442525180}
@@ -891,7 +891,7 @@ Transform:
   m_PrefabInternal: {fileID: 100100000}
   m_GameObject: {fileID: 1565542696011734}
   m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
-  m_LocalPosition: {x: -7.3, y: -2.1, z: -0.1}
+  m_LocalPosition: {x: -7.3, y: -2.1, z: -0.11}
   m_LocalScale: {x: 0.75, y: 0.75, z: 0.75}
   m_Children:
   - {fileID: 4685721866237570}

+ 4 - 4
Assets/Resource/Prefab/PrefabUI/GroupE.prefab

@@ -3017,7 +3017,7 @@ MonoBehaviour:
     m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
       Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
   m_FontData:
-    m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
+    m_Font: {fileID: 12800000, guid: 0e86defab91f2fb4189708f6dde11005, type: 3}
     m_FontSize: 14
     m_FontStyle: 2
     m_BestFit: 0
@@ -3527,11 +3527,11 @@ MonoBehaviour:
     m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
       Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
   m_FontData:
-    m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
-    m_FontSize: 14
+    m_Font: {fileID: 12800000, guid: 0e86defab91f2fb4189708f6dde11005, type: 3}
+    m_FontSize: 18
     m_FontStyle: 0
     m_BestFit: 0
-    m_MinSize: 10
+    m_MinSize: 1
     m_MaxSize: 40
     m_Alignment: 0
     m_AlignByGeometry: 0

+ 2 - 0
Assets/Resource/XML/lan/ChineseSimplified.xml

@@ -116,6 +116,8 @@
     <Q_CommentLab desc=""><![CDATA[留言]]></Q_CommentLab>
     <Q_CloseLab desc=""><![CDATA[关闭]]></Q_CloseLab>
     <Q_CommentTip desc=""><![CDATA[每条留言发送时间间隔为30秒]]></Q_CommentTip>
+    <Q_CommentDone desc=""><![CDATA[发送成功]]></Q_CommentDone>
+    <Q_CommentFail desc=""><![CDATA[发送失败]]></Q_CommentFail>
     <N_Lab desc=""><![CDATA[去试衣间看看吧!]]></N_Lab>
     <I_Lab desc=""><![CDATA[加载中]]></I_Lab>
     <热卖 desc=""><![CDATA[热卖]]></热卖>

+ 2 - 0
Assets/Resource/XML/lan/ChineseTraditional.xml

@@ -116,6 +116,8 @@
     <Q_CommentLab desc=""><![CDATA[]]></Q_CommentLab>
     <Q_CloseLab desc=""><![CDATA[]]></Q_CloseLab>
     <Q_CommentTip desc=""><![CDATA[]]></Q_CommentTip>
+    <Q_CommentDone desc=""><![CDATA[]]></Q_CommentDone>
+    <Q_CommentFail desc=""><![CDATA[]]></Q_CommentFail>
     <N_Lab desc=""><![CDATA[去試衣間看看吧!]]></N_Lab>
     <I_Lab desc=""><![CDATA[加載中]]></I_Lab>
     <热卖 desc=""><![CDATA[熱賣]]></热卖>

+ 2 - 0
Assets/Resource/XML/lan/English.xml

@@ -116,6 +116,8 @@ Program 水怪
     <Q_CommentLab desc=""><![CDATA[]]></Q_CommentLab>
     <Q_CloseLab desc=""><![CDATA[]]></Q_CloseLab>
     <Q_CommentTip desc=""><![CDATA[]]></Q_CommentTip>
+    <Q_CommentDone desc=""><![CDATA[]]></Q_CommentDone>
+    <Q_CommentFail desc=""><![CDATA[]]></Q_CommentFail>
     <N_Lab desc=""><![CDATA[Go to your dress room!]]></N_Lab>
     <I_Lab desc=""><![CDATA[Loading]]></I_Lab>
     <热卖 desc=""><![CDATA[Most Popular]]></热卖>

BIN
Assets/Resource/Xlsx/language_config.xlsx


+ 0 - 2
Assets/Script/Manage/Initializer.cs

@@ -165,8 +165,6 @@ public class Initializer : MonoBehaviour
 
         Complete = true;
 
-        ManaServer.GetComment(ManaServer.SerialNumber, "0", CommentType.Garden, data => { ManaSocial.InputCommentData(true, data); });
-
         ManaPlayer.InitializeDressRoom();
 
         GameObject.Find("I_Lab").GetComponent<Text>().text = "Error code : 7";

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

@@ -1003,6 +1003,7 @@ public class ManaCenter : Regist
         }
 
         ManaServer.PackTypeRequest();
+        ManaSocial.UpdatePage(true);
 
         if (ManaServer.Connect)
         {

+ 3 - 19
Assets/Script/Manage/ManaReso.cs

@@ -596,35 +596,19 @@ public class ManaReso : Regist
 
     public static Chest GetChest()
     {
-        int slotIndex = Random.Range(0, 9);
-
-        bool forceLeft = slotIndex == 3 || slotIndex == 8;
-        bool forceRight = slotIndex == 0 || slotIndex == 4;
-
-        slotIndex += Garden.CurPage * 9;
-
-
-        Slot slot = ManaGarden.SlotList[slotIndex];
-
-        Vector3 pos = slot.transform.position;
-
-        pos.z = -0.35f + Random.Range(-0.01f, 0.01f);
-
-        Transform tra = Get("Chest", Folder.Scene, false, null, pos, ObjType.Chest);
+        Transform tra = Get("Chest", Folder.Scene, false, Get("GardenPage"), true, ObjType.Chest);
 
         Chest chest = tra.GetComponent<Chest>();
 
-        tra.parent = slot.transform;
-
         if (chest == null)
         {
             chest = tra.AddComponent<Chest>();
 
-            chest.Initialize(pos.y, forceLeft, forceRight);
+            chest.Initialize(tra.position.y, false, false);
         }
         else
         {
-            chest.Initialize(pos.y, forceLeft, forceRight);
+            chest.Initialize(tra.position.y, false, false);
         }
 
         return chest;

+ 18 - 1
Assets/Script/Manage/ManaServer.cs

@@ -300,7 +300,24 @@ public class ManaServer : Regist
         urlData.Add("i", content);
         urlData.Add("t", type.GetHashCode());
 
-        URLRequest.CreateURLRequest("https://garden.dashgame.com/index.php/home/comment/comment", urlData, (data)=> {}, URLRequest.Method.POST);
+        URLRequest.CreateStrURLRequest
+        (
+            "https://garden.dashgame.com/index.php/home/comment/comment",
+            urlData,
+            data =>
+            {
+                if (data == "{\"error\":0}")
+                {
+                    Bubble.Show(Language.GetStr("UI", "Q_CommentDone"));
+                    ManaSocial.UpdatePage(false);
+                }
+                else
+                {
+                    Bubble.Show(Language.GetStr("UI", "Q_CommentFail"));
+                }
+            },
+            URLRequest.Method.POST
+        );
     }
 
     public static void GetComment(string id, string page, CommentType type, Action<JsonData> callback)

+ 333 - 58
Assets/Script/Manage/ManaSocial.cs

@@ -1,28 +1,44 @@
-using System;
-using UnityEngine;
+using UnityEngine;
 using UnityEngine.UI;
+using UnityEngine.EventSystems;
 
+using System;
 using System.Collections;
 using System.Collections.Generic;
 
 using LitJson;
-using UnityEngine.EventSystems;
 
 public class ManaSocial : Regist 
 {
     #region Variable
 
-    public static int LastCommentIndex;
-    public static int FirstCommentIndex;
+    public static int RecordLastIndex;
+    public static int RecordFirstIndex;
+    public static bool RecordFlag;
+    public static Vector3 RecordPosition;
+
+    public static bool IsPlayer;
+    public static bool PullLock;
+    public static bool UpdateLock;
+    public static bool IsPanelOpen;
+
+    public static int PlayerLastIndex=-1;
+    public static int VisiteeLastIndex=-1;
+    public static int PlayerFirstIndex;
+    public static int VisiteeFirstIndex;
+    public static int PlayerCommentPage;
+    public static int VisiteeCommentPage;
 
     public static Text PraiseText;
     public static Button PraiseBtn;
+    public static DateTime CommentTime;
+    public static InputField InputField;
     public static ScrollRectPlus ScrollRectPlus;
 
-    public static bool IsPlayer;
-    public static float PraiseTimer;
-    public static List<List<string>> PlayerCommentDatas;
-    public static List<List<string>> VisiteeCommentDatas;
+    public static float PraiseTimer = 5;
+    public static float CommentTimer = 0;
+    public static List<List<string>> PlayerCommentDatas = new List<List<string>>();
+    public static List<List<string>> VisiteeCommentDatas = new List<List<string>>();
 
     #endregion
 
@@ -33,14 +49,29 @@ public class ManaSocial : Regist
             return;
         }
 
+        CommentTimer += Time.deltaTime;
+
+        if (CommentTimer >= 10)
+        {
+            CommentTimer = 0;
+
+            if (!IsPanelOpen)
+            {
+                UpdatePage(true);
+            }
+        }
+
         PraiseTimer += Time.deltaTime;
 
-        if (PraiseTimer >= 10)
+        if (PraiseTimer >= 5)
         {
+            //index += 1;
+            //Debug.Log(index);
+            //ManaServer.AddComment(ManaServer.SerialNumber, ManaServer.SerialNumber, index.ToString(), CommentType.Garden);
+
             PraiseTimer = 0;
 
             PraiseText.text = ManaServer.PraiseAmt.ToString();
-            ManaServer.GetComment(ManaServer.SerialNumber, "0", CommentType.Garden, data => { InputCommentData(true, data); });
         }
     }
 
@@ -48,6 +79,7 @@ public class ManaSocial : Regist
     {
         PraiseText = ManaReso.Get<Text>("C_PraiseText");
         PraiseBtn = ManaReso.Get<Button>("C_Praise");
+        InputField = ManaReso.Get<InputField>("Q_InputField");
         ScrollRectPlus = ManaReso.Get<ScrollRectPlus>("Q_ScrollRect");
 
         ScrollRectPlus.onValueChanged.AddListener(OnScroll);
@@ -85,9 +117,28 @@ public class ManaSocial : Regist
 
     public static void InputCommentData(bool isPlayer, JsonData jsonData)
     {
+        Auxiliary.Instance.DelayCall
+        (
+            () =>
+            {
+                PullLock = false;
+            },
+            1
+        );
+
+        if (!jsonData.Inst_Object.ContainsKey("l"))
+        {
+            return;
+        }
+
+        if (jsonData["l"].Count == 0)
+        {
+            return;
+        }
+
         if (isPlayer)
         {
-            PlayerCommentDatas = new List<List<string>>();
+            PlayerCommentPage++;
 
             foreach (JsonData commentData in jsonData["l"])
             {
@@ -96,7 +147,7 @@ public class ManaSocial : Regist
         }
         else
         {
-            VisiteeCommentDatas = new List<List<string>>();
+            VisiteeCommentPage++;
 
             foreach (JsonData commentData in jsonData["l"])
             {
@@ -105,104 +156,328 @@ public class ManaSocial : Regist
         }
     }
 
-    public static void InitializeCommentPanel(bool isPlayer)
+
+    public static void NextPage(bool isPlayer, bool isDownload)
     {
-        for (int i = 0; i < ManaReso.Get("Q_Grid").childCount; i++)
+        Debug.Log("NextPage");
+        if (isPlayer)
+        {
+            int saveAmt = 0;
+            int updateAmt = Mathf.Min(15, PlayerCommentDatas.Count - PlayerLastIndex - 1);
+
+            for (int i = 0; i < updateAmt; i++)
+            {
+                if (ScrollRectPlus.content.childCount >= 20)
+                {
+                    saveAmt++;
+                    ManaReso.Save(ScrollRectPlus.content.GetChild(0).gameObject);
+                    PlayerFirstIndex++;
+                }
+
+                PlayerLastIndex++;
+
+                ManaReso.GetCommentItem(PlayerCommentDatas[PlayerLastIndex][0], PlayerCommentDatas[PlayerLastIndex][1]);
+            }
+
+            int offset = isDownload ? 1 : 0;
+            float scaleFactor = isDownload ? ScrollRectPlus.GetComponent<Image>().canvas.scaleFactor : 1;
+
+            if (saveAmt > 0)
+            {
+                ScrollRectPlus.content.position += new Vector3(0, -(saveAmt - offset) * 120 * scaleFactor, 0);
+                ScrollRectPlus.AddContentOffset(new Vector3(0, -(saveAmt - offset) * 120 * scaleFactor, 0));
+            }
+        }
+        else
         {
-            ManaReso.Save(ManaReso.Get("Q_Grid").GetChild(i));
+            int saveAmt = 0;
+            int updateAmt = Mathf.Min(15, VisiteeCommentDatas.Count - VisiteeLastIndex - 1);
+
+            for (int i = 0; i < updateAmt; i++)
+            {
+                if (ScrollRectPlus.content.childCount >= 20)
+                {
+                    saveAmt++;
+                    ManaReso.Save(ScrollRectPlus.content.GetChild(0).gameObject);
+                    VisiteeFirstIndex++;
+                }
+
+                VisiteeLastIndex++;
+
+                ManaReso.GetCommentItem(VisiteeCommentDatas[VisiteeLastIndex][0], VisiteeCommentDatas[VisiteeLastIndex][1]);
+            }
+
+            int offset = isDownload ? 1 : 0;
+            float scaleFactor = isDownload ? ScrollRectPlus.GetComponent<Image>().canvas.scaleFactor : 1;
+
+            if (saveAmt > 0)
+            {
+                ScrollRectPlus.content.position += new Vector3(0, -(saveAmt - offset) * 120 * scaleFactor, 0);
+                ScrollRectPlus.AddContentOffset(new Vector3(0, -(saveAmt - offset) * 120 * scaleFactor, 0));
+            }
         }
+    }
 
+    public static void PreviousPage(bool isPlayer)
+    {
         if (isPlayer)
         {
-            IsPlayer = true;
-            GetCommentItem(6, PlayerCommentDatas);
+            if (PlayerCommentDatas.Count > 20 && PlayerFirstIndex > 0)
+            {
+                int revertAmt = Mathf.Min(15, PlayerFirstIndex);
+                Debug.Log("PreviousPage");
+                for (int i = 0; i < revertAmt; i++)
+                {
+                    ManaReso.Save(ScrollRectPlus.content.GetChild(19));
+                    CommentItem commentItem = ManaReso.GetCommentItem(PlayerCommentDatas[PlayerFirstIndex - 1][0], PlayerCommentDatas[PlayerFirstIndex - 1][1]);
+                    commentItem.transform.SetAsFirstSibling();
+
+                    PlayerLastIndex--;
+                    PlayerFirstIndex--;
+                }
+
+                if (revertAmt > 0)
+                {
+                    ScrollRectPlus.content.position += new Vector3(0, revertAmt*120, 0);
+                    ScrollRectPlus.AddContentOffset(new Vector3(0, revertAmt*120, 0));
+                }
+            }
         }
         else
         {
-            IsPlayer = false;
-            GetCommentItem(6, VisiteeCommentDatas);
-        }  
+            if (VisiteeCommentDatas.Count > 20 && VisiteeFirstIndex > 0)
+            {
+                int revertAmt = Mathf.Min(15, VisiteeFirstIndex);
+                Debug.Log("Revertpage");
+                for (int i = 0; i < revertAmt; i++)
+                {
+                    ManaReso.Save(ScrollRectPlus.content.GetChild(19));
+                    CommentItem commentItem = ManaReso.GetCommentItem(VisiteeCommentDatas[VisiteeFirstIndex - 1][0], VisiteeCommentDatas[VisiteeFirstIndex - 1][1]);
+                    commentItem.transform.SetAsFirstSibling();
+
+                    VisiteeLastIndex--;
+                    VisiteeFirstIndex--;
+                }
+
+                if (revertAmt > 0)
+                {
+                    ScrollRectPlus.content.position += new Vector3(0, revertAmt * 120, 0);
+                    ScrollRectPlus.AddContentOffset(new Vector3(0, revertAmt * 120, 0));
+                }
+            }
+        }
     }
 
-    public static void UpdateCommentPanel(int direction)
+
+    public static void PullPage(bool isPlayer)
     {
-        if (IsPlayer)
+        PullLock = true;
+        UpdateLock = false;
+        Debug.Log("PullPage");
+
+        if (isPlayer)
         {
-            UpdateCommentItem(direction, PlayerCommentDatas);
+            ManaServer.GetComment
+            (
+                ManaServer.SerialNumber,
+                (PlayerCommentPage + 1).ToString(),
+                CommentType.Garden,
+                data =>
+                {
+                    if (!UpdateLock)
+                    {
+                        InputCommentData(IsPlayer, data);
+                        NextPage(IsPlayer, true);
+                    }
+                    else
+                    {
+                        PullLock = false;
+                    }
+                }
+            );
         }
         else
         {
-            UpdateCommentItem(direction, VisiteeCommentDatas);
+            ManaServer.GetComment
+            (
+                ManaServer.SerialNumber,
+                (VisiteeCommentPage + 1).ToString(),
+                CommentType.Garden,
+                data =>
+                {
+                    if (!UpdateLock)
+                    {
+                        InputCommentData(IsPlayer, data);
+                        NextPage(IsPlayer, true);
+                    }
+                    else
+                    {
+                        PullLock = false;
+                    }
+                }
+            );
         }
     }
 
-    public static void GetCommentItem(int amt, List<List<string>> commentDatas)
+    public static void ClearComment()
     {
-        if (commentDatas == null)
-        {
-            return;
-        }
+        int childAmt = ScrollRectPlus.content.childCount;
 
-        for (int i = 0; i < amt; i++)
+        for (int i = 0; i < childAmt; i++)
         {
-            if (i < PlayerCommentDatas.Count)
-            {
-                FirstCommentIndex = 0;
-                LastCommentIndex = i;
-                ManaReso.GetCommentItem(PlayerCommentDatas[i][0], PlayerCommentDatas[i][1]);
-            }
+            ManaReso.Save(ScrollRectPlus.content.GetChild(0));
         }
+
+        ScrollRectPlus.verticalNormalizedPosition = 1;
     }
 
-    public static void UpdateCommentItem(int direction, List<List<string>> commentDatas)
+    public static void UpdatePage(bool isPlayer)
     {
-        if (commentDatas.Count-1 == LastCommentIndex)
+        UpdateLock = true;
+
+        ClearComment();
+
+        if (isPlayer)
         {
-            return;
-        }
+            Debug.Log("UpdatePlayer");
+
+            PlayerFirstIndex = 0;
+            PlayerLastIndex = -1;
+            PlayerCommentPage = 0;
+            PlayerCommentDatas = new List<List<string>>();
 
-        LastCommentIndex += 1;
+            ManaServer.GetComment(ManaServer.SerialNumber, "1", CommentType.Garden, data => { InputCommentData(true, data); NextPage(true, true); });
+        }
+        else
+        {
+            Debug.Log("UpdateVisitee");
 
-        ManaReso.Save(ManaReso.Get("Q_Grid").GetChild(0).gameObject);
-        ManaReso.GetCommentItem(commentDatas[LastCommentIndex][0], commentDatas[LastCommentIndex][1]);
+            VisiteeFirstIndex = 0;
+            VisiteeLastIndex = -1;
+            VisiteeCommentPage = 0;
+            VisiteeCommentDatas = new List<List<string>>();
 
-        ScrollRectPlus.AddContentOffset(new Vector2(0, -120));
+            ManaServer.GetComment(ManaVisit.VisiteeSerialNumber, "1", CommentType.Garden, data => { InputCommentData(false, data); NextPage(false, true); });
+        }
     }
 
-    static bool Lock;
+
     public static void OnScroll(Vector2 position)
     {
-        if (Lock)
+        if (PullLock)
         {
             return;
         }
 
-        if (position.y < 0.5f)
+        if (position.y >= 1)
+        {
+            PreviousPage(IsPlayer);
+        }
+
+        if (position.y <= 0)
         {
-            Lock = true;
-            UpdateCommentPanel(1);
+            if (IsPlayer)
+            {
+                if (PlayerLastIndex == PlayerCommentDatas.Count - 1)
+                {
+                    PullPage(true);
+                }
+                else if (PlayerLastIndex < PlayerCommentDatas.Count - 1)
+                {
+                    NextPage(true, false);
+                }
+            }
+            else
+            {
+                if (VisiteeLastIndex == VisiteeCommentDatas.Count - 1)
+                {
+                    PullPage(false);
+                }
+                else if (VisiteeLastIndex < VisiteeCommentDatas.Count - 1)
+                {
+                    NextPage(false, false);
+                }
+            }
         }
     }
 
 
-    public static void OpenCommentPanel()
+    public static void Comment()
     {
-        ManaReso.Get("Q_CommentBK").TweenForCG();
-
-        ManaReso.SetActive("Q_InputBK", ManaVisit.InVisit);
-
-        if (ManaVisit.InVisit)
+        if ((DateTime.Now - CommentTime).TotalSeconds > 30)
         {
-            InitializeCommentPanel(false);    
+            CommentTime = DateTime.Now;
+
+            ManaServer.AddComment(ManaServer.SerialNumber, ManaVisit.VisiteeSerialNumber, InputField.text, CommentType.Garden);
         }
         else
         {
-            InitializeCommentPanel(true);
+            Bubble.Show(Language.GetStr("UI", "Q_CommentTip"));
         }
     }
 
+    public static void OpenCommentPanel()
+    {
+        ManaReso.Get("Q_CommentBK").TweenForCG();
+
+        ManaReso.SetActive("Q_InputBK", ManaVisit.InVisit);
+
+        IsPlayer = !ManaVisit.InVisit;
+        IsPanelOpen = true;
+    }
+
     public static void CloseCommentPanel()
     {
         ManaReso.Get("Q_CommentBK").TweenBacCG();
+        IsPanelOpen = false;
+    }
+
+
+    public static void Record()
+    {
+        if (IsPlayer)
+        {
+            RecordFlag = true;
+            RecordLastIndex = PlayerLastIndex;
+            RecordFirstIndex = PlayerFirstIndex;
+            RecordPosition = ScrollRectPlus.content.position;
+        }
+    }
+
+    public static void Recover()
+    {
+        if (RecordFlag)
+        {
+            RecordFlag = false;
+
+            OpenCommentPanel();
+
+            ClearComment();
+
+            PlayerLastIndex = -1;
+            PlayerFirstIndex = 0;
+
+            int antiCrush = 0;
+
+            while (PlayerFirstIndex != RecordFirstIndex || PlayerLastIndex != RecordLastIndex)
+            {
+                if (antiCrush > 10000)
+                {
+                    throw new Exception("Crush");
+                }
+
+                if (ScrollRectPlus.content.childCount >= 20)
+                {
+                    ManaReso.Save(ScrollRectPlus.content.GetChild(0).gameObject);
+                    PlayerFirstIndex++;
+                }
+
+                PlayerLastIndex++;
+
+                ManaReso.GetCommentItem(PlayerCommentDatas[PlayerLastIndex][0], PlayerCommentDatas[PlayerLastIndex][1]);
+            }
+
+            ScrollRectPlus.content.position = RecordPosition;
+        }
     }
 }

+ 10 - 1
Assets/Script/Manage/ManaUI.cs

@@ -476,7 +476,7 @@ public class ManaUI : Regist
                         ManaVisit.LoadComplete = false;
                         ManaVisit.TweenComplete = false;
 
-                        ManaVisit.GetArchive();
+                        ManaVisit.GetRandomArchive();
 
                         ManaAudio.PlayClip(Clip.BubbleClip);
 
@@ -2635,6 +2635,15 @@ public class ManaUI : Regist
                 }
             );
 
+        ManaReso.AddButtonEvent
+        (
+            "Q_CommentBtn",
+            () =>
+            {
+                ManaSocial.Comment();
+            }
+        );
+
         #endregion
 
         if (!ManaTutorial.TutorialA)

+ 144 - 3
Assets/Script/Manage/ManaVisit.cs

@@ -148,6 +148,8 @@ public class ManaVisit
     {
         TweenRoot tweenRoot = ManaReso.Get("I_BlackMask").TweenForCG();
 
+        EnableChest();
+
         tweenRoot.AddEventOnetime
             (
                 EventType.ForwardFinish,
@@ -158,7 +160,6 @@ public class ManaVisit
             );
 			
 		HideTip ();
-        SetPlayerPraise();
 
         ManaReso.SetActive("C_Visit", true);
         ManaReso.SetActive("C_Coin", true);
@@ -277,6 +278,9 @@ public class ManaVisit
         ManaGarden.ElfList = new List<ElfType>(OriginElfList);
 
         InVisit = false;
+
+        SetPlayerPraise();
+        SetPlayerComment();
     }
 
     public static void Enter()
@@ -288,6 +292,9 @@ public class ManaVisit
 
         ManaReso.Get("I_BlackMask").TweenForCG();
 
+        DisableChest();
+
+        ManaSocial.CloseCommentPanel();
 
 		ShowTip ();
 
@@ -608,6 +615,22 @@ public class ManaVisit
         InVisit = true;
     }
 
+    public static void EnableChest()
+    {
+        for (int i = 0; i < ManaIAP.ChestList.Count; i++)
+        {
+            ManaIAP.ChestList[i].SetActive(true);
+        }
+    }
+
+    public static void DisableChest()
+    {
+        for (int i = 0; i < ManaIAP.ChestList.Count; i++)
+        {
+            ManaIAP.ChestList[i].SetActive(false);
+        }
+    }
+
     public static void SetPlayerPraise()
     {
         ManaSocial.PraiseText.text = ManaServer.PraiseAmt.ToString();
@@ -644,6 +667,23 @@ public class ManaVisit
         }
     }
 
+    public static void SetPlayerComment()
+    {
+        if (ManaSocial.RecordFlag)
+        {
+            ManaSocial.Recover();
+        }
+        else
+        {
+            ManaSocial.UpdatePage(true);
+        }
+    }
+
+    public static void SetVisiteeComment()
+    {
+        ManaSocial.UpdatePage(false);
+    }
+
     public static void UpdateCost()
     {
         if (Complete)
@@ -685,8 +725,107 @@ public class ManaVisit
 	}
 
 
-    public static void GetArchive()
+    public static void TargetVisit(string serialNumber)
+    {
+        if (ManaCenter.SceneSwitchLock)
+        {
+            return;
+        }
+
+        ManaReso.Get("I_BlackMask").GetTweenCG().Duration = 0.5f;
+
+        ManaCenter.Pay
+        (
+            "", Cost, Current.Coin,
+            () =>
+            {
+                ManaPlayer.Player.SetAllCollider(false);
+
+                LoadComplete = false;
+                TweenComplete = false;
+
+                GetTargetArchive(serialNumber);
+
+                ManaAudio.PlayClip(Clip.BubbleClip);
+
+                ManaReso.SetActive("C_Return", false);
+
+                TweenRoot tween;
+
+                if (CoolTime != 0)
+                {
+                    ManaReso.Get<Button>("C_Visit").interactable = false;
+
+                    tween = ManaReso.Get("C_VisitLab").StreamReForScale();
+
+                    tween.AddEventOnetime
+                    (
+                        EventType.ForwardFinish,
+                        () =>
+                        {
+                            ManaReso.Get<Button>("C_Visit").interactable = true;
+                        }
+                    );
+                }
+
+
+                tween = ManaReso.Get("I_BlackMask").TweenBacCG();
+
+                tween.AddEventOnetime
+                (
+                    EventType.BackwardFinish,
+                    () =>
+                    {
+                        TweenComplete = true;
+
+                        Enter();
+                    }
+                );
+            },
+            StaticsManager.ItemID.参观花费,
+            StaticsManager.ConsumeModule.Shop,
+            false
+        );
+    }
+
+    public static void GetTargetArchive(string serialNumber)
+    {
+        ManaServer.Other
+        (
+            serialNumber,
+            jsonData =>
+            {
+                LoadComplete = true;
+
+                if (jsonData.Inst_Object.ContainsKey("l"))
+                {
+                    XmlStr = jsonData["l"].ToString();
+                    VisiteePraise = int.Parse(jsonData["p"].ToString());
+
+                    Document = new XmlDocument();
+                    Document.LoadXml(XmlStr);
+
+                    SetVisiteePraise(Document);
+                    SetVisiteeComment();
+                }
+                else
+                {
+                    LoadComplete = true;
+
+                    XmlStr = WriteArchive();
+                    Document = new XmlDocument();
+                    Document.LoadXml(XmlStr);
+                }
+
+                Enter();
+            }
+        );
+    }
+
+    public static void GetRandomArchive()
     {
+        CreateRate = 0;
+
         if (Random.Range(0f, 1f) <= CreateRate)
         {
             LoadComplete = true;
@@ -699,8 +838,9 @@ public class ManaVisit
         }
         else
         {
-            ManaServer.RandomLoad
+            ManaServer.Download
             (
+                ManaServer.ID,
                 jsonData =>
                 {
                     LoadComplete = true;
@@ -714,6 +854,7 @@ public class ManaVisit
                         Document.LoadXml(XmlStr);
 
                         SetVisiteePraise(Document);
+                        SetVisiteeComment();
                     }
                     else
                     {

+ 6 - 3
Assets/Script/Object/CommentItem.cs

@@ -7,9 +7,9 @@ using System.Collections.Generic;
 public class CommentItem : Regist
 {
     public Text Tit;
-    public Text ContentLab;
     public Text VisitLab;
     public Button VisitBtn;
+    public BestfitText ContentLab;
 
     public string Content;
     public string SerialNumber;
@@ -28,7 +28,8 @@ public class CommentItem : Regist
         Tit = childDic["Tit"].GetComponent<Text>();
         VisitLab = childDic["VisitLab"].GetComponent<Text>();
         VisitBtn = childDic["VisitBtn"].GetComponent<Button>();
-        ContentLab = childDic["ContentLab"].GetComponent<Text>();
+        ContentLab = childDic["ContentLab"].GetComponent<BestfitText>();
+        ContentLab.VerticalMaxSize = 20;
 
         VisitLab.text = ManaReso.Get<Text>("C_CostLab").text;
 
@@ -44,7 +45,9 @@ public class CommentItem : Regist
 
     public void Visit()
     {
-        
+        ManaSocial.Record();
+
+        ManaVisit.TargetVisit(SerialNumber);
     }
 
     public void Reset(string serialNumber, string content)

+ 0 - 1
Assets/Script/Object/Skill/Pack.cs

@@ -232,7 +232,6 @@ public class Pack : SkillRoot
 
     protected void UseA()
     {
-        Debug.Log(Name + " " + Plus);
         ManaCenter.SkillPlus += Plus;
         ManaCenter.SkillPerson += Person;
         ManaCenter.SkillPersonBuff += PersonBuff;

+ 14 - 14
Assets/Script/Tool/Auxiliary.cs

@@ -179,23 +179,23 @@ public class Auxiliary : Regist
         //    Debug.Log(ManaGarden.Slot);
         //}
 
-        //if (Input.GetKeyDown(KeyCode.N))
-        //{
-        //    ManaCenter.Coin = 0;
-        //    ManaCenter.Diamond = 0;
+        if (Input.GetKeyDown(KeyCode.N))
+        {
+            //ManaCenter.Coin = 0;
+            //ManaCenter.Diamond = 0;
 
-        //    foreach (var VARIABLE in ManaGarden.FlowerInfoDic)
-        //    {
-        //        VARIABLE.Value.Unlock = true;
-        //    }
+            foreach (var VARIABLE in ManaGarden.FlowerInfoDic)
+            {
+                VARIABLE.Value.Unlock = true;
+            }
 
-        //    foreach (var VARIABLE in ManaGarden.FlowerInfoDic)
-        //    {
-        //        VARIABLE.Value.Unlock = false;
-        //    }
+            //foreach (var VARIABLE in ManaGarden.FlowerInfoDic)
+            //{
+            //    VARIABLE.Value.Unlock = false;
+            //}
 
-        //    ManaGarden.FlowerInfoDic.First().Value.Unlock = true;
-        //}
+            //ManaGarden.FlowerInfoDic.First().Value.Unlock = true;
+        }
 
         //if (Input.GetKeyDown(KeyCode.B))
         //{

+ 2 - 5
Assets/Script/Tool/UI/BestfitText.cs

@@ -9,8 +9,8 @@ public class BestfitText : Text
 {
     #region
 
-    private int VerticalMinSize;
-    private int VerticalMaxSize;
+    public int VerticalMinSize = 1;
+    public int VerticalMaxSize = 29;
 
     protected string FormerText;
     
@@ -42,9 +42,6 @@ public class BestfitText : Text
 
         int antiCrush = 0;
 
-        VerticalMinSize = 1;
-        VerticalMaxSize = 29;
-
         while (true)
         {
             antiCrush++;

+ 9 - 7
ToDoList.txt

@@ -1,14 +1,12 @@
-VerticalBestfit最大与最小的限制
-
-调整箱子
-
-访问时的箱子
+修改了访问对象和概率
 
 没联网时的社交功能
 
-评论 点赞 宝箱 截图需要打入图集
+点赞更新不及时
 
-FlowerHouse动画控制器优化
+ScrollRect的特殊情况
+
+为什么有时要用ScaleFactor有时又不用
 
 
 关闭调试模式
@@ -24,6 +22,10 @@ FlowerHouse
 IOS设置Team
 
 
+FlowerHouse动画控制器优化
+
+评论 点赞 宝箱 截图需要打入图集
+
 图集
 {
   把网络得到的小图合并为图集