protected virtual SerializedObject ChangeThemeProperty(int index, SerializedObject themeObj, SerializedProperty target, bool isNew = false) { SerializedProperty themeObjSettings = themeObj.FindProperty("Settings"); themeObjSettings = ThemeInspector.ChangeThemeProperty(index, themeObjSettings, target, GetStates(), isNew); return(themeObj); }
protected virtual void AddThemeProperty(int[] arr, SerializedProperty prop = null) { int profile = arr[0]; int theme = arr[1]; SerializedProperty sItem = profileList.GetArrayElementAtIndex(profile); SerializedProperty themes = sItem.FindPropertyRelative("Themes"); SerializedProperty serializedTarget = sItem.FindPropertyRelative("Target"); SerializedProperty themeItem = themes.GetArrayElementAtIndex(theme); SerializedObject themeObj = new SerializedObject(themeItem.objectReferenceValue); themeObj.Update(); SerializedProperty themeObjSettings = themeObj.FindProperty("Settings"); themeObjSettings.InsertArrayElementAtIndex(themeObjSettings.arraySize); SerializedProperty settingsItem = themeObjSettings.GetArrayElementAtIndex(themeObjSettings.arraySize - 1); SerializedProperty className = settingsItem.FindPropertyRelative("Name"); SerializedProperty assemblyQualifiedName = settingsItem.FindPropertyRelative("AssemblyQualifiedName"); if (themeObjSettings.arraySize == 1) { className.stringValue = "ScaleOffsetColorTheme"; assemblyQualifiedName.stringValue = typeof(ScaleOffsetColorTheme).AssemblyQualifiedName; } else { className.stringValue = themeOptions.ClassNames[0]; assemblyQualifiedName.stringValue = themeOptions.AssemblyQualifiedNames[0]; } SerializedProperty easing = settingsItem.FindPropertyRelative("Easing"); SerializedProperty time = easing.FindPropertyRelative("LerpTime"); SerializedProperty curve = easing.FindPropertyRelative("Curve"); time.floatValue = 0.5f; curve.animationCurveValue = AnimationCurve.Linear(0, 1, 1, 1); themeObjSettings = ThemeInspector.ChangeThemeProperty(themeObjSettings.arraySize - 1, themeObjSettings, serializedTarget, GetStates(), true); themeObj.ApplyModifiedProperties(); }