Skip to content

Commit 9cdb3b3

Browse files
authored
Merge pull request #73 from kiraio-moe/main
[PULL REQUEST] Feat: Support New Input System
2 parents 9f284db + 8197fd4 commit 9cdb3b3

File tree

9 files changed

+186
-43
lines changed

9 files changed

+186
-43
lines changed

.github/workflows/main.yml

+3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,11 @@ name: Generate upm branches
55

66
on:
77
push:
8+
branches:
9+
- main
810
tags:
911
- v*
12+
workflow_dispatch:
1013

1114
env:
1215
MAIN_BRANCH: main

UniWinC/Assets/Kirurobo/UniWindowController/Runtime/Scripts/UniWindowController.cs

+12-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
using System.Reflection;
1616
using UnityEngine.Events;
1717
#endif
18+
#if ENABLE_INPUT_SYSTEM
19+
using UnityEngine.InputSystem;
20+
#endif
1821

1922
namespace Kirurobo
2023
{
@@ -637,7 +640,11 @@ private IEnumerator HitTestCoroutine()
637640
/// </summary>
638641
private void HitTestByOpaquePixel()
639642
{
643+
#if ENABLE_INPUT_SYSTEM
644+
Vector2 mousePos = Mouse.current.position.ReadValue();
645+
#elif ENABLE_LEGACY_INPUT_MANAGER
640646
Vector2 mousePos = Input.mousePosition;
647+
#endif
641648

642649
// マウス座標を調べる
643650
if (GetOnOpaquePixel(mousePos))
@@ -701,7 +708,11 @@ private bool GetOnOpaquePixel(Vector2 mousePos)
701708
/// </summary>
702709
private void HitTestByRaycast()
703710
{
704-
var position = Input.mousePosition;
711+
#if ENABLE_INPUT_SYSTEM
712+
Vector2 position = Mouse.current.position.ReadValue();
713+
#elif ENABLE_LEGACY_INPUT_MANAGER
714+
Vector2 position = Input.mousePosition;
715+
#endif
705716

706717
// // uGUIの上か否かを判定
707718
var raycastResults = new List<RaycastResult>();

UniWinC/Assets/Kirurobo/UniWindowController/Runtime/Scripts/UniWindowMoveHandle.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
using UnityEditor;
1111
using UnityEngine;
1212
using UnityEngine.EventSystems;
13+
#if ENABLE_INPUT_SYSTEM
14+
using UnityEngine.InputSystem;
15+
#endif
1316

1417
namespace Kirurobo
1518
{
@@ -147,9 +150,13 @@ public void OnDrag(PointerEventData eventData)
147150
if (eventData.button != PointerEventData.InputButton.Left) return;
148151

149152
// Return if any modifier key is pressed
153+
#if ENABLE_INPUT_SYSTEM
154+
if (Keyboard.current[Key.LeftShift].isPressed || Keyboard.current[Key.RightShift].isPressed || Keyboard.current[Key.LeftCtrl].isPressed || Keyboard.current[Key.RightCtrl].isPressed || Keyboard.current[Key.LeftAlt].isPressed || Keyboard.current[Key.RightAlt].isPressed) return;
155+
#elif ENABLE_LEGACY_INPUT_MANAGER
150156
if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)
151-
|| Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)
157+
|| Input.GetKey(KeyCode.LeftCtrl) || Input.GetKey(KeyCode.RightCtrl)
152158
|| Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) return;
159+
#endif
153160

154161
// フルスクリーンならウィンドウ移動は行わない
155162
// エディタだと true になってしまうようなので、エディタ以外でのみ確認

UniWinC/Assets/Kirurobo/UniWindowController/Runtime/Unity.UniWindowController.asmdef

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"name": "Unity.UniWindowController",
3-
"references": [],
4-
"optionalUnityReferences": [],
3+
"rootNamespace": "",
4+
"references": [
5+
"GUID:75469ad4d38634e559750d17036d5f7c"
6+
],
57
"includePlatforms": [
68
"Editor",
79
"macOSStandalone",
@@ -13,5 +15,7 @@
1315
"overrideReferences": false,
1416
"precompiledReferences": [],
1517
"autoReferenced": true,
16-
"defineConstraints": []
18+
"defineConstraints": [],
19+
"versionDefines": [],
20+
"noEngineReferences": false
1721
}

UniWinC/Assets/Kirurobo/UniWindowController/Samples/02_UiSample/UiSample.unity

+42-22
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ RenderSettings:
3838
m_ReflectionIntensity: 1
3939
m_CustomReflection: {fileID: 0}
4040
m_Sun: {fileID: 0}
41-
m_IndirectSpecularColor: {r: 0.44657844, g: 0.49641222, b: 0.57481676, a: 1}
4241
m_UseRadianceAmbientProbe: 0
4342
--- !u!157 &4
4443
LightmapSettings:
@@ -891,34 +890,14 @@ GameObject:
891890
m_Component:
892891
- component: {fileID: 1909436763}
893892
- component: {fileID: 1909436762}
894-
- component: {fileID: 1909436761}
893+
- component: {fileID: 1909436764}
895894
m_Layer: 0
896895
m_Name: EventSystem
897896
m_TagString: Untagged
898897
m_Icon: {fileID: 0}
899898
m_NavMeshLayer: 0
900899
m_StaticEditorFlags: 0
901900
m_IsActive: 1
902-
--- !u!114 &1909436761
903-
MonoBehaviour:
904-
m_ObjectHideFlags: 0
905-
m_CorrespondingSourceObject: {fileID: 0}
906-
m_PrefabInstance: {fileID: 0}
907-
m_PrefabAsset: {fileID: 0}
908-
m_GameObject: {fileID: 1909436760}
909-
m_Enabled: 1
910-
m_EditorHideFlags: 0
911-
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
912-
m_Name:
913-
m_EditorClassIdentifier:
914-
m_SendPointerHoverToParent: 1
915-
m_HorizontalAxis: Horizontal
916-
m_VerticalAxis: Vertical
917-
m_SubmitButton: Submit
918-
m_CancelButton: Cancel
919-
m_InputActionsPerSecond: 10
920-
m_RepeatDelay: 0.5
921-
m_ForceModuleActive: 0
922901
--- !u!114 &1909436762
923902
MonoBehaviour:
924903
m_ObjectHideFlags: 0
@@ -949,6 +928,47 @@ Transform:
949928
m_Children: []
950929
m_Father: {fileID: 0}
951930
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
931+
--- !u!114 &1909436764
932+
MonoBehaviour:
933+
m_ObjectHideFlags: 0
934+
m_CorrespondingSourceObject: {fileID: 0}
935+
m_PrefabInstance: {fileID: 0}
936+
m_PrefabAsset: {fileID: 0}
937+
m_GameObject: {fileID: 1909436760}
938+
m_Enabled: 1
939+
m_EditorHideFlags: 0
940+
m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3}
941+
m_Name:
942+
m_EditorClassIdentifier:
943+
m_SendPointerHoverToParent: 1
944+
m_MoveRepeatDelay: 0.5
945+
m_MoveRepeatRate: 0.1
946+
m_XRTrackingOrigin: {fileID: 0}
947+
m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018,
948+
type: 3}
949+
m_PointAction: {fileID: -1654692200621890270, guid: ca9f5fa95ffab41fb9a615ab714db018,
950+
type: 3}
951+
m_MoveAction: {fileID: -8784545083839296357, guid: ca9f5fa95ffab41fb9a615ab714db018,
952+
type: 3}
953+
m_SubmitAction: {fileID: 392368643174621059, guid: ca9f5fa95ffab41fb9a615ab714db018,
954+
type: 3}
955+
m_CancelAction: {fileID: 7727032971491509709, guid: ca9f5fa95ffab41fb9a615ab714db018,
956+
type: 3}
957+
m_LeftClickAction: {fileID: 3001919216989983466, guid: ca9f5fa95ffab41fb9a615ab714db018,
958+
type: 3}
959+
m_MiddleClickAction: {fileID: -2185481485913320682, guid: ca9f5fa95ffab41fb9a615ab714db018,
960+
type: 3}
961+
m_RightClickAction: {fileID: -4090225696740746782, guid: ca9f5fa95ffab41fb9a615ab714db018,
962+
type: 3}
963+
m_ScrollWheelAction: {fileID: 6240969308177333660, guid: ca9f5fa95ffab41fb9a615ab714db018,
964+
type: 3}
965+
m_TrackedDevicePositionAction: {fileID: 6564999863303420839, guid: ca9f5fa95ffab41fb9a615ab714db018,
966+
type: 3}
967+
m_TrackedDeviceOrientationAction: {fileID: 7970375526676320489, guid: ca9f5fa95ffab41fb9a615ab714db018,
968+
type: 3}
969+
m_DeselectOnBackgroundClick: 1
970+
m_PointerBehavior: 0
971+
m_CursorLockBehavior: 0
952972
--- !u!1 &1923367064
953973
GameObject:
954974
m_ObjectHideFlags: 0

UniWinC/Packages/manifest.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"dependencies": {
3-
"com.unity.ai.navigation": "1.1.5",
43
"com.unity.ide.visualstudio": "2.0.22",
4+
"com.unity.inputsystem": "1.7.0",
55
"com.unity.ugui": "1.0.0",
66
"com.unity.modules.ai": "1.0.0",
77
"com.unity.modules.androidjni": "1.0.0",

UniWinC/Packages/packages-lock.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
{
22
"dependencies": {
3-
"com.unity.ai.navigation": {
4-
"version": "1.1.5",
5-
"depth": 0,
6-
"source": "registry",
7-
"dependencies": {
8-
"com.unity.modules.ai": "1.0.0"
9-
},
10-
"url": "https://packages.unity.com"
11-
},
123
"com.unity.ext.nunit": {
134
"version": "1.0.6",
145
"depth": 2,
@@ -25,6 +16,15 @@
2516
},
2617
"url": "https://packages.unity.com"
2718
},
19+
"com.unity.inputsystem": {
20+
"version": "1.7.0",
21+
"depth": 0,
22+
"source": "registry",
23+
"dependencies": {
24+
"com.unity.modules.uielements": "1.0.0"
25+
},
26+
"url": "https://packages.unity.com"
27+
},
2828
"com.unity.test-framework": {
2929
"version": "1.1.33",
3030
"depth": 1,

0 commit comments

Comments
 (0)