//jumps to the mode and page specified public void changeMode(Mode newMode, Page page) { //Save any changes to previous story XMLSerializationManager.saveStory(currentStory); try { currentStory.setCurrentPage(page.getName()); changeMode(newMode); } catch (KeyNotFoundException) { //if page is not in current story, then change the current story Debug.Log("The story you are changing to is not in the same story that was previously active. Changing currentStory"); currentStory = page.storyRef; currentStory.setCurrentPage(page.getName()); changeMode(newMode); } }
public new void OnPointerClick(PointerEventData data) { XMLSerializationManager.saveStory(gm.currentStory); switch (toolbarAction) { case ToolbarAction.ReturnToEditor: gm.changeMode(GameManager.Mode.EditStory); break; case ToolbarAction.AddPage: Page page = new Page("New Page", gm.currentStory); page.buildDefaultPage(); gm.currentStory.addPage(page); FindObjectOfType <StoryEditorManager>().addPageGraphic(page); break; } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); GameManager gm = (GameManager)target; GUILayout.Label("CurrentStory: " + gm.currentStory.name); GUILayout.Label("CurrentPage: " + gm.currentStory.currentPage.name); GUILayout.Label("Story Management"); if (GUILayout.Button("Toggle Current page visibility")) { Debug.Log("toggling current page visibility. CurrentPage.isVisible = " + gm.currentStory.getCurrentPage().isVisible); if (gm.currentStory.getCurrentPage().isVisible == false) { gm.currentStory.getCurrentPage().setVisible(true); } else { gm.currentStory.getCurrentPage().setVisible(false); } } if (GUILayout.Button("BuildIntro")) { Debug.Log("Building intro story"); gm.currentStory = gm.buildIntro(); } if (GUILayout.Button("Make currentPage first page")) { gm.currentStory.firstPageName = gm.currentStory.currentPage.name; } if (GUILayout.Button("Pages in story")) { string output = "Page names in currentstory \n"; foreach (Page page in gm.currentStory.getPages()) { output += page.getName() + "\n"; } Debug.Log(output); } GUILayout.Label("XML Management"); if (GUILayout.Button("Load IntroStory from XML")) { gm.currentStory = XMLSerializationManager.loadStory("Assets/StreamingAssets/XML/intro_data.xml", gm.canvas); gm.currentStory.setCurrentPage("introPage1"); } if (GUILayout.Button("Save Story to XML")) { XMLSerializationManager.saveStory(gm.currentStory); } GUILayout.Label("StoryEditor Management"); if (GUILayout.Button("Build PageNodeGraphics from testStory")) { gm.currentStory = XMLSerializationManager.loadStory("Assets/StreamingAssets/XML/intro_data.xml", gm.canvas); gm.currentStory.setCurrentPage("introPage1"); gm.currentStory.currentPage.setVisible(false); FindObjectOfType <StoryEditorManager>().buildStoryEditorGraphics(gm.currentStory); } if (GUILayout.Button("Add Page")) { Page page = new Page("New Page", gm.currentStory); page.buildDefaultPage(); gm.currentStory.addPage(page); FindObjectOfType <StoryEditorManager>().addPageGraphic(page); } if (GUILayout.Button("Edit Current Page")) { gm.changeMode(GameManager.Mode.EditPage, gm.currentStory.currentPage); } }