static void SelectTweenTarget(ObjectData p_data) { currentTarget = p_data.obj as UnityEngine.Object; currentTargetPath = GetSelectionTargetPath(); HOTweenManager.HOTweenData twData = new HOTweenManager.HOTweenData(++src.creationTime, currentTargetRoot, currentTarget, currentTargetPath); src.tweenDatas.Add(twData); panelMode = HOTweenPanelMode.Default; }
static int SortTweenDatasByCreationTime(HOTweenManager.HOTweenData t1, HOTweenManager.HOTweenData t2) { if (t1.creationTime > t2.creationTime) { return(1); } if (t1.creationTime < t2.creationTime) { return(-1); } return(0); }
static int SortTweenDatas(HOTweenManager.HOTweenData t1, HOTweenManager.HOTweenData t2) { if (t1.targetRoot == null && t2.targetRoot == null) { return(SortTweenDatasByCreationTime(t1, t2)); } if (t1.targetRoot == null) { return(-1); } if (t2.targetRoot == null) { return(1); } int v = String.Compare(t1.targetRoot.name, t2.targetRoot.name); if (v != 0) { return(v); } return(SortTweenDatasByCreationTime(t1, t2)); }
static void DrawTweens() { src.tweenDatas.Sort(SortTweenDatas); int tweensCount = src.tweenDatas.Count; for (int i = 0; i < tweensCount; ++i) { EditorGUIUtility.LookLikeControls(81); HOTweenManager.HOTweenData twData = src.tweenDatas[i]; HOTweenManager.HOPropData propData; PluginData plugData = null; bool invalidTarget = twData.targetRoot == null; bool emptyTween = twData.propDatas == null || twData.propDatas.Count == 0; // Group everything to allow drag HOGUILayout.Vertical(() => { Color toolbarColor = invalidTarget ? HOTweenEditorVars.errorBgColor : emptyTween ? HOTweenEditorVars.warningBgColor : HOTweenEditorVars.tweenToolbarColor; HOGUILayout.Toolbar(toolbarColor, () => { twData.isActive = HOGUILayout.ToolbarToggle(twData.isActive); twData.foldout = HOGUILayout.MiniFoldout(twData.foldout, (twData.id == "" ? "" : "[" + twData.id + "] ") + (isManagerGUI ? twData.targetPath : twData.partialTargetPath), true); if (HOGUILayout.ColoredButton(new GUIContent("+", "Add a property to tween"), HOGUIStyle.toolbarButton, HOTweenEditorVars.strongButtonBgColor, HOTweenEditorVars.strongButtonFontColor, GUILayout.Width(HOGUIStyle.IconButtonWidth * 2))) { currentTwData = twData; objDatasCollection = new List<List<ObjectData>>(); objDatasCollection.Add(GetProperties(twData.target)); panelMode = HOTweenPanelMode.PropertySelection; } if (GUILayout.Button(new GUIContent("╣", "Duplicate this tween"), HOGUIStyle.toolbarIconButton)) { undoManager.ForceDirty(); HOTweenManager.HOTweenData twDataClone = twData.Clone(++src.creationTime); foreach (HOTweenManager.HOPropData pd in twDataClone.propDatas) { StoreValidPluginsFor(twDataClone.targetType, pd); } src.tweenDatas.Add(twDataClone); ++tweensCount; } if (isManagerGUI) { if (GUILayout.Button(new GUIContent("□", "Select GameObject"), HOGUIStyle.toolbarIconButton)) { Selection.activeGameObject = twData.targetRoot; EditorWindow h = GetHierarchyPanel(); if (h != null) h.Focus(); // Focus Hierarchy panel. } } if (HOGUILayout.ColoredButton(new GUIContent("x", "Delete this tween"), HOGUIStyle.toolbarIconButton, Color.red, Color.white)) { undoManager.ForceDirty(); src.tweenDatas.RemoveAt(i); --tweensCount; } }); if (twData.foldout) { if (invalidTarget) { GUILayout.Label("This tween's target doesn't exist anymore", HOGUIStyle.wordWrapLabelBold); GUILayout.Space(4); } else { HOGUILayout.DisabledGroup(!twData.isActive, () => { // General options toolbar HOGUILayout.Toolbar(() => { GUILayout.Label("Id", HOGUIStyle.miniLabel); twData.id = EditorGUILayout.TextField("", twData.id, HOGUIStyle.toolbarTextField, GUILayout.ExpandWidth(true)); twData.tweenFrom = HOGUILayout.ToggleButton(twData.tweenFrom, new GUIContent("From", "If selected the tween will animate FROM instead than TO the given value"), HOGUIStyle.toolbarButton, HOTweenEditorVars.toggleBgColor, HOTweenEditorVars.toggleFontColor, GUILayout.Width(40)); twData.paused = !HOGUILayout.ToggleButton(!twData.paused, new GUIContent("Autoplay"), HOGUIStyle.toolbarButton, HOTweenEditorVars.toggleBgColor, HOTweenEditorVars.toggleFontColor, GUILayout.Width(60)); twData.autoKill = HOGUILayout.ToggleButton(twData.autoKill, new GUIContent("Autokill", "If selected, destroys the tween after it reaches completion"), HOGUIStyle.toolbarButton, HOTweenEditorVars.toggleBgColor, HOTweenEditorVars.toggleFontColor, GUILayout.Width(60)); }); // Properties int propDatasCount = twData.propDatas.Count; for (int c = 0; c < propDatasCount; ++c) { HOGUILayout.Vertical(GUI.skin.box, () => { propData = twData.propDatas[c]; bool propDeleted = false; HOGUILayout.Horizontal(() => { propData.isActive = EditorGUILayout.Toggle(propData.isActive, GUILayout.Width(HOTweenEditorGUI.TinyToggleWidth)); GUILayout.Label(propData.propName + " (" + propData.shortPropType + ")", HOGUIStyle.miniLabel); GUILayout.FlexibleSpace(); if (GUILayout.Button(new GUIContent("╣", "Duplicate this property tween"), HOGUIStyle.iconButton)) { undoManager.ForceDirty(); HOTweenManager.HOPropData propDataClone = propData.Clone(); StoreValidPluginsFor(twData.targetType, propDataClone); twData.propDatas.Add(propDataClone); } if (HOGUILayout.ColoredButton(new GUIContent("x", "Delete this property tween"), HOGUIStyle.iconButton, Color.white, Color.red)) { undoManager.ForceDirty(); dcPropDataToValidPluginDatas.Remove(propData); dcPropDataToValidPluginsEnum.Remove(propData); twData.propDatas.RemoveAt(c); --propDatasCount; propDeleted = true; } }); if (!propDeleted) { HOGUILayout.DisabledGroup(!propData.isActive, () => { string[] propPluginsEnum = dcPropDataToValidPluginsEnum[propData]; // Plugin type popup int ind = 0; // Get index of currently applied plugin. Type plugType = propData.pluginType; List<PluginData> propPlugins = dcPropDataToValidPluginDatas[propData]; if (plugType != null) { for (int d = 0; d < propPlugins.Count; ++d) { if (propPlugins[d].type == plugType) { ind = d; break; } } } else { propData.pluginType = propPlugins[0].type; } // Show popup HOGUILayout.DisabledGroup(propPluginsEnum.Length <= 1, () => { int newInd = EditorGUILayout.Popup("Plugin Type", ind, propPluginsEnum); if (newInd != ind) { propData.pluginType = propPlugins[newInd].type; propData.valueType = null; } }); // Property type popup. ind = 0; // Get reference to currently used plugin. foreach (PluginData pd in pluginDatas) { if (pd.type == propData.pluginType) { plugData = pd; break; } } if (plugData != null) { // Get index of currently used value type. Type valType = propData.valueType; if (valType != null) { for (int d = 0; d < plugData.validValueTypes.Length; ++d) { if (plugData.validValueTypes[d] == valType) { ind = d; break; } } } else { propData.valueType = plugData.validValueTypes[0]; } // Show popup HOGUILayout.DisabledGroup(plugData.validValueTypesEnum.Length <= 1, () => { int newInd = EditorGUILayout.Popup("Value Type", ind, plugData.validValueTypesEnum); if (newInd != ind) propData.valueType = plugData.validValueTypes[newInd]; }); } // Value field. string twSuffix = "TO"; if (twData.tweenFrom) { twSuffix = (propData.isRelative ? "BY FROM" : "FROM"); } else { twSuffix = (propData.isRelative ? "BY" : "TO"); } if (propData.valueType == typeof(Vector2)) { propData.endVal = EditorGUILayout.Vector2Field("Tween " + twSuffix, (Vector2)propData.endVal); } else if (propData.valueType == typeof(Vector3)) { propData.endVal = EditorGUILayout.Vector3Field("Tween " + twSuffix, (Vector3)propData.endVal); } else if (propData.valueType == typeof(Quaternion)) { propData.endVal = EditorGUILayout.Vector4Field("Tween " + twSuffix, (Vector4)propData.endVal); } else if (propData.valueType == typeof(Color)) { propData.endVal = EditorGUILayout.ColorField("Tween " + twSuffix, (Color)propData.endVal); } else if (propData.valueType == typeof(Int32)) { propData.endVal = EditorGUILayout.IntField("Tween " + twSuffix, (int)propData.endVal); } else if (propData.valueType == typeof(String)) { propData.endVal = EditorGUILayout.TextField("Tween " + twSuffix, (string)propData.endVal); } else if (propData.valueType == typeof(Single)) { propData.endVal = EditorGUILayout.FloatField("Tween " + twSuffix, (float)propData.endVal); } else if (propData.valueType == typeof(Rect)) { propData.endVal = EditorGUILayout.RectField("Tween " + twSuffix, (Rect)propData.endVal); } // Is relative. EditorGUIUtility.LookLikeControls(81); propData.isRelative = EditorGUILayout.Toggle("Relative", propData.isRelative); }); } }); } // General tween parameters // Other parameters. HOGUILayout.Horizontal(() => { EditorGUIUtility.LookLikeControls(86, 70); twData.duration = EditorGUILayout.FloatField("Duration", twData.duration); if (twData.duration < 0) twData.duration = 0; GUILayout.Space(10); EditorGUIUtility.LookLikeControls(50, 40); twData.delay = EditorGUILayout.FloatField("Delay", twData.delay); if (twData.delay < 0) twData.delay = 0; }); HOGUILayout.Horizontal(() => { EditorGUIUtility.LookLikeControls(86, 70); twData.timeScale = EditorGUILayout.FloatField("TimeScale", twData.timeScale); if (twData.timeScale < 0) twData.timeScale = 0; GUILayout.Space(10); EditorGUIUtility.LookLikeControls(50, 40); twData.loops = EditorGUILayout.IntField("Loops", twData.loops); if (twData.loops < -1) twData.loops = -1; }); EditorGUIUtility.LookLikeControls(86, 100); twData.updateType = (Holoville.HOTween.UpdateType)EditorGUILayout.EnumPopup("Update Type", twData.updateType); HOGUILayout.DisabledGroup(twData.loops == 0 || twData.loops == 1, () => { twData.loopType = (Holoville.HOTween.LoopType)EditorGUILayout.EnumPopup("Loop Type", twData.loopType); }); twData.easeType = (Holoville.HOTween.EaseType)EditorGUILayout.EnumPopup("Ease Type", twData.easeType); HOGUILayout.HorizontalDivider(2); EditorGUIUtility.LookLikeControls(86, 100); twData.onCompleteActionType = (HOTweenManager.HOTweenData.OnCompleteActionType)EditorGUILayout.EnumPopup("OnComplete", twData.onCompleteActionType); if (twData.onCompleteActionType == HOTweenManager.HOTweenData.OnCompleteActionType.PlayTweensById) { twData.onCompletePlayId = EditorGUILayout.TextField("Id", twData.onCompletePlayId); } else if (twData.onCompleteActionType == HOTweenManager.HOTweenData.OnCompleteActionType.SendMessage) { HOGUILayout.ShadedGroup(twData.onCompleteTarget == null ? Color.red : GUI.backgroundColor, () => { twData.onCompleteTarget = EditorGUILayout.ObjectField("GameObject", twData.onCompleteTarget, typeof(GameObject), !EditorUtility.IsPersistent(src)) as GameObject; }); HOGUILayout.ShadedGroup(twData.onCompleteMethodName == null || twData.onCompleteMethodName == "" ? Color.red : GUI.backgroundColor, () => { twData.onCompleteMethodName = EditorGUILayout.TextField("Method Name", twData.onCompleteMethodName); }); twData.onCompleteParmType = (HOTweenManager.HOTweenData.ParameterType)EditorGUILayout.EnumPopup("Value type", twData.onCompleteParmType); switch (twData.onCompleteParmType) { case HOTweenManager.HOTweenData.ParameterType.Color: twData.onCompleteParmColor = EditorGUILayout.ColorField("Value", twData.onCompleteParmColor); break; case HOTweenManager.HOTweenData.ParameterType.Number: twData.onCompleteParmNumber = EditorGUILayout.FloatField("Value", twData.onCompleteParmNumber); break; case HOTweenManager.HOTweenData.ParameterType.Object: twData.onCompleteParmObject = EditorGUILayout.ObjectField("Value", twData.onCompleteParmObject, typeof(UnityEngine.Object), !EditorUtility.IsPersistent(src)); break; case HOTweenManager.HOTweenData.ParameterType.Quaternion: twData.onCompleteParmQuaternion = (Quaternion.Euler(EditorGUILayout.Vector3Field("Value", twData.onCompleteParmQuaternion.eulerAngles))); break; case HOTweenManager.HOTweenData.ParameterType.Rect: twData.onCompleteParmRect = EditorGUILayout.RectField("Value", twData.onCompleteParmRect); break; case HOTweenManager.HOTweenData.ParameterType.String: twData.onCompleteParmString = EditorGUILayout.TextField("Value", twData.onCompleteParmString); break; case HOTweenManager.HOTweenData.ParameterType.Vector2: twData.onCompleteParmVector2 = EditorGUILayout.Vector2Field("Value", twData.onCompleteParmVector2); break; case HOTweenManager.HOTweenData.ParameterType.Vector3: twData.onCompleteParmVector3 = EditorGUILayout.Vector3Field("Value", twData.onCompleteParmVector3); break; case HOTweenManager.HOTweenData.ParameterType.Vector4: twData.onCompleteParmVector4 = EditorGUILayout.Vector4Field("Value", twData.onCompleteParmVector4); break; } } EditorGUIUtility.LookLikeControls(labelsWidth, fieldsWidth); GUILayout.Space(HOTweenEditorGUI.ControlsVPadding); }); } } }); } }
static void DrawTweens() { src.tweenDatas.Sort(SortTweenDatas); int tweensCount = src.tweenDatas.Count; for (int i = 0; i < tweensCount; ++i) { EditorGUIUtility.LookLikeControls(81); HOTweenManager.HOTweenData twData = src.tweenDatas[i]; HOTweenManager.HOPropData propData; PluginData plugData = null; bool invalidTarget = twData.targetRoot == null; bool emptyTween = twData.propDatas == null || twData.propDatas.Count == 0; // Group everything to allow drag HOGUILayout.Vertical(() => { Color toolbarColor = invalidTarget ? HOTweenEditorVars.errorBgColor : emptyTween ? HOTweenEditorVars.warningBgColor : HOTweenEditorVars.tweenToolbarColor; HOGUILayout.Toolbar(toolbarColor, () => { twData.isActive = HOGUILayout.ToolbarToggle(twData.isActive); twData.foldout = HOGUILayout.MiniFoldout(twData.foldout, (twData.id == "" ? "" : "[" + twData.id + "] ") + (isManagerGUI ? twData.targetPath : twData.partialTargetPath), true); if (HOGUILayout.ColoredButton(new GUIContent("+", "Add a property to tween"), HOGUIStyle.toolbarButton, HOTweenEditorVars.strongButtonBgColor, HOTweenEditorVars.strongButtonFontColor, GUILayout.Width(HOGUIStyle.IconButtonWidth * 2))) { currentTwData = twData; objDatasCollection = new List <List <ObjectData> >(); objDatasCollection.Add(GetProperties(twData.target)); panelMode = HOTweenPanelMode.PropertySelection; } if (GUILayout.Button(new GUIContent("╣", "Duplicate this tween"), HOGUIStyle.toolbarIconButton)) { undoManager.ForceDirty(); HOTweenManager.HOTweenData twDataClone = twData.Clone(++src.creationTime); foreach (HOTweenManager.HOPropData pd in twDataClone.propDatas) { StoreValidPluginsFor(twDataClone.targetType, pd); } src.tweenDatas.Add(twDataClone); ++tweensCount; } if (isManagerGUI) { if (GUILayout.Button(new GUIContent("□", "Select GameObject"), HOGUIStyle.toolbarIconButton)) { Selection.activeGameObject = twData.targetRoot; EditorWindow h = GetHierarchyPanel(); if (h != null) { h.Focus(); // Focus Hierarchy panel. } } } if (HOGUILayout.ColoredButton(new GUIContent("x", "Delete this tween"), HOGUIStyle.toolbarIconButton, Color.red, Color.white)) { undoManager.ForceDirty(); src.tweenDatas.RemoveAt(i); --tweensCount; } }); if (twData.foldout) { if (invalidTarget) { GUILayout.Label("This tween's target doesn't exist anymore", HOGUIStyle.wordWrapLabelBold); GUILayout.Space(4); } else { HOGUILayout.DisabledGroup(!twData.isActive, () => { // General options toolbar HOGUILayout.Toolbar(() => { GUILayout.Label("Id", HOGUIStyle.miniLabel); twData.id = EditorGUILayout.TextField("", twData.id, HOGUIStyle.toolbarTextField, GUILayout.ExpandWidth(true)); twData.tweenFrom = HOGUILayout.ToggleButton(twData.tweenFrom, new GUIContent("From", "If selected the tween will animate FROM instead than TO the given value"), HOGUIStyle.toolbarButton, HOTweenEditorVars.toggleBgColor, HOTweenEditorVars.toggleFontColor, GUILayout.Width(40)); twData.paused = !HOGUILayout.ToggleButton(!twData.paused, new GUIContent("Autoplay"), HOGUIStyle.toolbarButton, HOTweenEditorVars.toggleBgColor, HOTweenEditorVars.toggleFontColor, GUILayout.Width(60)); twData.autoKill = HOGUILayout.ToggleButton(twData.autoKill, new GUIContent("Autokill", "If selected, destroys the tween after it reaches completion"), HOGUIStyle.toolbarButton, HOTweenEditorVars.toggleBgColor, HOTweenEditorVars.toggleFontColor, GUILayout.Width(60)); }); // Properties int propDatasCount = twData.propDatas.Count; for (int c = 0; c < propDatasCount; ++c) { HOGUILayout.Vertical(GUI.skin.box, () => { propData = twData.propDatas[c]; bool propDeleted = false; HOGUILayout.Horizontal(() => { propData.isActive = EditorGUILayout.Toggle(propData.isActive, GUILayout.Width(HOTweenEditorGUI.TinyToggleWidth)); GUILayout.Label(propData.propName + " (" + propData.shortPropType + ")", HOGUIStyle.miniLabel); GUILayout.FlexibleSpace(); if (GUILayout.Button(new GUIContent("╣", "Duplicate this property tween"), HOGUIStyle.iconButton)) { undoManager.ForceDirty(); HOTweenManager.HOPropData propDataClone = propData.Clone(); StoreValidPluginsFor(twData.targetType, propDataClone); twData.propDatas.Add(propDataClone); } if (HOGUILayout.ColoredButton(new GUIContent("x", "Delete this property tween"), HOGUIStyle.iconButton, Color.white, Color.red)) { undoManager.ForceDirty(); dcPropDataToValidPluginDatas.Remove(propData); dcPropDataToValidPluginsEnum.Remove(propData); twData.propDatas.RemoveAt(c); --propDatasCount; propDeleted = true; } }); if (!propDeleted) { HOGUILayout.DisabledGroup(!propData.isActive, () => { string[] propPluginsEnum = dcPropDataToValidPluginsEnum[propData]; // Plugin type popup int ind = 0; // Get index of currently applied plugin. Type plugType = propData.pluginType; List <PluginData> propPlugins = dcPropDataToValidPluginDatas[propData]; if (plugType != null) { for (int d = 0; d < propPlugins.Count; ++d) { if (propPlugins[d].type == plugType) { ind = d; break; } } } else { propData.pluginType = propPlugins[0].type; } // Show popup HOGUILayout.DisabledGroup(propPluginsEnum.Length <= 1, () => { int newInd = EditorGUILayout.Popup("Plugin Type", ind, propPluginsEnum); if (newInd != ind) { propData.pluginType = propPlugins[newInd].type; propData.valueType = null; } }); // Property type popup. ind = 0; // Get reference to currently used plugin. foreach (PluginData pd in pluginDatas) { if (pd.type == propData.pluginType) { plugData = pd; break; } } if (plugData != null) { // Get index of currently used value type. Type valType = propData.valueType; if (valType != null) { for (int d = 0; d < plugData.validValueTypes.Length; ++d) { if (plugData.validValueTypes[d] == valType) { ind = d; break; } } } else { propData.valueType = plugData.validValueTypes[0]; } // Show popup HOGUILayout.DisabledGroup(plugData.validValueTypesEnum.Length <= 1, () => { int newInd = EditorGUILayout.Popup("Value Type", ind, plugData.validValueTypesEnum); if (newInd != ind) { propData.valueType = plugData.validValueTypes[newInd]; } }); } // Value field. string twSuffix = "TO"; if (twData.tweenFrom) { twSuffix = (propData.isRelative ? "BY FROM" : "FROM"); } else { twSuffix = (propData.isRelative ? "BY" : "TO"); } if (propData.valueType == typeof(Vector2)) { propData.endVal = EditorGUILayout.Vector2Field("Tween " + twSuffix, (Vector2)propData.endVal); } else if (propData.valueType == typeof(Vector3)) { propData.endVal = EditorGUILayout.Vector3Field("Tween " + twSuffix, (Vector3)propData.endVal); } else if (propData.valueType == typeof(Quaternion)) { propData.endVal = EditorGUILayout.Vector4Field("Tween " + twSuffix, (Vector4)propData.endVal); } else if (propData.valueType == typeof(Color)) { propData.endVal = EditorGUILayout.ColorField("Tween " + twSuffix, (Color)propData.endVal); } else if (propData.valueType == typeof(Int32)) { propData.endVal = EditorGUILayout.IntField("Tween " + twSuffix, (int)propData.endVal); } else if (propData.valueType == typeof(String)) { propData.endVal = EditorGUILayout.TextField("Tween " + twSuffix, (string)propData.endVal); } else if (propData.valueType == typeof(Single)) { propData.endVal = EditorGUILayout.FloatField("Tween " + twSuffix, (float)propData.endVal); } else if (propData.valueType == typeof(Rect)) { propData.endVal = EditorGUILayout.RectField("Tween " + twSuffix, (Rect)propData.endVal); } // Is relative. EditorGUIUtility.LookLikeControls(81); propData.isRelative = EditorGUILayout.Toggle("Relative", propData.isRelative); }); } }); } // General tween parameters // Other parameters. HOGUILayout.Horizontal(() => { EditorGUIUtility.LookLikeControls(86, 70); twData.duration = EditorGUILayout.FloatField("Duration", twData.duration); if (twData.duration < 0) { twData.duration = 0; } GUILayout.Space(10); EditorGUIUtility.LookLikeControls(50, 40); twData.delay = EditorGUILayout.FloatField("Delay", twData.delay); if (twData.delay < 0) { twData.delay = 0; } }); HOGUILayout.Horizontal(() => { EditorGUIUtility.LookLikeControls(86, 70); twData.timeScale = EditorGUILayout.FloatField("TimeScale", twData.timeScale); if (twData.timeScale < 0) { twData.timeScale = 0; } GUILayout.Space(10); EditorGUIUtility.LookLikeControls(50, 40); twData.loops = EditorGUILayout.IntField("Loops", twData.loops); if (twData.loops < -1) { twData.loops = -1; } }); EditorGUIUtility.LookLikeControls(86, 100); twData.updateType = (Holoville.HOTween.UpdateType)EditorGUILayout.EnumPopup("Update Type", twData.updateType); HOGUILayout.DisabledGroup(twData.loops == 0 || twData.loops == 1, () => { twData.loopType = (Holoville.HOTween.LoopType)EditorGUILayout.EnumPopup("Loop Type", twData.loopType); }); twData.easeType = (Holoville.HOTween.EaseType)EditorGUILayout.EnumPopup("Ease Type", twData.easeType); HOGUILayout.HorizontalDivider(2); EditorGUIUtility.LookLikeControls(86, 100); twData.onCompleteActionType = (HOTweenManager.HOTweenData.OnCompleteActionType)EditorGUILayout.EnumPopup("OnComplete", twData.onCompleteActionType); if (twData.onCompleteActionType == HOTweenManager.HOTweenData.OnCompleteActionType.PlayTweensById) { twData.onCompletePlayId = EditorGUILayout.TextField("Id", twData.onCompletePlayId); } else if (twData.onCompleteActionType == HOTweenManager.HOTweenData.OnCompleteActionType.SendMessage) { HOGUILayout.ShadedGroup(twData.onCompleteTarget == null ? Color.red : GUI.backgroundColor, () => { twData.onCompleteTarget = EditorGUILayout.ObjectField("GameObject", twData.onCompleteTarget, typeof(GameObject), !EditorUtility.IsPersistent(src)) as GameObject; }); HOGUILayout.ShadedGroup(twData.onCompleteMethodName == null || twData.onCompleteMethodName == "" ? Color.red : GUI.backgroundColor, () => { twData.onCompleteMethodName = EditorGUILayout.TextField("Method Name", twData.onCompleteMethodName); }); twData.onCompleteParmType = (HOTweenManager.HOTweenData.ParameterType)EditorGUILayout.EnumPopup("Value type", twData.onCompleteParmType); switch (twData.onCompleteParmType) { case HOTweenManager.HOTweenData.ParameterType.Color: twData.onCompleteParmColor = EditorGUILayout.ColorField("Value", twData.onCompleteParmColor); break; case HOTweenManager.HOTweenData.ParameterType.Number: twData.onCompleteParmNumber = EditorGUILayout.FloatField("Value", twData.onCompleteParmNumber); break; case HOTweenManager.HOTweenData.ParameterType.Object: twData.onCompleteParmObject = EditorGUILayout.ObjectField("Value", twData.onCompleteParmObject, typeof(UnityEngine.Object), !EditorUtility.IsPersistent(src)); break; case HOTweenManager.HOTweenData.ParameterType.Quaternion: twData.onCompleteParmQuaternion = (Quaternion.Euler(EditorGUILayout.Vector3Field("Value", twData.onCompleteParmQuaternion.eulerAngles))); break; case HOTweenManager.HOTweenData.ParameterType.Rect: twData.onCompleteParmRect = EditorGUILayout.RectField("Value", twData.onCompleteParmRect); break; case HOTweenManager.HOTweenData.ParameterType.String: twData.onCompleteParmString = EditorGUILayout.TextField("Value", twData.onCompleteParmString); break; case HOTweenManager.HOTweenData.ParameterType.Vector2: twData.onCompleteParmVector2 = EditorGUILayout.Vector2Field("Value", twData.onCompleteParmVector2); break; case HOTweenManager.HOTweenData.ParameterType.Vector3: twData.onCompleteParmVector3 = EditorGUILayout.Vector3Field("Value", twData.onCompleteParmVector3); break; case HOTweenManager.HOTweenData.ParameterType.Vector4: twData.onCompleteParmVector4 = EditorGUILayout.Vector4Field("Value", twData.onCompleteParmVector4); break; } } EditorGUIUtility.LookLikeControls(labelsWidth, fieldsWidth); GUILayout.Space(HOTweenEditorGUI.ControlsVPadding); }); } } }); } }