lcy
1 天以前 4cb216db7866b50459e596f3e417c9e010b72a62
76 聊天系统 支持系统消息弹幕和聊天频道分开发
3个文件已修改
40 ■■■■ 已修改文件
Main/System/Chat/ChatManager.cs 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Message/GMNotify.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Message/SysNotifyMgr.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Chat/ChatManager.cs
@@ -1,8 +1,8 @@
using System.Collections;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Text;
using System;
using LitJson;
public partial class ChatManager : GameSystemManager<ChatManager>
@@ -161,6 +161,7 @@
            return true;
        return false;
    }
    // 0-系统 1-日期 2-自己 3-其他玩家
    public int GetTalkDataType(TalkData talkData)
    {
@@ -428,6 +429,7 @@
    }
    public void AddTalkData(ChatChannel type, TalkData data, bool isSendBullet)
    {
        //如果超过限制先删除旧数据
@@ -447,10 +449,7 @@
            }
        }
        if (isSendBullet)
        {
            OnUpdateTalkEvent?.Invoke(type, data, isSendBullet);
        }
    }
    public Dictionary<ChatChannel, int> currentDayDict = new Dictionary<ChatChannel, int>();
@@ -478,16 +477,17 @@
        return false;
    }
    public void AddSysData(string msg, ArrayList infoList, ChatChannel type, bool isSendBullet)
    public void AddSysData(string msg, ArrayList infoList, ChatChannel type)
    {
        int allSeconds = type == ChatChannel.CrossServer ? TimeUtility.GetCommServerTick(GuildManager.Instance.zoneID) : TimeUtility.AllSeconds;
        // 如果隔天,增加日期行
        TryAddDate(allSeconds, type, isSendBullet);
        TryAddDate(allSeconds, type, false);
        if (!talkDict.ContainsKey(type))
        {
            talkDict[type] = new List<TalkData>();
        }
        AddTalkData(type, new TalkData()
        {
            ChannelType = (byte)type,
@@ -496,9 +496,21 @@
            BubbleBox = 1,
            TalkTime = (uint)allSeconds,
            InfoList = new ArrayList(infoList),
        }, isSendBullet);
        }, false);
    }
    public void SendPureBullet(string msg, ArrayList infoList, ChatChannel type = ChatChannel.World)
    {
        TalkData talkData = new TalkData()
        {
            ChannelType = (byte)type,
            isSystem = true,
            Content = msg,
            InfoList = infoList != null ? new ArrayList(infoList) : null
        };
        OnUpdateTalkEvent?.Invoke(type, talkData, true);
    }
    public void UpdateTalk(HB310_tagMCTalk vNetData)
    {
        if (!IsValidChatChannel(vNetData.ChannelType))
Main/System/Message/GMNotify.cs
@@ -84,7 +84,7 @@
    private void Notify(GMNotifyMessgae _notify)
    {
        ServerTipDetails.ShowMarquee(_notify.message, null, 10);
        ChatManager.Instance.AddSysData(_notify.message, infoArray, ChatChannel.World, false);
        ChatManager.Instance.AddSysData(_notify.message, infoArray, ChatChannel.World);
    }
    private bool CheckNotify(GMNotifyMessgae _notify)
Main/System/Message/SysNotifyMgr.cs
@@ -241,11 +241,14 @@
                case SysNotifyType.SysMarqueeTip:
                    ServerTipDetails.ShowMarquee(msg, tipInfoList, order);
                    break;
                case SysNotifyType.SysBulletScreen:
                    ChatManager.Instance.SendPureBullet(msg, tipInfoList);
                    break;
                case SysNotifyType.ChatChannelWorld:
                    ChatManager.Instance.AddSysData(msg, tipInfoList, ChatChannel.World, true);
                    ChatManager.Instance.AddSysData(msg, tipInfoList, ChatChannel.World);
                    break;
                case SysNotifyType.ChatChannelGuild:
                    ChatManager.Instance.AddSysData(msg, tipInfoList, ChatChannel.Guild, true);
                    ChatManager.Instance.AddSysData(msg, tipInfoList, ChatChannel.Guild);
                    break;
                case SysNotifyType.SysRealmTip:
                    if (OnSysTipEvent != null)
@@ -278,6 +281,7 @@
        SysChatWin = 6, //聊天位置的提示
        SysEvenKill = 7,//上古战场连杀提示
        SysFixedTip1 = 11,//固定提示2
        SysBulletScreen = 19,//弹幕
        ChatChannelWorld = 20,//聊天-世界频道
        ChatChannelGuild = 21,//聊天-公会频道
        SysFairyQuestionTip = 31,//仙盟频道问答提示