/// <summary> /// Get a new theme instance and load it with settings /// </summary> /// <param name="settings"></param> /// <param name="host"></param> /// <param name="lists"></param> /// <returns></returns> public static InteractableThemeBase GetTheme(InteractableThemePropertySettings settings, GameObject host, ThemeLists lists) { int index = InspectorField.ReverseLookup(settings.Name, lists.Names.ToArray()); Type themeType = lists.Types[index]; InteractableThemeBase theme = (InteractableThemeBase)Activator.CreateInstance(themeType, host); theme.Init(host, settings); return(theme); }
/// <summary> /// Creates the list of theme instances based on all the theme settings /// </summary> protected virtual void SetupThemes() { InteractableProfileItem.ThemeLists lists = InteractableProfileItem.GetThemeTypes(); runningThemesList = new List <InteractableThemeBase>(); runningProfileSettings = new List <ProfileSettings>(); for (int i = 0; i < Profiles.Count; i++) { ProfileSettings profileSettings = new ProfileSettings(); List <ThemeSettings> themeSettingsList = new List <ThemeSettings>(); for (int j = 0; j < Profiles[i].Themes.Count; j++) { Theme theme = Profiles[i].Themes[j]; ThemeSettings themeSettings = new ThemeSettings(); if (Profiles[i].Target != null && theme != null) { List <InteractableThemePropertySettings> tempSettings = new List <InteractableThemePropertySettings>(); for (int n = 0; n < theme.Settings.Count; n++) { InteractableThemePropertySettings settings = theme.Settings[n]; settings.Theme = InteractableProfileItem.GetTheme(settings, Profiles[i].Target, lists); // add themes to theme list based on dimension if (j == dimensionIndex) { runningThemesList.Add(settings.Theme); } tempSettings.Add(settings); } themeSettings.Settings = tempSettings; themeSettingsList.Add(themeSettings); } } profileSettings.ThemeSettings = themeSettingsList; runningProfileSettings.Add(profileSettings); } }