コード例 #1
0
ファイル: Mouse.cs プロジェクト: bluebackblue/jsontest
        /** 更新。インプットシステム。ポインター。マウス位置。
         */
        private bool Main_InputSystem_Pointer_MousePosition(Fee.Render2D.Render2D a_render2d)
        {
                        #if (USE_DEF_FEE_INPUTSYSTEM)
            {
                UnityEngine_InputSystem.Pointer t_pointer_current = UnityEngine_InputSystem.InputSystem.GetDevice <UnityEngine_InputSystem.Pointer>();
                if (t_pointer_current != null)
                {
                    //デバイス。
                    int t_x;
                    int t_y;
                    {
                        int t_pos_x = (int)t_pointer_current.position.x.ReadValue();

                                                #if ((UNITY_STANDALONE_WIN) || (UNITY_EDITOR_WIN) || (UNITY_ANDROID))
                        int t_pos_y = (int)(this.screen_h - t_pointer_current.position.y.ReadValue());
                                                #else
                        int t_pos_y = (int)(t_pointer_current.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);
                    }

                    //設定。
                    this.cursor.Set(t_x, t_y);

                    //devicename
                    this.cursor.devicename = t_pointer_current.name;

                    return(true);
                }
            }
                        #endif

            return(false);
        }
コード例 #2
0
ファイル: Pointer.cs プロジェクト: Niixolas/Real-Time-Chess
 public override void MakeCurrent()
 {
     base.MakeCurrent();
     current = this;
 }
コード例 #3
0
ファイル: Mouse.cs プロジェクト: bluebackblue/jsontest
        /** 更新。インプットシステム。ポインター。マウスボタン。
         */
        private bool Main_InputSystem_Pointer_MouseButton()
        {
                        #if (USE_DEF_FEE_INPUTSYSTEM)
            {
                UnityEngine_InputSystem.Pointer t_pointer_current = UnityEngine_InputSystem.InputSystem.GetDevice <UnityEngine_InputSystem.Pointer>();
                if (t_pointer_current != null)
                {
                    bool t_l_on;

                                        #if ((UNITY_2018_3) || (UNITY_2018_4))
                    {
                        t_l_on = this.left.on;

                        //デバイス。
                        switch (t_pointer_current.phase.ReadValue())
                        {
                        case UnityEngine_InputSystem.PointerPhase.Began:
                        {
                            //開始。
                            t_l_on = true;
                        } break;

                        case UnityEngine_InputSystem.PointerPhase.Ended:
                                                #if ((UNITY_2018_3) || (UNITY_2018_4))
                        case UnityEngine_InputSystem.PointerPhase.Cancelled:
                                                #else
                        case UnityEngine_InputSystem.PointerPhase.Canceled:
                                                #endif
                        {
                            //終了。
                            t_l_on = false;
                        } break;

                        case UnityEngine_InputSystem.PointerPhase.Moved:
                        case UnityEngine_InputSystem.PointerPhase.None:
                        case UnityEngine_InputSystem.PointerPhase.Stationary:
                        {
                            //保留。
                        } break;
                        }
                    }
                                        #else
                    {
                        //デバイス。
                        t_l_on = t_pointer_current.press.isPressed;
                    }
                                        #endif

                    //設定。
                    this.left.Set(t_l_on & this.is_focus);
                    this.right.Set(false & this.is_focus);
                    this.middle.Set(false & this.is_focus);

                    //設定。
                    return(true);
                }
            }
                        #endif

            return(false);
        }