From 7209b52c93613e9a7b98a6ba921e62bacbbbbfcf Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Thu, 12 Sep 2024 17:47:05 +0800 Subject: [PATCH] =?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--; } }