Esempio n. 1
0
            public void Log <TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func <TState, Exception, string> formatter)
            {
                if (!IsEnabled(logLevel))
                {
                    return;
                }

                if (formatter != null)
                {
                    LogHistory.Add(formatter(state, exception));
                }
                else
                {
                    if (state != null)
                    {
                        LogHistory.Add($"{DateTime.Now:s} [{logLevel.ToString()}]: {state}");
                    }

                    if (exception != null)
                    {
                        LogHistory.Add($"{DateTime.Now:s} [{logLevel.ToString()}] Exception Details: {exception.ToString().PadLeft(512, ' ').Substring(0, 511)}");
                    }
                }

                //cleanup LogHistory
                if (LogHistory.Count > 9999)
                {
                    for (var i = 0; i < 1000; i++)
                    {
                        LogHistory.RemoveAt(0);
                    }
                }
            }
Esempio n. 2
0
        /// <summary>
        /// Logs the command, adding it to the log history and triggers an event
        /// </summary>
        /// <param name="command"></param>
        /// <param name="color"></param>
        private static void LogCommand(string command, string color)
        {
            DebugLogItem item = new DebugLogItem(command, color, Time.frameCount, Time.time, 3, true);

            LogHistory.Add(item);
            MMDebugLogEvent.Trigger(new DebugLogItem(null, "", Time.frameCount, Time.time, 0, false));
        }
Esempio n. 3
0
 public void LogWillPowerChanged(string name, int oldValue, int newValue)
 {
     if (oldValue > newValue)
     {
         LogHistory.Add(new Log($"{name}'s Willpower has decremented from {oldValue} to {newValue}"));
     }
     else if (newValue > oldValue)
     {
         LogHistory.Add(new Log($"{name}'s Willpower has incremented from {oldValue} to {newValue}"));
     }
 }
Esempio n. 4
0
 public void LogTurnChange(int newTurn, int previousTurn)
 {
     if (newTurn > previousTurn)
     {
         LogHistory.Add(new Log($"Incremented to turn {newTurn}"));
     }
     else if (newTurn < previousTurn)
     {
         LogHistory.Add(new Log($"Decremented to turn {newTurn}"));
     }
 }
Esempio n. 5
0
 public void LogObsessionPointsChanged(string name, int obsOldPts, int obsNewPts)
 {
     if (obsOldPts > obsNewPts)
     {
         LogHistory.Add(new Log(
                            $"{name} has lost {obsOldPts - obsNewPts} Obsession Point{(obsOldPts - obsNewPts == 1 ? "" : "s")}"));
     }
     else if (obsNewPts > obsOldPts)
     {
         LogHistory.Add(new Log(
                            $"{name} has earned {obsNewPts - obsOldPts} Obsession Point{(obsOldPts - obsNewPts == 1 ? "" : "s")}"));
     }
 }
Esempio n. 6
0
        public void LogDiceRoll(int[] rolls, int modifier)
        {
            var output = rolls.Length switch
            {
                0 => throw new NotImplementedException(),
                      1 => $"{rolls.Length} dice rolled: {rolls.Sum() + modifier}",
                      _ => $"{rolls.Length} dice rolled: {string.Join(", ", rolls)} for a total of {rolls.Sum() + modifier}"
            };

            if (modifier != 0)
            {
                output += $" ({modifier:+#;-#} modifier)";
            }

            LogHistory.Add(new Log(output));
        }
Esempio n. 7
0
 public void LogObsessionNameChanged(string name, string oldValue, string newValue)
 {
     LogHistory.Add(new Log($"{name}'s Obsession, {oldValue}, has been renamed to {newValue}"));
 }
Esempio n. 8
0
 public void LogNameChanged(string oldName, string newName)
 {
     LogHistory.Add(new Log($"{oldName} has been renamed to {newName}"));
 }
Esempio n. 9
0
 public void LogClearInventory()
 {
     LogHistory.Add(new Log("All items have been removed from the inventory"));
 }
Esempio n. 10
0
 public void LogItemDescriptionChanged(string name)
 {
     LogHistory.Add(new Log($"Item {name}'s description has been changed"));
 }
Esempio n. 11
0
 public void LogAddVoice(VoiceModel voice)
 {
     LogHistory.Add(new Log($"{voice.Name} has been added to the game"));
 }
Esempio n. 12
0
 public void LogAddItem(ItemModel item)
 {
     LogHistory.Add(new Log($"{item.Name} has been added to the inventory"));
 }
Esempio n. 13
0
 public OutputLogger()
 {
     LogHistory.Add(new Log("This application is ready..."));
     LogHistory.Add(new Log("This log will track all actions you take..."));
 }
Esempio n. 14
0
 public void LogDataSave(string fileName, bool errorFlag)
 {
     LogHistory.Add(new Log(errorFlag
         ? "There was an error saving the file. File was not saved..."
         : $"File {fileName} has been successfully saved"));
 }
Esempio n. 15
0
 public void LogDataLoad(bool errorFlag)
 {
     LogHistory.Add(new Log(errorFlag
         ? "File has been loaded. There were issues loading some data"
         : "File has been successfully loaded"));
 }
Esempio n. 16
0
 public void LogObsessionLevelChanged(string name, int oldValue, int newValue)
 {
     LogHistory.Add(
         new Log($"{name}'s Obsession has been changed from Lv. {oldValue} to Lv. {newValue}"));
 }
Esempio n. 17
0
 public void LogSkillNameChanged(string name, string oldName, string playerName)
 {
     LogHistory.Add(new Log($"{name}'s Skill \"{oldName}\" has been changed to \"{name}\""));
 }
Esempio n. 18
0
 public void LogRemoveVoice(VoiceModel voice)
 {
     LogHistory.Add(new Log($"{voice.Name} has been removed from the game"));
 }
Esempio n. 19
0
 public void AddHistory(string text, Color color = default(Color))
 {
     index = LogHistory.Count;
     LogHistory.Add(text);
 }
Esempio n. 20
0
 public void LogClearedVoiceCollection()
 {
     LogHistory.Add(new Log("All voices have been removed from the game"));
 }
Esempio n. 21
0
 public void LogRemoveInventoryItem(ItemModel item)
 {
     LogHistory.Add(new Log($"{item.Name} has been removed to the inventory"));
 }
Esempio n. 22
0
 public void LogItemCountChanged(string name, int oldCount, int newCount)
 {
     LogHistory.Add(new Log($"Item {name}'s count has been changed from {oldCount} to {newCount}"));
 }