Exemplo n.º 1
0
 public void Play(IntPtr emuHandle, BulletHellFishForm form, bool main, List <double> dataSource)
 {
     leftHandThread = CreateThread(emuHandle, Hand.Left, main, InputBoard, form, dataSource);
     leftHandThread.Start();
     if (InputBoard.TwoHandMode)
     {
         rightHandThread = CreateThread(emuHandle, Hand.Right, false, InputBoard, form, dataSource);
         rightHandThread.Start();
     }
 }
Exemplo n.º 2
0
 public PlayerFormControls(BulletHellFishForm Form, Control ParentControl, OpenFileDialog OpenFileDialog)
 {
     FillFromParent(ParentControl);
     this.OpenFileDialog = OpenFileDialog;
     this.Form           = Form;
 }
Exemplo n.º 3
0
        public Thread CreateThread(IntPtr emuHandle, Hand hand, bool main, InputBoard inputBoard, BulletHellFishForm form, List <double> dataSource)
        {
            return(new Thread(() =>
            {
                Thread.CurrentThread.IsBackground = true;

                InputParameters param = form.GetInputParameters(hand);

                bool noDataSource = dataSource == null || dataSource.Count() == 0;

                int minHoldTime = param.MinHoldTime;
                int maxHoldTime = noDataSource ? minHoldTime : param.MaxHoldTime;

                int i = 0;
                while (true)
                {
                    if (Utils.GetWindowCaption(emuHandle).Equals(Utils.GetWindowCaption(GetForegroundWindow())))
                    {
                        if (main)
                        {
                            inputBoard.ExecAdditionalBehaviors();
                        }

                        string[] nextCombo;

                        if (noDataSource)
                        {
                            nextCombo = inputBoard.NextCombo(hand);
                        }
                        else
                        {
                            nextCombo = inputBoard.NextComboFromNormalizedData(hand, dataSource[i]);
                        }

                        if (!Behavior.IsLocked())
                        {
                            inputBoard.PressCombo(nextCombo, minHoldTime, maxHoldTime, hand);
                            form.UpdateForm(inputBoard.ComboName(nextCombo), hand, main, playerId, i);
                            i++;
                            if (i >= dataSource.Count())
                            {
                                i = 0;
                            }
                        }
                        else
                        {
                            continue;
                        }


                        Thread.Sleep(param.SleepTime);
                    }
                    else
                    {
                        if (!form.Text.Equals(Utils.GetWindowCaption(GetForegroundWindow())))
                        {
                            SetForegroundWindow(emuHandle);
                        }
                        else
                        {
                            form.Pause();
                        }
                    }
                }
            }));
        }