From 07bb4c7c9cfe1f57adf3a3236bae215c19cb1e08 Mon Sep 17 00:00:00 2001 From: lrc <571244399@qq.com> Date: Sat, 25 Jul 2026 15:42:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/Plugins.meta | 2 +- Samples.meta => Runtime/Prefabs.meta | 2 +- Runtime/Prefabs/DragMoveCanvas.prefab | 186 ++++++++++++++++++ .../Prefabs/DragMoveCanvas.prefab.meta | 4 +- Runtime/Prefabs/UniWindowController.prefab | 58 ++++++ .../Prefabs/UniWindowController.prefab.meta | 4 +- Samples~/{Menu => 00_Menu}/SampleManager.cs | 14 +- .../00_Menu/SampleManager.cs.meta | 2 +- Samples~/{Menu => 00_Menu}/SampleMenu.unity | 0 .../00_Menu/SampleMenu.unity.meta | 3 +- .../SampleMenuSettings.lighting | 0 .../00_Menu/SampleMenuSettings.lighting.meta | 8 + .../SimpleSample.unity | 0 .../01_SimpleSample/SimpleSample.unity.meta | 8 + .../{UiSample => 02_UiSample}/UiSample.unity | 0 Samples~/02_UiSample/UiSample.unity.meta | 8 + .../UiSampleCanvas.prefab | 0 .../02_UiSample/UiSampleCanvas.prefab.meta | 7 + .../UiSampleController.cs | 154 +++++++-------- .../02_UiSample/UiSampleController.cs.meta | 12 ++ .../FullscreenSample.cs | 78 ++++---- .../03_Fullscreen/FullscreenSample.cs.meta | 2 +- .../FullscreenSample.unity | 0 .../03_Fullscreen/FullscreenSample.unity.meta | 3 +- .../FullscreenSampleSettings.lighting | 0 .../FullscreenSampleSettings.lighting.meta | 8 + .../SnowParticle.mat | 0 Samples~/03_Fullscreen/SnowParticle.mat.meta | 8 + .../SnowmanArm.mat | 0 Samples~/03_Fullscreen/SnowmanArm.mat.meta | 8 + .../SnowmanBody.mat | 0 Samples~/03_Fullscreen/SnowmanBody.mat.meta | 8 + .../SnowmanFace.mat | 0 Samples~/03_Fullscreen/SnowmanFace.mat.meta | 8 + .../FileDialogSample.cs | 44 ++--- .../04_FileDialog/FileDialogSample.cs.meta | 11 ++ .../FileDialogSample.unity | 0 .../04_FileDialog/FileDialogSample.unity.meta | 3 +- .../FileDialogSampleSettings.lighting | 0 .../FileDialogSampleSettings.lighting.meta | 8 + Samples~/Common/AutoRotator.cs | 14 +- Samples~/Common/InputModuleProxy.cs | 2 +- Samples~/Common/InputProxy.cs | 30 +-- Samples~/Common/ModelController.cs | 68 +++---- Samples~/FileDialog/.sample.json | 5 - Samples~/Fullscreen/.sample.json | 5 - Samples~/Menu/.sample.json | 5 - Samples~/SimpleSample/.sample.json | 5 - Samples~/UiSample/.sample.json | 5 - Tests/Editor/EditorExampleTest.cs | 29 --- ...3.Xuniwindowcontroller.Editor.Tests.asmdef | 14 -- .../Lrss3.Xuniwindowcontroller.Tests.asmdef | 11 -- Tests/Runtime/RuntimeExampleTest.cs | 28 --- package.json | 15 +- 54 files changed, 569 insertions(+), 328 deletions(-) rename Samples.meta => Runtime/Prefabs.meta (77%) create mode 100644 Runtime/Prefabs/DragMoveCanvas.prefab rename Tests/Runtime/Lrss3.Xuniwindowcontroller.Tests.asmdef.meta => Runtime/Prefabs/DragMoveCanvas.prefab.meta (59%) create mode 100644 Runtime/Prefabs/UniWindowController.prefab rename Tests/Editor/Lrss3.Xuniwindowcontroller.Editor.Tests.asmdef.meta => Runtime/Prefabs/UniWindowController.prefab.meta (59%) rename Samples~/{Menu => 00_Menu}/SampleManager.cs (79%) rename Tests/Runtime/RuntimeExampleTest.cs.meta => Samples~/00_Menu/SampleManager.cs.meta (83%) rename Samples~/{Menu => 00_Menu}/SampleMenu.unity (100%) rename Tests.meta => Samples~/00_Menu/SampleMenu.unity.meta (67%) rename Samples~/{Menu => 00_Menu}/SampleMenuSettings.lighting (100%) create mode 100644 Samples~/00_Menu/SampleMenuSettings.lighting.meta rename Samples~/{SimpleSample => 01_SimpleSample}/SimpleSample.unity (100%) create mode 100644 Samples~/01_SimpleSample/SimpleSample.unity.meta rename Samples~/{UiSample => 02_UiSample}/UiSample.unity (100%) create mode 100644 Samples~/02_UiSample/UiSample.unity.meta rename Samples~/{UiSample => 02_UiSample}/UiSampleCanvas.prefab (100%) create mode 100644 Samples~/02_UiSample/UiSampleCanvas.prefab.meta rename Samples~/{UiSample => 02_UiSample}/UiSampleController.cs (77%) create mode 100644 Samples~/02_UiSample/UiSampleController.cs.meta rename Samples~/{Fullscreen => 03_Fullscreen}/FullscreenSample.cs (74%) rename Tests/Editor/EditorExampleTest.cs.meta => Samples~/03_Fullscreen/FullscreenSample.cs.meta (83%) rename Samples~/{Fullscreen => 03_Fullscreen}/FullscreenSample.unity (100%) rename Tests/Editor.meta => Samples~/03_Fullscreen/FullscreenSample.unity.meta (67%) rename Samples~/{Fullscreen => 03_Fullscreen}/FullscreenSampleSettings.lighting (100%) create mode 100644 Samples~/03_Fullscreen/FullscreenSampleSettings.lighting.meta rename Samples~/{Fullscreen => 03_Fullscreen}/SnowParticle.mat (100%) create mode 100644 Samples~/03_Fullscreen/SnowParticle.mat.meta rename Samples~/{Fullscreen => 03_Fullscreen}/SnowmanArm.mat (100%) create mode 100644 Samples~/03_Fullscreen/SnowmanArm.mat.meta rename Samples~/{Fullscreen => 03_Fullscreen}/SnowmanBody.mat (100%) create mode 100644 Samples~/03_Fullscreen/SnowmanBody.mat.meta rename Samples~/{Fullscreen => 03_Fullscreen}/SnowmanFace.mat (100%) create mode 100644 Samples~/03_Fullscreen/SnowmanFace.mat.meta rename Samples~/{FileDialog => 04_FileDialog}/FileDialogSample.cs (56%) create mode 100644 Samples~/04_FileDialog/FileDialogSample.cs.meta rename Samples~/{FileDialog => 04_FileDialog}/FileDialogSample.unity (100%) rename Tests/Runtime.meta => Samples~/04_FileDialog/FileDialogSample.unity.meta (67%) rename Samples~/{FileDialog => 04_FileDialog}/FileDialogSampleSettings.lighting (100%) create mode 100644 Samples~/04_FileDialog/FileDialogSampleSettings.lighting.meta delete mode 100644 Samples~/FileDialog/.sample.json delete mode 100644 Samples~/Fullscreen/.sample.json delete mode 100644 Samples~/Menu/.sample.json delete mode 100644 Samples~/SimpleSample/.sample.json delete mode 100644 Samples~/UiSample/.sample.json delete mode 100644 Tests/Editor/EditorExampleTest.cs delete mode 100644 Tests/Editor/Lrss3.Xuniwindowcontroller.Editor.Tests.asmdef delete mode 100644 Tests/Runtime/Lrss3.Xuniwindowcontroller.Tests.asmdef delete mode 100644 Tests/Runtime/RuntimeExampleTest.cs diff --git a/Runtime/Plugins.meta b/Runtime/Plugins.meta index 5f41354..6bdb4c2 100644 --- a/Runtime/Plugins.meta +++ b/Runtime/Plugins.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b9161ad40887a5746afa1d4eb780f60a +guid: 1b2fb2965b4b647beb75e5d55e9c8d6b folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Samples.meta b/Runtime/Prefabs.meta similarity index 77% rename from Samples.meta rename to Runtime/Prefabs.meta index c2dfa62..e58f106 100644 --- a/Samples.meta +++ b/Runtime/Prefabs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 326ddcba926f5e849bde9a0e0fb87ee1 +guid: e224aeabe6945c54e845bf690e104015 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Runtime/Prefabs/DragMoveCanvas.prefab b/Runtime/Prefabs/DragMoveCanvas.prefab new file mode 100644 index 0000000..56f3726 --- /dev/null +++ b/Runtime/Prefabs/DragMoveCanvas.prefab @@ -0,0 +1,186 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &9167954367597434767 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9167954367597434766} + - component: {fileID: 9167954367597434803} + - component: {fileID: 9167954367597434764} + - component: {fileID: 9167954367597434765} + m_Layer: 2 + m_Name: WindowMoveHandle + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9167954367597434766 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9167954367597434767} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 9167954367673589915} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &9167954367597434803 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9167954367597434767} + m_CullTransparentMesh: 0 +--- !u!114 &9167954367597434764 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9167954367597434767} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 0} + m_RaycastTarget: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 +--- !u!114 &9167954367597434765 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9167954367597434767} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e7879148f4ed9cc42aa2ef8f22bf92c0, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!1 &9167954367673589911 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9167954367673589915} + - component: {fileID: 9167954367673589908} + - component: {fileID: 9167954367673589909} + - component: {fileID: 9167954367673589910} + m_Layer: 5 + m_Name: DragMoveCanvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9167954367673589915 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9167954367673589911} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 9167954367597434766} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!223 &9167954367673589908 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9167954367673589911} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 1 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 0 + m_SortingLayerID: 0 + m_SortingOrder: -99 + m_TargetDisplay: 0 +--- !u!114 &9167954367673589909 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9167954367673589911} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 +--- !u!114 &9167954367673589910 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9167954367673589911} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 diff --git a/Tests/Runtime/Lrss3.Xuniwindowcontroller.Tests.asmdef.meta b/Runtime/Prefabs/DragMoveCanvas.prefab.meta similarity index 59% rename from Tests/Runtime/Lrss3.Xuniwindowcontroller.Tests.asmdef.meta rename to Runtime/Prefabs/DragMoveCanvas.prefab.meta index 15d2fa2..07b6eb4 100644 --- a/Tests/Runtime/Lrss3.Xuniwindowcontroller.Tests.asmdef.meta +++ b/Runtime/Prefabs/DragMoveCanvas.prefab.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 536bc02f6b95d694cbf83ddcac597970 -AssemblyDefinitionImporter: +guid: d7dcf50428b152040847878685fe0746 +PrefabImporter: externalObjects: {} userData: assetBundleName: diff --git a/Runtime/Prefabs/UniWindowController.prefab b/Runtime/Prefabs/UniWindowController.prefab new file mode 100644 index 0000000..9a149fa --- /dev/null +++ b/Runtime/Prefabs/UniWindowController.prefab @@ -0,0 +1,58 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &2416199871598626844 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2416199871598626842} + - component: {fileID: 2416199871598626845} + m_Layer: 0 + m_Name: UniWindowController + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &2416199871598626842 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2416199871598626844} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2416199871598626845 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2416199871598626844} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: eb951500192d2430eb3e306480cc2f31, type: 3} + m_Name: + m_EditorClassIdentifier: + _isTransparent: 0 + _isTopmost: 0 + _isZoomed: 0 + isHitTestEnabled: 1 + hitTestType: 1 + opacityThreshold: 0.1 + forceWindowed: 0 + transparentType: 1 + keyColor: + serializedVersion: 2 + rgba: 65537 + onObject: 1 + pickedColor: {r: 0, g: 0, b: 0, a: 0} diff --git a/Tests/Editor/Lrss3.Xuniwindowcontroller.Editor.Tests.asmdef.meta b/Runtime/Prefabs/UniWindowController.prefab.meta similarity index 59% rename from Tests/Editor/Lrss3.Xuniwindowcontroller.Editor.Tests.asmdef.meta rename to Runtime/Prefabs/UniWindowController.prefab.meta index 53751e3..2e7f1fe 100644 --- a/Tests/Editor/Lrss3.Xuniwindowcontroller.Editor.Tests.asmdef.meta +++ b/Runtime/Prefabs/UniWindowController.prefab.meta @@ -1,6 +1,6 @@ fileFormatVersion: 2 -guid: 9cdd0222c2019eb4f984a69d349fa385 -AssemblyDefinitionImporter: +guid: e893aefd93740714b999573b02916984 +PrefabImporter: externalObjects: {} userData: assetBundleName: diff --git a/Samples~/Menu/SampleManager.cs b/Samples~/00_Menu/SampleManager.cs similarity index 79% rename from Samples~/Menu/SampleManager.cs rename to Samples~/00_Menu/SampleManager.cs index 55e333d..e4fbb82 100644 --- a/Samples~/Menu/SampleManager.cs +++ b/Samples~/00_Menu/SampleManager.cs @@ -15,7 +15,7 @@ namespace Kirurobo private void Awake() { - // 设为单例。若已有实例则销毁自身 + // シングルトンとする。既にインスタンスがあれば自分を破棄 if (this != Instance) { Destroy(this.gameObject); @@ -29,7 +29,7 @@ namespace Kirurobo } /// - /// 场景加载时记录主相机 + /// シーンロード時にメインカメラを記憶 /// /// /// @@ -39,19 +39,19 @@ namespace Kirurobo } /// - /// 打开指定名称的场景 + /// 指定の名前のシーンを開く /// - /// 场景名 + /// シーン名 public void LoadScene(string name) { if (name == "SimpleSample") { - // SimpleSample 时无脚本控制,在此处设置透明 + // SimpleSample の場合はスクリプトでの制御がないため、ここで透明化 UniWindowController.current.isTransparent = true; } else if (name == "FullScreenSample") { - // FullScreenSample 时强制最大化 + // FullScreenSample の場合は強制的に最大化 UniWindowController.current.shouldFitMonitor = true; } @@ -59,7 +59,7 @@ namespace Kirurobo } /// - /// 退出 + /// 終了 /// public void Quit() { diff --git a/Tests/Runtime/RuntimeExampleTest.cs.meta b/Samples~/00_Menu/SampleManager.cs.meta similarity index 83% rename from Tests/Runtime/RuntimeExampleTest.cs.meta rename to Samples~/00_Menu/SampleManager.cs.meta index 3408e6a..1aadfa9 100644 --- a/Tests/Runtime/RuntimeExampleTest.cs.meta +++ b/Samples~/00_Menu/SampleManager.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7f5802e9dd8c9bf4fb15aa0be21a95fc +guid: c83c7f09afe53854b909aed0ea55a3cd MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Samples~/Menu/SampleMenu.unity b/Samples~/00_Menu/SampleMenu.unity similarity index 100% rename from Samples~/Menu/SampleMenu.unity rename to Samples~/00_Menu/SampleMenu.unity diff --git a/Tests.meta b/Samples~/00_Menu/SampleMenu.unity.meta similarity index 67% rename from Tests.meta rename to Samples~/00_Menu/SampleMenu.unity.meta index d84185e..3081950 100644 --- a/Tests.meta +++ b/Samples~/00_Menu/SampleMenu.unity.meta @@ -1,6 +1,5 @@ fileFormatVersion: 2 -guid: 4f4b26af82054284b89cba410c27b75d -folderAsset: yes +guid: bca881472b6085049ad37ab0ad8fe61e DefaultImporter: externalObjects: {} userData: diff --git a/Samples~/Menu/SampleMenuSettings.lighting b/Samples~/00_Menu/SampleMenuSettings.lighting similarity index 100% rename from Samples~/Menu/SampleMenuSettings.lighting rename to Samples~/00_Menu/SampleMenuSettings.lighting diff --git a/Samples~/00_Menu/SampleMenuSettings.lighting.meta b/Samples~/00_Menu/SampleMenuSettings.lighting.meta new file mode 100644 index 0000000..5b46bb0 --- /dev/null +++ b/Samples~/00_Menu/SampleMenuSettings.lighting.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 970bccad986844364a272b0245fed77e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 4890085278179872738 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples~/SimpleSample/SimpleSample.unity b/Samples~/01_SimpleSample/SimpleSample.unity similarity index 100% rename from Samples~/SimpleSample/SimpleSample.unity rename to Samples~/01_SimpleSample/SimpleSample.unity diff --git a/Samples~/01_SimpleSample/SimpleSample.unity.meta b/Samples~/01_SimpleSample/SimpleSample.unity.meta new file mode 100644 index 0000000..291d93a --- /dev/null +++ b/Samples~/01_SimpleSample/SimpleSample.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b650a883366376446b7db29169c59420 +timeCreated: 1545989238 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples~/UiSample/UiSample.unity b/Samples~/02_UiSample/UiSample.unity similarity index 100% rename from Samples~/UiSample/UiSample.unity rename to Samples~/02_UiSample/UiSample.unity diff --git a/Samples~/02_UiSample/UiSample.unity.meta b/Samples~/02_UiSample/UiSample.unity.meta new file mode 100644 index 0000000..e61b8ea --- /dev/null +++ b/Samples~/02_UiSample/UiSample.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c4f4adeee10bff845b320d93a6b82f54 +timeCreated: 1545989238 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples~/UiSample/UiSampleCanvas.prefab b/Samples~/02_UiSample/UiSampleCanvas.prefab similarity index 100% rename from Samples~/UiSample/UiSampleCanvas.prefab rename to Samples~/02_UiSample/UiSampleCanvas.prefab diff --git a/Samples~/02_UiSample/UiSampleCanvas.prefab.meta b/Samples~/02_UiSample/UiSampleCanvas.prefab.meta new file mode 100644 index 0000000..a8a2ef3 --- /dev/null +++ b/Samples~/02_UiSample/UiSampleCanvas.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 38b9db02f63429f49bd117e7f988d985 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples~/UiSample/UiSampleController.cs b/Samples~/02_UiSample/UiSampleController.cs similarity index 77% rename from Samples~/UiSample/UiSampleController.cs rename to Samples~/02_UiSample/UiSampleController.cs index 2e67555..35949cd 100644 --- a/Samples~/UiSample/UiSampleController.cs +++ b/Samples~/02_UiSample/UiSampleController.cs @@ -1,5 +1,5 @@ /** - * UniWindowController 的示例脚本 + * A sample script of UniWindowContoller * * Author: Kirurobo http://twitter.com/kirurobo * License: MIT @@ -13,7 +13,7 @@ using UnityEngine.UI; namespace Kirurobo { /// - /// 使用 Toggle 开关 WindowController 设置的示例 + /// WindowControllerの設定をToggleでオン/オフするサンプル /// public class UiSampleController : MonoBehaviour { @@ -21,14 +21,14 @@ namespace Kirurobo private UniWindowMoveHandle uniWinMoveHandle; private RectTransform canvasRect; - private float mouseMoveSS = 0f; // 鼠标轨迹平方和。[px^2] - private float mouseMoveSSThreshold = 36f; // 点击(非拖拽)阈值。[px^2] - private Vector3 lastMousePosition; // 右键点击位置。 - private float lastEventOccurredTime = -5f; // 上次事件发生的时间戳 [s] - private float eventMessageTimeout = 1f; // 在此时间段内显示事件消息 [s] + private float mouseMoveSS = 0f; // Sum of mouse trajectory squares. [px^2] + private float mouseMoveSSThreshold = 36f; // Click (not dragging) threshold. [px^2] + private Vector3 lastMousePosition; // Right clicked position. + private float lastEventOccurredTime = -5f; // Timestamp the last event occurred [s] + private float eventMessageTimeout = 1f; // Show event message while this period [s] #if ENABLE_LEGACY_INPUT_MANAGER private float touchDuration = 0f; - private float touchDurationThreshold = 0.5f; // 长按时间阈值。[s] + private float touchDurationThreshold = 0.5f; // Long tap time threshold. [s] #endif public Toggle transparentToggle; public Slider alphaSlider; @@ -55,28 +55,28 @@ namespace Kirurobo public RectTransform borderlinePanel; /// - /// 初始化 + /// 初期化 /// void Start() { - // 查找 UniWindowController + // UniWindowController を探す uniwinc = UniWindowController.current; - // 查找 UniWindowDragMove + // UniWindowDragMove を探す uniWinMoveHandle = GameObject.FindAnyObjectByType(); - // 获取 Canvas 的 RectTransform + // CanvasのRectTransform取得 if (menuPanel) canvasRect = menuPanel.GetComponentInParent().GetComponent(); - // 根据有效显示器数量创建选项 + // 有効なモニタ数に合わせて選択肢を作成 UpdateMonitorDropdown(); - // 将 Toggle 的选中状态与当前状态同步 + // Toggleのチェック状態を、現在の状態に合わせる UpdateUI(); if (uniwinc) { - // 操作 UI 时将其反映到窗口 + // UIを操作された際にはウィンドウに反映されるようにする transparentToggle?.onValueChanged.AddListener(val => uniwinc.isTransparent = val); alphaSlider?.onValueChanged.AddListener(val => uniwinc.alphaValue = val); topmostToggle?.onValueChanged.AddListener(val => uniwinc.isTopmost = val); @@ -100,25 +100,25 @@ namespace Kirurobo if (uniWinMoveHandle) dragMoveToggle?.onValueChanged.AddListener(val => uniWinMoveHandle.enabled = val); #if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX - // 如果不是 Windows,则禁用透明方式选择 + // Windows でなければ、透過方法の選択は無効とする //if (transparentTypeDropdown) transparentTypeDropdown.interactable = false; //if (transparentTypeDropdown) transparentTypeDropdown.enabled = false; if (transparentTypeDropdown) transparentTypeDropdown.gameObject.SetActive(false); #endif - // 添加事件 + // Add events uniwinc.OnStateChanged += (type) => { UpdateUI(); //Debug.Log("Window state changed: " + type); - ShowEventMessage("状态改变: " + type); + ShowEventMessage("State changed: " + type); //ShowEventMessage("State changed: " + type + "4:isKey 2:canBecomeKey, 1:canBecomeMain : " + uniwinc.GetDebugInfo().ToString()); ShowClientSize(); }; uniwinc.OnMonitorChanged += () => { UpdateMonitorDropdown(); UpdateUI(); - ShowEventMessage("分辨率已改变!"); + ShowEventMessage("Resolution changed!"); ShowClientSize(); }; uniwinc.OnDropFiles += files => @@ -127,12 +127,12 @@ namespace Kirurobo }; } - // 即使 UinWinC 未就绪也能运行的 Listener + // UinWinCが準備できてなくても動くListener showBorderlineToggle?.onValueChanged.AddListener(val => borderlinePanel.gameObject.SetActive(val)); } /// - /// 显示带超时功能的消息 + /// Show the message with timeout /// /// private void ShowEventMessage(string message) @@ -144,20 +144,20 @@ namespace Kirurobo } /// - /// 每帧执行的处理 + /// 毎フレーム行う処理 /// private void Update() { - // 更新点击测试相关的显示 + // ヒットテスト関連の表示を更新 UpdateHitTestUI(); - // 显示窗口位置和大小以确认运行状态 + // 動作確認のためウィンドウ位置・サイズを表示 if ((lastEventOccurredTime + eventMessageTimeout) < Time.time) { ShowWindowMetrics(); } - // 鼠标右键点击显示菜单。移动距离在阈值以下视为点击。 + // マウス右ボタンクリックでメニューを表示させる。閾値以下の移動ならクリックとみなす。 if (InputProxy.GetMouseButtonDown(1)) { lastMousePosition = InputProxy.mousePosition; @@ -178,7 +178,7 @@ namespace Kirurobo } #if ENABLE_LEGACY_INPUT_MANAGER - // 长按也可显示菜单 + // ロングタッチでもメニューを表示させる if (Input.touchSupported && (Input.touchCount > 0)) { Touch touch = Input.GetTouch(0); @@ -203,38 +203,38 @@ namespace Kirurobo } } #elif ENABLE_INPUT_SYSTEM - // 目前 New Input System 不支持触摸 - // EnhancedTouch 不能与 InputAction 同时使用? + // 現状、New Input System ではタッチ対応は無し + // EnhancedTouch は InputAction と併用不可? #endif - // 按键也可更改设置 + // キーでも設定変更 if (uniwinc) { - // 切换透明模式 + // Toggle transparent if (InputProxy.GetKeyUp("t")) { uniwinc.isTransparent = !uniwinc.isTransparent; } - // 切换始终置顶 + // Toggle always on the front if (InputProxy.GetKeyUp("f")) { uniwinc.isTopmost = !uniwinc.isTopmost; } - // 切换始终置底 + // Toggle always on the bottom if (InputProxy.GetKeyUp("b")) { uniwinc.isBottommost = !uniwinc.isBottommost; } - // 切换最大化 + // Toggle zoom if (InputProxy.GetKeyUp("z")) { uniwinc.isZoomed = !uniwinc.isZoomed; } - // 切换自由定位 + // Toggle free positioning if (InputProxy.GetKeyUp("p")) { uniwinc.isFreePositioningEnabled = !uniwinc.isFreePositioningEnabled; @@ -242,13 +242,13 @@ namespace Kirurobo } - // 测试打开文件面板 + // Test for OpenFilePanel if (InputProxy.GetKeyUp("o")) { FilePanel.Settings ds = new FilePanel.Settings { flags = FilePanel.Flag.AllowMultipleSelection, - title = "打开!", + title = "Open!", filters = new FilePanel.Filter[]{ new FilePanel.Filter("Image files", "png", "jpg", "jpeg"), new FilePanel.Filter("All files", "*"), @@ -259,17 +259,17 @@ namespace Kirurobo FilePanel.OpenFilePanel(ds, (files) => ShowEventMessage(string.Join(Environment.NewLine, files))); } - // 测试保存文件面板 + // Test for SaveFilePanel if (InputProxy.GetKeyUp("s")) { FilePanel.Settings ds = new FilePanel.Settings { flags = FilePanel.Flag.AllowMultipleSelection, - title = "保存!", + title = "Save!", filters = new FilePanel.Filter[]{ - //// TODO: 指定文件类型时,macOS 保存对话框打开会失败 - //// 给 NSSavePanel.accessoryView 指定内容时会发生此问题。 - //// NSOpenPanel 继承自它,但不会发生此问题。 + //// TODO: ファイル種類指定があると、macOSの保存ダイアログを開くことに失敗する + //// NSSavePanel.accessoryView に何か指定すると発生する。 + //// それが継承された NSOpenPanel では発生しない。 // new FilePanel.Filter("Shell script", "sh"), // new FilePanel.Filter("Log", "log"), // new FilePanel.Filter("Plain text", "txt"), @@ -281,7 +281,7 @@ namespace Kirurobo FilePanel.SaveFilePanel(ds, (files) => ShowEventMessage(string.Join(Environment.NewLine, files))); } - // 按下 [ESC] 时退出或停止播放 + // Quit or stop playing when pressed [ESC] if (InputProxy.GetKeyUp("escape")) { #if UNITY_EDITOR @@ -293,8 +293,8 @@ namespace Kirurobo } /// - /// 重置持续触摸时间的记录 - /// 仅在 Legacy Input Manager 中处理以避免警告 + /// タッチされ続けている時間の記録をリセット + /// 警告が出ないように Legacy Input Manager でのみ処理している /// void ResetTouchDuration() { #if ENABLE_LEGACY_INPUT_MANAGER @@ -303,7 +303,7 @@ namespace Kirurobo } /// - /// 适配显示器下拉列表更改时的处理 + /// フィット対象モニタドロップダウンが変更された時の処理 /// /// void SetFitToMonitor(int val) @@ -312,25 +312,25 @@ namespace Kirurobo if (val < 1) { - // 下拉列表第一项为不适配 + // ドロップダウンの先頭は、フィット無し uniwinc.shouldFitMonitor = false; - // 允许更改最大化状态 + // 最大化を変更できるようにする if (zoomedToggle) zoomedToggle.interactable = true; } else { - // 由于从第二项开始,显示器编号减1 + // 次からなので、モニタ番号は1を引く uniwinc.monitorToFit = val - 1; - uniwinc.shouldFitMonitor = true; // 从false变为true时才会移动窗口,因此先指定显示器编号再更改 + uniwinc.shouldFitMonitor = true; // これがfalseからtrueにしたタイミングで移動されるため、モニタ番号を指定してから変更 - // 禁止更改最大化状态 + // 最大化を変更不可にする if (zoomedToggle) zoomedToggle.interactable = false; } } /// - /// 显示窗口位置和坐标 + /// ウィンドウ位置と座標を表示 /// void ShowWindowMetrics() { @@ -339,18 +339,18 @@ namespace Kirurobo var winPos = uniwinc.windowPosition; //var curPos = uniwinc.GetClientCursorPosition(); OutputMessage( - "位置: " + winPos - + "\n大小: " + uniwinc.windowSize - + "\n相对鼠标:" + (uniwinc.cursorPosition - winPos) + "Pos.: " + winPos + + "\nSize: " + uniwinc.windowSize + + "\nRel. Cur.:" + (uniwinc.cursorPosition - winPos) //+ "\nScr. Cur.:" + curPos - + "\nUnity鼠标:" + (Vector2)InputProxy.mousePosition + + "\nUnity Cur.:" + (Vector2)InputProxy.mousePosition ); ShowClientSize(); } } /// - /// 聚焦时刷新 UI + /// Refresh UI on focused /// /// private void OnApplicationFocus(bool hasFocus) @@ -361,20 +361,20 @@ namespace Kirurobo if (uniwinc) { - OutputMessage("已聚焦"); + OutputMessage("Focused"); } else { - OutputMessage("未找到 UniWindowController"); + OutputMessage("No UniWindowController"); } } } /// - /// 在指定坐标显示上下文菜单 + /// 指定した座標にコンテキストメニューを表示する /// - /// 指定中心坐标 + /// 中心座標指定 private void ShowMenu(Vector2 position) { if (menuPanel) @@ -383,11 +383,11 @@ namespace Kirurobo float w = menuPanel.rect.width; float h = menuPanel.rect.height; - // 以指定坐标为中心进行位置调整 - pos.y = Mathf.Max(Mathf.Min(pos.y, Screen.height - h / 2f), h / 2f); // 如果超出则向上移动 - pos.x = Mathf.Max(Mathf.Min(pos.x, Screen.width - w / 2f), w / 2f); // 如果超出右侧则向左移动 + // 指定座標に中心が来る前提で位置調整 + pos.y = Mathf.Max(Mathf.Min(pos.y, Screen.height - h / 2f), h / 2f); // はみ出していれば上に寄せる + pos.x = Mathf.Max(Mathf.Min(pos.x, Screen.width - w / 2f), w / 2f); // 右にはみ出していれば左に寄せる - menuPanel.pivot = Vector2.one * 0.5f; // 设置为中心 + menuPanel.pivot = Vector2.one * 0.5f; // Set the center menuPanel.anchorMin = Vector2.zero; menuPanel.anchorMax = Vector2.zero; menuPanel.anchoredPosition = pos; @@ -396,7 +396,7 @@ namespace Kirurobo } /// - /// 关闭上下文菜单 + /// コンテキストメニューを閉じる /// private void CloseMenu() { @@ -407,7 +407,7 @@ namespace Kirurobo } /// - /// 将实际状态反映到 UI 显示 + /// 実際の状態をUI表示に反映 /// private void UpdateUI() { @@ -476,11 +476,11 @@ namespace Kirurobo hitTestTypeDropdown.RefreshShownValue(); } - // 同时更新点击测试部分的显示 + // ヒットテスト部分の表示も更新 UpdateHitTestUI(); } - // 即使没有 UniWinC 也能运行的部分 + // UniWinC 無しでも動作する部分 if (showBorderlineToggle && borderlinePanel) { borderlinePanel.gameObject.SetActive(showBorderlineToggle.isOn); @@ -488,8 +488,8 @@ namespace Kirurobo } /// - /// 更新点击测试相关的 UI - /// 由于会自动变化,需要比 UpdateUI() 更频繁地更新 + /// ヒットテスト関連のUI更新 + /// 自動で変化するため UpdateUI() よりも高頻度で更新の必要がある /// public void UpdateHitTestUI() { @@ -530,7 +530,7 @@ namespace Kirurobo if (pickedColorText) { - pickedColorText.text = $"颜色拾取器已禁用"; + pickedColorText.text = $"Color picker is disabled"; pickedColorText.color = Color.gray; } } @@ -538,14 +538,14 @@ namespace Kirurobo } /// - /// 更新显示器选择下拉列表的选项 - /// 之后需要调用 UpdateUI() + /// モニタ選択ドロップダウンの選択肢を更新 + /// この後にUpdateUI()を呼ぶこと /// void UpdateMonitorDropdown() { if (!fitWindowDropdown) return; - // 删除除第一项以外的选项 + // 先頭以外の選択肢を削除 fitWindowDropdown.options.RemoveRange(1, fitWindowDropdown.options.Count - 1); if (!uniwinc) @@ -557,7 +557,7 @@ namespace Kirurobo int count = UniWindowController.GetMonitorCount(); for (int i = 0; i < count; i++) { - fitWindowDropdown.options.Add(new Dropdown.OptionData("适配显示器 " + i)); + fitWindowDropdown.options.Add(new Dropdown.OptionData("Fit to Monitor " + i)); } if (uniwinc.monitorToFit >= count) { @@ -567,7 +567,7 @@ namespace Kirurobo } /// - /// 如果 UI 中有文本框,则显示消息。否则输出到控制台 + /// テキスト枠がUIにあれば、そこにメッセージを出す。無ければコンソールに出力 /// /// public void OutputMessage(string text) @@ -583,7 +583,7 @@ namespace Kirurobo } /// - /// 如果 UI 中有客户端大小文本框,则显示消息。否则输出到控制台 + /// クライアントサイズ用テキスト枠がUIにあれば、そこにメッセージを出す。無ければコンソールに出力 /// public void ShowClientSize() { diff --git a/Samples~/02_UiSample/UiSampleController.cs.meta b/Samples~/02_UiSample/UiSampleController.cs.meta new file mode 100644 index 0000000..48243fa --- /dev/null +++ b/Samples~/02_UiSample/UiSampleController.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3b335a5bc9945c9469568d1aba1b14e8 +timeCreated: 1545989238 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples~/Fullscreen/FullscreenSample.cs b/Samples~/03_Fullscreen/FullscreenSample.cs similarity index 74% rename from Samples~/Fullscreen/FullscreenSample.cs rename to Samples~/03_Fullscreen/FullscreenSample.cs index c04272e..864b49e 100644 --- a/Samples~/Fullscreen/FullscreenSample.cs +++ b/Samples~/03_Fullscreen/FullscreenSample.cs @@ -1,5 +1,5 @@ - /** -* 全屏示例的 UI 控制器 +/** +* UI controller for the fullscreen sample * * Author: Kirurobo http://twitter.com/kirurobo * License: MIT @@ -11,18 +11,18 @@ using UnityEngine.UI; namespace Kirurobo { /// - /// 使用 Toggle 开关 WindowController 设置的示例 + /// WindowControllerの設定をToggleでオン/オフするサンプル /// public class FullscreenSample : MonoBehaviour { private UniWindowController uniwinc; private RectTransform canvasRect; - private float mouseMoveSS = 0f; // 鼠标轨迹平方和。[px^2] - private float mouseMoveSSThreshold = 36f; // 点击(非拖拽)阈值。[px^2] - private Vector3 lastMousePosition; // 右键点击位置。 + private float mouseMoveSS = 0f; // Sum of mouse trajectory squares. [px^2] + private float mouseMoveSSThreshold = 36f; // Click (not dragging) threshold. [px^2] + private Vector3 lastMousePosition; // Right clicked position. private float touchDuration = 0f; - private float touchDurationThreshold = 0.5f; // 长按时间阈值。[s] + private float touchDurationThreshold = 0.5f; // Long tap time threshold. [s] public Toggle transparentToggle; public Toggle topmostToggle; @@ -33,28 +33,28 @@ namespace Kirurobo public RectTransform menuPanel; /// - /// 设置 + /// Setup /// void Start() { - // 查找 UniWindowController + // UniWindowController を探す uniwinc = GameObject.FindAnyObjectByType(); - // 获取 Canvas 的 RectTransform + // CanvasのRectTransform取得 if (menuPanel) canvasRect = menuPanel.GetComponentInParent().GetComponent(); - // 根据有效显示器数量创建选项 + // 有効なモニタ数に合わせて選択肢を作成 UpdateMonitorDropdown(); - // 将 Toggle 的选中状态与当前状态同步 + // Toggleのチェック状態を、現在の状態に合わせる UpdateUI(); - // 初始状态下关闭菜单 + // 初期状態ではメニューを閉じておく CloseMenu(); if (uniwinc) { - // 操作 UI 时将其反映到窗口 + // UIを操作された際にはウィンドウに反映されるようにする transparentToggle?.onValueChanged.AddListener(val => uniwinc.isTransparent = val); topmostToggle?.onValueChanged.AddListener(val => uniwinc.isTopmost = val); bottommostToggle?.onValueChanged.AddListener(val => uniwinc.isBottommost = val); @@ -77,12 +77,12 @@ namespace Kirurobo } /// - /// 每帧执行 + /// Perform every frame /// private void Update() { - // 鼠标右键点击时显示上下文菜单。 - // 如果鼠标移动距离在阈值以下,则视为点击 + // Show the context menu when right clicked. + // If mouse movement is closer than a threshold, it is considered a click if (InputProxy.GetMouseButtonDown(1)) { lastMousePosition = InputProxy.mousePosition; @@ -102,9 +102,9 @@ namespace Kirurobo touchDuration = 0f; } - // 暂时仅在 Legacy Input Manager 中处理触摸 + // ひとまず Legacy Input Manager でのみタッチ処理を扱う #if ENABLE_LEGACY_INPUT_MANAGER - // 长按也可显示菜单 + // Show the menu also when long touched if (Input.touchSupported && (Input.touchCount > 0)) { Touch touch = Input.GetTouch(0); @@ -130,7 +130,7 @@ namespace Kirurobo } #endif - // 按下 [Space] 键也可显示菜单 + // Show the menu also when pressed [Space] key if (InputProxy.GetKeyUp("space")) { if (menuPanel) @@ -144,7 +144,7 @@ namespace Kirurobo } } - // 按下 [ESC] 时退出或停止播放 + // Quit or stop playing when pressed [ESC] if (InputProxy.GetKeyUp("escape")) { Quit(); @@ -161,7 +161,7 @@ namespace Kirurobo } /// - /// 适配显示器下拉列表更改时的处理 + /// フィット対象モニタドロップダウンが変更された時の処理 /// /// void SetFitToMonitor(int val) @@ -170,21 +170,21 @@ namespace Kirurobo if (val < 1) { - // 下拉列表第一项为不适配 + // ドロップダウンの先頭は、フィット無し uniwinc.shouldFitMonitor = false; } else { - // 由于从第二项开始,显示器编号减1 + // 次からなので、モニタ番号は1を引く uniwinc.monitorToFit = val - 1; - uniwinc.shouldFitMonitor = true; // 从false变为true时才会移动窗口,因此先指定显示器编号再更改 + uniwinc.shouldFitMonitor = true; // これがfalseからtrueにしたタイミングで移動されるため、モニタ番号を指定してから変更 } } /// - /// 在指定坐标显示上下文菜单 + /// 指定した座標にコンテキストメニューを表示する /// - /// 指定中心坐标 + /// 中心座標指定 private void ShowMenu(Vector2 position) { if (menuPanel) @@ -193,11 +193,11 @@ namespace Kirurobo float w = menuPanel.rect.width; float h = menuPanel.rect.height; - // 以指定坐标为中心进行位置调整 - pos.y = Mathf.Max(Mathf.Min(pos.y, Screen.height - h / 2f), h / 2f); // 如果超出则向上移动 - pos.x = Mathf.Max(Mathf.Min(pos.x, Screen.width - w / 2f), w / 2f); // 如果超出右侧则向左移动 + // 指定座標に中心が来る前提で位置調整 + pos.y = Mathf.Max(Mathf.Min(pos.y, Screen.height - h / 2f), h / 2f); // はみ出していれば上に寄せる + pos.x = Mathf.Max(Mathf.Min(pos.x, Screen.width - w / 2f), w / 2f); // 右にはみ出していれば左に寄せる - menuPanel.pivot = Vector2.one * 0.5f; // 设置为中心 + menuPanel.pivot = Vector2.one * 0.5f; // Set the center menuPanel.anchorMin = Vector2.zero; menuPanel.anchorMax = Vector2.zero; menuPanel.anchoredPosition = pos; @@ -207,7 +207,7 @@ namespace Kirurobo } /// - /// 关闭上下文菜单 + /// コンテキストメニューを閉じる /// private void CloseMenu() { @@ -218,7 +218,7 @@ namespace Kirurobo } /// - /// 将实际状态反映到 UI 显示 + /// 実際の状態をUI表示に反映 /// private void UpdateUI() { @@ -255,14 +255,14 @@ namespace Kirurobo } /// - /// 更新显示器选择下拉列表的选项 - /// 之后需要调用 UpdateUI() + /// モニタ選択ドロップダウンの選択肢を更新 + /// この後にUpdateUI()を呼ぶこと /// void UpdateMonitorDropdown() { if (!fitWindowDropdown) return; - // 删除除第一项以外的选项 + // 先頭以外の選択肢を削除 fitWindowDropdown.options.RemoveRange(1, fitWindowDropdown.options.Count - 1); if (!uniwinc) @@ -274,7 +274,7 @@ namespace Kirurobo int count = UniWindowController.GetMonitorCount(); for (int i = 0; i < count; i++) { - fitWindowDropdown.options.Add(new Dropdown.OptionData("适配显示器 " + i)); + fitWindowDropdown.options.Add(new Dropdown.OptionData("Fit to Monitor " + i)); } if (uniwinc.monitorToFit >= count) { @@ -284,7 +284,7 @@ namespace Kirurobo } /// - /// 显示带超时功能的消息 + /// Show the message with timeout /// /// private void ShowEventMessage(string message) @@ -293,7 +293,7 @@ namespace Kirurobo } /// - /// 如果 UI 中有文本框,则显示消息。否则输出到控制台 + /// テキスト枠がUIにあれば、そこにメッセージを出す。無ければコンソールに出力 /// /// public void OutputMessage(string text) diff --git a/Tests/Editor/EditorExampleTest.cs.meta b/Samples~/03_Fullscreen/FullscreenSample.cs.meta similarity index 83% rename from Tests/Editor/EditorExampleTest.cs.meta rename to Samples~/03_Fullscreen/FullscreenSample.cs.meta index da2576d..67e7f50 100644 --- a/Tests/Editor/EditorExampleTest.cs.meta +++ b/Samples~/03_Fullscreen/FullscreenSample.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7b16c3acbffcdc7478199eacc7ec8497 +guid: d027a988a73c645949379ea67c528652 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Samples~/Fullscreen/FullscreenSample.unity b/Samples~/03_Fullscreen/FullscreenSample.unity similarity index 100% rename from Samples~/Fullscreen/FullscreenSample.unity rename to Samples~/03_Fullscreen/FullscreenSample.unity diff --git a/Tests/Editor.meta b/Samples~/03_Fullscreen/FullscreenSample.unity.meta similarity index 67% rename from Tests/Editor.meta rename to Samples~/03_Fullscreen/FullscreenSample.unity.meta index ac92174..093f0d1 100644 --- a/Tests/Editor.meta +++ b/Samples~/03_Fullscreen/FullscreenSample.unity.meta @@ -1,6 +1,5 @@ fileFormatVersion: 2 -guid: 8878429ebc524544d849c1bc8884262a -folderAsset: yes +guid: cc8dc9342a8c4436397f75a2389ffc1a DefaultImporter: externalObjects: {} userData: diff --git a/Samples~/Fullscreen/FullscreenSampleSettings.lighting b/Samples~/03_Fullscreen/FullscreenSampleSettings.lighting similarity index 100% rename from Samples~/Fullscreen/FullscreenSampleSettings.lighting rename to Samples~/03_Fullscreen/FullscreenSampleSettings.lighting diff --git a/Samples~/03_Fullscreen/FullscreenSampleSettings.lighting.meta b/Samples~/03_Fullscreen/FullscreenSampleSettings.lighting.meta new file mode 100644 index 0000000..7029cff --- /dev/null +++ b/Samples~/03_Fullscreen/FullscreenSampleSettings.lighting.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b5563f201a09e4d65a6987f796daf7ac +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 4890085278179872738 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples~/Fullscreen/SnowParticle.mat b/Samples~/03_Fullscreen/SnowParticle.mat similarity index 100% rename from Samples~/Fullscreen/SnowParticle.mat rename to Samples~/03_Fullscreen/SnowParticle.mat diff --git a/Samples~/03_Fullscreen/SnowParticle.mat.meta b/Samples~/03_Fullscreen/SnowParticle.mat.meta new file mode 100644 index 0000000..c3ef014 --- /dev/null +++ b/Samples~/03_Fullscreen/SnowParticle.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6fcffb6aae595400e8ee042864de7ccb +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples~/Fullscreen/SnowmanArm.mat b/Samples~/03_Fullscreen/SnowmanArm.mat similarity index 100% rename from Samples~/Fullscreen/SnowmanArm.mat rename to Samples~/03_Fullscreen/SnowmanArm.mat diff --git a/Samples~/03_Fullscreen/SnowmanArm.mat.meta b/Samples~/03_Fullscreen/SnowmanArm.mat.meta new file mode 100644 index 0000000..4b27b34 --- /dev/null +++ b/Samples~/03_Fullscreen/SnowmanArm.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 0208720e8ee7e413abe0abd9e4497fba +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples~/Fullscreen/SnowmanBody.mat b/Samples~/03_Fullscreen/SnowmanBody.mat similarity index 100% rename from Samples~/Fullscreen/SnowmanBody.mat rename to Samples~/03_Fullscreen/SnowmanBody.mat diff --git a/Samples~/03_Fullscreen/SnowmanBody.mat.meta b/Samples~/03_Fullscreen/SnowmanBody.mat.meta new file mode 100644 index 0000000..4f30f6f --- /dev/null +++ b/Samples~/03_Fullscreen/SnowmanBody.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4184b0617c337434892dafbd45a3e5ce +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples~/Fullscreen/SnowmanFace.mat b/Samples~/03_Fullscreen/SnowmanFace.mat similarity index 100% rename from Samples~/Fullscreen/SnowmanFace.mat rename to Samples~/03_Fullscreen/SnowmanFace.mat diff --git a/Samples~/03_Fullscreen/SnowmanFace.mat.meta b/Samples~/03_Fullscreen/SnowmanFace.mat.meta new file mode 100644 index 0000000..f49c0da --- /dev/null +++ b/Samples~/03_Fullscreen/SnowmanFace.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b9e9365bee95a4312b88783e135b628c +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples~/FileDialog/FileDialogSample.cs b/Samples~/04_FileDialog/FileDialogSample.cs similarity index 56% rename from Samples~/FileDialog/FileDialogSample.cs rename to Samples~/04_FileDialog/FileDialogSample.cs index 49db3f5..ea4349d 100644 --- a/Samples~/FileDialog/FileDialogSample.cs +++ b/Samples~/04_FileDialog/FileDialogSample.cs @@ -6,7 +6,7 @@ using UnityEngine.UI; namespace Kirurobo { /// - /// 基础文件面板示例 + /// Basic filepanel sample /// public class FileDialogSample : MonoBehaviour { @@ -15,82 +15,82 @@ namespace Kirurobo public Button saveFileButton; public Text messageText; - // 首次更新前调用 Start + // Start is called before the first frame update void Start() { openFileButton.onClick.AddListener(OpenSingleFile); openMultipleFilesButton.onClick.AddListener(OpenMultipleFiles); saveFileButton.onClick.AddListener(OpenSaveFile); - messageText.text = "点击按钮!"; + messageText.text = "Click a button!"; } - // 每帧调用 Update + // Update is called once per frame void Update() { } /// - /// 打开单个文件的对话框。 + /// Open the open file dialog to select single file. /// private void OpenSingleFile() { FilePanel.Settings settings = new FilePanel.Settings(); settings.filters = new FilePanel.Filter[] { - new FilePanel.Filter("所有文件", "*"), - new FilePanel.Filter("图片文件 (*.png;*.jpg;*.jpeg;*.tiff;*.gif;*.tga)", "png", "jpg", "jpeg", "tiff", "gif", "tga"), - new FilePanel.Filter("文档 (*.txt;*.rtf;*.doc;*.docx)", "txt", "rtf", "doc", "docx"), + new FilePanel.Filter("All files", "*"), + new FilePanel.Filter("Image files (*.png;*.jpg;*.jpeg;*.tiff;*.gif;*.tga)", "png", "jpg", "jpeg", "tiff", "gif", "tga"), + new FilePanel.Filter("Documents (*.txt;*.rtf;*.doc;*.docx)", "txt", "rtf", "doc", "docx"), }; - settings.title = "打开文件!"; + settings.title = "Open a file!"; settings.initialDirectory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyPictures); messageText.text = ""; FilePanel.OpenFilePanel(settings, (files) => { - messageText.text = "打开文件\n" + string.Join("\n", files); + messageText.text = "Open a file\n" + string.Join("\n", files); }); } /// - /// 打开多个文件的对话框。 + /// Open the open file dialog to select multiple files. /// private void OpenMultipleFiles() { FilePanel.Settings settings = new FilePanel.Settings(); settings.filters = new FilePanel.Filter[] { - new FilePanel.Filter("图片文件 (*.png;*.jpg;*.jpeg;*.tiff;*.gif;*.tga)", "png", "jpg", "jpeg", "tiff", "gif", "tga"), - new FilePanel.Filter("文档 (*.txt;*.rtf;*.doc;*.docx)", "txt", "rtf", "doc", "docx"), - new FilePanel.Filter("所有文件", "*"), + new FilePanel.Filter("Image files (*.png;*.jpg;*.jpeg;*.tiff;*.gif;*.tga)", "png", "jpg", "jpeg", "tiff", "gif", "tga"), + new FilePanel.Filter("Documents (*.txt;*.rtf;*.doc;*.docx)", "txt", "rtf", "doc", "docx"), + new FilePanel.Filter("All files", "*"), }; settings.flags = FilePanel.Flag.AllowMultipleSelection; - settings.title = "打开多个文件!"; + settings.title = "Open multiple files!"; settings.initialDirectory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments); messageText.text = ""; FilePanel.OpenFilePanel(settings, (files) => { - messageText.text = "打开多个文件\n" + string.Join("\n", files); + messageText.text = "Open multiple files\n" + string.Join("\n", files); }); } /// - /// 打开保存文件对话框。 + /// Open the save file dialog. /// private void OpenSaveFile() { FilePanel.Settings settings = new FilePanel.Settings(); settings.filters = new FilePanel.Filter[] { - new FilePanel.Filter("文本文件 (*.txt;*.log)", "txt", "log"), - new FilePanel.Filter("图片文件 (*.png;*.jpg;*.jpeg;*.tiff;*.gif;*.tga)", "png", "jpg", "jpeg", "tiff", "gif", "tga"), - new FilePanel.Filter("所有文件", "*"), + new FilePanel.Filter("Text file (*.txt;*.log)", "txt", "log"), + new FilePanel.Filter("Image files (*.png;*.jpg;*.jpeg;*.tiff;*.gif;*.tga)", "png", "jpg", "jpeg", "tiff", "gif", "tga"), + new FilePanel.Filter("All files", "*"), }; - settings.title = "实际上不会执行保存操作"; + settings.title = "No save is actually performed"; settings.initialFile = "Test.txt"; messageText.text = ""; FilePanel.SaveFilePanel(settings, (files) => { - messageText.text = "选中的文件\n" + string.Join("\n", files); + messageText.text = "Selected file\n" + string.Join("\n", files); }); } } diff --git a/Samples~/04_FileDialog/FileDialogSample.cs.meta b/Samples~/04_FileDialog/FileDialogSample.cs.meta new file mode 100644 index 0000000..c8088fd --- /dev/null +++ b/Samples~/04_FileDialog/FileDialogSample.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eb6dba400744842c1b9025c020a1dd4e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples~/FileDialog/FileDialogSample.unity b/Samples~/04_FileDialog/FileDialogSample.unity similarity index 100% rename from Samples~/FileDialog/FileDialogSample.unity rename to Samples~/04_FileDialog/FileDialogSample.unity diff --git a/Tests/Runtime.meta b/Samples~/04_FileDialog/FileDialogSample.unity.meta similarity index 67% rename from Tests/Runtime.meta rename to Samples~/04_FileDialog/FileDialogSample.unity.meta index 054b84a..117f637 100644 --- a/Tests/Runtime.meta +++ b/Samples~/04_FileDialog/FileDialogSample.unity.meta @@ -1,6 +1,5 @@ fileFormatVersion: 2 -guid: e6602e0b6b65ef7438c1a83bcf07d1b2 -folderAsset: yes +guid: 48a0f5141a4d64ffd86a58d24b841e0c DefaultImporter: externalObjects: {} userData: diff --git a/Samples~/FileDialog/FileDialogSampleSettings.lighting b/Samples~/04_FileDialog/FileDialogSampleSettings.lighting similarity index 100% rename from Samples~/FileDialog/FileDialogSampleSettings.lighting rename to Samples~/04_FileDialog/FileDialogSampleSettings.lighting diff --git a/Samples~/04_FileDialog/FileDialogSampleSettings.lighting.meta b/Samples~/04_FileDialog/FileDialogSampleSettings.lighting.meta new file mode 100644 index 0000000..df81351 --- /dev/null +++ b/Samples~/04_FileDialog/FileDialogSampleSettings.lighting.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 24c3b38da5d7645cca546e4a61bf8980 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 4890085278179872738 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Samples~/Common/AutoRotator.cs b/Samples~/Common/AutoRotator.cs index f331214..f3d759d 100644 --- a/Samples~/Common/AutoRotator.cs +++ b/Samples~/Common/AutoRotator.cs @@ -2,31 +2,31 @@ using UnityEngine; namespace Kirurobo { /// - /// 使附加的对象以恒定速度进行偏航旋转 + /// アタッチしたオブジェクトを一定速度でヨー回転させる /// public class AutoRotator : MonoBehaviour { /// - /// 旋转速度 [度/秒] + /// 回転速度 [deg/s] /// public float angularVelocity = 90f; /// - /// 旋转轴(偏航旋转,方向向上) + /// 回転軸(ヨー回転のため上向き) /// Vector3 rotationAxis = Vector3.up; /// - /// 初始姿态 + /// 初期姿勢 /// Quaternion initialLocalRotation; - // 用于初始化 + // Use this for initialization void Start () { - // 记录初始姿态 + // 初期姿勢を記憶 initialLocalRotation = transform.localRotation; } - // 每帧调用 Update + // Update is called once per frame void Update () { var rotation = Quaternion.Euler(0f, Time.time * angularVelocity, 0f); transform.localRotation = initialLocalRotation * rotation; diff --git a/Samples~/Common/InputModuleProxy.cs b/Samples~/Common/InputModuleProxy.cs index adc84af..c77d363 100644 --- a/Samples~/Common/InputModuleProxy.cs +++ b/Samples~/Common/InputModuleProxy.cs @@ -9,7 +9,7 @@ using UnityEngine.InputSystem; namespace Kirurobo { /// - /// 为快速兼容 Legacy InputManager 和 InputSystem 而准备的类 + /// Legacy InputManager と InputSystem の両方に取り急ぎ対応するために用意したクラスです /// #if ENABLE_LEGACY_INPUT_MANAGER public class InputModuleProxy : UnityEngine.EventSystems.StandaloneInputModule diff --git a/Samples~/Common/InputProxy.cs b/Samples~/Common/InputProxy.cs index baa41aa..16dc2be 100644 --- a/Samples~/Common/InputProxy.cs +++ b/Samples~/Common/InputProxy.cs @@ -1,8 +1,8 @@ /** - * UniWindowController 的示例脚本 + * A sample script of UniWindowContoller * - * 作者: Kirurobo http://twitter.com/kirurobo - * 许可证: MIT + * Author: Kirurobo http://twitter.com/kirurobo + * License: MIT */ using System; @@ -15,8 +15,8 @@ using UnityEngine.InputSystem; namespace Kirurobo { /// - /// 用于消除 Input System 和 Input Manager 差异的代理 - /// + /// Input System と Input Manager の違いを吸収するためのプロキシ + /// public class InputProxy { public static Vector3 mousePosition { @@ -26,7 +26,7 @@ namespace Kirurobo { } /// - /// 配合 Input System 获取按键抬起 + /// Input System の利用に合わせてキーアップを取得 /// /// public static bool GetKeyUp(String key) @@ -34,22 +34,22 @@ namespace Kirurobo { #if ENABLE_LEGACY_INPUT_MANAGER return Input.GetKeyUp(key); #elif ENABLE_INPUT_SYSTEM - // 简易实现。仅支持单字母字符或数字 - // 非单字符的仅支持 escape, space + // 簡易的な実装。keyが1文字で、かつアルファベットか数字に対応 + // 1文字以外は escape, space のみ対応 if (key.Length == 1) { Key k = Key.None; char c = key[0]; if (c >= '0' && c <= '9') { - // 数字时同时响应 Digit0~Digit9 和 Numpad0~Numpad9 + // 数字の場合はDigit0~Digit9とNumpad0~Numpad9の両方に反応 k = (Key)Enum.ToObject(typeof(Key), (int)Key.Numpad0 + (int)(c - '0')); if (Keyboard.current[k].wasReleasedThisFrame) return true; - // Digit 键中 Digit0 的数值最大 + // Digitの場合はDigit0の値が最大 k = (Key)Enum.ToObject(typeof(Key), (int)Key.Digit1 + (int)((c == '0' ? 9 : c - '1'))); if (Keyboard.current[k].wasReleasedThisFrame) return true; } if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { - // 字母时大小写均可 + // アルファベットの場合は大文字・小文字どちらでも可とする k = (Key)Enum.ToObject(typeof(Key), (int)Key.A + (int)(Char.ToUpper(c) - 'A')); if (Keyboard.current[k].wasReleasedThisFrame) return true; } @@ -65,7 +65,7 @@ namespace Kirurobo { } /// - /// 配合 Input System 获取鼠标坐标 + /// Input System の利用に合わせてマウス座標を取得 /// /// private static Vector3 GetMousePosition() @@ -80,7 +80,7 @@ namespace Kirurobo { } /// - /// 判断鼠标按钮当前是否被按下 + /// マウスボタンが現在押されているか判定 /// /// /// @@ -99,7 +99,7 @@ namespace Kirurobo { } /// - /// 判断本帧是否按下了鼠标按钮 + /// このフレームでマウスボタンが押されたか判定 /// /// /// @@ -118,7 +118,7 @@ namespace Kirurobo { } /// - /// 判断本帧是否松开了鼠标按钮 + /// このフレームでマウスボタンが離されたか判定 /// /// /// diff --git a/Samples~/Common/ModelController.cs b/Samples~/Common/ModelController.cs index c477dde..e1fec48 100644 --- a/Samples~/Common/ModelController.cs +++ b/Samples~/Common/ModelController.cs @@ -1,10 +1,10 @@ -/* +/* * ModelController * - * 旋转、平移和缩放对象 + * Rotate, translate and scale the object * - * 作者: Kirurobo http://twitter.com/kirurobo - * 许可证: MIT + * Author: Kirurobo http://twitter.com/kirurobo + * License: MIT */ using System; @@ -40,7 +40,7 @@ namespace Kirurobo public Vector2 maximumAngles = new Vector2(90f, 360f); [Tooltip("Restrict to move out from screen")] - public bool confineTranslation = true; // 是否将位移限制在窗口(屏幕)范围内 + public bool confineTranslation = true; // 並進移動をウィンドウ(Screen)の範囲に制限するか [Tooltip("Default is the parent transform")] public Transform centerTransform; // 回転中心 @@ -48,12 +48,12 @@ namespace Kirurobo [Tooltip("Default is the main camera")] public Camera currentCamera; - internal GameObject centerObject = null; // 当未指定旋转中心Transform时创建的对象 + internal GameObject centerObject = null; // 回転中心Transformが指定されなかった場合に作成される internal Vector3 rotation; internal Vector3 translation; - internal Vector3 lastMousePosition; // 上一帧的鼠标坐标 - internal DragState dragState; // 拖动时根据开始时的按钮设置对应状态 + internal Vector3 lastMousePosition; // 直前フレームでのマウス座標 + internal DragState dragState; // ドラッグ中は開始時のボタンに合わせた内容にする internal Vector3 relativePosition; internal Quaternion relativeRotation; @@ -69,7 +69,7 @@ namespace Kirurobo void OnDestroy() { - // 如果旋转中心是独立创建的,则删除 + // 回転中心を独自に作成していれば、削除 if (centerObject) GameObject.Destroy(centerObject); } @@ -82,7 +82,7 @@ namespace Kirurobo } /// - /// 获取并准备所需对象 + /// 必要なオブジェクトを取得・準備 /// internal void Initialize() { @@ -106,12 +106,12 @@ namespace Kirurobo } /// - /// 设置初始位置和姿态 - /// 在目标对象就绪后执行 + /// 初期位置・姿勢の設定 + /// 対象となるオブジェクトがそろった後で実行する /// internal void SetupTransform() { - relativePosition = transform.position- centerTransform.position; // 从对象到中心坐标的向量 + relativePosition = transform.position- centerTransform.position; // オブジェクトから中心座標へのベクトル relativeRotation = transform.rotation * Quaternion.Inverse(centerTransform.rotation); originalLocalScale = transform.localScale; @@ -131,7 +131,7 @@ namespace Kirurobo } /// - /// 应用旋转和平移 + /// Apply rotation and translation /// internal void UpdateTransform() { @@ -148,38 +148,38 @@ namespace Kirurobo if (InputProxy.GetMouseButtonDown(0)) { - // 左键(0)拖动时进行平移 + // 左ボタン(0)ドラッグでは並進移動を行う if (dragState == DragState.None && IsHit(mousePos)) { dragState = DragState.Translating; - // 限制在屏幕范围内 + // 画面範囲に制限する if (confineTranslation) { Vector3 screenMax = new Vector3(Screen.width, Screen.height); mousePos = Vector3.Max(Vector3.Min(mousePos, screenMax), Vector3.zero); } - lastMousePosition = mousePos; // 拖动开始时重置 + lastMousePosition = mousePos; // ドラッグ開始時にはリセット } } else if (InputProxy.GetMouseButtonDown(1)) { - // 右键(1)拖动时进行旋转 + // 右ボタン(1)ドラッグでは回転を行う if (dragState == DragState.None && IsHit(mousePos)) { dragState = DragState.Rotating; - lastMousePosition = mousePos; // 拖动开始时重置 + lastMousePosition = mousePos; // ドラッグ開始時にはリセット } } - // 通过拖动旋转 + // ドラッグで回転 if (dragState == DragState.Rotating) { - // 仅在按下按钮时操作 + // ボタンが押されている間のみ操作 if (InputProxy.GetMouseButton(1)) { - // 通过拖动旋转 + // ドラッグで回転 if ((axes & RotationAxes.Yaw) > RotationAxes.None) { rotation.y -= (mousePos.x - lastMousePosition.x) * 360f / Screen.width * yawSensitivity; @@ -196,18 +196,18 @@ namespace Kirurobo } else { - // 如果右键已松开则结束旋转 + // 右ボタンが離されていれば回転は終了 dragState = DragState.None; } } - // 通过拖动平移 + // ドラッグで並進移動 if (dragState == DragState.Translating) { - // 仅在按下按钮时操作 + // ボタンが押されている間のみ操作 if (InputProxy.GetMouseButton(0)) { - // 限制在屏幕范围内 + // 画面範囲に制限する if (confineTranslation) { Vector3 screenMax = new Vector3(Screen.width, Screen.height); @@ -224,22 +224,22 @@ namespace Kirurobo } else { - // 如果按钮已松开则结束位移 + // ボタンが離されていれば並進は終了 dragState = DragState.None; } } - // 暂时仅在使用 Legacy Input Manager 时接受滚轮操作 + // ひとまず Legacy Input Manager でのみホイール操作を受け付けるものとしてリリース #if ENABLE_LEGACY_INPUT_MANAGER - // 如果滚轮转动,则进行缩放 + // ホイールが回転されれば、拡大縮小 if (!Mathf.Approximately(Input.GetAxis("Mouse ScrollWheel"), 0f) && IsHit(mousePos)) { - // 滚轮操作量 + // ホイールによる操作量 float wheelDelta = Input.GetAxis("Mouse ScrollWheel") * scaleSensitivity; - // 更改缩放倍率 + // 倍率を変更 zoom -= wheelDelta; - zoom = Mathf.Clamp(zoom, -1f, 2f); // 视场角的对数范围 [度] + zoom = Mathf.Clamp(zoom, -1f, 2f); // Logarithm of field-of-view [deg] range UpdateTransform(); } @@ -249,7 +249,7 @@ namespace Kirurobo } /// - /// 判断鼠标操作时是否点击到对象 + /// マウスでの操作時、オブジェクトにヒットしたか判定 /// /// internal bool IsHit(Vector3 screenPosition) @@ -266,7 +266,7 @@ namespace Kirurobo } /// - /// 若角度超出指定范围,则进行修正 + /// 指定範囲から外れる角度の場合、補正する /// /// /// diff --git a/Samples~/FileDialog/.sample.json b/Samples~/FileDialog/.sample.json deleted file mode 100644 index c9dc99b..0000000 --- a/Samples~/FileDialog/.sample.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "displayName": "FileDialog", - "description": "Demonstrates native file open/save dialog integration.", - "createSeparatePackage": false -} \ No newline at end of file diff --git a/Samples~/Fullscreen/.sample.json b/Samples~/Fullscreen/.sample.json deleted file mode 100644 index 4fce493..0000000 --- a/Samples~/Fullscreen/.sample.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "displayName": "Fullscreen", - "description": "Fullscreen mode example with right-click context menu and 3D snowman scene.", - "createSeparatePackage": false -} \ No newline at end of file diff --git a/Samples~/Menu/.sample.json b/Samples~/Menu/.sample.json deleted file mode 100644 index ecdb37e..0000000 --- a/Samples~/Menu/.sample.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "displayName": "Menu", - "description": "Sample menu scene for navigating between different example scenes.", - "createSeparatePackage": false -} \ No newline at end of file diff --git a/Samples~/SimpleSample/.sample.json b/Samples~/SimpleSample/.sample.json deleted file mode 100644 index 010e69a..0000000 --- a/Samples~/SimpleSample/.sample.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "displayName": "SimpleSample", - "description": "A minimal example demonstrating basic window control setup.", - "createSeparatePackage": false -} \ No newline at end of file diff --git a/Samples~/UiSample/.sample.json b/Samples~/UiSample/.sample.json deleted file mode 100644 index d708e29..0000000 --- a/Samples~/UiSample/.sample.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "displayName": "UiSample", - "description": "Complete UI demonstration with toggles and sliders for controlling window properties (transparency, topmost, click-through, etc.).", - "createSeparatePackage": false -} \ No newline at end of file diff --git a/Tests/Editor/EditorExampleTest.cs b/Tests/Editor/EditorExampleTest.cs deleted file mode 100644 index e342da2..0000000 --- a/Tests/Editor/EditorExampleTest.cs +++ /dev/null @@ -1,29 +0,0 @@ -using UnityEngine; -using UnityEditor; -using UnityEngine.TestTools; -using NUnit.Framework; -using System.Collections; - -namespace Lrss3.Xuniwindowcontroller.Editor.Tests -{ - - class EditorExampleTest - { - - [Test] - public void EditorSampleTestSimplePasses() - { - // Use the Assert class to test conditions. - } - - // A UnityTest behaves like a coroutine in PlayMode - // and allows you to yield null to skip a frame in EditMode - [UnityTest] - public IEnumerator EditorSampleTestWithEnumeratorPasses() - { - // Use the Assert class to test conditions. - // yield to skip a frame - yield return null; - } - } -} \ No newline at end of file diff --git a/Tests/Editor/Lrss3.Xuniwindowcontroller.Editor.Tests.asmdef b/Tests/Editor/Lrss3.Xuniwindowcontroller.Editor.Tests.asmdef deleted file mode 100644 index 4f1a215..0000000 --- a/Tests/Editor/Lrss3.Xuniwindowcontroller.Editor.Tests.asmdef +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "Lrss3.Xuniwindowcontroller.Editor.Tests", - "references": [ - "Lrss3.Xuniwindowcontroller.Editor", - "Lrss3.Xuniwindowcontroller" - ], - "optionalUnityReferences": [ - "TestAssemblies" - ], - "includePlatforms": [ - "Editor" - ], - "excludePlatforms": [] -} diff --git a/Tests/Runtime/Lrss3.Xuniwindowcontroller.Tests.asmdef b/Tests/Runtime/Lrss3.Xuniwindowcontroller.Tests.asmdef deleted file mode 100644 index 911d69e..0000000 --- a/Tests/Runtime/Lrss3.Xuniwindowcontroller.Tests.asmdef +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "Lrss3.Xuniwindowcontroller.Tests", - "references": [ - "Lrss3.Xuniwindowcontroller" - ], - "optionalUnityReferences": [ - "TestAssemblies" - ], - "includePlatforms": [], - "excludePlatforms": [] -} diff --git a/Tests/Runtime/RuntimeExampleTest.cs b/Tests/Runtime/RuntimeExampleTest.cs deleted file mode 100644 index 2505d35..0000000 --- a/Tests/Runtime/RuntimeExampleTest.cs +++ /dev/null @@ -1,28 +0,0 @@ -using UnityEngine; -using UnityEngine.TestTools; -using NUnit.Framework; -using System.Collections; - -namespace Lrss3.Xuniwindowcontroller.Tests -{ - - class RuntimeExampleTest - { - - [Test] - public void PlayModeSampleTestSimplePasses() - { - // Use the Assert class to test conditions. - } - - // A UnityTest behaves like a coroutine in PlayMode - // and allows you to yield null to skip a frame in EditMode - [UnityTest] - public IEnumerator PlayModeSampleTestWithEnumeratorPasses() - { - // Use the Assert class to test conditions. - // yield to skip a frame - yield return null; - } - } -} \ No newline at end of file diff --git a/package.json b/package.json index 15bf0f4..d632dd0 100644 --- a/package.json +++ b/package.json @@ -22,27 +22,32 @@ { "displayName": "Menu", "description": "Sample menu scene for navigating between different example scenes.", - "path": "Samples~/Menu" + "path": "Samples~/00_Menu" }, { "displayName": "SimpleSample", "description": "A minimal example demonstrating basic window control setup.", - "path": "Samples~/SimpleSample" + "path": "Samples~/01_SimpleSample" }, { "displayName": "UiSample", "description": "Complete UI demonstration with toggles and sliders for controlling window properties (transparency, topmost, click-through, etc.).", - "path": "Samples~/UiSample" + "path": "Samples~/02_UiSample" }, { "displayName": "Fullscreen", "description": "Fullscreen mode example with right-click context menu and 3D snowman scene.", - "path": "Samples~/Fullscreen" + "path": "Samples~/03_Fullscreen" }, { "displayName": "FileDialog", "description": "Demonstrates native file open/save dialog integration.", - "path": "Samples~/FileDialog" + "path": "Samples~/04_FileDialog" + }, + { + "displayName": "Common", + "description": "", + "path": "Samples~/Common" } ] } \ No newline at end of file