예제 #1
0
        private void WriteDynamicLine(ref string line, Dynamic dyn)
        {
            if (dyn is Demand)
                line += " D ";
            else
                line += " R ";

            if (dyn.FuncCall != null)
            {
                line += String.Format("{0} {1} {2}", "_script", dyn.FuncCall.ScriptString,
                                      dyn.FuncCall.Args == null ? 0 : dyn.FuncCall.Args.Count);
                if (dyn.FuncCall.Args != null && dyn.FuncCall.Args.Count > 0)
                    line += " " + String.Join(" ", dyn.FuncCall.Args.ToArray());
            }
            else if (dyn.Item != null)
            {
                line += String.Format("{0} {1} {2} {3} {4}", "_item", dyn.ForPlayer ? "p" : "n", dyn.Item.PidDefine,
                                      Dialog.Dialog.SetOperator(dyn.Operator), dyn.Value);
            }
            else if (dyn.Param != null)
            {
                line += String.Format("{0} {1} {2} {3} {4}", "_param", dyn.ForPlayer ? "p" : "n",
                                      dyn.Param.ParamDefine, Dialog.Dialog.SetOperator(dyn.Operator), dyn.Value);
            }
            else if (dyn.Var != null)
            {
                line += String.Format("{0} {1} {2} {3} {4}", "_var", dyn.ForPlayer ? "p" : "n", dyn.Var.Name,
                                      Dialog.Dialog.SetOperator(dyn.Operator), dyn.Value);
            }
        }
예제 #2
0
 private void AddDynamic(Answer answer, Dynamic dynamic, bool recheck)
 {
     if (dynamic is Demand)
     {
         var demand = (Demand)dynamic;
         demand.NoRecheck = recheck;
         answer.Demands.Add(demand);
     }
     if (dynamic is Result)
     {
         var result = (Result)dynamic;
         answer.Results.Add(result);
     }
 }