예제 #1
0
            private static bool Prefix(DialogAnswerView __instance, BlueprintAnswer answer)
            {
                if (!settings.previewDialogResults && !settings.toggleShowAnswersForEachConditionalResponse && !settings.toggleMakePreviousAnswersMoreClear)
                {
                    return(true);
                }
                var type    = Game.Instance.DialogController.Dialog.Type;
                var str     = string.Format("DialogChoice{0}", (object)__instance.ViewModel.Index);
                var text    = UIConsts.GetAnswerString(answer, str, __instance.ViewModel.Index);
                var isAvail = answer.CanSelect();

                if (answer.NextCue.Cues.Count == 1)
                {
                    var cue           = answer.NextCue.Cues.Dereference <BlueprintCueBase>().FirstOrDefault();
                    var conditionText = $"{string.Join(", ", cue.Conditions.Conditions.Select(c => c.GetCaption()))}";
                    // the following is a kludge for toggleShowAnswersForEachConditionalResponse  to work around cases where there may be a next cue that doesn't get shown due it being already seen and the dialog being intended to fall through.  We assume that any singleton conditional nextCue (CueSelection) was generated by this feature.  We should look for edge cases to be sure.
                    isAvail = cue.CanShow() || !settings.toggleShowAnswersForEachConditionalResponse || conditionText.Length == 0;
                    var color = isAvail ? "#005800><b>" : "#800000>";
                    if (conditionText.Length > 0)
                    {
                        text += $"<size=75%><color={color}[{conditionText.MergeSpaces(true)}]</color></size>";
                    }
                }
                __instance.AnswerText.text        = text;
                __instance.ViewModel.Enable.Value = isAvail;
                var color32 = isAvail ? DialogAnswerView.Colors.NormalAnswer : DialogAnswerView.Colors.DisabledAnswer;

                if (type == DialogType.Common && answer.IsAlreadySelected() && (Game.Instance.DialogController.NextCueWasShown(answer) || !Game.Instance.DialogController.NextCueHasNewAnswers(answer)))
                {
                    color32 = DialogAnswerView.Colors.SelectedAnswer;
                    __instance.AnswerText.alpha = 0.45f;
                    if (settings.toggleMakePreviousAnswersMoreClear)
                    {
                        __instance.AnswerText.text = text.SizePercent(83);
                    }
                }
                else
                {
                    __instance.AnswerText.alpha = 1.0f;
                }
                __instance.AnswerText.color = (Color)color32;
                __instance.AddDisposable(Game.Instance.Keyboard.Bind(str, new Action(__instance.Confirm)));
                if (__instance.ViewModel.Index != 1 || type != DialogType.Interchapter && type != DialogType.Epilogue)
                {
                    return(false);
                }
                __instance.AddDisposable(Game.Instance.Keyboard.Bind("NextOrEnd", new Action(__instance.Confirm)));
                return(false);
            }
예제 #2
0
            private void SetAnswer(BlueprintAnswer answer)
            {
                DialogType type = Game.Instance.DialogController.Dialog.Type;
                string     str  = string.Format("DialogChoice{0}", (object)this.ViewModel.Index);

                this.AnswerText.text = UIConsts.GetAnswerString(answer, str, this.ViewModel.Index);
                Color32 color32 = answer.CanSelect() ? DialogAnswerView.Colors.NormalAnswer : DialogAnswerView.Colors.DisabledAnswer;

                if (type == DialogType.Common && answer.IsAlreadySelected() && (Game.Instance.DialogController.NextCueWasShown(answer) || !Game.Instance.DialogController.NextCueHasNewAnswers(answer)))
                {
                    color32 = DialogAnswerView.Colors.SelectedAnswer;
                }

                this.AnswerText.color = (Color)color32;
                this.AddDisposable(Game.Instance.Keyboard.Bind(str, new Action(this.Confirm)));
                if (this.ViewModel.Index != 1 || type != DialogType.Interchapter && type != DialogType.Epilogue)
                {
                    return;
                }
                this.AddDisposable(Game.Instance.Keyboard.Bind("NextOrEnd", new Action(this.Confirm)));
            }