From 74bf5425154530639305a2267c9ada03e7b4c7bb Mon Sep 17 00:00:00 2001 From: sthkm3 Date: Mon, 14 Sep 2026 22:42:35 +0800 Subject: [PATCH] 260913 --- Assets/Scenes/StartUI.unity | 843 ++++++++++++++++-- .../StartUI_Interactions/AssistIntro.cs | 42 + .../StartUI_Interactions/AssistIntro.cs.meta | 2 + .../StartUI_Interactions/AssistStrength.cs | 45 + .../AssistStrength.cs.meta | 2 + .../Stript/StartUI_Interactions/Movement.cs | 41 + .../StartUI_Interactions/Movement.cs.meta | 2 + Assets/Stript/StartUI_Interactions/Polling.cs | 180 ++++ .../StartUI_Interactions/Polling.cs.meta | 2 + .../StartUI_Interactions/PollingRate.cs | 71 -- .../StartUI_Interactions/PollingRate.cs.meta | 2 - .../StartUI_Interactions/Sensitivity.cs | 42 + .../StartUI_Interactions/Sensitivity.cs.meta | 2 + Assets/Stript/Test.meta | 8 + Assets/Stript/Test/Win32PollingAnalyzer.cs | 107 +++ .../Stript/Test/Win32PollingAnalyzer.cs.meta | 2 + Assets/Stript/Test/polling.cs | 136 +++ Assets/Stript/Test/polling.cs.meta | 2 + Assets/Stript/Test/polling.py | 44 + Assets/Stript/Test/polling.py.meta | 7 + 20 files changed, 1416 insertions(+), 166 deletions(-) create mode 100644 Assets/Stript/StartUI_Interactions/AssistIntro.cs create mode 100644 Assets/Stript/StartUI_Interactions/AssistIntro.cs.meta create mode 100644 Assets/Stript/StartUI_Interactions/AssistStrength.cs create mode 100644 Assets/Stript/StartUI_Interactions/AssistStrength.cs.meta create mode 100644 Assets/Stript/StartUI_Interactions/Movement.cs create mode 100644 Assets/Stript/StartUI_Interactions/Movement.cs.meta create mode 100644 Assets/Stript/StartUI_Interactions/Polling.cs create mode 100644 Assets/Stript/StartUI_Interactions/Polling.cs.meta delete mode 100644 Assets/Stript/StartUI_Interactions/PollingRate.cs delete mode 100644 Assets/Stript/StartUI_Interactions/PollingRate.cs.meta create mode 100644 Assets/Stript/StartUI_Interactions/Sensitivity.cs create mode 100644 Assets/Stript/StartUI_Interactions/Sensitivity.cs.meta create mode 100644 Assets/Stript/Test.meta create mode 100644 Assets/Stript/Test/Win32PollingAnalyzer.cs create mode 100644 Assets/Stript/Test/Win32PollingAnalyzer.cs.meta create mode 100644 Assets/Stript/Test/polling.cs create mode 100644 Assets/Stript/Test/polling.cs.meta create mode 100644 Assets/Stript/Test/polling.py create mode 100644 Assets/Stript/Test/polling.py.meta diff --git a/Assets/Scenes/StartUI.unity b/Assets/Scenes/StartUI.unity index ff099b2..fbe48bd 100644 --- a/Assets/Scenes/StartUI.unity +++ b/Assets/Scenes/StartUI.unity @@ -221,81 +221,6 @@ RectTransform: m_CorrespondingSourceObject: {fileID: 695154717561431475, guid: fd1a6f8f44409eb4c950a67c813fdf08, type: 3} m_PrefabInstance: {fileID: 20759451} m_PrefabAsset: {fileID: 0} ---- !u!1 &37745415 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 37745416} - - component: {fileID: 37745418} - - component: {fileID: 37745417} - m_Layer: 5 - m_Name: KeySet - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &37745416 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 37745415} - 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_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 259934723} - 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.5, y: 0.5} ---- !u!114 &37745417 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 37745415} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} - m_Name: - m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 0.392} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 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 - m_PixelsPerUnitMultiplier: 1 ---- !u!222 &37745418 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 37745415} - m_CullTransparentMesh: 1 --- !u!1 &57617350 GameObject: m_ObjectHideFlags: 0 @@ -477,6 +402,143 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 0} +--- !u!1 &158815353 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 158815354} + - component: {fileID: 158815356} + - component: {fileID: 158815355} + m_Layer: 5 + m_Name: Text (TMP) (1) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &158815354 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 158815353} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1887587492} + 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: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &158815355 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 158815353} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: "\u53D6\u6D88\u6C34\u5E73\u8F14\u52A9" + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: a90984eb310cd5a449f31c00582b648a, type: 2} + m_sharedMaterial: {fileID: 2808115657558496897, guid: a90984eb310cd5a449f31c00582b648a, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 32 + m_fontSizeBase: 32 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_characterHorizontalScale: 1 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &158815356 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 158815353} + m_CullTransparentMesh: 1 --- !u!1 &175020296 GameObject: m_ObjectHideFlags: 0 @@ -543,7 +605,7 @@ MonoBehaviour: m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 - m_FadeDuration: 0.01 + m_FadeDuration: 0.1 m_SpriteState: m_HighlightedSprite: {fileID: 0} m_PressedSprite: {fileID: 0} @@ -560,7 +622,7 @@ MonoBehaviour: m_FillRect: {fileID: 1008062299} m_HandleRect: {fileID: 2120664500} m_Direction: 0 - m_MinValue: 0 + m_MinValue: 0.1 m_MaxValue: 10 m_WholeNumbers: 0 m_Value: 1 @@ -934,7 +996,7 @@ GameObject: - component: {fileID: 224319197} - component: {fileID: 224319196} m_Layer: 5 - m_Name: SensitivityText + m_Name: SensitivityInfo m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -1093,12 +1155,12 @@ RectTransform: - {fileID: 1976532342} - {fileID: 260641033} - {fileID: 801092281} + - {fileID: 1859848479} + - {fileID: 983575574} - {fileID: 776089618} - {fileID: 224319195} - {fileID: 175020297} - {fileID: 1625066413} - - {fileID: 1859848479} - - {fileID: 37745416} m_Father: {fileID: 1844327274} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} @@ -1283,6 +1345,126 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 260641032} m_CullTransparentMesh: 1 +--- !u!1 &289871939 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 289871940} + - component: {fileID: 289871943} + - component: {fileID: 289871942} + - component: {fileID: 289871941} + m_Layer: 5 + m_Name: Button_Test + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &289871940 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 289871939} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 759665680} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -160, y: 0} + m_SizeDelta: {x: 300, y: 60} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &289871941 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 289871939} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Button + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 289871942} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!114 &289871942 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 289871939} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 10905, 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 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &289871943 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 289871939} + m_CullTransparentMesh: 1 --- !u!1 &292105530 GameObject: m_ObjectHideFlags: 0 @@ -2094,10 +2276,10 @@ MonoBehaviour: m_FillRect: {fileID: 1604481403} m_HandleRect: {fileID: 190826461} m_Direction: 0 - m_MinValue: 0 - m_MaxValue: 1 - m_WholeNumbers: 0 - m_Value: 0.4 + m_MinValue: 1 + m_MaxValue: 100 + m_WholeNumbers: 1 + m_Value: 40 m_OnValueChanged: m_PersistentCalls: m_Calls: [] @@ -2113,6 +2295,8 @@ GameObject: - component: {fileID: 418327626} - component: {fileID: 418327625} - component: {fileID: 418327624} + - component: {fileID: 418327627} + - component: {fileID: 418327628} m_Layer: 5 m_Name: Notice_M m_TagString: Untagged @@ -2209,6 +2393,34 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 418327622} m_CullTransparentMesh: 1 +--- !u!114 &418327627 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 418327622} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e5ffef45c6a94f543a4f4bb8b1ed2f48, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::AssistStrength + targetSlider: {fileID: 406621758} + valueDisplayText: {fileID: 1415120354} +--- !u!114 &418327628 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 418327622} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: eb773ea3cff4cd3458860b9d3eab1303, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::AssistIntro + assistDropdown: {fileID: 219941943} + introDisplayText: {fileID: 1076048429} --- !u!1 &518581658 GameObject: m_ObjectHideFlags: 0 @@ -2481,6 +2693,8 @@ GameObject: - component: {fileID: 577747343} - component: {fileID: 577747344} - component: {fileID: 577747345} + - component: {fileID: 577747346} + - component: {fileID: 577747347} m_Layer: 5 m_Name: Notice_L m_TagString: Untagged @@ -2613,9 +2827,37 @@ MonoBehaviour: m_GameObject: {fileID: 577747338} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 20bda67a74291514cac9cd232e2093ee, type: 3} + m_Script: {fileID: 11500000, guid: dbfae505c051b8241a378b2712dd7b5d, type: 3} m_Name: - m_EditorClassIdentifier: Assembly-CSharp::PollingRate + m_EditorClassIdentifier: Assembly-CSharp::Polling + pollingDisplay: {fileID: 1859848480} +--- !u!114 &577747346 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 577747338} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0baddb7dc6fc5184997d41c4fe35bb25, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::Movement + movementVectorText: {fileID: 983575575} +--- !u!114 &577747347 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 577747338} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0c0bf45cb5cebd14190d7c1e7ec7f6d7, type: 3} + m_Name: + m_EditorClassIdentifier: Assembly-CSharp::Sensitivity + targetSlider: {fileID: 175020298} + valueDisplayText: {fileID: 224319196} --- !u!1 &590569044 GameObject: m_ObjectHideFlags: 0 @@ -3229,6 +3471,7 @@ RectTransform: m_Children: - {fileID: 518581659} - {fileID: 1139324154} + - {fileID: 289871940} - {fileID: 1429612747} m_Father: {fileID: 57617351} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -3585,7 +3828,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: "\u89E3\u6790\u5EA6 : 1920*1080*120hz " + m_text: "\u89E3\u6790\u5EA6 : 1920*1080*60hz " m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: a90984eb310cd5a449f31c00582b648a, type: 2} m_sharedMaterial: {fileID: 2808115657558496897, guid: a90984eb310cd5a449f31c00582b648a, type: 2} @@ -4013,6 +4256,143 @@ MonoBehaviour: m_PersistentCalls: m_Calls: [] m_IsOn: 1 +--- !u!1 &869900993 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 869900994} + - component: {fileID: 869900996} + - component: {fileID: 869900995} + m_Layer: 5 + m_Name: Text (TMP) (2) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &869900994 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 869900993} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1887587492} + 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: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &869900995 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 869900993} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: "\u53D6\u6D88\u5782\u76F4\u8F14\u52A9" + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: a90984eb310cd5a449f31c00582b648a, type: 2} + m_sharedMaterial: {fileID: 2808115657558496897, guid: a90984eb310cd5a449f31c00582b648a, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 32 + m_fontSizeBase: 32 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_characterHorizontalScale: 1 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &869900996 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 869900993} + m_CullTransparentMesh: 1 --- !u!1 &896869732 GameObject: m_ObjectHideFlags: 0 @@ -4724,6 +5104,143 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 979601749} m_CullTransparentMesh: 1 +--- !u!1 &983575573 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 983575574} + - component: {fileID: 983575576} + - component: {fileID: 983575575} + m_Layer: 5 + m_Name: MovementVector + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &983575574 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 983575573} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 259934723} + 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: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &983575575 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 983575573} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: "\u79FB\u52D5\u5411\u91CF: X: +0.0, Y: +0.0" + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: a90984eb310cd5a449f31c00582b648a, type: 2} + m_sharedMaterial: {fileID: 2808115657558496897, guid: a90984eb310cd5a449f31c00582b648a, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 32 + m_fontSizeBase: 32 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_characterHorizontalScale: 1 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &983575576 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 983575573} + m_CullTransparentMesh: 1 --- !u!1 &992629459 GameObject: m_ObjectHideFlags: 0 @@ -4968,7 +5485,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: "\t\u6B64\u9078\u9805\u4E0D\u4F7F\u7528\u4EFB\u4F55\u7784\u6E96\u8F14\u52A9\uFF0C\u4F7F\u7528\u4F60\u6700\u7D14\u7CB9\u7684\u53CD\u61C9\u529B\u8207\u63A7\u5236\u529B\u7784\u6E96\u3002\u5982\u679C\u53EF\u4EE5\u7684\u8A71\uFF0C\u8ACB\u591A\u591A\u6E2C\u8A66\u6B64\u9078\u9805\u3002" + m_text: "\t\u4E0D\u4F7F\u7528\u4EFB\u4F55\u7784\u6E96\u8F14\u52A9\uFF0C\u4F7F\u7528\u4F60\u6700\u7D14\u7CB9\u7684\u53CD\u61C9\u529B\u8207\u63A7\u5236\u529B\u7784\u6E96\u3002\u5982\u679C\u53EF\u4EE5\u7684\u8A71\uFF0C\u8ACB\u591A\u591A\u6E2C\u8A66\u6B64\u9078\u9805\u3002" m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: a90984eb310cd5a449f31c00582b648a, type: 2} m_sharedMaterial: {fileID: 2808115657558496897, guid: a90984eb310cd5a449f31c00582b648a, type: 2} @@ -5003,7 +5520,7 @@ MonoBehaviour: m_fontSizeMax: 72 m_fontStyle: 0 m_HorizontalAlignment: 8 - m_VerticalAlignment: 256 + m_VerticalAlignment: 512 m_textAlignment: 65535 m_characterSpacing: 0 m_characterHorizontalScale: 1 @@ -5364,7 +5881,7 @@ GameObject: - component: {fileID: 1139324156} - component: {fileID: 1139324155} m_Layer: 5 - m_Name: Button_M + m_Name: Button_Start m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -5386,7 +5903,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 0, y: 0} + m_AnchoredPosition: {x: 160, y: 0} m_SizeDelta: {x: 300, y: 60} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1139324155 @@ -7652,7 +8169,7 @@ MonoBehaviour: m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] - m_text: "\u56DE\u5831\u7387 : 1000hz " + m_text: "\u6ED1\u9F20\u56DE\u5831\u7387 : 1000hz " m_isRightToLeft: 0 m_fontAsset: {fileID: 11400000, guid: a90984eb310cd5a449f31c00582b648a, type: 2} m_sharedMaterial: {fileID: 2808115657558496897, guid: a90984eb310cd5a449f31c00582b648a, type: 2} @@ -7768,6 +8285,9 @@ RectTransform: - {fileID: 1415120353} - {fileID: 406621757} - {fileID: 1728676493} + - {fileID: 1945929173} + - {fileID: 869900994} + - {fileID: 158815354} m_Father: {fileID: 1618052314} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} @@ -7942,6 +8462,143 @@ MonoBehaviour: m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.RectMask2D m_Padding: {x: -8, y: -5, z: -8, w: -5} m_Softness: {x: 0, y: 0} +--- !u!1 &1945929172 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1945929173} + - component: {fileID: 1945929175} + - component: {fileID: 1945929174} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1945929173 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1945929172} + 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_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1887587492} + 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: 50} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1945929174 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1945929172} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: Unity.TextMeshPro::TMPro.TextMeshProUGUI + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: "\u9032\u968E\u8F14\u52A9\u512A\u5316 :" + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: a90984eb310cd5a449f31c00582b648a, type: 2} + m_sharedMaterial: {fileID: 2808115657558496897, guid: a90984eb310cd5a449f31c00582b648a, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 32 + m_fontSizeBase: 32 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_characterHorizontalScale: 1 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_TextWrappingMode: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 0 + m_ActiveFontFeatures: 6e72656b + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_EmojiFallbackSupport: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &1945929175 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1945929172} + m_CullTransparentMesh: 1 --- !u!1 &1976532341 GameObject: m_ObjectHideFlags: 0 @@ -8617,7 +9274,7 @@ MonoBehaviour: m_HandleRect: {fileID: 590569045} m_Direction: 2 m_Value: 1 - m_Size: 0.6059791 + m_Size: 0.6063342 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: diff --git a/Assets/Stript/StartUI_Interactions/AssistIntro.cs b/Assets/Stript/StartUI_Interactions/AssistIntro.cs new file mode 100644 index 0000000..d99c577 --- /dev/null +++ b/Assets/Stript/StartUI_Interactions/AssistIntro.cs @@ -0,0 +1,42 @@ +using UnityEngine; +using TMPro; + +public class AssistIntro : MonoBehaviour +{ + [Header("UI 參照")] + [Tooltip("Dropdown")] + public TMP_Dropdown assistDropdown; + + [Tooltip("Text (TMP)")] + public TextMeshProUGUI introDisplayText; + + private readonly string[] intros = new string[] + { + " 不使用任何瞄準輔助,使用你最純粹的反應力與控制力瞄準。如果可以的話,無輔助與有輔助的測試次數請盡量控制在 1 : 1。", + " 依照敵方在螢幕上的座標,直接移動準心以實現瞄準。輔助強度為移動量,如設定 100% 會形成暴力鎖。", + " 依照敵方在螢幕上與你準心的距離,動態更改你的靈敏度(接近敵方時降低靈敏度)以吸附準心。輔助強度為靈敏度降低程度。" + }; + + void Start() + { + if (assistDropdown != null) + { + UpdateIntro(assistDropdown.value); + + assistDropdown.onValueChanged.AddListener(OnDropdownChanged); + } + } + + void OnDropdownChanged(int index) + { + UpdateIntro(index); + } + + void UpdateIntro(int index) + { + if (introDisplayText != null && index >= 0 && index < intros.Length) + { + introDisplayText.text = intros[index]; + } + } +} \ No newline at end of file diff --git a/Assets/Stript/StartUI_Interactions/AssistIntro.cs.meta b/Assets/Stript/StartUI_Interactions/AssistIntro.cs.meta new file mode 100644 index 0000000..c4243bc --- /dev/null +++ b/Assets/Stript/StartUI_Interactions/AssistIntro.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: eb773ea3cff4cd3458860b9d3eab1303 \ No newline at end of file diff --git a/Assets/Stript/StartUI_Interactions/AssistStrength.cs b/Assets/Stript/StartUI_Interactions/AssistStrength.cs new file mode 100644 index 0000000..f006d6e --- /dev/null +++ b/Assets/Stript/StartUI_Interactions/AssistStrength.cs @@ -0,0 +1,45 @@ +using UnityEngine; +using UnityEngine.UI; +using TMPro; + +public class AssistStrength : MonoBehaviour +{ + [Header("UI 參照")] + [Tooltip("Slider")] + public Slider targetSlider; + + [Tooltip("Text (TMP)")] + public TextMeshProUGUI valueDisplayText; + + void Start() + { + if (targetSlider != null) + { + // 設定拉桿的屬性 + targetSlider.minValue = 1f; + targetSlider.maxValue = 100f; + targetSlider.wholeNumbers = true; // 每 1 一個階梯,使用整數 + + // 初始化顯示 + UpdateDisplayText(targetSlider.value); + + // 註冊拉桿數值改變事件 + targetSlider.onValueChanged.AddListener(OnSliderValueChanged); + } + } + + void OnSliderValueChanged(float rawValue) + { + int steppedValue = Mathf.RoundToInt(rawValue); + UpdateDisplayText(steppedValue); + } + + void UpdateDisplayText(float val) + { + if (valueDisplayText != null) + { + int intVal = Mathf.RoundToInt(val); + valueDisplayText.text = $"輔助強度 : {intVal}%"; + } + } +} \ No newline at end of file diff --git a/Assets/Stript/StartUI_Interactions/AssistStrength.cs.meta b/Assets/Stript/StartUI_Interactions/AssistStrength.cs.meta new file mode 100644 index 0000000..50514f0 --- /dev/null +++ b/Assets/Stript/StartUI_Interactions/AssistStrength.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: e5ffef45c6a94f543a4f4bb8b1ed2f48 \ No newline at end of file diff --git a/Assets/Stript/StartUI_Interactions/Movement.cs b/Assets/Stript/StartUI_Interactions/Movement.cs new file mode 100644 index 0000000..eca9e6e --- /dev/null +++ b/Assets/Stript/StartUI_Interactions/Movement.cs @@ -0,0 +1,41 @@ +using UnityEngine; +using TMPro; +using UnityEngine.InputSystem; + +public class Movement : MonoBehaviour +{ + [Header("UI 參照")] + [Tooltip("Text (TMP)")] + public TextMeshProUGUI movementVectorText; + private Vector2 smoothedDelta = Vector2.zero; + private const float alpha = 0.1f; // 數值越大 越貼最新數值 + + void Update() + { + if (Mouse.current != null) + { + Vector2 currentDelta = Mouse.current.delta.ReadValue(); + + if (smoothedDelta == Vector2.zero) + { + smoothedDelta = currentDelta; + } + else + { + smoothedDelta = (alpha * currentDelta) + ((1.0f - alpha) * smoothedDelta); + } + } + else + { + smoothedDelta = Vector2.zero; + } + + if (movementVectorText != null) + { + string xStr = (smoothedDelta.x >= 0 ? "+" : "") + smoothedDelta.x.ToString("F1"); + string yStr = (smoothedDelta.y >= 0 ? "+" : "") + smoothedDelta.y.ToString("F1"); + + movementVectorText.text = $"移動向量: X: {xStr}, Y: {yStr}"; + } + } +} \ No newline at end of file diff --git a/Assets/Stript/StartUI_Interactions/Movement.cs.meta b/Assets/Stript/StartUI_Interactions/Movement.cs.meta new file mode 100644 index 0000000..10000a7 --- /dev/null +++ b/Assets/Stript/StartUI_Interactions/Movement.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 0baddb7dc6fc5184997d41c4fe35bb25 \ No newline at end of file diff --git a/Assets/Stript/StartUI_Interactions/Polling.cs b/Assets/Stript/StartUI_Interactions/Polling.cs new file mode 100644 index 0000000..0347523 --- /dev/null +++ b/Assets/Stript/StartUI_Interactions/Polling.cs @@ -0,0 +1,180 @@ +using UnityEngine; +using TMPro; +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +public class Polling : MonoBehaviour +{ + [Header("UI 參照")] + [Tooltip("Text (TMP) ")] + public TextMeshProUGUI pollingDisplay; + + private const int WH_MOUSE_LL = 14; + private const int WM_MOUSEMOVE = 0x0200; + + private delegate IntPtr LowLevelMouseProc(int nCode, IntPtr wParam, IntPtr lParam); + private static LowLevelMouseProc _proc; + private static IntPtr _hookID = IntPtr.Zero; + + private static Stopwatch stopwatch = new Stopwatch(); + private static long lastTicks = 0; + private static List intervals = new List(); + private static readonly object lockObj = new object(); + + // EMA + private double smoothedMs = 0; + private const double alpha = 0.25; + + // 無動作計時 + private List recentRates = new List(); + private float timeSinceLastEvent = 0f; + private const float idleTimeout = 2f; // 超過 2 秒沒動就歸零 + + void OnEnable() + { + stopwatch.Start(); + _proc = HookCallback; + _hookID = SetHook(_proc); + } + + void OnDisable() + { + UnhookWindowsHookEx(_hookID); + } + + private IntPtr SetHook(LowLevelMouseProc proc) + { + using (Process curProcess = Process.GetCurrentProcess()) + using (ProcessModule curModule = curProcess.MainModule) + { + return SetWindowsHookEx(WH_MOUSE_LL, proc, GetModuleHandle(curModule.ModuleName), 0); + } + } + + private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) + { + if (nCode >= 0 && wParam == (IntPtr)WM_MOUSEMOVE) + { + long currentTicks = stopwatch.ElapsedTicks; + if (lastTicks != 0) + { + double ms = (double)(currentTicks - lastTicks) / Stopwatch.Frequency * 1000.0; + + lock (lockObj) + { + if (ms > 0.001 && ms < 100.0) + { + intervals.Add(ms); + } + } + } + lastTicks = currentTicks; + } + return CallNextHookEx(_hookID, nCode, wParam, lParam); + } + + void Update() + { + List currentBatch; + lock (lockObj) + { + currentBatch = new List(intervals); + intervals.Clear(); + } + + if (currentBatch.Count > 0) + { + timeSinceLastEvent = 0f; + + double sum = 0; + foreach (var val in currentBatch) sum += val; + double batchAvgMs = sum / currentBatch.Count; + + if (smoothedMs == 0) + { + smoothedMs = batchAvgMs; + } + else + { + smoothedMs = (alpha * batchAvgMs) + ((1.0 - alpha) * smoothedMs); + } + + if (smoothedMs > 0) + { + double rawHz = 1000.0 / smoothedMs; + int standardHz = SnapToStandardPollingRate(rawHz); + recentRates.Add(standardHz); + } + } + else + { + timeSinceLastEvent += Time.unscaledDeltaTime; + } + + if (timeSinceLastEvent >= idleTimeout) + { + recentRates.Clear(); + smoothedMs = 0; + } + + // 更新 UI + if (pollingDisplay != null) + { + if (recentRates.Count > 0) + { + int maxHz = recentRates[0]; + foreach (int rate in recentRates) + { + if (rate >= maxHz) maxHz = rate; + } + + pollingDisplay.text = $"滑鼠回報率: {maxHz} Hz"; + + if (recentRates.Count > 60) + { + recentRates.RemoveAt(0); + } + } + else + { + pollingDisplay.text = "滑鼠回報率: 0 Hz"; + } + } + } + + private int SnapToStandardPollingRate(double rawHz) + { + int[] standardRates = {63, 125, 250, 500, 1000, 2000, 4000, 8000, 16000}; + int closestRate = standardRates[0]; + double minDifference = double.MaxValue; + + foreach (int rate in standardRates) + { + double diff = Math.Abs(rawHz - rate); + if (diff < minDifference) + { + minDifference = diff; + closestRate = rate; + } + } + + return closestRate; + } + + #region Win32 API 匯入 + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern IntPtr SetWindowsHookEx(int idHook, LowLevelMouseProc lpfn, IntPtr hMod, uint dwThreadId); + + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool UnhookWindowsHookEx(IntPtr hk); + + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern IntPtr CallNextHookEx(IntPtr hk, int nCode, IntPtr wParam, IntPtr lParam); + + [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern IntPtr GetModuleHandle(string lpModuleName); + #endregion +} \ No newline at end of file diff --git a/Assets/Stript/StartUI_Interactions/Polling.cs.meta b/Assets/Stript/StartUI_Interactions/Polling.cs.meta new file mode 100644 index 0000000..2c9f40b --- /dev/null +++ b/Assets/Stript/StartUI_Interactions/Polling.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: dbfae505c051b8241a378b2712dd7b5d \ No newline at end of file diff --git a/Assets/Stript/StartUI_Interactions/PollingRate.cs b/Assets/Stript/StartUI_Interactions/PollingRate.cs deleted file mode 100644 index deeb465..0000000 --- a/Assets/Stript/StartUI_Interactions/PollingRate.cs +++ /dev/null @@ -1,71 +0,0 @@ -using UnityEngine; -using UnityEngine.InputSystem; -using UnityEngine.InputSystem.LowLevel; -using System.Collections.Generic; - -public class MouseTrailLogger : MonoBehaviour -{ - // 定義單筆數據結構:包含時間戳記與當下的微小位移量 - [System.Serializable] - public struct MouseSample - { - public double timestamp; // 作業系統級別的時間戳記(秒,可換算為 ms) - public Vector2 delta; // 該瞬間的滑鼠位移量 (Delta) - } - - private List recordedSamples = new List(); - private bool isRecording = false; - - void OnEnable() - { - // 註冊 Input System 的底層事件攔截器 - InputSystem.onEvent += OnDataEvent; - } - - void OnDisable() - { - // 記得取消註冊,避免記憶體洩漏 - InputSystem.onEvent -= OnDataEvent; - } - - public void StartRecording() - { - recordedSamples.Clear(); - isRecording = true; - } - - public void StopRecording() - { - isRecording = false; - // 這裡可以把 recordedSamples 序列化成 JSON 準備上傳到 GitHub 或後端 - } - - private void OnDataEvent(InputEventPtr eventPtr, InputDevice device) - { - if (!isRecording) return; - - // 檢查這個事件是否由「滑鼠」發出,且是否包含狀態更新 - if (device is Mouse mouse) - { - // 判斷事件類型是否為滑鼠動態 (State Event) - if (eventPtr.IsA() || eventPtr.IsA()) - { - // 取得該事件發生時作業系統的高精度時間戳記 (Unscaled Time) - double eventTime = eventPtr.time; - - // 讀取當下的滑鼠位移量 - Vector2 mouseDelta = mouse.delta.ReadValue(); - - // 只有當滑鼠真有移動時才記錄,避免無效資料浪費記憶體 - if (mouseDelta != Vector2.zero) - { - recordedSamples.Add(new MouseSample - { - timestamp = eventTime, - delta = mouseDelta - }); - } - } - } - } -} \ No newline at end of file diff --git a/Assets/Stript/StartUI_Interactions/PollingRate.cs.meta b/Assets/Stript/StartUI_Interactions/PollingRate.cs.meta deleted file mode 100644 index 2056512..0000000 --- a/Assets/Stript/StartUI_Interactions/PollingRate.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 20bda67a74291514cac9cd232e2093ee \ No newline at end of file diff --git a/Assets/Stript/StartUI_Interactions/Sensitivity.cs b/Assets/Stript/StartUI_Interactions/Sensitivity.cs new file mode 100644 index 0000000..e4b1848 --- /dev/null +++ b/Assets/Stript/StartUI_Interactions/Sensitivity.cs @@ -0,0 +1,42 @@ +using UnityEngine; +using UnityEngine.UI; +using TMPro; + +public class Sensitivity : MonoBehaviour +{ + [Header("UI 參照")] + [Tooltip("Slider")] + public Slider targetSlider; + + [Tooltip("Text (TMP)")] + public TextMeshProUGUI valueDisplayText; + + void Start() + { + if (targetSlider != null) + { + targetSlider.minValue = 0.1f; + targetSlider.maxValue = 10.0f; + targetSlider.wholeNumbers = false; + + UpdateDisplayText(targetSlider.value); + + targetSlider.onValueChanged.AddListener(OnSliderValueChanged); + } + } + + void OnSliderValueChanged(float rawValue) + { + float steppedValue = Mathf.Round(rawValue * 10f) / 10f; + + UpdateDisplayText(steppedValue); + } + + void UpdateDisplayText(float val) + { + if (valueDisplayText != null) + { + valueDisplayText.text = $"靈敏度 : {val:F1}"; + } + } +} \ No newline at end of file diff --git a/Assets/Stript/StartUI_Interactions/Sensitivity.cs.meta b/Assets/Stript/StartUI_Interactions/Sensitivity.cs.meta new file mode 100644 index 0000000..29175c4 --- /dev/null +++ b/Assets/Stript/StartUI_Interactions/Sensitivity.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 0c0bf45cb5cebd14190d7c1e7ec7f6d7 \ No newline at end of file diff --git a/Assets/Stript/Test.meta b/Assets/Stript/Test.meta new file mode 100644 index 0000000..df99a5f --- /dev/null +++ b/Assets/Stript/Test.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 652d306d5da9f394ba03403e88093a84 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Stript/Test/Win32PollingAnalyzer.cs b/Assets/Stript/Test/Win32PollingAnalyzer.cs new file mode 100644 index 0000000..b755e69 --- /dev/null +++ b/Assets/Stript/Test/Win32PollingAnalyzer.cs @@ -0,0 +1,107 @@ +using UnityEngine; +using TMPro; +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Collections.Generic; + +public class Win32PollingAnalyzer : MonoBehaviour +{ + [Header("UI 參照")] + [Tooltip("請把顯示輪詢率的 Text (TMP) 拖進這裡")] + public TextMeshProUGUI pollingDisplay; + + private const int WH_MOUSE_LL = 14; + private const int WM_MOUSEMOVE = 0x0200; + + private delegate IntPtr LowLevelMouseProc(int nCode, IntPtr wParam, IntPtr lParam); + private static LowLevelMouseProc _proc; + private static IntPtr _hookID = IntPtr.Zero; + + private static Stopwatch stopwatch = new Stopwatch(); + private static long lastTicks = 0; + private static List intervals = new List(); + private static readonly object lockObj = new object(); + + void OnEnable() + { + stopwatch.Start(); + _proc = HookCallback; + // 在 Unity 啟動時安裝 Windows 底層滑鼠勾子 + _hookID = SetHook(_proc); + } + + void OnDisable() + { + // 離開或關閉時務必解除安裝,否則容易造成 Unity 編輯器卡頓 + UnhookWindowsHookEx(_hookID); + } + + private IntPtr SetHook(LowLevelMouseProc proc) + { + using (Process curProcess = Process.GetCurrentProcess()) + using (ProcessModule curModule = curProcess.MainModule) + { + return SetWindowsHookEx(WH_MOUSE_LL, proc, GetModuleHandle(curModule.ModuleName), 0); + } + } + + private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) + { + if (nCode >= 0 && wParam == (IntPtr)WM_MOUSEMOVE) + { + long currentTicks = stopwatch.ElapsedTicks; + if (lastTicks != 0) + { + // 計算兩次底層滑鼠事件之間的高精度毫秒差 + double ms = (double)(currentTicks - lastTicks) / Stopwatch.Frequency * 1000.0; + + lock (lockObj) + { + if (ms > 0.001 && ms < 100.0) // 過濾極端異常值 + { + intervals.Add(ms); + } + } + } + lastTicks = currentTicks; + } + return CallNextHookEx(_hookID, nCode, wParam, lParam); + } + + void Update() + { + // 每幀從清單中抓取並清空累積的數據,計算平均值更新到 UI + List currentBatch; + lock (lockObj) + { + currentBatch = new List(intervals); + intervals.Clear(); + } + + if (currentBatch.Count > 0 && pollingDisplay != null) + { + double sum = 0; + foreach (var val in currentBatch) sum += val; + double avgMs = sum / currentBatch.Count; + int hz = avgMs > 0 ? (int)Math.Round(1000.0 / avgMs) : 0; + + pollingDisplay.text = $"延遲: {avgMs:F2} ms | 實測回報率: {hz} Hz"; + } + } + + #region Win32 API 匯入 + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern IntPtr SetWindowsHookEx(int idHook, LowLevelMouseProc lpfn, IntPtr hMod, uint dwThreadId); + + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool UnhookWindowsHookEx(IntPtr hk); + + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern IntPtr CallNextHookEx(IntPtr hk, int nCode, IntPtr wParam, IntPtr lParam); + + [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern IntPtr GetModuleHandle(string lpModuleName); + #endregion +} \ No newline at end of file diff --git a/Assets/Stript/Test/Win32PollingAnalyzer.cs.meta b/Assets/Stript/Test/Win32PollingAnalyzer.cs.meta new file mode 100644 index 0000000..f0ea9fa --- /dev/null +++ b/Assets/Stript/Test/Win32PollingAnalyzer.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: f41105b446ed5b547a12f7b50c59d367 \ No newline at end of file diff --git a/Assets/Stript/Test/polling.cs b/Assets/Stript/Test/polling.cs new file mode 100644 index 0000000..a0c98ab --- /dev/null +++ b/Assets/Stript/Test/polling.cs @@ -0,0 +1,136 @@ +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; +using System.Threading; +using System.Collections.Generic; + +class Program +{ + private const int WH_MOUSE_LL = 14; + private const int WM_MOUSEMOVE = 0x0200; + + private delegate IntPtr LowLevelMouseProc(int nCode, IntPtr wParam, IntPtr lParam); + private static LowLevelMouseProc _proc = HookCallback; + private static IntPtr _hookID = IntPtr.Zero; + + private static Stopwatch stopwatch = Stopwatch.StartNew(); + private static long lastTicks = 0; + private static List intervals = new List(); + private static readonly object lockObj = new object(); + + static void Main(string[] args) + { + Console.WriteLine("========================================"); + Console.WriteLine("純 C# 獨立滑鼠輪詢率 (Polling Rate) 檢測工具"); + Console.WriteLine("請在視窗外「持續滑動滑鼠」..."); + Console.WriteLine("關閉主控台視窗即可結束。"); + Console.WriteLine("========================================"); + + // 安裝全域滑鼠 Hook + _hookID = SetHook(_proc); + + // 啟動背景執行緒,每 0.5 秒計算並印出數據 + Thread statsThread = new Thread(PrintStats); + statsThread.IsBackground = true; + statsThread.Start(); + + // Windows 低階 Hook 需要訊息迴圈 (Message Loop) 來接收事件 + MSG msg; + while (GetMessage(out msg, IntPtr.Zero, 0, 0) > 0) + { + TranslateMessage(ref msg); + DispatchMessage(ref msg); + } + + UnhookWindowsHookEx(_hookID); + } + + private static IntPtr SetHook(LowLevelMouseProc proc) + { + using (Process curProcess = Process.GetCurrentProcess()) + using (ProcessModule curModule = curProcess.MainModule) + { + return SetWindowsHookEx(WH_MOUSE_LL, proc, GetModuleHandle(curModule.ModuleName), 0); + } + } + + private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam) + { + if (nCode >= 0 && wParam == (IntPtr)WM_MOUSEMOVE) + { + long currentTicks = stopwatch.ElapsedTicks; + if (lastTicks != 0) + { + // 計算兩次滑鼠移動事件之間的高精度毫秒差 + double ms = (double)(currentTicks - lastTicks) / Stopwatch.Frequency * 1000.0; + + lock (lockObj) + { + if (ms > 0.001 && ms < 100.0) // 過濾異常極端值 + { + intervals.Add(ms); + } + } + } + lastTicks = currentTicks; + } + return CallNextHookEx(_hookID, nCode, wParam, lParam); + } + + private static void PrintStats() + { + while (true) + { + Thread.Sleep(500); + List currentBatch; + + lock (lockObj) + { + currentBatch = new List(intervals); + intervals.Clear(); + } + + if (currentBatch.Count > 0) + { + double sum = 0; + foreach (var val in currentBatch) sum += val; + double avgMs = sum / currentBatch.Count; + int hz = avgMs > 0 ? (int)Math.Round(1000.0 / avgMs) : 0; + + Console.WriteLine($"平均間隔: {avgMs,6:F2} ms | 實測回報率: {hz,5} Hz (樣本數: {currentBatch.Count})"); + } + else + { + Console.WriteLine("等待滑鼠移動..."); + } + } + } + + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern IntPtr SetWindowsHookEx(int idHook, LowLevelMouseProc lpfn, IntPtr hMod, uint dwThreadId); + + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + [return: MarshalAs(UnmanagedType.Bool)] + private static extern bool UnhookWindowsHookEx(IntPtr hk); + + [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern IntPtr CallNextHookEx(IntPtr hk, int nCode, IntPtr wParam, IntPtr lParam); + + [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern IntPtr GetModuleHandle(string lpModuleName); + + [DllImport("user32.dll")] + private static extern int GetMessage(out MSG lpMsg, IntPtr hWnd, uint wMsgFilterMin, uint wMsgFilterMax); + + [DllImport("user32.dll")] + private static extern bool TranslateMessage(ref MSG lpMsg); + + [DllImport("user32.dll")] + private static extern IntPtr DispatchMessage(ref MSG lpMsg); + + [StructLayout(LayoutKind.Sequential)] + public struct POINT { public int x; public int y; } + + [StructLayout(LayoutKind.Sequential)] + public struct MSG { public IntPtr hwnd; public uint message; public IntPtr wParam; public IntPtr lParam; public uint time; public POINT pt; } +} \ No newline at end of file diff --git a/Assets/Stript/Test/polling.cs.meta b/Assets/Stript/Test/polling.cs.meta new file mode 100644 index 0000000..bd93bb8 --- /dev/null +++ b/Assets/Stript/Test/polling.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 9707f3354094cab459e58a8aded637f1 \ No newline at end of file diff --git a/Assets/Stript/Test/polling.py b/Assets/Stript/Test/polling.py new file mode 100644 index 0000000..e0b79b4 --- /dev/null +++ b/Assets/Stript/Test/polling.py @@ -0,0 +1,44 @@ +import time +from pynput import mouse + +last_time = time.perf_counter() +event_intervals = [] + +def on_move(x, y): + global last_time + current_time = time.perf_counter() + delta = current_time - last_time + last_time = current_time + + if 0.0001 < delta < 0.1: + event_intervals.append(delta) + +def main(): + print("=" * 40) + print("滑鼠輪詢率 (Polling Rate) 獨立檢測工具") + print("請在視窗外「持續滑動滑鼠」以獲取數據...") + print("按 Ctrl + C 可以結束程式並查看統計") + print("=" * 40) + + listener = mouse.Listener(on_move=on_move) + listener.start() + + try: + while True: + time.sleep(0.5) + if event_intervals: + current_batch = event_intervals.copy() + event_intervals.clear() + + avg_interval = sum(current_batch) / len(current_batch) + hz = 1.0 / avg_interval if avg_interval > 0 else 0 + + print(f"平均間隔: {avg_interval * 1000:.2f} ms | 實測回報率: {round(hz):4d} Hz") + + except KeyboardInterrupt: + print("\n正在停止監聽...") + listener.stop() + print("已結束。") + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/Assets/Stript/Test/polling.py.meta b/Assets/Stript/Test/polling.py.meta new file mode 100644 index 0000000..ff8ba5a --- /dev/null +++ b/Assets/Stript/Test/polling.py.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: fe5e9aac1dc105f43a01d71557cccfaf +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: