GameFramework.JsonGmMessageDispatcher.Init C# (CSharp) Method

Init() static private method

static private Init ( int worldId ) : void
worldId int
return void
        internal static void Init(int worldId)
        {
            if (!s_Inited) {
            s_WorldId = worldId;
            s_MessageHandlers = new JsonMessageHandlerInfo[(int)LobbyGmMessageDefine.MaxNum];
            for (int i = 0; i < (int)LobbyGmMessageDefine.MaxNum; ++i) {
              s_MessageHandlers[i] = new JsonMessageHandlerInfo();
            }
            s_Inited = true;
              }
        }

Usage Example

        /// <summary>
        /// 注意,node来的消息处理需要分发到DataProcess的用户线程里进行处理!
        /// 注意,GM工具消息与客户端GM消息不要混用,实现代码要分开放(后面代码里有有标注,客户端的GM消息处理在前,GM工具的在后,中间有分隔区)!!!
        /// </summary>
        private void InstallGmJsonHandlers()
        {
            //客户端GM消息

            if (UserServerConfig.WorldIdNum > 0)
            {
                JsonGmMessageDispatcher.Init(UserServerConfig.WorldId1);
                //GM工具消息
            }
        }