コード例 #1
0
            protected override void OnAttached(InputRecorder inputRecorder)
            {
                Assert.IsTrue(inputRecorder.FrameDataRecorder is FrameInputData);
                var frameInputData = inputRecorder.FrameDataRecorder as FrameInputData;

                TestRecorder.RegistToFrameInputData();
                frameInputData.AddChildRecorder(CreateInputData());
            }
コード例 #2
0
        private void FinishPlaying(InputRecorder _recorder)
        {
            // swap from playing to recording

            string filePath = GetNewFilePath();

            File.Copy(recorder.GetFilePath(), filePath);
            recorder.RecordAfterPlay(filePath);
        }
コード例 #3
0
        public void Restart(int _seed)
        {
            Stop();
            string version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

            recorder = new InputRecorder(true, true, version, SaveSaveState, LoadSaveState);
            recorder.FinishPlaying += FinishPlaying;
            recorder.Record(GetNewFilePath(), _seed);
            playing = false;
        }
コード例 #4
0
    void Awake()
    {
        if (instance != null)
        {
            Destroy(gameObject);
        }
        instance = this;

        m_Recorder = GetComponent <InputRecorder>();
    }
コード例 #5
0
ファイル: Form1.cs プロジェクト: SatsuiBird/SatsuiInputDemo
        public Form1()
        {
            // Initializing UI
            InitializeComponent();

            // Initializing the recorder
            this.inputRecorder          = new InputRecorder();
            this.inputRecorder.Pressed += InputRecorder_Pressed;
            this.inputRecorder.Start();
        }
コード例 #6
0
        public MainViewModel(InputRecorder recorder)
        {
            // Catching input events
            this.inputRecorder          = recorder;
            this.inputRecorder.Pressed += InputRecorder_Pressed;

            // Populating actions
            this.MyActions = new ObservableCollection <MyAction>();
            this.MyActions.Add(new MyAction("First action"));
            this.MyActions.Add(new MyAction("Second action"));
            this.MyActions.Add(new MyAction("Last action"));
        }
コード例 #7
0
    private void Awake()
    {
        _inputRecorder = GetComponent <InputRecorder>();
        _sampleRate    = 1f / SetSampleRate;

        if (Instance == null)
        {
            Instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

        _desktopPath       = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
        _desktopFolderPath = Path.GetFullPath(Path.Combine(_desktopPath, "WestdriveLoopARData"));
    }
コード例 #8
0
ファイル: Program.cs プロジェクト: SatsuiBird/SatsuiInputDemo
        /// <summary>
        /// Console application entry point
        /// </summary>
        /// <param name="args">Startup arguments</param>
        static void Main(string[] args)
        {
            // Initializing the recorder
            // Only pads inputs are allowed for console applications
            InputRecorder inputRecorder = new InputRecorder(InputType.Pad);

            inputRecorder.Pressed += InputRecorder_Pressed;

            try
            {
                // Starting the recorde
                inputRecorder.Start();

                // Intercepting inputs
                Console.WriteLine("------> Input recorder started");
                Console.WriteLine("[ESC] : Exit");
                Console.WriteLine("------------------------------");

                bool exit = false;
                while (!exit)
                {
                    ConsoleKeyInfo key = Console.ReadKey(true);
                    switch (key.Key)
                    {
                    case ConsoleKey.Escape:
                        exit = true;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                // Errors happens...
                Console.WriteLine("-> " + ex.Message);
                Console.ReadKey();
            }
            finally
            {
                // Stopping the recorder
                inputRecorder.Stop();
            }
        }
コード例 #9
0
        protected override void OnStartup(StartupEventArgs e)
        {
            try
            {
                // Initializing the recorder
                // We are catching keyboard and pad events
                this.inputRecorder = new InputRecorder(InputType.Keyboard | InputType.Pad);
                this.inputRecorder.Start();

                // Showing the main view
                MainView view = new MainView()
                {
                    DataContext = new MainViewModel(this.inputRecorder)
                };
                view.ShowDialog();
            }
            catch (Exception ex)
            {
                // Oopss, an error occured...
                MessageBox.Show(ex.Message, "DemoMVVM", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                Application.Current.Shutdown();
            }
        }
コード例 #10
0
 public void Stop()
 {
     recorder?.Dispose();
     recorder = null;
 }
コード例 #11
0
        private void AttachRecorderImpl(IntPtr window, InputRecorder recorder, CooperativeLevelFlags cooperativeLevelFlags)
        {
            if (this.running) {
                throw new InvalidOperationException("Already attached");
            }

            this.recordedSequenceQueue = new BlockingQueue<IInputSequence>();

            (this.recordingHandlerThread = new Thread(RecordingHandler) {
                Name = "Direct Input Recording Runner",
                IsBackground = true
            }).Start();

            this.recording = true;
            this.recordingHandler = recorder;

            AttachImpl(window, cooperativeLevelFlags);
        }
コード例 #12
0
 public void AttachRecorder(IntPtr window, InputRecorder recorder)
 {
     AttachRecorderImpl(window, recorder, ForegroundFlags);
 }
コード例 #13
0
 public void AttachRecorder(InputRecorder recorder)
 {
     AttachRecorderImpl(IntPtr.Zero, recorder, BackgroundFlags);
 }
コード例 #14
0
 public void SetUp()
 {
     _recorder = new InputRecorder();
 }
コード例 #15
0
ファイル: NebulaClient.cs プロジェクト: brogowski/nebula
 public NebulaClient(AbstractSender <RecordedInput> inputSender, AbstractReciver <IPacket> packetReciver, InputRecorder inputRecorder)
 {
     _inputSender   = inputSender;
     _packetReciver = packetReciver;
     _inputRecorder = inputRecorder;
 }