Esempio n. 1
0
        //检查数据库上传完成
        private static void waitUploadDB()
        {
            tar = new Image <Bgr, byte>(Properties.Resources.m7_3);
            System.Windows.Forms.Timer timerWaitUploadDB = new System.Windows.Forms.Timer();
            timerWaitUploadDB.Interval = 1;
            timerWaitUploadDB.Enabled  = true;
            timerWaitUploadDB.Start();
            timerWaitUploadDB.Tick += (sen, eve) =>
            {
                double result = Mission.Instance.MatchTemplate(tar);
                if (result > 0.98)
                {
                    ((System.Windows.Forms.Timer)sen).Stop();
                    ((System.Windows.Forms.Timer)sen).Dispose();
                    //数据库上传完成
                    Keybd.keybd_event(Keys.Enter, 0, 0, 0);
                    Keybd.keybd_event(Keys.Enter, 0, 2, 0);
                    Thread.Sleep(200);

                    //停止运行unity
                    Keybd.keybd_event(Keys.ControlKey, 0, 0, 0);
                    Keybd.keybd_event(Keys.P, 0, 0, 0);
                    Keybd.keybd_event(Keys.P, 0, 2, 0);
                    Keybd.keybd_event(Keys.ControlKey, 0, 2, 0);
                    Mission.Instance.mainform.showLog("db已上传...");
                    Mission.Instance.missionOK();
                }
            };
        }
Esempio n. 2
0
 //等待文件上传完成
 private static void waitUploadFile()
 {
     tar = new Image <Bgr, byte>(Properties.Resources.m7_2);
     System.Windows.Forms.Timer timerWaitUploadFile = new System.Windows.Forms.Timer();
     timerWaitUploadFile.Interval = 1;
     timerWaitUploadFile.Enabled  = true;
     timerWaitUploadFile.Start();
     timerWaitUploadFile.Tick += (sen, eve) =>
     {
         double result = Mission.Instance.MatchTemplate(tar);
         if (result > 0.98)
         {
             ((System.Windows.Forms.Timer)sen).Stop();
             ((System.Windows.Forms.Timer)sen).Dispose();
             //文件上传完成
             Keybd.keybd_event(Keys.Enter, 0, 0, 0);
             Keybd.keybd_event(Keys.Enter, 0, 2, 0);
             Thread.Sleep(200);
             //点击上传数据库按钮
             MouseControl.Click(new Point(735, 1097));
             Mission.Instance.mainform.showLog("文件已上传...");
             waitUploadDB();
         }
     };
 }
Esempio n. 3
0
 //拖拽至Hierarchy面板后调用
 static void onDragedToHierarchy()
 {
     //为预制体改名字
     Thread.Sleep(1000);
     Keybd.keybd_event(Keys.F2, 0, 0, 0);
     Keybd.keybd_event(Keys.F2, 0, 2, 0);
     Thread.Sleep(200);
     Keybd.keybd_event(Keys.M, 0, 0, 0);
     Keybd.keybd_event(Keys.M, 0, 2, 0);
     Thread.Sleep(200);
     Keybd.keybd_event(Keys.O, 0, 0, 0);
     Keybd.keybd_event(Keys.O, 0, 2, 0);
     Thread.Sleep(200);
     Keybd.keybd_event(Keys.D, 0, 0, 0);
     Keybd.keybd_event(Keys.D, 0, 2, 0);
     Thread.Sleep(200);
     Keybd.keybd_event(Keys.E, 0, 0, 0);
     Keybd.keybd_event(Keys.E, 0, 2, 0);
     Thread.Sleep(200);
     Keybd.keybd_event(Keys.L, 0, 0, 0);
     Keybd.keybd_event(Keys.L, 0, 2, 0);
     Thread.Sleep(200);
     Keybd.keybd_event(Keys.Enter, 0, 0, 0);
     Keybd.keybd_event(Keys.Enter, 0, 2, 0);
     dragToBundleFolder();
 }
Esempio n. 4
0
        //任务6 运行DDBuild
        public static void mission()
        {
            //运行unity
            Keybd.keybd_event(Keys.ControlKey, 0, 0, 0);
            Keybd.keybd_event(Keys.P, 0, 0, 0);
            Keybd.keybd_event(Keys.P, 0, 2, 0);
            Keybd.keybd_event(Keys.ControlKey, 0, 2, 0);

            //检查unity是否已启动
            waitUnityRun();
        }
