2025-01-25 04:38:09 +08:00

55 lines
1.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using Thousandto.Code.Logic.Network;
using UnityEngine;
/// <summary>
/// 消息拓展类
/// </summary>
public class MsgExtend
{
static MsgExtend _sharedInstance = null;
public static MsgExtend Instance
{
get
{
return SharedInstance;
}
}
public static MsgExtend SharedInstance
{
get
{
if (_sharedInstance == null)
{
_sharedInstance = new MsgExtend();
}
return _sharedInstance;
}
}
//lua消息ID表
public HashSet<uint> ResLuaMsgIDMap = new HashSet<uint>();
public HashSet<uint> ResLuaExtendMsgIDMap = new HashSet<uint>();
private HashSet<uint> ResCSMsgIDMap = new HashSet<uint>();
private bool isInitMsg = false;
//这个消息是否走lua端
public bool IsGoLuaMsg(uint msgId)
{
if (!isInitMsg)
{
isInitMsg = true;
}
return !ResCSMsgIDMap.Contains(msgId) && (ResLuaMsgIDMap.Contains(msgId) || msgId >= 500000);
}
//这个消息是否是lua扩展消息lua和C#同时处理
public bool IsGoLuaExtendMsg(uint msgId)
{
return ResLuaExtendMsgIDMap.Contains(msgId);
}
}