Exemplo n.º 1
0
        private InputWriter CreateTouchWriter(IEventSystemHandler handler)
        {
            if (currentInputWriter != null)
            {
                DestroyWriter();
            }

            if (recordExecuteEvent.SkipSendTouch)
            {
                return(null);
            }

            var selectable = handler as Selectable;

            if (selectable != null && !selectable.interactable)
            {
                return(null);
            }

            var selectGameObject = (handler as Component).gameObject;

            if (selectGameObject.tag == "SkipRecord")
            {
                return(null);
            }

            Controller.WriteDelay();
            var isDrag = handler is ScrollRect;
            var currentDragSessionName = (isDrag ? "Drag_" : "Click_") + DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + selectGameObject.name + ".txt";
            var currentDragSessionPath = Path.Combine(PathFileTarget, currentDragSessionName);

            Controller.WriteScript((isDrag ? "--drag " : "--click ") + selectGameObject.name);
            Controller.WriteScript("coroutine.yield(MouseInput(\"" + selectGameObject.name + "\", \"" + currentDragSessionName + "\"));" + Environment.NewLine);

            currentInputWriter = new TouchWriter();

            currentInputWriter.StartWriter(selectGameObject, currentDragSessionPath);
            Controller.BeginWrite();

            return(currentInputWriter);
        }
Exemplo n.º 2
0
        private InputWriter CreateKeyboardWriter(InputField inputField)
        {
            if (currentInputWriter != null)
            {
                DestroyWriter();
            }

            Controller.WriteDelay();

            var selectGameObject       = inputField.gameObject;
            var currentDragSessionName = "Keyboard_" + DateTime.Now.ToString("yyyyMMddHHmmss") + "_" + selectGameObject.name + ".txt";
            var currentDragSessionPath = Path.Combine(PathFileTarget, currentDragSessionName);

            Controller.WriteScript("--select input field " + selectGameObject.name);
            Controller.WriteScript("coroutine.yield(KeyboardInput(\"" + currentDragSessionName + "\"));" + Environment.NewLine);
            currentInputWriter = new KeyboardWriter();
            currentInputWriter.StartWriter(selectGameObject, currentDragSessionPath);

            Controller.BeginWrite();
            return(currentInputWriter);
        }