// Copyright (c) 2015 - 2023 Doozy Entertainment. All Rights Reserved. // This code can only be used under the standard Unity Asset Store End User License Agreement // A Copy of the EULA APPENDIX 1 is available at http://unity3d.com/company/legal/as_terms using System.Collections.Generic; using System.Linq; using Doozy.Editor.EditorUI.Components.Internal; using Doozy.Editor.EditorUI.ScriptableObjects.Colors; using Doozy.Editor.EditorUI.Utils; using Doozy.Runtime.UIElements.Extensions; using UnityEditor; using UnityEngine; using UnityEngine.UIElements; // ReSharper disable MemberCanBeProtected.Global // ReSharper disable MemberCanBePrivate.Global namespace Doozy.Editor.EditorUI.Components { public abstract class FluidWindowLayout : VisualElement { protected string EditorPrefsKey(string variableName) => $"{GetType().FullName} - {variableName}"; protected string sideMenuWidthKey => EditorPrefsKey($"{nameof(sideMenu)}.{nameof(sideMenu.customWidth)}"); protected string sideMenuIsCollapsedKey => EditorPrefsKey($"{nameof(sideMenu)}.{nameof(sideMenu.isCollapsed)}"); public virtual string layoutName => "Unknown Layout Name"; public virtual Texture2D staticIconTexture => null; public virtual List animatedIconTextures => null; public virtual Color accentColor => EditorColors.EditorUI.Amber; public virtual EditorSelectableColorInfo selectableAccentColor => EditorSelectableColors.EditorUI.Amber; public TemplateContainer templateContainer { get; protected set; } public VisualElement menu { get; protected set; } public VisualElement header { get; protected set; } public VisualElement content { get; protected set; } public VisualElement footer { get; protected set; } public Label footerLabel { get; protected set; } public FluidWindowHeader fluidWindowHeader { get; set; } public FluidSideMenu sideMenu { get; protected set; } public FluidResizer sideMenuResizer { get; protected set; } public ScrollView searchResults { get; } public Dictionary searchableItems { get; } protected virtual int maximumNumberOfItemsVisibleAtOnce => 10; protected virtual int spacing => DesignUtils.k_Spacing; public void Dispose() { sideMenu?.Dispose(); } protected FluidWindowLayout() { this.SetStyleFlexGrow(1); Add(templateContainer = EditorLayouts.EditorUI.FluidWindowLayout.CloneTree()); templateContainer .SetStyleFlexGrow(1) .AddStyle(EditorStyles.EditorUI.FluidWindowLayout); //REFERENCES menu = templateContainer.Q("MenuContainer"); header = templateContainer.Q("HeaderContainer"); content = templateContainer.Q("ContentContainer"); footer = templateContainer.Q("FooterContainer"); footerLabel = footer.Q