/** constructor */ public Task_CalcVertex(Render2D a_render2d) { //render2d this.render2d = a_render2d; //screen this.screen = a_render2d.GetScreen(); //layerlist this.layerlist = a_render2d.GetLayerList(); //spritelist this.spritelist = a_render2d.GetSpriteList(); //関数登録。 this.task_list = new Fee.TaskW.Task <int> [Config.MAX_LAYER]; for (int ii = 0; ii < this.task_list.Length; ii++) { this.task_list[ii] = new Fee.TaskW.Task <int>(Fee.TaskW.Mode.InstanceMode_Function); int t_layer_index = ii; this.task_list[ii].SetFunction(() => { return(this.TaskMain(t_layer_index)); }); } }
/** 更新。 */ public void Main(bool a_is_focus, Fee.Render2D.Render2D a_render2d) { //is_focus this.is_focus = a_is_focus; //スクリーンサイズ更新。 { this.screen_w = UnityEngine.Screen.width; this.screen_h = UnityEngine.Screen.height; } try{ //位置。 this.Main_Pos(a_render2d); //ボタン。 this.Main_Button(); //マウスホイール。 this.Main_Wheel(); //更新。 this.left.Main(in this.cursor); this.right.Main(in this.cursor); this.middle.Main(in this.cursor); this.mouse_wheel.Main(); }catch (System.Exception t_exception) { Tool.DebugReThrow(t_exception); } }
/** 更新。位置。 */ private void Main_Pos(Fee.Render2D.Render2D a_render2d) { //インプットシステム。マウス。マウス位置。 if (Config.USE_INPUTSYSTEM_MOUSE_MOUSEPOSITION == true) { if (this.Main_InputSystem_Mouse_MousePosition(a_render2d) == true) { return; } } //インプットシステム。ポインター。マウス位置。 if (Config.USE_INPUTSYSTEM_POINTER_MOUSEPOSITION == true) { if (this.Main_InputSystem_Pointer_MousePosition(a_render2d) == true) { return; } } //インプットマネージャ。インプットマウス。マウス位置。 if (Config.USE_INPUTMANAGER_INPUTMOUSE_MOUSEPOSITION == true) { if (this.Main_InputManager_InputMouse_MousePosition(a_render2d) == true) { return; } } }
/** 更新。インプットマネージャ。インプットマウス。マウス位置。 */ #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); }
/** constructor */ public Task_SortList(Render2D a_render2d) { //render2d this.render2d = a_render2d; //layerlist this.layerlist = a_render2d.GetLayerList(); //spritelist this.spritelist = a_render2d.GetSpriteList(); //textlist this.textlist = a_render2d.GetTextList(); //inputfieldlist this.inputfieldlist = a_render2d.GetInputFieldList(); //canceltoken this.canceltoken = new Fee.TaskW.CancelToken(); //frame this.frame = 0; this.frame_max = 120; //関数登録。 this.task_list = new Fee.TaskW.Task <int> [3]; for (int ii = 0; ii < this.task_list.Length; ii++) { this.task_list[ii] = new Fee.TaskW.Task <int>(Fee.TaskW.Mode.InstanceMode_Function); } this.task_list[0].SetFunction(() => { return(this.TaskMain_SpriteList(this.canceltoken)); }); this.task_list[1].SetFunction(() => { return(this.TaskMain_TextList(this.canceltoken)); }); this.task_list[2].SetFunction(() => { return(this.TaskMain_InputFieldList(this.canceltoken)); }); }
/** 更新。タッチ。 */ public void Main_Touch(Fee.Render2D.Render2D a_render2d) { //インプットシステム。マウス。タッチ。 if (Config.USE_INPUTSYSTEM_MOUSE_TOUCH == true) { if (this.Main_InputSystem_Mouse_Touch(a_render2d) == true) { return; } } //インプットマネージャ。インプットマウス。タッチ。 if (Config.USE_INPUTMANAGER_INPUTMOUSE_TOUCH == true) { if (this.Main_InputManager_InputMouse_Touch(a_render2d) == true) { return; } } //インプットシステム。タッチスクリーン。タッチ。 if (Config.USE_INPUTSYSTEM_TOUCHSCREEN_TOUCH == true) { if (this.Main_InputSystem_Touchscreen_Touch(a_render2d) == true) { return; } } //インプットマネージャ。インプットタッチ。タッチ。 if (Config.USE_INPUTMANAGER_INPUTTOUCH_TOUCH == true) { if (this.Main_InputManager_InputTouch_Touch(a_render2d) == true) { return; } } }
/** constructor */ public ResourceList(Render2D a_render2d) { //render2d this.render2d = a_render2d; //screen this.screen = a_render2d.GetScreen(); //layerlist this.layerlist = a_render2d.GetLayerList(); //spritelist this.spritelist = a_render2d.GetSpriteList(); //textlist this.textlist = a_render2d.GetTextList(); //inputfieldlist this.inputfieldlist = a_render2d.GetInputFieldList(); //frame this.frame = 0; this.frame_max = 120; }
/** 更新。 */ public void Main(Fee.Render2D.Render2D a_render2d) { //スクリーンサイズ更新。 { this.screen_w = UnityEngine.Screen.width; this.screen_h = UnityEngine.Screen.height; } try{ for (int ii = 0; ii < this.list.Count; ii++) { this.list[ii].update = false; } //タッチ。 this.Main_Touch(a_render2d); //近距離追跡。 for (int ii = 0; ii < this.device_item_list_count; ii++) { if (this.device_item_list[ii].link == false) { int t_index = this.SearchListItemFromNoUpdate(this.device_item_list[ii].x, this.device_item_list[ii].y, 100); if (t_index >= 0) { //追跡。 this.device_item_list[ii].link = true; //設定。 this.list[t_index].Set(this.device_item_list[ii].x, this.device_item_list[ii].y, this.device_item_list[ii].phasetype); this.list[t_index].SetRawID(this.device_item_list[ii].touch_raw_id); this.list[t_index].update = true; this.list[t_index].fadeoutframe = 0; } } } for (int ii = 0; ii < this.device_item_list_count; ii++) { if (this.device_item_list[ii].link == false) { int t_index = this.SearchListItemFromNoUpdate(this.device_item_list[ii].x, this.device_item_list[ii].y, -1); if (t_index >= 0) { //遠距離追跡。 this.device_item_list[ii].link = true; //設定。 this.list[t_index].Set(this.device_item_list[ii].x, this.device_item_list[ii].y, this.device_item_list[ii].phasetype); this.list[t_index].SetRawID(this.device_item_list[ii].touch_raw_id); this.list[t_index].update = true; this.list[t_index].fadeoutframe = 0; } else { Touch_Phase t_touch_phase = new Touch_Phase(); this.list.Add(t_touch_phase); t_index = this.list.Count - 1; { //新規。 this.device_item_list[ii].link = true; //設定。 this.list[t_index].Set(this.device_item_list[ii].x, this.device_item_list[ii].y, this.device_item_list[ii].phasetype); this.list[t_index].SetRawID(this.device_item_list[ii].touch_raw_id); this.list[t_index].update = true; this.list[t_index].fadeoutframe = 0; } if (this.callback != null) { this.callback(t_touch_phase); } } } } { int ii = 0; while (ii < this.list.Count) { if (this.list[ii].update == false) { this.list[ii].fadeoutframe++; if (this.list[ii].fadeoutframe >= 10) { //タイムアウト削除。 this.list.RemoveAt(ii); } else { this.list[ii].update = true; this.list[ii].phasetype = Touch_Phase.PhaseType.FadeOut; } } else { ii++; } } } //更新。 for (int ii = 0; ii < this.list.Count; ii++) { this.list[ii].Main(); } }catch (System.Exception t_exception) { Tool.DebugReThrow(t_exception); } }
/** 更新。インプットマネージャ。インプットタッチ。タッチ。 */ 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); }