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

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

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

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

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

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

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

            // Clear methods
            Script.ClearButtons();

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

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