From 86ec353733265fa82fff8524351762d45df0ef44 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Thu, 12 Sep 2024 11:02:30 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8DUI=E8=A1=A8=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AxibugEmuOnline.Client/Assets/Script/UI/Game_NES.cs | 6 ++++-- AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs | 6 +++++- .../Assets/Script/UI/ThirdMenuRoot.cs | 11 ++++++++++- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/Game_NES.cs b/AxibugEmuOnline.Client/Assets/Script/UI/Game_NES.cs index a22f046..a772f8b 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/Game_NES.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/Game_NES.cs @@ -13,8 +13,10 @@ namespace AxibugEmuOnline.Client CanvasGroup RomGroupRoot; private TweenerCore m_showTween; - private void Awake() + protected override void Awake() { + base.Awake(); + RomGroupRoot.gameObject.SetActive(false); RomGroupRoot.alpha = 0; } @@ -58,7 +60,7 @@ namespace AxibugEmuOnline.Client thirdMenuGroup.itemGroup.UpdateDependencyProperty(thirdMenuGroup); thirdMenuGroup.itemGroup.SetData(roms); thirdMenuGroup.itemGroup.UpdateProxyVisualState(); - thirdMenuGroup.SelectIndex = 0; + thirdMenuGroup.ResetToFirst(); }); if (SubMenuItemGroup != null) SubMenuItemGroup.SetSelect(true); diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs b/AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs index e4ed2f2..2adfc87 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs @@ -33,6 +33,11 @@ namespace AxibugEmuOnline.Client.UI protected TweenerCore progressTween; protected float m_progress; + protected virtual void Awake() + { + Reset(); + } + public void SetData(MenuData data) { Reset(); @@ -47,7 +52,6 @@ namespace AxibugEmuOnline.Client.UI m_select = false; m_progress = 0f; - if (InfoNode != null) InfoNode.alpha = 0; Root.localScale = Vector3.one * UnSelectScale; if (progressTween != null) { progressTween.Kill(); progressTween = null; } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/ThirdMenuRoot.cs b/AxibugEmuOnline.Client/Assets/Script/UI/ThirdMenuRoot.cs index d7217ad..74b6a40 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/ThirdMenuRoot.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/ThirdMenuRoot.cs @@ -39,6 +39,12 @@ namespace AxibugEmuOnline.Client } } + public void ResetToFirst() + { + m_selectIndex = -1; + SelectIndex = 0; + } + protected override MenuItem GetItemUIByIndex(int index) { return itemGroup.GetItemUIByDataIndex(index).GetComponent(); @@ -89,7 +95,10 @@ namespace AxibugEmuOnline.Client if (!useAnim) srollRect.content.anchoredPosition += new Vector2(0, gap); else - srollRect.content.anchoredPosition += new Vector2(0, gap); + { + var endValue = srollRect.content.anchoredPosition + new Vector2(0, gap); + DOTween.To(() => srollRect.content.anchoredPosition, (x) => srollRect.content.anchoredPosition = x, endValue, 0.125f); + } } Vector3[] corner = new Vector3[4]; From e90d74e63c05594dde1dcc9623417f8a4697d95c Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Thu, 12 Sep 2024 11:19:40 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=BB=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Resources/UIPrefabs/LaunchUI.prefab | 278 ++------------- .../Assets/Scene/AxibugEmuOnline.Client.unity | 322 +++++++++++++++++- .../Assets/Script/UI/MenuItem.cs | 5 +- .../Assets/Script/UI/OptionMenu.cs | 21 ++ .../Assets/Script/UI/OptionMenu.cs.meta | 11 + 5 files changed, 367 insertions(+), 270 deletions(-) create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/OptionMenu.cs create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/OptionMenu.cs.meta diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/LaunchUI.prefab b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/LaunchUI.prefab index 658ad61..d058f0d 100644 --- a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/LaunchUI.prefab +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/LaunchUI.prefab @@ -1,154 +1,5 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!1 &820229125 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 820229128} - - component: {fileID: 820229127} - - component: {fileID: 820229126} - m_Layer: 0 - m_Name: EventSystem - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &820229128 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 820229125} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -960, y: -540, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 1639091784002085428} - m_RootOrder: 1 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &820229127 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 820229125} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} - m_Name: - m_EditorClassIdentifier: - m_FirstSelected: {fileID: 0} - m_sendNavigationEvents: 1 - m_DragThreshold: 10 ---- !u!114 &820229126 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 820229125} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} - m_Name: - m_EditorClassIdentifier: - m_HorizontalAxis: Horizontal - m_VerticalAxis: Vertical - m_SubmitButton: Submit - m_CancelButton: Cancel - m_InputActionsPerSecond: 10 - m_RepeatDelay: 0.5 - m_ForceModuleActive: 0 ---- !u!1 &1355724343 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1355724346} - - component: {fileID: 1355724345} - - component: {fileID: 1355724344} - m_Layer: 0 - m_Name: Main Camera - m_TagString: MainCamera - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &1355724346 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1355724343} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -960, y: -539, z: -10} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 1639091784002085428} - m_RootOrder: 0 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!20 &1355724345 -Camera: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1355724343} - m_Enabled: 1 - serializedVersion: 2 - m_ClearFlags: 1 - m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} - m_projectionMatrixMode: 1 - m_GateFitMode: 2 - m_FOVAxisMode: 0 - m_SensorSize: {x: 36, y: 24} - m_LensShift: {x: 0, y: 0} - m_FocalLength: 50 - m_NormalizedViewPortRect: - serializedVersion: 2 - x: 0 - y: 0 - width: 1 - height: 1 - near clip plane: 0.3 - far clip plane: 1000 - field of view: 60 - orthographic: 0 - orthographic size: 5 - m_Depth: -1 - m_CullingMask: - serializedVersion: 2 - m_Bits: 4294967295 - m_RenderingPath: -1 - m_TargetTexture: {fileID: 0} - m_TargetDisplay: 0 - m_TargetEye: 3 - m_HDR: 1 - m_AllowMSAA: 1 - m_AllowDynamicResolution: 0 - m_ForceIntoRT: 0 - m_OcclusionCulling: 1 - m_StereoConvergence: 10 - m_StereoSeparation: 0.022 ---- !u!81 &1355724344 -AudioListener: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1355724343} - m_Enabled: 1 --- !u!1 &1924338506 GameObject: m_ObjectHideFlags: 0 @@ -178,7 +29,7 @@ RectTransform: m_Children: - {fileID: 6855144573435021451} m_Father: {fileID: 1639091784002085428} - m_RootOrder: 4 + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -234,9 +85,9 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: fb4f275956ba18440b061e92278f13cd, type: 3} m_Name: m_EditorClassIdentifier: + m_menuItemRoot: {fileID: 7102897325704768026} PulseInvoke_Delay: 0.4 PulseInvoke_Interval: 0.05 - m_menuItemRoot: {fileID: 7102897325704768026} GroupRoot: {fileID: 5247317738185020566} Template: {fileID: 2502609279043838113, guid: ece591129eb9bcc48bd83ec153c98018, type: 3} MenuSetting: @@ -371,7 +222,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 1639091784002085428} - m_RootOrder: 2 + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} @@ -426,8 +277,6 @@ GameObject: m_Component: - component: {fileID: 1639091784002085428} - component: {fileID: 8460114235823285599} - - component: {fileID: 1797058509527648109} - - component: {fileID: 1789270450140393263} m_Layer: 5 m_Name: LaunchUI m_TagString: Untagged @@ -444,12 +293,9 @@ RectTransform: m_GameObject: {fileID: 1639091784002085451} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - - {fileID: 1355724346} - - {fileID: 820229128} - {fileID: 1639091783724093883} - - {fileID: 2355022013370943017} - {fileID: 1924338507} m_Father: {fileID: 0} m_RootOrder: 0 @@ -475,92 +321,6 @@ MonoBehaviour: MainMenu: {fileID: 4533431376032812611} m_detailLayoutPosition: {x: 55, y: -140} m_LayoutChangeSpeed: 1000 ---- !u!223 &1797058509527648109 -Canvas: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1639091784002085451} - m_Enabled: 1 - serializedVersion: 3 - m_RenderMode: 0 - m_Camera: {fileID: 0} - m_PlaneDistance: 100 - m_PixelPerfect: 0 - m_ReceivesEvents: 1 - m_OverrideSorting: 0 - m_OverridePixelPerfect: 0 - m_SortingBucketNormalizedSize: 0 - m_AdditionalShaderChannelsFlag: 1 - m_SortingLayerID: 0 - m_SortingOrder: 0 - m_TargetDisplay: 0 ---- !u!114 &1789270450140393263 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1639091784002085451} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} - m_Name: - m_EditorClassIdentifier: - m_IgnoreReversedGraphics: 1 - m_BlockingObjects: 0 - m_BlockingMask: - serializedVersion: 2 - m_Bits: 32 ---- !u!1 &2556464728420224707 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 2355022013370943017} - - component: {fileID: 4512092057495325491} - m_Layer: 5 - m_Name: CommandDispatcher - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &2355022013370943017 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2556464728420224707} - 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: 1639091784002085428} - m_RootOrder: 3 - 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_SizeDelta: {x: 100, y: 100} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &4512092057495325491 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 2556464728420224707} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4471d8231d16ba3469228e09d4cb3a81, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1 &3732356966700017678 GameObject: m_ObjectHideFlags: 0 @@ -1715,16 +1475,16 @@ PrefabInstance: objectReference: {fileID: 21300000, guid: c300d49e84cf0fb4186c750320e50146, type: 3} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: ece591129eb9bcc48bd83ec153c98018, type: 3} ---- !u!224 &200175573067837263 stripped -RectTransform: - m_CorrespondingSourceObject: {fileID: 1998281097548910301, guid: ece591129eb9bcc48bd83ec153c98018, type: 3} - m_PrefabInstance: {fileID: 1836475297758503314} - m_PrefabAsset: {fileID: 0} --- !u!224 &3871933347447045354 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 3226730524206505336, guid: ece591129eb9bcc48bd83ec153c98018, type: 3} m_PrefabInstance: {fileID: 1836475297758503314} m_PrefabAsset: {fileID: 0} +--- !u!224 &200175573067837263 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 1998281097548910301, guid: ece591129eb9bcc48bd83ec153c98018, type: 3} + m_PrefabInstance: {fileID: 1836475297758503314} + m_PrefabAsset: {fileID: 0} --- !u!1001 &3526319057829025666 PrefabInstance: m_ObjectHideFlags: 0 @@ -1830,16 +1590,16 @@ PrefabInstance: objectReference: {fileID: 21300000, guid: 8706af46c93329b4da3c86c0b13b886e, type: 3} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: ece591129eb9bcc48bd83ec153c98018, type: 3} ---- !u!224 &3119677798517643615 stripped -RectTransform: - m_CorrespondingSourceObject: {fileID: 1998281097548910301, guid: ece591129eb9bcc48bd83ec153c98018, type: 3} - m_PrefabInstance: {fileID: 3526319057829025666} - m_PrefabAsset: {fileID: 0} --- !u!224 &2033276478374529786 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 3226730524206505336, guid: ece591129eb9bcc48bd83ec153c98018, type: 3} m_PrefabInstance: {fileID: 3526319057829025666} m_PrefabAsset: {fileID: 0} +--- !u!224 &3119677798517643615 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 1998281097548910301, guid: ece591129eb9bcc48bd83ec153c98018, type: 3} + m_PrefabInstance: {fileID: 3526319057829025666} + m_PrefabAsset: {fileID: 0} --- !u!1001 &4164567408330100520 PrefabInstance: m_ObjectHideFlags: 0 @@ -3141,16 +2901,16 @@ PrefabInstance: objectReference: {fileID: 21300000, guid: 8706af46c93329b4da3c86c0b13b886e, type: 3} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: ece591129eb9bcc48bd83ec153c98018, type: 3} ---- !u!224 &8316363507104801344 stripped -RectTransform: - m_CorrespondingSourceObject: {fileID: 1998281097548910301, guid: ece591129eb9bcc48bd83ec153c98018, type: 3} - m_PrefabInstance: {fileID: 7553375082048335005} - m_PrefabAsset: {fileID: 0} --- !u!224 &4905929412244550117 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 3226730524206505336, guid: ece591129eb9bcc48bd83ec153c98018, type: 3} m_PrefabInstance: {fileID: 7553375082048335005} m_PrefabAsset: {fileID: 0} +--- !u!224 &8316363507104801344 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 1998281097548910301, guid: ece591129eb9bcc48bd83ec153c98018, type: 3} + m_PrefabInstance: {fileID: 7553375082048335005} + m_PrefabAsset: {fileID: 0} --- !u!1001 &7707851465888658123 PrefabInstance: m_ObjectHideFlags: 0 diff --git a/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity b/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity index d14078a..afb743a 100644 --- a/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity +++ b/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity @@ -123,12 +123,78 @@ NavMeshSettings: debug: m_Flags: 0 m_NavMeshData: {fileID: 0} +--- !u!1 &74796456 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 74796459} + - component: {fileID: 74796458} + - component: {fileID: 74796457} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &74796457 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 74796456} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &74796458 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 74796456} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &74796459 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 74796456} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 2 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1001 &730698711 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 m_Modification: - m_TransformParent: {fileID: 0} + m_TransformParent: {fileID: 1599240741} m_Modifications: - target: {fileID: 3406227244189230, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} propertyPath: m_SizeDelta.x @@ -268,23 +334,23 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} propertyPath: m_Pivot.x - value: 0 + value: 0.5 objectReference: {fileID: 0} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} propertyPath: m_Pivot.y - value: 0 + value: 0.5 objectReference: {fileID: 0} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} propertyPath: m_RootOrder - value: 1 + value: 0 objectReference: {fileID: 0} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} propertyPath: m_AnchorMax.x - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} propertyPath: m_AnchorMax.y - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} propertyPath: m_AnchorMin.x @@ -320,15 +386,15 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} propertyPath: m_LocalRotation.x - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} propertyPath: m_LocalRotation.y - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} propertyPath: m_LocalRotation.z - value: 0 + value: -0 objectReference: {fileID: 0} - target: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} propertyPath: m_AnchoredPosition.x @@ -1036,6 +1102,54 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} +--- !u!1 &1427887268 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1427887270} + - component: {fileID: 1427887269} + m_Layer: 5 + m_Name: CommandDispatcher + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1427887269 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1427887268} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4471d8231d16ba3469228e09d4cb3a81, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!224 &1427887270 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1427887268} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 3 + 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: 960, y: 540} + m_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &1498586261 GameObject: m_ObjectHideFlags: 3 @@ -1055,7 +1169,7 @@ GameObject: m_IsActive: 1 --- !u!114 &1498586262 MonoBehaviour: - m_ObjectHideFlags: 3 + m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} @@ -1077,5 +1191,193 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1599240737 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1599240741} + - component: {fileID: 1599240740} + - component: {fileID: 1599240739} + - component: {fileID: 1599240738} + m_Layer: 5 + m_Name: UIRoot + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1599240738 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1599240737} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &1599240739 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1599240737} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &1599240740 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1599240737} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 1 + m_Camera: {fileID: 1639312036} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_AdditionalShaderChannelsFlag: 1 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &1599240741 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1599240737} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_Children: + - {fileID: 1983793178} + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!1 &1639312034 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1639312037} + - component: {fileID: 1639312036} + - component: {fileID: 1639312035} + m_Layer: 0 + m_Name: UICamera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1639312035 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1639312034} + m_Enabled: 1 +--- !u!20 &1639312036 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1639312034} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_FocalLength: 50 + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 32 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1639312037 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1639312034} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!224 &1983793178 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} + m_PrefabInstance: {fileID: 730698711} + m_PrefabAsset: {fileID: 0} diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs b/AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs index 2adfc87..bc9a8d4 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/MenuItem.cs @@ -83,7 +83,10 @@ namespace AxibugEmuOnline.Client.UI m_select = selected; if (ShadowIcon != null) ShadowIcon.gameObject.SetActiveEx(selected); - if (SubMenuItemGroup != null) SubMenuItemGroup.SetSelect(selected); + if (SubMenuItemGroup != null) + { + SubMenuItemGroup.SetSelect(selected); + } if (progressTween != null) { progressTween.Kill(); progressTween = null; } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OptionMenu.cs b/AxibugEmuOnline.Client/Assets/Script/UI/OptionMenu.cs new file mode 100644 index 0000000..d09058e --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OptionMenu.cs @@ -0,0 +1,21 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +namespace AxibugEmuOnline.Client +{ + public class OptionMenu : MonoBehaviour + { + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OptionMenu.cs.meta b/AxibugEmuOnline.Client/Assets/Script/UI/OptionMenu.cs.meta new file mode 100644 index 0000000..5effef7 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OptionMenu.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d9077edba700447499a21395109542df +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From e6dd0ec952086469082bd9366f643b0d06fcc689 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Thu, 12 Sep 2024 11:34:32 +0800 Subject: [PATCH 3/9] =?UTF-8?q?Game=5FNES=20=E6=94=B9=E5=90=8DRomListMenuI?= =?UTF-8?q?tem=20=E6=9B=B4=E9=80=9A=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UI/{Game_NES.cs => RomListMenuItem.cs} | 21 +++++++++++++++++-- ...me_NES.cs.meta => RomListMenuItem.cs.meta} | 0 2 files changed, 19 insertions(+), 2 deletions(-) rename AxibugEmuOnline.Client/Assets/Script/UI/{Game_NES.cs => RomListMenuItem.cs} (81%) rename AxibugEmuOnline.Client/Assets/Script/UI/{Game_NES.cs.meta => RomListMenuItem.cs.meta} (100%) diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/Game_NES.cs b/AxibugEmuOnline.Client/Assets/Script/UI/RomListMenuItem.cs similarity index 81% rename from AxibugEmuOnline.Client/Assets/Script/UI/Game_NES.cs rename to AxibugEmuOnline.Client/Assets/Script/UI/RomListMenuItem.cs index a772f8b..02d4c28 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/Game_NES.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/RomListMenuItem.cs @@ -7,12 +7,29 @@ using App = AxibugEmuOnline.Client.ClientCore.App; namespace AxibugEmuOnline.Client { - public class Game_NES : MenuItem + public class RomListMenuItem : MenuItem { [SerializeField] CanvasGroup RomGroupRoot; + [SerializeField] + EnumPlatform Platform; + private TweenerCore m_showTween; + private RomLib RomLib + { + get + { + switch (Platform) + { + case EnumPlatform.NES: + return App.nesRomLib; + default: + throw new System.NotImplementedException($"未实现的平台 {Platform}"); + } + } + } + protected override void Awake() { base.Awake(); @@ -54,7 +71,7 @@ namespace AxibugEmuOnline.Client var thirdMenuGroup = SubMenuItemGroup as ThirdMenuRoot; thirdMenuGroup.itemGroup.Clear(); - App.nesRomLib.FetchRomCount((roms) => + RomLib.FetchRomCount((roms) => { var thirdMenuGroup = SubMenuItemGroup as ThirdMenuRoot; thirdMenuGroup.itemGroup.UpdateDependencyProperty(thirdMenuGroup); diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/Game_NES.cs.meta b/AxibugEmuOnline.Client/Assets/Script/UI/RomListMenuItem.cs.meta similarity index 100% rename from AxibugEmuOnline.Client/Assets/Script/UI/Game_NES.cs.meta rename to AxibugEmuOnline.Client/Assets/Script/UI/RomListMenuItem.cs.meta From d38a653280815e125d8b78c2f957e203e398d1cc Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Thu, 12 Sep 2024 13:42:57 +0800 Subject: [PATCH 4/9] =?UTF-8?q?OptionUI=E8=BF=AD=E4=BB=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Resources/UIPrefabs/OptionUI.prefab | 369 ++++++++++++++++++ .../Resources/UIPrefabs/OptionUI.prefab.meta | 7 + .../Assets/Scene/AxibugEmuOnline.Client.unity | 103 +++++ .../Assets/Script/UI/OptionMenu.cs | 21 - .../Assets/Script/UI/OptionUI.cs | 79 ++++ .../{OptionMenu.cs.meta => OptionUI.cs.meta} | 0 6 files changed, 558 insertions(+), 21 deletions(-) create mode 100644 AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab create mode 100644 AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab.meta delete mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/OptionMenu.cs create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/OptionUI.cs rename AxibugEmuOnline.Client/Assets/Script/UI/{OptionMenu.cs.meta => OptionUI.cs.meta} (100%) diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab new file mode 100644 index 0000000..e8d6c8f --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab @@ -0,0 +1,369 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &793983410033291345 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8581099496228509946} + - component: {fileID: 1315151990470629735} + - component: {fileID: 5089554718053375447} + - component: {fileID: 7896211045508186424} + m_Layer: 5 + m_Name: bg + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8581099496228509946 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 793983410033291345} + 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: 5397686940312333149} + 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 &1315151990470629735 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 793983410033291345} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 1 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!222 &5089554718053375447 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 793983410033291345} + m_CullTransparentMesh: 1 +--- !u!114 &7896211045508186424 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 793983410033291345} + 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.5176471} + 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 &2500436782395572584 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2780569438310375802} + - component: {fileID: 9142037267599823005} + m_Layer: 5 + m_Name: ExecuteItem_Template + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2780569438310375802 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2500436782395572584} + 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: 1714682891259844147} + m_Father: {fileID: 5397686940312333149} + m_RootOrder: 1 + 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 &9142037267599823005 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2500436782395572584} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 0 + m_Right: 0 + m_Top: 0 + m_Bottom: 0 + m_ChildAlignment: 4 + m_Spacing: 0 + m_ChildForceExpandWidth: 0 + m_ChildForceExpandHeight: 0 + m_ChildControlWidth: 1 + m_ChildControlHeight: 1 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 +--- !u!1 &3968697266383191021 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5397686940312333149} + - component: {fileID: 1188777947975519706} + - component: {fileID: 4924150661256616665} + m_Layer: 5 + m_Name: MenuRoot + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5397686940312333149 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3968697266383191021} + 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: 8581099496228509946} + - {fileID: 2780569438310375802} + m_Father: {fileID: 4478785627166277610} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 1, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 1, y: 0.5} +--- !u!114 &1188777947975519706 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3968697266383191021} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 59f8146938fff824cb5fd77236b75775, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Padding: + m_Left: 10 + m_Right: 10 + m_Top: 10 + m_Bottom: 10 + m_ChildAlignment: 4 + m_Spacing: 0 + m_ChildForceExpandWidth: 0 + m_ChildForceExpandHeight: 0 + m_ChildControlWidth: 1 + m_ChildControlHeight: 1 + m_ChildScaleWidth: 0 + m_ChildScaleHeight: 0 + m_ReverseArrangement: 0 +--- !u!114 &4924150661256616665 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3968697266383191021} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3245ec927659c4140ac4f8d17403cc18, type: 3} + m_Name: + m_EditorClassIdentifier: + m_HorizontalFit: 2 + m_VerticalFit: 0 +--- !u!1 &4478785627166277609 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4478785627166277610} + - component: {fileID: 4478785627166277611} + m_Layer: 5 + m_Name: OptionUI + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4478785627166277610 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4478785627166277609} + 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: 5397686940312333149} + 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 &4478785627166277611 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4478785627166277609} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d9077edba700447499a21395109542df, type: 3} + m_Name: + m_EditorClassIdentifier: + MenuRoot: {fileID: 5397686940312333149} +--- !u!1 &6998597834321643812 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1714682891259844147} + - component: {fileID: 6532365540230118336} + - component: {fileID: 1824253632728291860} + m_Layer: 5 + m_Name: Text + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1714682891259844147 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6998597834321643812} + 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: 2780569438310375802} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6532365540230118336 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6998597834321643812} + m_CullTransparentMesh: 1 +--- !u!114 &1824253632728291860 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6998597834321643812} + 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: 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_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 18 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 1 + m_MaxSize: 185 + m_Alignment: 0 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 1 + m_VerticalOverflow: 1 + m_LineSpacing: 1 + m_Text: '[MenuName]' diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab.meta b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab.meta new file mode 100644 index 0000000..5574944 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: d3c2508a55398a24db5d68f68d2702ea +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity b/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity index afb743a..eb85124 100644 --- a/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity +++ b/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity @@ -189,6 +189,11 @@ Transform: m_Father: {fileID: 0} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!224 &246947326 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + m_PrefabInstance: {fileID: 4478785627007410708} + m_PrefabAsset: {fileID: 0} --- !u!1001 &730698711 PrefabInstance: m_ObjectHideFlags: 0 @@ -1285,6 +1290,7 @@ RectTransform: m_LocalScale: {x: 0, y: 0, z: 0} m_Children: - {fileID: 1983793178} + - {fileID: 246947326} m_Father: {fileID: 0} m_RootOrder: 4 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -1381,3 +1387,100 @@ RectTransform: m_CorrespondingSourceObject: {fileID: 1639091784002085428, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} m_PrefabInstance: {fileID: 730698711} m_PrefabAsset: {fileID: 0} +--- !u!1001 &4478785627007410708 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + m_TransformParent: {fileID: 1599240741} + m_Modifications: + - target: {fileID: 4478785627166277609, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_Name + value: OptionUI + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_RootOrder + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OptionMenu.cs b/AxibugEmuOnline.Client/Assets/Script/UI/OptionMenu.cs deleted file mode 100644 index d09058e..0000000 --- a/AxibugEmuOnline.Client/Assets/Script/UI/OptionMenu.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; - -namespace AxibugEmuOnline.Client -{ - public class OptionMenu : MonoBehaviour - { - // Start is called before the first frame update - void Start() - { - - } - - // Update is called once per frame - void Update() - { - - } - } -} diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI.cs b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI.cs new file mode 100644 index 0000000..03ebfdd --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI.cs @@ -0,0 +1,79 @@ +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace AxibugEmuOnline.Client +{ + public class OptionUI : MonoBehaviour + { + public static OptionUI Instance { get; private set; } + + [SerializeField] + RectTransform MenuRoot; + + private bool m_bPoped = false; + + private void Awake() + { + Instance = this; + } + + private void Start() + { + Canvas.ForceUpdateCanvases(); + var width = MenuRoot.rect.size.x; + var temp = MenuRoot.anchoredPosition; + temp.x = -width; + } + + public void Pop(IEnumerable menus) + { + } + + public void Hide() + { + + } + } + + public abstract class OptionMenu + { + public string Name { get; protected set; } + + public OptionMenu(string name) + { + Name = name; + } + } + + public abstract class ExecuteMenu : OptionMenu + { + protected ExecuteMenu(string name) : base(name) { } + + public abstract void OnExcute(); + } + + public abstract class ValueSetMenu : OptionMenu + { + protected ValueSetMenu(string name) : base(name) { } + + public abstract Type ValueType { get; } + public abstract object ValueRaw { get; } + public abstract void OnValueChanged(object newValue); + } + + public abstract class ValueSetMenu : ValueSetMenu + { + public sealed override Type ValueType => typeof(T); + + public T Value { get; private set; } + + public sealed override object ValueRaw => Value; + + public sealed override void OnValueChanged(object newValue) + { + Value = (T)newValue; + } + protected ValueSetMenu(string name) : base(name) { } + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OptionMenu.cs.meta b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI.cs.meta similarity index 100% rename from AxibugEmuOnline.Client/Assets/Script/UI/OptionMenu.cs.meta rename to AxibugEmuOnline.Client/Assets/Script/UI/OptionUI.cs.meta From 7d7b864c1b4b4cecb2b14c8335cc1be8e0b64753 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Thu, 12 Sep 2024 15:08:48 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E9=87=8D=E6=9E=84UI=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E7=BB=A7=E6=89=BF=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Resources/UIPrefabs/OptionUI.prefab | 155 +++++++++++++--- .../Assets/Scene/AxibugEmuOnline.Client.unity | 4 + .../Assets/Script/UI/CommandDispatcher.cs | 157 ++++++++++++++--- .../Assets/Script/UI/MenuItemController.cs | 143 +++------------ .../Assets/Script/UI/OptionUI.cs | 79 --------- .../Assets/Script/UI/OptionUI.meta | 8 + .../Assets/Script/UI/OptionUI/OptionUI.cs | 166 ++++++++++++++++++ .../Script/UI/{ => OptionUI}/OptionUI.cs.meta | 0 .../UI/OptionUI/OptionUI_ExecuteItem.cs | 22 +++ .../UI/OptionUI/OptionUI_ExecuteItem.cs.meta | 11 ++ .../Assets/Script/UI/SubMenuItemGroup.cs | 16 +- .../Assets/Script/UI/ThirdMenuRoot.cs | 8 +- 12 files changed, 518 insertions(+), 251 deletions(-) delete mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/OptionUI.cs create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/OptionUI.meta create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs rename AxibugEmuOnline.Client/Assets/Script/UI/{ => OptionUI}/OptionUI.cs.meta (100%) create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI_ExecuteItem.cs create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI_ExecuteItem.cs.meta diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab index e8d6c8f..5a20333 100644 --- a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab @@ -1,5 +1,101 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &782102846085628909 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 6503369113137645357} + - component: {fileID: 6442047476311195174} + - component: {fileID: 394891843266770919} + - component: {fileID: 5658511545186035791} + m_Layer: 5 + m_Name: Icon + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &6503369113137645357 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 782102846085628909} + 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: 2780569438310375802} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 25, y: -25} + m_SizeDelta: {x: 40, y: 40} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6442047476311195174 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 782102846085628909} + m_CullTransparentMesh: 1 +--- !u!114 &394891843266770919 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 782102846085628909} + 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: 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!114 &5658511545186035791 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 782102846085628909} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: 40 + m_PreferredHeight: 40 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 --- !u!1 &793983410033291345 GameObject: m_ObjectHideFlags: 0 @@ -106,13 +202,14 @@ GameObject: m_Component: - component: {fileID: 2780569438310375802} - component: {fileID: 9142037267599823005} + - component: {fileID: 3721725547312714320} m_Layer: 5 m_Name: ExecuteItem_Template m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &2780569438310375802 RectTransform: m_ObjectHideFlags: 0 @@ -124,14 +221,15 @@ RectTransform: m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: + - {fileID: 6503369113137645357} - {fileID: 1714682891259844147} m_Father: {fileID: 5397686940312333149} m_RootOrder: 1 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_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 124.5, y: -540} + m_SizeDelta: {x: 209, y: 50} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &9142037267599823005 MonoBehaviour: @@ -146,12 +244,12 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 + m_Left: 5 + m_Right: 5 + m_Top: 5 + m_Bottom: 5 m_ChildAlignment: 4 - m_Spacing: 0 + m_Spacing: 12 m_ChildForceExpandWidth: 0 m_ChildForceExpandHeight: 0 m_ChildControlWidth: 1 @@ -159,6 +257,20 @@ MonoBehaviour: m_ChildScaleWidth: 0 m_ChildScaleHeight: 0 m_ReverseArrangement: 0 +--- !u!114 &3721725547312714320 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2500436782395572584} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: eb6aef4a36f116c42a45843286be880c, type: 3} + m_Name: + m_EditorClassIdentifier: + m_MenuNameTxt: {fileID: 1824253632728291860} + m_Icon: {fileID: 394891843266770919} --- !u!1 &3968697266383191021 GameObject: m_ObjectHideFlags: 0 @@ -211,12 +323,12 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Padding: - m_Left: 10 - m_Right: 10 - m_Top: 10 - m_Bottom: 10 + m_Left: 20 + m_Right: 20 + m_Top: 0 + m_Bottom: 0 m_ChildAlignment: 4 - m_Spacing: 0 + m_Spacing: 12 m_ChildForceExpandWidth: 0 m_ChildForceExpandHeight: 0 m_ChildControlWidth: 1 @@ -288,6 +400,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: MenuRoot: {fileID: 5397686940312333149} + TEMPLATE_EXECUTEITEM: {fileID: 3721725547312714320} --- !u!1 &6998597834321643812 GameObject: m_ObjectHideFlags: 0 @@ -318,12 +431,12 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 2780569438310375802} - m_RootOrder: 0 + m_RootOrder: 1 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_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 130.5, y: -25} + m_SizeDelta: {x: 147, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &6532365540230118336 CanvasRenderer: @@ -355,7 +468,7 @@ MonoBehaviour: m_Calls: [] m_FontData: m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} - m_FontSize: 18 + m_FontSize: 26 m_FontStyle: 0 m_BestFit: 0 m_MinSize: 1 diff --git a/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity b/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity index eb85124..9561d07 100644 --- a/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity +++ b/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity @@ -1482,5 +1482,9 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 5397686940312333149, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher.cs b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher.cs index cd6b1ca..492e28d 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher.cs @@ -1,3 +1,5 @@ +using AxibugEmuOnline.Client.UI; +using System; using System.Collections.Generic; using UnityEngine; @@ -7,29 +9,29 @@ namespace AxibugEmuOnline.Client { public static CommandDispatcher Instance { get; private set; } - List m_register = new List(); - Dictionary m_keyMapper = new Dictionary(); + List m_register = new List(); + Dictionary m_keyMapper = new Dictionary(); private void Awake() { Instance = this; - m_keyMapper.Add(KeyCode.A, MenuItemController.EnumCommand.SelectItemLeft); - m_keyMapper.Add(KeyCode.D, MenuItemController.EnumCommand.SelectItemRight); - m_keyMapper.Add(KeyCode.W, MenuItemController.EnumCommand.SelectItemUp); - m_keyMapper.Add(KeyCode.S, MenuItemController.EnumCommand.SelectItemDown); - m_keyMapper.Add(KeyCode.K, MenuItemController.EnumCommand.Enter); - m_keyMapper.Add(KeyCode.L, MenuItemController.EnumCommand.Back); - m_keyMapper.Add(KeyCode.I, MenuItemController.EnumCommand.OptionMenu); + m_keyMapper.Add(KeyCode.A, EnumCommand.SelectItemLeft); + m_keyMapper.Add(KeyCode.D, EnumCommand.SelectItemRight); + m_keyMapper.Add(KeyCode.W, EnumCommand.SelectItemUp); + m_keyMapper.Add(KeyCode.S, EnumCommand.SelectItemDown); + m_keyMapper.Add(KeyCode.K, EnumCommand.Enter); + m_keyMapper.Add(KeyCode.L, EnumCommand.Back); + m_keyMapper.Add(KeyCode.I, EnumCommand.OptionMenu); - m_keyMapper.Add(KeyCode.LeftArrow, MenuItemController.EnumCommand.SelectItemLeft); - m_keyMapper.Add(KeyCode.RightArrow, MenuItemController.EnumCommand.SelectItemRight); - m_keyMapper.Add(KeyCode.UpArrow, MenuItemController.EnumCommand.SelectItemUp); - m_keyMapper.Add(KeyCode.DownArrow, MenuItemController.EnumCommand.SelectItemDown); - m_keyMapper.Add(KeyCode.Return, MenuItemController.EnumCommand.Enter); - m_keyMapper.Add(KeyCode.Escape, MenuItemController.EnumCommand.Back); - m_keyMapper.Add(KeyCode.RightShift, MenuItemController.EnumCommand.OptionMenu); - m_keyMapper.Add(KeyCode.LeftShift, MenuItemController.EnumCommand.OptionMenu); + m_keyMapper.Add(KeyCode.LeftArrow, EnumCommand.SelectItemLeft); + m_keyMapper.Add(KeyCode.RightArrow, EnumCommand.SelectItemRight); + m_keyMapper.Add(KeyCode.UpArrow, EnumCommand.SelectItemUp); + m_keyMapper.Add(KeyCode.DownArrow, EnumCommand.SelectItemDown); + m_keyMapper.Add(KeyCode.Return, EnumCommand.Enter); + m_keyMapper.Add(KeyCode.Escape, EnumCommand.Back); + m_keyMapper.Add(KeyCode.RightShift, EnumCommand.OptionMenu); + m_keyMapper.Add(KeyCode.LeftShift, EnumCommand.OptionMenu); } private void OnDestroy() @@ -37,19 +39,19 @@ namespace AxibugEmuOnline.Client Instance = null; } - public void RegistController(MenuItemController controller) + public void RegistController(CommandExecuter controller) { if (m_register.Contains(controller)) { return; } m_register.Add(controller); } - public void UnRegistController(MenuItemController menuItemController) + public void UnRegistController(CommandExecuter menuItemController) { m_register.Remove(menuItemController); } - readonly List oneFrameRegister = new List(); + readonly List oneFrameRegister = new List(); private void Update() { foreach (var item in m_keyMapper) @@ -62,7 +64,7 @@ namespace AxibugEmuOnline.Client for (int i = 0; i < oneFrameRegister.Count; i++) { var controller = oneFrameRegister[i]; - if (!controller.enabled) continue; + if (!controller.Enable) continue; controller.ExecuteCommand(item.Value, false); } } @@ -74,11 +76,122 @@ namespace AxibugEmuOnline.Client for (int i = 0; i < oneFrameRegister.Count; i++) { var controller = oneFrameRegister[i]; - if (!controller.enabled) continue; + if (!controller.Enable) continue; controller.ExecuteCommand(item.Value, true); } } } } } + + public abstract class CommandExecuter : MonoBehaviour + { + private PulseInvoker m_pulsInvoker_Left; + private PulseInvoker m_pulsInvoker_Right; + private PulseInvoker m_pulsInvoker_Up; + private PulseInvoker m_pulsInvoker_Down; + + [SerializeField] + float PulseInvoke_Delay = 0.4f; + [SerializeField] + float PulseInvoke_Interval = 0.05f; + + public abstract bool Enable { get; } + + protected virtual void Awake() + { + m_pulsInvoker_Left = new PulseInvoker(OnCmdSelectItemLeft, PulseInvoke_Delay, PulseInvoke_Interval); + m_pulsInvoker_Right = new PulseInvoker(OnCmdSelectItemRight, PulseInvoke_Delay, PulseInvoke_Interval); + m_pulsInvoker_Up = new PulseInvoker(OnCmdSelectItemUp, PulseInvoke_Delay, PulseInvoke_Interval); + m_pulsInvoker_Down = new PulseInvoker(OnCmdSelectItemDown, PulseInvoke_Delay, PulseInvoke_Interval); + } + + protected virtual void Update() + { + m_pulsInvoker_Left.Update(Time.deltaTime); + m_pulsInvoker_Right.Update(Time.deltaTime); + m_pulsInvoker_Up.Update(Time.deltaTime); + m_pulsInvoker_Down.Update(Time.deltaTime); + } + + public void ExecuteCommand(EnumCommand cmd, bool cancel) + { + if (!cancel) + { + switch (cmd) + { + case EnumCommand.SelectItemLeft: + m_pulsInvoker_Left.SetActive(); + OnCmdSelectItemLeft(); + break; + case EnumCommand.SelectItemRight: + m_pulsInvoker_Right.SetActive(); + OnCmdSelectItemRight(); + break; + case EnumCommand.SelectItemUp: + m_pulsInvoker_Up.SetActive(); + OnCmdSelectItemUp(); + break; + case EnumCommand.SelectItemDown: + m_pulsInvoker_Down.SetActive(); + OnCmdSelectItemDown(); + break; + case EnumCommand.Enter: + if (OnCmdEnter()) + { + m_pulsInvoker_Left.DisActive(); + m_pulsInvoker_Right.DisActive(); + m_pulsInvoker_Up.DisActive(); + m_pulsInvoker_Down.DisActive(); + } + break; + case EnumCommand.Back: + OnCmdBack(); + break; + case EnumCommand.OptionMenu: + OnCmdOptionMenu(); + break; + } + } + else + { + switch (cmd) + { + case EnumCommand.SelectItemLeft: + m_pulsInvoker_Left.DisActive(); break; + case EnumCommand.SelectItemRight: + m_pulsInvoker_Right.DisActive(); break; + case EnumCommand.SelectItemUp: + m_pulsInvoker_Up.DisActive(); break; + case EnumCommand.SelectItemDown: + m_pulsInvoker_Down.DisActive(); break; + } + } + } + + protected virtual void OnCmdSelectItemLeft() { } + + protected virtual void OnCmdSelectItemRight() { } + + protected virtual void OnCmdSelectItemUp() { } + + protected virtual void OnCmdSelectItemDown() { } + + protected virtual void OnCmdOptionMenu() { } + protected virtual bool OnCmdEnter() => false; + protected virtual void OnCmdBack() { } + protected abstract void OnSelectMenuChanged(); + + } + + public enum EnumCommand + { + SelectItemLeft, + SelectItemRight, + SelectItemUp, + SelectItemDown, + Enter, + Back, + OptionMenu + } } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/MenuItemController.cs b/AxibugEmuOnline.Client/Assets/Script/UI/MenuItemController.cs index b34e6ac..d09e73e 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/MenuItemController.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/MenuItemController.cs @@ -4,35 +4,15 @@ using UnityEngine; namespace AxibugEmuOnline.Client { - public abstract class MenuItemController : MonoBehaviour + public abstract class MenuItemController : CommandExecuter { - public enum EnumCommand - { - SelectItemLeft, - SelectItemRight, - SelectItemUp, - SelectItemDown, - Enter, - Back, - OptionMenu - } - - [SerializeField] protected Transform m_menuItemRoot; protected List m_runtimeMenuUI = new List(); + public override bool Enable => enabled; - private PulseInvoker m_pulsInvoker_Left; - private PulseInvoker m_pulsInvoker_Right; - private PulseInvoker m_pulsInvoker_Up; - private PulseInvoker m_pulsInvoker_Down; private MenuItem m_enteredItem = null; - [SerializeField] - float PulseInvoke_Delay = 0.4f; - [SerializeField] - float PulseInvoke_Interval = 0.05f; - protected int m_selectIndex = -1; public virtual int SelectIndex @@ -61,87 +41,6 @@ namespace AxibugEmuOnline.Client Canvas.ForceUpdateCanvases(); SelectIndex = 0; - - m_pulsInvoker_Left = new PulseInvoker(OnCmdSelectItemLeft, PulseInvoke_Delay, PulseInvoke_Interval); - m_pulsInvoker_Right = new PulseInvoker(OnCmdSelectItemRight, PulseInvoke_Delay, PulseInvoke_Interval); - m_pulsInvoker_Up = new PulseInvoker(OnCmdSelectItemUp, PulseInvoke_Delay, PulseInvoke_Interval); - m_pulsInvoker_Down = new PulseInvoker(OnCmdSelectItemDown, PulseInvoke_Delay, PulseInvoke_Interval); - } - - - protected virtual void Update() - { - m_pulsInvoker_Left.Update(Time.deltaTime); - m_pulsInvoker_Right.Update(Time.deltaTime); - m_pulsInvoker_Up.Update(Time.deltaTime); - m_pulsInvoker_Down.Update(Time.deltaTime); - } - - public void ExecuteCommand(EnumCommand cmd, bool cancel) - { - if (!cancel) - { - switch (cmd) - { - case EnumCommand.SelectItemLeft: - m_pulsInvoker_Left.SetActive(); - OnCmdSelectItemLeft(); - break; - case EnumCommand.SelectItemRight: - m_pulsInvoker_Right.SetActive(); - OnCmdSelectItemRight(); - break; - case EnumCommand.SelectItemUp: - m_pulsInvoker_Up.SetActive(); - OnCmdSelectItemUp(); - break; - case EnumCommand.SelectItemDown: - m_pulsInvoker_Down.SetActive(); - OnCmdSelectItemDown(); - break; - case EnumCommand.Enter: - if (m_enteredItem == null) - { - var willEnterItem = GetItemUIByIndex(SelectIndex); - bool res = OnCmdEnter(willEnterItem); - if (res) - { - m_enteredItem = willEnterItem; - - m_pulsInvoker_Left.DisActive(); - m_pulsInvoker_Right.DisActive(); - m_pulsInvoker_Up.DisActive(); - m_pulsInvoker_Down.DisActive(); - } - - } - break; - case EnumCommand.Back: - if (m_enteredItem != null) - { - OnCmdBack(m_enteredItem); - m_enteredItem = null; - } - break; - case EnumCommand.OptionMenu: - OnCmdOptionMenu(); - break; - } - } - else - { - switch (cmd) - { - case EnumCommand.SelectItemLeft: - m_pulsInvoker_Left.DisActive(); break; - case EnumCommand.SelectItemRight: - m_pulsInvoker_Right.DisActive(); break; - case EnumCommand.SelectItemUp: - m_pulsInvoker_Up.DisActive(); break; - case EnumCommand.SelectItemDown: - m_pulsInvoker_Down.DisActive(); break; - } - } } protected virtual MenuItem GetItemUIByIndex(int index) @@ -149,19 +48,30 @@ namespace AxibugEmuOnline.Client return m_runtimeMenuUI[SelectIndex]; } - protected virtual void OnCmdSelectItemLeft() { } + protected override bool OnCmdEnter() + { + if (m_enteredItem == null) + { + var willEnterItem = GetItemUIByIndex(SelectIndex); + bool res = willEnterItem.OnEnterItem(); + if (res) + { + m_enteredItem = willEnterItem; + } + return res; + } - protected virtual void OnCmdSelectItemRight() { } - - protected virtual void OnCmdSelectItemUp() { } - - protected virtual void OnCmdSelectItemDown() { } - - protected virtual void OnCmdOptionMenu() { } - protected virtual bool OnCmdEnter(MenuItem item) => item.OnEnterItem(); - protected virtual bool OnCmdBack(MenuItem item) => item.OnExitItem(); - protected abstract void OnSelectMenuChanged(); + return false; + } + protected override void OnCmdBack() + { + if (m_enteredItem != null) + { + m_enteredItem.OnExitItem(); + m_enteredItem = null; + } + } } public abstract class MenuItemController : MenuItemController @@ -189,10 +99,5 @@ namespace AxibugEmuOnline.Client if (CommandDispatcher.Instance != null) CommandDispatcher.Instance.UnRegistController(this); } - - - - - } } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI.cs b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI.cs deleted file mode 100644 index 03ebfdd..0000000 --- a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI.cs +++ /dev/null @@ -1,79 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace AxibugEmuOnline.Client -{ - public class OptionUI : MonoBehaviour - { - public static OptionUI Instance { get; private set; } - - [SerializeField] - RectTransform MenuRoot; - - private bool m_bPoped = false; - - private void Awake() - { - Instance = this; - } - - private void Start() - { - Canvas.ForceUpdateCanvases(); - var width = MenuRoot.rect.size.x; - var temp = MenuRoot.anchoredPosition; - temp.x = -width; - } - - public void Pop(IEnumerable menus) - { - } - - public void Hide() - { - - } - } - - public abstract class OptionMenu - { - public string Name { get; protected set; } - - public OptionMenu(string name) - { - Name = name; - } - } - - public abstract class ExecuteMenu : OptionMenu - { - protected ExecuteMenu(string name) : base(name) { } - - public abstract void OnExcute(); - } - - public abstract class ValueSetMenu : OptionMenu - { - protected ValueSetMenu(string name) : base(name) { } - - public abstract Type ValueType { get; } - public abstract object ValueRaw { get; } - public abstract void OnValueChanged(object newValue); - } - - public abstract class ValueSetMenu : ValueSetMenu - { - public sealed override Type ValueType => typeof(T); - - public T Value { get; private set; } - - public sealed override object ValueRaw => Value; - - public sealed override void OnValueChanged(object newValue) - { - Value = (T)newValue; - } - protected ValueSetMenu(string name) : base(name) { } - } -} diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI.meta b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI.meta new file mode 100644 index 0000000..ab20c77 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 65c17e13e38c7dd459e5c74ff9b37e87 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs new file mode 100644 index 0000000..1de156f --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs @@ -0,0 +1,166 @@ +using DG.Tweening; +using System; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +namespace AxibugEmuOnline.Client +{ + public class OptionUI : CommandExecuter + { + public static OptionUI Instance { get; private set; } + + [SerializeField] + RectTransform MenuRoot; + + [Space] + [Header("模板")] + [SerializeField] OptionUI_ExecuteItem TEMPLATE_EXECUTEITEM; + + private bool m_bPoped = false; + private List m_runtimeMenuItems = new List(); + + protected override void Awake() + { + Instance = this; + TEMPLATE_EXECUTEITEM.gameObject.SetActiveEx(false); + + base.Awake(); + } + + private void Start() + { + Canvas.ForceUpdateCanvases(); + var width = MenuRoot.rect.size.x; + var temp = MenuRoot.anchoredPosition; + temp.x = width; + MenuRoot.anchoredPosition = temp; + } + + protected override void Update() + { + if (Input.GetKeyDown(KeyCode.T)) + { + if (m_bPoped) Hide(); + else Pop(new List + { + new ExecuteMenu("测试菜单1"), + new ExecuteMenu("Copilot"), + new ExecuteMenu("ChatGPT 4o"), + }); + } + } + + public void Pop(IEnumerable menus) + { + ReleaseRuntimeMenus(); + foreach (var menu in menus) CreateRuntimeMenuItem(menu); + CommandDispatcher.Instance.RegistController(this); + if (!m_bPoped) + { + m_bPoped = true; + DOTween.To( + () => MenuRoot.anchoredPosition.x, + (value) => + { + var temp = MenuRoot.anchoredPosition; + temp.x = value; + MenuRoot.anchoredPosition = temp; + }, + 0, + 0.3f + ).SetEase(Ease.OutCubic); + } + } + + public void Hide() + { + if (m_bPoped) + { + m_bPoped = false; + Canvas.ForceUpdateCanvases(); + var width = MenuRoot.rect.width; + DOTween.To( + () => MenuRoot.anchoredPosition.x, + (value) => + { + var temp = MenuRoot.anchoredPosition; + temp.x = value; + MenuRoot.anchoredPosition = temp; + }, + width, + 0.3f + ).SetEase(Ease.OutCubic); + } + } + + private void CreateRuntimeMenuItem(OptionMenu menuData) + { + if (menuData is ExecuteMenu executeMenu) + { + var menuUI = GameObject.Instantiate(TEMPLATE_EXECUTEITEM.gameObject, TEMPLATE_EXECUTEITEM.transform.parent).GetComponent(); + menuUI.gameObject.SetActive(true); + menuUI.SetData(executeMenu); + m_runtimeMenuItems.Add(menuUI); + } + } + + private void ReleaseRuntimeMenus() + { + foreach (var item in m_runtimeMenuItems) + { + Destroy(item.gameObject); + } + m_runtimeMenuItems.Clear(); + } + + public override bool Enable => m_bPoped; + + protected override void OnSelectMenuChanged() + { + + } + } + + public abstract class OptionMenu + { + public string Name { get; protected set; } + public Sprite Icon { get; protected set; } + public OptionMenu(string name, Sprite icon = null) + { + Name = name; + Icon = icon; + } + } + + public class ExecuteMenu : OptionMenu + { + public ExecuteMenu(string name, Sprite icon = null) : base(name, icon) { } + + public virtual void OnExcute() { } + } + + public abstract class ValueSetMenu : OptionMenu + { + public ValueSetMenu(string name) : base(name) { } + + public abstract Type ValueType { get; } + public abstract object ValueRaw { get; } + public abstract void OnValueChanged(object newValue); + } + + public class ValueSetMenu : ValueSetMenu + { + public sealed override Type ValueType => typeof(T); + + public T Value { get; private set; } + + public sealed override object ValueRaw => Value; + + public sealed override void OnValueChanged(object newValue) + { + Value = (T)newValue; + } + protected ValueSetMenu(string name) : base(name) { } + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI.cs.meta b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs.meta similarity index 100% rename from AxibugEmuOnline.Client/Assets/Script/UI/OptionUI.cs.meta rename to AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs.meta diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI_ExecuteItem.cs b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI_ExecuteItem.cs new file mode 100644 index 0000000..0208f2f --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI_ExecuteItem.cs @@ -0,0 +1,22 @@ +using UnityEngine; +using UnityEngine.UI; + +namespace AxibugEmuOnline.Client +{ + public class OptionUI_ExecuteItem : MonoBehaviour + { + [SerializeField] Text m_MenuNameTxt; + [SerializeField] Image m_Icon; + + public void SetData(ExecuteMenu executeMenu) + { + m_MenuNameTxt.text = executeMenu.Name; + if (executeMenu.Icon == null) m_Icon.gameObject.SetActiveEx(false); + else + { + m_Icon.gameObject.SetActiveEx(true); + m_Icon.sprite = executeMenu.Icon; + } + } + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI_ExecuteItem.cs.meta b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI_ExecuteItem.cs.meta new file mode 100644 index 0000000..b3fb48f --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI_ExecuteItem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eb6aef4a36f116c42a45843286be880c +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 eeacb02..4a6b605 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/SubMenuItemGroup.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/SubMenuItemGroup.cs @@ -22,10 +22,12 @@ namespace AxibugEmuOnline.Client private TweenerCore rollTween; - protected virtual void Awake() + protected override void Awake() { m_selected = false; if (alphaGroup != null) alphaGroup.alpha = 0; + + base.Awake(); } public override void Init(List menuDataList) @@ -62,22 +64,22 @@ namespace AxibugEmuOnline.Client } } - protected override bool OnCmdEnter(MenuItem item) + protected override bool OnCmdEnter() { LaunchUI.Instance.ToDetailMenuLayout(); + base.OnCmdEnter(); + var item = GetItemUIByIndex(SelectIndex); item.SetSelectState(false); - base.OnCmdEnter(item); return true; } - protected override bool OnCmdBack(MenuItem item) + protected override void OnCmdBack() { + base.OnCmdBack(); LaunchUI.Instance.ToMainMenuLayout(); + var item = GetItemUIByIndex(SelectIndex); item.SetSelectState(true); - base.OnCmdBack(item); - - return true; } protected override void OnCmdSelectItemUp() diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/ThirdMenuRoot.cs b/AxibugEmuOnline.Client/Assets/Script/UI/ThirdMenuRoot.cs index 74b6a40..67b02fe 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/ThirdMenuRoot.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/ThirdMenuRoot.cs @@ -60,14 +60,16 @@ namespace AxibugEmuOnline.Client public override void Init(List menuDataList) { } - protected override bool OnCmdEnter(MenuItem item) + protected override bool OnCmdEnter() { + var item = GetItemUIByIndex(SelectIndex); return item.OnEnterItem(); } - protected override bool OnCmdBack(MenuItem item) + protected override void OnCmdBack() { - return item.OnExitItem(); + var item = GetItemUIByIndex(SelectIndex); + item.OnExitItem(); } private void LateUpdate() From f8fc518a4434d266ef1c7a471c70e440488f62b4 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Thu, 12 Sep 2024 15:10:48 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E7=9B=AE=E5=BD=95=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Script/UI/CommandDispatcher.meta | 8 ++ .../UI/CommandDispatcher/CommandDispatcher.cs | 86 +++++++++++++++++++ .../CommandDispatcher.cs.meta | 0 .../CommandExcuter.cs} | 81 +---------------- .../CommandDispatcher/CommandExcuter.cs.meta | 11 +++ 5 files changed, 106 insertions(+), 80 deletions(-) create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher.meta create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs rename AxibugEmuOnline.Client/Assets/Script/UI/{ => CommandDispatcher}/CommandDispatcher.cs.meta (100%) rename AxibugEmuOnline.Client/Assets/Script/UI/{CommandDispatcher.cs => CommandDispatcher/CommandExcuter.cs} (56%) create mode 100644 AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs.meta diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher.meta b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher.meta new file mode 100644 index 0000000..50b7105 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1e5c9fb1d636a5d43b09c7db07044b4f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs new file mode 100644 index 0000000..ebe7894 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs @@ -0,0 +1,86 @@ +using AxibugEmuOnline.Client.UI; +using System; +using System.Collections.Generic; +using UnityEngine; + +namespace AxibugEmuOnline.Client +{ + public class CommandDispatcher : MonoBehaviour + { + public static CommandDispatcher Instance { get; private set; } + + List m_register = new List(); + Dictionary m_keyMapper = new Dictionary(); + + private void Awake() + { + Instance = this; + + m_keyMapper.Add(KeyCode.A, EnumCommand.SelectItemLeft); + m_keyMapper.Add(KeyCode.D, EnumCommand.SelectItemRight); + m_keyMapper.Add(KeyCode.W, EnumCommand.SelectItemUp); + m_keyMapper.Add(KeyCode.S, EnumCommand.SelectItemDown); + m_keyMapper.Add(KeyCode.K, EnumCommand.Enter); + m_keyMapper.Add(KeyCode.L, EnumCommand.Back); + m_keyMapper.Add(KeyCode.I, EnumCommand.OptionMenu); + + m_keyMapper.Add(KeyCode.LeftArrow, EnumCommand.SelectItemLeft); + m_keyMapper.Add(KeyCode.RightArrow, EnumCommand.SelectItemRight); + m_keyMapper.Add(KeyCode.UpArrow, EnumCommand.SelectItemUp); + m_keyMapper.Add(KeyCode.DownArrow, EnumCommand.SelectItemDown); + m_keyMapper.Add(KeyCode.Return, EnumCommand.Enter); + m_keyMapper.Add(KeyCode.Escape, EnumCommand.Back); + m_keyMapper.Add(KeyCode.RightShift, EnumCommand.OptionMenu); + m_keyMapper.Add(KeyCode.LeftShift, EnumCommand.OptionMenu); + } + + private void OnDestroy() + { + Instance = null; + } + + public void RegistController(CommandExecuter controller) + { + if (m_register.Contains(controller)) { return; } + + m_register.Add(controller); + } + + public void UnRegistController(CommandExecuter menuItemController) + { + m_register.Remove(menuItemController); + } + + readonly List oneFrameRegister = new List(); + private void Update() + { + foreach (var item in m_keyMapper) + { + if (Input.GetKeyDown(item.Key)) + { + oneFrameRegister.Clear(); + oneFrameRegister.AddRange(m_register); + + for (int i = 0; i < oneFrameRegister.Count; i++) + { + var controller = oneFrameRegister[i]; + if (!controller.Enable) continue; + controller.ExecuteCommand(item.Value, false); + } + } + if (Input.GetKeyUp(item.Key)) + { + oneFrameRegister.Clear(); + oneFrameRegister.AddRange(m_register); + + for (int i = 0; i < oneFrameRegister.Count; i++) + { + var controller = oneFrameRegister[i]; + if (!controller.Enable) continue; + controller.ExecuteCommand(item.Value, true); + } + } + } + } + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher.cs.meta b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs.meta similarity index 100% rename from AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher.cs.meta rename to AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs.meta diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher.cs b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs similarity index 56% rename from AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher.cs rename to AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs index 492e28d..12db380 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs @@ -1,89 +1,10 @@ using AxibugEmuOnline.Client.UI; -using System; +using System.Collections; using System.Collections.Generic; using UnityEngine; namespace AxibugEmuOnline.Client { - public class CommandDispatcher : MonoBehaviour - { - public static CommandDispatcher Instance { get; private set; } - - List m_register = new List(); - Dictionary m_keyMapper = new Dictionary(); - - private void Awake() - { - Instance = this; - - m_keyMapper.Add(KeyCode.A, EnumCommand.SelectItemLeft); - m_keyMapper.Add(KeyCode.D, EnumCommand.SelectItemRight); - m_keyMapper.Add(KeyCode.W, EnumCommand.SelectItemUp); - m_keyMapper.Add(KeyCode.S, EnumCommand.SelectItemDown); - m_keyMapper.Add(KeyCode.K, EnumCommand.Enter); - m_keyMapper.Add(KeyCode.L, EnumCommand.Back); - m_keyMapper.Add(KeyCode.I, EnumCommand.OptionMenu); - - m_keyMapper.Add(KeyCode.LeftArrow, EnumCommand.SelectItemLeft); - m_keyMapper.Add(KeyCode.RightArrow, EnumCommand.SelectItemRight); - m_keyMapper.Add(KeyCode.UpArrow, EnumCommand.SelectItemUp); - m_keyMapper.Add(KeyCode.DownArrow, EnumCommand.SelectItemDown); - m_keyMapper.Add(KeyCode.Return, EnumCommand.Enter); - m_keyMapper.Add(KeyCode.Escape, EnumCommand.Back); - m_keyMapper.Add(KeyCode.RightShift, EnumCommand.OptionMenu); - m_keyMapper.Add(KeyCode.LeftShift, EnumCommand.OptionMenu); - } - - private void OnDestroy() - { - Instance = null; - } - - public void RegistController(CommandExecuter controller) - { - if (m_register.Contains(controller)) { return; } - - m_register.Add(controller); - } - - public void UnRegistController(CommandExecuter menuItemController) - { - m_register.Remove(menuItemController); - } - - readonly List oneFrameRegister = new List(); - private void Update() - { - foreach (var item in m_keyMapper) - { - if (Input.GetKeyDown(item.Key)) - { - oneFrameRegister.Clear(); - oneFrameRegister.AddRange(m_register); - - for (int i = 0; i < oneFrameRegister.Count; i++) - { - var controller = oneFrameRegister[i]; - if (!controller.Enable) continue; - controller.ExecuteCommand(item.Value, false); - } - } - if (Input.GetKeyUp(item.Key)) - { - oneFrameRegister.Clear(); - oneFrameRegister.AddRange(m_register); - - for (int i = 0; i < oneFrameRegister.Count; i++) - { - var controller = oneFrameRegister[i]; - if (!controller.Enable) continue; - controller.ExecuteCommand(item.Value, true); - } - } - } - } - } - public abstract class CommandExecuter : MonoBehaviour { private PulseInvoker m_pulsInvoker_Left; diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs.meta b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs.meta new file mode 100644 index 0000000..677ba87 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8506406a7119fff468b4ce029101f81a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 040c23e00141d1c0fb047fb5ec412565505c9328 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Thu, 12 Sep 2024 16:20:11 +0800 Subject: [PATCH 7/9] =?UTF-8?q?UI=E8=B0=83=E6=95=B4,=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E6=B4=BE=E5=8F=91=E6=9C=BA=E5=88=B6=E6=8A=BD=E8=B1=A1=E7=BB=93?= =?UTF-8?q?=E6=9E=84=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AxibugEmuOnline.Client/Assets/Editors.meta | 8 + .../Editors/AxibugEmuOnline.Editor.asmdef | 18 +++ .../AxibugEmuOnline.Editor.asmdef.meta | 7 + .../Assets/Editors/CommandDispatcherEditor.cs | 45 ++++++ .../Editors/CommandDispatcherEditor.cs.meta | 11 ++ .../Assets/Scene/AxibugEmuOnline.Client.unity | 139 +++++++++++++++--- AxibugEmuOnline.Client/Assets/Script/App.cs | 3 + .../UI/CommandDispatcher/CommandDispatcher.cs | 73 +++++++-- .../UI/CommandDispatcher/CommandExcuter.cs | 1 + .../Assets/Script/UI/MenuItemController.cs | 2 +- .../Assets/Script/UI/OptionUI/OptionUI.cs | 5 +- .../Assets/Script/UI/SubMenuItemGroup.cs | 10 +- 12 files changed, 283 insertions(+), 39 deletions(-) create mode 100644 AxibugEmuOnline.Client/Assets/Editors.meta create mode 100644 AxibugEmuOnline.Client/Assets/Editors/AxibugEmuOnline.Editor.asmdef create mode 100644 AxibugEmuOnline.Client/Assets/Editors/AxibugEmuOnline.Editor.asmdef.meta create mode 100644 AxibugEmuOnline.Client/Assets/Editors/CommandDispatcherEditor.cs create mode 100644 AxibugEmuOnline.Client/Assets/Editors/CommandDispatcherEditor.cs.meta diff --git a/AxibugEmuOnline.Client/Assets/Editors.meta b/AxibugEmuOnline.Client/Assets/Editors.meta new file mode 100644 index 0000000..d920b2d --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Editors.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fd41663b74cbfcc45a028bc891a8c4fc +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Editors/AxibugEmuOnline.Editor.asmdef b/AxibugEmuOnline.Client/Assets/Editors/AxibugEmuOnline.Editor.asmdef new file mode 100644 index 0000000..08a7065 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Editors/AxibugEmuOnline.Editor.asmdef @@ -0,0 +1,18 @@ +{ + "name": "AxibugEmuOnline.Editor", + "rootNamespace": "AxibugEmuOnline.Editors", + "references": [ + "GUID:3fe77f1eed9fc0847a86648f644fe815" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Editors/AxibugEmuOnline.Editor.asmdef.meta b/AxibugEmuOnline.Client/Assets/Editors/AxibugEmuOnline.Editor.asmdef.meta new file mode 100644 index 0000000..3fa942e --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Editors/AxibugEmuOnline.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a37804d4d608e1e4bb8204f442ab0e60 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Editors/CommandDispatcherEditor.cs b/AxibugEmuOnline.Client/Assets/Editors/CommandDispatcherEditor.cs new file mode 100644 index 0000000..c8dcbc9 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Editors/CommandDispatcherEditor.cs @@ -0,0 +1,45 @@ +using AxibugEmuOnline.Client; +using System; +using UnityEditor; +using UnityEngine; +namespace AxibugEmuOnline.Editors +{ + [CustomEditor(typeof(CommandDispatcher))] + public class CommandDispatcherEditor : Editor + { + public override void OnInspectorGUI() + { + base.OnInspectorGUI(); + + var dispacather = target as CommandDispatcher; + + dispacather.GetRegisters(out var normal, out var solo); + + EditorGUILayout.BeginVertical(EditorStyles.helpBox); + EditorGUILayout.LabelField("NORMAL"); + foreach (var item in normal) + { + Draw(item); + } + EditorGUILayout.EndVertical(); + + EditorGUILayout.BeginVertical(EditorStyles.helpBox); + EditorGUILayout.LabelField("SOLO"); + foreach (var item in solo) + { + Draw(item); + } + EditorGUILayout.EndVertical(); + + Repaint(); + } + + private void Draw(CommandExecuter item) + { + EditorGUILayout.BeginHorizontal(EditorStyles.helpBox); + using (new EditorGUI.DisabledGroupScope(!item.Enable)) + EditorGUILayout.ObjectField(item.gameObject, typeof(GameObject), false); + EditorGUILayout.EndHorizontal(); + } + } +} diff --git a/AxibugEmuOnline.Client/Assets/Editors/CommandDispatcherEditor.cs.meta b/AxibugEmuOnline.Client/Assets/Editors/CommandDispatcherEditor.cs.meta new file mode 100644 index 0000000..0742aa8 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Editors/CommandDispatcherEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 57378be70cec95341aea522ad2d8e30d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity b/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity index 9561d07..68a56ea 100644 --- a/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity +++ b/AxibugEmuOnline.Client/Assets/Scene/AxibugEmuOnline.Client.unity @@ -182,12 +182,12 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 74796456} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 2 + m_Father: {fileID: 1335662459} + m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!224 &246947326 stripped RectTransform: @@ -1107,6 +1107,40 @@ PrefabInstance: objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 450328d5a907c8249a60bc3980ba66f6, type: 3} +--- !u!1 &1335662458 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1335662459} + m_Layer: 0 + m_Name: IMPORTENT + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1335662459 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1335662458} + 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: 1639312037} + - {fileID: 74796459} + - {fileID: 1427887270} + - {fileID: 1599240741} + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1427887268 GameObject: m_ObjectHideFlags: 0 @@ -1136,25 +1170,20 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 4471d8231d16ba3469228e09d4cb3a81, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!224 &1427887270 -RectTransform: +--- !u!4 &1427887270 +Transform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1427887268} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 3 + m_Father: {fileID: 1335662459} + m_RootOrder: 2 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: 960, y: 540} - m_SizeDelta: {x: 100, y: 100} - m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &1498586261 GameObject: m_ObjectHideFlags: 3 @@ -1196,7 +1225,7 @@ Transform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] m_Father: {fileID: 0} - m_RootOrder: 1 + m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1599240737 GameObject: @@ -1291,8 +1320,8 @@ RectTransform: m_Children: - {fileID: 1983793178} - {fileID: 246947326} - m_Father: {fileID: 0} - m_RootOrder: 4 + m_Father: {fileID: 1335662459} + m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} @@ -1375,11 +1404,11 @@ Transform: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1639312034} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_Children: [] - m_Father: {fileID: 0} + m_Father: {fileID: 1335662459} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!224 &1983793178 stripped @@ -1394,6 +1423,54 @@ PrefabInstance: m_Modification: m_TransformParent: {fileID: 1599240741} m_Modifications: + - target: {fileID: 1714682891259844147, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1714682891259844147, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1714682891259844147, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1714682891259844147, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1714682891259844147, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1714682891259844147, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2780569438310375802, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2780569438310375802, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2780569438310375802, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2780569438310375802, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2780569438310375802, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2780569438310375802, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 4478785627166277609, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} propertyPath: m_Name value: OptionUI @@ -1486,5 +1563,29 @@ PrefabInstance: propertyPath: m_SizeDelta.x value: 0 objectReference: {fileID: 0} + - target: {fileID: 6503369113137645357, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6503369113137645357, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6503369113137645357, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6503369113137645357, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6503369113137645357, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6503369113137645357, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3} diff --git a/AxibugEmuOnline.Client/Assets/Script/App.cs b/AxibugEmuOnline.Client/Assets/Script/App.cs index 15dc5cd..3af9f5d 100644 --- a/AxibugEmuOnline.Client/Assets/Script/App.cs +++ b/AxibugEmuOnline.Client/Assets/Script/App.cs @@ -49,6 +49,9 @@ namespace AxibugEmuOnline.Client.ClientCore GameObject.DontDestroyOnLoad(go); coRunner = go.AddComponent(); + var importNode = GameObject.Find("IMPORTENT"); + GameObject.DontDestroyOnLoad(importNode); + StartCoroutine(AppTickFlow()); } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs index ebe7894..487a421 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs @@ -1,5 +1,3 @@ -using AxibugEmuOnline.Client.UI; -using System; using System.Collections.Generic; using UnityEngine; @@ -9,7 +7,11 @@ namespace AxibugEmuOnline.Client { public static CommandDispatcher Instance { get; private set; } + /// 平级注册对象,都会响应指令 List m_register = new List(); + /// 独占注册对象,指令会被列表中最后一个对象独占 + List m_registerHigh = new List(); + Dictionary m_keyMapper = new Dictionary(); private void Awake() @@ -41,14 +43,26 @@ namespace AxibugEmuOnline.Client public void RegistController(CommandExecuter controller) { - if (m_register.Contains(controller)) { return; } + if (!controller.AloneMode) + { + if (m_register.Contains(controller)) { return; } - m_register.Add(controller); + m_register.Add(controller); + } + else + { + if (m_registerHigh.Contains(controller)) { return; } + + m_registerHigh.Add(controller); + } } public void UnRegistController(CommandExecuter menuItemController) { - m_register.Remove(menuItemController); + if (!menuItemController.AloneMode) + m_register.Remove(menuItemController); + else + m_registerHigh.Remove(menuItemController); } readonly List oneFrameRegister = new List(); @@ -56,31 +70,60 @@ namespace AxibugEmuOnline.Client { foreach (var item in m_keyMapper) { + peekRegister(oneFrameRegister); + if (Input.GetKeyDown(item.Key)) { - oneFrameRegister.Clear(); - oneFrameRegister.AddRange(m_register); - - for (int i = 0; i < oneFrameRegister.Count; i++) + foreach (var controller in oneFrameRegister) { - var controller = oneFrameRegister[i]; if (!controller.Enable) continue; controller.ExecuteCommand(item.Value, false); } } if (Input.GetKeyUp(item.Key)) { - oneFrameRegister.Clear(); - oneFrameRegister.AddRange(m_register); - - for (int i = 0; i < oneFrameRegister.Count; i++) + foreach (var controller in oneFrameRegister) { - var controller = oneFrameRegister[i]; if (!controller.Enable) continue; controller.ExecuteCommand(item.Value, true); } } } } + + private List peekRegister(List results) + { + results.Clear(); + + if (m_registerHigh.Count > 0) + { + for (int i = m_registerHigh.Count - 1; i >= 0; i--) + { + var controller = m_registerHigh[i]; + if (controller.Enable) + { + results.Add(controller); + return results; + } + } + } + + foreach (var controller in m_register) + { + if (!controller.Enable) continue; + + results.Add(controller); + } + + return results; + } + +#if UNITY_EDITOR + public void GetRegisters(out IReadOnlyList normal, out IReadOnlyList alone) + { + normal = m_register; + alone = m_registerHigh; + } +#endif } } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs index 12db380..1462b37 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs @@ -18,6 +18,7 @@ namespace AxibugEmuOnline.Client float PulseInvoke_Interval = 0.05f; public abstract bool Enable { get; } + public virtual bool AloneMode { get; } protected virtual void Awake() { diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/MenuItemController.cs b/AxibugEmuOnline.Client/Assets/Script/UI/MenuItemController.cs index d09e73e..49c4f04 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/MenuItemController.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/MenuItemController.cs @@ -11,7 +11,7 @@ namespace AxibugEmuOnline.Client protected List m_runtimeMenuUI = new List(); public override bool Enable => enabled; - private MenuItem m_enteredItem = null; + protected MenuItem m_enteredItem = null; protected int m_selectIndex = -1; diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs index 1de156f..8a5da68 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs @@ -17,6 +17,8 @@ namespace AxibugEmuOnline.Client [Header("模板")] [SerializeField] OptionUI_ExecuteItem TEMPLATE_EXECUTEITEM; + public override bool AloneMode => true; + private bool m_bPoped = false; private List m_runtimeMenuItems = new List(); @@ -77,6 +79,7 @@ namespace AxibugEmuOnline.Client { if (m_bPoped) { + CommandDispatcher.Instance.UnRegistController(this); m_bPoped = false; Canvas.ForceUpdateCanvases(); var width = MenuRoot.rect.width; @@ -118,7 +121,7 @@ namespace AxibugEmuOnline.Client protected override void OnSelectMenuChanged() { - + } } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/SubMenuItemGroup.cs b/AxibugEmuOnline.Client/Assets/Script/UI/SubMenuItemGroup.cs index 4a6b605..b92d2b1 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/SubMenuItemGroup.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/SubMenuItemGroup.cs @@ -66,8 +66,9 @@ namespace AxibugEmuOnline.Client protected override bool OnCmdEnter() { - LaunchUI.Instance.ToDetailMenuLayout(); base.OnCmdEnter(); + + LaunchUI.Instance.ToDetailMenuLayout(); var item = GetItemUIByIndex(SelectIndex); item.SetSelectState(false); @@ -77,6 +78,7 @@ namespace AxibugEmuOnline.Client protected override void OnCmdBack() { base.OnCmdBack(); + LaunchUI.Instance.ToMainMenuLayout(); var item = GetItemUIByIndex(SelectIndex); item.SetSelectState(true); @@ -84,12 +86,14 @@ namespace AxibugEmuOnline.Client protected override void OnCmdSelectItemUp() { - SelectIndex--; + if (m_enteredItem == null) + SelectIndex--; } protected override void OnCmdSelectItemDown() { - SelectIndex++; + if (m_enteredItem == null) + SelectIndex++; } public virtual void SetSelect(bool select) From 7209b52c93613e9a7b98a6ba921e62bacbbbbfcf Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Thu, 12 Sep 2024 17:47:05 +0800 Subject: [PATCH 8/9] =?UTF-8?q?UI=E8=BF=AD=E4=BB=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Resources/UIPrefabs/OptionUI.prefab | 196 ++++++++++++++++-- .../UIPrefabs/SelectBorder.controller | 72 +++++++ .../UIPrefabs/SelectBorder.controller.meta | 8 + .../Resources/UIPrefabs/SelectBorderLoop.anim | 134 ++++++++++++ .../UIPrefabs/SelectBorderLoop.anim.meta | 8 + AxibugEmuOnline.Client/Assets/Script/App.cs | 3 +- .../Assets/Script/Manager/AppChat.cs | 1 + .../UI/CommandDispatcher/CommandExcuter.cs | 1 - .../Assets/Script/UI/MenuItemController.cs | 2 + .../Assets/Script/UI/OptionUI/OptionUI.cs | 46 +++- 10 files changed, 444 insertions(+), 27 deletions(-) create mode 100644 AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/SelectBorder.controller create mode 100644 AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/SelectBorder.controller.meta create mode 100644 AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/SelectBorderLoop.anim create mode 100644 AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/SelectBorderLoop.anim.meta diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab index 5a20333..575ba43 100644 --- a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/OptionUI.prefab @@ -33,10 +33,10 @@ RectTransform: m_Father: {fileID: 2780569438310375802} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 25, y: -25} - m_SizeDelta: {x: 40, y: 40} + 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!222 &6442047476311195174 CanvasRenderer: @@ -192,6 +192,135 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 +--- !u!1 &1731066637017514641 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2404013603202822047} + - component: {fileID: 2800056879890978085} + - component: {fileID: 5346551564609800717} + - component: {fileID: 8330179430250887958} + - component: {fileID: 8744505332349586225} + - component: {fileID: 2568349821411169439} + m_Layer: 5 + m_Name: SelectBorder + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2404013603202822047 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1731066637017514641} + 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: 5397686940312333149} + m_RootOrder: 2 + 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_SizeDelta: {x: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &2800056879890978085 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1731066637017514641} + m_CullTransparentMesh: 1 +--- !u!114 &5346551564609800717 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1731066637017514641} + 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: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + m_PreserveAspect: 0 + m_FillCenter: 0 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!114 &8330179430250887958 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1731066637017514641} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 1 + m_MinWidth: -1 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 +--- !u!95 &8744505332349586225 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1731066637017514641} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 9100000, guid: 03d70dab4b3bebf4cac606d9801f4ad4, type: 2} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 +--- !u!225 &2568349821411169439 +CanvasGroup: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1731066637017514641} + m_Enabled: 1 + m_Alpha: 1 + m_Interactable: 1 + m_BlocksRaycasts: 1 + m_IgnoreParentGroups: 0 --- !u!1 &2500436782395572584 GameObject: m_ObjectHideFlags: 0 @@ -209,7 +338,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &2780569438310375802 RectTransform: m_ObjectHideFlags: 0 @@ -226,10 +355,10 @@ RectTransform: m_Father: {fileID: 5397686940312333149} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 124.5, y: -540} - m_SizeDelta: {x: 209, y: 50} + 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 &9142037267599823005 MonoBehaviour: @@ -244,10 +373,10 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Padding: - m_Left: 5 - m_Right: 5 - m_Top: 5 - m_Bottom: 5 + m_Left: 20 + m_Right: 20 + m_Top: 20 + m_Bottom: 20 m_ChildAlignment: 4 m_Spacing: 12 m_ChildForceExpandWidth: 0 @@ -282,6 +411,7 @@ GameObject: - component: {fileID: 5397686940312333149} - component: {fileID: 1188777947975519706} - component: {fileID: 4924150661256616665} + - component: {fileID: 8076475514644024618} m_Layer: 5 m_Name: MenuRoot m_TagString: Untagged @@ -302,6 +432,7 @@ RectTransform: m_Children: - {fileID: 8581099496228509946} - {fileID: 2780569438310375802} + - {fileID: 2404013603202822047} m_Father: {fileID: 4478785627166277610} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -323,13 +454,13 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Padding: - m_Left: 20 - m_Right: 20 + m_Left: 0 + m_Right: 0 m_Top: 0 m_Bottom: 0 m_ChildAlignment: 4 - m_Spacing: 12 - m_ChildForceExpandWidth: 0 + m_Spacing: 0 + m_ChildForceExpandWidth: 1 m_ChildForceExpandHeight: 0 m_ChildControlWidth: 1 m_ChildControlHeight: 1 @@ -350,6 +481,26 @@ MonoBehaviour: m_EditorClassIdentifier: m_HorizontalFit: 2 m_VerticalFit: 0 +--- !u!114 &8076475514644024618 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3968697266383191021} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreLayout: 0 + m_MinWidth: 400 + m_MinHeight: -1 + m_PreferredWidth: -1 + m_PreferredHeight: -1 + m_FlexibleWidth: -1 + m_FlexibleHeight: -1 + m_LayoutPriority: 1 --- !u!1 &4478785627166277609 GameObject: m_ObjectHideFlags: 0 @@ -399,7 +550,10 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: d9077edba700447499a21395109542df, type: 3} m_Name: m_EditorClassIdentifier: + PulseInvoke_Delay: 0.4 + PulseInvoke_Interval: 0.05 MenuRoot: {fileID: 5397686940312333149} + SelectBorder: {fileID: 2404013603202822047} TEMPLATE_EXECUTEITEM: {fileID: 3721725547312714320} --- !u!1 &6998597834321643812 GameObject: @@ -433,10 +587,10 @@ RectTransform: m_Father: {fileID: 2780569438310375802} m_RootOrder: 1 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 130.5, y: -25} - m_SizeDelta: {x: 147, y: 30} + 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!222 &6532365540230118336 CanvasRenderer: diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/SelectBorder.controller b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/SelectBorder.controller new file mode 100644 index 0000000..a8e2342 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/SelectBorder.controller @@ -0,0 +1,72 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: SelectBorder + serializedVersion: 5 + m_AnimatorParameters: [] + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: Base Layer + m_StateMachine: {fileID: 67293628948416311} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1107 &67293628948416311 +AnimatorStateMachine: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Base Layer + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 5956899137579874003} + m_Position: {x: 340, y: 100, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 5956899137579874003} +--- !u!1102 &5956899137579874003 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: DEFAULT + m_Speed: 1.5 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: 7400000, guid: 439c6f728b1b8364896c749f3afb4b5e, type: 2} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/SelectBorder.controller.meta b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/SelectBorder.controller.meta new file mode 100644 index 0000000..4c62739 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/SelectBorder.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 03d70dab4b3bebf4cac606d9801f4ad4 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/SelectBorderLoop.anim b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/SelectBorderLoop.anim new file mode 100644 index 0000000..3ce0df1 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/SelectBorderLoop.anim @@ -0,0 +1,134 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: SelectBorderLoop + serializedVersion: 7 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.3 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2 + value: 0.3 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Alpha + path: + classID: 225 + script: {fileID: 0} + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: + - serializedVersion: 2 + path: 0 + attribute: 1574349066 + script: {fileID: 0} + typeID: 225 + customType: 0 + isPPtrCurve: 0 + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 2 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 1 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: + - curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0.3 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 2 + value: 0.3 + inSlope: 0 + outSlope: 0 + tangentMode: 136 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + attribute: m_Alpha + path: + classID: 225 + script: {fileID: 0} + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/SelectBorderLoop.anim.meta b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/SelectBorderLoop.anim.meta new file mode 100644 index 0000000..ac68c8b --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Resources/UIPrefabs/SelectBorderLoop.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 439c6f728b1b8364896c749f3afb4b5e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/App.cs b/AxibugEmuOnline.Client/Assets/Script/App.cs index 3af9f5d..9f60457 100644 --- a/AxibugEmuOnline.Client/Assets/Script/App.cs +++ b/AxibugEmuOnline.Client/Assets/Script/App.cs @@ -2,6 +2,7 @@ using AxibugEmuOnline.Client.Network; using System; using System.Collections; +using System.Net.Sockets; using UnityEngine; namespace AxibugEmuOnline.Client.ClientCore @@ -43,7 +44,7 @@ namespace AxibugEmuOnline.Client.ClientCore nesRomLib = new RomLib(EnumPlatform.NES); CacheMgr = new CacheManager(); SceneLoader = new AppSceneLoader(); - roomMgr = new AppRoom(); + roomMgr = new AppRoom(); var go = new GameObject("[AppAxibugEmuOnline]"); GameObject.DontDestroyOnLoad(go); diff --git a/AxibugEmuOnline.Client/Assets/Script/Manager/AppChat.cs b/AxibugEmuOnline.Client/Assets/Script/Manager/AppChat.cs index 92f531e..4ab2e28 100644 --- a/AxibugEmuOnline.Client/Assets/Script/Manager/AppChat.cs +++ b/AxibugEmuOnline.Client/Assets/Script/Manager/AppChat.cs @@ -3,6 +3,7 @@ using AxibugEmuOnline.Client.Common; using AxibugEmuOnline.Client.Event; using AxibugEmuOnline.Client.Network; using AxibugProtobuf; +using System; namespace AxibugEmuOnline.Client.Manager { diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs index 1462b37..07eff9b 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandExcuter.cs @@ -102,7 +102,6 @@ namespace AxibugEmuOnline.Client protected virtual void OnCmdOptionMenu() { } protected virtual bool OnCmdEnter() => false; protected virtual void OnCmdBack() { } - protected abstract void OnSelectMenuChanged(); } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/MenuItemController.cs b/AxibugEmuOnline.Client/Assets/Script/UI/MenuItemController.cs index 49c4f04..909afcf 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/MenuItemController.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/MenuItemController.cs @@ -72,6 +72,8 @@ namespace AxibugEmuOnline.Client m_enteredItem = null; } } + + protected abstract void OnSelectMenuChanged(); } public abstract class MenuItemController : MenuItemController diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs index 8a5da68..dd83239 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs @@ -12,21 +12,43 @@ namespace AxibugEmuOnline.Client [SerializeField] RectTransform MenuRoot; + [SerializeField] + RectTransform SelectBorder; [Space] [Header("模板")] [SerializeField] OptionUI_ExecuteItem TEMPLATE_EXECUTEITEM; public override bool AloneMode => true; + public override bool Enable => m_bPoped; private bool m_bPoped = false; private List m_runtimeMenuItems = new List(); + private int m_selectIndex = -1; + public int SelectIndex + { + get { return m_selectIndex; } + set + { + value = Mathf.Clamp(value, 0, m_runtimeMenuItems.Count - 1); + if (m_selectIndex == value) return; + + m_selectIndex = value; + + var itemUIRect = m_runtimeMenuItems[m_selectIndex].transform as RectTransform; + SelectBorder.pivot = itemUIRect.pivot; + SelectBorder.sizeDelta = itemUIRect.rect.size; + DOTween.To(() => SelectBorder.position, (value) => SelectBorder.position = value, itemUIRect.position, 0.125f); + SelectBorder.SetAsLastSibling(); + } + } + protected override void Awake() { Instance = this; TEMPLATE_EXECUTEITEM.gameObject.SetActiveEx(false); - + SelectBorder.gameObject.SetActiveEx(false); base.Awake(); } @@ -58,6 +80,17 @@ namespace AxibugEmuOnline.Client ReleaseRuntimeMenus(); foreach (var menu in menus) CreateRuntimeMenuItem(menu); CommandDispatcher.Instance.RegistController(this); + SelectBorder.gameObject.SetActiveEx(true); + + Canvas.ForceUpdateCanvases(); + + m_selectIndex = 0; + var itemUIRect = m_runtimeMenuItems[m_selectIndex].transform as RectTransform; + SelectBorder.pivot = itemUIRect.pivot; + SelectBorder.position = itemUIRect.position; + SelectBorder.sizeDelta = itemUIRect.rect.size; + SelectBorder.SetAsLastSibling(); + if (!m_bPoped) { m_bPoped = true; @@ -79,6 +112,8 @@ namespace AxibugEmuOnline.Client { if (m_bPoped) { + SelectBorder.gameObject.SetActiveEx(false); + CommandDispatcher.Instance.UnRegistController(this); m_bPoped = false; Canvas.ForceUpdateCanvases(); @@ -117,11 +152,14 @@ namespace AxibugEmuOnline.Client m_runtimeMenuItems.Clear(); } - public override bool Enable => m_bPoped; - - protected override void OnSelectMenuChanged() + protected override void OnCmdSelectItemDown() { + SelectIndex++; + } + protected override void OnCmdSelectItemUp() + { + SelectIndex--; } } From ec8f01065b2c83844a98c901e3e4758ac9388cc6 Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Thu, 12 Sep 2024 17:47:55 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E5=88=A0=E4=B8=80=E4=B8=8B=E5=91=BD?= =?UTF-8?q?=E5=90=8D=E7=A9=BA=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AxibugEmuOnline.Client/Assets/Script/App.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/App.cs b/AxibugEmuOnline.Client/Assets/Script/App.cs index 9f60457..7c96c3d 100644 --- a/AxibugEmuOnline.Client/Assets/Script/App.cs +++ b/AxibugEmuOnline.Client/Assets/Script/App.cs @@ -1,8 +1,6 @@ 锘縰sing AxibugEmuOnline.Client.Manager; using AxibugEmuOnline.Client.Network; -using System; using System.Collections; -using System.Net.Sockets; using UnityEngine; namespace AxibugEmuOnline.Client.ClientCore