diff --git a/Assets/Resources/Prefabs/UI/Toolbar/Toolbar.prefab b/Assets/Resources/Prefabs/UI/Toolbar/Toolbar.prefab index ad079a64..252bc00a 100644 --- a/Assets/Resources/Prefabs/UI/Toolbar/Toolbar.prefab +++ b/Assets/Resources/Prefabs/UI/Toolbar/Toolbar.prefab @@ -11,7 +11,7 @@ GameObject: - component: {fileID: 8849628700159893901} - component: {fileID: 3825612598300117465} - component: {fileID: 6541545458344494002} - - component: {fileID: 133595411402575730} + - component: {fileID: 5195573723593518711} - component: {fileID: 7913949744637121483} m_Layer: 5 m_Name: Toolbar @@ -39,7 +39,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} m_AnchoredPosition: {x: 10, y: -80} - m_SizeDelta: {x: 60, y: 300} + m_SizeDelta: {x: 34, y: 300} m_Pivot: {x: 0, y: 1} --- !u!222 &3825612598300117465 CanvasRenderer: @@ -61,7 +61,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 2c8047638e9a7ca4495254682609d580, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &133595411402575730 +--- !u!114 &5195573723593518711 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -70,7 +70,7 @@ MonoBehaviour: m_GameObject: {fileID: 1206908582753628858} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 60240c8d04420604681084344d3a0253, type: 3} + m_Script: {fileID: 11500000, guid: 2eb6cd37a2c94ca48b031d1a9c160e46, type: 3} m_Name: m_EditorClassIdentifier: standardButtonPrefab: {fileID: 9218577172950644075, guid: 6ddcf28d4dbbab846af10da00d6a25e8, type: 3} @@ -94,8 +94,8 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Padding: - m_Left: 0 - m_Right: 0 + m_Left: 2 + m_Right: 2 m_Top: 5 m_Bottom: 5 m_ChildAlignment: 1 diff --git a/Assets/Resources/Prefabs/UI/Toolbar/ToolbarExpandableButton.prefab b/Assets/Resources/Prefabs/UI/Toolbar/ToolbarExpandableButton.prefab index 16b0f9bd..d6b94ac7 100644 --- a/Assets/Resources/Prefabs/UI/Toolbar/ToolbarExpandableButton.prefab +++ b/Assets/Resources/Prefabs/UI/Toolbar/ToolbarExpandableButton.prefab @@ -251,7 +251,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 20, y: 20} + m_SizeDelta: {x: 30, y: 30} m_Pivot: {x: 0, y: 1} --- !u!222 &5596571647579825329 CanvasRenderer: @@ -360,10 +360,10 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_IgnoreLayout: 0 - m_MinWidth: 20 - m_MinHeight: 20 - m_PreferredWidth: 20 - m_PreferredHeight: 20 - m_FlexibleWidth: 20 - m_FlexibleHeight: 20 + m_MinWidth: 30 + m_MinHeight: 30 + m_PreferredWidth: 30 + m_PreferredHeight: 30 + m_FlexibleWidth: 30 + m_FlexibleHeight: 30 m_LayoutPriority: 1 diff --git a/Assets/Resources/Prefabs/UI/Toolbar/ToolbarRadioButton.prefab b/Assets/Resources/Prefabs/UI/Toolbar/ToolbarRadioButton.prefab index b10b91ca..ae0d58d1 100644 --- a/Assets/Resources/Prefabs/UI/Toolbar/ToolbarRadioButton.prefab +++ b/Assets/Resources/Prefabs/UI/Toolbar/ToolbarRadioButton.prefab @@ -268,8 +268,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: -20, y: 20} - m_SizeDelta: {x: 20, y: 20} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 30, y: 30} m_Pivot: {x: 0, y: 1} --- !u!114 &5516198187994438965 MonoBehaviour: @@ -344,12 +344,12 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_IgnoreLayout: 0 - m_MinWidth: 20 - m_MinHeight: 20 - m_PreferredWidth: 20 - m_PreferredHeight: 20 - m_FlexibleWidth: 20 - m_FlexibleHeight: 20 + m_MinWidth: 30 + m_MinHeight: 30 + m_PreferredWidth: 30 + m_PreferredHeight: 30 + m_FlexibleWidth: 30 + m_FlexibleHeight: 30 m_LayoutPriority: 1 --- !u!1 &8870708017338182451 GameObject: diff --git a/Assets/Resources/Prefabs/UI/Toolbar/ToolbarSeparator.prefab b/Assets/Resources/Prefabs/UI/Toolbar/ToolbarSeparator.prefab index 07903f00..2501b7d2 100644 --- a/Assets/Resources/Prefabs/UI/Toolbar/ToolbarSeparator.prefab +++ b/Assets/Resources/Prefabs/UI/Toolbar/ToolbarSeparator.prefab @@ -36,7 +36,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 16, y: 1} + m_SizeDelta: {x: 26, y: 1} m_Pivot: {x: 0, y: 1} --- !u!222 &2193016365674033586 CanvasRenderer: @@ -89,10 +89,10 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_IgnoreLayout: 0 - m_MinWidth: 16 + m_MinWidth: 26 m_MinHeight: 1 - m_PreferredWidth: 16 + m_PreferredWidth: 26 m_PreferredHeight: 1 - m_FlexibleWidth: 16 + m_FlexibleWidth: 26 m_FlexibleHeight: 1 m_LayoutPriority: 1 diff --git a/Assets/Resources/Prefabs/UI/Toolbar/ToolbarStandardButton.prefab b/Assets/Resources/Prefabs/UI/Toolbar/ToolbarStandardButton.prefab index 31769f70..afe56cbe 100644 --- a/Assets/Resources/Prefabs/UI/Toolbar/ToolbarStandardButton.prefab +++ b/Assets/Resources/Prefabs/UI/Toolbar/ToolbarStandardButton.prefab @@ -251,7 +251,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 20, y: 20} + m_SizeDelta: {x: 30, y: 30} m_Pivot: {x: 0, y: 1} --- !u!222 &5596571647579825329 CanvasRenderer: @@ -360,10 +360,10 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_IgnoreLayout: 0 - m_MinWidth: 20 - m_MinHeight: 20 - m_PreferredWidth: 20 - m_PreferredHeight: 20 - m_FlexibleWidth: 20 - m_FlexibleHeight: 20 + m_MinWidth: 30 + m_MinHeight: 30 + m_PreferredWidth: 30 + m_PreferredHeight: 30 + m_FlexibleWidth: 30 + m_FlexibleHeight: 30 m_LayoutPriority: 1 diff --git a/Assets/Resources/Prefabs/UI/Toolbar/ToolbarSubMenuPanel.prefab b/Assets/Resources/Prefabs/UI/Toolbar/ToolbarSubMenuPanel.prefab index 2f6c1400..55a1eebd 100644 --- a/Assets/Resources/Prefabs/UI/Toolbar/ToolbarSubMenuPanel.prefab +++ b/Assets/Resources/Prefabs/UI/Toolbar/ToolbarSubMenuPanel.prefab @@ -230,7 +230,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 20, y: 20} + m_SizeDelta: {x: 34, y: 34} m_Pivot: {x: 0, y: 1} --- !u!222 &6840350081958449137 CanvasRenderer: diff --git a/Assets/Resources/Prefabs/UI/Toolbar/ToolbarToggleButton.prefab b/Assets/Resources/Prefabs/UI/Toolbar/ToolbarToggleButton.prefab index d610b958..b1be448b 100644 --- a/Assets/Resources/Prefabs/UI/Toolbar/ToolbarToggleButton.prefab +++ b/Assets/Resources/Prefabs/UI/Toolbar/ToolbarToggleButton.prefab @@ -344,7 +344,7 @@ RectTransform: m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 20, y: 20} + m_SizeDelta: {x: 30, y: 30} m_Pivot: {x: 0, y: 1} --- !u!114 &5516198187994438965 MonoBehaviour: @@ -419,10 +419,10 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_IgnoreLayout: 0 - m_MinWidth: 20 - m_MinHeight: 20 - m_PreferredWidth: 20 - m_PreferredHeight: 20 - m_FlexibleWidth: 20 - m_FlexibleHeight: 20 + m_MinWidth: 30 + m_MinHeight: 30 + m_PreferredWidth: 30 + m_PreferredHeight: 30 + m_FlexibleWidth: 30 + m_FlexibleHeight: 30 m_LayoutPriority: 1 diff --git a/Assets/Resources/Prefabs/UI/Toolbar/images/ic_chapture_white.png b/Assets/Resources/Prefabs/UI/Toolbar/images/ic_capture_white.png similarity index 100% rename from Assets/Resources/Prefabs/UI/Toolbar/images/ic_chapture_white.png rename to Assets/Resources/Prefabs/UI/Toolbar/images/ic_capture_white.png diff --git a/Assets/Resources/Prefabs/UI/Toolbar/images/ic_chapture_white.png.meta b/Assets/Resources/Prefabs/UI/Toolbar/images/ic_capture_white.png.meta similarity index 100% rename from Assets/Resources/Prefabs/UI/Toolbar/images/ic_chapture_white.png.meta rename to Assets/Resources/Prefabs/UI/Toolbar/images/ic_capture_white.png.meta diff --git a/Assets/Resources/Prefabs/UI/Toolbox/Toolbox.prefab b/Assets/Resources/Prefabs/UI/Toolbox/Toolbox.prefab index 0892dfe8..2060ef3a 100644 --- a/Assets/Resources/Prefabs/UI/Toolbox/Toolbox.prefab +++ b/Assets/Resources/Prefabs/UI/Toolbox/Toolbox.prefab @@ -11,7 +11,7 @@ GameObject: - component: {fileID: 8849628700159893901} - component: {fileID: 3825612598300117465} - component: {fileID: -5269853908805418363} - - component: {fileID: 133595411402575730} + - component: {fileID: 7699290495808528696} - component: {fileID: 1218744162406425590} m_Layer: 5 m_Name: Toolbox @@ -61,7 +61,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: b8045a62c23fdbb479bb5160bba0d9be, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &133595411402575730 +--- !u!114 &7699290495808528696 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -70,7 +70,7 @@ MonoBehaviour: m_GameObject: {fileID: 1206908582753628858} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 60240c8d04420604681084344d3a0253, type: 3} + m_Script: {fileID: 11500000, guid: 2eb6cd37a2c94ca48b031d1a9c160e46, type: 3} m_Name: m_EditorClassIdentifier: standardButtonPrefab: {fileID: 9218577172950644075, guid: 46c3c3914627e1d4193201897b623780, type: 3} diff --git a/Assets/Resources/Prefabs/UI/Toolbox/ToolboxExpandableButton.prefab b/Assets/Resources/Prefabs/UI/Toolbox/ToolboxExpandableButton.prefab index 0627748a..c9509bb5 100644 --- a/Assets/Resources/Prefabs/UI/Toolbox/ToolboxExpandableButton.prefab +++ b/Assets/Resources/Prefabs/UI/Toolbox/ToolboxExpandableButton.prefab @@ -313,8 +313,8 @@ MonoBehaviour: m_Transition: 1 m_Colors: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} - m_HighlightedColor: {r: 0.15686275, g: 0.15686275, b: 0.17254902, a: 1} - m_PressedColor: {r: 0.15686275, g: 0.15686275, b: 0.17254902, a: 1} + m_HighlightedColor: {r: 0.33333334, g: 0.33333334, b: 0.33333334, a: 1} + m_PressedColor: {r: 0.33333334, g: 0.33333334, b: 0.33333334, a: 1} m_SelectedColor: {r: 1, g: 1, b: 1, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 diff --git a/Assets/Resources/Prefabs/UI/Toolbox/ToolboxRadioButton.prefab b/Assets/Resources/Prefabs/UI/Toolbox/ToolboxRadioButton.prefab index 8c3d98bd..0af5e2f5 100644 --- a/Assets/Resources/Prefabs/UI/Toolbox/ToolboxRadioButton.prefab +++ b/Assets/Resources/Prefabs/UI/Toolbox/ToolboxRadioButton.prefab @@ -293,8 +293,8 @@ MonoBehaviour: m_Transition: 1 m_Colors: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} - m_HighlightedColor: {r: 0.15686275, g: 0.15686275, b: 0.17254902, a: 1} - m_PressedColor: {r: 0.15686275, g: 0.15686275, b: 0.17254902, a: 1} + m_HighlightedColor: {r: 0.33333334, g: 0.33333334, b: 0.33333334, a: 1} + m_PressedColor: {r: 0.33333334, g: 0.33333334, b: 0.33333334, a: 1} m_SelectedColor: {r: 1, g: 1, b: 1, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 diff --git a/Assets/Resources/Prefabs/UI/Toolbox/ToolboxStandardButton.prefab b/Assets/Resources/Prefabs/UI/Toolbox/ToolboxStandardButton.prefab index 9ea45362..f585f38d 100644 --- a/Assets/Resources/Prefabs/UI/Toolbox/ToolboxStandardButton.prefab +++ b/Assets/Resources/Prefabs/UI/Toolbox/ToolboxStandardButton.prefab @@ -313,8 +313,8 @@ MonoBehaviour: m_Transition: 1 m_Colors: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} - m_HighlightedColor: {r: 0.15686275, g: 0.15686275, b: 0.17254902, a: 1} - m_PressedColor: {r: 0.15686275, g: 0.15686275, b: 0.17254902, a: 1} + m_HighlightedColor: {r: 0.33333334, g: 0.33333334, b: 0.33333334, a: 1} + m_PressedColor: {r: 0.33333334, g: 0.33333334, b: 0.33333334, a: 1} m_SelectedColor: {r: 1, g: 1, b: 1, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 diff --git a/Assets/Resources/Prefabs/UI/Toolbox/ToolboxToggleButton.prefab b/Assets/Resources/Prefabs/UI/Toolbox/ToolboxToggleButton.prefab index e52135ff..7f200453 100644 --- a/Assets/Resources/Prefabs/UI/Toolbox/ToolboxToggleButton.prefab +++ b/Assets/Resources/Prefabs/UI/Toolbox/ToolboxToggleButton.prefab @@ -172,7 +172,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &5993489077151453672 RectTransform: m_ObjectHideFlags: 0 @@ -368,8 +368,8 @@ MonoBehaviour: m_Transition: 1 m_Colors: m_NormalColor: {r: 1, g: 1, b: 1, a: 1} - m_HighlightedColor: {r: 0.15686275, g: 0.15686275, b: 0.17254902, a: 1} - m_PressedColor: {r: 0.15686275, g: 0.15686275, b: 0.17254902, a: 1} + m_HighlightedColor: {r: 0.3317708, g: 0.3317708, b: 0.33333334, a: 1} + m_PressedColor: {r: 0.33333334, g: 0.33333334, b: 0.33333334, a: 1} m_SelectedColor: {r: 1, g: 1, b: 1, a: 1} m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} m_ColorMultiplier: 1 diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 33d32f99..6709bf1d 100644 --- a/Assets/Scenes/Main.unity +++ b/Assets/Scenes/Main.unity @@ -824,8 +824,8 @@ RectTransform: - {fileID: 1694507572} - {fileID: 19718907} - {fileID: 2037570841} - - {fileID: 856020556} - - {fileID: 1237517542} + - {fileID: 769109586} + - {fileID: 1379798063} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -877,6 +877,108 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: ccb57283566667d45924328b93aeb7f4, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!1001 &769109585 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 483439351} + m_Modifications: + - target: {fileID: 1206908582753628858, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_Name + value: Toolbar + objectReference: {fileID: 0} + - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_Pivot.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_Pivot.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_AnchorMax.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_SizeDelta.x + value: 34 + objectReference: {fileID: 0} + - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_SizeDelta.y + value: 300 + objectReference: {fileID: 0} + - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_AnchoredPosition.x + value: 10 + objectReference: {fileID: 0} + - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_AnchoredPosition.y + value: -80 + objectReference: {fileID: 0} + - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} +--- !u!224 &769109586 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} + m_PrefabInstance: {fileID: 769109585} + m_PrefabAsset: {fileID: 0} --- !u!1 &832575517 GameObject: m_ObjectHideFlags: 0 @@ -926,11 +1028,6 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!224 &856020556 stripped -RectTransform: - m_CorrespondingSourceObject: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - m_PrefabInstance: {fileID: 4671278531516404769} - m_PrefabAsset: {fileID: 0} --- !u!1 &945196058 GameObject: m_ObjectHideFlags: 0 @@ -1139,7 +1236,7 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1101428664} m_CullTransparentMesh: 1 ---- !u!1001 &1237517541 +--- !u!1001 &1379798062 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 @@ -1236,10 +1333,10 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 43766caa723360d4c97983845e6749fe, type: 3} ---- !u!224 &1237517542 stripped +--- !u!224 &1379798063 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 8849628700159893901, guid: 43766caa723360d4c97983845e6749fe, type: 3} - m_PrefabInstance: {fileID: 1237517541} + m_PrefabInstance: {fileID: 1379798062} m_PrefabAsset: {fileID: 0} --- !u!1 &1561871829 GameObject: @@ -1783,143 +1880,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2037570840} m_CullTransparentMesh: 1 ---- !u!1001 &4671278531516404769 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 483439351} - m_Modifications: - - target: {fileID: 1206908582753628858, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_Name - value: Toolbar - objectReference: {fileID: 0} - - target: {fileID: 5114632767715460752, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_AnchorMax.x - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 5114632767715460752, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_AnchorMax.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 5114632767715460752, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_AnchorMin.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5114632767715460752, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_AnchorMin.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 5114632767715460752, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_SizeDelta.x - value: 4 - objectReference: {fileID: 0} - - target: {fileID: 5114632767715460752, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_SizeDelta.y - value: 4 - objectReference: {fileID: 0} - - target: {fileID: 5114632767715460752, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_AnchoredPosition.x - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 5114632767715460752, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_AnchoredPosition.y - value: -2 - objectReference: {fileID: 0} - - target: {fileID: 7913949744637121483, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_Padding.m_Left - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 7913949744637121483, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_Padding.m_Right - value: 2 - objectReference: {fileID: 0} - - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_Pivot.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_Pivot.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_AnchorMax.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_AnchorMax.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_AnchorMin.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_AnchorMin.y - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_SizeDelta.x - value: 24 - objectReference: {fileID: 0} - - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_SizeDelta.y - value: 300 - objectReference: {fileID: 0} - - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_LocalPosition.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_LocalPosition.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_LocalPosition.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_LocalRotation.x - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_LocalRotation.y - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_LocalRotation.z - value: -0 - objectReference: {fileID: 0} - - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_AnchoredPosition.x - value: 10 - objectReference: {fileID: 0} - - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_AnchoredPosition.y - value: -80 - objectReference: {fileID: 0} - - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8849628700159893901, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 5a23b2bd2bd04c045878e1a06b3b9aa2, type: 3} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/UVC/UI/ToolBar/Model.meta b/Assets/Scripts/UVC/UI/ToolBar/Model.meta new file mode 100644 index 00000000..21573361 --- /dev/null +++ b/Assets/Scripts/UVC/UI/ToolBar/Model.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6c1fc3d4cc5339c429588952b08b1c0f +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/UVC/UI/ToolBar/IToolbarItem.cs b/Assets/Scripts/UVC/UI/ToolBar/Model/IToolbarItem.cs similarity index 98% rename from Assets/Scripts/UVC/UI/ToolBar/IToolbarItem.cs rename to Assets/Scripts/UVC/UI/ToolBar/Model/IToolbarItem.cs index 88ebc227..e4e41a72 100644 --- a/Assets/Scripts/UVC/UI/ToolBar/IToolbarItem.cs +++ b/Assets/Scripts/UVC/UI/ToolBar/Model/IToolbarItem.cs @@ -1,4 +1,4 @@ -namespace UVC.UI.Toolbar +namespace UVC.UI.Toolbar.Model { /// /// 툴바에 추가될 수 있는 모든 항목(예: 버튼, 구분선, 드롭다운 메뉴 등)의 diff --git a/Assets/Scripts/UVC/UI/ToolBar/IToolbarItem.cs.meta b/Assets/Scripts/UVC/UI/ToolBar/Model/IToolbarItem.cs.meta similarity index 100% rename from Assets/Scripts/UVC/UI/ToolBar/IToolbarItem.cs.meta rename to Assets/Scripts/UVC/UI/ToolBar/Model/IToolbarItem.cs.meta diff --git a/Assets/Scripts/UVC/UI/ToolBar/ToolbarButtonBase.cs b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarButtonBase.cs similarity index 87% rename from Assets/Scripts/UVC/UI/ToolBar/ToolbarButtonBase.cs rename to Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarButtonBase.cs index 649e2037..4ddce37d 100644 --- a/Assets/Scripts/UVC/UI/ToolBar/ToolbarButtonBase.cs +++ b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarButtonBase.cs @@ -1,7 +1,7 @@ using System; using UVC.UI.Commands; -namespace UVC.UI.Toolbar +namespace UVC.UI.Toolbar.Model { /// /// 툴바에 사용되는 모든 버튼(표준 버튼, 토글 버튼, 확장 버튼 등)의 기본 추상 클래스입니다. @@ -23,7 +23,7 @@ namespace UVC.UI.Toolbar /// Text = text; // 부모 클래스의 Text 속성 사용 /// IconSpritePath = iconPath; // 부모 클래스의 IconSpritePath 속성 사용 /// ClickCommand = command; // 부모 클래스의 ClickCommand 속성 사용 - /// TooltipKey = tooltip; // 부모 클래스의 TooltipKey 속성 사용 + /// Tooltip = tooltip; // 부모 클래스의 Tooltip 속성 사용 /// IsEnabled = true; // 기본적으로 활성화 상태로 설정 /// } /// @@ -130,28 +130,28 @@ namespace UVC.UI.Toolbar } } - protected string _tooltipKey; + protected string _tooltip; /// /// 버튼에 마우스를 올렸을 때 표시될 툴팁의 텍스트 또는 다국어 키입니다. - /// TooltipKey 변경 시에는 기본적으로 OnStateChanged 이벤트가 발생하지 않지만, + /// Tooltip 변경 시에는 기본적으로 OnStateChanged 이벤트가 발생하지 않지만, /// 필요에 따라 View에서 이 값을 직접 참조하여 툴팁을 업데이트할 수 있습니다. /// /// /// - /// button.TooltipKey = "tooltip_save_button"; // 다국어 키 사용 - /// button.TooltipKey = "클릭하여 문서를 저장합니다."; // 직접 텍스트 사용 + /// button.Tooltip = "tooltip_save_button"; // 다국어 키 사용 + /// button.Tooltip = "클릭하여 문서를 저장합니다."; // 직접 텍스트 사용 /// /// - public string TooltipKey + public string Tooltip { - get => _tooltipKey; + get => _tooltip; set { - if (_tooltipKey != value) + if (_tooltip != value) { - _tooltipKey = value; - // TooltipKey 변경 시 OnStateChanged를 호출할 필요는 일반적으로 없으나, - // 만약 UI가 TooltipKey 자체를 표시하는 등의 로직이 있다면 필요할 수 있습니다. + _tooltip = value; + // Tooltip 변경 시 OnStateChanged를 호출할 필요는 일반적으로 없으나, + // 만약 UI가 Tooltip 자체를 표시하는 등의 로직이 있다면 필요할 수 있습니다. // 여기서는 툴팁 내용이 동적으로 변경되는 경우가 적다고 가정하고 생략합니다. // 필요하다면 OnStateChanged?.Invoke(); 추가 } @@ -216,5 +216,15 @@ namespace UVC.UI.Toolbar { OnStateChanged?.Invoke(); } + + /// + /// 이 버튼 모델에 연결된 모든 이벤트 핸들러를 정리(구독 해제)합니다. + /// 주로 View가 파괴되거나 UI가 재생성될 때 호출되어 메모리 누수를 방지합니다. + /// 파생 클래스에서는 이 메서드를 재정의하여 해당 클래스에 특화된 이벤트를 추가로 정리해야 합니다. + /// + public virtual void ClearEventHandlers() + { + OnStateChanged = null; + } } } \ No newline at end of file diff --git a/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarButtonBase.cs.meta b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarButtonBase.cs.meta new file mode 100644 index 00000000..f1532fd3 --- /dev/null +++ b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarButtonBase.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 0d8d1e1abfa138645b33ce2f969df756 \ No newline at end of file diff --git a/Assets/Scripts/UVC/UI/ToolBar/ToolbarExpandableButton.cs b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarExpandableButton.cs similarity index 90% rename from Assets/Scripts/UVC/UI/ToolBar/ToolbarExpandableButton.cs rename to Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarExpandableButton.cs index 5196dfc9..d12bd3df 100644 --- a/Assets/Scripts/UVC/UI/ToolBar/ToolbarExpandableButton.cs +++ b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarExpandableButton.cs @@ -1,9 +1,8 @@ using System; using System.Collections.Generic; -using UnityEngine; // GameObject 사용을 위해 필요 // using UnityEngine.UI; // Image 사용을 위해 필요할 수 있으나, 모델 클래스에서는 직접적인 UI 참조를 최소화하는 것이 좋음 -namespace UVC.UI.Toolbar +namespace UVC.UI.Toolbar.Model { /// /// 클릭 시 하위 버튼 목록(서브 메뉴)을 표시하거나 숨길 수 있는 확장형 버튼입니다. @@ -17,7 +16,7 @@ namespace UVC.UI.Toolbar /// /// /// - /// // ToolbarController 등에서 확장 버튼 생성 및 설정 예시 + /// // Toolbar 등에서 확장 버튼 생성 및 설정 예시 /// var brushToolButton = mainToolbar.AddExpandableButton( /// "brush_tool_main", // 주 버튼 텍스트 (또는 다국어 키) /// "icons/brush_default", // 주 버튼 기본 아이콘 경로 @@ -30,7 +29,7 @@ namespace UVC.UI.Toolbar /// { /// Text = "brush_small", /// IconSpritePath = "icons/brush_small_icon", - /// TooltipKey = "tooltip_brush_small", + /// Tooltip = "tooltip_brush_small", /// ClickCommand = new ActionCommand(() => Debug.Log("작은 브러시 선택됨")) /// }; /// brushToolButton.SubButtons.Add(smallBrush); @@ -40,7 +39,7 @@ namespace UVC.UI.Toolbar /// { /// Text = "brush_medium", /// IconSpritePath = "icons/brush_medium_icon", - /// TooltipKey = "tooltip_brush_medium", + /// Tooltip = "tooltip_brush_medium", /// ClickCommand = new ActionCommand(() => Debug.Log("중간 브러시 선택됨")) /// }; /// brushToolButton.SubButtons.Add(mediumBrush); @@ -141,5 +140,22 @@ namespace UVC.UI.Toolbar // 만약 여기서 실행해야 한다면: selectedSubButton.ExecuteClick(); } } + + /// + /// 이 버튼 모델 및 모든 하위 버튼 모델에 연결된 이벤트 핸들러를 정리합니다. + /// + public override void ClearEventHandlers() + { + base.ClearEventHandlers(); // 부모 클래스의 이벤트 정리 (OnStateChanged) + OnSubButtonSelected = null; + + if (SubButtons != null) + { + foreach (var subButton in SubButtons) + { + subButton?.ClearEventHandlers(); // 각 하위 버튼의 이벤트 핸들러도 정리 + } + } + } } } \ No newline at end of file diff --git a/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarExpandableButton.cs.meta b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarExpandableButton.cs.meta new file mode 100644 index 00000000..36359e77 --- /dev/null +++ b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarExpandableButton.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: d7b463d85335feb4db9a045177ee9221 \ No newline at end of file diff --git a/Assets/Scripts/UVC/UI/Toolbar/ToolbarModel.cs b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarModel.cs similarity index 92% rename from Assets/Scripts/UVC/UI/Toolbar/ToolbarModel.cs rename to Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarModel.cs index d1b5f2f7..90daf6e4 100644 --- a/Assets/Scripts/UVC/UI/Toolbar/ToolbarModel.cs +++ b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarModel.cs @@ -1,7 +1,6 @@ -using UnityEngine; -using UVC.UI.Commands; +using UVC.UI.Commands; -namespace UVC.UI.Toolbar +namespace UVC.UI.Toolbar.Model { /// /// 툴바의 전체적인 데이터 컨테이너 및 관리 클래스입니다. @@ -16,13 +15,13 @@ namespace UVC.UI.Toolbar /// - 라디오 버튼 그룹 관리: 동일한 그룹 이름을 가진 ToolbarRadioButton들을 내부적으로 ToolbarRadioButtonGroup으로 묶어 관리합니다. /// /// 사용 흐름: - /// 1. ToolbarController (또는 유사한 관리 클래스)에서 ToolbarModel의 인스턴스를 생성합니다. + /// 1. Toolbar (또는 유사한 관리 클래스)에서 ToolbarModel의 인스턴스를 생성합니다. /// 2. 다양한 Add[ButtonType] 메서드 또는 AddItem 메서드를 호출하여 툴바 항목 모델들을 생성하고 ToolbarModel에 추가합니다. /// 3. 설정이 완료된 ToolbarModel 객체를 ToolbarView의 Initialize 메서드에 전달하여 UI를 렌더링하도록 합니다. /// /// /// - /// // ToolbarController 등에서 ToolbarModel 사용 예시 + /// // Toolbar 등에서 ToolbarModel 사용 예시 /// /// // 1. ToolbarModel 인스턴스 생성 /// ToolbarModel myToolbar = new ToolbarModel(); @@ -118,11 +117,11 @@ namespace UVC.UI.Toolbar /// 버튼에 표시될 텍스트 또는 다국어 키입니다. /// 버튼 아이콘의 Resources 경로입니다 (선택 사항). /// 버튼 클릭 시 실행될 ICommand 객체입니다 (선택 사항). - /// 버튼 툴팁의 텍스트 또는 다국어 키입니다 (선택 사항). + /// 버튼 툴팁의 텍스트 또는 다국어 키입니다 (선택 사항). /// 생성되고 추가된 ToolbarStandardButton 객체입니다. - public ToolbarStandardButton AddStandardButton(string text, string iconSpritePath = null, ICommand command = null, string tooltipKey = null) + public ToolbarStandardButton AddStandardButton(string text, string iconSpritePath = null, ICommand command = null, string tooltip = null) { - var button = new ToolbarStandardButton { Text = text, IconSpritePath = iconSpritePath, ClickCommand = command, TooltipKey = tooltipKey }; + var button = new ToolbarStandardButton { Text = text, IconSpritePath = iconSpritePath, ClickCommand = command, Tooltip = tooltip }; AddItem(button); return button; } @@ -136,9 +135,9 @@ namespace UVC.UI.Toolbar /// 버튼이 해제(Off) 상태일 때의 아이콘 경로입니다 (선택 사항). /// 버튼의 선택 상태가 변경될 때 호출될 콜백 함수입니다 (선택 사항). /// 버튼 클릭 시 실행될 ICommand 객체입니다 (선택 사항). - /// 버튼 툴팁의 텍스트 또는 다국어 키입니다 (선택 사항). + /// 버튼 툴팁의 텍스트 또는 다국어 키입니다 (선택 사항). /// 생성되고 추가된 ToolbarToggleButton 객체입니다. - public ToolbarToggleButton AddToggleButton(string text, bool initialState = false, string onIconSpritePath = null, string offIconSpritePath = null, System.Action onToggle = null, ICommand command = null, string tooltipKey = null) + public ToolbarToggleButton AddToggleButton(string text, bool initialState = false, string onIconSpritePath = null, string offIconSpritePath = null, System.Action onToggle = null, ICommand command = null, string tooltip = null) { // ToolbarToggleButton의 IconSpritePath는 '선택된 상태'의 아이콘을 의미합니다. var button = new ToolbarToggleButton @@ -149,7 +148,7 @@ namespace UVC.UI.Toolbar OffIconSpritePath = offIconSpritePath, // 해제 시 아이콘 OnToggle = onToggle, ClickCommand = command, - TooltipKey = tooltipKey + Tooltip = tooltip }; AddItem(button); return button; @@ -166,9 +165,9 @@ namespace UVC.UI.Toolbar /// 버튼이 해제(Off) 상태일 때의 아이콘 경로입니다 (선택 사항). /// 버튼의 선택 상태가 변경될 때 호출될 콜백 함수입니다 (선택 사항). /// 버튼 클릭(선택) 시 실행될 ICommand 객체입니다 (선택 사항). - /// 버튼 툴팁의 텍스트 또는 다국어 키입니다 (선택 사항). + /// 버튼 툴팁의 텍스트 또는 다국어 키입니다 (선택 사항). /// 생성되고 추가된 ToolbarRadioButton 객체입니다. - public ToolbarRadioButton AddRadioButton(string groupName, string text, bool initialState = false, string iconSpritePath = null, string offIconSpritePath = null, System.Action onToggle = null, ICommand command = null, string tooltipKey = null) + public ToolbarRadioButton AddRadioButton(string groupName, string text, bool initialState = false, string iconSpritePath = null, string offIconSpritePath = null, System.Action onToggle = null, ICommand command = null, string tooltip = null) { var button = new ToolbarRadioButton(groupName) { @@ -178,9 +177,9 @@ namespace UVC.UI.Toolbar OffIconSpritePath = offIconSpritePath,// 해제 시 아이콘 OnToggle = onToggle, ClickCommand = command, - TooltipKey = tooltipKey + Tooltip = tooltip }; - + // AddItem 내에서 그룹 등록 및 버튼에 그룹 참조 설정이 이루어집니다. AddItem(button); @@ -200,11 +199,11 @@ namespace UVC.UI.Toolbar /// 주 버튼에 표시될 텍스트 또는 다국어 키입니다. /// 주 버튼의 기본 아이콘 경로입니다 (선택 사항). /// 주 버튼 클릭 시 실행될 ICommand 객체입니다 (선택 사항, 하위 메뉴 토글과는 별개일 수 있음). - /// 주 버튼 툴팁의 텍스트 또는 다국어 키입니다 (선택 사항). + /// 주 버튼 툴팁의 텍스트 또는 다국어 키입니다 (선택 사항). /// 생성되고 추가된 ToolbarExpandableButton 객체입니다. - public ToolbarExpandableButton AddExpandableButton(string text, string iconSpritePath = null, ICommand command = null, string tooltipKey = null) + public ToolbarExpandableButton AddExpandableButton(string text, string iconSpritePath = null, ICommand command = null, string tooltip = null) { - var button = new ToolbarExpandableButton { Text = text, IconSpritePath = iconSpritePath, ClickCommand = command, TooltipKey = tooltipKey }; + var button = new ToolbarExpandableButton { Text = text, IconSpritePath = iconSpritePath, ClickCommand = command, Tooltip = tooltip }; AddItem(button); return button; } diff --git a/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarModel.cs.meta b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarModel.cs.meta new file mode 100644 index 00000000..35686308 --- /dev/null +++ b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarModel.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 27e53214281a62642adbdbf761ffd630 \ No newline at end of file diff --git a/Assets/Scripts/UVC/UI/ToolBar/ToolbarRadioButton.cs b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarRadioButton.cs similarity index 91% rename from Assets/Scripts/UVC/UI/ToolBar/ToolbarRadioButton.cs rename to Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarRadioButton.cs index bf08698f..61823f5e 100644 --- a/Assets/Scripts/UVC/UI/ToolBar/ToolbarRadioButton.cs +++ b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarRadioButton.cs @@ -1,6 +1,6 @@ using System; -namespace UVC.UI.Toolbar +namespace UVC.UI.Toolbar.Model { /// /// 라디오 버튼 그룹 내에서 사용되는 버튼입니다. 동일한 GroupName을 가진 라디오 버튼들 중에서 @@ -15,7 +15,7 @@ namespace UVC.UI.Toolbar /// /// /// - /// // ToolbarController 또는 ToolbarModel 등에서 ToolbarRadioButton 생성 및 사용 예시 + /// // Toolbar 또는 ToolbarModel 등에서 ToolbarRadioButton 생성 및 사용 예시 /// /// string cameraViewGroupName = "CameraViewOptions"; /// @@ -25,7 +25,7 @@ namespace UVC.UI.Toolbar /// Text = "view_top", /// IconSpritePath = "icons/toolbar/view_top_on", /// OffIconSpritePath = "icons/toolbar/view_top_off", - /// TooltipKey = "tooltip_top_view", + /// Tooltip = "tooltip_top_view", /// IsSelected = true, // 초기 선택 상태 /// OnToggle = (isSelected) => /// { @@ -44,7 +44,7 @@ namespace UVC.UI.Toolbar /// Text = "view_front", /// IconSpritePath = "icons/toolbar/view_front_on", /// OffIconSpritePath = "icons/toolbar/view_front_off", - /// TooltipKey = "tooltip_front_view", + /// Tooltip = "tooltip_front_view", /// IsSelected = false, // 초기 선택 안됨 /// OnToggle = (isSelected) => /// { @@ -149,5 +149,16 @@ namespace UVC.UI.Toolbar // 위 if(IsSelected) 조건을 제거하거나, 별도의 Command(예: DeselectCommand)를 고려해야 합니다. // 하지만 일반적인 라디오 버튼의 사용 패턴은 선택 시의 액션에 중점을 둡니다. } + + /// + /// 이 버튼 모델에 연결된 모든 이벤트 핸들러를 정리합니다. + /// ToolbarRadioButton은 ToolbarToggleButton에서 상속받은 이벤트 외에 추가적인 이벤트가 없으므로, + /// 부모 클래스의 ClearEventHandlers를 호출합니다. + /// + public override void ClearEventHandlers() + { + base.ClearEventHandlers(); // 부모 클래스(ToolbarToggleButton)의 이벤트 정리 + // ToolbarRadioButton에 특화된 이벤트가 있다면 여기서 정리합니다. + } } } diff --git a/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarRadioButton.cs.meta b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarRadioButton.cs.meta new file mode 100644 index 00000000..9b68dd09 --- /dev/null +++ b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarRadioButton.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 357d7605383a64d4cb43bd295b261c1a \ No newline at end of file diff --git a/Assets/Scripts/UVC/UI/ToolBar/ToolbarRadioButtonGroup.cs b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarRadioButtonGroup.cs similarity index 99% rename from Assets/Scripts/UVC/UI/ToolBar/ToolbarRadioButtonGroup.cs rename to Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarRadioButtonGroup.cs index 630f06a0..5f8d2df9 100644 --- a/Assets/Scripts/UVC/UI/ToolBar/ToolbarRadioButtonGroup.cs +++ b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarRadioButtonGroup.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Linq; -namespace UVC.UI.Toolbar +namespace UVC.UI.Toolbar.Model { /// /// 여러 개의 ToolbarRadioButton 객체들을 하나의 그룹으로 관리합니다. diff --git a/Assets/Scripts/UVC/UI/ToolBar/ToolbarRadioButtonGroup.cs.meta b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarRadioButtonGroup.cs.meta similarity index 100% rename from Assets/Scripts/UVC/UI/ToolBar/ToolbarRadioButtonGroup.cs.meta rename to Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarRadioButtonGroup.cs.meta diff --git a/Assets/Scripts/UVC/UI/ToolBar/ToolbarSeparator.cs b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarSeparator.cs similarity index 94% rename from Assets/Scripts/UVC/UI/ToolBar/ToolbarSeparator.cs rename to Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarSeparator.cs index 1488e1ba..1358380b 100644 --- a/Assets/Scripts/UVC/UI/ToolBar/ToolbarSeparator.cs +++ b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarSeparator.cs @@ -1,4 +1,4 @@ -namespace UVC.UI.Toolbar +namespace UVC.UI.Toolbar.Model { /// /// 툴바 내에서 항목들(예: 버튼 그룹)을 시각적으로 구분하는 구분선을 나타냅니다. @@ -11,7 +11,7 @@ /// /// /// - /// // ToolbarController 또는 ToolbarModel 등에서 ToolbarSeparator 사용 예시 + /// // Toolbar 또는 ToolbarModel 등에서 ToolbarSeparator 사용 예시 /// /// // ToolbarModel 인스턴스가 있다고 가정 /// // ToolbarModel toolbarModel = new ToolbarModel(); diff --git a/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarSeparator.cs.meta b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarSeparator.cs.meta new file mode 100644 index 00000000..b73b1d58 --- /dev/null +++ b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarSeparator.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 2df7acabcce51f34c9495286bc8ed81b \ No newline at end of file diff --git a/Assets/Scripts/UVC/UI/ToolBar/ToolbarStandardButton.cs b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarStandardButton.cs similarity index 81% rename from Assets/Scripts/UVC/UI/ToolBar/ToolbarStandardButton.cs rename to Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarStandardButton.cs index 197d0609..038f5442 100644 --- a/Assets/Scripts/UVC/UI/ToolBar/ToolbarStandardButton.cs +++ b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarStandardButton.cs @@ -1,4 +1,4 @@ -namespace UVC.UI.Toolbar +namespace UVC.UI.Toolbar.Model { /// /// 한 번 클릭으로 특정 동작을 수행하는 표준적인 버튼입니다. @@ -12,7 +12,7 @@ /// /// /// - /// // ToolbarController 또는 ToolbarModel 등에서 ToolbarStandardButton 생성 및 사용 예시 + /// // Toolbar 또는 ToolbarModel 등에서 ToolbarStandardButton 생성 및 사용 예시 /// /// // 1. 버튼 클릭 시 실행될 커맨드 정의 (예: 간단한 로그 출력) /// ICommand saveCommand = new ActionCommand(() => @@ -26,7 +26,7 @@ /// { /// Text = "button_save", // 버튼 텍스트 (다국어 키 또는 실제 텍스트) /// IconSpritePath = "icons/toolbar/save_icon", // Resources 폴더 내 아이콘 경로 - /// TooltipKey = "tooltip_save_button_description", // 툴팁 (다국어 키 또는 실제 텍스트) + /// Tooltip = "tooltip_save_button_description", // 툴팁 (다국어 키 또는 실제 텍스트) /// ClickCommand = saveCommand, // 위에서 정의한 커맨드 할당 /// IsEnabled = true // 버튼 활성화 상태 /// }; @@ -53,13 +53,13 @@ // /// 버튼 텍스트 또는 다국어 키입니다. // /// 아이콘의 Resources 경로입니다. // /// 클릭 시 실행될 커맨드입니다. - // /// 툴팁 텍스트 또는 다국어 키입니다. - // public ToolbarStandardButton(string text, string iconSpritePath = null, ICommand command = null, string tooltipKey = null) + // /// 툴팁 텍스트 또는 다국어 키입니다. + // public ToolbarStandardButton(string text, string iconSpritePath = null, ICommand command = null, string tooltip = null) // { // this.Text = text; // this.IconSpritePath = iconSpritePath; // this.ClickCommand = command; - // this.TooltipKey = tooltipKey; + // this.TooltipKey = tooltip; // } // ToolbarButtonBase의 ExecuteClick 메서드를 그대로 사용합니다. @@ -80,5 +80,17 @@ // // 여기에 ToolbarStandardButton만의 추가적인 로직이 있다면 작성 // // 예를 들어, 클릭 후 특정 사운드 재생 등 // } + + /// + /// 이 버튼 모델에 연결된 모든 이벤트 핸들러를 정리합니다. + /// ToolbarStandardButton은 ToolbarButtonBase에서 상속받은 이벤트 외에 추가적인 이벤트가 없으므로, + /// 기본 구현을 호출합니다. + /// + public override void ClearEventHandlers() + { + base.ClearEventHandlers(); + // ToolbarStandardButton에 특화된 이벤트가 있다면 여기서 정리합니다. + // 예: CustomEvent = null; + } } } \ No newline at end of file diff --git a/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarStandardButton.cs.meta b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarStandardButton.cs.meta new file mode 100644 index 00000000..5dc9cca7 --- /dev/null +++ b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarStandardButton.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: ce9fef59341116a46a731f2afe6a96f9 \ No newline at end of file diff --git a/Assets/Scripts/UVC/UI/ToolBar/ToolbarToggleButton.cs b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarToggleButton.cs similarity index 92% rename from Assets/Scripts/UVC/UI/ToolBar/ToolbarToggleButton.cs rename to Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarToggleButton.cs index 65f15c14..bf9c2622 100644 --- a/Assets/Scripts/UVC/UI/ToolBar/ToolbarToggleButton.cs +++ b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarToggleButton.cs @@ -1,7 +1,6 @@ using System; -using UnityEngine; -namespace UVC.UI.Toolbar +namespace UVC.UI.Toolbar.Model { /// /// 클릭할 때마다 선택(On) 또는 해제(Off) 상태가 전환되는 토글 버튼입니다. @@ -16,7 +15,7 @@ namespace UVC.UI.Toolbar /// /// /// - /// // ToolbarController 또는 ToolbarModel 등에서 ToolbarToggleButton 생성 및 사용 예시 + /// // Toolbar 또는 ToolbarModel 등에서 ToolbarToggleButton 생성 및 사용 예시 /// /// // 1. 토글 상태 변경 시 실행될 액션 정의 (OnToggle 콜백용) /// Action handleMuteToggle = (isMuted) => @@ -39,7 +38,7 @@ namespace UVC.UI.Toolbar /// Text = "button_mute", // 버튼 텍스트 (다국어 키) /// IconSpritePath = "icons/toolbar/sound_on_icon", // 선택(On) 상태 아이콘 /// OffIconSpritePath = "icons/toolbar/sound_off_icon", // 해제(Off) 상태 아이콘 - /// TooltipKey = "tooltip_mute_button", // 툴팁 (다국어 키) + /// Tooltip = "tooltip_mute_button", // 툴팁 (다국어 키) /// IsSelected = false, // 초기 상태는 해제(Off) /// OnToggle = handleMuteToggle, // 상태 변경 시 콜백 할당 /// ClickCommand = muteCommand, // 클릭 커맨드 할당 @@ -155,5 +154,16 @@ namespace UVC.UI.Toolbar ClickCommand.Execute(IsSelected); } } + + /// + /// 이 버튼 모델에 연결된 모든 이벤트 핸들러를 정리합니다. + /// ToolbarButtonBase의 이벤트 외에 ToolbarToggleButton에 특화된 이벤트(OnToggleStateChanged, OnToggle)를 추가로 정리합니다. + /// + public override void ClearEventHandlers() + { + base.ClearEventHandlers(); // 부모 클래스의 이벤트 정리 (OnStateChanged) + OnToggleStateChanged = null; + OnToggle = null; + } } } diff --git a/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarToggleButton.cs.meta b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarToggleButton.cs.meta new file mode 100644 index 00000000..cdb0f2d7 --- /dev/null +++ b/Assets/Scripts/UVC/UI/ToolBar/Model/ToolbarToggleButton.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 9530db2a5b423bf4eb8c5d8e4f9dd5ed \ No newline at end of file diff --git a/Assets/Scripts/UVC/UI/Toolbar/ToolbarController.cs b/Assets/Scripts/UVC/UI/ToolBar/Toolbar.cs similarity index 96% rename from Assets/Scripts/UVC/UI/Toolbar/ToolbarController.cs rename to Assets/Scripts/UVC/UI/ToolBar/Toolbar.cs index 0fe3abca..2caa2519 100644 --- a/Assets/Scripts/UVC/UI/Toolbar/ToolbarController.cs +++ b/Assets/Scripts/UVC/UI/ToolBar/Toolbar.cs @@ -1,10 +1,12 @@ using UnityEngine; using UVC.Locale; using UVC.UI.Commands; +using UVC.UI.Toolbar.Model; +using UVC.UI.Toolbar.View; namespace UVC.UI.Toolbar { - public class ToolbarController : MonoBehaviour + public class Toolbar : MonoBehaviour { protected ToolbarModel mainToolbar; protected ToolbarView mainToolbarView; @@ -100,7 +102,7 @@ namespace UVC.UI.Toolbar // 9. 화면 캡처 mainToolbar.AddStandardButton("button_capture_screen", - "Prefabs/UI/Toolbar/images/ic_chapture_white", + "Prefabs/UI/Toolbar/images/ic_capture_white", new ActionCommand(() => Debug.Log("화면 캡처 버튼 클릭됨")), "tooltip_capture_screen"); @@ -124,7 +126,7 @@ namespace UVC.UI.Toolbar { Text = "brush_size_small", IconSpritePath = "Prefabs/UI/Toolbar/images/ic_brush_small_white", - TooltipKey = "tooltip_brush_small", + Tooltip = "tooltip_brush_small", ClickCommand = smallBrushCmd }; expandableBtnModel.SubButtons.Add(smallBrush); @@ -133,7 +135,7 @@ namespace UVC.UI.Toolbar { Text = "brush_size_medium", IconSpritePath = "Prefabs/UI/Toolbar/images/ic_brush_medium_white", - TooltipKey = "tooltip_brush_medium", + Tooltip = "tooltip_brush_medium", ClickCommand = new ActionCommand(() => Debug.Log("중간 브러시 선택됨 (Sub-Command 실행)")) }; expandableBtnModel.SubButtons.Add(mediumBrush); diff --git a/Assets/Scripts/UVC/UI/Toolbar/ToolbarController.cs.meta b/Assets/Scripts/UVC/UI/ToolBar/Toolbar.cs.meta similarity index 100% rename from Assets/Scripts/UVC/UI/Toolbar/ToolbarController.cs.meta rename to Assets/Scripts/UVC/UI/ToolBar/Toolbar.cs.meta diff --git a/Assets/Scripts/UVC/UI/ToolBar/ToolbarButtonBase.cs.meta b/Assets/Scripts/UVC/UI/ToolBar/ToolbarButtonBase.cs.meta deleted file mode 100644 index 51d32b91..00000000 --- a/Assets/Scripts/UVC/UI/ToolBar/ToolbarButtonBase.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 49e156554491e3c4fb49243701695feb \ No newline at end of file diff --git a/Assets/Scripts/UVC/UI/ToolBar/ToolbarExpandableButton.cs.meta b/Assets/Scripts/UVC/UI/ToolBar/ToolbarExpandableButton.cs.meta deleted file mode 100644 index f689937e..00000000 --- a/Assets/Scripts/UVC/UI/ToolBar/ToolbarExpandableButton.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: c71e02eeca4e94e4b8dedd8f9fb7e4a7 \ No newline at end of file diff --git a/Assets/Scripts/UVC/UI/ToolBar/ToolbarRadioButton.cs.meta b/Assets/Scripts/UVC/UI/ToolBar/ToolbarRadioButton.cs.meta deleted file mode 100644 index 0fbedd82..00000000 --- a/Assets/Scripts/UVC/UI/ToolBar/ToolbarRadioButton.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 451c776768fed71479e8c7a4a73818ea \ No newline at end of file diff --git a/Assets/Scripts/UVC/UI/ToolBar/ToolbarSeparator.cs.meta b/Assets/Scripts/UVC/UI/ToolBar/ToolbarSeparator.cs.meta deleted file mode 100644 index 85d7001e..00000000 --- a/Assets/Scripts/UVC/UI/ToolBar/ToolbarSeparator.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 41943a25123704b4f82ec6417863d158 \ No newline at end of file diff --git a/Assets/Scripts/UVC/UI/ToolBar/ToolbarStandardButton.cs.meta b/Assets/Scripts/UVC/UI/ToolBar/ToolbarStandardButton.cs.meta deleted file mode 100644 index 8779191c..00000000 --- a/Assets/Scripts/UVC/UI/ToolBar/ToolbarStandardButton.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 0d7cc1da90c7117449ff98ba4600c3ce \ No newline at end of file diff --git a/Assets/Scripts/UVC/UI/ToolBar/ToolbarToggleButton.cs.meta b/Assets/Scripts/UVC/UI/ToolBar/ToolbarToggleButton.cs.meta deleted file mode 100644 index 4fabdd8c..00000000 --- a/Assets/Scripts/UVC/UI/ToolBar/ToolbarToggleButton.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 6407c881188c7c04c9cb4efb1dd7b4ce \ No newline at end of file diff --git a/Assets/Scripts/UVC/UI/ToolBar/ToolbarView.cs.meta b/Assets/Scripts/UVC/UI/ToolBar/ToolbarView.cs.meta deleted file mode 100644 index a4cb3719..00000000 --- a/Assets/Scripts/UVC/UI/ToolBar/ToolbarView.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 60240c8d04420604681084344d3a0253 \ No newline at end of file diff --git a/Assets/Scripts/UVC/UI/ToolBar/ToolboxController.cs b/Assets/Scripts/UVC/UI/ToolBar/Toolbox.cs similarity index 95% rename from Assets/Scripts/UVC/UI/ToolBar/ToolboxController.cs rename to Assets/Scripts/UVC/UI/ToolBar/Toolbox.cs index 5a200df9..733ad217 100644 --- a/Assets/Scripts/UVC/UI/ToolBar/ToolboxController.cs +++ b/Assets/Scripts/UVC/UI/ToolBar/Toolbox.cs @@ -2,6 +2,8 @@ using UVC.Locale; using UVC.UI.Commands; using UVC.UI.Toolbar; +using UVC.UI.Toolbar.Model; +using UVC.UI.Toolbar.View; namespace UVC.UI.ToolBar { @@ -21,7 +23,7 @@ namespace UVC.UI.ToolBar /// /// /// - /// // Unity 에디터에서 GameObject를 생성하고 이 ToolboxController 스크립트를 추가합니다. + /// // Unity 에디터에서 GameObject를 생성하고 이 Toolbox 스크립트를 추가합니다. /// // 또한, ToolbarView 스크립트도 해당 GameObject 또는 자식 GameObject에 추가하고, /// // ToolbarView의 프리팹 필드들(standardButtonPrefab 등)을 Inspector에서 할당해야 합니다. /// @@ -31,7 +33,7 @@ namespace UVC.UI.ToolBar /// // private void OpenFile() { Debug.Log("파일 열기 기능 실행"); } /// /// - public class ToolboxController : MonoBehaviour + public class Toolbox : MonoBehaviour { /// /// 툴바의 데이터 모델입니다. 툴바 항목들의 정보와 구조를 담고 있습니다. @@ -62,7 +64,7 @@ namespace UVC.UI.ToolBar if (mainToolbarView == null) { - Debug.LogError("ToolboxController: ToolbarView 컴포넌트를 찾을 수 없습니다. GameObject에 ToolbarView를 추가하고 연결해주세요."); + Debug.LogError("Toolbox: ToolbarView 컴포넌트를 찾을 수 없습니다. GameObject에 ToolbarView를 추가하고 연결해주세요."); } } @@ -80,7 +82,7 @@ namespace UVC.UI.ToolBar if (mainToolbarView == null) { // Awake에서 이미 로그를 남겼을 수 있지만, 한 번 더 확인하여 Start 로직 중단 - Debug.LogError("ToolboxController: ToolbarView가 할당되지 않아 툴바를 초기화할 수 없습니다."); + Debug.LogError("Toolbox: ToolbarView가 할당되지 않아 툴바를 초기화할 수 없습니다."); return; } @@ -156,7 +158,7 @@ namespace UVC.UI.ToolBar // 예시 4: 화면 캡처 버튼 (텍스트가 다국어 키일 수 있음) mainToolbar.AddStandardButton("button_capture_screen", // 다국어 키로 사용될 수 있는 텍스트 - "Prefabs/UI/Toolbar/images/ic_chapture_white", + "Prefabs/UI/Toolbar/images/ic_capture_white", new ActionCommand(() => Debug.Log("화면 캡처 버튼 클릭됨")), "tooltip_capture_screen"); // 툴팁도 다국어 키 사용 가능 @@ -184,7 +186,7 @@ namespace UVC.UI.ToolBar { Text = "brush_size_small", // 하위 버튼 텍스트/키 IconSpritePath = "Prefabs/UI/Toolbar/images/ic_brush_small_white", // 하위 버튼 아이콘 - TooltipKey = "tooltip_brush_small", // 하위 버튼 툴팁 + Tooltip = "tooltip_brush_small", // 하위 버튼 툴팁 ClickCommand = smallBrushCmd }; expandableBtnModel.SubButtons.Add(smallBrush); // 확장 버튼 모델에 하위 버튼 추가 @@ -194,7 +196,7 @@ namespace UVC.UI.ToolBar { Text = "brush_size_medium", IconSpritePath = "Prefabs/UI/Toolbar/images/ic_brush_medium_white", - TooltipKey = "tooltip_brush_medium", + Tooltip = "tooltip_brush_medium", ClickCommand = new ActionCommand(() => Debug.Log("중간 브러시 선택됨 (Sub-Command 실행)")) }; expandableBtnModel.SubButtons.Add(mediumBrush); diff --git a/Assets/Scripts/UVC/UI/ToolBar/ToolboxController.cs.meta b/Assets/Scripts/UVC/UI/ToolBar/Toolbox.cs.meta similarity index 100% rename from Assets/Scripts/UVC/UI/ToolBar/ToolboxController.cs.meta rename to Assets/Scripts/UVC/UI/ToolBar/Toolbox.cs.meta diff --git a/Assets/Scripts/UVC/UI/ToolBar/View.meta b/Assets/Scripts/UVC/UI/ToolBar/View.meta new file mode 100644 index 00000000..702a1de1 --- /dev/null +++ b/Assets/Scripts/UVC/UI/ToolBar/View.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c3981414c9998a846bad8e35456a3979 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/UVC/UI/ToolBar/View/IButtonViewProcessor.cs b/Assets/Scripts/UVC/UI/ToolBar/View/IButtonViewProcessor.cs new file mode 100644 index 00000000..bd7ef2db --- /dev/null +++ b/Assets/Scripts/UVC/UI/ToolBar/View/IButtonViewProcessor.cs @@ -0,0 +1,51 @@ +using UnityEngine; +using UVC.UI.Toolbar.Model; +using UVC.UI.Toolbar.View; + +namespace UVC.UI.ToolBar.View +{ + /// + /// 툴바 버튼의 UI 생성, 설정 및 업데이트 로직을 처리하는 인터페이스입니다. + /// 각 버튼 타입(표준, 토글, 라디오, 확장 등)에 대한 구체적인 UI 처리 클래스가 이 인터페이스를 구현합니다. + /// + public interface IButtonViewProcessor + { + /// + /// 지정된 버튼 모델에 대한 UI GameObject를 생성하고 초기화합니다. + /// + /// UI를 생성할 버튼의 데이터 모델입니다. + /// 생성된 UI GameObject가 자식으로 추가될 부모 Transform입니다. + /// 현재 ToolbarView의 컨텍스트입니다. 프리팹 참조, 헬퍼 메서드 접근 등에 사용됩니다. + /// 생성된 UI GameObject입니다. 생성 실패 시 null을 반환할 수 있습니다. + GameObject CreateButtonUI(ToolbarButtonBase buttonModel, Transform parentContainer, ToolbarView viewContext); + + /// + /// 생성된 버튼 UI GameObject에 대해 초기 시각적 요소(텍스트, 아이콘 등)를 설정하고, + /// 사용자 상호작용(예: 클릭 이벤트) 시 모델의 메서드가 호출되도록 이벤트를 바인딩합니다. + /// 또한, 모델의 상태 변경 이벤트(OnStateChanged, OnToggleStateChanged 등)를 구독하여 UI가 업데이트되도록 설정합니다. + /// + /// 설정할 버튼의 데이터 모델입니다. + /// 모델에 해당하는, 화면에 표시될 UI GameObject입니다. + /// 현재 ToolbarView의 컨텍스트입니다. + void SetupButtonInteractions(ToolbarButtonBase buttonModel, GameObject buttonUIObject, ToolbarView viewContext); + + /// + /// 버튼 모델의 공통적인 상태(텍스트, 아이콘, 활성화 상태 등)가 변경되었을 때, + /// 해당 버튼 UI의 시각적 요소를 업데이트합니다. + /// + /// 상태가 변경된 버튼의 모델입니다. + /// 업데이트할 UI GameObject입니다. + /// 현재 ToolbarView의 컨텍스트입니다. + void UpdateCommonButtonVisuals(ToolbarButtonBase buttonModel, GameObject buttonUIObject, ToolbarView viewContext); + + /// + /// 토글 가능한 버튼(ToolbarToggleButton, ToolbarRadioButton)의 선택 상태(IsSelected)가 모델에서 변경되었을 때 호출됩니다. + /// 해당 UI Toggle 컴포넌트의 isOn 상태를 모델의 IsSelected 값과 동기화합니다. + /// + /// IsSelected 상태가 변경된 토글/라디오 버튼의 모델입니다. + /// 업데이트할 UI GameObject입니다. + /// 모델의 새로운 IsSelected 값입니다. + /// 현재 ToolbarView의 컨텍스트입니다. + void UpdateToggleStateVisuals(ToolbarToggleButton toggleButtonModel, GameObject buttonUIObject, bool isSelected, ToolbarView viewContext); + } +} diff --git a/Assets/Scripts/UVC/UI/ToolBar/View/IButtonViewProcessor.cs.meta b/Assets/Scripts/UVC/UI/ToolBar/View/IButtonViewProcessor.cs.meta new file mode 100644 index 00000000..35f72429 --- /dev/null +++ b/Assets/Scripts/UVC/UI/ToolBar/View/IButtonViewProcessor.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 813fbe357e2233d49beaf93864c6bfd8 \ No newline at end of file diff --git a/Assets/Scripts/UVC/UI/ToolBar/View/ToolbarExpandableButtonViewProcessor.cs b/Assets/Scripts/UVC/UI/ToolBar/View/ToolbarExpandableButtonViewProcessor.cs new file mode 100644 index 00000000..47af2cd9 --- /dev/null +++ b/Assets/Scripts/UVC/UI/ToolBar/View/ToolbarExpandableButtonViewProcessor.cs @@ -0,0 +1,51 @@ +using UnityEngine; +using UnityEngine.UI; +using UVC.UI.Toolbar.Model; +using UVC.UI.ToolBar.View; + +namespace UVC.UI.Toolbar.View +{ + public class ToolbarExpandableButtonViewProcessor : IButtonViewProcessor + { + public GameObject CreateButtonUI(ToolbarButtonBase buttonModel, Transform parentContainer, ToolbarView viewContext) + { + if (viewContext.expandableButtonPrefab == null) + { + Debug.LogError("ExpandableButtonViewProcessor: expandableButtonPrefab이 ToolbarView에 할당되지 않았습니다.", viewContext); + return null; + } + return Object.Instantiate(viewContext.expandableButtonPrefab, parentContainer); + } + + public void SetupButtonInteractions(ToolbarButtonBase buttonModel, GameObject buttonUIObject, ToolbarView viewContext) + { + ToolbarExpandableButton expandableModel = buttonModel as ToolbarExpandableButton; + if (expandableModel == null) return; + + Button uiButton = buttonUIObject.GetComponent /// 찾거나 생성할 토글 그룹의 이름입니다. /// 해당 이름의 ToggleGroup 컴포넌트입니다. - protected ToggleGroup GetOrCreateToggleGroup(string groupName) + internal ToggleGroup GetOrCreateToggleGroup(string groupName) { if (string.IsNullOrEmpty(groupName)) { @@ -577,7 +491,7 @@ namespace UVC.UI.Toolbar /// /// 하위 버튼 목록을 가진 확장 버튼 모델입니다. /// 주 확장 버튼의 UI GameObject로, 하위 메뉴 위치 결정에 사용됩니다. - protected void ToggleSubMenu(ToolbarExpandableButton expandableButtonModel, GameObject expandableButtonObj) + internal void ToggleSubMenu(ToolbarExpandableButton expandableButtonModel, GameObject expandableButtonObj) { // 이미 다른 하위 메뉴가 열려있거나, 현재 클릭한 버튼의 하위 메뉴가 열려있다면 닫습니다. if (currentSubMenu != null) @@ -648,13 +562,13 @@ namespace UVC.UI.Toolbar // 패널 위치를 확장 버튼의 위치에 맞춥니다. Vector2 offset = new Vector2(expandableButtonRect.anchoredPosition.x, expandableButtonRect.anchoredPosition.y); - if(layoutGroup is VerticalLayoutGroup) + if (layoutGroup is VerticalLayoutGroup) { offset.x += expandableButtonRect.rect.width; // 수직 레이아웃인 경우 버튼 오른쪽에 표시 되도록 } else - { - if(subMenuLayoutGroup != null) offset.x -= subMenuLayoutGroup.padding.left; // 수평 레이아웃인 경우 패딩을 고려 + { + if (subMenuLayoutGroup != null) offset.x -= subMenuLayoutGroup.padding.left; // 수평 레이아웃인 경우 패딩을 고려 offset.y -= expandableButtonRect.rect.height; // 수평 레이아웃인 경우 버튼 아래에 표시 되도록 } panelRect.anchoredPosition = offset; // 위치 조정 @@ -664,62 +578,83 @@ namespace UVC.UI.Toolbar { if (subItemBase is ToolbarButtonBase subItemModel) // 모든 하위 아이템은 ToolbarButtonBase라고 가정 { + IButtonViewProcessor subProcessor = GetButtonViewProcessor(subItemModel.GetType()); // 하위 버튼도 적절한 프리팹을 사용해야 합니다. // 여기서는 모든 하위 버튼이 standardButtonPrefab을 사용한다고 가정합니다. // 실제로는 subItemModel의 타입에 따라 다른 프리팹을 선택할 수 있습니다. GameObject subButtonPrefabToUse = standardButtonPrefab; // 기본값 - if (subItemModel is ToolbarToggleButton) subButtonPrefabToUse = toggleButtonPrefab; - // ... 다른 타입에 대한 처리 ... - if (subButtonPrefabToUse == null) + if (subProcessor != null) // 하위 버튼도 Processor를 통해 생성 시도 { - Debug.LogError($"ToolbarView: 하위 버튼 '{subItemModel.Text}'에 대한 프리팹을 결정할 수 없습니다 (standardButtonPrefab 사용 시도).", this); - continue; - } + if (subItemModel is ToolbarToggleButton) subButtonPrefabToUse = toggleButtonPrefab; + else subButtonPrefabToUse = standardButtonPrefab; // 기본은 표준 버튼 - GameObject subButtonObj = Instantiate(subButtonPrefabToUse, panelRect); // 하위 메뉴 패널의 자식으로 생성 - subButtonObj.name = $"SubItem_{subItemModel.Text}"; - - // 하위 버튼의 시각적 요소 설정 및 상호작용 연결 - UpdateCommonButtonVisuals(subItemModel, subButtonObj); // 공통 UI 업데이트 - - // 하위 버튼 클릭 이벤트 연결 - Button subUiButton = subButtonObj.GetComponent