コード例 #1
0
        private void AddDialogLine(CampaignGameStarter starter, DialogueData d, string in_token)
        {
            if (d.InjectedToTaleworlds)
            {
                return;
            }

            d.InjectedToTaleworlds = true;

            ConversationSentence.OnConditionDelegate cond = null;

            if (d.Condition != null)
            {
                cond = delegate
                {
                    return(EvalulateDialogueCondition(d.Condition));
                };
            }

            ConversationSentence.OnConsequenceDelegate conseq = null;

            if (d.Consequence != null)
            {
                conseq = delegate
                {
                    ExecuteDialogueConsequence(d.Consequence);
                };
            }

            if (d.IsPlayerDialogue)
            {
                starter.AddPlayerLine(d.Dialogue_ID,
                                      in_token,
                                      d.Children.Count == 0? "close_window" : d.Dialogue_ID,
                                      d.DialogueText,
                                      cond,
                                      conseq,
                                      int.MaxValue
                                      );
            }
            else
            {
                starter.AddDialogLine(d.Dialogue_ID,
                                      in_token,
                                      d.Children.Count == 0 ? "close_window" : d.Dialogue_ID,
                                      d.DialogueText,
                                      cond,
                                      conseq,
                                      int.MaxValue
                                      );
            }

            foreach (DialogueData child in d.Children)
            {
                AddDialogLine(starter, child, d.Dialogue_ID);
            }
        }
コード例 #2
0
ファイル: DialogBuilder.cs プロジェクト: sirdoombox/BannerLib
            public IPlayerDialogToken AddPlayerLine(string tokenName,
                                                    ConversationSentence.OnConditionDelegate condition = null)
            {
                var result = new PlayerDialogToken(Builder, this, tokenName);

                if (condition != null)
                {
                    result.SetCondition(condition);
                }
                return(result);
            }
コード例 #3
0
ファイル: DialogBuilder.cs プロジェクト: sirdoombox/BannerLib
 public IPlayerDialogToken SetCondition(ConversationSentence.OnConditionDelegate condition)
 {
     Condition = condition;
     return(this);
 }