// 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.Runtime.Reactor.Extensions; using Doozy.Runtime.Reactor.Internal; using Doozy.Runtime.Reactor.Reactions; using Doozy.Runtime.UIElements.Extensions; using UnityEngine; using UnityEngine.UIElements; // ReSharper disable MemberCanBePrivate.Global namespace Doozy.Editor.EditorUI.Components { public class FluidWindowHeader : PoolableElement { public override void Reset() { this.ResetLayout(); this.SetTooltip(string.Empty); ClearIcon(); ClearTitle(); ClearSubtitle(); } public override void Dispose() { base.Dispose(); iconReaction?.Recycle(); } public static Color backgroundColor => EditorColors.Default.WindowHeaderBackground; public static Color titleColor => EditorColors.Default.WindowHeaderTitle; public static Color subtitleColor => EditorColors.Default.WindowHeaderSubtitle; public static Color iconColor => EditorColors.Default.WindowHeaderIcon; public static Font titleFont => EditorFonts.Ubuntu.Light; public static Font subtitleFont => EditorFonts.Inter.Light; public TemplateContainer templateContainer { get; } public VisualElement layoutContainer { get; } public Image icon { get; } public Label title { get; } public Label subtitle { get; } public Texture2DReaction iconReaction { get; set; } public static FluidWindowHeader Get(string title, string subtitle, Texture2D iconTexture2D) => Get().SetTitle(title).SetSubtitle(subtitle).SetIcon(iconTexture2D); public static FluidWindowHeader Get(string title, string subtitle, IEnumerable textures) => Get().SetTitle(title).SetSubtitle(subtitle).SetIcon(textures); public FluidWindowHeader() { Add(templateContainer = EditorLayouts.EditorUI.WindowHeader.CloneTree()); templateContainer .AddStyle(EditorStyles.EditorUI.WindowHeader) .SetStyleFlexGrow(1) .SetStyleBackgroundColor(backgroundColor); layoutContainer = templateContainer.Q("LayoutContainer"); icon = templateContainer.Q("Icon"); title = templateContainer.Q