示例#1
0
 protected override void OnRemoved()
 {
     base.OnRemoved();
     if (current == this)
     {
         current = null;
     }
 }
示例#2
0
 public override void MakeCurrent()
 {
     base.MakeCurrent();
     current = this;
 }
示例#3
0
        /** 更新。インプットシステム。タッチスクリーン。タッチ。
         */
        public bool Main_InputSystem_Touchscreen_Touch(Fee.Render2D.Render2D a_render2d)
        {
                        #if (USE_DEF_FEE_INPUTSYSTEM)
            {
                UnityEngine_InputSystem.Touchscreen t_touchscreen_current = UnityEngine_InputSystem.InputSystem.GetDevice <UnityEngine_InputSystem.Touchscreen>();
                if (t_touchscreen_current != null)
                {
                    //devicename
                    this.devicename = t_touchscreen_current.displayName;

                    {
                        //TODO:バグ対策。一番最後に発行されたタッチIDを取得する。
                        int t_last_touchid = -1;
                        {
                            for (int ii = 0; ii < t_touchscreen_current.touches.Count; ii++)
                            {
                                int t_touch_id = t_touchscreen_current.touches[ii].touchId.ReadValue();
                                if ((t_touch_id >= t_last_touchid) || (t_last_touchid == -1))
                                {
                                    t_last_touchid = t_touch_id;
                                }
                            }
                        }

                        this.device_item_list_count = 0;

                        //リスト作成。
                        if (this.device_item_list.Length < t_touchscreen_current.touches.Count)
                        {
                            this.device_item_list = new Touch_Device_Item[t_touchscreen_current.touches.Count];
                        }

                        for (int ii = 0; ii < t_touchscreen_current.touches.Count; ii++)
                        {
                            //デバイス。
                            UnityEngine_InputSystem.Controls.TouchControl t_touch = t_touchscreen_current.touches[ii];

                            int t_x;
                            int t_y;
                            {
                                int t_pos_x = (int)t_touch.position.x.ReadValue();

                                                                #if (UNITY_ANDROID)
                                int t_pos_y = (int)(this.screen_h - t_touch.position.y.ReadValue());
                                                                #else
                                int t_pos_y = (int)t_touch.position.y.ReadValue();
                                                                #endif

                                /*
                                 * {
                                 *      t_pos_x = (int)((float)t_pos_x * UnityEngine.Screen.width / this.screen_w);
                                 *      t_pos_y = (int)((float)t_pos_y * UnityEngine.Screen.height / this.screen_h);
                                 * }
                                 */

                                //(GUIスクリーン座標)=>(仮想スクリーン座標)。
                                a_render2d.GuiScreenToVirtualScreen(t_pos_x, t_pos_y, out t_x, out t_y);
                            }

                            UnityEngine_InputSystem.TouchPhase t_touch_phase = t_touch.phase.ReadValue();
                            int t_touch_id = t_touch.touchId.ReadValue();

                            if (this.device_item_list_count < this.device_item_list.Length)
                            {
                                //位置。
                                this.device_item_list[this.device_item_list_count].x = t_x;
                                this.device_item_list[this.device_item_list_count].y = t_y;

                                bool t_enable = false;

                                //フェーズ。
                                switch (t_touch_phase)
                                {
                                case UnityEngine_InputSystem.TouchPhase.Began:
                                {
                                    this.device_item_list[this.device_item_list_count].phasetype = Touch_Phase.PhaseType.Began;
                                    t_enable = true;
                                } break;

                                case UnityEngine_InputSystem.TouchPhase.Moved:
                                {
                                    this.device_item_list[this.device_item_list_count].phasetype = Touch_Phase.PhaseType.Moved;
                                    t_enable = true;
                                } break;

                                case UnityEngine_InputSystem.TouchPhase.Stationary:
                                {
                                    this.device_item_list[this.device_item_list_count].phasetype = Touch_Phase.PhaseType.Stationary;
                                    t_enable = true;
                                } break;

                                case UnityEngine_InputSystem.TouchPhase.Ended:
                                case UnityEngine_InputSystem.TouchPhase.Canceled:
                                case UnityEngine_InputSystem.TouchPhase.None:
                                default:
                                {
                                } break;
                                }

                                //TODO:バグ対策。タッチIDが古いものは除外。
                                if (t_touch_id < t_last_touchid - 100)
                                {
                                    t_enable = false;
                                }

                                if (t_enable == true)
                                {
                                    //フラグ。
                                    this.device_item_list[this.device_item_list_count].link = false;

                                    //追加情報。
                                    this.device_item_list[this.device_item_list_count].touch_raw_id = t_touch_id;

                                    this.device_item_list_count++;
                                }
                            }
                        }
                    }

                    return(true);
                }
            }
                        #endif

            return(false);
        }