Esempio n. 1
0
        private void TouchHandle(int what, GestureArgs e)
        {
            UserInfo playerself = WorldSystem.Instance.GetPlayerSelf();

            if (null == playerself || null == e)
            {
                return;
            }
            if ((int)TouchEvent.Cesture == what)
            {
                string ename = e.name;
                if (GestureEvent.OnSingleTap.ToString() == ename)
                {
                    if (EnableMoveInput)
                    {
                        if (WorldSystem.Instance.IsPveScene())
                        {
                            if (e.selectedObjID < 0)
                            {
                                FindPath(playerself, new Vector3(e.airWelGamePosX, e.airWelGamePosY, e.airWelGamePosZ), e.towards);
                            }
                            else
                            {
                                Combat(playerself, e.selectedObjID, e.attackRange);
                            }
                            m_lastSelectObjId = e.selectedObjID;
                            ///
                            GfxSystem.PublishGfxEvent("Op_InputEffect", "Input", GestureEvent.OnSingleTap, e.airWelGamePosX, e.airWelGamePosY, e.airWelGamePosZ, e.selectedObjID < 0 ? false : true, true);
                        }
                        else
                        {
                            Vector3 world_pos = new Vector3(GfxSystem.GetTouchRayPointX(), GfxSystem.GetTouchRayPointY(), GfxSystem.GetTouchRayPointZ());
                            NetworkSystem.Instance.SyncPlayerFindPath(world_pos);
                        }
                    }
                }
                else if (GestureEvent.OnFingerMove.ToString() == ename)
                {
                    if (EnableMoveInput)
                    {
                        if (TouchType.Attack == e.moveType)
                        {
                            UpdateTowards(playerself, e.towards);
                        }
                    }
                }
                else if (GestureEvent.OnSkillStart.ToString() == ename)
                {
                    if (null != playerself)
                    {
                        UserAiStateInfo info = playerself.GetAiStateInfo();
                        if ((int)AiStateId.Move == info.CurState)
                        {
                            StopFindPath(playerself, info);
                        }
                    }
                }
                else if (GestureEvent.OnEasyGesture.ToString() == ename)
                {
                    Vector3 targetpos = new Vector3(e.startGamePosX, e.startGamePosY, e.startGamePosZ);
                    if (Vector3.Zero != targetpos)
                    {
                        PushSkill(playerself, targetpos, e.attackRange);
                    }
                }

                //LogSystem.Debug("userid:{0}, input event:{1}", playerself.GetId(), e.name);
            }
        }