/** 更新。インプットマネージャ。インプットマウス。マウス位置。 */ #if (true) private bool Main_InputManager_InputMouse_MousePosition(Fee.Render2D.Render2D a_render2d) { //デバイス。 int t_x; int t_y; { int t_pos_x = (int)UnityEngine.Input.mousePosition.x; int t_pos_y = this.screen_h - (int)UnityEngine.Input.mousePosition.y; /* * { * 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 = "inputmouse"; return(true); }
/** 更新。インプットマネージャ。インプットマウス。タッチ。 */ #if (true) public bool Main_InputManager_InputMouse_Touch(Fee.Render2D.Render2D a_render2d) { //devicename this.devicename = "inputmouse"; //device_item_list_count this.device_item_list_count = 0; //リスト作成。 if (this.device_item_list.Length < 1) { this.device_item_list = new Touch_Device_Item[1]; } if (UnityEngine.Input.GetMouseButton(0) == true) { //デバイス。 int t_x; int t_y; { int t_pos_x = (int)UnityEngine.Input.mousePosition.x; int t_pos_y = this.screen_h - (int)UnityEngine.Input.mousePosition.y; /* * { * t_pos_x = t_pos_x * UnityEngine.Screen.width / this.screen_w; * t_pos_y = 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.device_item_list[this.device_item_list_count].x = t_x; this.device_item_list[this.device_item_list_count].y = t_y; //フェーズ。 this.device_item_list[this.device_item_list_count].phasetype = Touch_Phase.PhaseType.Moved; //フラグ。 this.device_item_list[this.device_item_list_count].link = false; //追加情報。 this.device_item_list[this.device_item_list_count].touch_raw_id = Touch.INVALID_TOUCH_RAW_ID; this.device_item_list_count++; } return(true); }
/** 更新。インプットシステム。マウス。マウス位置。 */ private bool Main_InputSystem_Mouse_MousePosition(Fee.Render2D.Render2D a_render2d) { #if (USE_DEF_FEE_INPUTSYSTEM) { UnityEngine_InputSystem.Mouse t_mouse_current = UnityEngine_InputSystem.InputSystem.GetDevice <UnityEngine_InputSystem.Mouse>(); if (t_mouse_current != null) { //デバイス。 int t_x; int t_y; { int t_pos_x = (int)t_mouse_current.position.x.ReadValue(); #if ((UNITY_STANDALONE_WIN) || (UNITY_EDITOR_WIN) || (UNITY_ANDROID)) int t_pos_y = (int)(this.screen_h - t_mouse_current.position.y.ReadValue()); #else int t_pos_y = (int)(t_mouse_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_mouse_current.displayName; return(true); } } #endif return(false); }
/** 更新。インプットマネージャ。インプットタッチ。タッチ。 */ public bool Main_InputManager_InputTouch_Touch(Fee.Render2D.Render2D a_render2d) { //devicename this.devicename = "inputtouch"; //device_item_list_count this.device_item_list_count = 0; //リスト作成。 if (this.device_item_list.Length < UnityEngine.Input.touchCount) { this.device_item_list = new Touch_Device_Item[UnityEngine.Input.touchCount]; } for (int ii = 0; ii < UnityEngine.Input.touchCount; ii++) { UnityEngine.Touch t_touch = UnityEngine.Input.GetTouch(ii); switch (t_touch.phase) { case UnityEngine.TouchPhase.Began: case UnityEngine.TouchPhase.Moved: case UnityEngine.TouchPhase.Stationary: { //デバイス。 int t_x; int t_y; { int t_pos_x = (int)t_touch.position.x; int t_pos_y = this.screen_h - (int)t_touch.position.y; /* * { * t_pos_x = t_pos_x * UnityEngine.Screen.width / this.screen_w; * t_pos_y = 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.device_item_list[this.device_item_list_count].x = t_x; this.device_item_list[this.device_item_list_count].y = t_y; //フェーズ。 if (t_touch.phase == UnityEngine.TouchPhase.Began) { this.device_item_list[this.device_item_list_count].phasetype = Touch_Phase.PhaseType.Began; } else if (t_touch.phase == UnityEngine.TouchPhase.Moved) { this.device_item_list[this.device_item_list_count].phasetype = Touch_Phase.PhaseType.Moved; } else if (t_touch.phase == UnityEngine.TouchPhase.Stationary) { this.device_item_list[this.device_item_list_count].phasetype = Touch_Phase.PhaseType.Stationary; } else { this.device_item_list[this.device_item_list_count].phasetype = Touch_Phase.PhaseType.None; } //フラグ。 this.device_item_list[this.device_item_list_count].link = false; //追加情報。 this.device_item_list[this.device_item_list_count].touch_raw_id = Touch.INVALID_TOUCH_RAW_ID; this.device_item_list_count++; } break; } } return(true); }
/** 更新。インプットシステム。マウス。タッチ。 */ public bool Main_InputSystem_Mouse_Touch(Fee.Render2D.Render2D a_render2d) { #if (USE_DEF_FEE_INPUTSYSTEM) { UnityEngine_InputSystem.Mouse t_mouse_current = UnityEngine_InputSystem.InputSystem.GetDevice <UnityEngine_InputSystem.Mouse>(); if (t_mouse_current != null) { //devicename this.devicename = t_mouse_current.displayName; //device_item_list_count this.device_item_list_count = 0; //リスト作成。 if (this.device_item_list.Length < 1) { this.device_item_list = new Touch_Device_Item[1]; } if (t_mouse_current.leftButton.isPressed == true) { //デバイス。 int t_x; int t_y; { int t_pos_x = (int)t_mouse_current.position.x.ReadValue(); #if ((UNITY_STANDALONE_WIN) || (UNITY_EDITOR_WIN)) int t_pos_y = (int)(this.screen_h - t_mouse_current.position.y.ReadValue()); #else int t_pos_y = (int)(t_mouse_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.device_item_list[this.device_item_list_count].x = t_x; this.device_item_list[this.device_item_list_count].y = t_y; //フェーズ。 this.device_item_list[this.device_item_list_count].phasetype = Touch_Phase.PhaseType.Moved; //フラグ。 this.device_item_list[this.device_item_list_count].link = false; //追加情報。 this.device_item_list[this.device_item_list_count].touch_raw_id = Touch.INVALID_TOUCH_RAW_ID; this.device_item_list_count++; } return(true); } } #endif return(false); }
/** 更新。インプットシステム。タッチスクリーン。タッチ。 */ 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); }