Exemple #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();
                    }
                };
            }
        }
Exemple #2
0
        public void Pause()
        {
            IsPaused = true;

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

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

            if (suspendDelay > 0)
            {
                Suspend(suspendDelay);
            }
        }
Exemple #5
0
        public void Play()
        {
            Start();

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

            IsPaused = false;
        }
Exemple #6
0
        public void Stop()
        {
            if (Worker != null)
            {
                Worker.CancelAsync();
            }

            MacroPlayer.Stop();
            SuspendCounter = 0;
            IsRunning      = false;
            IsPaused       = false;
        }
Exemple #7
0
        public void Pause()
        {
            IsPaused = true;

            // Clear methods
            Script.ClearButtons();

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

            // For cleanup
            Script.OnPaused();
        }
Exemple #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;
            }
        }
Exemple #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();
        }
Exemple #10
0
 /* Constructor */
 public SaveLoadHelper(MainForm mainForm, MacroPlayer macroPlayer)
 {
     m_MainForm    = mainForm;
     m_MacroPlayer = macroPlayer;
 }
Exemple #11
0
 public void StopMacro()
 {
     MacroPlayer.Stop();
 }