using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.UI; public class PrivateMessageDataStash { private static int MaxPageAmount = 20; public int CurrentPage; public List PrivateMessageDatas = new List(); public void Add(int page, List datas) { if (page < CurrentPage) { return; } CurrentPage = page; if (PrivateMessageDatas.Count <= page*MaxPageAmount) { PrivateMessageDatas.AddRange(datas); } else { for (int i = page * MaxPageAmount; i < PrivateMessageDatas.Count; i++) { PrivateMessageDatas.RemoveAt(i--); } PrivateMessageDatas.AddRange(datas); } } public int GetNextPageIndex() { return PrivateMessageDatas.Count/ MaxPageAmount; } } public class MessagePanel : Regist { #region Config public static Action OnPanelClosed; public static Text NicknameTitle; public static Text ContentTitle; public static Text TimeTitle; public static Text PanelTitle; public static Text PlaceholderTitle; public static Text InputText; public static Text SendMessageButtonTitle; public static Text CloseButtonTitle; public static Text LoadingTitle; public static Button CloseButton; public static Button SendMessageButton; public static Transform Grid; public static Transform MessagePanelMask; public static InputField InputField; public static VirtualScrollRectPlus ScrollRect; private static Coroutine LoadingTitleFadeOut; private static int MaxRollAmount = 4; private static int MaxChildAmount = 10; private static bool DownloadingPrivateMessageFlag; public static bool IsPanelOpen; public static AccountData AccountData; public static List PrivateMessageItems = new List(); public static Dictionary PrivateMessageDataDictionary = new Dictionary(); public static Action OnHaveNewMessage; public static Action OnDontHaveNewMessage; #endregion public override void RegistReference() { NicknameTitle = ResourceManager.Get(CanvasLabel.AH_NicknameTitle); ContentTitle = ResourceManager.Get(CanvasLabel.AH_ContentTitle); TimeTitle = ResourceManager.Get(CanvasLabel.AH_TimeTitle); PanelTitle = ResourceManager.Get(CanvasLabel.AH_PanelTitle); PlaceholderTitle = ResourceManager.Get(CanvasLabel.AH_PlaceholderTitle); InputText = ResourceManager.Get(CanvasLabel.AH_InputText); SendMessageButtonTitle = ResourceManager.Get(CanvasLabel.AH_SendMessageButtonTitle); CloseButtonTitle = ResourceManager.Get(CanvasLabel.AH_CloseButtonTitle); LoadingTitle = ResourceManager.Get(CanvasLabel.AH_LoadingTitle); CloseButton = ResourceManager.Get