private void OnPlayerEnterLeftGame(PlayerInfo playerInfo, bool isEnter)
        {
            string msg = string.Format("玩家: {0} {1}了游戏, SteamID: {2}", playerInfo.PlayerName, isEnter ? "进入" : "离开", playerInfo.SteamID);

            Log.Info(msg);

            _chatMessageViewService.AppendBlock(new RichText(DateTime.Now.ToString() + " "),
                                                new RichText(msg, "#00FA9A"));
        }
예제 #2
0
        private void OnLogRecorded(string message, Exception exception, LogLevel logLevel)
        {
            List <RichText> richTexts = new List <RichText>();

            string color = null;

            switch (logLevel)
            {
            case LogLevel.Trace:
                break;

            case LogLevel.Debug:
                break;

            case LogLevel.Info:
                break;

            case LogLevel.Warn:
                color = "#FFD700";
                break;

            case LogLevel.Error:
                color = "#FF0000";
                break;

            case LogLevel.Fatal:
                color = "#FF0000";
                break;
            }

            richTexts.Add(new RichText(message, color));

            if (exception != null)
            {
                richTexts.Add(new RichText(" "));
                richTexts.Add(new RichText(exception.Message, color));

                exception = exception.InnerException;
                if (exception != null)
                {
                    richTexts.Add(new RichText(" "));
                    richTexts.Add(new RichText(exception.Message, color));
                }
            }

            _outputLogService.AppendBlock(richTexts);
        }