diff --git a/Basis/Packages/com.basis.framework/BasisUI/Elements/.Deprecated/PanelLayoutContainer.cs b/Basis/Packages/com.basis.framework/BasisUI/Elements/.Deprecated/PanelLayoutContainer.cs deleted file mode 100644 index 0269311bb6..0000000000 --- a/Basis/Packages/com.basis.framework/BasisUI/Elements/.Deprecated/PanelLayoutContainer.cs +++ /dev/null @@ -1,117 +0,0 @@ -using System; -using UnityEngine; -using UnityEngine.UI; - -#if UNITY_EDITOR -using UnityEditor; -#endif - -namespace Basis.BasisUI -{ - [Obsolete] - public class PanelLayoutContainer : PanelElementDescriptor - { - public static class LayoutStyles - { - public static string Vertical => "Packages/com.basis.framework/BasisUI/Prefabs/Elements/Layout Container Vertical.prefab"; - public static string Horizontal => "Packages/com.basis.framework/BasisUI/Prefabs/Elements/Layout Container Horizontal.prefab"; - } - - public HorizontalOrVerticalLayoutGroup LayoutGroup; - public ContentSizeFitter ContentFitter; - - /// - /// Layout options must be applied immediately after through ApplyLayoutOptions(). - /// - public LayoutContainerOptions ChildLayoutOptions; - - /// - /// Direction is handled via Horizontal/Vertical Layout Groups and cannot be changed at runtime. - /// - public LayoutDirection Direction => _direction; - protected LayoutDirection _direction; - - public static PanelLayoutContainer CreateNew(Component parent, LayoutDirection direction) - { - PanelLayoutContainer element; - switch (direction) - { - case LayoutDirection.Vertical: - element = CreateNew(LayoutStyles.Vertical, parent); - element._direction = LayoutDirection.Vertical; - return element; - - case LayoutDirection.Horizontal: - element = CreateNew(LayoutStyles.Horizontal, parent); - element._direction = LayoutDirection.Horizontal; - return element; - - default: - throw new ArgumentOutOfRangeException(nameof(direction), direction, null); - } - } - - public override void OnCreateEvent() - { - base.OnCreateEvent(); - ApplyLayoutOptions(); - } - - public void CopyLayoutOptions(LayoutContainerOptions options) - { - ChildLayoutOptions = options; - ApplyLayoutOptions(); - } - - public void ApplyLayoutOptions() - { - rectTransform.anchorMin = Vector2.zero; - rectTransform.anchorMax = Vector2.one; - - if (ChildLayoutOptions.Constrained) - { - switch (Direction) - { - case LayoutDirection.Vertical: - ContentFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize; - ContentFitter.horizontalFit = ContentSizeFitter.FitMode.Unconstrained; - break; - case LayoutDirection.Horizontal: - ContentFitter.verticalFit = ContentSizeFitter.FitMode.Unconstrained; - ContentFitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize; - break; - default: - throw new ArgumentOutOfRangeException(); - } - } - - LayoutGroup.childAlignment = ChildLayoutOptions.Alignment; - LayoutGroup.childControlWidth = ChildLayoutOptions.StretchItemWidth; - LayoutGroup.childControlHeight = ChildLayoutOptions.StretchItemHeight; - LayoutGroup.childForceExpandWidth = ChildLayoutOptions.SpreadItemWidth; - LayoutGroup.childForceExpandHeight = ChildLayoutOptions.SpreadItemHeight; - } - - -#if UNITY_EDITOR - protected override void OnValidate() - { - EditorApplication.delayCall += EditorApplyLayoutOptions; - } - - private void EditorApplyLayoutOptions() - { - if (!this || !gameObject) return; - if (PrefabUtility.IsPartOfPrefabAsset(gameObject)) return; - - ApplyLayoutOptions(); - if (rectTransform) LayoutRebuilder.MarkLayoutForRebuild(rectTransform); - - EditorUtility.SetDirty(this); - if (rectTransform) EditorUtility.SetDirty(rectTransform); - if (LayoutGroup) EditorUtility.SetDirty(LayoutGroup); - if (ContentFitter) EditorUtility.SetDirty(ContentFitter); - } -#endif - } -} diff --git a/Basis/Packages/com.basis.framework/BasisUI/Elements/.Deprecated/PanelLayoutContainer.cs.meta b/Basis/Packages/com.basis.framework/BasisUI/Elements/.Deprecated/PanelLayoutContainer.cs.meta deleted file mode 100644 index 4a39ae48b6..0000000000 --- a/Basis/Packages/com.basis.framework/BasisUI/Elements/.Deprecated/PanelLayoutContainer.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: cc58095392b6e2444879173630a4c5f1 \ No newline at end of file diff --git a/Basis/Packages/com.basis.framework/BasisUI/Elements/.Deprecated/PanelTabGroup.cs b/Basis/Packages/com.basis.framework/BasisUI/Elements/.Deprecated/PanelTabGroup.cs deleted file mode 100644 index c8f00f03c0..0000000000 --- a/Basis/Packages/com.basis.framework/BasisUI/Elements/.Deprecated/PanelTabGroup.cs +++ /dev/null @@ -1,147 +0,0 @@ -using System; -using System.Collections.Generic; -using UnityEngine; - -namespace Basis.BasisUI -{ - public class PanelTabGroup : PanelBindableElement - { - - public enum TabType - { - Callback, - Page, - } - - public struct TabData - { - public TabType Type; - public PanelButton Button; - public Action Callback; - public PanelLayoutContainer Page; - public bool? Value; - - public TabData(PanelButton button, Action callback) - { - Type = TabType.Callback; - Button = button; - Callback = callback; - Page = null; - Value = null; - } - - public TabData(PanelButton button, PanelLayoutContainer page) - { - Type = TabType.Page; - Button = button; - Callback = null; - Page = page; - Value = null; - } - - public void Set(bool value, bool ignoreMatchingStates = false) - { - if (Value == value && !ignoreMatchingStates) - { - // Debug.Log("Value already matched."); - return; - } - - Value = value; - Button.ButtonStyling.ShowIndicator(value); - - switch (Type) - { - case TabType.Callback: - Callback?.Invoke(value); - break; - case TabType.Page: - Page.SetActive(value); - break; - default: - throw new ArgumentOutOfRangeException(); - } - } - } - - public static class TabGroupStyles - { - public static string Default => "Packages/com.basis.framework/BasisUI/Prefabs/Elements/Panel Tab Group.prefab"; - } - - public List Buttons = new(); - public List Tabs = new(); - - public virtual string ButtonStyle => PanelButton.ButtonStyles.Tab; - - /// - /// Direction is handled via Horizontal/Vertical Layout Groups and should not be changed. - /// - public LayoutDirection Direction => _direction; - protected LayoutDirection _direction; - - [SerializeField] protected PanelLayoutContainer _layoutContainer; - - - - public static PanelTabGroup CreateNew(Component parent) - => CreateNew(TabGroupStyles.Default, parent); - - public static PanelTabGroup CreateNew(string style, Component parent) - => CreateNew(style, parent); - - - public void Init(LayoutDirection direction) - { - _direction = direction; - _layoutContainer = PanelLayoutContainer.CreateNew(ContentParent, direction); - ContentParent = _layoutContainer.rectTransform; - } - - public void AddTab(string title, Sprite icon, bool iconIsAddressable, Action action) - { - PanelButton button = PanelButton.CreateNew(ButtonStyle, ContentParent); - button.PanelElement.SetTitle(title); - button.SetIcon(icon, iconIsAddressable); - button.OnClicked.AddListener(() => OnTabPressed(button)); - - Buttons.Add(button); - Tabs.Add(new TabData(button, action)); - } - - public void AddTab(string title, Sprite icon, bool iconIsAddressable, PanelLayoutContainer page) - { - PanelButton button = PanelButton.CreateNew(ButtonStyle, ContentParent); - button.PanelElement.SetTitle(title); - button.SetIcon(icon, iconIsAddressable); - button.OnClicked.AddListener(() => OnTabPressed(button)); - - Buttons.Add(button); - Tabs.Add(new TabData(button, page)); - } - - private void OnTabPressed(PanelButton button) - { - int index = Buttons.IndexOf(button); - SetValue(index); - } - - public override void OnValueChanged() - { - base.OnValueChanged(); - for (int i = 0; i < Tabs.Count; i++) - { - Tabs[i].Set(RawValue == i); - } - } - - protected override void OnBoundValueLoaded() - { - base.OnBoundValueLoaded(); - for (int i = 0; i < Tabs.Count; i++) - { - Tabs[i].Set(RawValue == i, true); - } - } - } -} diff --git a/Basis/Packages/com.basis.framework/BasisUI/Elements/.Deprecated/PanelTabGroup.cs.meta b/Basis/Packages/com.basis.framework/BasisUI/Elements/.Deprecated/PanelTabGroup.cs.meta deleted file mode 100644 index 802f3a0441..0000000000 --- a/Basis/Packages/com.basis.framework/BasisUI/Elements/.Deprecated/PanelTabGroup.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: d33434103dea7bc4a96ed448116b88a4 \ No newline at end of file diff --git a/Basis/Packages/com.basis.framework/BasisUI/Elements/.Deprecated/PanelTabPageGroup.cs b/Basis/Packages/com.basis.framework/BasisUI/Elements/.Deprecated/PanelTabPageGroup.cs deleted file mode 100644 index dea4cee598..0000000000 --- a/Basis/Packages/com.basis.framework/BasisUI/Elements/.Deprecated/PanelTabPageGroup.cs +++ /dev/null @@ -1,18 +0,0 @@ -using UnityEngine; - -namespace Basis.BasisUI -{ - public class PanelTabPageGroup : PanelElementDescriptor - { - public static class TabPageGroupStyles - { - public static string Group => "Packages/com.basis.framework/BasisUI/Prefabs/Elements/Panel Group.prefab"; - } - - public static PanelTabPageGroup CreateNew(Component parent) - => CreateNew(TabPageGroupStyles.Group, parent); - - public static PanelTabPageGroup CreateNew(string style, Component parent) - => CreateNew(style, parent); - } -} diff --git a/Basis/Packages/com.basis.framework/BasisUI/Elements/.Deprecated/PanelTabPageGroup.cs.meta b/Basis/Packages/com.basis.framework/BasisUI/Elements/.Deprecated/PanelTabPageGroup.cs.meta deleted file mode 100644 index 4fa7ee501b..0000000000 --- a/Basis/Packages/com.basis.framework/BasisUI/Elements/.Deprecated/PanelTabPageGroup.cs.meta +++ /dev/null @@ -1,2 +0,0 @@ -fileFormatVersion: 2 -guid: 7fb6f50fb0d412940b9279308b4352a5 \ No newline at end of file diff --git a/Basis/Packages/com.basis.sdk/UiStyling/Runtime/UiStyleLibrary.cs b/Basis/Packages/com.basis.sdk/UiStyling/Runtime/UiStyleLibrary.cs index d27ab070fe..a7a0409ff0 100644 --- a/Basis/Packages/com.basis.sdk/UiStyling/Runtime/UiStyleLibrary.cs +++ b/Basis/Packages/com.basis.sdk/UiStyling/Runtime/UiStyleLibrary.cs @@ -132,7 +132,7 @@ public enum StyleComponentType Dropdown, } - [CreateAssetMenu(fileName = "Style Library", menuName = "WorldUI/Style Library")] + [CreateAssetMenu(fileName = "Style Library", menuName = "BasisUI/Style Library")] public class UiStyleLibrary : ScriptableObject { [Header("Base Styles")] diff --git a/Basis/Packages/com.basis.sdk/UiStyling/Runtime/UiStylePalette.cs b/Basis/Packages/com.basis.sdk/UiStyling/Runtime/UiStylePalette.cs index 71d11eb39d..46e27b4f22 100644 --- a/Basis/Packages/com.basis.sdk/UiStyling/Runtime/UiStylePalette.cs +++ b/Basis/Packages/com.basis.sdk/UiStyling/Runtime/UiStylePalette.cs @@ -24,7 +24,7 @@ public enum UiPaletteStyle Scrollbar, } - [CreateAssetMenu(fileName = "Style Palette", menuName = "WorldUI/Style Palette")] + [CreateAssetMenu(fileName = "Style Palette", menuName = "BasisUI/Style Palette")] public class UiStylePalette : ScriptableObject {