Esempio n. 1
0
        public override void StartRecord(RecordController controller)
        {
            Controller = controller;
            if (recordExecuteEvent == null)
            {
                var inputModule = Object.FindObjectOfType <StandaloneInputModule>();
                recordInput = inputModule.input;

                recordExecuteEvent          = gameObject.AddComponent <RecordExecuteEvent>();
                recordExecuteEvent.OnEvent += ProcessEvent;
            }

            PathFileTarget = Path.Combine(controller.PathData(), FOLER_DATA);
            Directory.CreateDirectory(PathFileTarget);
        }
Esempio n. 2
0
//        private Dictionary<int, PointerEventData> m_PointerData;

        public override void StartReplay(ReplayController controller)
        {
            Controller = controller;

            var customInput = Object.FindObjectOfType <ReplayInput>();

            if (customInput == null)
            {
                customInput = gameObject.AddComponent <ReplayInput>();
                customInput.ReplayComponent = this;

                var inputModule = Object.FindObjectOfType <StandaloneInputModule>();
                var prop        = inputModule.GetType().GetField("m_InputOverride", System.Reflection.BindingFlags.NonPublic
                                                                 | System.Reflection.BindingFlags.Instance);
                prop.SetValue(inputModule, customInput);

                //prop = inputModule.GetType().GetField("m_PointerData", System.Reflection.BindingFlags.NonPublic
                //| System.Reflection.BindingFlags.Instance);
                //m_PointerData = prop.GetValue(inputModule) as Dictionary<int, PointerEventData>;
            }

            if (recordExecuteEvent == null)
            {
                recordExecuteEvent          = gameObject.AddComponent <RecordExecuteEvent>();
                recordExecuteEvent.OnEvent += ProcessEvent;
            }

            //customInput.ReplayComponent = this;

            PathFileTarget = Path.Combine(controller.PathData(), InputRecordComponent.FOLER_DATA);
            //Directory.CreateDirectory(PathFileTarget);

            //Controller.RegistGlobal("MouseClick", (Func<string, IEnumerator>)MouseClick);
            Controller.RegistGlobal("MouseInput", (Func <string, string, IEnumerator>)MouseInput);
            Controller.RegistGlobal("KeyboardInput", (Func <string, IEnumerator>)KeyboardInput);
            Controller.RegistGlobal("ClickObject", (Func <string, IEnumerator>)ClickObject);

            //Controller.RegistGlobal("CanClick", (Func<string, bool>)CanClick);
            Controller.RegistGlobal("KeyboardInputText", (Func <string, IEnumerator>)KeyboardInputText);
            Controller.RegistGlobal("InputTextField", (Func <string, string, IEnumerator>)InputTextField);
            //Controller.RegistGlobal("MouseDown", (Action<string>)MouseDown);
            //Controller.RegistGlobal("MouseUp", (Action)MouseUp);
        }