Esempio n. 5
0
        //任务5 打包
        public static void mission()
        {
            to6 = false;
            //按下alt+b
            Thread.Sleep(500);
            Keybd.keybd_event(Keys.Menu, 0, 0, 0);
            Keybd.keybd_event(Keys.B, 0, 0, 0);

            Keybd.keybd_event(Keys.B, 0, 2, 0);
            Keybd.keybd_event(Keys.Menu, 0, 2, 0);

            //检查打包是否完成
            timeCount = 0;
            tar       = new Image <Bgr, byte>(Properties.Resources.m6);
            System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
            timer.Interval = 500;
            timer.Enabled  = true;
            timer.Start();
            timer.Tick += (sen, eve) =>
            {
                double result = Mission.Instance.MatchTemplate(tar);

                if (result > 0.98)
                {
                    //timer.Stop();
                    //timer.Dispose();
                    ((System.Windows.Forms.Timer)sen).Stop();
                    ((System.Windows.Forms.Timer)sen).Dispose();

                    if (to6 == false)
                    {
                        //点击确定按钮
                        Keybd.keybd_event(Keys.Enter, 0, 0, 0);
                        Keybd.keybd_event(Keys.Enter, 0, 2, 0);
                        Mission.Instance.mainform.showLog("打包完成...");
                        Mission6.mission();
                        to6 = true;
                    }
                    else
                    {
                        Mission.Instance.mainform.showLog("这不该发生,已经去6了,还要去干吗?");
                    }
                }
                timeCount++;
                if (timeCount > 60)//超过30秒
                {
                    Mission.Instance.onFaild("m6:打包超时!");
                    return;
                }
            };
        }
Esempio n. 6
0
 //当运行失败后调用
 public void onFaild(string content)
 {
     //排除unity的弹出框
     MouseControl.Click(AppConst.focuspos2);
     Keybd.keybd_event(Keys.Enter, 0, 0, 0);
     Keybd.keybd_event(Keys.Enter, 0, 2, 0);
     Keybd.keybd_event(Keys.Enter, 0, 0, 0);
     Keybd.keybd_event(Keys.Enter, 0, 2, 0);
     //输出日志
     mainform.showLog("出错!3秒后重启:" + buildModel.Filename + "    " + buildModel.Name + "   " + content);
     //写入log文件
     TxtLog.Log("出错任务:" + buildModel.Filename + "    " + buildModel.Name + "   " + content);
     //重新轮询任务
     Thread.Sleep(3000);
     ask();
 }
Esempio n. 7
0
        //任务4 截图
        public static void mission()
        {
            //进行截图
            Thread.Sleep(500);
            Image <Bgr, byte> game;

            game = GameCapture.Instance.game;
            Image <Bgr, byte> preImg = game.Copy(new Rectangle(new Point(900, 168), new Size(600, 600)));
            //保存截图
            string code = Mission.Instance.buildModel.Filename.Substring(0, Mission.Instance.buildModel.Filename.IndexOf('.'));
            string path = AppConst.ddBuildResourcesPath + code + @"_FA1pre.bundle\pre.jpg";

            preImg.ToBitmap().Save(path);
            //删掉hierarchy面板中的model
            MouseControl.Click(new Point(Mission.Instance.MatchTemplatePosition.X + 5, Mission.Instance.MatchTemplatePosition.Y + 5));
            Keybd.keybd_event(Keys.Delete, 0, 0, 0);
            Keybd.keybd_event(Keys.Delete, 0, 2, 0);
            Thread.Sleep(200);
            //切换焦点
            MouseControl.Click(AppConst.focuspos1);
            Thread.Sleep(1000);
            MouseControl.Click(AppConst.focuspos2);
            Thread.Sleep(3000);
            //点击_pre.bundle文件夹
            MouseControl.Click(new Point(Mission.Instance.ProjectPosition.X, Mission.Instance.ProjectPosition.Y + 202));
            Thread.Sleep(500);
            //点击pre图片,随后进行设置
            tar = new Image <Bgr, byte>(DDBuildHelper.Properties.Resources.m5);//找到预览图位置
            double result = Mission.Instance.MatchTemplate(tar);

            if (result > 0.98)
            {
                Debug.Print("目标检测的结果: " + result);
                MouseControl.Click(new Point(Mission.Instance.MatchTemplatePosition.X, Mission.Instance.MatchTemplatePosition.Y + 20));
                //进行图片设置
                setting();
            }
            else
            {
                Debug.Print("目标检测的结果: " + result);
                //   MessageBox.Show("m5:未找到pre图片" + result);
                Mission.Instance.onFaild("m5:未找到pre图片" + result);
                return;
            }
        }