コード例 #1
0
ファイル: Dialog.cs プロジェクト: cabarius/ToyBox
            public static bool Prefix(CueSelection __instance, ref BlueprintCueBase __result)
            {
                if (!settings.toggleRandomizeCueSelections)
                {
                    return(true);
                }
                List <BlueprintCueBase> blueprintCueBaseList = null;

                foreach (BlueprintCueBase blueprintCueBase in __instance.Cues.Dereference())
                {
                    if (blueprintCueBase != null && blueprintCueBase.CanShow())
                    {
                        if (blueprintCueBaseList == null)
                        {
                            blueprintCueBaseList = new();
                        }
                        blueprintCueBaseList.Add(blueprintCueBase);
                    }
                }
                if (blueprintCueBaseList == null)
                {
                    __result = null;
                    return(false);
                }
                int index = UnityEngine.Random.Range(0, blueprintCueBaseList.Count);

                Mod.Debug($"CueSelection_Select_Patch - index: {index}");
                __result = blueprintCueBaseList[index];
                return(false);
            }
コード例 #2
0
        public static BlueprintDialog CreateBookEvent(string name, CueSelection FirstCue, Condition[] conditions = null, GameAction[] startaction = null, GameAction[] finishaction = null,
                                                      GameAction[] replaceaction = null, params BlueprintComponent[] components)
        {
            BlueprintDialog o = Helpers.Create <BlueprintDialog>();

            o.FirstCue         = FirstCue;
            o.Type             = DialogType.Book;
            o.TurnFirstSpeaker = true;
            o.TurnPlayer       = true;
            o.name             = "BookEventCustom" + name;

            o.Conditions            = new ConditionsChecker();
            o.Conditions.Conditions = conditions == null?Array.Empty <Condition>() : conditions;

            o.StartActions         = new ActionList();
            o.StartActions.Actions = startaction == null?Array.Empty <GameAction>() : startaction;

            o.FinishActions         = new ActionList();
            o.FinishActions.Actions = finishaction == null?Array.Empty <GameAction>() : finishaction;

            o.ReplaceActions         = new ActionList();
            o.ReplaceActions.Actions = replaceaction == null?Array.Empty <GameAction>() : replaceaction;

            o.SetComponents(components);
            library.AddAsset(o, Guid(o.name));

            return(o);
        }