| | |
| | | public static void Init()
|
| | | {
|
| | | // 登记相应的数据体及对应的数据转逻辑类
|
| | | Register(typeof(HB311_tagGCTalkCache), typeof(DTCB311_tagGCTalkCache));
|
| | | Register(typeof(HAC01_tagGCFamilyWarInfo), typeof(DTCAC01_tagGCFamilyWarInfo));
|
| | | Register(typeof(HA40D_tagGCServerCreatFamilyTimes), typeof(DTCA40D_tagGCServerCreatFamilyTimes));
|
| | | Register(typeof(HAC07_tagGCHorsePetBossInfo), typeof(DTCAC07_tagGCHorsePetBossInfo));
|
| New file |
| | |
| | | //--------------------------------------------------------
|
| | | // [Author]: 第二世界
|
| | | // [ Date ]: Tuesday, July 16, 2019
|
| | | //--------------------------------------------------------
|
| | |
|
| | | using System;
|
| | | using System.Collections;
|
| | | using System.Collections.Generic;
|
| | |
|
| | | public class DTCB311_tagGCTalkCache : DtcBasic {
|
| | |
|
| | | public override void Done(GameNetPackBasic vNetPack)
|
| | | {
|
| | | base.Done(vNetPack);
|
| | | var package = vNetPack as HB311_tagGCTalkCache;
|
| | | ChatCtrl.Inst.RevChatInfo(package);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 9836b24a3ccd40e46b9ce6d1b2a221ec |
| | | timeCreated: 1563267425 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // B3 11 聊天缓存通知 #tagGCTalkCache
|
| | |
|
| | | public class HB311_tagGCTalkCache : GameNetPackBasic {
|
| | | public ushort Count;
|
| | | public tagGCTalkCacheInfo[] InfoList; //size = Count
|
| | |
|
| | | public HB311_tagGCTalkCache () {
|
| | | _cmd = (ushort)0xB311;
|
| | | }
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | | TransBytes (out Count, vBytes, NetDataType.WORD);
|
| | | InfoList = new tagGCTalkCacheInfo[Count];
|
| | | for (int i = 0; i < Count; i ++) {
|
| | | InfoList[i] = new tagGCTalkCacheInfo();
|
| | | TransBytes (out InfoList[i].ChannelType, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out InfoList[i].NameLen, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out InfoList[i].Name, vBytes, NetDataType.Chars, InfoList[i].NameLen);
|
| | | TransBytes (out InfoList[i].PlayerID, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out InfoList[i].Time, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out InfoList[i].Len, vBytes, NetDataType.WORD);
|
| | | TransBytes (out InfoList[i].Content, vBytes, NetDataType.Chars, InfoList[i].Len);
|
| | | TransBytes (out InfoList[i].Extras, vBytes, NetDataType.Chars, 256);
|
| | | }
|
| | | }
|
| | |
|
| | | public struct tagGCTalkCacheInfo {
|
| | | public byte ChannelType; // 1 世界 2 仙盟
|
| | | public byte NameLen;
|
| | | public string Name; //size = SrcNameLen
|
| | | public uint PlayerID;
|
| | | public uint Time;
|
| | | public ushort Len;
|
| | | public string Content; //size = Len
|
| | | public string Extras; //附加值列表
|
| | | }
|
| | |
|
| | | }
|
| New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 96f83e8de58e613499a6713611e5997d |
| | | timeCreated: 1563267391 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | }
|
| | | #endregion
|
| | | public int CHAT_INFO_CNT = 50;
|
| | |
|
| | | public const int CHAT_TIP_CNT = 4;
|
| | | public const int CHAT_CELL_CNT = 6;
|
| | | public const int CHAT_INFO_LIMIT = 50;
|
| | |
| | | /// 世界频道
|
| | | /// </summary>
|
| | | /// <param name="vNetData"></param>
|
| | | public void RevChatInfo(H0201_tagTalkGong vNetData)
|
| | | public void RevChatInfo(H0201_tagTalkGong vNetData, uint time = 0)
|
| | | {
|
| | | if (friendModel.GetFirendInfo(vNetData.PlayerID, (byte)GroupType.Balcklist) != null)//黑名单拦截
|
| | | {
|
| | |
| | | content = StringUtility.Contact(content, Language.Get("InviteTeam", vNetData.PlayerID));
|
| | | }
|
| | | chatData = new ChatWorldData(content, (int)vNetData.PlayerID, vNetData.Name, vNetData.Extras);
|
| | | if (time != 0)
|
| | | {
|
| | | chatData.createTime = TimeUtility.GetTime(time);
|
| | | }
|
| | | LocalChatHistory.Save(chatData as ChatUeseData);
|
| | | KeepChatInfo(chatData);
|
| | | }
|
| | |
| | | /// 家族频道
|
| | | /// </summary>
|
| | | /// <param name="vNetData"></param>
|
| | | public void RevChatInfo(H0203_tagTalkBang vNetData)
|
| | | public void RevChatInfo(H0203_tagTalkBang vNetData, uint time = 0)
|
| | | {
|
| | | var content = vNetData.Content;
|
| | | if (IsAssitChat(content, true) == 1 && vNetData.PlayerID != PlayerDatas.Instance.baseData.PlayerID)
|
| | |
| | | content = StringUtility.Contact(content, Language.Get("InviteTeam", vNetData.PlayerID));
|
| | | }
|
| | | ChatData chatData = new ChatFamilyData(content, (int)vNetData.PlayerID, vNetData.Name, vNetData.Extras);
|
| | | if (time != 0)
|
| | | {
|
| | | chatData.createTime = TimeUtility.GetTime(time);
|
| | | }
|
| | | LocalChatHistory.Save(chatData as ChatUeseData);
|
| | | KeepChatInfo(chatData);
|
| | | ReceiveNewChat(ChatInfoType.Fairy);
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 后端缓存
|
| | | /// </summary>
|
| | | /// <param name="vNetData"></param>
|
| | | public void RevChatInfo(HB311_tagGCTalkCache package)
|
| | | {
|
| | | for (int i = 0; i < package.Count; i++)
|
| | | {
|
| | | var data = package.InfoList[i];
|
| | | if (data.ChannelType == 1)
|
| | | {
|
| | | RevChatInfo(new H0201_tagTalkGong()
|
| | | {
|
| | | socketType = package.socketType,
|
| | | Content = data.Content,
|
| | | Extras = data.Extras,
|
| | | ExtraValue = 0,
|
| | | Name = data.Name,
|
| | | NameLen = data.NameLen,
|
| | | Len = data.Len,
|
| | | PlayerID = data.PlayerID,
|
| | | }, data.Time);
|
| | | }
|
| | | else if (data.ChannelType == 2)
|
| | | {
|
| | | RevChatInfo(new H0203_tagTalkBang()
|
| | | {
|
| | | socketType = package.socketType,
|
| | | Content = data.Content,
|
| | | Extras = data.Extras,
|
| | | ExtraValue = 0,
|
| | | Len = data.Len,
|
| | | Name = data.Name,
|
| | | NameLen = data.NameLen,
|
| | | PlayerID = data.PlayerID,
|
| | | });
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 好友私聊
|
| | | /// </summary>
|
| | |
| | | }
|
| | | switch (chat.type)
|
| | | {
|
| | | case ChatInfoType.World:
|
| | | //case ChatInfoType.World:
|
| | | case ChatInfoType.CrossServer:
|
| | | case ChatInfoType.Area:
|
| | | case ChatInfoType.Trumpet:
|
| | | case ChatInfoType.Fairy:
|
| | | //case ChatInfoType.Fairy:
|
| | | case ChatInfoType.Friend:
|
| | | if (chat.IsSound && string.IsNullOrEmpty(chat.content))
|
| | | {
|
| | |
| | | {
|
| | | switch (chat.type)
|
| | | {
|
| | | case ChatInfoType.World:
|
| | | //case ChatInfoType.World:
|
| | | case ChatInfoType.Area:
|
| | | case ChatInfoType.CrossServer:
|
| | | case ChatInfoType.Team:
|
| | | case ChatInfoType.Fairy:
|
| | | //case ChatInfoType.Fairy:
|
| | | {
|
| | | LocalChat localChat = new LocalChat();
|
| | | localChat.type = chat.type;
|
| | |
| | | ChatData chat = null;
|
| | | switch (type)
|
| | | {
|
| | | case ChatInfoType.World:
|
| | | //case ChatInfoType.World:
|
| | | case ChatInfoType.Area:
|
| | | case ChatInfoType.CrossServer:
|
| | | case ChatInfoType.Team:
|
| | | case ChatInfoType.Fairy:
|
| | | //case ChatInfoType.Fairy:
|
| | | {
|
| | | LocalChat localChat = LitJson.JsonMapper.ToObject<LocalChat>(line);
|
| | | var ts = DateTime.Now - localChat.time;
|
| | |
| | | if (chatHistory.ContainsKey(type))
|
| | | {
|
| | | chatHistory.Remove(type);
|
| | | Save();
|
| | | }
|
| | | Save();
|
| | | }
|
| | |
|
| | | public static void Clear()
|