Esempio n. 1
0
        //file:///C:/Documents%20and%20Settings/All%20Users/Documents/PSM/doc/ja/structSce_1_1PlayStation_1_1Core_1_1Input_1_1TouchData.html
        /// <summary>
        /// Touchs the panel UI.
        /// FrameWorkで使う。タッチ状態取得。
        /// </summary>
        /// <param name='sceneClass'>
        /// Scene class.
        /// </param>
        /// <param name='gameCounter'>
        /// Game counter.
        /// </param>
        public static void TouchPanelUI(GameScene sceneClass, long gameCounter)
        {
            foreach (var touchData in Touch.GetData(0)) {
                byte touchStatus = (byte)TOUCH_STATUS.TOUCH_NOT;
                //タッチダウン
                if (touchData.Status == TouchStatus.Down){
                    //Console.WriteLine("Touch"+ touchData.ID +":(x,y)=("+ touchData.X +","+ touchData.Y +")");
                    touchStatus = (byte)TOUCH_STATUS.TOUCH_DOWN;
                    touchPositionX = touchData.X;
                    touchPositionY = touchData.Y;
                    moveFinishCount = gameCounter;
                    swiped = false;
                }

                //ドラッグ
                if ((touchData.Status != TouchStatus.Down) &&
                    (touchData.Status == TouchStatus.Move) &&
                    (touchPositionX != touchData.X && touchPositionY != touchData.Y)){
                    //Console.WriteLine("TouchMove"+ touchData.ID +":(x,y)=("+ touchData.X +","+ touchData.Y +")");
                    touchStatus = (byte)TOUCH_STATUS.TOUCH_MOVE;
                    touchPositionX = touchData.X;
                    touchPositionY = touchData.Y;
                    swiped = true;
                    moveFinishCount = gameCounter;
                }
                //キープ(同じ場所を押しっぱなし)
                else if((touchData.Status != TouchStatus.Down) &&
                        (touchData.Status == TouchStatus.Move) &&
                        (moveFinishCount + 10 < gameCounter)){
                    //Console.WriteLine("TouchKeep"+ touchData.ID +":(x,y)=("+ touchData.X +","+ touchData.Y +")");
                    touchStatus = (byte)TOUCH_STATUS.TOUCH_KEEP;
                }

                //タッチアップ(タッチをやめたとき) -> スワイプしてない時はタッチになる
                if (touchData.Status == TouchStatus.Up){
                    //Console.WriteLine("TouchUp"+ touchData.ID +":(x,y)=("+ touchData.X +","+ touchData.Y +")");
                    touchStatus = (byte)TOUCH_STATUS.TOUCH_UP;
                    if (!swiped){
                        touchStatus = (byte)TOUCH_STATUS.TOUCH;
                    }
                }
                sceneClass.SetTouchData(touchData , touchStatus);
            }
        }