private void FindGame_Click(object sender, RoutedEventArgs e)
 {
     PVZ.CloseGame();
     if (PVZ.RunGame())
     {
         (Tag as Window).Title = "已找到游戏";
     }
     else
     {
         (Tag as Window).Title = "未找到游戏";
     }
 }
Exemple #2
0
        static void Main(string[] args)
        {
            Clazz        target = pvz;
            bool         isfile = false;
            StreamReader sr     = null;

            if (args.Length >= 1 && args[0].ToUpper().EndsWith(".PVZS"))
            {
                isfile = true;
                sr     = new StreamReader(args[0], Encoding.Default);
                if (args.Length >= 2)
                {
                    PVZ.GameName = args[1];
                }
                if (args.Length >= 3)
                {
                    PVZ.GameTitle = args[2];
                }
            }
            if (PVZ.RunGame())
            {
                Console.WriteLine("PVZScript [版本 2.0.0.5]");
                Console.WriteLine("With PVZClass By 冥谷川恋(Meiyagawa Koishi) [版本 1.0.4.9]");
                Console.WriteLine("StartScript");
                while (true)
                {
                    Interpreter script;
                    if (isfile)
                    {
                        script = new Interpreter(sr.ReadLine());
                    }
                    else
                    {
                        Console.Write(target.Instance.Name + ">>");
                        script = new Interpreter(Console.ReadLine());
                    }
                    var lf = script.IsFor(target);
                    if (lf.Valid)
                    {
                        while (true)
                        {
                            var temp = new Clazz(lf.objs);
                            if (isfile)
                            {
                                script = new Interpreter(sr.ReadLine());
                            }
                            else
                            {
                                Console.Write(temp.Instance.Name + ">>");
                                script = new Interpreter(Console.ReadLine());
                            }
                            if (script.Dealing == "EndFor")
                            {
                                target = pvz;
                                break;
                            }
                            foreach (var item in lf.objs)
                            {
                                target = new Clazz(item);
                                if (!Mainloop(script, ref target, isfile))
                                {
                                    break;
                                }
                            }
                        }
                    }
                    else if (!Mainloop(script, ref target, isfile))
                    {
                        break;
                    }
                }
                PVZ.CloseGame();
            }
        }