Files
Main/Assets/Code/Logic/_Required/Networker/MsgExtend.cs

55 lines
1.3 KiB
C#
Raw Normal View History

2025-01-25 04:38:09 +08:00
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);
}
}