using System.Collections.Generic; using Unity.UIWidgets.material; using Unity.UIWidgets.ui; using UnityEditor.VersionControl; namespace Unity.UIWidgets.material { public enum MaterialState { hovered, focused, pressed, dragged, selected, disabled, error, } public partial class material_ { public delegate T MaterialPropertyResolver(HashSet states); } abstract class MaterialStateColor : Color { public MaterialStateColor(uint defaultValue) : base(defaultValue) { } static MaterialStateColor resolveWith(material_.MaterialPropertyResolver callback) => new _MaterialStateColor(callback); public abstract Color resolve(HashSet states); public static Color resolveAs(Color value, HashSet states) { if (value is MaterialStateProperty materialStateProperty) { MaterialStateProperty property = materialStateProperty; return property.resolve(states); } return value; } public static MaterialStateProperty resolveWith( material_.MaterialPropertyResolver callback) => new _MaterialStateProperty(callback); } class _MaterialStateColor : MaterialStateColor { internal _MaterialStateColor(material_.MaterialPropertyResolver _resolve) : base(_resolve(_defaultStates) .value) { this._resolve = _resolve; } readonly material_.MaterialPropertyResolver _resolve; public static readonly HashSet _defaultStates = new HashSet(); public override Color resolve(HashSet states) => _resolve(states); } abstract class MaterialStateProperty { public abstract T resolve(HashSet states); public static T resolveAs(T value, HashSet states) { if (value is MaterialStateProperty materialStateProperty) { MaterialStateProperty property = materialStateProperty; return property.resolve(states); } return value; } public static MaterialStateProperty resolveWith(material_.MaterialPropertyResolver callback) => new _MaterialStateProperty(callback); } class _MaterialStateProperty : MaterialStateProperty { internal _MaterialStateProperty(material_.MaterialPropertyResolver _resolve) { this._resolve = _resolve; } readonly material_.MaterialPropertyResolver _resolve; public override T resolve(HashSet states) => _resolve(states); public static T resolveAs(T value, HashSet states) { if (value is MaterialStateProperty materialStateProperty) { MaterialStateProperty property = materialStateProperty; return property.resolve(states); } return value; } public static MaterialStateProperty resolveWith(material_.MaterialPropertyResolver callback) => new _MaterialStateProperty(callback); } }