public void jumpToScene(string nameToJumpTo, int commandIndex) { if (inRewindMode) { int lastJumpIndex = jumpsList.Count - 1; if (lastJumpIndex > -1) { currSectionIndex = jumpsList [lastJumpIndex].sectionJumpedFrom; currCommandIndex = jumpsList [lastJumpIndex].commandJumpedFrom; jumpsList.RemoveAt(lastJumpIndex); play(); } else { Debug.Log("You are at the starting index of the sequence, can't rewind further"); inRewindMode = false; play(); } } else { int indexOfToSection = Array.IndexOf(sequencerData.getSectionNames(), nameToJumpTo); jumpsList.Add(new PlayerJumpModel(currSectionIndex, indexOfToSection, currCommandIndex, commandIndex)); currSectionIndex = indexOfToSection; currCommandIndex = commandIndex; play(); } }
private void drawSections() { EditorGUILayout.BeginHorizontal(); { GUILayout.Label("Sections"); if (GUILayout.Button("New Section")) { doAddNewSection(); } if (GUILayout.Button("Duplicate Selected Section")) { if (sequencerData.sections != null && lastSelectedSection > -1) { doDuplicateSection(sequencerData.sections [lastSelectedSection]); } } // if (GUILayout.Button("Fix Commands to have reference to data object")) // doFixCommands(); } EditorGUILayout.EndHorizontal(); //spacer GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1)); if (sequencerData != null && sequencerData.getSectionNames().Length > 0) { EditorGUILayout.BeginHorizontal(); { GUILayout.Label("Select Section:"); lastSelectedSection = EditorGUILayout.Popup(lastSelectedSection, sequencerData.getSectionNames(), GUILayout.Width(100)); GUILayout.Label("Rename to this:"); renameBoxString = GUILayout.TextField(renameBoxString); if (GUILayout.Button("Rename this Section")) { doRenameSection(sequencerData.sections [lastSelectedSection], renameBoxString); } if (GUILayout.Button("Delete this Section")) { doDeleteSection(sequencerData.getSectionNames() [lastSelectedSection]); } } EditorGUILayout.EndHorizontal(); } EditorGUILayout.BeginHorizontal(); { GUILayout.Label("Available Commands:"); lastSelectedCommand = EditorGUILayout.Popup(lastSelectedCommand, SequencerCommandTypes.getAsStringArray(), GUILayout.Width(100)); if (GUILayout.Button("Add Command")) { doAddCommandToSection(lastSelectedSection, lastSelectedCommand); } insertIndex = EditorGUILayout.IntField(insertIndex); if (GUILayout.Button("Add Command At")) { doAddCommandToSectionAt(lastSelectedSection, lastSelectedCommand, insertIndex); } } EditorGUILayout.EndHorizontal(); //spacer GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1)); if (lastSelectedSection > -1 && lastSelectedSection < sequencerData.sections.Count && sequencerData.sections [lastSelectedSection] != null && sequencerData.sections [lastSelectedSection].commandList != null) { scrollPosSections = EditorGUILayout.BeginScrollView(scrollPosSections); { EditorGUILayout.BeginVertical(); { SequencerCommandBase[] tempCommands = new SequencerCommandBase[sequencerData.sections [lastSelectedSection].commandList.Count]; sequencerData.sections [lastSelectedSection].commandList.CopyTo(tempCommands); for (int i = 0; i < tempCommands.Length; i++) { if (i % 2 == 0) { EditorGUILayout.BeginHorizontal(guiBGAltColorA); } else { EditorGUILayout.BeginHorizontal(); } { tempCommands [i].drawFrontUi(); tempCommands [i].drawCustomUi(); tempCommands [i].drawBackUi(); } EditorGUILayout.EndHorizontal(); } } EditorGUILayout.EndVertical(); } EditorGUILayout.EndScrollView(); } else { lastSelectedSection -= 1; } }