private void DoLogicList(Game game, Save save) { LogicList list = (LogicList)save.CurrentLogic; if (list.Nodes.Count > 0) { save.CurrentLogic = list.Nodes [0]; } else { save.CurrentLogic = save.CurrentLogic.GetNextLogic(); } this.Overlord.Step(game, save); }
private void DoLogicCondition(Game game, Save save) { LogicCondition condition = (LogicCondition)save.CurrentLogic; //evaluate the condition bool result = bool.Parse(condition.Condition.Evaluate(game, save)); //get the new list depending on result LogicList newList = result ? condition.TrueLogicList : condition.FalseLogicList; //set the prev and next logic to be the same as the condition's newList.Prev = condition.Prev; newList.Next = condition.GetNextLogic(); save.CurrentLogic = newList; this.Overlord.Step(game, save); }
public void Delete() { if (SelectedItem == null) { return; } var diagle = windowManager.ShowMessageBox(String.Format("确定要删除【{0}】", SelectedItem.Name), "系统提示", MessageBoxButton.YesNo); if (diagle == MessageBoxResult.Yes) { var res = this.logicService.DeleteT_LogicTest(SelectedItem.ID); if (res) { LogicList.Remove(SelectedItem); } this.View.ShowHint(new MessageWin(res)); } }
public void SelectOption(Game game, Save save, int index) { if (this.state != State.OptionList) { throw new Exception(string.Format("Bad operation. Engine is in {0} state.", this.state)); } LogicList list = (LogicList)save.CurrentLogic; if (index < 0 || index > list.Nodes.Count - 1) { throw new Exception("Option index out of bounds."); } this.state = State.Action; this.Overlord.EnableStep(); save.CurrentLogic = ((LogicList)(list.Nodes [index])).Nodes [0]; this.Overlord.Step(game, save); }
public LogicCondition(XmlNode node, CreateLogicVessel vessel, Dictionary <string, ExpressionConstructorInfo> expressionConstructorInfos) : base(node) { this.Condition = new Expression(node.ChildNodes [0], expressionConstructorInfos); this.TrueLogicList = (LogicList)vessel.CreateLogic(node.ChildNodes [1].ChildNodes [0]); this.FalseLogicList = (LogicList)vessel.CreateLogic(node.ChildNodes [2].ChildNodes [0]); }
private void Vm_SaveEvent(T_LogicTest t_LogicTest) { LogicList.Add(t_LogicTest); }