// 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 Doozy.Editor.Reactor.Internal; using Doozy.Editor.UIElements; using Doozy.Runtime.Colors; using Doozy.Runtime.Common.Extensions; using Doozy.Runtime.Reactor.Extensions; using Doozy.Runtime.Reactor.Internal; using Doozy.Runtime.Reactor.Reactions; using Doozy.Runtime.UIElements; using Doozy.Runtime.UIElements.Extensions; using UnityEditor; using UnityEngine; using UnityEngine.UIElements; namespace Doozy.Editor.EditorUI.Components { public class FluidContainer : PoolableElement { public override void Reset() { this.SetEnabled(true); this.ResetLayout(); this.SetTooltip(string.Empty); this.ResetAccentColor(); this.ClearIcon(); this.ClearLabelText(); this.ClearHeaderContent(); this.ClearFluidContent(); this.ClearFooterContent(); } public override void Dispose() { base.Dispose(); iconReaction?.Recycle(); } #region IconType private IconType iconType { get; set; } = IconType.None; private List iconDependentComponents { get; } internal void UpdateIconType(IconType value) { if (iconType != IconType.None) UIElementsUtils.RemoveClass(iconType.ToString(), iconDependentComponents); if (value != IconType.None) UIElementsUtils.AddClass(value.ToString(), iconDependentComponents); iconType = value; } #endregion public static Color defaultBackgroundColor => EditorColors.Default.Background; public static Color defaultIconColor => EditorColors.Default.FieldIcon; public static Color defaultTitleColor => EditorColors.Default.TextTitle; public static Font titleFont => EditorFonts.Ubuntu.Light; public static int titleFontSize => 12; public TemplateContainer templateContainer { get; } public VisualElement layoutContainer { get; } public VisualElement headerContainer { get; } public Image icon { get; } public Label title { get; } public VisualElement headerContent { get; } public VisualElement fluidContainer { get; } public VisualElement fluidContent { get; } public VisualElement footerContainer { get; } public VisualElement footerContent { get; } public Texture2DReaction iconReaction { get; internal set; } public FluidContainer() { Add(templateContainer = EditorLayouts.EditorUI.FluidContainer.CloneTree()); templateContainer .AddStyle(EditorStyles.EditorUI.FluidContainer); layoutContainer = templateContainer.Q(nameof(layoutContainer)); headerContainer = layoutContainer.Q(nameof(headerContainer)); icon = headerContainer.Q(nameof(icon)); title = headerContainer.Q