// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using System; using System.Collections.Generic; using UnityEngine; namespace Microsoft.MixedReality.Toolkit.UI { /// /// Theme engine that allows control to enable/disable a GameObject based on the current state /// public class InteractableActivateTheme : InteractableThemeBase { /// public override bool IsEasingSupported => false; public InteractableActivateTheme() { Types = new Type[] { typeof(Transform) }; Name = "Activate Theme"; } /// public override ThemeDefinition GetDefaultThemeDefinition() { return new ThemeDefinition() { ThemeType = GetType(), StateProperties = new List() { new ThemeStateProperty() { Name = "Activate", Type = ThemePropertyTypes.Bool, Values = new List(), Default = new ThemePropertyValue() { Bool = true } }, }, CustomProperties = new List(), }; } /// public override ThemePropertyValue GetProperty(ThemeStateProperty property) { ThemePropertyValue start = new ThemePropertyValue(); start.Bool = Host.activeSelf; return start; } /// public override void SetValue(ThemeStateProperty property, int index, float percentage) { SetValue(property, property.Values[index]); } /// protected override void SetValue(ThemeStateProperty property, ThemePropertyValue value) { Host.SetActive(value.Bool); } } }