public void Setup() { context = new GameContext { hostCard = new Card() { health = 10 } }; parser = new OJParser(typeof(CardCommondDefiner)); }
public void Setup() { context = new GameContext(); context.hostCard = new Card() { health = 10 }; Dictionary <string, string> remaps = new Dictionary <string, string>(); remaps.Add("iftrue", "ifelse:true,$1,$2"); parser = new OJParser(typeof(CardCommondDefiner), remaps); }
public static void TestMethod2() { //string code = @"if: true, {IncreaseHealth:;Log:'in ',health; iftrue}"; string code = "if:true or false, log:'in'"; Dictionary <string, string> remaps = new Dictionary <string, string>(); remaps.Add("iftrue", "if:{Equals:health,10},$1"); var parser = new OJParser(typeof(CardCommondDefiner), remaps); IOJMethod method = parser.Parse(code, Filename); GameContext context = new GameContext(); context.hostCard = new Card() { health = 10 }; DateTime time = DateTime.Now; for (int i = 0; i < 1; i++) { method.Invoke(context); } Console.WriteLine($"{DateTime.Now - time}"); }