private bool DrawAddBranchButton() { EditorGUILayout.BeginHorizontal(GUILayout.Width(20.0f)); { if (GUILayout.Button("Add Branch")) { EventStartBranchingState evnt = GetEditableObject() as EventStartBranchingState; Branch newBranch = new Branch(); ArrayUtils.Add(ref evnt._branches, newBranch); GetTimelineEditor().GetParent().OnAddedNewXmlNode(newBranch); return(true); } GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); return(false); }
public override void DrawLabel(GUIStyle style) { EventStartBranchingState evnt = GetEditableObject() as EventStartBranchingState; GUILayout.BeginArea(new Rect(kEventPadding, kEventPadding, GetLabelSize().x, GetLabelSize().y), EditorUtils.ColoredRoundedBoxStyle); { GUILayout.Label("<b>Branching State:</b>", EditorUtils.TextWhiteStyle); bool firstBranch = true; foreach (Branch branch in evnt._branches) { GUILayout.BeginHorizontal(); { GUILayout.Label(GetBranchLabel(branch, firstBranch), EditorUtils.TextStyle); GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); firstBranch = false; } if (evnt._backgroundLogic.Length > 0) { GUILayout.Label("<b>During Branching State:</b>", EditorUtils.TextWhiteStyle); foreach (BranchingBackgroundLogic backgroundLogic in evnt._backgroundLogic) { GUILayout.BeginHorizontal(); { GUILayout.Label("- " + backgroundLogic.GetDescription(), EditorUtils.TextStyle); GUILayout.FlexibleSpace(); } GUILayout.EndHorizontal(); } } } GUILayout.EndArea(); }
public override bool RenderObjectProperties(GUIContent label) { Color orig = GUI.backgroundColor; EventStartBranchingState evnt = GetEditableObject() as EventStartBranchingState; bool dataChanged = false; #region Render Brances EditorGUILayout.LabelField("Branches:", EditorStyles.boldLabel); EditorGUILayout.Separator(); for (int i = 0; i < evnt._branches.Length; i++) { GUI.backgroundColor = _branchLabelColor; EditorGUILayout.LabelField(GetBranchLabel(evnt._branches[i], i == 0), EditorUtils.TextTitleStyle, GUILayout.Height(24.0f)); GUI.backgroundColor = orig; //Draw branch properties bool branchChanged; SerializedObjectEditorGUILayout.ObjectField(evnt._branches[i], string.Empty, out branchChanged); dataChanged |= branchChanged; if (DrawEditBranchButtons(i)) { dataChanged = true; break; } } dataChanged |= DrawAddBranchButton(); #endregion EditorGUILayout.Separator(); EditorGUILayout.Separator(); #region Render Background Logic Threads EditorGUILayout.LabelField("Background Logic:", EditorStyles.boldLabel); EditorGUILayout.Separator(); for (int i = 0; i < evnt._backgroundLogic.Length; i++) { BranchingBackgroundLogic backgroundLogic = evnt._backgroundLogic[i]; GUI.backgroundColor = _branchLabelColor; EditorGUILayout.LabelField(backgroundLogic.GetDescription(), EditorUtils.TextTitleStyle, GUILayout.Height(24.0f)); GUI.backgroundColor = orig; //Draw backgroundLogic properties { int origIndent = EditorGUI.indentLevel; EditorGUI.indentLevel++; bool objectChanged; backgroundLogic = SerializedObjectEditorGUILayout.ObjectField(backgroundLogic, "", out objectChanged); dataChanged |= objectChanged; EditorGUI.indentLevel = origIndent; } if (DrawEditBackgroundLogicButtons(i)) { dataChanged = true; break; } } dataChanged |= DrawAddBackgroundLogicButton(); #endregion return(dataChanged); }