Exemplo n.º 1
0
        /* Constructor */
        public ScriptHost(Form hostForm, ScriptBase script)
        {
            HostForm    = hostForm;
            Script      = script;
            Script.Host = this;

            MacroPlayer           = new MacroPlayer();
            MacroPlayer.LapEnter += (sender) =>
            {
                Script.OnMacroLapEnter(sender);
            };

            var scriptForm = Script.ScriptForm;

            if (scriptForm != null)
            {
                // Intercept form closing
                scriptForm.FormClosing += (_sender, _e) =>
                {
                    if (_e.CloseReason == CloseReason.UserClosing)
                    {
                        _e.Cancel = true;
                        scriptForm.Hide();
                    }
                };
            }
        }
Exemplo n.º 2
0
        public void Pause()
        {
            IsPaused = true;

            if (MacroPlayer.IsPlaying)
            {
                MacroPlayer.Pause();
            }
        }
Exemplo n.º 3
0
        public void PlayMacro(string path, int suspendDelay = 0)
        {
            MacroPlayer.LoadFile(path);
            MacroPlayer.Play();

            if (suspendDelay > 0)
            {
                Suspend(suspendDelay);
            }
        }
Exemplo n.º 4
0
        public void PlayMacro(List <DualShockState> sequence, int suspendDelay = 0)
        {
            MacroPlayer.Sequence = ScriptHostUtility.ConvertAPIToInterceptorSequence(sequence);
            MacroPlayer.Play();

            if (suspendDelay > 0)
            {
                Suspend(suspendDelay);
            }
        }
Exemplo n.º 5
0
        public void Play()
        {
            Start();

            if (MacroPlayer.IsPaused)
            {
                MacroPlayer.Play();
            }

            IsPaused = false;
        }
Exemplo n.º 6
0
        public void Stop()
        {
            if (Worker != null)
            {
                Worker.CancelAsync();
            }

            MacroPlayer.Stop();
            SuspendCounter = 0;
            IsRunning      = false;
            IsPaused       = false;
        }
Exemplo n.º 7
0
        public void Pause()
        {
            IsPaused = true;

            // Clear methods
            Script.ClearButtons();

            if (MacroPlayer.IsPlaying)
            {
                MacroPlayer.Pause();
            }

            // For cleanup
            Script.OnPaused();
        }
Exemplo n.º 8
0
        public void OnReceiveData(ref PS4RemotePlayInterceptor.DualShockState state)
        {
            if (MacroPlayer.IsPlaying)
            {
                MacroPlayer.OnReceiveData(ref state);
            }
            else if (Script.CurrentState != null)
            {
                state = ScriptHostUtility.ConvertAPIToInterceptorState(Script.CurrentState);
                state.ReportTimeStamp = DateTime.Now;

                // Replace battery status
                state.Battery    = 100;
                state.IsCharging = true;
            }
        }
Exemplo n.º 9
0
        public void Stop()
        {
            if (Worker != null)
            {
                Worker.CancelAsync();
            }

            // Clear methods
            Script.ClearButtons();
            MacroPlayer.Stop();

            // Clear states
            SuspendCounter = 0;
            IsRunning      = false;
            IsPaused       = false;

            // For cleanup
            Script.OnStopped();
        }
Exemplo n.º 10
0
 /* Constructor */
 public SaveLoadHelper(MainForm mainForm, MacroPlayer macroPlayer)
 {
     m_MainForm    = mainForm;
     m_MacroPlayer = macroPlayer;
 }
Exemplo n.º 11
0
 public void StopMacro()
 {
     MacroPlayer.Stop();
 }