| | |
| | | return _recentlyChat;
|
| | | }
|
| | |
|
| | | public void SaveLocalRecentlyChat()
|
| | | {
|
| | | for (int i = 0; i < recentlyChats.Count; i++)
|
| | | {
|
| | | var localKey = StringUtility.Contact("RecentlyChat_", PlayerDatas.Instance.baseData.PlayerID, "_", i);
|
| | | LocalSave.SetString(localKey, recentlyChats[i].ToString());
|
| | | }
|
| | | }
|
| | |
|
| | | void GetLocalRecentlyChat()
|
| | | {
|
| | | recentlyChats.Clear();
|
| | | for (int i = 0; i < RecentlyChatNum; i++)
|
| | | {
|
| | | var localKey = StringUtility.Contact("RecentlyChat_", PlayerDatas.Instance.baseData.PlayerID, "_", i);
|
| | | if (LocalSave.HasKey(localKey))
|
| | | {
|
| | | var json = LocalSave.GetString(localKey);
|
| | | if (!string.IsNullOrEmpty(json))
|
| | | {
|
| | | RecentlyChat chat;
|
| | | if (RecentlyChat.TryParse(json, out chat))
|
| | | {
|
| | | recentlyChats.Add(chat);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | if (RecentlyChatChangeEvent != null)
|
| | | {
|
| | | RecentlyChatChangeEvent();
|
| | | }
|
| | | }
|
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | recentlyChat = null;
|
| | |
| | | public List<string> itemInfos = new List<string>();
|
| | | public List<int> itemIndexs = new List<int>();
|
| | | public List<string> itemNames = new List<string>();
|
| | |
|
| | | public RecentlyChat()
|
| | | {
|
| | |
|
| | | }
|
| | |
|
| | | public RecentlyChat(string _chat)
|
| | | {
|
| | | display = _chat;
|
| | |
| | | {
|
| | | itemIndexs.Add(i);
|
| | | }
|
| | | }
|
| | |
|
| | | public override string ToString()
|
| | | {
|
| | | return LitJson.JsonMapper.ToJson(this);
|
| | | }
|
| | |
|
| | | public static bool TryParse(string json, out RecentlyChat chat)
|
| | | {
|
| | | chat = null;
|
| | | try
|
| | | {
|
| | | chat = LitJson.JsonMapper.ToObject<RecentlyChat>(json);
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | Debug.LogError(e.StackTrace + e.Message);
|
| | | return false;
|
| | | }
|
| | | return chat != null;
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | | serverInited = true;
|
| | | GetLocalRecentlyChat();
|
| | | }
|
| | |
|
| | | #region 聊天浮动
|