|
@@ -8,22 +8,26 @@ public class FashionShowCommentPanel : Regist
|
|
{
|
|
{
|
|
#region Config
|
|
#region Config
|
|
|
|
|
|
- //StartMark-Used by LabelUtility-Do not remove
|
|
|
|
private static Text NicknameTitle;
|
|
private static Text NicknameTitle;
|
|
private static Text ContentTitle;
|
|
private static Text ContentTitle;
|
|
private static Text Title;
|
|
private static Text Title;
|
|
private static Text CloseButtonText;
|
|
private static Text CloseButtonText;
|
|
private static Text SendCommentButtonText;
|
|
private static Text SendCommentButtonText;
|
|
private static Text Placeholder;
|
|
private static Text Placeholder;
|
|
- //private static Text PlaceholderText;
|
|
|
|
- //private static Text Tip;
|
|
|
|
private static Button CloseButton;
|
|
private static Button CloseButton;
|
|
private static Button SendCommentButton;
|
|
private static Button SendCommentButton;
|
|
- //EndMark-Used by LabelUtility-Do not remove
|
|
|
|
-
|
|
|
|
private static Transform Mask;
|
|
private static Transform Mask;
|
|
|
|
+ private static InputField commentInputField;
|
|
private static VirtualScrollRectPlus VirtualScrollRectPlus;
|
|
private static VirtualScrollRectPlus VirtualScrollRectPlus;
|
|
|
|
|
|
|
|
+ private static int currentCommentPage;
|
|
|
|
+ private static int currentCommentIndex;
|
|
|
|
+ private static bool requesting;
|
|
|
|
+ private static ShowCommentsHttp commentDataHttp;
|
|
|
|
+ private static GetFashionShowData showData;
|
|
|
|
+ private static List<ShowCommentData> commentDatas = new List<ShowCommentData>();
|
|
|
|
+ private static List<ShowComment> commentItems = new List<ShowComment>();
|
|
|
|
+
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
public override void RegistReference()
|
|
public override void RegistReference()
|
|
@@ -36,12 +40,10 @@ public class FashionShowCommentPanel : Regist
|
|
CloseButtonText = ResourceManager.Get<Text>(CanvasLabel.Ph_CloseButtonText);
|
|
CloseButtonText = ResourceManager.Get<Text>(CanvasLabel.Ph_CloseButtonText);
|
|
SendCommentButtonText = ResourceManager.Get<Text>(CanvasLabel.Ph_SendCommentButtonText);
|
|
SendCommentButtonText = ResourceManager.Get<Text>(CanvasLabel.Ph_SendCommentButtonText);
|
|
Placeholder = ResourceManager.Get<Text>(CanvasLabel.Ph_Placeholder);
|
|
Placeholder = ResourceManager.Get<Text>(CanvasLabel.Ph_Placeholder);
|
|
- //PlaceholderText = ResourceManager.Get<Text>(CanvasLabel.Ph_PlaceholderText);
|
|
|
|
- //Tip = ResourceManager.Get<Text>(CanvasLabel.Ph_Tip);
|
|
|
|
CloseButton = ResourceManager.Get<Button>(CanvasLabel.Ph_CloseButton);
|
|
CloseButton = ResourceManager.Get<Button>(CanvasLabel.Ph_CloseButton);
|
|
SendCommentButton = ResourceManager.Get<Button>(CanvasLabel.Ph_SendCommentButton);
|
|
SendCommentButton = ResourceManager.Get<Button>(CanvasLabel.Ph_SendCommentButton);
|
|
-
|
|
|
|
Mask = ResourceManager.Get(CanvasLabel.Ph_CommentMask);
|
|
Mask = ResourceManager.Get(CanvasLabel.Ph_CommentMask);
|
|
|
|
+ commentInputField = ResourceManager.Get<InputField>(CanvasLabel.Ph_InputField);
|
|
VirtualScrollRectPlus = ResourceManager.Get<VirtualScrollRectPlus>(CanvasLabel.Ph_ScrollRect);
|
|
VirtualScrollRectPlus = ResourceManager.Get<VirtualScrollRectPlus>(CanvasLabel.Ph_ScrollRect);
|
|
|
|
|
|
LanguageManager.Add(Title, new MulLanStr(LanguageLabel.UI__Ph_Tit));
|
|
LanguageManager.Add(Title, new MulLanStr(LanguageLabel.UI__Ph_Tit));
|
|
@@ -52,20 +54,36 @@ public class FashionShowCommentPanel : Regist
|
|
LanguageManager.Add(Placeholder, new MulLanStr(LanguageLabel.UI__Ph_Placeholder));
|
|
LanguageManager.Add(Placeholder, new MulLanStr(LanguageLabel.UI__Ph_Placeholder));
|
|
|
|
|
|
Mask.CreateTweenCG(0, 1, 0.25f, false, true, Curve.EaseOutQuad);
|
|
Mask.CreateTweenCG(0, 1, 0.25f, false, true, Curve.EaseOutQuad);
|
|
- VirtualScrollRectPlus.OnSaveItem += OnSaveItem;
|
|
|
|
- VirtualScrollRectPlus.OnGetNextItem += OnGetNextItem;
|
|
|
|
- VirtualScrollRectPlus.OnGetPreviousItem += OnGetPreviousItem;
|
|
|
|
|
|
|
|
|
|
+ VirtualScrollRectPlus.Init(1, 1000000);
|
|
|
|
+ VirtualScrollRectPlus.OnGetNextItem += OnGetNextItem;
|
|
CloseButton.onClick.AddListener(OnCloseButtonClick);
|
|
CloseButton.onClick.AddListener(OnCloseButtonClick);
|
|
SendCommentButton.onClick.AddListener(OnSendCommentButtonClick);
|
|
SendCommentButton.onClick.AddListener(OnSendCommentButtonClick);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- public static void ShowPanel()
|
|
|
|
|
|
+ public static void ShowPanel(GetFashionShowData data)
|
|
{
|
|
{
|
|
|
|
+ ResetPanel(data);
|
|
Mask.TweenForCG();
|
|
Mask.TweenForCG();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private static void ResetPanel(GetFashionShowData data)
|
|
|
|
+ {
|
|
|
|
+ showData = data;
|
|
|
|
+ requesting = false;
|
|
|
|
+ currentCommentPage = 0;
|
|
|
|
+ currentCommentIndex = 0;
|
|
|
|
+ commentDatas = new List<ShowCommentData>();
|
|
|
|
+ foreach (var commentItem in commentItems)
|
|
|
|
+ {
|
|
|
|
+ DestroyImmediate(commentItem.gameObject);
|
|
|
|
+ }
|
|
|
|
+ commentItems = new List<ShowComment>();
|
|
|
|
+ commentInputField.text = "";
|
|
|
|
+ OnGetNextItem(0);
|
|
|
|
+ }
|
|
|
|
+
|
|
public static void HidePanel()
|
|
public static void HidePanel()
|
|
{
|
|
{
|
|
Mask.TweenBacCG();
|
|
Mask.TweenBacCG();
|
|
@@ -74,29 +92,98 @@ public class FashionShowCommentPanel : Regist
|
|
|
|
|
|
private static void OnCloseButtonClick()
|
|
private static void OnCloseButtonClick()
|
|
{
|
|
{
|
|
|
|
+ if (commentDataHttp != null)
|
|
|
|
+ {
|
|
|
|
+ commentDataHttp.disable = true;
|
|
|
|
+ }
|
|
AudioManager.PlayClip(ResourceLabel.CloseClip);
|
|
AudioManager.PlayClip(ResourceLabel.CloseClip);
|
|
HidePanel();
|
|
HidePanel();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ private static VirtualScrollRectItem OnGetNextItem(int index)
|
|
|
|
+ {
|
|
|
|
+ if (commentDatas.Count > currentCommentIndex)
|
|
|
|
+ {
|
|
|
|
+ ShowCommentData data = commentDatas[currentCommentIndex];
|
|
|
|
+ ShowComment item = ResourceManager.GetShowComment(data);
|
|
|
|
+ commentItems.Add(item);
|
|
|
|
+ currentCommentIndex++;
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ GetCommentData();
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
private static void OnSendCommentButtonClick()
|
|
private static void OnSendCommentButtonClick()
|
|
{
|
|
{
|
|
AudioManager.PlayClip(ResourceLabel.BtnClip);
|
|
AudioManager.PlayClip(ResourceLabel.BtnClip);
|
|
|
|
+ SendComment();
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ private static void SendComment()
|
|
|
|
+ {
|
|
|
|
+ string comment = commentInputField.text;
|
|
|
|
+ if (StringFilter.ContainSensitiveWord(comment))
|
|
|
|
+ {
|
|
|
|
+ Bubble.Show(null, Language.GetStr(LanguageLabel.Common__ContainSensitiveWord));
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ SendCommentButton.interactable = false;
|
|
|
|
+ long playerId = HttpManager.GetPlayerId();
|
|
|
|
+ CommentShowHttp.Comment(playerId, showData.showId, comment,
|
|
|
|
+ OnSendCommentSuccees, OnSendCommentFail);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private static void OnSendCommentSuccees()
|
|
|
|
+ {
|
|
|
|
+ commentInputField.text = "";
|
|
|
|
+ SendCommentButton.interactable = true;
|
|
|
|
+ ResetPanel(showData);
|
|
|
|
+ }
|
|
|
|
|
|
- private static void OnSaveItem(int index, VirtualScrollRectItem item)
|
|
|
|
|
|
+ private static void OnSendCommentFail()
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+ SendCommentButton.interactable = true;
|
|
}
|
|
}
|
|
|
|
|
|
- private static VirtualScrollRectItem OnGetNextItem(int index)
|
|
|
|
|
|
+
|
|
|
|
+ private static void GetCommentData()
|
|
|
|
+ {
|
|
|
|
+ if (requesting)
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ requesting = true;
|
|
|
|
+ commentDataHttp = ShowCommentsHttp.Get(currentCommentPage, showData.showId,
|
|
|
|
+ OnGetCommentDataSuccess, OnGetCommentDataFail);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private static void OnGetCommentDataSuccess(object obj)
|
|
{
|
|
{
|
|
- return null;
|
|
|
|
|
|
+ requesting = false;
|
|
|
|
+ currentCommentPage++;
|
|
|
|
+ List<ShowCommentData> datas = (List<ShowCommentData>) obj;
|
|
|
|
+ foreach (var data in datas)
|
|
|
|
+ {
|
|
|
|
+ commentDatas.AddUnique(data, (data0, data1) => data0.id == data1.id);
|
|
|
|
+ }
|
|
|
|
+ if (commentItems.Count == 0)
|
|
|
|
+ {
|
|
|
|
+ OnGetNextItem(0);
|
|
|
|
+ OnGetNextItem(0);
|
|
|
|
+ OnGetNextItem(0);
|
|
|
|
+ OnGetNextItem(0);
|
|
|
|
+ OnGetNextItem(0);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- private static VirtualScrollRectItem OnGetPreviousItem(int index)
|
|
|
|
|
|
+ private static void OnGetCommentDataFail()
|
|
{
|
|
{
|
|
- return null;
|
|
|
|
|
|
+ requesting = false;
|
|
}
|
|
}
|
|
}
|
|
}
|