From 2493cd8520c50db11bc91315535c10d7b29b3807 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Wed, 13 Nov 2024 13:55:36 +0800 Subject: [PATCH] =?UTF-8?q?Rom=E5=88=97=E8=A1=A8=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Resources/UIPrefabs/OverlayUI.meta | 8 + .../UIPrefabs/OverlayUI/InputUI.prefab | 450 ++++++++++++++++++ .../UIPrefabs/OverlayUI/InputUI.prefab.meta | 7 + .../UIPrefabs/OverlayUI/Overlay.prefab | 165 +++++++ .../UIPrefabs/OverlayUI/Overlay.prefab.meta | 7 + .../Assets/Scene/AxibugEmuOnline.Client.unity | 113 ++++- .../Assets/Script/Manager/HttpAPI.cs | 19 + .../Assets/Script/Manager/RomLib/RomLib.cs | 49 +- .../UI/CommandDispatcher/CommandExcuter.cs | 5 + .../Script/UI/GamesUI/RomListMenuItem.cs | 82 +++- .../Assets/Script/UI/MenuItem.cs | 14 +- .../Assets/Script/UI/OptionUI/OptionUI.cs | 20 +- .../Assets/Script/UI/OverlayUI.meta | 8 + .../Assets/Script/UI/OverlayUI/InputUI.cs | 54 +++ .../Script/UI/OverlayUI/InputUI.cs.meta | 11 + .../Script/UI/OverlayUI/OverlayManager.cs | 27 ++ .../UI/OverlayUI/OverlayManager.cs.meta | 11 + .../Assets/Script/UI/OverlayUI/OverlayUI.cs | 58 +++ .../Script/UI/OverlayUI/OverlayUI.cs.meta | 11 + .../Assets/Script/UI/SubMenuItemGroup.cs | 4 +- 20 files changed, 1091 insertions(+), 32 deletions(-) create mode 100644 AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OverlayUI.meta create mode 100644 AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OverlayUI/InputUI.prefab create mode 100644 AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OverlayUI/InputUI.prefab.meta create mode 100644 AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OverlayUI/Overlay.prefab create mode 100644 AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OverlayUI/Overlay.prefab.meta create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI.meta create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/InputUI.cs create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/InputUI.cs.meta create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/OverlayManager.cs create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/OverlayManager.cs.meta create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/OverlayUI.cs create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/OverlayUI.cs.meta diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OverlayUI.meta b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OverlayUI.meta new file mode 100644 index 0000000..c838e80 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OverlayUI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ae66a82f4821b1d4b8f77eb95a659c23 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OverlayUI/InputUI.prefab b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OverlayUI/InputUI.prefab new file mode 100644 index 0000000..344c61a --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OverlayUI/InputUI.prefab @@ -0,0 +1,450 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &653882822709289751 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5589934240202962389} + - component: {fileID: 3486608270429142847} + - component: {fileID: 1398156440816191940} + m_Layer: 5 + m_Name: Placeholder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5589934240202962389 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 653882822709289751} + 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: 5544196017830799039} + 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.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3486608270429142847 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 653882822709289751} + m_CullTransparentMesh: 1 +--- !u!114 &1398156440816191940 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 653882822709289751} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 75 + m_FontStyle: 2 + m_BestFit: 0 + m_MinSize: 1 + m_MaxSize: 100 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: Enter text... +--- !u!1 &3197032368305979763 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3638738785586139655} + - component: {fileID: 6120137949945203901} + - component: {fileID: 7765357008554011675} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3638738785586139655 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3197032368305979763} + 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: 5544196017830799039} + m_RootOrder: 1 + 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.5} + m_SizeDelta: {x: -20, y: -13} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6120137949945203901 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3197032368305979763} + m_CullTransparentMesh: 1 +--- !u!114 &7765357008554011675 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3197032368305979763} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, 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_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 75 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 1 + m_MaxSize: 100 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 0 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: +--- !u!1 &4732986731625205737 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5544196017830799039} + - component: {fileID: 7636621933174253281} + - component: {fileID: 4751957965008653128} + - component: {fileID: 2842545688870835167} + m_Layer: 5 + m_Name: InputField + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5544196017830799039 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4732986731625205737} + 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: + - {fileID: 5589934240202962389} + - {fileID: 3638738785586139655} + m_Father: {fileID: 7458324991124475286} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0.5} + m_AnchorMax: {x: 1, y: 0.5} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: -200, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7636621933174253281 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4732986731625205737} + m_CullTransparentMesh: 1 +--- !u!114 &4751957965008653128 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4732986731625205737} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + 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: 10911, 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!114 &2842545688870835167 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4732986731625205737} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d199490a83bb2b844b9695cbf13b01ef, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 4 + 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: 4751957965008653128} + m_TextComponent: {fileID: 7765357008554011675} + m_Placeholder: {fileID: 1398156440816191940} + m_ContentType: 0 + m_InputType: 0 + m_AsteriskChar: 42 + m_KeyboardType: 0 + m_LineType: 0 + m_HideMobileInput: 0 + m_CharacterValidation: 0 + m_CharacterLimit: 0 + m_OnEndEdit: + m_PersistentCalls: + m_Calls: [] + m_OnValueChanged: + m_PersistentCalls: + m_Calls: [] + m_CaretColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_CustomCaretColor: 0 + m_SelectionColor: {r: 0.65882355, g: 0.80784315, b: 1, a: 0.7529412} + m_Text: + m_CaretBlinkRate: 0.85 + m_CaretWidth: 1 + m_ReadOnly: 0 + m_ShouldActivateOnSelect: 1 +--- !u!1 &5812039901955765352 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 7458324991124475286} + - component: {fileID: 1811275770296273178} + - component: {fileID: 6422235873759818477} + - component: {fileID: 5841450604621234090} + m_Layer: 5 + m_Name: Root + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &7458324991124475286 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5812039901955765352} + 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: + - {fileID: 5544196017830799039} + m_Father: {fileID: 5891255890837614045} + 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!225 &1811275770296273178 +CanvasGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5812039901955765352} + m_Enabled: 1 + m_Alpha: 1 + m_Interactable: 1 + m_BlocksRaycasts: 1 + m_IgnoreParentGroups: 0 +--- !u!222 &6422235873759818477 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5812039901955765352} + m_CullTransparentMesh: 1 +--- !u!114 &5841450604621234090 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5812039901955765352} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0, g: 0, b: 0, a: 0.5019608} + 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: 0} + m_Type: 0 + 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!1 &5891255890837614044 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5891255890837614045} + - component: {fileID: 5891255890837614042} + m_Layer: 5 + m_Name: InputUI + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5891255890837614045 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5891255890837614044} + 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: + - {fileID: 7458324991124475286} + m_Father: {fileID: 0} + 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!114 &5891255890837614042 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5891255890837614044} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d366ee5eba9505c4ca908df5cfb35585, type: 3} + m_Name: + m_EditorClassIdentifier: + PulseInvoke_Delay: 0.4 + PulseInvoke_Interval: 0.05 + StartAlpha: 0 + StartScale: 1.2 + Duration: 0.5 + Ease: 12 + m_root: {fileID: 7458324991124475286} + m_cg: {fileID: 1811275770296273178} + m_input: {fileID: 2842545688870835167} diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OverlayUI/InputUI.prefab.meta b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OverlayUI/InputUI.prefab.meta new file mode 100644 index 0000000..fd67cf0 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OverlayUI/InputUI.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 179ef233a0b40a74f8df0748c664b5e8 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OverlayUI/Overlay.prefab b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OverlayUI/Overlay.prefab new file mode 100644 index 0000000..b34362c --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OverlayUI/Overlay.prefab @@ -0,0 +1,165 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &3531919739338806916 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 3531919739338806919} + - component: {fileID: 3531919739338806918} + m_Layer: 5 + m_Name: Overlay + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &3531919739338806919 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3531919739338806916} + 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: + - {fileID: 3531919739979819162} + m_Father: {fileID: 0} + 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!114 &3531919739338806918 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3531919739338806916} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 83ac6a2a0673d154cb98c7cc45663eb5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_InputUI: {fileID: 3531919739979819165} +--- !u!1001 &6972157500961473863 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 3531919739338806919} + m_Modifications: + - target: {fileID: 5891255890837614044, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_Name + value: InputUI + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_RootOrder + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} +--- !u!224 &3531919739979819162 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 5891255890837614045, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + m_PrefabInstance: {fileID: 6972157500961473863} + m_PrefabAsset: {fileID: 0} +--- !u!114 &3531919739979819165 stripped +MonoBehaviour: + m_CorrespondingSourceObject: {fileID: 5891255890837614042, guid: 179ef233a0b40a74f8df0748c664b5e8, type: 3} + m_PrefabInstance: {fileID: 6972157500961473863} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d366ee5eba9505c4ca908df5cfb35585, type: 3} + m_Name: + m_EditorClassIdentifier: diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OverlayUI/Overlay.prefab.meta b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OverlayUI/Overlay.prefab.meta new file mode 100644 index 0000000..fadfc43 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OverlayUI/Overlay.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 1de15a80c8c1aa94486563740a15d91c +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity b/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity index 0ddffa6..cbe4d3a 100644 --- a/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity +++ b/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity @@ -173,7 +173,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_FirstSelected: {fileID: 0} - m_sendNavigationEvents: 1 + m_sendNavigationEvents: 0 m_DragThreshold: 10 --- !u!4 &74796459 Transform: @@ -9537,6 +9537,10 @@ PrefabInstance: propertyPath: m_AnchoredPosition.x value: 0 objectReference: {fileID: 0} + - target: {fileID: 6354166569501586286, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} + propertyPath: m_Padding.m_Right + value: 24 + objectReference: {fileID: 0} - target: {fileID: 6354166569501586286, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} propertyPath: m_ChildControlHeight value: 1 @@ -13231,6 +13235,11 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} +--- !u!224 &939125854 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + m_PrefabInstance: {fileID: 3531919738450164441} + m_PrefabAsset: {fileID: 0} --- !u!224 &1318590597 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 1963501579241001456, guid: 334eee9f85f308347844f8f5e99167c3, type: 3} @@ -13450,6 +13459,7 @@ RectTransform: - {fileID: 1983793178} - {fileID: 246947326} - {fileID: 1318590597} + - {fileID: 939125854} m_Father: {fileID: 1335662459} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -13643,6 +13653,107 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 334eee9f85f308347844f8f5e99167c3, type: 3} +--- !u!1001 &3531919738450164441 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1599240741} + m_Modifications: + - target: {fileID: 3531919739338806916, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_Name + value: Overlay + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_RootOrder + value: 3 + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3531919739338806919, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 3531919739979819163, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} + propertyPath: m_IsActive + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 1de15a80c8c1aa94486563740a15d91c, type: 3} --- !u!1001 &4478785627007410708 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/AxibugEmuOnline.Client/Assets/Script/Manager/HttpAPI.cs b/AxibugEmuOnline.Client/Assets/Script/Manager/HttpAPI.cs index e7e588a..aec8bfd 100644 --- a/AxibugEmuOnline.Client/Assets/Script/Manager/HttpAPI.cs +++ b/AxibugEmuOnline.Client/Assets/Script/Manager/HttpAPI.cs @@ -13,12 +13,31 @@ namespace AxibugEmuOnline.Client public string WebSiteApi => WebHost + "/api"; public delegate void GetRomListAPI(Action callback, int page, int pageSize = 10); + public delegate void SearchRomListAPI(Action callback, string searchKey, int page, int pageSize = 10); public void GetNesRomList(Action callback, int page, int pageSize = 10) { App.StartCoroutine(GetNesRomListFlow(page, pageSize, callback)); } + public void SearchNesRomList(Action callback, string searchKey, int page, int pageSize = 10) + { + App.StartCoroutine(SearchNesRomListFlow(searchKey, page, pageSize, callback)); + } + private IEnumerator SearchNesRomListFlow(string searchKey, int page, int pageSize, Action callback) + { + UnityWebRequest request = UnityWebRequest.Get($"{WebSiteApi}/NesRomList?Page={page}&PageSize={pageSize}&SearchKey={searchKey}"); + yield return request.SendWebRequest(); + + if (request.result != UnityWebRequest.Result.Success) + { + callback.Invoke(null); + yield break; + } + + var resp = JsonUtility.FromJson(request.downloadHandler.text); + callback.Invoke(resp); + } private IEnumerator GetNesRomListFlow(int page, int pageSize, Action callback) { UnityWebRequest request = UnityWebRequest.Get($"{WebSiteApi}/NesRomList?Page={page}&PageSize={pageSize}"); diff --git a/AxibugEmuOnline.Client/Assets/Script/Manager/RomLib/RomLib.cs b/AxibugEmuOnline.Client/Assets/Script/Manager/RomLib/RomLib.cs index 8e5dfb6..7e1241d 100644 --- a/AxibugEmuOnline.Client/Assets/Script/Manager/RomLib/RomLib.cs +++ b/AxibugEmuOnline.Client/Assets/Script/Manager/RomLib/RomLib.cs @@ -18,6 +18,7 @@ namespace AxibugEmuOnline.Client private Dictionary nesRomFileIdMapper = new Dictionary(); private Dictionary nesRomFileNameMapper = new Dictionary(); private HttpAPI.GetRomListAPI m_romGetFunc; + private HttpAPI.SearchRomListAPI m_romSearchFunc; private EnumPlatform m_platform; public RomLib(EnumPlatform platform) @@ -27,6 +28,7 @@ namespace AxibugEmuOnline.Client { case EnumPlatform.NES: m_romGetFunc = App.httpAPI.GetNesRomList; + m_romSearchFunc = App.httpAPI.SearchNesRomList; break; } } @@ -67,23 +69,44 @@ namespace AxibugEmuOnline.Client /// 获得所有Rom文件 /// /// - public void FetchRomCount(Action callback) + public void FetchRomCount(Action callback, string searchKey = null) { - m_romGetFunc((romList) => + if (string.IsNullOrWhiteSpace(searchKey)) { - FetchPageCmd.Clear(); - nesRomFileIdMapper.Clear(); - nesRomFileNameMapper.Clear(); - nesRomFetchList = new RomFile[romList.resultAllCount]; - for (int i = 0; i < nesRomFetchList.Length; i++) + m_romGetFunc((romList) => { - //以后考虑用对象池实例化RomFile - nesRomFetchList[i] = new RomFile(m_platform, i, i / PAGE_SIZE); - } - SaveRomInfoFromWeb(romList); + FetchPageCmd.Clear(); + nesRomFileIdMapper.Clear(); + nesRomFileNameMapper.Clear(); + nesRomFetchList = new RomFile[romList.resultAllCount]; + for (int i = 0; i < nesRomFetchList.Length; i++) + { + //以后考虑用对象池实例化RomFile + nesRomFetchList[i] = new RomFile(m_platform, i, i / PAGE_SIZE); + } + SaveRomInfoFromWeb(romList); - callback.Invoke(nesRomFetchList); - }, 0, PAGE_SIZE); + callback.Invoke(nesRomFetchList); + }, 0, PAGE_SIZE); + } + else + { + m_romSearchFunc((romList) => + { + FetchPageCmd.Clear(); + nesRomFileIdMapper.Clear(); + nesRomFileNameMapper.Clear(); + nesRomFetchList = new RomFile[romList.resultAllCount]; + for (int i = 0; i < nesRomFetchList.Length; i++) + { + //以后考虑用对象池实例化RomFile + nesRomFetchList[i] = new RomFile(m_platform, i, i / PAGE_SIZE); + } + SaveRomInfoFromWeb(romList); + + callback.Invoke(nesRomFetchList); + }, searchKey, 0, PAGE_SIZE); + } } public void BeginFetchRomInfo(RomFile romFile) diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs index 7a324a2..ce71d3c 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs @@ -28,6 +28,10 @@ namespace AxibugEmuOnline.Client m_pulsInvoker_Down = new PulseInvoker(OnCmdSelectItemDown, PulseInvoke_Delay, PulseInvoke_Interval); } + protected virtual void OnEnable() { } + protected virtual void OnDisable() { } + protected virtual void OnDestroy() { } + protected virtual void Update() { m_pulsInvoker_Left.Update(Time.deltaTime); @@ -36,6 +40,7 @@ namespace AxibugEmuOnline.Client m_pulsInvoker_Down.Update(Time.deltaTime); } + public void ResetPulsInvoker() { m_pulsInvoker_Left.DisActive(); diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/GamesUI/RomListMenuItem.cs b/AxibugEmuOnline.Client/Assets/Script/UI/GamesUI/RomListMenuItem.cs index c337bd5..aacebc1 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/GamesUI/RomListMenuItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/GamesUI/RomListMenuItem.cs @@ -1,7 +1,6 @@ using AxibugEmuOnline.Client.ClientCore; -using AxibugEmuOnline.Client.UI; -using Codice.Client.Common; using System; +using System.Collections.Generic; using UnityEngine; namespace AxibugEmuOnline.Client @@ -25,9 +24,84 @@ namespace AxibugEmuOnline.Client } } + private List m_options; + + protected override void Awake() + { + base.Awake(); + + m_options = new List() + { + new OptMenu_Search(this), + new OptMenu_ShowAll(this), + }; + } + + public string SearchKey; protected override void GetVirtualListDatas(Action datas) { - RomLib.FetchRomCount((roms) => datas.Invoke(roms)); - } + RomLib.FetchRomCount((roms) => datas.Invoke(roms), SearchKey); + } + + public override bool OnEnterItem() + { + var res = base.OnEnterItem(); + if (res) CommandDispatcher.Instance.RegistController(this); + + return true; + } + + public override bool OnExitItem() + { + var res = base.OnExitItem(); + if (res) CommandDispatcher.Instance.UnRegistController(this); + + return false; + } + + + protected override void OnCmdOptionMenu() + { + OptionUI.Instance.Pop(m_options); + } + + public class OptMenu_Search : ExecuteMenu + { + private RomListMenuItem m_romListUI; + + public OptMenu_Search(RomListMenuItem romListUI, Sprite icon = null) : base("", icon) + { + m_romListUI = romListUI; + } + + public override void OnExcute() + { + OverlayManager.Input((OnSearchCommit, "Rom", null)); + } + + private void OnSearchCommit(string text) + { + m_romListUI.SearchKey = text; + m_romListUI.RefreshUI(); + } + } + + public class OptMenu_ShowAll : ExecuteMenu + { + private RomListMenuItem m_ui; + + public override bool Visible => !string.IsNullOrWhiteSpace(m_ui.SearchKey); + + public OptMenu_ShowAll(RomListMenuItem romListUI,Sprite icon = null) : base("ʾȫ", icon) + { + m_ui = romListUI; + } + + public override void OnExcute() + { + m_ui.SearchKey = null; + m_ui.RefreshUI(); + } + } } } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs b/AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs index e385778..815613c 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs @@ -6,7 +6,7 @@ using UnityEngine.UI; namespace AxibugEmuOnline.Client.UI { - public class MenuItem : MonoBehaviour + public class MenuItem : CommandExecuter { [SerializeField] protected Image Icon; @@ -32,16 +32,12 @@ namespace AxibugEmuOnline.Client.UI protected TweenerCore progressTween; protected float m_progress; - protected virtual void Awake() + protected override void Awake() { + base.Awake(); Reset(); } - protected virtual void OnDestroy() - { - - } - public void SetData(MenuData data) { Reset(); @@ -57,7 +53,7 @@ namespace AxibugEmuOnline.Client.UI m_progress = 0f; Root.localScale = Vector3.one * UnSelectScale; - + if (progressTween != null) { progressTween.Kill(); progressTween = null; } if (ShadowIcon != null) ShadowIcon.gameObject.SetActive(false); @@ -107,5 +103,7 @@ namespace AxibugEmuOnline.Client.UI public virtual bool OnEnterItem() => true; public virtual bool OnExitItem() => true; + + public override bool Enable => true; } } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs index 4a3fba2..99f9dad 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs @@ -34,7 +34,7 @@ namespace AxibugEmuOnline.Client { value = Mathf.Clamp(value, 0, m_runtimeMenuItems.Count - 1); if (m_selectIndex == value) return; - + m_selectIndex = value; OptionUI_MenuItem optionUI_MenuItem = m_runtimeMenuItems[m_selectIndex]; @@ -82,6 +82,8 @@ namespace AxibugEmuOnline.Client } if (dirty) { + Canvas.ForceUpdateCanvases(); + if (m_runtimeMenuItems[SelectIndex].Visible == false) { bool find = false; @@ -110,6 +112,14 @@ namespace AxibugEmuOnline.Client if (find) SelectIndex = currentSelect; } + else + { + var selectItem = m_runtimeMenuItems[SelectIndex]; + var itemUIRect = selectItem.transform as RectTransform; + SelectBorder.pivot = itemUIRect.pivot; + SelectBorder.position = itemUIRect.position; + SelectBorder.sizeDelta = itemUIRect.rect.size; + } } } @@ -195,6 +205,10 @@ namespace AxibugEmuOnline.Client menuUI.SetData(executeMenu); m_runtimeMenuItems.Add(menuUI); } + else + { + throw new NotImplementedException($"ݲֵ֧IJ˵{menuData.GetType().Name}"); + } } private void ReleaseRuntimeMenus() @@ -244,11 +258,11 @@ namespace AxibugEmuOnline.Client } } - public class ExecuteMenu : OptionMenu + public abstract class ExecuteMenu : OptionMenu { public ExecuteMenu(string name, Sprite icon = null) : base(name, icon) { } - public virtual void OnExcute() { } + public abstract void OnExcute(); } public abstract class ValueSetMenu : OptionMenu diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI.meta b/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI.meta new file mode 100644 index 0000000..d655184 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6e1182d93bb09194297cdd775186071a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/InputUI.cs b/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/InputUI.cs new file mode 100644 index 0000000..43a9186 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/InputUI.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections; +using UnityEngine; +using UnityEngine.UI; + +namespace AxibugEmuOnline.Client +{ + public class InputUI : OverlayUI + { + [SerializeField] + InputField m_input; + + Action OnCommit; + + + protected override void OnShow(object param) + { + (Action callback, string placeHolder, string defaultText) t = ((Action callback, string placeHolder, string defaultText))param; + + OnCommit = t.callback; + (m_input.placeholder as Text).text = t.placeHolder; + m_input.text = t.defaultText; + } + + protected override void OnEnable() + { + base.OnEnable(); + + StartCoroutine(ActiveInput()); + } + + private IEnumerator ActiveInput() + { + yield return new WaitForEndOfFrame(); + + m_input.Select(); + m_input.ActivateInputField(); + + yield break; + } + + protected override bool OnCmdEnter() + { + OnCommit?.Invoke(m_input.text); + Close(); + return true; + } + + protected override void OnCmdBack() + { + Close(); + } + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/InputUI.cs.meta b/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/InputUI.cs.meta new file mode 100644 index 0000000..bd4edc8 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/InputUI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d366ee5eba9505c4ca908df5cfb35585 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/OverlayManager.cs b/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/OverlayManager.cs new file mode 100644 index 0000000..16eb9e9 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/OverlayManager.cs @@ -0,0 +1,27 @@ +using System; +using UnityEngine; + +namespace AxibugEmuOnline.Client +{ + public class OverlayManager : MonoBehaviour + { + static OverlayManager s_ins; + + [SerializeField] + InputUI m_InputUI; + + private void Awake() + { + s_ins = this; + + m_InputUI.gameObject.SetActive(false); + } + + public static InputUI Input((Action callback, string placeHolder, string defaultText) param) + { + s_ins.m_InputUI.Show(param); + + return s_ins.m_InputUI; + } + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/OverlayManager.cs.meta b/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/OverlayManager.cs.meta new file mode 100644 index 0000000..1c8a0ea --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/OverlayManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 83ac6a2a0673d154cb98c7cc45663eb5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/OverlayUI.cs b/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/OverlayUI.cs new file mode 100644 index 0000000..083ead2 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/OverlayUI.cs @@ -0,0 +1,58 @@ +using DG.Tweening; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace AxibugEmuOnline.Client +{ + public abstract class OverlayUI : CommandExecuter + { + public override bool AloneMode => true; + public override bool Enable => true; + + public float StartAlpha = 0; + public float StartScale = 1.2f; + public float Duration = 0.5f; + public Ease Ease; + + [SerializeField] + protected Transform m_root; + [SerializeField] + protected CanvasGroup m_cg; + + protected override void OnEnable() + { + base.OnEnable(); + + float progress = 0; + DOTween.To(() => progress, (x) => + { + progress = x; + m_cg.alpha = Mathf.Lerp(StartAlpha, 1, x); + m_root.localScale = Vector3.Lerp(Vector3.one * StartScale, Vector3.one, x); + }, 1, Duration).SetEase(Ease).SetLink(gameObject, LinkBehaviour.KillOnDisable); + + CommandDispatcher.Instance.RegistController(this); + } + + protected override void OnDisable() + { + base.OnDisable(); + + CommandDispatcher.Instance.UnRegistController(this); + } + + public void Show(object param) + { + gameObject.SetActive(true); + OnShow(param); + } + public void Close() + { + OnClose(); + gameObject.SetActive(false); + } + protected abstract void OnShow(object param); + protected virtual void OnClose() { } + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/OverlayUI.cs.meta b/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/OverlayUI.cs.meta new file mode 100644 index 0000000..8a58bb7 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OverlayUI/OverlayUI.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e46843c32ed1d454fb95a0c99728b6f4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/SubMenuItemGroup.cs b/AxibugEmuOnline.Client/Assets/Script/UI/SubMenuItemGroup.cs index 8474398..85dfe70 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/SubMenuItemGroup.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/SubMenuItemGroup.cs @@ -1,9 +1,7 @@ using AxibugEmuOnline.Client.UI; -using Codice.Utils; using DG.Tweening; using DG.Tweening.Core; using DG.Tweening.Plugins.Options; -using System; using System.Collections.Generic; using UnityEngine; @@ -188,7 +186,7 @@ namespace AxibugEmuOnline.Client #if UNITY_EDITOR if (Application.isPlaying) { - var item= GameObject.Instantiate(template.gameObject, parent).GetComponent(); + var item = GameObject.Instantiate(template.gameObject, parent).GetComponent(); item.transform.localPosition = Vector3.zero; return item; }