Skip to content

Commit

Permalink
Merge pull request #73 from kiraio-moe/main
Browse files Browse the repository at this point in the history
[PULL REQUEST] Feat: Support New Input System
  • Loading branch information
kirurobo authored Feb 6, 2025
2 parents 9f284db + 8197fd4 commit 9cdb3b3
Show file tree
Hide file tree
Showing 9 changed files with 186 additions and 43 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ name: Generate upm branches

on:
push:
branches:
- main
tags:
- v*
workflow_dispatch:

env:
MAIN_BRANCH: main
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
using System.Reflection;
using UnityEngine.Events;
#endif
#if ENABLE_INPUT_SYSTEM
using UnityEngine.InputSystem;
#endif

namespace Kirurobo
{
Expand Down Expand Up @@ -637,7 +640,11 @@ private IEnumerator HitTestCoroutine()
/// </summary>
private void HitTestByOpaquePixel()
{
#if ENABLE_INPUT_SYSTEM
Vector2 mousePos = Mouse.current.position.ReadValue();
#elif ENABLE_LEGACY_INPUT_MANAGER
Vector2 mousePos = Input.mousePosition;
#endif

// マウス座標を調べる
if (GetOnOpaquePixel(mousePos))
Expand Down Expand Up @@ -701,7 +708,11 @@ private bool GetOnOpaquePixel(Vector2 mousePos)
/// </summary>
private void HitTestByRaycast()
{
var position = Input.mousePosition;
#if ENABLE_INPUT_SYSTEM
Vector2 position = Mouse.current.position.ReadValue();
#elif ENABLE_LEGACY_INPUT_MANAGER
Vector2 position = Input.mousePosition;
#endif

// // uGUIの上か否かを判定
var raycastResults = new List<RaycastResult>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
using UnityEditor;
using UnityEngine;
using UnityEngine.EventSystems;
#if ENABLE_INPUT_SYSTEM
using UnityEngine.InputSystem;
#endif

namespace Kirurobo
{
Expand Down Expand Up @@ -147,9 +150,13 @@ public void OnDrag(PointerEventData eventData)
if (eventData.button != PointerEventData.InputButton.Left) return;

// Return if any modifier key is pressed
#if ENABLE_INPUT_SYSTEM
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;
#elif ENABLE_LEGACY_INPUT_MANAGER
if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)
|| Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)
|| Input.GetKey(KeyCode.LeftCtrl) || Input.GetKey(KeyCode.RightCtrl)
|| Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.RightAlt)) return;
#endif

// フルスクリーンならウィンドウ移動は行わない
// エディタだと true になってしまうようなので、エディタ以外でのみ確認
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{
"name": "Unity.UniWindowController",
"references": [],
"optionalUnityReferences": [],
"rootNamespace": "",
"references": [
"GUID:75469ad4d38634e559750d17036d5f7c"
],
"includePlatforms": [
"Editor",
"macOSStandalone",
Expand All @@ -13,5 +15,7 @@
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.44657844, g: 0.49641222, b: 0.57481676, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &4
LightmapSettings:
Expand Down Expand Up @@ -891,34 +890,14 @@ GameObject:
m_Component:
- component: {fileID: 1909436763}
- component: {fileID: 1909436762}
- component: {fileID: 1909436761}
- component: {fileID: 1909436764}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1909436761
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1909436760}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SendPointerHoverToParent: 1
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &1909436762
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -949,6 +928,47 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1909436764
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1909436760}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3}
m_Name:
m_EditorClassIdentifier:
m_SendPointerHoverToParent: 1
m_MoveRepeatDelay: 0.5
m_MoveRepeatRate: 0.1
m_XRTrackingOrigin: {fileID: 0}
m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_PointAction: {fileID: -1654692200621890270, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_MoveAction: {fileID: -8784545083839296357, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_SubmitAction: {fileID: 392368643174621059, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_CancelAction: {fileID: 7727032971491509709, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_LeftClickAction: {fileID: 3001919216989983466, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_MiddleClickAction: {fileID: -2185481485913320682, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_RightClickAction: {fileID: -4090225696740746782, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_ScrollWheelAction: {fileID: 6240969308177333660, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_TrackedDevicePositionAction: {fileID: 6564999863303420839, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_TrackedDeviceOrientationAction: {fileID: 7970375526676320489, guid: ca9f5fa95ffab41fb9a615ab714db018,
type: 3}
m_DeselectOnBackgroundClick: 1
m_PointerBehavior: 0
m_CursorLockBehavior: 0
--- !u!1 &1923367064
GameObject:
m_ObjectHideFlags: 0
Expand Down
2 changes: 1 addition & 1 deletion UniWinC/Packages/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"dependencies": {
"com.unity.ai.navigation": "1.1.5",
"com.unity.ide.visualstudio": "2.0.22",
"com.unity.inputsystem": "1.7.0",
"com.unity.ugui": "1.0.0",
"com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0",
Expand Down
18 changes: 9 additions & 9 deletions UniWinC/Packages/packages-lock.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
{
"dependencies": {
"com.unity.ai.navigation": {
"version": "1.1.5",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.modules.ai": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.ext.nunit": {
"version": "1.0.6",
"depth": 2,
Expand All @@ -25,6 +16,15 @@
},
"url": "https://packages.unity.com"
},
"com.unity.inputsystem": {
"version": "1.7.0",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.modules.uielements": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.test-framework": {
"version": "1.1.33",
"depth": 1,
Expand Down
Loading

0 comments on commit 9cdb3b3

Please sign in to comment.