// 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; using Doozy.Runtime.Common.Extensions; using Doozy.Runtime.UIElements.Extensions; using UnityEngine; using UnityEngine.UIElements; namespace Doozy.Editor.EditorUI.Components { public class ComponentField : VisualElement { public enum Size { None, Large, Small } public static Color backgroundColor => EditorColors.Default.FieldBackground; public static Font fieldNameFont => EditorFonts.Inter.Medium; public TemplateContainer templateContainer { get; } public VisualElement layoutContainer { get; } public Image fieldIcon { get; } public VisualElement nameAndFieldContainer { get; } public Label fieldNameLabel { get; } public VisualElement fieldContent { get; } private Size m_CurrentSize = Size.None; public ComponentField(Size componentSize, string fieldName, VisualElement field, Texture2D icon = null) { Add(templateContainer = EditorLayouts.EditorUI.ComponentField.CloneTree()); templateContainer .AddStyle(EditorStyles.EditorUI.ComponentField); layoutContainer = templateContainer.Q("LayoutContainer"); fieldIcon = layoutContainer.Q("FieldIcon"); nameAndFieldContainer = layoutContainer.Q("NameAndFieldContainer"); fieldNameLabel = layoutContainer.Q