// Everything to be rendered to the screen is called here void OnGUI() { // Start the scroll view for the list of NPC's scrollViewNPCMenu = GUI.BeginScrollView (new Rect (0, 0, Screen.width / 6, Screen.height / 2), scrollViewNPCMenu, new Rect (0, 0, Screen.width / 6 - 25, 30 * allNPCs.Count)); int itemsY = 0; foreach(DictionaryEntry entry in allNPCs) { // Go through all prefabs GameObject go = (GameObject)(entry.Key); if (go != null) { if(GUI.Button(new Rect(0, itemsY++ * 30, Screen.width / 6 - 25, 25), go.GetComponent("NPC").ToString())) { // Button to choose NPC NPCtoEdit = go; // Make this the NPC to edit, rendered by displayNPC() componentToEdit = null; // Clear out what the component to edit is linkToEdit = varToEdit.NONE; // Clear out the link to edit foldOutBooleans.Clear(); // Get rid of the foldouts data ConversationTree cTree = ((GameObject)allNPCs[NPCtoEdit]).GetComponent<ConversationTree>(); // Get conversation tree if(cTree.root == null) continue; foldOutBooleans.Add(cTree.root, false); // Add the first conversation to foldouts } } } GUI.EndScrollView(); // End the scroll view for the list of NPC's // Displays the conversation of the NPC that is selected displayConversation(); // Displays the component to be edited displayComponentToEdit(); // if(linkToEdit != varToEdit.NONE) // displayEditLink(); // // New NPC Button // if(GUI.Button(new Rect(0, Screen.height / 2, Screen.width / 6, Screen.height / 4), "New NPC")) { // allNPCs.Add(PrefabUtility.CreatePrefab(prefabsPath + "/Eddie", templateNPC)); // // } // Save button if(GUI.Button(new Rect(0.0f, Screen.height * 7 / 8, Screen.width / 6, Screen.height / 8), "Save")) saveEditsToPrefab(); // Refresh button if(GUI.Button(new Rect(Screen.width / 3.0f, Screen.height * 7 / 8, Screen.width / 6, Screen.height / 8), "Refresh")) Init(); // Empty button //if(GUI.Button(new Rect(2.0f / 3.0f * Screen.width, Screen.height * 7 / 8, Screen.width / 6, Screen.height / 8), "Clear")) // EmptyTool(); // Clear button if(GUI.Button(new Rect(2.0f / 3.0f * Screen.width, Screen.height * 7 / 8, Screen.width / 6, Screen.height / 8), "Clear")) ClearScene(); }
void initializeComponentToEdit(Component componentToEdit) { linkToEdit = varToEdit.NONE; if(componentToEdit.GetType() == typeof(Dialogue)) { Dialogue dialogueToEdit = (Dialogue)componentToEdit; dropDownDialogueDisplayTypeMenu.setFirstSelected((int)(dialogueToEdit.displayType)); dropDownDialogueBubbleTypeMenu.setFirstSelected((int)(dialogueToEdit.dialogueBubbleType)); dropDownDialogueSpeakerMenu.setFirstSelected((int)(dialogueToEdit.speaker)); dropDownDialogueTypeMenu.setFirstSelected((int)(dialogueToEdit.type)); } if(componentToEdit.GetType() == typeof(Reply)) { Reply replyToEdit = (Reply)componentToEdit; dropDownReplyTypeMenu.setFirstSelected(Convert.ToInt32(Enum.Format(typeof(Reply.AnswerType), replyToEdit.type, "d"))); } }