} //Returns the list of Decisions void SolveConditional() { if (CurrentType != Type.T_Conditional) { return; } int PropositionValue = 0; string Proposition = Dialogue.Dialogue.DialogueList[CurrentIndex].Message; PropositionValue = EvaluateProposition(Proposition); ConditionalBox CBox = Dialogue.Dialogue.DialogueList[CurrentIndex] as ConditionalBox; if (PropositionValue == 1) { CurrentAddress = CBox.YArrowAddress; } else if (PropositionValue == 0) { CurrentAddress = CBox.NArrowAddress; } else { CurrentAddress = CBox.ArrowAddress; } CurrentIndex = Dialogue.Dialogue.DialogueList.FindIndex(x => x.Address == CurrentAddress); Print(); }
void Print() { switch (Dialogue.Dialogue.DialogueList[CurrentIndex].DialogueType) { case Type.T_Base: Message = ""; DecisionList = new List <string>(); CurrentType = Type.T_Base; break; case Type.T_Message: MessageBox mBox = Dialogue.Dialogue.DialogueList[CurrentIndex] as MessageBox; DecisionList = new List <string>(); Message = Translate(mBox.Message); CurrentType = mBox.DialogueType; break; case Type.T_DecisionBox: DecisionBox dBox = Dialogue.Dialogue.DialogueList[CurrentIndex] as DecisionBox; DecisionList = new List <string>(); foreach (Decision d in dBox.DecisionSet) { DecisionList.Add(Translate(d.Message)); } Message = Translate(dBox.Message); CurrentType = dBox.DialogueType; break; case Type.T_Conditional: ConditionalBox cBox = Dialogue.Dialogue.DialogueList[CurrentIndex] as ConditionalBox; DecisionList = new List <string>(); Message = ""; CurrentType = cBox.DialogueType; break; case Type.T_End: Message = ""; DecisionList = new List <string>(); CurrentType = Type.T_End; break; } }