Exemplo n.º 1
0
        private void PushTouchAction()
        {
            while (run)
            {
                try
                {
                    TouchActions actions = actionsQueue.Dequeue();

                    if (actions.events != null)
                    {
                        for (int i = 0; i < actions.events.Length; ++i)
                        {
                            TouchEvent touchEvent = actions.events[i];
                            AddEvent(touchEvent);
                            if (touchEvent.sleeptime > 0)
                            {
                                Thread.Sleep(touchEvent.sleeptime);
                            }
                        }
                    }

                    if (actions.cmd != null)
                    {
                        CommandDispatcher.SendCommand(actions.cmd);
                    }
                }
                catch (System.Exception ex)
                {
                    Logger.w(ex.Message + "\n" + ex.StackTrace);
                }
            }
        }
Exemplo n.º 2
0
        protected void handleTouchActions(Command command)
        {
            Logger.d("HandleTouchActions");

            TouchEvent[] events = null;
            if (command.recvObject != null)
            {
                events = (TouchEvent[])command.recvObject;
            }
            else
            {
                events = JsonParser.Deserialization <TouchEvent[]>(command);
            }
            TouchActions actions = new TouchActions();

            actions.cmd    = command;
            actions.events = events;

            TouchEventHandler.INSTANCE.AddTouchActions(actions);
        }
        protected void handleTouchActions(Command command)
        {
            Logger.d("HandleTouchActions");

            TouchEvent[] events = null;
            if (command.recvObject != null)
            {
                events = (TouchEvent[])command.recvObject;
            }
            else
            {
                events = JsonParser.Deserialization <TouchEvent[]>(command);
            }

            float scalex = 0, scaley = 0, offsetx = 0, offsety = 0;
            Point ptNew = new Point(CoordinateType.UnityScreen);

            TouchActions actions = new TouchActions();

            actions.cmd    = command;
            actions.events = events;

            TouchEventHandler.INSTANCE.AddTouchActions(actions);
        }
Exemplo n.º 4
0
 /// <summary>
 /// 获取命令后,交由时间处理线程来处理
 /// </summary>
 /// <param name="touchActions"></param>
 public void AddTouchActions(TouchActions touchActions)
 {
     actionsQueue.Enqueue(touchActions);
 }