Init() static private method

static private Init ( ) : void
return void
示例#1
0
        private void OnCommand(int src, int dest, string command)
        {
            const string c_QuitLobby    = "QuitLobby";
            const string c_ReloadConfig = "ReloadConfig";

            try {
                if (0 == command.CompareTo(c_QuitLobby))
                {
                    LogSys.Log(LOG_TYPE.MONITOR, "receive {0} command, save data and then quitting ...", command);
                    if (!m_WaitQuit)
                    {
                        m_UserProcessScheduler.DispatchAction(m_UserProcessScheduler.DoCloseServers);
                        m_LastWaitQuitTime = TimeUtility.GetLocalMilliseconds();
                        m_WaitQuit         = true;
                    }
                }
                else if (0 == command.CompareTo(c_ReloadConfig))
                {
                    CenterClientApi.ReloadConfigScript();
                    LobbyConfig.Init();
                    LogSys.Log(LOG_TYPE.WARN, "receive {0} command.", command);
                }
            } catch (Exception ex) {
                LogSys.Log(LOG_TYPE.ERROR, "Exception {0}\n{1}", ex.Message, ex.StackTrace);
            }
        }
示例#2
0
        private void Init(string[] args)
        {
            m_NameHandleCallback = this.OnNameHandleChanged;
            m_MsgCallback        = this.OnMessage;
            m_MsgResultCallback  = this.OnMessageResultCallback;
            m_CmdCallback        = this.OnCommand;
            m_LogHandler         = this.OnCenterLog;
            CenterClientApi.SetCenterLogHandler(m_LogHandler);
            CenterClientApi.Init("lobby", args.Length, args, m_NameHandleCallback, m_MsgCallback, m_MsgResultCallback, m_CmdCallback);

            LogSys.Init("./config/logconfig.xml");
            LobbyConfig.Init();

            if (LobbyConfig.IsDebug)
            {
                GlobalVariables.Instance.IsDebug = true;
            }

            GlobalVariables.Instance.IsClient = false;

            ResourceReadProxy.OnReadAsArray = ((string filePath) => {
                byte[] buffer = null;
                try {
                    buffer = File.ReadAllBytes(filePath);
                } catch (Exception e) {
                    LogSys.Log(LOG_TYPE.ERROR, "Exception:{0}\n{1}", e.Message, e.StackTrace);
                    return(null);
                }
                return(buffer);
            });
            LogSystem.OnOutput += (Log_Type type, string msg) => {
                switch (type)
                {
                case Log_Type.LT_Debug:
                    LogSys.Log(LOG_TYPE.DEBUG, msg);
                    break;

                case Log_Type.LT_Info:
                    LogSys.Log(LOG_TYPE.INFO, msg);
                    break;

                case Log_Type.LT_Warn:
                    LogSys.Log(LOG_TYPE.WARN, msg);
                    break;

                case Log_Type.LT_Error:
                case Log_Type.LT_Assert:
                    LogSys.Log(LOG_TYPE.ERROR, msg);
                    break;
                }
            };

            LoadData();
            LogSys.Log(LOG_TYPE.INFO, "Init Config ...");
            s_Instance = this;
            InstallMessageHandlers();
            LogSys.Log(LOG_TYPE.INFO, "Init Messenger ...");
            m_RoomProcessThread.Init();
            LogSys.Log(LOG_TYPE.INFO, "Init RoomProcessThread ...");
            Start();
            LogSys.Log(LOG_TYPE.INFO, "Start Threads ...");
        }
示例#3
0
        private void Init(string[] args)
        {
            m_NameHandleCallback = this.OnNameHandleChanged;
            m_MsgCallback        = this.OnMessage;
            m_CmdCallback        = this.OnCommand;
            m_MsgResultCallback  = this.OnMessageResult;
            CenterClientApi.Init("lobby", args.Length, args, m_NameHandleCallback, m_MsgCallback, m_MsgResultCallback, m_CmdCallback);

            LogSys.Init("./config/logconfig.xml");
            LobbyConfig.Init();

            if (LobbyConfig.IsDebug)
            {
                GlobalVariables.Instance.IsDebug = true;
            }

            GlobalVariables.Instance.IsClient = false;

            FileReaderProxy.RegisterReadFileHandler((string filePath) =>
            {
                byte[] buffer = null;
                try
                {
                    buffer = File.ReadAllBytes(filePath);
                }
                catch (Exception e)
                {
                    LogSys.Log(LOG_TYPE.ERROR, "Exception:{0}\n{1}", e.Message, e.StackTrace);
                    return(null);
                }
                return(buffer);
            }, (string filePath) =>
            {
                return(File.Exists(filePath));
            });
            LogSystem.OnOutput += (Log_Type type, string msg) =>
            {
                switch (type)
                {
                case Log_Type.LT_Debug:
                    LogSys.Log(LOG_TYPE.DEBUG, msg);
                    break;

                case Log_Type.LT_Info:
                    LogSys.Log(LOG_TYPE.INFO, msg);
                    break;

                case Log_Type.LT_Warn:
                    LogSys.Log(LOG_TYPE.WARN, msg);
                    break;

                case Log_Type.LT_Error:
                case Log_Type.LT_Assert:
                    LogSys.Log(LOG_TYPE.ERROR, msg);
                    break;
                }
            };

            LoadData();

            LogSys.Log(LOG_TYPE.INFO, "Init Config ...");
            s_Instance = this;
            InstallMessageHandlers();
            LogSys.Log(LOG_TYPE.INFO, "Init Messenger ...");
            m_DataStoreThread.Init(m_StoreChannel);
            LogSys.Log(LOG_TYPE.INFO, "Init DataStore ...");
            m_ServerBridgeThread.Init(m_BridgeChannel);
            LogSys.Log(LOG_TYPE.INFO, "Init BillingClient ...");
            m_GmServerThread.Init(m_GmSvrChannel);
            LogSys.Log(LOG_TYPE.INFO, "Init GmServerThread ...");
            Start();
            LogSys.Log(LOG_TYPE.INFO, "Start Threads ...");
        }