예제 #1
0
 static void Postfix(DialogCurrentPart __instance)
 {
     try {
         if (!Main.Enabled)
         {
             return;
         }
         if (!Main.settings.previewDialogResults)
         {
             return;
         }
         var cue       = Game.Instance.DialogController.CurrentCue;
         var actions   = cue.OnShow.Actions.Concat(cue.OnStop.Actions).ToArray();
         var alignment = cue.AlignmentShift;
         var text      = "";
         if (actions.Length > 0)
         {
             var result = PreviewUtilities.FormatActions(actions);
             if (result == "")
             {
                 result = "EmptyAction";
             }
             text += $" \n<size=75%>[{result}]</size>";
         }
         if (alignment != null && alignment.Value > 0)
         {
             text += $" \n<size=75%>[AlignmentShift {alignment.Direction} by {alignment.Value} - {alignment.Description}]";
         }
         __instance.DialogPhrase.text += text;
     }
     catch (Exception ex) {
         Logger.Error(ex);
     }
 }
예제 #2
0
 static void Postfix(ref string __result, BlueprintAnswer answer, string bind, int index)
 {
     try {
         if (!Main.Enabled)
         {
             return;
         }
         if (Main.settings.previewAlignmentRestrictedDialog && !answer.IsAlignmentRequirementSatisfied)
         {
             __result = GetFixedAnswerString(answer, bind, index);
         }
         if (!Main.settings.previewDialogResults)
         {
             return;
         }
         var answerData = CollateAnswerData(answer, out bool isRecursive);
         if (isRecursive)
         {
             __result += $" <size=75%>[Repeats]</size>";
         }
         var results = new List <string>();
         foreach (var data in answerData)
         {
             var cue       = data.Item1;
             var depth     = data.Item2;
             var actions   = data.Item3;
             var alignment = data.Item4;
             var line      = new List <string>();
             if (actions.Length > 0)
             {
                 line.AddRange(actions.
                               SelectMany(action => PreviewUtilities.FormatActionAsList(action)
                                          .Select(actionText => actionText == "" ? "EmptyAction" : actionText)));
             }
             if (alignment != null && alignment.Value > 0)
             {
                 line.Add($"AlignmentShift({alignment.Direction}, {alignment.Value}, {alignment.Description})");
             }
             if (cue is BlueprintCheck check)
             {
                 line.Add($"Check({check.Type}, DC {check.DC}, hidden {check.Hidden})");
             }
             if (line.Count > 0)
             {
                 results.Add($"{depth}: {line.Join()}");
             }
         }
         if (results.Count > 0)
         {
             __result += $" \n<size=75%>[{results.Join()}]</size>";
         }
     }
     catch (Exception ex) {
         Logger.Error(ex);
     }
 }