/// <summary> /// Update and Draw the inspector /// </summary> public override void OnInspectorGUI() { visualTrack.Update(); EditorGUILayout.Foldout(shotFoldout, "Shot List"); ShotTrack track = base.serializedObject.targetObject as ShotTrack; { var __array1 = track.TimelineItems; var __arrayLength1 = __array1.Length; for (int __i1 = 0; __i1 < __arrayLength1; ++__i1) { var shot = (CinemaShot)__array1[__i1]; { shot.name = EditorGUILayout.TextField(new GUIContent("Shot Name"), shot.name); EditorGUI.indentLevel++; shot.shotCamera = EditorGUILayout.ObjectField(new GUIContent("Camera"), shot.shotCamera, typeof(Camera), true) as Camera; shot.CutTime = EditorGUILayout.FloatField(new GUIContent("Cut Time"), shot.CutTime); shot.ShotLength = EditorGUILayout.FloatField(new GUIContent("Shot Length"), shot.ShotLength); EditorGUI.indentLevel--; } } } if (GUILayout.Button("Add New Shot")) { CutsceneItemFactory.CreateNewShot(track); } visualTrack.ApplyModifiedProperties(); }
/// <summary> /// Draw the header control at slot 3. In most cases this is the "Add" button. /// </summary> /// <param name="position">The position of the track's 3rd header control</param> protected override void updateHeaderControl3(Rect position) { ShotTrack shotTrack = TargetTrack.Behaviour as ShotTrack; Color temp = GUI.color; GUI.color = (shotTrack.Shots.Length > 0) ? Color.green : Color.red; if (GUI.Button(position, string.Empty, TrackGroupControl.styles.addIcon)) { addNewShot(shotTrack); } GUI.color = temp; }
public override void Trigger(GameObject actor) { if (!Application.isPlaying) { return; } shotTrack = Cutscene.GetComponentInChildren <ShotTrack>(); //PanelManager panelMgr = AppFacade.Instance.GetManager<PanelManager>(); //LuaManager luaMgr = AppFacade.Instance.GetManager<LuaManager>(); //handler = TimeManager.TotalMilliSeconds(DateTime.Now); //if (!panelMgr.IsPanelVisible(UIName)) //{ // LuaFunction func = luaMgr.mainLua.GetFunction(UIName + ".show"); // if (func == null) return; // func.BeginPCall(); // func.Push(handler); // func.Push(actor); // func.Push((int)Direction); // if(!string.IsNullOrEmpty(Args)) // func.Push(Args); // func.PCall(); // func.EndPCall(); //} //else //{ // LuaFunction func = luaMgr.mainLua.GetFunction(UIName + ".addItem"); // if (func == null) return; // func.BeginPCall(); // func.Push(handler); // func.Push(actor); // func.Push((int)Direction); // if (!string.IsNullOrEmpty(Args)) // func.Push(Args); // func.PCall(); // func.EndPCall(); //} //updateTimeFunc = luaMgr.mainLua.GetFunction(UIName + ".updateTime"); }
/// <summary> /// Update and Draw the inspector /// </summary> public override void OnInspectorGUI() { visualTrack.Update(); EditorGUILayout.Foldout(shotFoldout, "Shot List"); ShotTrack track = base.serializedObject.targetObject as ShotTrack; TimelineItem[] items = track.TimelineItems; for (int i = 0; i < items.Length; i++) { CinemaGlobalAction shot = items[i] as CinemaGlobalAction; shot.name = EditorGUILayout.TextField(new GUIContent("Shot Name"), shot.name); EditorGUI.indentLevel++; // Check if it is an actor event. CinemaShot cinemaShot = shot as CinemaShot; if (cinemaShot != null) { cinemaShot.shotCamera = EditorGUILayout.ObjectField(new GUIContent("Camera"), cinemaShot.shotCamera, typeof(Camera), true) as Camera; } else { // Display something for non-default shots } shot.Firetime = EditorGUILayout.FloatField(new GUIContent("Cut Time"), shot.Firetime); shot.Duration = EditorGUILayout.FloatField(new GUIContent("Shot Length"), shot.Duration); EditorGUI.indentLevel--; } if (GUILayout.Button("Add New Shot")) { CutsceneItemFactory.CreateNewShot(track); } visualTrack.ApplyModifiedProperties(); }
public static CinemaShot CreateNewShot(ShotTrack shotTrack) { string name = DirectorHelper.getCutsceneItemName(shotTrack.gameObject, SHOT_NAME_DEFAULT, typeof(CinemaShot)); GameObject shotGO = new GameObject(name); shotGO.transform.parent = shotTrack.transform; SortedDictionary <float, CinemaShot> sortedShots = new SortedDictionary <float, CinemaShot>(); foreach (CinemaShot s in shotTrack.TimelineItems) { sortedShots.Add(s.CutTime, s); } float latestTime = 0; float length = DEFAULT_SHOT_LENGTH; foreach (CinemaShot s in sortedShots.Values) { if (latestTime >= s.CutTime) { latestTime = Mathf.Max(latestTime, s.CutTime + s.Duration); } else { length = s.CutTime - latestTime; break; } } CinemaShot shot = shotGO.AddComponent <CinemaShot>(); shot.CutTime = latestTime; shot.ShotLength = length; return(shot); }
protected override void showBodyContextMenu(Event evt) { ShotTrack itemTrack = TargetTrack.Behaviour as ShotTrack; if (itemTrack == null) { return; } Behaviour b = DirectorCopyPaste.Peek(); PasteContext pasteContext = new PasteContext(evt.mousePosition, itemTrack); GenericMenu createMenu = new GenericMenu(); if (b != null && DirectorHelper.IsTrackItemValidForTrack(b, itemTrack)) { createMenu.AddItem(new GUIContent("Paste"), false, pasteItem, pasteContext); } else { createMenu.AddDisabledItem(new GUIContent("Paste")); } createMenu.ShowAsContext(); }
/// <summary> /// Update and Draw the inspector /// </summary> public override void OnInspectorGUI() { visualTrack.Update(); EditorGUILayout.Foldout(shotFoldout, "Shot List"); ShotTrack track = base.serializedObject.targetObject as ShotTrack; foreach (CinemaShot shot in track.Shots) { shot.name = EditorGUILayout.TextField(new GUIContent("Shot Name"), shot.name); EditorGUI.indentLevel++; shot.shotCamera = EditorGUILayout.ObjectField(new GUIContent("Camera"), shot.shotCamera, typeof(Camera), true) as Camera; shot.CutTime = EditorGUILayout.FloatField(new GUIContent("Cut Time"), shot.CutTime); shot.ShotLength = EditorGUILayout.FloatField(new GUIContent("Shot Length"), shot.ShotLength); EditorGUI.indentLevel--; } if (GUILayout.Button("Add New Shot")) { CutsceneItemFactory.CreateNewShot(track); } visualTrack.ApplyModifiedProperties(); }
public PasteContext(Vector2 mousePosition, ShotTrack track) { this.mousePosition = mousePosition; this.track = track; }
private void addNewShot(ShotTrack shotTrack) { GameObject shot = CutsceneItemFactory.CreateNewShot(shotTrack).gameObject; Undo.RegisterCreatedObjectUndo(shot, string.Format("Create {0}", shot.name)); }