18 子 2D卡牌客户端搭建 / 2D卡牌客户端搭建
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 2741384f32fca3a4b9de828eceda495f |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text.RegularExpressions; |
| | | using UnityEngine; |
| | | using System.Threading; |
| | | |
| | | public partial class DirtyWordConfig : ConfigBase<int, DirtyWordConfig> |
| | | { |
| | | |
| | | private static WordGroup[] DIRTYWORLD = new WordGroup[(int)char.MaxValue]; |
| | | |
| | | private static List<string> memoryList = new List<string>(); |
| | | |
| | | private static bool dirtyWordInited = false; |
| | | |
| | | static int cursor = 0; |
| | | |
| | | static int wordlenght = 0; |
| | | |
| | | static int nextCursor = 0; |
| | | |
| | | public void OnConfigParseCompleted() |
| | | { |
| | | if (string.IsNullOrEmpty(word)) |
| | | { |
| | | Debug.LogErrorFormat("屏蔽字 id = {0} 的内容为空 需要修改", id); |
| | | return; |
| | | } |
| | | var tmpword = word.Replace(" ", ""); |
| | | string key = ToDBC(tmpword); |
| | | memoryList.Add(key); |
| | | } |
| | | |
| | | private static string ToDBC(string input) |
| | | { |
| | | char[] c = input.ToCharArray(); |
| | | for (int i = 0; i < c.Length; i++) |
| | | { |
| | | if (c[i] == 12288) |
| | | { |
| | | c[i] = (char)32; |
| | | continue; |
| | | } |
| | | if (c[i] > 65280 && c[i] < 65375) |
| | | c[i] = (char)(c[i] - 65248); |
| | | } |
| | | return new string(c).ToLower(); |
| | | } |
| | | |
| | | public static string IsDirtWord(string source, char filter) |
| | | { |
| | | if (source != string.Empty) |
| | | { |
| | | cursor = 0; |
| | | nextCursor = 0; |
| | | char[] temp = source.ToCharArray(); |
| | | source = FitterSpecial(source); |
| | | for (int i = 0; i < source.Length; i++) |
| | | { |
| | | //查询以该字为首字符的词组 |
| | | WordGroup group = DIRTYWORLD[(int)ToDBC(source)[i]]; |
| | | if (group != null) |
| | | { |
| | | for (int z = 0; z < group.Count(); z++) |
| | | { |
| | | string word = group.GetWord(z); |
| | | if (word.Length == 0 || Check(word, source)) |
| | | { |
| | | string blackword = string.Empty; |
| | | for (int pos = 0; pos < wordlenght + 1; pos++) |
| | | { |
| | | try |
| | | { |
| | | blackword += temp[pos + cursor].ToString(); |
| | | temp[pos + cursor] = filter; |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | Debug.Log(e.Message); |
| | | } |
| | | } |
| | | cursor = cursor + wordlenght; |
| | | i = i + wordlenght; |
| | | |
| | | } |
| | | } |
| | | } |
| | | cursor++; |
| | | } |
| | | return new string(temp); |
| | | } |
| | | return string.Empty; |
| | | } |
| | | |
| | | public static bool IsDirtWord(string source) |
| | | { |
| | | if (System.Text.Encoding.UTF8.GetByteCount(source) == 1) |
| | | return false; |
| | | |
| | | if (source != string.Empty) |
| | | { |
| | | cursor = 0; |
| | | nextCursor = 0; |
| | | for (int i = 0; i < source.Length; i++) |
| | | { |
| | | //查询以该字为首字符的词组 |
| | | WordGroup group = DIRTYWORLD[(int)ToDBC(source)[i]]; |
| | | if (group != null) |
| | | { |
| | | for (int z = 0; z < group.Count(); z++) |
| | | { |
| | | string word = group.GetWord(z); |
| | | if (word.Length == 0 || Check(word, source)) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | cursor++; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private static bool Check(string blackWord, string source) |
| | | { |
| | | wordlenght = 0; |
| | | int wordCnt = 0; |
| | | //检测源下一位游标 |
| | | nextCursor = cursor + 1; |
| | | bool found = false; |
| | | //遍历词的每一位做匹配 |
| | | for (int i = 0; i < blackWord.Length; i++) |
| | | { |
| | | //特殊字符偏移游标 |
| | | int offset = 0; |
| | | if (nextCursor >= source.Length) |
| | | { |
| | | break; |
| | | } |
| | | else |
| | | { |
| | | //检测下位字符如果不是汉字 数字 字符 偏移量加1,,过滤特殊字符 |
| | | for (int y = nextCursor; y < source.Length; y++) |
| | | { |
| | | //if (!IsCHS(source[y]) && !IsNum(source[y]) && !IsAlphabet(source[y])) { |
| | | if (IsSpecial(source[y])) |
| | | { |
| | | offset++; |
| | | //避让特殊字符,下位游标如果>=字符串长度 跳出 |
| | | if (nextCursor + offset >= source.Length) break; |
| | | wordlenght++; |
| | | |
| | | } |
| | | else break; |
| | | } |
| | | if (nextCursor + offset >= source.Length) |
| | | { |
| | | break; |
| | | } |
| | | if (blackWord[i] == char.ToLower(source[nextCursor + offset])) |
| | | { |
| | | wordCnt++; |
| | | found = true; |
| | | } |
| | | else |
| | | { |
| | | found = false; |
| | | break; |
| | | } |
| | | } |
| | | nextCursor = nextCursor + 1 + offset; |
| | | wordlenght++; |
| | | } |
| | | if (blackWord.Length != wordCnt) return false; |
| | | return found; |
| | | } |
| | | |
| | | private static bool IsSpecial(char character) |
| | | { |
| | | if (character == ' ') |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | static public void DirtyWordInit() |
| | | { |
| | | if (dirtyWordInited) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | dirtyWordInited = true; |
| | | |
| | | ThreadPool.QueueUserWorkItem((object aaa) => |
| | | { |
| | | memoryList.Sort((string x, string y) => |
| | | { |
| | | return x.CompareTo(y); |
| | | }); |
| | | for (int i = memoryList.Count - 1; i > 0; i--) |
| | | { |
| | | if (memoryList[i].ToString() == memoryList[i - 1].ToString()) |
| | | { |
| | | memoryList.RemoveAt(i); |
| | | } |
| | | } |
| | | foreach (string word in memoryList) |
| | | { |
| | | WordGroup group = DIRTYWORLD[(int)word[0]]; |
| | | if (group == null) |
| | | { |
| | | group = new WordGroup(); |
| | | DIRTYWORLD[(int)word[0]] = group; |
| | | } |
| | | group.Add(word.Substring(1)); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | public static bool IsCHS(char character) |
| | | { |
| | | // 中文表意字符的范围 4E00-9FA5 |
| | | int charVal = (int)character; |
| | | return (charVal >= 0x4e00 && charVal <= 0x9fa5); |
| | | } |
| | | |
| | | private static bool IsNum(char character) |
| | | { |
| | | int charVal = (int)character; |
| | | return (charVal >= 48 && charVal <= 57); |
| | | } |
| | | |
| | | private static bool IsAlphabet(char character) |
| | | { |
| | | int charVal = (int)character; |
| | | return ((charVal >= 97 && charVal <= 122) || (charVal >= 65 && charVal <= 90)); |
| | | } |
| | | |
| | | private const string FACE_REPLACE = @"#~[0-9a-zA-Z]{1,3}"; |
| | | private static Regex FaceRegex = new Regex(FACE_REPLACE, RegexOptions.Singleline); |
| | | public static string FitterSpecial(string source) |
| | | { |
| | | return FaceRegex.Replace(source, " "); |
| | | } |
| | | } |
| | | |
| | | class WordGroup |
| | | { |
| | | private List<string> groupList; |
| | | |
| | | public WordGroup() |
| | | { |
| | | groupList = new List<string>(); |
| | | } |
| | | |
| | | public void Add(string word) |
| | | { |
| | | groupList.Add(word); |
| | | } |
| | | |
| | | public int Count() |
| | | { |
| | | return groupList.Count; |
| | | } |
| | | |
| | | public string GetWord(int index) |
| | | { |
| | | return groupList[index]; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: eaa6a42d2cc924045b9f3e241e5f3285 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using System.Text.RegularExpressions; |
| | | using UnityEngine; |
| | | using Cysharp.Threading.Tasks; |
| | | |
| | | |
| | | public class ChatCenter : Singleton<ChatCenter> |
| | | { |
| | | public int talkRechargeLimmit; |
| | | public int talkLevelLimmit; |
| | | |
| | | public void Init() |
| | | { |
| | | ParseConfig(); |
| | | //var _uiframe = UIFrameMgr.Inst; |
| | | // ChatSetting.Instance.RefreshChatSetAct += RefreshChatSetAct; |
| | | // TimeMgr.Instance.OnSyntonyEvent += OnSyntonyEvent; |
| | | // VoiceHttpRequest.Instance.samplesDecodecComplete += SamplesDecodecComplete; |
| | | UIManager.Instance.OnOpenWindow += WindowAfterOpenEvent; |
| | | // StageLoad.Instance.onStageLoadFinish += OnStageLoadFinish; |
| | | // PrepareHandler.Instance.OnPrepareEnd += OnPrepareEnd; |
| | | |
| | | var time = bandTime; |
| | | banTimeArray[0] = time.Year; |
| | | banTimeArray[1] = time.Month; |
| | | banTimeArray[2] = time.Day; |
| | | banTimeArray[3] = time.Hour; |
| | | banTimeArray[4] = time.Minute; |
| | | banTimeArray[5] = time.Second; |
| | | } |
| | | |
| | | public void UnInit() |
| | | { |
| | | |
| | | } |
| | | |
| | | bool serverInited = false; |
| | | |
| | | public int chatCharacterLimit { get; private set; } |
| | | public int bugleItem { get; private set; } |
| | | public bool beforeDungeon { get; private set; } |
| | | public List<ChatInfoType> chatChannels { get; private set; } |
| | | |
| | | public int chatInputLength { get; set; } |
| | | public StringBuilder m_EncodeBuilder = new StringBuilder(); |
| | | void ParseConfig() |
| | | { |
| | | chatCharacterLimit = int.Parse(FuncConfigConfig.Get("MessageLength").Numerical1); |
| | | var _funcCfg = FuncConfigConfig.Get("BugleItem"); |
| | | bugleItem = int.Parse(_funcCfg.Numerical1); |
| | | chatChannels = new List<ChatInfoType>(); |
| | | chatChannels.Add(ChatInfoType.System); |
| | | chatChannels.Add(ChatInfoType.World); |
| | | chatChannels.Add(ChatInfoType.CrossServer); |
| | | chatChannels.Add(ChatInfoType.Area); |
| | | chatChannels.Add(ChatInfoType.Team); |
| | | chatChannels.Add(ChatInfoType.Invite); |
| | | chatChannels.Add(ChatInfoType.Trumpet); |
| | | chatChannels.Add(ChatInfoType.Fairy); |
| | | chatChannels.Add(ChatInfoType.Friend); |
| | | chatChannels.Add(ChatInfoType.default1); |
| | | |
| | | var config = FuncConfigConfig.Get("ClientChatBan"); |
| | | banCheckSecond = int.Parse(config.Numerical1); |
| | | repeatCountLimit = int.Parse(config.Numerical2); |
| | | maliceCheckCount = int.Parse(config.Numerical3); |
| | | maliceLimitCount = int.Parse(config.Numerical4); |
| | | var array = ConfigParse.GetMultipleStr<int>(config.Numerical5); |
| | | singleBanSecond = array[0]; |
| | | maxBanSecond = array[1]; |
| | | |
| | | config = FuncConfigConfig.Get("LocalChatHistoryCount"); |
| | | if (config != null) |
| | | { |
| | | LocalChatHistory.localSaveCount = int.Parse(config.Numerical1); |
| | | if (!string.IsNullOrEmpty(config.Numerical2)) |
| | | { |
| | | LocalChatHistory.localChatKeepHour = int.Parse(config.Numerical2); |
| | | } |
| | | } |
| | | |
| | | config = FuncConfigConfig.Get("TalkLimit"); |
| | | talkRechargeLimmit = int.Parse(config.Numerical1); |
| | | talkLevelLimmit = int.Parse(config.Numerical2); |
| | | } |
| | | |
| | | public event Action<string, bool, bool> UpdateChatValueEvent; |
| | | public void ChangeChatValue(string _msg, bool _add, bool _force) |
| | | { |
| | | if (UpdateChatValueEvent != null) |
| | | { |
| | | UpdateChatValueEvent(_msg, _add, _force); |
| | | } |
| | | } |
| | | |
| | | public event Action UpdateChatType; |
| | | public void ChangeChatType() |
| | | { |
| | | if (UpdateChatType != null) |
| | | { |
| | | UpdateChatType(); |
| | | } |
| | | } |
| | | |
| | | public event Action UpdateChatContent; |
| | | public void UpdateChatContentPos() |
| | | { |
| | | if (UpdateChatContent != null) |
| | | { |
| | | UpdateChatContent(); |
| | | } |
| | | } |
| | | |
| | | public ChatData GetChatData(ChatInfoType _type, int _index, int _pteChatId = 0) |
| | | { |
| | | ChatData chat = null; |
| | | if (_type == ChatInfoType.Friend) |
| | | { |
| | | var _list = ChatManager.Instance.GetChatInfo(_pteChatId == 0 ? ChatManager.Instance.PteChatID : _pteChatId); |
| | | if (_list == null || _index >= _list.Count) |
| | | { |
| | | return null; |
| | | } |
| | | chat = _list[_index]; |
| | | } |
| | | else |
| | | { |
| | | List<ChatData> _list = ChatManager.Instance.GetChatInfo(_type); |
| | | if (_list == null || _index >= _list.Count) |
| | | { |
| | | return null; |
| | | } |
| | | chat = _list[_index]; |
| | | } |
| | | return chat; |
| | | } |
| | | |
| | | public const int RecentlyChatNum = 8; |
| | | public List<RecentlyChat> recentlyChats = new List<RecentlyChat>(RecentlyChatNum); |
| | | public event Action RecentlyChatChangeEvent; |
| | | public RecentlyChat recentlyChat = null; |
| | | |
| | | public RecentlyChat SaveRecentlyChat(string _chat) |
| | | { |
| | | if (ChatManager.Instance.IsInviteChat(_chat) |
| | | || Regex.IsMatch(_chat, ChatManager.KILL_IDENTIFY)) |
| | | { |
| | | return null; |
| | | } |
| | | if (s_VoiceRegex.IsMatch(_chat)) |
| | | { |
| | | _chat = s_VoiceRegex.Replace(_chat, string.Empty); |
| | | } |
| | | if (recentlyChats.FindIndex((x) => |
| | | { |
| | | return x.display.Equals(_chat); |
| | | }) != -1) |
| | | { |
| | | return null; |
| | | } |
| | | if (recentlyChats.Count >= RecentlyChatNum) |
| | | { |
| | | var _old = recentlyChats[0]; |
| | | recentlyChats.RemoveAt(0); |
| | | _old = null; |
| | | } |
| | | var _recentlyChat = new RecentlyChat(_chat); |
| | | recentlyChats.Add(_recentlyChat); |
| | | if (RecentlyChatChangeEvent != null) |
| | | { |
| | | RecentlyChatChangeEvent(); |
| | | } |
| | | return _recentlyChat; |
| | | } |
| | | |
| | | public void OnBeforePlayerDataInitialize() |
| | | { |
| | | recentlyChat = null; |
| | | serverInited = false; |
| | | m_VoiceChatDict.Clear(); |
| | | } |
| | | |
| | | public void OnSwitchAccount() |
| | | { |
| | | |
| | | } |
| | | |
| | | |
| | | public class RecentlyChat |
| | | { |
| | | public string display = string.Empty; |
| | | 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; |
| | | } |
| | | |
| | | public void Add(string _name, string _itemInfo) |
| | | { |
| | | itemNames.Add(_name); |
| | | itemInfos.Add(_itemInfo); |
| | | } |
| | | |
| | | public void Reset() |
| | | { |
| | | itemIndexs.Clear(); |
| | | for (int i = 0; i < itemInfos.Count; i++) |
| | | { |
| | | 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 static readonly Regex s_VoiceRegex = new Regex("<v=([0-9]+)_([0-9]+)>"); |
| | | private Dictionary<int, VoiceChat> m_VoiceChatDict = new Dictionary<int, VoiceChat>(); |
| | | |
| | | public class VoiceChat |
| | | { |
| | | public ChatInfoType chatType; |
| | | public int index; |
| | | public int toPlayer; |
| | | public long tick; |
| | | public byte length; |
| | | public bool translate = false; |
| | | public byte[] encode; |
| | | public string result = string.Empty; |
| | | } |
| | | |
| | | public void SetVoice(int _instance, ChatInfoType _type, float _length, int _toPlayer = 0) |
| | | { |
| | | if (!m_VoiceChatDict.ContainsKey(_instance)) |
| | | { |
| | | VoiceChat _chat = new VoiceChat() |
| | | { |
| | | chatType = _type, |
| | | index = _instance, |
| | | toPlayer = _toPlayer, |
| | | tick = TimeUtility.ServerNow.Ticks, |
| | | translate = false, |
| | | encode = null, |
| | | length = (byte)Mathf.Min((int)(_length * 10), 100), |
| | | }; |
| | | m_VoiceChatDict.Add(_instance, _chat); |
| | | } |
| | | } |
| | | |
| | | public void OnPlayerLoginOk() |
| | | { |
| | | serverInited = true; |
| | | } |
| | | |
| | | private void WindowAfterOpenEvent(UIBase win) |
| | | { |
| | | CheckChatFloatOpen(); |
| | | if (win is MainWin) |
| | | { |
| | | Co_CheckAfterCollect().Forget(); |
| | | } |
| | | } |
| | | |
| | | public bool IsShowChatFloat() |
| | | { |
| | | return !UIManager.Instance.IsOpened<LoadingWin>(); |
| | | // if (!UIManager.Instance.IsOpened<LoadingWin>()) |
| | | // return true; |
| | | // return false; |
| | | } |
| | | |
| | | private void CheckChatFloatOpen() |
| | | { |
| | | if (IsShowChatFloat()) |
| | | { |
| | | // TODO YYL |
| | | // if (!UIManager.Instance.IsOpened<ChatFloatWin>()) |
| | | // { |
| | | // UIManager.Instance.OpenWindow<ChatFloatWin>(); |
| | | // } |
| | | } |
| | | //else |
| | | //{ |
| | | // if (UIManager.Instance.IsOpened<ChatFloatWin>()) |
| | | // { |
| | | // UIManager.Instance.Close<ChatFloatWin>(); |
| | | // } |
| | | //} |
| | | } |
| | | |
| | | bool openChatAfterCollect = false; |
| | | // private void OnPrepareEnd(int playerId, int type) |
| | | // { |
| | | // if (playerId == PlayerDatas.Instance.baseData.PlayerID |
| | | // && type == 0 && PlayerDatas.Instance.baseData.MapID == 31230) |
| | | // { |
| | | // openChatAfterCollect = true; |
| | | // } |
| | | // CheckOpenChatAfterCollect(); |
| | | // } |
| | | |
| | | async UniTask Co_CheckAfterCollect() |
| | | { |
| | | await UniTask.Yield(); |
| | | CheckOpenChatAfterCollect(); |
| | | } |
| | | |
| | | void CheckOpenChatAfterCollect() |
| | | { |
| | | if (!openChatAfterCollect) |
| | | { |
| | | return; |
| | | } |
| | | if (PlayerDatas.Instance.baseData.MapID != 31230) |
| | | { |
| | | return; |
| | | } |
| | | if (!UIManager.Instance.IsOpened<MainWin>() |
| | | /*TODO YYL|| NewBieCenter.Instance.inGuiding*/) |
| | | { |
| | | return; |
| | | } |
| | | openChatAfterCollect = false; |
| | | |
| | | //TODO YYL |
| | | // if (!UIManager.Instance.IsOpened<ChatWin>()) |
| | | // { |
| | | // ChatManager.Instance.presentChatType = ChatInfoType.Fairy; |
| | | // UIManager.Instance.Open<ChatWin>(); |
| | | // } |
| | | } |
| | | |
| | | |
| | | public string SetChatExtra() |
| | | { |
| | | var vipLevel = PlayerDatas.Instance.baseData.VIPLv; |
| | | var job = PlayerDatas.Instance.baseData.Job; |
| | | var bubbleId = PlayerDatas.Instance.baseData.bubbleId; |
| | | var serverGroupId = PlayerDatas.Instance.baseData.ServerGroupId; |
| | | return StringUtility.Contact(vipLevel.ToString().PadLeft(2, '0'), 0, job, |
| | | bubbleId.ToString().PadLeft(2, '0'), serverGroupId.ToString().PadLeft(7, '0')); |
| | | } |
| | | |
| | | public void HandleChatBanned(ChatInfoType channel, string message, int toPlayer) |
| | | { |
| | | if (IsChatBanned || clientBanned) |
| | | { |
| | | var playerId = PlayerDatas.Instance.baseData.PlayerID; |
| | | var playerName = UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName); |
| | | switch (channel) |
| | | { |
| | | case ChatInfoType.World: |
| | | ChatManager.Instance.RevChatInfo(new H0201_tagTalkGong() |
| | | { |
| | | Content = message, |
| | | Extras = SetChatExtra(), |
| | | PlayerID = playerId, |
| | | Name = playerName, |
| | | }); |
| | | break; |
| | | case ChatInfoType.Area: |
| | | ChatManager.Instance.RevChatInfo(new H0207_tagTalkArea() |
| | | { |
| | | Content = message, |
| | | Extras = SetChatExtra(), |
| | | PlayerID = playerId, |
| | | SrcName = playerName, |
| | | }); |
| | | break; |
| | | case ChatInfoType.CrossServer: |
| | | ChatManager.Instance.RevChatInfo(new H0208_tagTalkCountry() |
| | | { |
| | | Content = message, |
| | | Extras = SetChatExtra(), |
| | | PlayerID = playerId, |
| | | Name = playerName, |
| | | }); |
| | | break; |
| | | case ChatInfoType.Team: |
| | | ChatManager.Instance.RevChatInfo(new H0205_tagTalkDui() |
| | | { |
| | | PlayerID = playerId, |
| | | Name = playerName, |
| | | Content = message, |
| | | Extras = SetChatExtra(), |
| | | }); |
| | | break; |
| | | case ChatInfoType.Fairy: |
| | | ChatManager.Instance.RevChatInfo(new H0203_tagTalkBang() |
| | | { |
| | | PlayerID = playerId, |
| | | Content = message, |
| | | Extras = SetChatExtra(), |
| | | Name = playerName, |
| | | }); |
| | | break; |
| | | case ChatInfoType.Friend: |
| | | ChatManager.Instance.RevChatInfo(new H0206_tagTalkMi() |
| | | { |
| | | PlayerID = playerId, |
| | | SrcName = playerName, |
| | | Content = message, |
| | | Extras = SetChatExtra(), |
| | | ToPlayerID = (uint)toPlayer, |
| | | ToName = string.Empty, |
| | | TalkType = 1, |
| | | }); |
| | | break; |
| | | case ChatInfoType.default1: |
| | | ChatManager.Instance.RevChatInfo(new HA707_tagMCPyTalk() |
| | | { |
| | | Content = message, |
| | | Extras = SetChatExtra(), |
| | | PlayerID = playerId, |
| | | Name = playerName, |
| | | }); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void ServerForbidenChat(bool value) |
| | | { |
| | | if (value) |
| | | { |
| | | serverForbidenChat = true; |
| | | } |
| | | } |
| | | private bool m_serverForbidenChat; |
| | | bool serverForbidenChat { |
| | | //get { return LocalSave.GetBool("ServerForbidenChat"); } |
| | | //set { LocalSave.SetBool("ServerForbidenChat", value); } |
| | | get { return m_serverForbidenChat; } |
| | | set { m_serverForbidenChat = value; } |
| | | } |
| | | |
| | | public bool IsChatBanned { |
| | | get { |
| | | var value = PlayerDatas.Instance.extersion.forbidenTalk; |
| | | //增加判断是否设备禁言 |
| | | if (LocalSave.GetBool("ServerForbidenChatDevice1", false) || value > 0) |
| | | return true; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | public bool clientBanned { |
| | | get { |
| | | return false; |
| | | //var time = new DateTime(banTimeArray[0], banTimeArray[1], banTimeArray[2], |
| | | // banTimeArray[3], banTimeArray[4], banTimeArray[5]); |
| | | //return TimeUtility.ServerNow < time; |
| | | } |
| | | } |
| | | |
| | | public int banCheckSecond = 60; |
| | | public int repeatCountLimit = 5; |
| | | public int maliceCheckCount = 10; |
| | | public int maliceLimitCount = 5; |
| | | public int singleBanSecond = 1; |
| | | public int maxBanSecond = 1; |
| | | |
| | | public int banSecond { |
| | | get { return LocalSave.GetInt("ClientChatBanSecond", 0); } |
| | | set { |
| | | LocalSave.SetInt("ClientChatBanSecond", value); |
| | | } |
| | | } |
| | | |
| | | private int[] banTimeArray = new int[6]; |
| | | private DateTime bandTime { |
| | | get { |
| | | var timeArray = LocalSave.GetIntArray("ClientChatBanTime"); |
| | | if (null == timeArray) |
| | | { |
| | | return TimeUtility.OriginalTime; |
| | | } |
| | | else |
| | | { |
| | | return new DateTime(timeArray[0], timeArray[1], timeArray[2], timeArray[3], timeArray[4], timeArray[5]); |
| | | } |
| | | } |
| | | set { |
| | | banTimeArray[0] = value.Year; |
| | | banTimeArray[1] = value.Month; |
| | | banTimeArray[2] = value.Day; |
| | | banTimeArray[3] = value.Hour; |
| | | banTimeArray[4] = value.Minute; |
| | | banTimeArray[5] = value.Second; |
| | | LocalSave.SetIntArray("ClientChatBanTime", banTimeArray); |
| | | } |
| | | } |
| | | |
| | | public void ChatClientBan() |
| | | { |
| | | // if (!clientBanned) |
| | | // { |
| | | // var time = TimeUtility.ServerNow; |
| | | // var second = Mathf.Min(maxBanSecond, banSecond + singleBanSecond); |
| | | // banSecond = second; |
| | | // bandTime = time.AddTicks(second * TimeSpan.TicksPerSecond); |
| | | //#if !UNITY_EDITOR |
| | | // OperationLogCollect.Instance.BugReport(Language.Get("ClientBanTitle"), |
| | | // Language.Get("ClientBanContent", banSecond)); |
| | | //#endif |
| | | // } |
| | | } |
| | | |
| | | public bool IsClientBan(ChatInfoType chatType) |
| | | { |
| | | return false; |
| | | //if (!clientBanned) |
| | | //{ |
| | | // return false; |
| | | //} |
| | | //if (chatType == ChatInfoType.Fairy) |
| | | //{ |
| | | // var model = ModelCenter.Instance.GetModel<DailyQuestModel>(); |
| | | // return model.GetQuestState((int)DailyQuestType.FairyFeast) != DailyQuestModel.DailyQuestState.Normal; |
| | | //} |
| | | //return clientBanned; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: dda4314f0337ba442ac1a05b0cdd2350 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using System.Text; |
| | | using System; |
| | | using System.Text.RegularExpressions; |
| | | using vnxbqy.UI; |
| | | |
| | | using System.Linq; |
| | | |
| | | public class ChatManager : GameSystemManager<ChatManager> |
| | | { |
| | | 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; |
| | | |
| | | public readonly int BugleItem = 0;//喇叭物品id |
| | | |
| | | static StringBuilder sb = new StringBuilder(); |
| | | /// <summary> |
| | | /// 聊天信息 |
| | | /// </summary> |
| | | private bool _lockUpdate = true; |
| | | public bool lockUpdate { |
| | | get { |
| | | return _lockUpdate; |
| | | } |
| | | set { |
| | | _lockUpdate = value; |
| | | if (ChatFriend != null && ChatFriend.IsOpen) |
| | | { |
| | | ChatFriend.OnSetLock(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private Dictionary<ChatInfoType, List<ChatData>> chatDics = new Dictionary<ChatInfoType, List<ChatData>>(); |
| | | |
| | | private Dictionary<ChatInfoType, bool> chatOpenDics = new Dictionary<ChatInfoType, bool>(); |
| | | |
| | | public List<ChatData> chatDisplayList = new List<ChatData>(); |
| | | |
| | | #region 私聊 |
| | | private Dictionary<int, List<ChatFriendData>> pteChatDics = new Dictionary<int, List<ChatFriendData>>(); |
| | | public event Action OnPteChatChangeEvent; |
| | | public event Action<int> SelectRecentlyEvent; |
| | | public static event OnChatPteRefresh OnRefreshPteChat; |
| | | private int pteChatId = 0; |
| | | public int PteChatID { |
| | | get { return pteChatId; } |
| | | set { |
| | | if (pteChatId == value) |
| | | { |
| | | return; |
| | | } |
| | | pteChatId = value; |
| | | if (OnPteChatChangeEvent != null) |
| | | { |
| | | OnPteChatChangeEvent(); |
| | | } |
| | | if (ChatFriend != null && ChatFriend.IsOpen) |
| | | { |
| | | ChatFriend.RefreshChatInfo(); |
| | | } |
| | | } |
| | | } |
| | | private string pteChatName = string.Empty; |
| | | public string PteChatName { |
| | | get { return pteChatName; } |
| | | set { pteChatName = value; } |
| | | } |
| | | |
| | | private ChatFriend m_ChatFriend; |
| | | public ChatFriend ChatFriend { |
| | | get { return m_ChatFriend; } |
| | | } |
| | | |
| | | public void ClearPteChat(int playerId) |
| | | { |
| | | var id = (int)PlayerDatas.Instance.PlayerId + playerId; |
| | | if (pteChatDics.ContainsKey(id)) |
| | | { |
| | | pteChatDics.Remove(id); |
| | | if (OnRefreshPteChat != null) |
| | | { |
| | | OnRefreshPteChat(null); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public void SelectRecentlyChat(int playerId) |
| | | { |
| | | if (SelectRecentlyEvent != null) |
| | | { |
| | | SelectRecentlyEvent(playerId); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | private List<ChatData> chatlist = new List<ChatData>(); |
| | | private List<ChatData> chatUpList = new List<ChatData>(); |
| | | |
| | | public delegate void OnChatRefresh(ChatInfoType type); |
| | | public static event OnChatRefresh OnRefreshChat; |
| | | |
| | | public delegate void OnChatSelfRefresh(ChatData data); |
| | | public static event OnChatSelfRefresh OnRefreshSelf; |
| | | |
| | | public delegate void OnChatPteRefresh(ChatFriendData data); |
| | | |
| | | public ChatInfoType presentChatType { |
| | | get; set; |
| | | } |
| | | |
| | | public event Action OnClickCloseChatEvent; |
| | | public event Action<bool> OnChatExtentOpenEvent; |
| | | |
| | | public event Action<ChatData> chatFloatUpdate; |
| | | |
| | | // TeamModel teamModel { |
| | | // get { |
| | | // return ModelCenter.Instance.GetModel<TeamModel>(); |
| | | // } |
| | | // } |
| | | |
| | | // FriendsModel friendModel { |
| | | // get { return ModelCenter.Instance.GetModel<FriendsModel>(); } |
| | | // } |
| | | |
| | | // EquipGemModel equipGemModel { get { return ModelCenter.Instance.GetModel<EquipGemModel>(); } } |
| | | // EquipStrengthModel equipStrengthModel { get { return ModelCenter.Instance.GetModel<EquipStrengthModel>(); } } |
| | | // EquipStarModel equipStarModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } } |
| | | // EquipTrainModel equipTrainModel { get { return ModelCenter.Instance.GetModel<EquipTrainModel>(); } } |
| | | // EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } } |
| | | PackManager packManager => PackManager.Instance; |
| | | // DungeonAssistModel dungeonAssistModel { get { return ModelCenter.Instance.GetModel<DungeonAssistModel>(); } } |
| | | |
| | | public Dictionary<ChatInfoType, List<string>> achievementRandoms = new Dictionary<ChatInfoType, List<string>>(); |
| | | List<string> assistThankLanguages = new List<string>(); |
| | | Int2 assistThankLevelLimit = new Int2(150, 200); |
| | | |
| | | public ChatManager() |
| | | { |
| | | chatOpenDics.Add(ChatInfoType.System, true); |
| | | chatOpenDics.Add(ChatInfoType.World, true); |
| | | chatOpenDics.Add(ChatInfoType.CrossServer, true); |
| | | chatOpenDics.Add(ChatInfoType.Area, true); |
| | | chatOpenDics.Add(ChatInfoType.Team, true); |
| | | chatOpenDics.Add(ChatInfoType.Invite, true); |
| | | chatOpenDics.Add(ChatInfoType.Trumpet, true); |
| | | chatOpenDics.Add(ChatInfoType.Fairy, true); |
| | | chatOpenDics.Add(ChatInfoType.default1, true); |
| | | lockUpdate = true; |
| | | presentChatType = ChatInfoType.World; |
| | | IsExtentOpen = false; |
| | | |
| | | var _funcCfg = FuncConfigConfig.Get("BugleItem"); |
| | | BugleItem = int.Parse(_funcCfg.Numerical1); |
| | | |
| | | DTC0102_tagCDBPlayer.switchAccountEvent += SwitchAccountEvent; |
| | | // TODO YYL |
| | | // StageLoad.Instance.onStageLoadFinish += OnStageLoadFinish; |
| | | DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += PlayerLoginOkEvent; |
| | | |
| | | InitChatRedpoints(); |
| | | |
| | | FuncConfigConfig _cfg = FuncConfigConfig.Get("RandomWord"); |
| | | try |
| | | { |
| | | achievementRandoms.Add(ChatInfoType.World, new List<string>(ConfigParse.GetMultipleStr(_cfg.Numerical1))); |
| | | achievementRandoms.Add(ChatInfoType.Fairy, new List<string>(ConfigParse.GetMultipleStr(_cfg.Numerical2))); |
| | | var json = LitJson.JsonMapper.ToObject(_cfg.Numerical3); |
| | | foreach (var key in json.Keys) |
| | | { |
| | | var type = int.Parse(key); |
| | | m_TaskRandomChats.Add(type, new List<string>(LitJson.JsonMapper.ToObject<string[]>(json[key].ToJson()))); |
| | | } |
| | | assistThankLanguages.AddRange(ConfigParse.GetMultipleStr(_cfg.Numerical4)); |
| | | if (!string.IsNullOrEmpty(_cfg.Numerical5)) |
| | | { |
| | | var levelArray = ConfigParse.GetMultipleStr<int>(_cfg.Numerical5); |
| | | assistThankLevelLimit = new Int2(levelArray[0], levelArray[1]); |
| | | } |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | Debug.LogError(e.Message); |
| | | } |
| | | } |
| | | |
| | | private void PlayerLoginOkEvent() |
| | | { |
| | | UpdateRedpoint(ChatInfoType.Team); |
| | | UpdateRedpoint(ChatInfoType.Fairy); |
| | | } |
| | | |
| | | private void SwitchAccountEvent() |
| | | { |
| | | ClearAllChatInfo(); |
| | | } |
| | | |
| | | void ChatReport(ChatInfoType chatType, string content, string toPlayer) |
| | | { |
| | | try |
| | | { |
| | | if (ChatCenter.Instance.IsChatBanned || ChatCenter.Instance.IsClientBan(chatType) || |
| | | IsInviteChat(content) || KillRegex.IsMatch(content)) |
| | | { |
| | | return; |
| | | } |
| | | var channelName = string.Empty; |
| | | switch (chatType) |
| | | { |
| | | case ChatInfoType.World: |
| | | channelName = Language.Get("ChatType_World"); |
| | | break; |
| | | case ChatInfoType.Area: |
| | | channelName = Language.Get("ChatType_Area"); |
| | | break; |
| | | case ChatInfoType.CrossServer: |
| | | channelName = Language.Get("ChatType_CrossServer"); |
| | | break; |
| | | case ChatInfoType.Team: |
| | | channelName = Language.Get("ChatType_Team"); |
| | | break; |
| | | case ChatInfoType.Invite: |
| | | channelName = Language.Get("ChatType_Invite"); |
| | | break; |
| | | case ChatInfoType.Trumpet: |
| | | channelName = Language.Get("ChatType_Trumpet"); |
| | | break; |
| | | case ChatInfoType.Fairy: |
| | | channelName = Language.Get("ChatType_Fairy"); |
| | | break; |
| | | case ChatInfoType.Friend: |
| | | channelName = Language.Get("PlayerDetail_PrivateChat"); |
| | | break; |
| | | case ChatInfoType.default1: |
| | | channelName = Language.Get("ChatType_default1"); |
| | | break; |
| | | default: |
| | | return; |
| | | } |
| | | // TODO YYL |
| | | // OperationLogCollect.Instance.ChatReport(content, channelName, chatType == ChatInfoType.Friend ? toPlayer : string.Empty, chatType); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | Debug.Log(e.StackTrace + e.Message); |
| | | } |
| | | } |
| | | |
| | | public void SendChatInfo(ChatInfoType type, string msg, ChatExtraData? info = null , bool isDirtyWord = true, bool isChatInfoCount = true) |
| | | { |
| | | bool isDirty = false; |
| | | bool isVoice = ChatCenter.s_VoiceRegex.IsMatch(msg); |
| | | |
| | | if (CheckEmptyChat(msg)) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("CanootTalk14"); |
| | | return; |
| | | } |
| | | |
| | | ChatReport(type, msg, PteChatName); |
| | | |
| | | if (!isVoice && !InviteRegex.IsMatch(msg)) |
| | | { |
| | | if (isDirtyWord) |
| | | { |
| | | isDirty = DirtyWordConfig.IsDirtWord(msg); |
| | | if (isDirty) |
| | | msg = DirtyWordConfig.IsDirtWord(msg, '*'); |
| | | } |
| | | |
| | | var length = GetChatMessageLength(msg); |
| | | if (isChatInfoCount) |
| | | { |
| | | if (length > CHAT_INFO_CNT) |
| | | { |
| | | ServerTipDetails.DisplayNormalTip(Language.Get("L1014")); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if (itemPlaceList.Count > 5) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("ChatSendItemLimit"); |
| | | return; |
| | | } |
| | | } |
| | | LanguageVerify.toPlayer = (uint)PteChatID; |
| | | LanguageVerify.toPlayerName = PteChatName; |
| | | LanguageVerify.Instance.VerifyChat(msg, type, (bool ok, string result) => |
| | | { |
| | | if (ok) |
| | | { |
| | | ChatCenter.RecentlyChat _recentlyChat = null; |
| | | if (!isDirty && !isVoice) |
| | | { |
| | | _recentlyChat = ChatCenter.Instance.SaveRecentlyChat(result); |
| | | } |
| | | msg = CheckHasItem(result, _recentlyChat); |
| | | ChatCenter.Instance.recentlyChat = null; |
| | | |
| | | if (ChatCenter.Instance.IsChatBanned || ChatCenter.Instance.IsClientBan(type)) |
| | | { |
| | | var toPlayer = PteChatID; |
| | | if (info.HasValue && info.Value.infoint1 == 0) |
| | | { |
| | | toPlayer = info.Value.infoint1; |
| | | } |
| | | ChatCenter.Instance.HandleChatBanned(type, msg, toPlayer); |
| | | return; |
| | | } |
| | | |
| | | switch (type) |
| | | { |
| | | case ChatInfoType.World: |
| | | case ChatInfoType.Fairy: |
| | | if (IsAssitChat(msg) != 0) |
| | | { |
| | | // TODO YYL |
| | | // teamModel.RequestAssistAutoMatch(); |
| | | } |
| | | break; |
| | | } |
| | | |
| | | switch (type) |
| | | { |
| | | case ChatInfoType.World: |
| | | { |
| | | C0201_tagCTalkGong chatPack = new C0201_tagCTalkGong(); |
| | | chatPack.Len = (ushort)GetUTF8InfoLen(msg); |
| | | chatPack.Content = msg; |
| | | GameNetSystem.Instance.SendInfo(chatPack); |
| | | } |
| | | break; |
| | | case ChatInfoType.Area: |
| | | { |
| | | C0207_tagCTalkArea chatPack = new C0207_tagCTalkArea(); |
| | | chatPack.Len = (ushort)GetUTF8InfoLen(msg); |
| | | chatPack.Content = msg; |
| | | if (CrossServerUtility.IsCrossServer()) |
| | | { |
| | | GameNetSystem.Instance.SendToCrossServer(chatPack); |
| | | } |
| | | else |
| | | { |
| | | GameNetSystem.Instance.SendInfo(chatPack); |
| | | } |
| | | } |
| | | break; |
| | | case ChatInfoType.CrossServer: |
| | | { |
| | | C0208_tagCTalkCountry chatPack = new C0208_tagCTalkCountry(); |
| | | chatPack.Len = (ushort)GetUTF8InfoLen(msg); |
| | | chatPack.Content = msg; |
| | | GameNetSystem.Instance.SendInfo(chatPack); |
| | | } |
| | | break; |
| | | case ChatInfoType.Team: |
| | | { |
| | | C0205_tagCTalkDui chatPack = new C0205_tagCTalkDui(); |
| | | chatPack.Len = (ushort)GetUTF8InfoLen(msg); |
| | | chatPack.Content = msg; |
| | | GameNetSystem.Instance.SendInfo(chatPack); |
| | | } |
| | | break; |
| | | case ChatInfoType.Friend: |
| | | { |
| | | var _toPlayer = PteChatID; |
| | | if (info.HasValue && info.Value.infoint1 == 0) |
| | | { |
| | | _toPlayer = info.Value.infoint1; |
| | | } |
| | | if (_toPlayer == 0) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("NoChatTarget"); |
| | | return; |
| | | } |
| | | SendFriendChat(msg, _toPlayer); |
| | | } |
| | | break; |
| | | case ChatInfoType.Fairy: |
| | | { |
| | | C0203_tagCTalkBang chatPack = new C0203_tagCTalkBang(); |
| | | chatPack.Len = (ushort)GetUTF8InfoLen(msg); |
| | | chatPack.Content = msg; |
| | | GameNetSystem.Instance.SendInfo(chatPack); |
| | | } |
| | | break; |
| | | case ChatInfoType.Trumpet: |
| | | { |
| | | if (info.HasValue) |
| | | { |
| | | CA217_tagCMPYSpeaker _pak = new CA217_tagCMPYSpeaker(); |
| | | _pak.SpeakerType = 1; |
| | | _pak.IsUseGold = 0; |
| | | _pak.ItemIndex = (byte)info.Value.infoint1; |
| | | _pak.TextLen = (ushort)GetUTF8InfoLen(msg); |
| | | _pak.Text = msg; |
| | | GameNetSystem.Instance.SendInfo(_pak); |
| | | } |
| | | } |
| | | break; |
| | | case ChatInfoType.default1: |
| | | { |
| | | if (PlayerDatas.Instance.baseData.faction == 0) |
| | | { |
| | | SysNotifyMgr.Instance.ShowTip("FactionChatLimit"); |
| | | return; |
| | | } |
| | | CA216_tagCMPyTalk _pak = new CA216_tagCMPyTalk(); |
| | | _pak.TalkType = 100; |
| | | _pak.Len = (ushort)GetUTF8InfoLen(msg); |
| | | _pak.Content = msg; |
| | | if (CrossServerUtility.IsCrossServer()) |
| | | { |
| | | GameNetSystem.Instance.SendToCrossServer(_pak); |
| | | } |
| | | else |
| | | { |
| | | GameNetSystem.Instance.SendInfo(_pak); |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | int GetChatMessageLength(string message) |
| | | { |
| | | message = WordAnalysis.Color_Start_Regex.Replace(message, string.Empty); |
| | | message = WordAnalysis.Color_End_Regex.Replace(message, string.Empty); |
| | | return message.Length; |
| | | } |
| | | |
| | | bool CheckEmptyChat(string msg) |
| | | { |
| | | if (string.IsNullOrEmpty(msg.Replace(" ", string.Empty))) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | /// <summary> |
| | | /// 世界频道 |
| | | /// </summary> |
| | | /// <param name="vNetData"></param> |
| | | public void RevChatInfo(H0201_tagTalkGong vNetData, uint time = 0) |
| | | { |
| | | // TODO YYL |
| | | // if (friendModel.GetFirendInfo(vNetData.PlayerID, (byte)GroupType.Balcklist) != null)//黑名单拦截 |
| | | // { |
| | | // return; |
| | | // } |
| | | ChatData chatData = null; |
| | | var content = vNetData.Content; |
| | | if (IsInviteChat(vNetData.Content)) |
| | | { |
| | | content = InviteRegex.Replace(vNetData.Content, ""); |
| | | |
| | | // if (teamModel.myTeam.GetIndexOfMember((int)vNetData.PlayerID) != -1) |
| | | // { |
| | | // content = StringUtility.Contact("<color=#f8983b>", vNetData.Name, "</color>", ":", content); |
| | | // } |
| | | // else |
| | | { |
| | | content = StringUtility.Contact("<color=#f8983b>", vNetData.Name, "</color>", ":", content, string.Format("<color=#00ff00><a>{0}|invite={1}</a></color>", Language.Get("L1013"), vNetData.PlayerID)); |
| | | } |
| | | chatData = new ChatInviteData(content, (int)vNetData.PlayerID, vNetData.Name, vNetData.Extras); |
| | | KeepChatInfo(chatData); |
| | | return; |
| | | } |
| | | if (IsAssitChat(content, true) == 2 && vNetData.PlayerID != PlayerDatas.Instance.baseData.PlayerID) |
| | | { |
| | | 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> |
| | | /// 区域频道 |
| | | /// </summary> |
| | | /// <param name="vNetData"></param> |
| | | public void RevChatInfo(H0207_tagTalkArea vNetData) |
| | | { |
| | | // TODO YYL |
| | | // if (friendModel.GetFirendInfo(vNetData.PlayerID, (byte)GroupType.Balcklist) != null)//黑名单拦截 |
| | | // { |
| | | // return; |
| | | // } |
| | | ChatData chatData = new ChatAreaData(vNetData.Content, (int)vNetData.PlayerID, vNetData.SrcName, vNetData.Extras); |
| | | LocalChatHistory.Save(chatData as ChatUeseData); |
| | | KeepChatInfo(chatData); |
| | | } |
| | | |
| | | // 阵营频道 |
| | | public void RevChatInfo(HA707_tagMCPyTalk vNetData) |
| | | { |
| | | // TODO YYL |
| | | // if (friendModel.GetFirendInfo(vNetData.PlayerID, (byte)GroupType.Balcklist) != null)//黑名单拦截 |
| | | // { |
| | | // return; |
| | | // } |
| | | ChatData chatData = new ChatFactionData(vNetData.Content, (int)vNetData.PlayerID, vNetData.Name, vNetData.Extras); |
| | | LocalChatHistory.Save(chatData as ChatUeseData); |
| | | KeepChatInfo(chatData); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 跨服聊天 |
| | | /// </summary> |
| | | /// <param name="package"></param> |
| | | public void RevChatInfo(H0208_tagTalkCountry package) |
| | | { |
| | | // TODO YYL |
| | | // if (friendModel.GetFirendInfo(package.PlayerID, (byte)GroupType.Balcklist) != null)//黑名单拦截 |
| | | // { |
| | | // return; |
| | | // } |
| | | if (!FuncOpen.Instance.IsFuncOpen(162)) |
| | | { |
| | | return; |
| | | } |
| | | ChatData chatData = new ChatCrossServerData(package.Content, (int)package.PlayerID, package.Name, package.Extras); |
| | | LocalChatHistory.Save(chatData as ChatUeseData); |
| | | KeepChatInfo(chatData); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 喇叭喊话 |
| | | /// </summary> |
| | | /// <param name="vNetData"></param> |
| | | public void RevChatInfo(HA9A3_tagGCPYSpeakerContent vNetData) |
| | | { |
| | | // ChatData chatData = new ChatTrumpetData(vNetData.Text, (int)vNetData.PlayerID, vNetData.Name, vNetData.Extras, vNetData.SpeakerType, vNetData.AccID); |
| | | // LocalChatHistory.Save(chatData as ChatUeseData); |
| | | // KeepChatInfo(chatData); |
| | | // ServerTipDetails.ShowTrumpetTip(chatData as ChatTrumpetData); |
| | | } |
| | | /// <summary> |
| | | /// 家族频道 |
| | | /// </summary> |
| | | /// <param name="vNetData"></param> |
| | | 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> |
| | | /// <param name="vNetData"></param> |
| | | public void SetChatFreind(ChatFriend inst) |
| | | { |
| | | m_ChatFriend = inst; |
| | | } |
| | | public void RevChatInfo(H0206_tagTalkMi vNetData) |
| | | { |
| | | if (Regex.IsMatch(vNetData.Content, KILL_IDENTIFY)) |
| | | { |
| | | if (vNetData.PlayerID == PlayerDatas.Instance.baseData.PlayerID) |
| | | { |
| | | return; |
| | | } |
| | | } |
| | | ChatFriendData chatData = new ChatFriendData(vNetData.Content, (int)vNetData.PlayerID, vNetData.SrcName, vNetData.Extras, vNetData.ToName, vNetData.TalkType, vNetData.ToPlayerID); |
| | | FitterChat(chatData); |
| | | AddPteChat(chatData, false); |
| | | LocalChatHistory.Save(chatData as ChatUeseData); |
| | | if (chatData.player == PlayerDatas.Instance.baseData.PlayerID) |
| | | { |
| | | if (OnRefreshSelf != null) |
| | | { |
| | | OnRefreshSelf(chatData); |
| | | } |
| | | } |
| | | if (chatData.IsSound) |
| | | { |
| | | // ChatCenter.Instance.CheckAutoPlayVoice(chatData); |
| | | } |
| | | } |
| | | private void AddPteChat(ChatFriendData chatData, bool isLocal) |
| | | { |
| | | List<ChatFriendData> list = null; |
| | | pteChatDics.TryGetValue(chatData.player + chatData.toPlayer, out list); |
| | | if (list != null) |
| | | { |
| | | if (list.Count > CHAT_INFO_CNT) |
| | | { |
| | | ChatUeseData outData = list[0]; |
| | | list.RemoveAt(0); |
| | | outData = null; |
| | | } |
| | | list.Add(chatData); |
| | | } |
| | | else |
| | | { |
| | | list = new List<ChatFriendData>(); |
| | | list.Add(chatData); |
| | | pteChatDics.Add(chatData.player + chatData.toPlayer, list); |
| | | } |
| | | if (OnRefreshPteChat != null && !isLocal) |
| | | { |
| | | OnRefreshPteChat(chatData); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 队伍频道 |
| | | /// </summary> |
| | | /// <param name="vNetData"></param> |
| | | public void RevChatInfo(H0205_tagTalkDui vNetData) |
| | | { |
| | | ChatData chatData = new ChatTeamData(vNetData.Content, (int)vNetData.PlayerID, vNetData.Name, vNetData.Extras); |
| | | KeepChatInfo(chatData); |
| | | ReceiveNewChat(ChatInfoType.Team); |
| | | } |
| | | /// <summary> |
| | | /// GM |
| | | /// </summary> |
| | | /// <param name="vNetData"></param> |
| | | public void RevChatInfo(H3202_tagServerResponse vNetData) |
| | | { |
| | | ChatData chatData = new ChatSystemData(vNetData.Message); |
| | | KeepChatInfo(chatData); |
| | | } |
| | | /// <summary> |
| | | /// 系统提示 |
| | | /// </summary> |
| | | /// <param name="msg"></param> |
| | | public void RevChatInfo(string msg) |
| | | { |
| | | ChatData chatData = new ChatSystemData(msg); |
| | | KeepChatInfo(chatData); |
| | | } |
| | | public void RevChatInfo(string msg, ArrayList infoList, ChatInfoType type = ChatInfoType.System) |
| | | { |
| | | ChatData chatData = null; |
| | | switch (type) |
| | | { |
| | | case ChatInfoType.System: |
| | | { |
| | | chatData = new ChatSystemData(msg); |
| | | chatData.infoList.AddRange(infoList); |
| | | } |
| | | break; |
| | | case ChatInfoType.FairyTip: |
| | | case ChatInfoType.FairyQuestion: |
| | | { |
| | | chatData = new ChatFamilyData(msg, 0, string.Empty, string.Empty, type); |
| | | chatData.infoList.AddRange(infoList); |
| | | } |
| | | break; |
| | | case ChatInfoType.TeamTip: |
| | | { |
| | | chatData = new ChatTeamData(msg, 0, string.Empty, string.Empty, type); |
| | | chatData.infoList.AddRange(infoList); |
| | | } |
| | | break; |
| | | case ChatInfoType.default1: |
| | | case ChatInfoType.default2: |
| | | { |
| | | chatData = new ChatFactionData(msg, 0, string.Empty, string.Empty, type); |
| | | chatData.infoList.AddRange(infoList); |
| | | } |
| | | break; |
| | | } |
| | | if (chatData != null) |
| | | { |
| | | KeepChatInfo(chatData); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 获取频道聊天数据 |
| | | /// </summary> |
| | | /// <param name="type"></param> |
| | | /// <returns></returns> |
| | | public List<ChatData> GetChatInfo(ChatInfoType type) |
| | | { |
| | | List<ChatData> list = null; |
| | | chatDics.TryGetValue(type, out list); |
| | | return list; |
| | | } |
| | | /// <summary> |
| | | /// 获取好友聊天数据 |
| | | /// </summary> |
| | | /// <param name="type"></param> |
| | | /// <returns></returns> |
| | | public List<ChatFriendData> GetChatInfo(int player) |
| | | { |
| | | List<ChatFriendData> list = null; |
| | | pteChatDics.TryGetValue(player + (int)PlayerDatas.Instance.baseData.PlayerID, out list); |
| | | return list; |
| | | } |
| | | /// <summary> |
| | | /// 获取主界面的聊天数据 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public List<ChatData> GetChatInfo() |
| | | { |
| | | return chatlist; |
| | | } |
| | | public List<ChatData> GetChatUpInfo() |
| | | { |
| | | return chatUpList; |
| | | } |
| | | public ChatData GetChatInfo(ChatInfoType type, int index) |
| | | { |
| | | List<ChatData> list = null; |
| | | chatDics.TryGetValue(type, out list); |
| | | if (list != null) |
| | | { |
| | | return list[index]; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public void KeepLocalChat(ChatData chat) |
| | | { |
| | | if (chat.type == ChatInfoType.Friend) |
| | | { |
| | | FitterChat(chat); |
| | | AddPteChat(chat as ChatFriendData, true); |
| | | } |
| | | else |
| | | { |
| | | KeepChatInfo(chat); |
| | | } |
| | | } |
| | | |
| | | private void KeepChatInfo(ChatData data) |
| | | { |
| | | KeepAllTypeChat(data); |
| | | List<ChatData> list = null; |
| | | chatDics.TryGetValue(data.type, out list); |
| | | if (list != null) |
| | | { |
| | | if (list.Count >= CHAT_INFO_CNT) |
| | | { |
| | | ChatData outData = list[0]; |
| | | list.RemoveAt(0); |
| | | outData = null; |
| | | } |
| | | list.Add(data); |
| | | } |
| | | else |
| | | { |
| | | list = new List<ChatData>(); |
| | | list.Add(data); |
| | | chatDics.Add(data.type, list); |
| | | } |
| | | if (chatFloatUpdate != null) |
| | | { |
| | | chatFloatUpdate(data); |
| | | } |
| | | if (OnRefreshChat != null) |
| | | OnRefreshChat(data.type); |
| | | if (data.type != ChatInfoType.System && (data as ChatUeseData).player == PlayerDatas.Instance.baseData.PlayerID) |
| | | { |
| | | if (OnRefreshSelf != null) |
| | | OnRefreshSelf(data); |
| | | } |
| | | // if ((data is ChatUeseData) |
| | | // && (data as ChatUeseData).IsSound) |
| | | // { |
| | | // ChatCenter.Instance.CheckAutoPlayVoice(data); |
| | | // } |
| | | } |
| | | private void KeepAllTypeChat(ChatData data) |
| | | { |
| | | if (!FitterChat(data)) |
| | | { |
| | | if (chatlist.Count >= CHAT_TIP_CNT) |
| | | { |
| | | ChatData outData = chatlist[0]; |
| | | chatlist.RemoveAt(0); |
| | | } |
| | | if (chatUpList.Count >= CHAT_INFO_CNT) |
| | | { |
| | | ChatData outData = chatUpList[0]; |
| | | chatUpList.RemoveAt(0); |
| | | } |
| | | chatlist.Add(data); |
| | | chatUpList.Add(data); |
| | | } |
| | | } |
| | | private bool FitterChat(ChatData data) |
| | | { |
| | | if (data.type == ChatInfoType.System) |
| | | { |
| | | return true; |
| | | } |
| | | |
| | | if (IsItemChat(data.content)) |
| | | { |
| | | string content = data.content; |
| | | MatchCollection matchArray = HrefAnalysis.EquipDetailRegex.Matches(content); |
| | | int index = 0; |
| | | for (int i = 0; i < matchArray.Count; i++) |
| | | { |
| | | data.richText.Append(content.Substring(index, matchArray[i].Index - index)); |
| | | index = matchArray[i].Index + matchArray[i].Length; |
| | | string detail = matchArray[i].Groups[1].Value; |
| | | var itemplusArray = detail.Split('|'); |
| | | if (itemplusArray.Length > 1) |
| | | { |
| | | var itemId = int.Parse(itemplusArray[0]); |
| | | ItemConfig itemConfig = ItemConfig.Get(itemId); |
| | | if (itemConfig != null) |
| | | { |
| | | try |
| | | { |
| | | int[] equipGems = null; |
| | | if (itemplusArray.Length >= 8) |
| | | { |
| | | equipGems = new int[4]; |
| | | for (int j = 0; j < equipGems.Length; j++) |
| | | { |
| | | equipGems[j] = int.Parse(itemplusArray[4 + j]); |
| | | } |
| | | } |
| | | |
| | | ItemTipUtility.CustomEquipWash equipWash = new ItemTipUtility.CustomEquipWash(); |
| | | if (itemplusArray.Length >= 15) |
| | | { |
| | | equipWash.LV = int.Parse(itemplusArray[11]); |
| | | equipWash.Value = new int[3]; |
| | | equipWash.Value[0] = int.Parse(itemplusArray[12]); |
| | | equipWash.Value[1] = int.Parse(itemplusArray[13]); |
| | | equipWash.Value[2] = int.Parse(itemplusArray[14]); |
| | | } |
| | | |
| | | List<int> suitPlaces = null; |
| | | if (itemplusArray.Length > 15) |
| | | { |
| | | suitPlaces = new List<int>(); |
| | | for (int j = 0; j < 8; j++) |
| | | { |
| | | var place = int.Parse(itemplusArray[15 + j]); |
| | | if (place != 0) |
| | | { |
| | | suitPlaces.Add(place); |
| | | } |
| | | } |
| | | } |
| | | |
| | | int[] suitLevels = null; |
| | | if (itemplusArray.Length > 15) |
| | | { |
| | | suitLevels = new int[3]; |
| | | for (int j = 0; j < 3; j++) |
| | | { |
| | | suitLevels[j] = int.Parse(itemplusArray[23 + j]); |
| | | } |
| | | } |
| | | |
| | | int[] placeStars = null; |
| | | if (itemplusArray.Length > 15) |
| | | { |
| | | placeStars = new int[8]; |
| | | for (int j = 0; j < 8; j++) |
| | | { |
| | | placeStars[j] = int.Parse(itemplusArray[26 + j]); |
| | | } |
| | | } |
| | | |
| | | |
| | | ItemTipUtility.CustomItemPlus itemplus = new ItemTipUtility.CustomItemPlus() |
| | | { |
| | | ItemID = itemId, |
| | | count = int.Parse(itemplusArray[1]), |
| | | Equipped = int.Parse(itemplusArray[2]), |
| | | UserData = itemplusArray[3], |
| | | Stone = equipGems, |
| | | PlusLV = itemplusArray.Length >= 9 ? int.Parse(itemplusArray[8]) : 0, |
| | | Star = itemplusArray.Length >= 10 ? int.Parse(itemplusArray[9]) : 0, |
| | | EvolveLV = itemplusArray.Length >= 11 ? int.Parse(itemplusArray[10]) : 0, |
| | | Wash = equipWash, |
| | | Equips = null, |
| | | suitPlaces = suitPlaces == null ? null : suitPlaces.ToArray(), |
| | | suitLevels = suitLevels, |
| | | placeStars = placeStars, |
| | | }; |
| | | |
| | | string append = string.Format("<a><Word info=item id={0} itemplus={1} chatsend=1/>|showitem={0} itemplus={1}</a>", |
| | | itemId, LitJson.JsonMapper.ToJson(itemplus)); |
| | | append = UIHelper.AppendColor(itemConfig.ItemColor, append); |
| | | data.richText.Append(append); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | data.richText.Append(itemConfig.ItemName); |
| | | Debug.Log(e.Message); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | data.richText.Append(matchArray[i].Value); |
| | | } |
| | | } |
| | | data.richText.Append(content.Substring(index, content.Length - index)); |
| | | } |
| | | if (data.type == ChatInfoType.Friend) |
| | | { |
| | | return true; |
| | | } |
| | | if (data.content.Equals(string.Empty)) |
| | | { |
| | | return true; |
| | | } |
| | | return !chatOpenDics[data.type]; |
| | | } |
| | | public Dictionary<ChatInfoType, bool> GetChatOpen() |
| | | { |
| | | return chatOpenDics; |
| | | } |
| | | |
| | | #region 组队邀请 |
| | | private const string INVITE_IDENTIFY = "<i>"; |
| | | public static Regex InviteRegex = new Regex(@INVITE_IDENTIFY, RegexOptions.Singleline); |
| | | public void SendInvite(string msg) |
| | | { |
| | | SendChatInfo(ChatInfoType.World, StringUtility.Contact(msg, INVITE_IDENTIFY)); |
| | | } |
| | | public bool IsInviteChat(string msg) |
| | | { |
| | | return InviteRegex.IsMatch(msg); |
| | | } |
| | | #endregion |
| | | |
| | | #region 发送物品 |
| | | public List<ItemModel> itemPlaceList = new List<ItemModel>(); |
| | | public bool IsItemChat(string msg) |
| | | { |
| | | return HrefAnalysis.EquipDetailRegex.IsMatch(msg); |
| | | } |
| | | public string CheckHasItem(string msg, ChatCenter.RecentlyChat _recently) |
| | | { |
| | | return string.Empty; |
| | | // if (!HrefAnalysis.EquipRegex.IsMatch(msg)) |
| | | // { |
| | | // return msg; |
| | | // } |
| | | // sb.Length = 0; |
| | | // MatchCollection matchArray = HrefAnalysis.EquipRegex.Matches(msg); |
| | | // int index = 0; |
| | | // for (int i = 0; i < matchArray.Count; i++) |
| | | // { |
| | | // sb.Append(msg.Substring(index, matchArray[i].Index - index)); |
| | | // if (ChatCenter.Instance.recentlyChat != null) |
| | | // { |
| | | // if (i < ChatCenter.Instance.recentlyChat.itemIndexs.Count) |
| | | // { |
| | | // var _index = ChatCenter.Instance.recentlyChat.itemIndexs[i]; |
| | | // sb.Append(" "); |
| | | // sb.Append(ChatCenter.Instance.recentlyChat.itemInfos[_index]); |
| | | // sb.Append(" "); |
| | | // } |
| | | // index = matchArray[i].Index + matchArray[i].Length; |
| | | // continue; |
| | | // } |
| | | // var _length = sb.Length; |
| | | // if (i < itemPlaceList.Count) |
| | | // { |
| | | // var itemConfig = ItemConfig.Get((int)itemPlaceList[i].itemId); |
| | | // if (itemConfig.ItemName == matchArray[i].Groups[1].Value) |
| | | // { |
| | | // bool equip = itemPlaceList[i].packType == PackType.Equip; |
| | | |
| | | // sb.Append("#item#"); |
| | | // AppendValue(sb, itemPlaceList[i].itemId); |
| | | // AppendValue(sb, itemPlaceList[i].count); |
| | | // AppendValue(sb, equip ? 1 : 0); |
| | | // AppendValue(sb, itemPlaceList[i].itemInfo.userData); |
| | | |
| | | // if (equip) |
| | | // { |
| | | // var position = new Int2(itemConfig.LV, itemConfig.EquipPlace); |
| | | |
| | | // int[] equipGems; |
| | | // equipGemModel.TryGetEquipGems(itemPlaceList[i].gridIndex, out equipGems); |
| | | // for (int j = 0; j < EquipGemModel.EQUIPGEM_HOLE_COUNT; j++) |
| | | // { |
| | | // AppendValue(sb, equipGems != null && j < equipGems.Length ? equipGems[j] : 0); |
| | | // } |
| | | |
| | | // var strengthLevel = equipStrengthModel.GetStrengthLevel(itemConfig.LV, itemConfig.EquipPlace); |
| | | // AppendValue(sb, strengthLevel); |
| | | |
| | | // var starLevel = equipStarModel.GetEquipStarLevel(new Int2(itemConfig.LV, itemConfig.EquipPlace)); |
| | | // AppendValue(sb, starLevel); |
| | | |
| | | // var evolveLevel = equipStrengthModel.GetStrengthEvolveLevel(position.x, position.y); |
| | | // AppendValue(sb, evolveLevel); |
| | | |
| | | // AppendValue(sb, equipTrainModel.GetTrainLevel(position)); |
| | | |
| | | // var property = equipTrainModel.GetTrainedProperties(position); |
| | | // AppendValue(sb, property.x); |
| | | // AppendValue(sb, property.y); |
| | | // AppendValue(sb, property.z); |
| | | |
| | | // for (int place = 1; place <= 12; place++) |
| | | // { |
| | | // if (place > 8) |
| | | // { |
| | | // continue; |
| | | // } |
| | | // var equipGuid = equipModel.GetEquip(new Int2(position.x, place)); |
| | | // if (!string.IsNullOrEmpty(equipGuid)) |
| | | // { |
| | | // var equipItem = packManager.GetItemByGuid(equipGuid); |
| | | // if (equipItem.config.SuiteiD > 0) |
| | | // { |
| | | // AppendValue(sb, place); |
| | | // continue; |
| | | // } |
| | | // } |
| | | // AppendValue(sb, 0); |
| | | // } |
| | | |
| | | // AppendValue(sb, equipModel.GetSuitLevel(itemConfig.LV, EquipSuitType.TwoSuit)); |
| | | // AppendValue(sb, equipModel.GetSuitLevel(itemConfig.LV, EquipSuitType.FiveSuit)); |
| | | // AppendValue(sb, equipModel.GetSuitLevel(itemConfig.LV, EquipSuitType.EightSuit)); |
| | | |
| | | // for (int place = 1; place <= 8; place++) |
| | | // { |
| | | // var equipGuid = equipModel.GetEquip(new Int2(position.x, place)); |
| | | // if (!string.IsNullOrEmpty(equipGuid)) |
| | | // { |
| | | // var equipItem = packManager.GetItemByGuid(equipGuid); |
| | | // if (ItemLogicUtility.Instance.IsSuitEquip(equipItem.itemId)) |
| | | // { |
| | | // AppendValue(sb, equipStarModel.GetStarLevel(new Int2(position.x, place))); |
| | | // } |
| | | // else |
| | | // { |
| | | // AppendValue(sb, -1); |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // AppendValue(sb, -1); |
| | | // } |
| | | // } |
| | | // } |
| | | |
| | | // sb.Remove(sb.Length - 1, 1); |
| | | // sb.Append("#item#"); |
| | | |
| | | // if (_recently != null) |
| | | // { |
| | | // _recently.Add(itemConfig.ItemName, sb.ToString().Substring(_length)); |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // sb.Append(matchArray[i].Value); |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // sb.Append(matchArray[i].Value); |
| | | // } |
| | | // index = matchArray[i].Index + matchArray[i].Length; |
| | | // } |
| | | // sb.Append(msg.Substring(index, msg.Length - index)); |
| | | // return sb.ToString(); |
| | | } |
| | | |
| | | void AppendValue(StringBuilder sb, object _object) |
| | | { |
| | | sb.Append(_object); |
| | | sb.Append('|'); |
| | | } |
| | | #endregion |
| | | |
| | | #region 好友私聊 |
| | | public static Regex KillRegex = new Regex(@KILL_IDENTIFY, RegexOptions.Singleline); |
| | | public const string KILL_IDENTIFY = "<k>"; |
| | | public void SendFriendChat(string msg, int player) |
| | | { |
| | | C0209_tagCTalkMiFix chatPack = new C0209_tagCTalkMiFix(); |
| | | chatPack.TalkType = 1; |
| | | chatPack.PlayerID = (uint)player; |
| | | chatPack.Len = (ushort)GetUTF8InfoLen(msg); |
| | | chatPack.Content = msg; |
| | | GameNetSystem.Instance.SendInfo(chatPack); |
| | | } |
| | | #endregion |
| | | /// <summary> |
| | | /// 清屏 |
| | | /// </summary> |
| | | public void ClearAllChatInfo() |
| | | { |
| | | chatDics.Clear(); |
| | | chatlist.Clear(); |
| | | chatUpList.Clear(); |
| | | pteChatDics.Clear(); |
| | | if (OnRefreshChat != null) |
| | | { |
| | | OnRefreshChat(presentChatType); |
| | | } |
| | | } |
| | | |
| | | public void ClearChatInfo(ChatInfoType type) |
| | | { |
| | | List<ChatData> list = null; |
| | | if (chatDics.TryGetValue(type, out list)) |
| | | { |
| | | list.Clear(); |
| | | if (OnRefreshChat != null) |
| | | { |
| | | OnRefreshChat(type); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static int GetUTF8InfoLen(string msg) |
| | | { |
| | | return Encoding.UTF8.GetBytes(msg).Length; |
| | | } |
| | | |
| | | public void CloseChatBtnClick() |
| | | { |
| | | if (OnClickCloseChatEvent != null) |
| | | { |
| | | OnClickCloseChatEvent(); |
| | | } |
| | | } |
| | | |
| | | public bool IsExtentOpen { get; set; } |
| | | public void OpenChatExtent(bool open) |
| | | { |
| | | if (OnChatExtentOpenEvent != null) |
| | | { |
| | | OnChatExtentOpenEvent(open); |
| | | } |
| | | } |
| | | |
| | | #region 陌生人聊天 |
| | | public event Action OpenPteChatEvent; |
| | | public void OpenFriendWin() |
| | | { |
| | | if (OpenPteChatEvent != null) |
| | | { |
| | | OpenPteChatEvent(); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | #region 主界面聊天频道显示设置 |
| | | public void SetChatChannelShow(ChatInfoType type, bool open) |
| | | { |
| | | if (chatOpenDics.ContainsKey(type)) |
| | | { |
| | | chatOpenDics[type] = open; |
| | | } |
| | | } |
| | | |
| | | public void GetChatChannelShow() |
| | | { |
| | | chatOpenDics[ChatInfoType.World] = ChatSetting.Instance.GetBool(ChatBoolType.ChannelWorld); |
| | | chatOpenDics[ChatInfoType.Area] = ChatSetting.Instance.GetBool(ChatBoolType.ChannelArea); |
| | | chatOpenDics[ChatInfoType.Fairy] = ChatSetting.Instance.GetBool(ChatBoolType.ChannelGrad); |
| | | chatOpenDics[ChatInfoType.Invite] = ChatSetting.Instance.GetBool(ChatBoolType.ChannelATeam); |
| | | chatOpenDics[ChatInfoType.System] = ChatSetting.Instance.GetBool(ChatBoolType.ChannelSystem); |
| | | chatOpenDics[ChatInfoType.Team] = ChatSetting.Instance.GetBool(ChatBoolType.ChannelTeam); |
| | | chatOpenDics[ChatInfoType.Trumpet] = ChatSetting.Instance.GetBool(ChatBoolType.ChannelBugle); |
| | | chatOpenDics[ChatInfoType.CrossServer] = true; |
| | | chatOpenDics[ChatInfoType.default1] = true; |
| | | } |
| | | #endregion |
| | | |
| | | #region 日常跳转 |
| | | private string[] realmRandomChats = new string[2] { "DailyQuestRealmTalk1", "DailyQuestRealmTalk2" }; |
| | | private string[] dungeonRandomChats = new string[2] { "DailyQuestAssitmTalk1", "DailyQuestAssitmTalk2" }; |
| | | public bool openFromDaily { get; set; } |
| | | public string GetAssitRandomChat(ChatInfoType _type) |
| | | { |
| | | int _index = UnityEngine.Random.Range(0, 2); |
| | | switch (_type) |
| | | { |
| | | case ChatInfoType.World: |
| | | if (_index == 0) |
| | | { |
| | | return Language.Get(dungeonRandomChats[0]); |
| | | } |
| | | else |
| | | { |
| | | return Language.Get(dungeonRandomChats[1], PlayerDatas.Instance.baseData.FightPoint); |
| | | } |
| | | case ChatInfoType.Fairy: |
| | | return Language.Get(realmRandomChats[_index]); |
| | | } |
| | | return string.Empty; |
| | | } |
| | | |
| | | public bool openFromFairyTask { get; set; } |
| | | Dictionary<int, List<string>> m_TaskRandomChats = new Dictionary<int, List<string>>(); |
| | | public string GetTaskRandomChat(ChatInfoType _type) |
| | | { |
| | | if (m_TaskRandomChats.ContainsKey((int)_type)) |
| | | { |
| | | var list = m_TaskRandomChats[(int)_type]; |
| | | var index = UnityEngine.Random.Range(0, list.Count); |
| | | return Language.Get(list[index]); |
| | | } |
| | | return string.Empty; |
| | | } |
| | | |
| | | public bool needCheckAssitChat { get; set; } |
| | | public int IsAssitChat(string message, bool force = false) |
| | | { |
| | | int assitChat = 0; |
| | | if (needCheckAssitChat || force) |
| | | { |
| | | for (int i = 0; i < 2; i++) |
| | | { |
| | | if (message.Equals(Language.Get(realmRandomChats[i]))) |
| | | { |
| | | assitChat = 1; |
| | | break; |
| | | } |
| | | if (message.Equals(Language.Get(dungeonRandomChats[i]))) |
| | | { |
| | | assitChat = 2; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | return assitChat; |
| | | } |
| | | #endregion |
| | | |
| | | #region 宝石炫耀跳转 |
| | | public bool openFromGem { get; set; } |
| | | public int flauntGemId { get; set; } |
| | | public bool flauntGemBind { get; set; } |
| | | public string GetGemFlauntChat() |
| | | { |
| | | var config = ItemConfig.Get(flauntGemId); |
| | | if (config != null) |
| | | { |
| | | var itemInfo = new ItemInfo(); |
| | | itemInfo.itemId = flauntGemId; |
| | | var item = new ItemModel(PackType.Item, itemInfo); |
| | | var tip = string.Format("[{0}]", config.ItemName); |
| | | itemPlaceList.Add(item); |
| | | return Language.Get("GemLookTalk", tip); |
| | | } |
| | | return string.Empty; |
| | | } |
| | | #endregion |
| | | |
| | | #region 仙缘红点 |
| | | Dictionary<ChatInfoType, Redpoint> chatSocialRedpoints = new Dictionary<ChatInfoType, Redpoint>(); |
| | | Dictionary<ChatInfoType, int> unReadChatCounts = new Dictionary<ChatInfoType, int>(); |
| | | public void InitChatRedpoints() |
| | | { |
| | | chatSocialRedpoints.Add(ChatInfoType.Fairy, new Redpoint(MainRedDot.RedPoint_FriendChatKey, 2502)); |
| | | chatSocialRedpoints.Add(ChatInfoType.Team, new Redpoint(MainRedDot.RedPoint_FriendChatKey, 2503)); |
| | | unReadChatCounts.Add(ChatInfoType.Fairy, 0); |
| | | unReadChatCounts.Add(ChatInfoType.Team, 0); |
| | | } |
| | | |
| | | public void ViewChat(ChatInfoType type) |
| | | { |
| | | if (unReadChatCounts.ContainsKey(type)) |
| | | { |
| | | unReadChatCounts[type] = 0; |
| | | UpdateRedpoint(type); |
| | | } |
| | | } |
| | | |
| | | void ReceiveNewChat(ChatInfoType type) |
| | | { |
| | | // TODO YYL |
| | | // switch (type) |
| | | // { |
| | | // case ChatInfoType.Team: |
| | | // if (!UIManager.Instance.IsOpened<TeamChatWin>() |
| | | // && (!UIManager.Instance.IsOpened<ChatWin>() || presentChatType != ChatInfoType.Team)) |
| | | // { |
| | | // unReadChatCounts[ChatInfoType.Team] = Mathf.Min(unReadChatCounts[ChatInfoType.Team] + 1, 99); |
| | | // } |
| | | // break; |
| | | // case ChatInfoType.Fairy: |
| | | // if (!UIManager.Instance.IsOpened<FairyChatWin>() |
| | | // && (!UIManager.Instance.IsOpened<ChatWin>() || presentChatType != ChatInfoType.Fairy)) |
| | | // { |
| | | // unReadChatCounts[ChatInfoType.Fairy] = Mathf.Min(unReadChatCounts[ChatInfoType.Fairy] + 1, 99); |
| | | // } |
| | | // break; |
| | | // } |
| | | UpdateRedpoint(type); |
| | | } |
| | | |
| | | public void UpdateRedpoint(ChatInfoType type) |
| | | { |
| | | if (chatSocialRedpoints.ContainsKey(type)) |
| | | { |
| | | var redpoint = chatSocialRedpoints[type]; |
| | | if (unReadChatCounts[type] > 0) |
| | | { |
| | | redpoint.state = RedPointState.Quantity; |
| | | redpoint.count = unReadChatCounts[type]; |
| | | } |
| | | else |
| | | { |
| | | redpoint.state = RedPointState.None; |
| | | } |
| | | } |
| | | var socialRed = MainRedDot.Instance.redPointFriendChat; |
| | | if (chatSocialRedpoints[ChatInfoType.Fairy].state == RedPointState.Quantity |
| | | || chatSocialRedpoints[ChatInfoType.Team].state == RedPointState.Quantity) |
| | | { |
| | | socialRed.count = unReadChatCounts[ChatInfoType.Fairy] > 0 ? |
| | | unReadChatCounts[ChatInfoType.Fairy] : unReadChatCounts[ChatInfoType.Team]; |
| | | } |
| | | else |
| | | { |
| | | socialRed.count = 0; |
| | | } |
| | | } |
| | | |
| | | public RedPointState GetSocialChatRedpoint(ChatInfoType type) |
| | | { |
| | | if (chatSocialRedpoints.ContainsKey(type)) |
| | | { |
| | | return chatSocialRedpoints[type].state; |
| | | } |
| | | return RedPointState.None; |
| | | } |
| | | #endregion |
| | | |
| | | #region 协助感谢 |
| | | public void SendThank2AssistPlayer(int playerId) |
| | | { |
| | | // TODO YYL |
| | | // if (PlayerDatas.Instance.baseData.LV >= assistThankLevelLimit.x) |
| | | // { |
| | | // return; |
| | | // } |
| | | // var assistPlayerInfo = dungeonAssistModel.GetAssistPlayerInfo(playerId); |
| | | // if (assistPlayerInfo != null) |
| | | // { |
| | | // if (assistPlayerInfo.LV >= assistThankLevelLimit.y) |
| | | // { |
| | | // return; |
| | | // } |
| | | // } |
| | | // var languageKeyIndex = UnityEngine.Random.Range(0, assistThankLanguages.Count); |
| | | // if (assistThankLanguages.Count > 0) |
| | | // { |
| | | // SendFriendChat(Language.Get(assistThankLanguages[languageKeyIndex]), playerId); |
| | | // } |
| | | } |
| | | #endregion |
| | | } |
| | | public struct ChatExtraData |
| | | { |
| | | public int infoint1; |
| | | public ChatExtraData(int info1) |
| | | { |
| | | this.infoint1 = info1; |
| | | } |
| | | |
| | | public static ChatExtraData Default { |
| | | get { |
| | | return new ChatExtraData(0); |
| | | } |
| | | } |
| | | } |
| | | |
| | | public enum ChatInfoType |
| | | { |
| | | System,//系统消息 |
| | | World, //世界频道 |
| | | Area, //区域频道 |
| | | Team, //队伍 |
| | | Invite,//组队 |
| | | Trumpet,//喇叭 |
| | | Fairy,//仙盟 |
| | | Friend,//私聊 |
| | | CrossServer,//跨服 |
| | | FairyQuestion, |
| | | FairyTip, |
| | | TeamTip, |
| | | |
| | | //后续IL开发添加预设 |
| | | default1, //阵营(在跨服地图往跨服发) |
| | | default2, //阵营信息提示 |
| | | default3, |
| | | default4, |
| | | default5, |
| | | default6, |
| | | default7, |
| | | default8, |
| | | default9, |
| | | default10, |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: d56edf10ef498d940b587b6f64c4d907 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 27d5c84a0701e5d40953997b3f050861 |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | //02 01公屏#tagCTalkGong |
| | | |
| | | |
| | | |
| | | public class C0201_tagCTalkGong : GameNetPackBasic { |
| | | |
| | | public ushort Len; |
| | | |
| | | public string Content; //size = Len |
| | | |
| | | |
| | | |
| | | public C0201_tagCTalkGong () { |
| | | |
| | | _cmd = (ushort)0x0201; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | public override void WriteToBytes () { |
| | | |
| | | WriteBytes (Len, NetDataType.WORD); |
| | | |
| | | WriteBytes (Content, NetDataType.Chars, Len); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 64b71bc2465aabe4ca03ea6f6951e019 |
| | | timeCreated: 1502702981 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | //02 03 家族频#tagCTalkBang |
| | | |
| | | |
| | | |
| | | public class C0203_tagCTalkBang : GameNetPackBasic { |
| | | |
| | | public ushort Len; |
| | | |
| | | public string Content; //size = Len |
| | | |
| | | |
| | | |
| | | public C0203_tagCTalkBang () { |
| | | |
| | | _cmd = (ushort)0x0203; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | public override void WriteToBytes () { |
| | | |
| | | WriteBytes (Len, NetDataType.WORD); |
| | | |
| | | WriteBytes (Content, NetDataType.Chars, Len); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: a310943592d08a84f88452e158e4dd01 |
| | | timeCreated: 1502941087 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | //02 05对频#tagCTalkDui
|
| | |
|
| | | public class C0205_tagCTalkDui : GameNetPackBasic {
|
| | | public ushort Len;
|
| | | public string Content; //size = Len
|
| | |
|
| | | public C0205_tagCTalkDui () {
|
| | | _cmd = (ushort)0x0205;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (Len, NetDataType.WORD);
|
| | | WriteBytes (Content, NetDataType.Chars, Len);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 27f4337063b470e4fb47e50b752741d7 |
| | | timeCreated: 1502971998 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | //02 06密频#tagCTalkMi |
| | | |
| | | |
| | | |
| | | public class C0206_tagCTalkMi : GameNetPackBasic { |
| | | |
| | | public byte TalkType; //0为默认 1为1对1聊天 |
| | | |
| | | public byte TargetNameLen; |
| | | |
| | | public string TargetName; //size = TargetNameLen |
| | | |
| | | public ushort Len; |
| | | |
| | | public string Content; //size = Len |
| | | |
| | | |
| | | |
| | | public C0206_tagCTalkMi () { |
| | | |
| | | _cmd = (ushort)0x0206; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | public override void WriteToBytes () { |
| | | |
| | | WriteBytes (TalkType, NetDataType.BYTE); |
| | | |
| | | WriteBytes (TargetNameLen, NetDataType.BYTE); |
| | | |
| | | WriteBytes (TargetName, NetDataType.Chars, TargetNameLen); |
| | | |
| | | WriteBytes (Len, NetDataType.WORD); |
| | | |
| | | WriteBytes (Content, NetDataType.Chars, Len); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: e522bac48da949c439cfa1ce72f2015d |
| | | timeCreated: 1502970390 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | //02 07 区域频道#tagCTalkArea
|
| | |
|
| | | public class C0207_tagCTalkArea : GameNetPackBasic {
|
| | | public ushort Len;
|
| | | public string Content; //size = Len
|
| | |
|
| | | public C0207_tagCTalkArea () {
|
| | | _cmd = (ushort)0x0207;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (Len, NetDataType.WORD);
|
| | | WriteBytes (Content, NetDataType.Chars, Len);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: eff22d8cbf0977743bf7148bbfd98ffe |
| | | timeCreated: 1502768710 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | //02 08 国家频道#tagCTalkCountry
|
| | |
|
| | | public class C0208_tagCTalkCountry : GameNetPackBasic {
|
| | | public ushort Len;
|
| | | public string Content; //size = Len
|
| | |
|
| | | public C0208_tagCTalkCountry () {
|
| | | _cmd = (ushort)0x0208;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (Len, NetDataType.WORD);
|
| | | WriteBytes (Content, NetDataType.Chars, Len);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 03f61f4e99938614b95491aa293c0004 |
| | | timeCreated: 1547533853 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | //02 09 密频优化#tagCTalkMiFix
|
| | |
|
| | | public class C0209_tagCTalkMiFix : GameNetPackBasic {
|
| | | public byte TalkType; //0为默认 1为1对1聊天
|
| | | public uint PlayerID;
|
| | | public ushort Len;
|
| | | public string Content; //size = Len
|
| | |
|
| | | public C0209_tagCTalkMiFix () {
|
| | | _cmd = (ushort)0x0209;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (TalkType, NetDataType.BYTE);
|
| | | WriteBytes (PlayerID, NetDataType.DWORD);
|
| | | WriteBytes (Len, NetDataType.WORD);
|
| | | WriteBytes (Content, NetDataType.Chars, Len);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 645580c505641e24684252b75ef368d6 |
| | | timeCreated: 1502970390 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: ed9b5fa1622097949b83432deb77a9e4 |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | //A2 01 请求npc商店物品信息 #tagCMQueryNPCShopItem
|
| | |
|
| | | public class CA201_tagCMQueryNPCShopItem : GameNetPackBasic {
|
| | | public uint NPCShopID; //商店npcid
|
| | |
|
| | | public CA201_tagCMQueryNPCShopItem () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xA201;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (NPCShopID, NetDataType.DWORD);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 32d724a12783cc8418b8c55ac5e2b1ac |
| | | timeCreated: 1505463111 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | //A2 02通知选中对象 # tagCMSelectObj |
| | | |
| | | public class CA202_tagCMSelectObj : GameNetPackBasic |
| | | { |
| | | public byte isSelect; //0 不选中 |
| | | public byte Type; //目标类型 |
| | | public uint ID; //ID |
| | | |
| | | public CA202_tagCMSelectObj() |
| | | { |
| | | combineCmd = (ushort)0x03FE; |
| | | _cmd = (ushort)0xA202; |
| | | } |
| | | |
| | | public override void WriteToBytes() |
| | | { |
| | | WriteBytes(isSelect, NetDataType.BYTE); |
| | | WriteBytes(Type, NetDataType.BYTE); |
| | | WriteBytes(ID, NetDataType.DWORD); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: fbbd0a74db4e14a428e1a0fc7c69386b |
| | | timeCreated: 1555406256 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | //A2 04 请求打开远程仓库 #tagCMOpenLongWarehouse
|
| | |
|
| | | public class CA204_tagCMOpenLongWarehouse : GameNetPackBasic {
|
| | |
|
| | | public CA204_tagCMOpenLongWarehouse () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xA204;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 9cd236a940519044a83ce42a76ebe229 |
| | | timeCreated: 1503995835 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // A2 06 快速完成任务#tagCMQuickFinishMission
|
| | |
|
| | | public class CA206_tagCMQuickFinishMission : GameNetPackBasic {
|
| | | public uint MissionID;
|
| | | public byte DoType; // 0-只完成本次;1-完成所有环任务
|
| | |
|
| | | public CA206_tagCMQuickFinishMission () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xA206;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (MissionID, NetDataType.DWORD);
|
| | | WriteBytes (DoType, NetDataType.BYTE);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 837e8dc8090b7c741b4e8ce47109a6a4 |
| | | timeCreated: 1509439103 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // A2 10 清除副本CD#tagCMClearFBCD
|
| | |
|
| | | public class CA210_tagCMClearFBCD : GameNetPackBasic {
|
| | | public uint MapID;
|
| | |
|
| | | public CA210_tagCMClearFBCD () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xA210;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (MapID, NetDataType.DWORD);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: b0bbd701b679ffb49ba0ddaee04a0b62 |
| | | timeCreated: 1509460537 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | //A2 12 查看玩家详细信息#tagCMViewPlayerInfo |
| | | |
| | | public class CA212_tagCMViewPlayerInfo : GameNetPackBasic |
| | | { |
| | | public uint PlayerID; |
| | | public byte EquipClassLV; //大于0为查看指定境界阶装备信息, 0为查看默认信息 |
| | | |
| | | public CA212_tagCMViewPlayerInfo() |
| | | { |
| | | combineCmd = (ushort)0x03FE; |
| | | _cmd = (ushort)0xA212; |
| | | } |
| | | |
| | | public override void WriteToBytes() |
| | | { |
| | | WriteBytes(PlayerID, NetDataType.DWORD); |
| | | WriteBytes(EquipClassLV, NetDataType.BYTE); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f227c3364eeb54c459f57b97bb14978f |
| | | timeCreated: 1511770536 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // A2 16 自定义玩家聊天 #tagCMPyTalk |
| | | |
| | | public class CA216_tagCMPyTalk : GameNetPackBasic { |
| | | public byte TalkType; // 自定义聊天类型 |
| | | public ushort Len; |
| | | public string Content; //size = Len |
| | | |
| | | public CA216_tagCMPyTalk () { |
| | | combineCmd = (ushort)0x03FE; |
| | | _cmd = (ushort)0xA216; |
| | | } |
| | | |
| | | public override void WriteToBytes () { |
| | | WriteBytes (TalkType, NetDataType.BYTE); |
| | | WriteBytes (Len, NetDataType.WORD); |
| | | WriteBytes (Content, NetDataType.Chars, Len); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 9c3fe5983a8ce40499605c559abcad1d |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // A2 17 喇叭聊天 #tagCMPYSpeaker
|
| | |
|
| | | public class CA217_tagCMPYSpeaker : GameNetPackBasic {
|
| | | public byte SpeakerType; //1-本服;2-跨服
|
| | | public byte IsUseGold; //是否使用钻石
|
| | | public byte ItemIndex; //使用物品说话时, 物品Index
|
| | | public ushort TextLen; //字符长度
|
| | | public string Text; //size = TextLen
|
| | |
|
| | | public CA217_tagCMPYSpeaker () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xA217;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (SpeakerType, NetDataType.BYTE);
|
| | | WriteBytes (IsUseGold, NetDataType.BYTE);
|
| | | WriteBytes (ItemIndex, NetDataType.BYTE);
|
| | | WriteBytes (TextLen, NetDataType.WORD);
|
| | | WriteBytes (Text, NetDataType.Chars, TextLen);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 81c34b5222041684887385bfa43257b7 |
| | | timeCreated: 1502874278 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // A2 21 领取跑环每轮结束奖励 #tagCMGetRunTaskEndAward
|
| | |
|
| | | public class CA221_tagCMGetRunTaskEndAward : GameNetPackBasic {
|
| | | public byte Type; //任务类型
|
| | |
|
| | | public CA221_tagCMGetRunTaskEndAward () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xA221;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (Type, NetDataType.BYTE);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 605194c4c6dc4eb48a128bcc23c03b01 |
| | | timeCreated: 1509523798 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // A2 22 设置引导成功 #tagCMSetGuideOK |
| | | |
| | | public class CA222_tagCMSetGuideOK : GameNetPackBasic |
| | | { |
| | | public byte GuideIndex; // 记录位索引, 发送255时,代表设置全部 |
| | | public byte IsOK; |
| | | |
| | | public CA222_tagCMSetGuideOK() |
| | | { |
| | | combineCmd = (ushort)0x03FE; |
| | | _cmd = (ushort)0xA222; |
| | | } |
| | | |
| | | public override void WriteToBytes() |
| | | { |
| | | WriteBytes(GuideIndex, NetDataType.BYTE); |
| | | WriteBytes(IsOK, NetDataType.BYTE); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 4a1938f4429f50349974571a9040f5a4 |
| | | timeCreated: 1517622122 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // A2 23 NPC秀结束 #tagCMNPCShowEnd
|
| | |
|
| | | public class CA223_tagCMNPCShowEnd : GameNetPackBasic {
|
| | | public uint NPCID;
|
| | | public byte EndType; // 0-默认;1-跳过
|
| | |
|
| | | public CA223_tagCMNPCShowEnd () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xA223;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (NPCID, NetDataType.DWORD);
|
| | | WriteBytes (EndType, NetDataType.BYTE);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: bf5a7e187044a7f4f8e7db48eeb8f6d0 |
| | | timeCreated: 1512473176 |
| | | licenseType: Free |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // A2 24 触碰NPC #tagCMTouchNPC |
| | | |
| | | public class CA224_tagCMTouchNPC : GameNetPackBasic |
| | | { |
| | | public uint ObjID; |
| | | |
| | | public CA224_tagCMTouchNPC() |
| | | { |
| | | combineCmd = (ushort)0x03FE; |
| | | _cmd = (ushort)0xA224; |
| | | } |
| | | |
| | | public override void WriteToBytes() |
| | | { |
| | | WriteBytes(ObjID, NetDataType.DWORD); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 4cbcd46603dd47441a850c1982f68f07 |
| | | timeCreated: 1513752991 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | //A2 25 客户端任务计数 # tagCMClientTaskCount |
| | | |
| | | public class CA225_tagCMClientTaskCount : GameNetPackBasic { |
| | | public uint CountID; // 计数ID,客户端与策划约定,可以是NPCID或其他 |
| | | public byte Type; // 1-杀怪 |
| | | |
| | | public CA225_tagCMClientTaskCount () { |
| | | combineCmd = (ushort)0x03FE; |
| | | _cmd = (ushort)0xA225; |
| | | } |
| | | |
| | | public override void WriteToBytes () { |
| | | WriteBytes (CountID, NetDataType.DWORD); |
| | | WriteBytes (Type, NetDataType.BYTE); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 7172610959203e54e808aeaca380eaa1 |
| | | timeCreated: 1514292391 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | //A2 26 语音聊天 #tagCMVoiceChat
|
| | |
|
| | | public class CA226_tagCMVoiceChat : GameNetPackBasic {
|
| | | public byte ChannelType; // 5 区域 --- 查看封包tagCGVoiceChat 1 世界 2 仙盟 3 私聊(好友) 4 队伍
|
| | | public byte TargetNameLen;
|
| | | public string TargetName; //size = TargetNameLen
|
| | | public uint TargetID; // 私聊默认发玩家ID,没有ID才发名称
|
| | | public ushort Len;
|
| | | public byte[] Content; //size = Len
|
| | |
|
| | | public CA226_tagCMVoiceChat () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xA226;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (ChannelType, NetDataType.BYTE);
|
| | | WriteBytes (TargetNameLen, NetDataType.BYTE);
|
| | | WriteBytes (TargetName, NetDataType.Chars, TargetNameLen);
|
| | | WriteBytes (TargetID, NetDataType.DWORD);
|
| | | WriteBytes (Len, NetDataType.WORD);
|
| | | WriteBytes (Content, NetDataType.BYTE, Len);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: e6a01da96cdf6cf439a0782502efc0ce |
| | | timeCreated: 1524707101 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // A2 27 查询地图NPC数量信息 #tagCMQueryNPCCntInfo |
| | | |
| | | public class CA227_tagCMQueryNPCCntInfo : GameNetPackBasic |
| | | { |
| | | public uint MapID; // 目标地图ID |
| | | public ushort LineID; // 线路ID |
| | | public byte IsNoTimeLimit; //是否没有查询时间限制,默认有限制 |
| | | public byte NPCIDListLen; |
| | | public string NPCIDList; // 需要查询的NPCID列表 |
| | | |
| | | public CA227_tagCMQueryNPCCntInfo() |
| | | { |
| | | combineCmd = (ushort)0x03FE; |
| | | _cmd = (ushort)0xA227; |
| | | } |
| | | |
| | | public override void WriteToBytes() |
| | | { |
| | | WriteBytes(MapID, NetDataType.DWORD); |
| | | WriteBytes(LineID, NetDataType.WORD); |
| | | WriteBytes(IsNoTimeLimit, NetDataType.BYTE); |
| | | WriteBytes(NPCIDListLen, NetDataType.BYTE); |
| | | WriteBytes(NPCIDList, NetDataType.Chars, NPCIDListLen); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: cd1ae837bd2fb0740a2eebd1bd12e4bf |
| | | timeCreated: 1534765562 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // A2 28 查询仙盟抢Boss伤血列表 #tagCMQueryFamilyBossHurt
|
| | |
|
| | | public class CA228_tagCMQueryFamilyBossHurt : GameNetPackBasic {
|
| | | public uint ObjID;
|
| | | public uint NPCID;
|
| | | public byte QueryType; // 0-实时仙盟伤血,1-历史仙盟伤血,2-实时玩家伤血,3-历史玩家伤血
|
| | |
|
| | | public CA228_tagCMQueryFamilyBossHurt () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xA228;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (ObjID, NetDataType.DWORD);
|
| | | WriteBytes (NPCID, NetDataType.DWORD);
|
| | | WriteBytes (QueryType, NetDataType.BYTE);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 983c43e61a332a34298145db9e1355d6 |
| | | timeCreated: 1535424857 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // A2 30 设置聊天气泡框 #tagCMSetChatBubbleBox
|
| | |
|
| | | public class CA230_tagCMSetChatBubbleBox : GameNetPackBasic {
|
| | | public byte BubbleBoxType; //气泡框类型
|
| | |
|
| | | public CA230_tagCMSetChatBubbleBox () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xA230;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (BubbleBoxType, NetDataType.BYTE);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 2bd82e50dd886f640bb5c2c2a95029ae |
| | | timeCreated: 1541388926 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // A2 31 前端开始自定义场景 #tagCMClientStartCustomScene |
| | | |
| | | public class CA231_tagCMClientStartCustomScene : GameNetPackBasic |
| | | { |
| | | public uint MapID;
|
| | | public ushort FuncLineID; |
| | | |
| | | |
| | | |
| | | public CA231_tagCMClientStartCustomScene() |
| | | { |
| | | combineCmd = (ushort)0x03FE; |
| | | _cmd = (ushort)0xA231; |
| | | } |
| | | |
| | | public override void WriteToBytes() |
| | | {
|
| | | WriteBytes(MapID, NetDataType.DWORD);
|
| | | WriteBytes(FuncLineID, NetDataType.WORD);
|
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: dac5e3d3907d6e94a86612907372331c |
| | | timeCreated: 1550133153 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // A2 32 神秘商店刷新 #tagCMRefreshMysticalShop |
| | | |
| | | public class CA232_tagCMRefreshMysticalShop : GameNetPackBasic |
| | | { |
| | | |
| | | public CA232_tagCMRefreshMysticalShop() |
| | | { |
| | | combineCmd = (ushort)0x03FE; |
| | | _cmd = (ushort)0xA232; |
| | | } |
| | | |
| | | public override void WriteToBytes() |
| | | { |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 18beaa3b153bbc145a3d8de5fff41866 |
| | | timeCreated: 1551083019 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // A2 33 前端退出自定义场景 #tagCMClientExitCustomScene
|
| | |
|
| | | public class CA233_tagCMClientExitCustomScene : GameNetPackBasic {
|
| | |
|
| | | public CA233_tagCMClientExitCustomScene () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xA233;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f040e374599a6384bacdea70b3860c14 |
| | | timeCreated: 1555060344 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // A2 34 自定义场景中获取采集奖励 #tagCMGetCustomSceneCollectAward
|
| | |
|
| | | public class CA234_tagCMGetCustomSceneCollectAward : GameNetPackBasic {
|
| | | public uint NPCID; //采集的NPCID
|
| | |
|
| | | public CA234_tagCMGetCustomSceneCollectAward () {
|
| | | combineCmd = (ushort)0x03FE;
|
| | | _cmd = (ushort)0xA234;
|
| | | }
|
| | |
|
| | | public override void WriteToBytes () {
|
| | | WriteBytes (NPCID, NetDataType.DWORD);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f0d0635cf0a0bd64f8f4742fb964f93f |
| | | timeCreated: 1555412785 |
| | | licenseType: Pro |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // A2 35 选择境界难度层级 #tagCMSelectRealmDifficulty |
| | | |
| | | public class CA235_tagCMSelectRealmDifficulty : GameNetPackBasic { |
| | | public ushort RealmDifficulty; //境界难度 = 1000 + 所选境界等级,如境界13,则发1013 |
| | | |
| | | public CA235_tagCMSelectRealmDifficulty () { |
| | | combineCmd = (ushort)0x03FE; |
| | | _cmd = (ushort)0xA235; |
| | | } |
| | | |
| | | public override void WriteToBytes () { |
| | | WriteBytes (RealmDifficulty, NetDataType.WORD); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: e433770f5f2e9b146909ab44ba8c5530 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // A2 36 聊天气泡框升星 #tagCMChatBubbleBoxStarUP |
| | | |
| | | public class CA236_tagCMChatBubbleBoxStarUP : GameNetPackBasic { |
| | | public byte BoxID; //气泡ID |
| | | |
| | | public CA236_tagCMChatBubbleBoxStarUP () { |
| | | combineCmd = (ushort)0x03FE; |
| | | _cmd = (ushort)0xA236; |
| | | } |
| | | |
| | | public override void WriteToBytes () { |
| | | WriteBytes (BoxID, NetDataType.BYTE); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: cfc606a6bfea0af4bbd3563512f33410 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | //02 01 公屏#tagTalkGong |
| | | |
| | | |
| | | |
| | | public class H0201_tagTalkGong : GameNetPackBasic { |
| | | |
| | | public byte NameLen; |
| | | |
| | | public string Name; //size = NameLen |
| | | |
| | | public uint PlayerID; |
| | | |
| | | public ushort Len; |
| | | |
| | | public string Content; //size = Len |
| | | |
| | | public uint ExtraValue; //附加值 |
| | | |
| | | public string Extras; //附加值列表 |
| | | |
| | | |
| | | |
| | | public H0201_tagTalkGong () { |
| | | |
| | | _cmd = (ushort)0x0201; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | public override void ReadFromBytes (byte[] vBytes) { |
| | | |
| | | TransBytes (out NameLen, vBytes, NetDataType.BYTE); |
| | | |
| | | TransBytes (out Name, vBytes, NetDataType.Chars, NameLen); |
| | | |
| | | TransBytes (out PlayerID, vBytes, NetDataType.DWORD); |
| | | |
| | | TransBytes (out Len, vBytes, NetDataType.WORD); |
| | | |
| | | TransBytes (out Content, vBytes, NetDataType.Chars, Len); |
| | | |
| | | TransBytes (out ExtraValue, vBytes, NetDataType.DWORD); |
| | | |
| | | TransBytes (out Extras, vBytes, NetDataType.Chars, 256); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 59bcc1189c8216d4f873182f0f465e1e |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | //02 03 家族频 #tagTalkBang
|
| | |
|
| | | public class H0203_tagTalkBang : GameNetPackBasic {
|
| | | public byte NameLen;
|
| | | public string Name; //size = NameLen
|
| | | public uint PlayerID;
|
| | | public ushort Len;
|
| | | public string Content; //size = Len
|
| | | public uint ExtraValue; //附加值
|
| | | public string Extras; //附加值列表
|
| | |
|
| | | public H0203_tagTalkBang () {
|
| | | _cmd = (ushort)0x0203;
|
| | | }
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | | TransBytes (out NameLen, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out Name, vBytes, NetDataType.Chars, NameLen);
|
| | | TransBytes (out PlayerID, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out Len, vBytes, NetDataType.WORD);
|
| | | TransBytes (out Content, vBytes, NetDataType.Chars, Len);
|
| | | TransBytes (out ExtraValue, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out Extras, vBytes, NetDataType.Chars, 256);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 48c7cc1b683baa446a59013bc6ae3add |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | //02 05 对频#tagTalkDui
|
| | |
|
| | | public class H0205_tagTalkDui : GameNetPackBasic {
|
| | | public byte NameLen;
|
| | | public string Name; //size = NameLen
|
| | | public uint PlayerID;
|
| | | public ushort Len;
|
| | | public string Content; //size = Len
|
| | | public uint ExtraValue; //附加值
|
| | | public string Extras; //附加值列表
|
| | |
|
| | | public H0205_tagTalkDui () {
|
| | | _cmd = (ushort)0x0205;
|
| | | }
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | | TransBytes (out NameLen, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out Name, vBytes, NetDataType.Chars, NameLen);
|
| | | TransBytes (out PlayerID, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out Len, vBytes, NetDataType.WORD);
|
| | | TransBytes (out Content, vBytes, NetDataType.Chars, Len);
|
| | | TransBytes (out ExtraValue, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out Extras, vBytes, NetDataType.Chars, 256);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3f850a2ad6e22814eaf88e3c521a03e2 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | //02 06 密频 #tagTalkMi
|
| | |
|
| | | public class H0206_tagTalkMi : GameNetPackBasic {
|
| | | public byte TalkType; //0为默认, 1为1对1聊天用
|
| | | public byte SrcNameLen;
|
| | | public string SrcName; //size = SrcNameLen
|
| | | public uint PlayerID;
|
| | | public byte ToNameLen;
|
| | | public string ToName; //size = ToNameLen
|
| | | public uint ToPlayerID;
|
| | | public ushort Len;
|
| | | public string Content; //size = Len
|
| | | public uint ExtraValue; //附加值
|
| | | public string Extras; //附加值列表
|
| | |
|
| | | public H0206_tagTalkMi () {
|
| | | _cmd = (ushort)0x0206;
|
| | | }
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | | TransBytes (out TalkType, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out SrcNameLen, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out SrcName, vBytes, NetDataType.Chars, SrcNameLen);
|
| | | TransBytes (out PlayerID, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out ToNameLen, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out ToName, vBytes, NetDataType.Chars, ToNameLen);
|
| | | TransBytes (out ToPlayerID, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out Len, vBytes, NetDataType.WORD);
|
| | | TransBytes (out Content, vBytes, NetDataType.Chars, Len);
|
| | | TransBytes (out ExtraValue, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out Extras, vBytes, NetDataType.Chars, 256);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 580543451e143be49b0a211ef8358d69 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | //02 07 区域频道#tagTalkArea
|
| | |
|
| | | public class H0207_tagTalkArea : GameNetPackBasic {
|
| | | public byte SrcNameLen;
|
| | | public string SrcName; //size = SrcNameLen
|
| | | public uint PlayerID;
|
| | | public ushort Len;
|
| | | public string Content; //size = Len
|
| | | public uint ExtraValue; //附加值
|
| | | public string Extras; //附加值列表
|
| | |
|
| | | public H0207_tagTalkArea () {
|
| | | _cmd = (ushort)0x0207;
|
| | | }
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | | TransBytes (out SrcNameLen, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out SrcName, vBytes, NetDataType.Chars, SrcNameLen);
|
| | | TransBytes (out PlayerID, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out Len, vBytes, NetDataType.WORD);
|
| | | TransBytes (out Content, vBytes, NetDataType.Chars, Len);
|
| | | TransBytes (out ExtraValue, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out Extras, vBytes, NetDataType.Chars, 256);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 6305204e0859d9d4b975cd3417521ffa |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | //02 08 国家频道#tagTalkCountry
|
| | |
|
| | | public class H0208_tagTalkCountry : GameNetPackBasic {
|
| | | public byte NameLen;
|
| | | public string Name; //size = NameLen
|
| | | public uint PlayerID;
|
| | | public ushort Len;
|
| | | public string Content; //size = Len
|
| | | public uint ExtraValue; //附加值
|
| | | public string Extras; //附加值列表
|
| | |
|
| | | public H0208_tagTalkCountry () {
|
| | | _cmd = (ushort)0x0208;
|
| | | }
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | | TransBytes (out NameLen, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out Name, vBytes, NetDataType.Chars, NameLen);
|
| | | TransBytes (out PlayerID, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out Len, vBytes, NetDataType.WORD);
|
| | | TransBytes (out Content, vBytes, NetDataType.Chars, Len);
|
| | | TransBytes (out ExtraValue, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out Extras, vBytes, NetDataType.Chars, 256);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 2a22596d78c8a1b428f562758794a03f |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: eb197269b77e5d143b80dd9eca6aa305 |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | //32 02 服务器回应客户端消息#tagServerResponse |
| | | |
| | | |
| | | |
| | | public class H3202_tagServerResponse : GameNetPackBasic { |
| | | |
| | | public ushort Len; |
| | | |
| | | public string Message; //size = Len |
| | | |
| | | |
| | | |
| | | public H3202_tagServerResponse () { |
| | | |
| | | _cmd = (ushort)0x3202; |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | public override void ReadFromBytes (byte[] vBytes) { |
| | | |
| | | TransBytes (out Len, vBytes, NetDataType.WORD); |
| | | |
| | | TransBytes (out Message, vBytes, NetDataType.Chars, Len); |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 92b8e0cb83d24f343ad262a74d4bd4bf |
| | | MonoImporter: |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: c0bb9295f75577e46b35d06e99629649 |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | |
| | | // A7 07 通知玩家自定义聊天 #tagMCPyTalk |
| | | |
| | | public class HA707_tagMCPyTalk : GameNetPackBasic { |
| | | public byte TalkType; // 自定义聊天类型 |
| | | public byte NameLen; |
| | | public string Name; //size = NameLen |
| | | public uint PlayerID; |
| | | public ushort Len; |
| | | public string Content; //size = Len |
| | | public uint ExtraValue; //附加值 |
| | | public string Extras; //附加值列表 |
| | | |
| | | public HA707_tagMCPyTalk () { |
| | | _cmd = (ushort)0xA707; |
| | | } |
| | | |
| | | public override void ReadFromBytes (byte[] vBytes) { |
| | | TransBytes (out TalkType, vBytes, NetDataType.BYTE); |
| | | TransBytes (out NameLen, vBytes, NetDataType.BYTE); |
| | | TransBytes (out Name, vBytes, NetDataType.Chars, NameLen); |
| | | TransBytes (out PlayerID, vBytes, NetDataType.DWORD); |
| | | TransBytes (out Len, vBytes, NetDataType.WORD); |
| | | TransBytes (out Content, vBytes, NetDataType.Chars, Len); |
| | | TransBytes (out ExtraValue, vBytes, NetDataType.DWORD); |
| | | TransBytes (out Extras, vBytes, NetDataType.Chars, 256); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: e54b51ae2e7743d47b45deda5bae0ce6 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f1e49f633fb6f704ab59547a9b1b4753 |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using UnityEngine;
|
| | | using System.Collections;
|
| | |
|
| | | // A9 A3 喇叭聊天内容 #tagGCPYSpeakerContent
|
| | |
|
| | | public class HA9A3_tagGCPYSpeakerContent : GameNetPackBasic {
|
| | | public byte AccIDLen;
|
| | | public string AccID; //size = AccIDLen
|
| | | public uint PlayerID; // 子服的玩家ID,该ID有值时为本服玩家
|
| | | public byte NameLen;
|
| | | public string Name; //size = NameLen
|
| | | public byte SpeakerType;
|
| | | public ushort TextLen;
|
| | | public string Text; //size = TextLen
|
| | | public uint ExtraValue; //附加值
|
| | | public string Extras; //附加值列表
|
| | |
|
| | | public HA9A3_tagGCPYSpeakerContent () {
|
| | | _cmd = (ushort)0xA9A3;
|
| | | }
|
| | |
|
| | | public override void ReadFromBytes (byte[] vBytes) {
|
| | | TransBytes (out AccIDLen, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out AccID, vBytes, NetDataType.Chars, AccIDLen);
|
| | | TransBytes (out PlayerID, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out NameLen, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out Name, vBytes, NetDataType.Chars, NameLen);
|
| | | TransBytes (out SpeakerType, vBytes, NetDataType.BYTE);
|
| | | TransBytes (out TextLen, vBytes, NetDataType.WORD);
|
| | | TransBytes (out Text, vBytes, NetDataType.Chars, TextLen);
|
| | | TransBytes (out ExtraValue, vBytes, NetDataType.DWORD);
|
| | | TransBytes (out Extras, vBytes, NetDataType.Chars, 256);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: a8be9ab1f11a39f4cad05114e4a9cb2a |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 98a56b1c5823f1c47b96b73378759345 |
| | | folderAsset: yes |
| | | DefaultImporter: |
| | | externalObjects: {} |
| | | 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: |
| | |
| | | using System.Text; |
| | | using System.Collections; |
| | | using vnxbqy.UI; |
| | | using System; |
| | | |
| | | public class ChatData |
| | | { |
| | | // public ChatData(string content) |
| | | // { |
| | | // _content = content; |
| | | // if (ChatCenter.s_VoiceRegex.IsMatch(_content)) |
| | | // { |
| | | // _content = ChatCenter.s_VoiceRegex.Replace(_content, string.Empty); |
| | | // } |
| | | // richText = new StringBuilder(); |
| | | // richText.Length = 0; |
| | | // createTime = DateTime.Now; |
| | | // } |
| | | public ChatData(string content) |
| | | { |
| | | _content = content; |
| | | if (ChatCenter.s_VoiceRegex.IsMatch(_content)) |
| | | { |
| | | _content = ChatCenter.s_VoiceRegex.Replace(_content, string.Empty); |
| | | } |
| | | richText = new StringBuilder(); |
| | | richText.Length = 0; |
| | | createTime = DateTime.Now; |
| | | } |
| | | |
| | | private string _content = string.Empty; |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | // public ChatInfoType type { get; protected set; } |
| | | public ChatInfoType type { get; protected set; } |
| | | |
| | | // public DateTime createTime { get; set; } |
| | | public DateTime createTime { get; set; } |
| | | |
| | | // private ChatInfoType m_DetailType = ChatInfoType.World; |
| | | // public ChatInfoType detailType |
| | | // { |
| | | // get |
| | | // { |
| | | // return m_DetailType; |
| | | // } |
| | | // set |
| | | // { |
| | | // m_DetailType = value; |
| | | // } |
| | | // } |
| | | private ChatInfoType m_DetailType = ChatInfoType.World; |
| | | public ChatInfoType detailType |
| | | { |
| | | get |
| | | { |
| | | return m_DetailType; |
| | | } |
| | | set |
| | | { |
| | | m_DetailType = value; |
| | | } |
| | | } |
| | | |
| | | public StringBuilder richText; |
| | | |
| | |
| | | |
| | | public class ChatUeseData : ChatData |
| | | { |
| | | public ChatUeseData() |
| | | { |
| | | |
| | | } |
| | | |
| | | public ChatUeseData(string _content, int player, string name, string extra)// : base(_content) |
| | | public ChatUeseData(string _content, int player, string name, string extra) : base(_content) |
| | | { |
| | | this.player = player; |
| | | this.name = name; |
| | |
| | | |
| | | public class ChatSystemData : ChatData |
| | | { |
| | | // public ChatSystemData(string content) : base(content) |
| | | // { |
| | | // type = ChatInfoType.System; |
| | | // } |
| | | public ChatSystemData(string content) : base(content) |
| | | { |
| | | type = ChatInfoType.System; |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | public class ChatWorldData : ChatUeseData |
| | | { |
| | | // public ChatWorldData(string content, int player, string name, string extra) : base(content, player, name, extra) |
| | | // { |
| | | // type = ChatInfoType.World; |
| | | // } |
| | | public ChatWorldData(string content, int player, string name, string extra) : base(content, player, name, extra) |
| | | { |
| | | type = ChatInfoType.World; |
| | | } |
| | | } |
| | | |
| | | public class ChatAreaData : ChatUeseData |
| | | { |
| | | // public ChatAreaData(string content, int player, string name, string extra) : base(content, player, name, extra) |
| | | // { |
| | | // type = ChatInfoType.Area; |
| | | // } |
| | | public ChatAreaData(string content, int player, string name, string extra) : base(content, player, name, extra) |
| | | { |
| | | type = ChatInfoType.Area; |
| | | } |
| | | } |
| | | |
| | | public class ChatCrossServerData : ChatUeseData |
| | | { |
| | | // public ChatCrossServerData(string content, int player, string name, string extra) : base(content, player, name, extra) |
| | | // { |
| | | // type = ChatInfoType.CrossServer; |
| | | // } |
| | | public ChatCrossServerData(string content, int player, string name, string extra) : base(content, player, name, extra) |
| | | { |
| | | type = ChatInfoType.CrossServer; |
| | | } |
| | | } |
| | | |
| | | public class ChatFactionData : ChatUeseData |
| | | { |
| | | // public ChatFactionData(string content, int player, string name, string extra, ChatInfoType detailType = ChatInfoType.default1) : base(content, player, name, extra) |
| | | // { |
| | | // type = ChatInfoType.default1; |
| | | // this.detailType = detailType; |
| | | // } |
| | | public ChatFactionData(string content, int player, string name, string extra, ChatInfoType detailType = ChatInfoType.default1) : base(content, player, name, extra) |
| | | { |
| | | type = ChatInfoType.default1; |
| | | this.detailType = detailType; |
| | | } |
| | | } |
| | | |
| | | public class ChatTeamData : ChatUeseData |
| | | { |
| | | // public ChatTeamData(string content, int player, string name, string extra, ChatInfoType detailType = ChatInfoType.Team) : base(content, player, name, extra) |
| | | // { |
| | | // type = ChatInfoType.Team; |
| | | // this.detailType = detailType; |
| | | // } |
| | | public ChatTeamData(string content, int player, string name, string extra, ChatInfoType detailType = ChatInfoType.Team) : base(content, player, name, extra) |
| | | { |
| | | type = ChatInfoType.Team; |
| | | this.detailType = detailType; |
| | | } |
| | | } |
| | | |
| | | public class ChatFamilyData : ChatUeseData |
| | | { |
| | | // public ChatFamilyData(string content, int player, string name, string extra, ChatInfoType detailType = ChatInfoType.Fairy) : base(content, player, name, extra) |
| | | // { |
| | | // type = ChatInfoType.Fairy; |
| | | // this.detailType = detailType; |
| | | // } |
| | | public ChatFamilyData(string content, int player, string name, string extra, ChatInfoType detailType = ChatInfoType.Fairy) : base(content, player, name, extra) |
| | | { |
| | | type = ChatInfoType.Fairy; |
| | | this.detailType = detailType; |
| | | } |
| | | } |
| | | |
| | | public class ChatInviteData : ChatUeseData |
| | | { |
| | | // public ChatInviteData(string content, int player, string name, string extra) : base(content, player, name, extra) |
| | | // { |
| | | // type = ChatInfoType.Invite; |
| | | // } |
| | | public ChatInviteData(string content, int player, string name, string extra) : base(content, player, name, extra) |
| | | { |
| | | type = ChatInfoType.Invite; |
| | | } |
| | | } |
| | | |
| | | public class ChatFriendData : ChatUeseData |
| | | { |
| | | // public ChatFriendData(string content, int player, string name, string extra, string toName, byte talkType, uint toPlayer) : base(content, player, name, extra) |
| | | // { |
| | | // type = ChatInfoType.Friend; |
| | | // this.toName = toName; |
| | | // this.talkType = talkType; |
| | | // this.toPlayer = (int)toPlayer; |
| | | // } |
| | | public ChatFriendData(string content, int player, string name, string extra, string toName, byte talkType, uint toPlayer) : base(content, player, name, extra) |
| | | { |
| | | type = ChatInfoType.Friend; |
| | | this.toName = toName; |
| | | this.talkType = talkType; |
| | | this.toPlayer = (int)toPlayer; |
| | | } |
| | | |
| | | public string toName { get; protected set; } |
| | | |
New file |
| | |
| | | //-------------------------------------------------------- |
| | | // [Author]: 第二世界 |
| | | // [ Date ]: Wednesday, September 13, 2017 |
| | | //-------------------------------------------------------- |
| | | using UnityEngine; |
| | | using System.Collections; |
| | | using UnityEngine.UI; |
| | | using System.Collections.Generic; |
| | | using System; |
| | | using System.Text.RegularExpressions; |
| | | |
| | | public class ChatFriend : MonoBehaviour |
| | | { |
| | | [SerializeField] ScrollerController m_Controller; |
| | | |
| | | private List<ChatFriendData> chatList = null; |
| | | |
| | | [SerializeField] RichText destText; |
| | | [SerializeField] RichText destSysText; |
| | | private bool open = false; |
| | | public bool IsOpen |
| | | { |
| | | get { return open; } |
| | | } |
| | | |
| | | private void Awake() |
| | | { |
| | | m_Controller.OnGetDynamicSize += OnGetChatDynamicSize; |
| | | ChatManager.Instance.SetChatFreind(this); |
| | | } |
| | | |
| | | #region 计算动态宽度长度 |
| | | private bool OnGetChatDynamicSize(ScrollerDataType type, int index, out float height) |
| | | { |
| | | height = 90; |
| | | if (chatList == null || index >= chatList.Count) |
| | | { |
| | | return false; |
| | | } |
| | | ChatData chat = chatList[index]; |
| | | if (type == ScrollerDataType.Extra2) |
| | | { |
| | | height = chat.content.Equals(string.Empty) ? 90 : 120; |
| | | } |
| | | else if (type == ScrollerDataType.Tail) |
| | | { |
| | | height = 30; |
| | | } |
| | | float width = 0; |
| | | OnGetChatDynamicHeight(chat.content, ref height, ref width, type, chat.infoList); |
| | | return true; |
| | | } |
| | | private void OnGetChatDynamicHeight(string content, ref float height, ref float width, ScrollerDataType type, ArrayList infoList = null) |
| | | { |
| | | if (type == ScrollerDataType.Tail) |
| | | { |
| | | destSysText.SetExtenalData(infoList); |
| | | destSysText.text = content; |
| | | width = destSysText.preferredWidth; |
| | | height += Mathf.Max(0, destSysText.preferredHeight - 23); |
| | | } |
| | | else |
| | | { |
| | | destText.SetExtenalData(infoList); |
| | | destText.text = content; |
| | | width = destText.preferredWidth; |
| | | height += Mathf.Max(0, destText.preferredHeight - 30); |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | private void OnEnable() |
| | | { |
| | | ChatManager.OnRefreshPteChat += OnRefreshPteChat; |
| | | RefreshChatInfo(); |
| | | open = true; |
| | | ChatManager.Instance.lockUpdate = true; |
| | | OnSetLock(); |
| | | } |
| | | |
| | | public void OnSetLock() |
| | | { |
| | | m_Controller.lockType = ChatManager.Instance.lockUpdate ? EnhanceLockType.LockVerticalBottom : EnhanceLockType.KeepVertical; |
| | | if (ChatManager.Instance.lockUpdate) |
| | | { |
| | | m_Controller.ResetScrollPos(); |
| | | } |
| | | } |
| | | |
| | | private void OnDisable() |
| | | { |
| | | ChatManager.OnRefreshPteChat -= OnRefreshPteChat; |
| | | open = false; |
| | | } |
| | | |
| | | public void RefreshChatInfo() |
| | | { |
| | | int id = ChatManager.Instance.PteChatID; |
| | | chatList = ChatManager.Instance.GetChatInfo(id); |
| | | m_Controller.Refresh(); |
| | | if (chatList != null) |
| | | { |
| | | for (int i = 0; i < chatList.Count; i++) |
| | | { |
| | | if (chatList[i].soundTick != 0) |
| | | { |
| | | m_Controller.AddCell(ScrollerDataType.Extra2, i); |
| | | continue; |
| | | } |
| | | if (Regex.IsMatch(chatList[i].content, ChatManager.KILL_IDENTIFY)) |
| | | { |
| | | m_Controller.AddCell(ScrollerDataType.Tail, i); |
| | | continue; |
| | | } |
| | | if (chatList[i].player == PlayerDatas.Instance.baseData.PlayerID) |
| | | { |
| | | m_Controller.AddCell(ScrollerDataType.Header, i); |
| | | } |
| | | else |
| | | { |
| | | m_Controller.AddCell(ScrollerDataType.Normal, i); |
| | | } |
| | | } |
| | | } |
| | | m_Controller.Restart(); |
| | | } |
| | | |
| | | private void OnRefreshPteChat(ChatFriendData data) |
| | | { |
| | | if (data == null) |
| | | { |
| | | return; |
| | | } |
| | | if (data.toPlayer != ChatManager.Instance.PteChatID && data.player != ChatManager.Instance.PteChatID) |
| | | { |
| | | return; |
| | | } |
| | | if (data.player == PlayerDatas.Instance.baseData.PlayerID) |
| | | { |
| | | |
| | | } |
| | | RefreshChatInfo(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3056ddc13bd52ed4483c16475a2fcc08 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | using vnxbqy.UI; |
| | | |
| | | namespace EnhancedUI.EnhancedScroller |
| | | { |
| | | // public class ChatFriendCell : ScrollerUI |
| | | // { |
| | | // [SerializeField] RichText m_ChatText; |
| | | // [SerializeField] Text m_VipText; |
| | | // [SerializeField] Text m_NameText; |
| | | // [SerializeField] AvatarCell m_ChatIcon; |
| | | // [SerializeField] ImageFitterText m_ImageFitter; |
| | | |
| | | // public override void Refresh(CellView cell) |
| | | // { |
| | | // var _index = cell.index; |
| | | // int _playerId = ChatCtrl.Inst.PteChatID; |
| | | // var _list = ChatCtrl.Inst.GetChatInfo(_playerId); |
| | | // if (_list != null && _index < _list.Count) |
| | | // { |
| | | // ChatFriendData chat = _list[_index]; |
| | | // m_ChatText.text = chat.content; |
| | | // if (type == ScrollerDataType.Header) |
| | | // { |
| | | // m_ChatText.AutoNewLine = false; |
| | | // if (m_ChatText.preferredWidth > m_ChatText.rectTransform.rect.width) |
| | | // { |
| | | // m_ChatText.alignment = TextAnchor.UpperLeft; |
| | | // } |
| | | // else |
| | | // { |
| | | // m_ChatText.alignment = TextAnchor.UpperRight; |
| | | // } |
| | | // m_ChatText.AutoNewLine = true; |
| | | // } |
| | | // m_ImageFitter.FiterRealTxtWidth = m_ChatText.alignment == TextAnchor.UpperRight; |
| | | // m_VipText.text = chat.vipLv > 0 ? StringUtility.Contact("V", chat.vipLv) : string.Empty; |
| | | // m_NameText.text = chat.name; |
| | | // m_ChatIcon.InitUI(AvatarHelper.GetAvatarModel(chat.player, chat.face, chat.facePic, chat.job)); |
| | | // m_ChatText.text = chat.content; |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 3c7103d0f86bb6c4fb02025e35939eb3 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | namespace EnhancedUI.EnhancedScroller |
| | | { |
| | | // public class ChatFriendTipCell : ScrollerUI |
| | | // { |
| | | // [SerializeField] RichText m_TipText; |
| | | // public override void Refresh(CellView cell) |
| | | // { |
| | | // var _index = cell.index; |
| | | // int _playerId = ChatCtrl.Inst.PteChatID; |
| | | // var _list = ChatCtrl.Inst.GetChatInfo(_playerId); |
| | | // if (_list != null && _index < _list.Count) |
| | | // { |
| | | // ChatFriendData chat = _list[_index]; |
| | | // m_TipText.text = chat.content.Replace(ChatCtrl.KILL_IDENTIFY, string.Empty); |
| | | // } |
| | | // } |
| | | // } |
| | | } |
| | | |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 68376cb82e4739943aecb4dbbd81a757 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using UnityEngine; |
| | | using UnityEngine.UI; |
| | | |
| | | namespace vnxbqy.UI |
| | | { |
| | | public class ChatItemCell : CellView |
| | | { |
| | | [SerializeField] List<ItemCell> m_Items; |
| | | public List<ItemCell> items { get { return m_Items; } } |
| | | [SerializeField] List<Image> m_ItemEquips; |
| | | public List<Image> itemEquips { get { return m_ItemEquips; } } |
| | | } |
| | | } |
| | | |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 54be5c5a694cce842a5ad0dc6e7bbe76 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using UnityEngine; |
| | | using System; |
| | | using System.IO; |
| | | |
| | | |
| | | public class LocalChatHistory |
| | | { |
| | | public static Dictionary<ChatInfoType, List<string>> chatHistory = new Dictionary<ChatInfoType, List<string>>(); |
| | | |
| | | const string fileName = "ChatHistory"; |
| | | |
| | | public static int localSaveCount = 50; |
| | | public static int localChatKeepHour = 12; |
| | | |
| | | static StringBuilder sb = new StringBuilder(); |
| | | |
| | | public static void Save() |
| | | { |
| | | if (!ExistAnyLocalChatHistory()) |
| | | { |
| | | return; |
| | | } |
| | | var playerId = PlayerDatas.Instance.baseData.PlayerID; |
| | | var path = StringUtility.Contact(ResourcesPath.Instance.ExternalStorePath, fileName, "_", playerId, ".log"); |
| | | using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write)) |
| | | { |
| | | using (StreamWriter sw = new StreamWriter(fs, Encoding.UTF8)) |
| | | { |
| | | foreach (var type in chatHistory.Keys) |
| | | { |
| | | var list = chatHistory[type]; |
| | | if (list.Count > 0) |
| | | { |
| | | sw.WriteLine(StringUtility.Contact("channel:", (int)type)); |
| | | for (int i = 0; i < list.Count; i++) |
| | | { |
| | | sw.WriteLine(list[i]); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | static bool ExistAnyLocalChatHistory() |
| | | { |
| | | foreach (var list in chatHistory.Values) |
| | | { |
| | | if (list.Count > 0) |
| | | { |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | public static void Save<T>(T chat) where T : ChatUeseData |
| | | { |
| | | if (null == chat) |
| | | { |
| | | return; |
| | | } |
| | | switch (chat.type) |
| | | { |
| | | //case ChatInfoType.World: |
| | | case ChatInfoType.CrossServer: |
| | | case ChatInfoType.Area: |
| | | case ChatInfoType.Trumpet: |
| | | //case ChatInfoType.Fairy: |
| | | case ChatInfoType.Friend: |
| | | if (chat.IsSound && string.IsNullOrEmpty(chat.content)) |
| | | { |
| | | return; |
| | | } |
| | | var jsonString = ChatToString(chat); |
| | | if (!string.IsNullOrEmpty(jsonString)) |
| | | { |
| | | List<string> list; |
| | | if (!chatHistory.TryGetValue(chat.type, out list)) |
| | | { |
| | | list = new List<string>(); |
| | | chatHistory.Add(chat.type, list); |
| | | } |
| | | if (list.Count >= localSaveCount) |
| | | { |
| | | list.RemoveAt(0); |
| | | } |
| | | list.Add(jsonString); |
| | | } |
| | | break; |
| | | } |
| | | Save(); |
| | | } |
| | | |
| | | static void Save(ChatInfoType type, string line) |
| | | { |
| | | if (!string.IsNullOrEmpty(line)) |
| | | { |
| | | List<string> list; |
| | | if (!chatHistory.TryGetValue(type, out list)) |
| | | { |
| | | list = new List<string>(); |
| | | chatHistory.Add(type, list); |
| | | } |
| | | if (list.Count >= localSaveCount) |
| | | { |
| | | list.RemoveAt(0); |
| | | } |
| | | list.Add(line); |
| | | } |
| | | } |
| | | |
| | | public static string ChatToString(ChatUeseData chat) |
| | | { |
| | | switch (chat.type) |
| | | { |
| | | //case ChatInfoType.World: |
| | | case ChatInfoType.Area: |
| | | case ChatInfoType.CrossServer: |
| | | case ChatInfoType.Team: |
| | | //case ChatInfoType.Fairy: |
| | | { |
| | | LocalChat localChat = new LocalChat(); |
| | | localChat.type = chat.type; |
| | | localChat.player = chat.player; |
| | | localChat.name = chat.name; |
| | | localChat.extra = chat.extra; |
| | | localChat.content = chat.content; |
| | | localChat.time = chat.createTime; |
| | | return LitJson.JsonMapper.ToJson(localChat); |
| | | } |
| | | // case ChatInfoType.Trumpet: |
| | | // { |
| | | // var chatTrumpet = chat as ChatTrumpetData; |
| | | // LocalTrumpetChat localChat = new LocalTrumpetChat(); |
| | | // localChat.player = chat.player; |
| | | // localChat.name = chat.name; |
| | | // localChat.extra = chat.extra; |
| | | // localChat.content = chat.content; |
| | | // localChat.speakType = chatTrumpet.speakType; |
| | | // localChat.accId = chatTrumpet.accId; |
| | | // localChat.time = chat.createTime; |
| | | // return LitJson.JsonMapper.ToJson(localChat); |
| | | // } |
| | | case ChatInfoType.Friend: |
| | | { |
| | | var chatFriend = chat as ChatFriendData; |
| | | LocalFriendChat localChat = new LocalFriendChat(); |
| | | localChat.player = chat.player; |
| | | localChat.name = chat.name; |
| | | localChat.extra = chat.extra; |
| | | localChat.toName = chatFriend.toName; |
| | | localChat.toPlayer = chatFriend.toPlayer; |
| | | localChat.talkType = chatFriend.talkType; |
| | | localChat.content = chat.content; |
| | | localChat.time = chat.createTime; |
| | | return LitJson.JsonMapper.ToJson(localChat); |
| | | } |
| | | } |
| | | return string.Empty; |
| | | } |
| | | |
| | | public static void Read() |
| | | { |
| | | Clear(); |
| | | var playerId = PlayerDatas.Instance.baseData.PlayerID; |
| | | var path = StringUtility.Contact(ResourcesPath.Instance.ExternalStorePath, fileName, "_", playerId, ".log"); |
| | | if (!File.Exists(path)) |
| | | { |
| | | return; |
| | | } |
| | | using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read)) |
| | | { |
| | | using (StreamReader sr = new StreamReader(fs, Encoding.UTF8)) |
| | | { |
| | | ChatInfoType type = ChatInfoType.World; |
| | | while (!sr.EndOfStream) |
| | | { |
| | | try |
| | | { |
| | | var line = sr.ReadLine(); |
| | | if (line.StartsWith("channel")) |
| | | { |
| | | type = (ChatInfoType)int.Parse(line.Split(':')[1]); |
| | | continue; |
| | | } |
| | | if (type == ChatInfoType.Fairy) |
| | | { |
| | | if (PlayerDatas.Instance.baseData.FamilyId == 0) |
| | | { |
| | | continue; |
| | | } |
| | | } |
| | | ChatData chat = null; |
| | | switch (type) |
| | | { |
| | | //case ChatInfoType.World: |
| | | case ChatInfoType.Area: |
| | | case ChatInfoType.CrossServer: |
| | | case ChatInfoType.Team: |
| | | //case ChatInfoType.Fairy: |
| | | { |
| | | LocalChat localChat = LitJson.JsonMapper.ToObject<LocalChat>(line); |
| | | var ts = DateTime.Now - localChat.time; |
| | | if (ts.TotalHours >= localChatKeepHour) |
| | | { |
| | | continue; |
| | | } |
| | | if (type == ChatInfoType.World) |
| | | { |
| | | chat = new ChatWorldData(localChat.content, localChat.player, localChat.name, localChat.extra); |
| | | } |
| | | else if (type == ChatInfoType.Area) |
| | | { |
| | | chat = new ChatAreaData(localChat.content, localChat.player, localChat.name, localChat.extra); |
| | | } |
| | | else if (type == ChatInfoType.Team) |
| | | { |
| | | chat = new ChatTeamData(localChat.content, localChat.player, localChat.name, localChat.extra); |
| | | } |
| | | else if (type == ChatInfoType.Fairy) |
| | | { |
| | | chat = new ChatFamilyData(localChat.content, localChat.player, localChat.name, localChat.extra); |
| | | } |
| | | else if (type == ChatInfoType.CrossServer) |
| | | { |
| | | chat = new ChatCrossServerData(localChat.content, localChat.player, localChat.name, localChat.extra); |
| | | } |
| | | chat.createTime = localChat.time; |
| | | } |
| | | break; |
| | | // case ChatInfoType.Trumpet: |
| | | // { |
| | | // LocalTrumpetChat localChat = LitJson.JsonMapper.ToObject<LocalTrumpetChat>(line); |
| | | // var ts = DateTime.Now - localChat.time; |
| | | // if (ts.TotalHours >= localChatKeepHour) |
| | | // { |
| | | // continue; |
| | | // } |
| | | // chat = new ChatTrumpetData(localChat.content, localChat.player, localChat.name, |
| | | // localChat.extra, localChat.speakType, localChat.accId); |
| | | // chat.createTime = localChat.time; |
| | | // } |
| | | // break; |
| | | case ChatInfoType.Friend: |
| | | { |
| | | LocalFriendChat localChat = LitJson.JsonMapper.ToObject<LocalFriendChat>(line); |
| | | var ts = DateTime.Now - localChat.time; |
| | | if (ts.TotalHours >= localChatKeepHour) |
| | | { |
| | | continue; |
| | | } |
| | | chat = new ChatFriendData(localChat.content, localChat.player, localChat.name, |
| | | localChat.extra, localChat.toName, localChat.talkType, (uint)localChat.toPlayer); |
| | | chat.createTime = localChat.time; |
| | | } |
| | | break; |
| | | } |
| | | if (chat != null) |
| | | { |
| | | ChatManager.Instance.KeepLocalChat(chat); |
| | | } |
| | | Save(type, line); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | | Debug.Log(e.Message); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static void Clear(ChatInfoType type) |
| | | { |
| | | if (chatHistory.ContainsKey(type)) |
| | | { |
| | | chatHistory.Remove(type); |
| | | Save(); |
| | | } |
| | | } |
| | | |
| | | public static void Clear() |
| | | { |
| | | chatHistory.Clear(); |
| | | } |
| | | |
| | | public struct LocalChat |
| | | { |
| | | public ChatInfoType type; |
| | | public DateTime time; |
| | | public int player; |
| | | public string name; |
| | | public string extra; |
| | | public string content; |
| | | } |
| | | |
| | | public struct LocalFriendChat |
| | | { |
| | | public DateTime time; |
| | | public int player; |
| | | public string name; |
| | | public string extra; |
| | | public string content; |
| | | public string toName; |
| | | public byte talkType; |
| | | public int toPlayer; |
| | | } |
| | | |
| | | public struct LocalTrumpetChat |
| | | { |
| | | public DateTime time; |
| | | public int player; |
| | | public string name; |
| | | public string extra; |
| | | public string content; |
| | | public byte speakType; |
| | | public string accId; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 2be021001cf2964428f72448aa2c536d |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
| | |
| | | public void CleanNewBranchSet() |
| | | { |
| | | LocalSave.DeleteKey("#@#BrancH"); |
| | | // ScrollTip.ShowTip("清理分支设置"); |
| | | ScrollTip.ShowTip("清理分支设置"); |
| | | } |
| | | |
| | | public void PrintLastCrashLog() |
| | |
| | | |
| | | private void BeforePlayerDataInitializeEvent() |
| | | { |
| | | // TODO YYL |
| | | // ScrollTip.m_Hints.Clear(); |
| | | ScrollTip.m_Hints.Clear(); |
| | | ServerTipDetails.ClearHint(); |
| | | } |
| | | |
| | |
| | | #if UNITY_EDITOR |
| | | string hint = Language.Get("L1093", key); |
| | | // TODO YYL |
| | | // ScrollTip.ShowTip(hint); |
| | | ScrollTip.ShowTip(hint); |
| | | // ChatCtrl.Inst.RevChatInfo(hint); |
| | | #endif |
| | | } |
| | |
| | | break; |
| | | case SysNotifyType.SysFixedTip1: |
| | | case SysNotifyType.SysScrollTip: |
| | | // TODO YYL |
| | | // ScrollTip.ShowTip(msg, tipInfoList, order); |
| | | ScrollTip.ShowTip(msg, tipInfoList, order); |
| | | break; |
| | | case SysNotifyType.SysIntervalFixedTip: |
| | | ServerTipDetails.ShowServerTip(msg, tipInfoList, order); |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | |
| | | public enum ChatBoolType |
| | | { |
| | | ChannelSystem = 0 , //系统频道 |
| | | ChannelWorld,//世界频道 |
| | | ChannelATeam,//组队频道 |
| | | ChannelTeam,//队伍频道 |
| | | ChannelBugle,//喇叭频道 |
| | | ChannelGrad,//仙盟频道 |
| | | ChannelArea,//区域频道 |
| | | //ChannelAlliance,//同盟频道 |
| | | |
| | | Voice1, |
| | | Voice2, |
| | | Voice3, |
| | | |
| | | GradVoiceWifi, //仙盟语音Wifi |
| | | PrivateChatVoiceWifi,//私聊语音Wifi |
| | | TeamVoiceWifi,//队伍语音Wifi |
| | | WorldVoiceWifi,//世界语音Wifi |
| | | AreaVoiceWifi,//区域语音Wifi |
| | | // AllianceVoiceWifi, //同盟语音Wifi |
| | | |
| | | GradVoice4G,//仙盟语音4G |
| | | PrivatChatVoice4G,//私聊语音4G |
| | | TeamVoice4G,//队伍语音4G |
| | | WorldVoice4G,//世界语音4G |
| | | AreaVoice4G,//区域语音4G |
| | | //AllianceVoice4G, //同盟语音4G |
| | | //后续IL开发添加预设 |
| | | default1, |
| | | default2, |
| | | default3, |
| | | default4, |
| | | default5, |
| | | default6, |
| | | default7, |
| | | default8, |
| | | default9, |
| | | default10, |
| | | } |
| | | |
| | | |
| | | public class ChatSetting : Singleton<ChatSetting> |
| | | |
| | | { |
| | | const string ChatBoolSet_Key = "ChatBoolSet"; |
| | | |
| | | public event Action<ChatBoolType, bool> RefreshChatSetAct; |
| | | |
| | | #region 缓存数据 |
| | | public Dictionary<ChatBoolType, bool> boolSetDict { get; private set; } |
| | | public void GetLoginBoolSet() |
| | | { |
| | | boolSetDict = new Dictionary<ChatBoolType, bool>(); |
| | | for (int i = 0; i < 20; i++) |
| | | { |
| | | if (!boolSetDict.ContainsKey((ChatBoolType)i)) |
| | | { |
| | | boolSetDict.Add((ChatBoolType)i, SettingMgr.Instance.GetAccountSetBoolInfo(((ChatBoolType)i).ToString())); |
| | | } |
| | | |
| | | } |
| | | } |
| | | #endregion |
| | | |
| | | public void SetBoolSetStr(ChatBoolType type, bool isOpen) |
| | | { |
| | | SettingMgr.Instance.SetAccountSetStr(type.ToString(),isOpen.ToString()); |
| | | switch (type) { |
| | | case ChatBoolType.ChannelSystem: |
| | | ChatManager.Instance.SetChatChannelShow(ChatInfoType.System, isOpen); |
| | | break; |
| | | case ChatBoolType.ChannelWorld: |
| | | ChatManager.Instance.SetChatChannelShow(ChatInfoType.World, isOpen); |
| | | break; |
| | | case ChatBoolType.ChannelATeam: |
| | | ChatManager.Instance.SetChatChannelShow(ChatInfoType.Invite, isOpen); |
| | | break; |
| | | case ChatBoolType.ChannelTeam: |
| | | ChatManager.Instance.SetChatChannelShow(ChatInfoType.Team, isOpen); |
| | | break; |
| | | case ChatBoolType.ChannelBugle: |
| | | ChatManager.Instance.SetChatChannelShow(ChatInfoType.Trumpet, isOpen); |
| | | break; |
| | | case ChatBoolType.ChannelGrad: |
| | | ChatManager.Instance.SetChatChannelShow(ChatInfoType.Fairy, isOpen); |
| | | break; |
| | | case ChatBoolType.ChannelArea: |
| | | ChatManager.Instance.SetChatChannelShow(ChatInfoType.Area, isOpen); |
| | | break; |
| | | } |
| | | |
| | | if (boolSetDict != null) |
| | | { |
| | | if (boolSetDict.ContainsKey(type)) |
| | | { |
| | | boolSetDict[type] = isOpen; |
| | | } |
| | | } |
| | | |
| | | if(RefreshChatSetAct != null) |
| | | { |
| | | RefreshChatSetAct(type,isOpen); |
| | | } |
| | | } |
| | | |
| | | public bool GetBool(ChatBoolType type) |
| | | { |
| | | if (boolSetDict != null) |
| | | { |
| | | bool isOpen = false; |
| | | boolSetDict.TryGetValue(type, out isOpen); |
| | | return isOpen; |
| | | } |
| | | else |
| | | { |
| | | return SettingMgr.Instance.GetAccountSetBoolInfo(type.ToString()); |
| | | } |
| | | } |
| | | |
| | | public bool GetAutoPlayVoice(ChatInfoType type, int netState) |
| | | { |
| | | if (netState == 0) |
| | | { |
| | | return false; |
| | | } |
| | | switch (type) |
| | | { |
| | | case ChatInfoType.World: |
| | | if (netState == 2) |
| | | { |
| | | return GetBool(ChatBoolType.WorldVoiceWifi); |
| | | } |
| | | else |
| | | { |
| | | return GetBool(ChatBoolType.WorldVoice4G); |
| | | } |
| | | case ChatInfoType.Area: |
| | | if (netState == 2) |
| | | { |
| | | return GetBool(ChatBoolType.AreaVoiceWifi); |
| | | } |
| | | else |
| | | { |
| | | return GetBool(ChatBoolType.AreaVoice4G); |
| | | } |
| | | case ChatInfoType.Team: |
| | | if (netState == 2) |
| | | { |
| | | return GetBool(ChatBoolType.TeamVoiceWifi); |
| | | } |
| | | else |
| | | { |
| | | return GetBool(ChatBoolType.TeamVoice4G); |
| | | } |
| | | case ChatInfoType.Fairy: |
| | | if (netState == 2) |
| | | { |
| | | return GetBool(ChatBoolType.GradVoiceWifi); |
| | | } |
| | | else |
| | | { |
| | | return GetBool(ChatBoolType.GradVoice4G); |
| | | } |
| | | case ChatInfoType.Friend: |
| | | if (netState == 2) |
| | | { |
| | | return GetBool(ChatBoolType.PrivateChatVoiceWifi); |
| | | } |
| | | else |
| | | { |
| | | return GetBool(ChatBoolType.PrivatChatVoice4G); |
| | | } |
| | | case ChatInfoType.CrossServer: |
| | | return false; |
| | | } |
| | | return false; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: f233865cd812ec342a52b00b4af26d27 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |
New file |
| | |
| | | using vnxbqy.UI; |
| | | using System; |
| | | using System.Collections; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using System.Text.RegularExpressions; |
| | | using UnityEngine; |
| | | |
| | | |
| | | public class LanguageVerify : Singleton<LanguageVerify> |
| | | |
| | | { |
| | | const string Sercret = "c345a165b566d1c421afd8a748373d7f"; |
| | | |
| | | static StringBuilder sb = new StringBuilder(); |
| | | |
| | | /// <summary> |
| | | /// 校验玩家名 |
| | | /// </summary> |
| | | /// <param name="verifyName">需要检验的名字</param> |
| | | /// <param name="playerId">玩家id</param> |
| | | /// <param name="playerName">原来的角色名,创角传空</param> |
| | | /// <param name="level">玩家等级</param> |
| | | /// <param name="vipLv">玩家VIP等级</param> |
| | | /// <param name="callback"></param> |
| | | public void VerifyPlayerName(string verifyName, int playerId, string playerName, int level, int vipLv, Action<bool, string> callback) |
| | | { |
| | | if (callback != null) |
| | | { |
| | | callback(true, verifyName); |
| | | callback = null; |
| | | } |
| | | return; |
| | | } |
| | | |
| | | public void VerifyFairy(string verifyContent, int op_type, string fairyName, int title, Action<bool, string> callback) |
| | | { |
| | | if (callback != null) |
| | | { |
| | | callback(true, verifyContent); |
| | | callback = null; |
| | | } |
| | | return; |
| | | } |
| | | |
| | | public static uint toPlayer = 0; |
| | | public static string toPlayerName = string.Empty; |
| | | public static int toPlayerLevel = 0; |
| | | public void VerifyChat(string content, ChatInfoType channelType, Action<bool, string> callback) |
| | | { |
| | | int channel = 0; |
| | | var chatCenter = ChatCenter.Instance; |
| | | if (chatCenter.IsChatBanned || chatCenter.IsClientBan(channelType)) |
| | | { |
| | | if (!(IsFairyFeast(channelType) || IsSystemChat(content))) |
| | | { |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if (!GetChannel(channelType, out channel)) |
| | | { |
| | | return; |
| | | } |
| | | if (callback != null) |
| | | { |
| | | callback(true, content); |
| | | callback = null; |
| | | } |
| | | |
| | | } |
| | | |
| | | Dictionary<long, List<string>> transferContents = new Dictionary<long, List<string>>(); |
| | | Dictionary<long, List<int>> splitContents = new Dictionary<long, List<int>>(); |
| | | |
| | | List<MatchString> matchs = new List<MatchString>(); |
| | | |
| | | struct MatchString |
| | | { |
| | | public int index; |
| | | public string value; |
| | | } |
| | | |
| | | void AddMathcs(MatchCollection _matchs) |
| | | { |
| | | if (_matchs.Count == 0) |
| | | { |
| | | return; |
| | | } |
| | | foreach (Match match in _matchs) |
| | | { |
| | | matchs.Add(new MatchString() |
| | | { |
| | | index = match.Index, |
| | | value = match.Value, |
| | | }); |
| | | } |
| | | } |
| | | |
| | | string TransferContent(long tick, string content) |
| | | { |
| | | List<string> list; |
| | | List<int> splits; |
| | | if (!transferContents.TryGetValue(tick, out list)) |
| | | { |
| | | list = new List<string>(); |
| | | transferContents.Add(tick, list); |
| | | } |
| | | if (!splitContents.TryGetValue(tick, out splits)) |
| | | { |
| | | splits = new List<int>(); |
| | | splitContents.Add(tick, splits); |
| | | } |
| | | list.Clear(); |
| | | splits.Clear(); |
| | | matchs.Clear(); |
| | | AddMathcs(WordAnalysis.Color_Start_Regex.Matches(content)); |
| | | AddMathcs(WordAnalysis.Color_End_Regex.Matches(content)); |
| | | AddMathcs(ImgAnalysis.FaceRegex.Matches(content)); |
| | | AddMathcs(ChatManager.InviteRegex.Matches(content)); |
| | | AddMathcs(WordAnalysis.Size_Start_Regex.Matches(content)); |
| | | AddMathcs(WordAnalysis.Size_End_Regex.Matches(content)); |
| | | AddMathcs(WordAnalysis.Space_Regex.Matches(content)); |
| | | AddMathcs(ChatManager.KillRegex.Matches(content)); |
| | | AddMathcs(ChatCenter.s_VoiceRegex.Matches(content)); |
| | | matchs.Sort((x, y) => |
| | | { |
| | | return x.index.CompareTo(y.index); |
| | | }); |
| | | var index = 0; |
| | | for (int i = 0; i < matchs.Count; i++) |
| | | { |
| | | list.Add(matchs[i].value); |
| | | var length = matchs[i].index - index; |
| | | splits.Add(length); |
| | | index += length + matchs[i].value.Length; |
| | | } |
| | | content = WordAnalysis.Color_Start_Regex.Replace(content, string.Empty); |
| | | content = WordAnalysis.Color_End_Regex.Replace(content, string.Empty); |
| | | content = ImgAnalysis.FaceRegex.Replace(content, string.Empty); |
| | | content = ChatManager.InviteRegex.Replace(content, string.Empty); |
| | | content = WordAnalysis.Size_Start_Regex.Replace(content, string.Empty); |
| | | content = WordAnalysis.Size_End_Regex.Replace(content, string.Empty); |
| | | content = WordAnalysis.Space_Regex.Replace(content, string.Empty); |
| | | content = ChatManager.KillRegex.Replace(content, string.Empty); |
| | | content = ChatCenter.s_VoiceRegex.Replace(content, string.Empty); |
| | | return content; |
| | | } |
| | | |
| | | string DisTransfer(long tick, string content) |
| | | { |
| | | List<string> list; |
| | | if (!transferContents.TryGetValue(tick, out list)) |
| | | { |
| | | return content; |
| | | } |
| | | List<int> splits; |
| | | if (!splitContents.TryGetValue(tick, out splits)) |
| | | { |
| | | return content; |
| | | } |
| | | var index = 0; |
| | | sb.Length = 0; |
| | | for (int i = 0; i < splits.Count; i++) |
| | | { |
| | | sb.Append(content.Substring(index, splits[i])); |
| | | if (i < list.Count) |
| | | { |
| | | sb.Append(list[i]); |
| | | } |
| | | index += splits[i]; |
| | | } |
| | | sb.Append(content.Substring(index)); |
| | | transferContents.Remove(tick); |
| | | splitContents.Remove(tick); |
| | | return sb.ToString(); |
| | | } |
| | | |
| | | bool IsSystemChat(string content) |
| | | { |
| | | if (ChatManager.InviteRegex.IsMatch(content) |
| | | || ChatManager.KillRegex.IsMatch(content)) |
| | | { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | bool GetChannel(ChatInfoType type, out int channel) |
| | | { |
| | | channel = 0; |
| | | switch (type) |
| | | { |
| | | case ChatInfoType.World: |
| | | case ChatInfoType.CrossServer: |
| | | channel = 0; |
| | | break; |
| | | case ChatInfoType.Team: |
| | | channel = 4; |
| | | break; |
| | | case ChatInfoType.Area: |
| | | case ChatInfoType.Trumpet: |
| | | case ChatInfoType.default1: |
| | | channel = 5; |
| | | break; |
| | | case ChatInfoType.Fairy: |
| | | channel = 2; |
| | | break; |
| | | case ChatInfoType.Friend: |
| | | channel = 3; |
| | | break; |
| | | default: |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | bool IsFairyFeast(ChatInfoType type) |
| | | { |
| | | // TODO YYL |
| | | // var dailyQuestModel = ModelCenter.Instance.GetModel<DailyQuestModel>(); |
| | | // DailyQuestOpenTime dailyQuestOpenTime; |
| | | // if (dailyQuestModel.TryGetOpenTime((int)DailyQuestType.FairyFeast, out dailyQuestOpenTime)) |
| | | // { |
| | | // return type == ChatInfoType.Fairy && dailyQuestOpenTime.InOpenTime(); |
| | | // } |
| | | return false; |
| | | } |
| | | |
| | | public class VerifyResponse |
| | | { |
| | | public string result; |
| | | public int code; |
| | | public string content; |
| | | } |
| | | } |
New file |
| | |
| | | fileFormatVersion: 2 |
| | | guid: 1fd3fdd6f2f5d0d45813610dc7cbc714 |
| | | MonoImporter: |
| | | externalObjects: {} |
| | | serializedVersion: 2 |
| | | defaultReferences: [] |
| | | executionOrder: 0 |
| | | icon: {instanceID: 0} |
| | | userData: |
| | | assetBundleName: |
| | | assetBundleVariant: |