public void Draw(ActionTable actable) { GUILayout.BeginVertical(); TimeLine(); for (int i = 0; i < mEvents.Count; i++) { float rate = mEvents[i].mTime / mTotalTime; TimeLine(rate, Color.red); } if (mCurrentEvent != null) { float rate = mCurrentEvent.mTime / mTotalTime; TimeLine(rate, Color.blue); } mTotalTimelineBGTex.Apply(); GUILayout.Label(mTotalTimelineBGTex); GUILayout.BeginHorizontal(); GUILayout.Label("============== Action ================="); GUILayout.EndHorizontal(); { GUILayout.BeginHorizontal(); GUILayout.BeginHorizontal(); // this.mName = EditorGUILayout.TextField("Name",this.mName); this.mTotalTime = EditorGUILayout.FloatField("Total Time", this.mTotalTime); mActionEventType = (ActionObject.ActionType)EditorGUILayout.EnumPopup("Event Type", mActionEventType); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Change Event")) { if (mCurrentEventIndex >= 0 && mCurrentEventIndex < mEvents.Count) { ActionEvent ev = ActionFactory.CreateActionEvent(mActionEventType); if (ev != null) { ev.SetActionObject(this); this.mEvents[mCurrentEventIndex] = ev; this.mCurrentEvent = ev; } } } if (GUILayout.Button("Add Event")) { ActionEvent ev = ActionFactory.CreateActionEvent(mActionEventType); if (ev != null) { ev.SetActionObject(this); mCurrentEvent = ev; mCurrentEventIndex = mEvents.Count; this.mEvents.Add(ev); } } if (GUILayout.Button("Delete Event")) { if (EditorUtility.DisplayDialog("Remove Event", "Are you sure to remove Event?", "Remove", "Cancel")) { if (mCurrentEvent != null) { mEvents.Remove(mCurrentEvent); mCurrentEvent = null; mCurrentEventIndex = -1; } } } GUILayout.EndHorizontal(); GUILayout.EndHorizontal(); } { GUILayout.BeginHorizontal(); for (int i = 0; i < mEvents.Count; i++) { ActionEvent ev = this.mEvents[i]; // ev.Draw(this); if (GUILayout.Button("" + i)) { mCurrentEvent = ev; mCurrentEventIndex = i; } } GUILayout.EndHorizontal(); GUILayout.BeginVertical(); if (mCurrentEvent != null) { GUILayout.Label("============== Event " + mCurrentEventIndex + " ================="); mCurrentEvent.Draw(this); } GUILayout.EndVertical(); } GUILayout.EndVertical(); }