|
@@ -11,7 +11,7 @@ using LitJson;
|
|
|
|
|
|
using Debug = UnityEngine.Debug;
|
|
|
|
|
|
-public class ManaSocial : Regist
|
|
|
+public class ManaSocial : Regist
|
|
|
{
|
|
|
#region Variable
|
|
|
|
|
@@ -27,8 +27,8 @@ public class ManaSocial : Regist
|
|
|
public static bool UpdateLock;
|
|
|
public static bool IsPanelOpen;
|
|
|
|
|
|
- public static int PlayerLastIndex=-1;
|
|
|
- public static int VisiteeLastIndex=-1;
|
|
|
+ public static int PlayerLastIndex = -1;
|
|
|
+ public static int VisiteeLastIndex = -1;
|
|
|
public static int PlayerFirstIndex;
|
|
|
public static int VisiteeFirstIndex;
|
|
|
public static int PlayerCommentPage;
|
|
@@ -46,8 +46,8 @@ public class ManaSocial : Regist
|
|
|
public static float PraiseTimer = 5;
|
|
|
public static float CommentTimespan = 60;
|
|
|
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>>();
|
|
|
+ public static List<CommentData> PlayerCommentDatas = new List<CommentData>();
|
|
|
+ public static List<CommentData> VisiteeCommentDatas = new List<CommentData>();
|
|
|
|
|
|
#endregion
|
|
|
|
|
@@ -163,8 +163,7 @@ public class ManaSocial : Regist
|
|
|
|
|
|
foreach (JsonData commentData in jsonData["l"])
|
|
|
{
|
|
|
- //Debug.Log(commentData["n"].ToString());
|
|
|
- PlayerCommentDatas.Add(new List<string>() { commentData["s"].ToString(), commentData["c"].ToString(), commentData["n"].ToString() });
|
|
|
+ PlayerCommentDatas.UniqueAdd(new CommentData(commentData));
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -173,7 +172,7 @@ public class ManaSocial : Regist
|
|
|
|
|
|
foreach (JsonData commentData in jsonData["l"])
|
|
|
{
|
|
|
- VisiteeCommentDatas.Add(new List<string>() { commentData["s"].ToString(), commentData["c"].ToString(), commentData["n"].ToString() });
|
|
|
+ VisiteeCommentDatas.UniqueAdd(new CommentData(commentData));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -198,7 +197,8 @@ public class ManaSocial : Regist
|
|
|
|
|
|
PlayerLastIndex++;
|
|
|
|
|
|
- ManaReso.GetCommentItem(PlayerCommentDatas[PlayerLastIndex][2], PlayerCommentDatas[PlayerLastIndex][0], PlayerCommentDatas[PlayerLastIndex][1]);
|
|
|
+ CommentData commentData = PlayerCommentDatas[PlayerLastIndex];
|
|
|
+ ManaReso.GetCommentItem(commentData.NickName, commentData.SerialNumber, commentData.Content);
|
|
|
}
|
|
|
|
|
|
int offset = isDownload ? 1 : 0;
|
|
@@ -206,8 +206,8 @@ public class ManaSocial : Regist
|
|
|
|
|
|
if (saveAmt > 0)
|
|
|
{
|
|
|
- ScrollRectPlus.content.position += new Vector3(0, -(saveAmt - offset) * 120 * scaleFactor, 0);
|
|
|
- ScrollRectPlus.AddContentOffset(new Vector3(0, -(saveAmt - offset) * 120 * scaleFactor, 0));
|
|
|
+ ScrollRectPlus.content.position += new Vector3(0, -(saveAmt - offset)*120*scaleFactor, 0);
|
|
|
+ ScrollRectPlus.AddContentOffset(new Vector3(0, -(saveAmt - offset)*120*scaleFactor, 0));
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -226,7 +226,8 @@ public class ManaSocial : Regist
|
|
|
|
|
|
VisiteeLastIndex++;
|
|
|
|
|
|
- ManaReso.GetCommentItem(VisiteeCommentDatas[VisiteeLastIndex][2], VisiteeCommentDatas[VisiteeLastIndex][0], VisiteeCommentDatas[VisiteeLastIndex][1]);
|
|
|
+ CommentData commentData = VisiteeCommentDatas[VisiteeLastIndex];
|
|
|
+ ManaReso.GetCommentItem(commentData.NickName, commentData.SerialNumber, commentData.Content);
|
|
|
}
|
|
|
|
|
|
int offset = isDownload ? 1 : 0;
|
|
@@ -234,8 +235,8 @@ public class ManaSocial : Regist
|
|
|
|
|
|
if (saveAmt > 0)
|
|
|
{
|
|
|
- ScrollRectPlus.content.position += new Vector3(0, -(saveAmt - offset) * 120 * scaleFactor, 0);
|
|
|
- ScrollRectPlus.AddContentOffset(new Vector3(0, -(saveAmt - offset) * 120 * scaleFactor, 0));
|
|
|
+ ScrollRectPlus.content.position += new Vector3(0, -(saveAmt - offset)*120*scaleFactor, 0);
|
|
|
+ ScrollRectPlus.AddContentOffset(new Vector3(0, -(saveAmt - offset)*120*scaleFactor, 0));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -257,8 +258,10 @@ public class ManaSocial : Regist
|
|
|
|
|
|
for (int i = 0; i < revertAmt; i++)
|
|
|
{
|
|
|
- ManaReso.Save(ScrollRectPlus.content.GetChild(ScrollRectPlus.content.childCount-1));
|
|
|
- CommentItem commentItem = ManaReso.GetCommentItem(PlayerCommentDatas[PlayerFirstIndex - 1][2], PlayerCommentDatas[PlayerFirstIndex - 1][0], PlayerCommentDatas[PlayerFirstIndex - 1][1]);
|
|
|
+ ManaReso.Save(ScrollRectPlus.content.GetChild(ScrollRectPlus.content.childCount - 1));
|
|
|
+ CommentData commentData = VisiteeCommentDatas[VisiteeLastIndex];
|
|
|
+
|
|
|
+ CommentItem commentItem = ManaReso.GetCommentItem(commentData.NickName, commentData.SerialNumber, commentData.Content);
|
|
|
commentItem.transform.SetAsFirstSibling();
|
|
|
|
|
|
PlayerLastIndex--;
|
|
@@ -281,7 +284,9 @@ public class ManaSocial : Regist
|
|
|
for (int i = 0; i < revertAmt; i++)
|
|
|
{
|
|
|
ManaReso.Save(ScrollRectPlus.content.GetChild(ScrollRectPlus.content.childCount - 1));
|
|
|
- CommentItem commentItem = ManaReso.GetCommentItem(VisiteeCommentDatas[VisiteeFirstIndex - 1][2], VisiteeCommentDatas[VisiteeFirstIndex - 1][0], VisiteeCommentDatas[VisiteeFirstIndex - 1][1]);
|
|
|
+ CommentData commentData = VisiteeCommentDatas[VisiteeLastIndex];
|
|
|
+
|
|
|
+ CommentItem commentItem = ManaReso.GetCommentItem(commentData.NickName, commentData.SerialNumber, commentData.Content);
|
|
|
commentItem.transform.SetAsFirstSibling();
|
|
|
|
|
|
VisiteeLastIndex--;
|
|
@@ -290,8 +295,8 @@ public class ManaSocial : Regist
|
|
|
|
|
|
if (revertAmt > 0)
|
|
|
{
|
|
|
- ScrollRectPlus.content.position += new Vector3(0, revertAmt * 120, 0);
|
|
|
- ScrollRectPlus.AddContentOffset(new Vector3(0, revertAmt * 120, 0));
|
|
|
+ ScrollRectPlus.content.position += new Vector3(0, revertAmt*120, 0);
|
|
|
+ ScrollRectPlus.AddContentOffset(new Vector3(0, revertAmt*120, 0));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -376,8 +381,8 @@ public class ManaSocial : Regist
|
|
|
PlayerFirstIndex = 0;
|
|
|
PlayerLastIndex = -1;
|
|
|
PlayerCommentPage = 0;
|
|
|
- PlayerCommentDatas = new List<List<string>>();
|
|
|
-
|
|
|
+ PlayerCommentDatas = new List<CommentData>();
|
|
|
+
|
|
|
ManaServer.GetComment
|
|
|
(
|
|
|
ManaServer.SerialNumber,
|
|
@@ -406,7 +411,7 @@ public class ManaSocial : Regist
|
|
|
VisiteeFirstIndex = 0;
|
|
|
VisiteeLastIndex = -1;
|
|
|
VisiteeCommentPage = 0;
|
|
|
- VisiteeCommentDatas = new List<List<string>>();
|
|
|
+ VisiteeCommentDatas = new List<CommentData>();
|
|
|
|
|
|
ManaServer.GetComment
|
|
|
(
|
|
@@ -531,8 +536,8 @@ public class ManaSocial : Regist
|
|
|
{
|
|
|
CommentTime = DateTime.Now;
|
|
|
|
|
|
- string content = StringFilter.GetFilteredString(InputField.text);
|
|
|
-
|
|
|
+ string content = StringFilter.GetFilteredString(InputField.text);
|
|
|
+
|
|
|
ManaServer.AddComment(ManaServer.SerialNumber, ManaVisit.VisiteeSerialNumber, content, CommentType.Garden);
|
|
|
}
|
|
|
else
|
|
@@ -543,14 +548,29 @@ public class ManaSocial : Regist
|
|
|
|
|
|
public static void OpenCommentPanel()
|
|
|
{
|
|
|
- ManaReso.Get("Q_CommentBK").TweenForCG();
|
|
|
+ IsPlayer = !ManaVisit.InVisit;
|
|
|
|
|
|
- ManaReso.SetActive("Q_InputBK", ManaVisit.InVisit);
|
|
|
+ if (IsPlayer)
|
|
|
+ {
|
|
|
+ UpdatePage(IsPlayer);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if (string.IsNullOrEmpty(ManaVisit.VisiteeSerialNumber))
|
|
|
+ {
|
|
|
+ Bubble.Show(null, Language.GetStr("UI", "C_CannotComment"));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ UpdatePage(IsPlayer);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- IsPlayer = !ManaVisit.InVisit;
|
|
|
IsPanelOpen = true;
|
|
|
+ ManaReso.Get("Q_CommentBK").TweenForCG();
|
|
|
|
|
|
- UpdatePage(IsPlayer);
|
|
|
+ ManaReso.SetActive("Q_InputBK", ManaVisit.InVisit);
|
|
|
}
|
|
|
|
|
|
public static void CloseCommentPanel()
|
|
@@ -597,8 +617,8 @@ public class ManaSocial : Regist
|
|
|
}
|
|
|
|
|
|
PlayerLastIndex++;
|
|
|
-
|
|
|
- ManaReso.GetCommentItem(PlayerCommentDatas[PlayerLastIndex][2], PlayerCommentDatas[PlayerLastIndex][0], PlayerCommentDatas[PlayerLastIndex][1]);
|
|
|
+ CommentData commentData = PlayerCommentDatas[PlayerLastIndex];
|
|
|
+ ManaReso.GetCommentItem(commentData.NickName, commentData.SerialNumber, commentData.Content);
|
|
|
}
|
|
|
|
|
|
ScrollRectPlus.content.transform.position = CommentRecordPosition;
|