Exemple #1
0
        public void Update(GameTime gameTime)
        {
            var touchState = TouchDevice.GetState();

            for (var i = 0; i < touchState.Count; i++)
            {
                var touchID = touchState[i].ID;
                var posX    = touchState[i].Position.X;
                var posY    = touchState[i].Position.Y;

                if (touchState[i].State == TouchDevice.State.PressAndMove && m_TouchID == -1)
                {
                    m_TouchID = touchID;

                    if (isPressOnce == false)
                    {
                        isPressOnce = true;

                        if (m_SkillButtonArea.Contains((int)posX, (int)posY))
                        {
                            isTouch = true;
                            break;
                        }
                    }
                }
                else
                {
                    if (m_TouchID == touchID && touchState[i].State == TouchDevice.State.Released)
                    {
                        if (isTouch && m_PpuoooButtonArea.Contains((int)posX, (int)posY))
                        {
                            selectSkill = 0;
                            if (UserTouchEvent != null)
                            {
                                UserTouchEvent();
                            }
                        }
                        else if (isTouch && m_FirstButtonArea.Contains((int)posX, (int)posY))
                        {
                            selectSkill = 1;
                            if (UserTouchEvent != null)
                            {
                                UserTouchEvent();
                            }
                        }
                        else if (isTouch && m_SecondButtonArea.Contains((int)posX, (int)posY))
                        {
                            selectSkill = 2;
                            if (UserTouchEvent != null)
                            {
                                UserTouchEvent();
                            }
                        }
                        m_TouchID = -1;

                        isTouch     = false;
                        isPressOnce = false;
                        break;
                    }
                }
            }
        }