using System.Collections.Generic; namespace UnityEngine.Rendering.HighDefinition { /// /// Defines the number of levels and the level names for a scalable setting. /// /// This class is intended to be immutable. As it is a reference type, a schema should be instantiated only once and used /// as reference everywhere. /// public class ScalableSettingSchema { /// /// Available scalable setting schemas. /// /// In the future this array will probably be dynamic. /// For now it is immutable to avoid to handle cases where a schema is missing. /// internal static readonly Dictionary Schemas = new Dictionary { { ScalableSettingSchemaId.With3Levels, new ScalableSettingSchema(new[] { new GUIContent("Low"), new GUIContent("Medium"), new GUIContent("High") }) }, { ScalableSettingSchemaId.With4Levels, new ScalableSettingSchema(new[] { new GUIContent("Low"), new GUIContent("Medium"), new GUIContent("High"), new GUIContent("Ultra") }) }, }; /// Get the for the provided . /// Id to search for. /// The schema if it exists, otherwise null. internal static ScalableSettingSchema GetSchemaOrNull(ScalableSettingSchemaId id) => Schemas.TryGetValue(id, out var value) ? value : null; /// Get the for the provided . /// Id to search for. /// The schema if it exists, otherwise null. internal static ScalableSettingSchema GetSchemaOrNull(ScalableSettingSchemaId? id) => id.HasValue && Schemas.TryGetValue(id.Value, out var value) ? value : null; /// The names of the levels. public readonly GUIContent[] levelNames; /// The number of levels. public int levelCount => levelNames.Length; /// /// Instantiate a new schema. /// /// The names of each level. public ScalableSettingSchema(GUIContent[] levelNames) => this.levelNames = levelNames; } }