void RightClick(Event e) { clickedOnWindow = false; currentlyLinkingResponse = null; linkingTalkingPoints = false; windowID = CheckForWindowClick(e.mousePosition); GenericMenu newMenu = new GenericMenu(); if (clickedOnWindow) { newMenu.AddItem(new GUIContent("Delete Talking Point"), false, DeleteTalkingPoint); newMenu.AddItem(new GUIContent("Reset Height"), false, ResetWindowHeight); } else { newMenu.AddItem(new GUIContent("New Talking Point"), false, AddTalkingPoint); } newMenu.ShowAsContext(); }
void DisplayTalkingPoint(int id) { if (id >= currentDialogue.talkingPoints.Count) { return; } TalkingPoint tp = currentDialogue.talkingPoints[id]; GUILayout.BeginHorizontal(); //NPC name GUILayout.Label(tp.npc == null ? "Select Profile" : tp.npc.characterName /*+ "(" + tp.m_ID.ToString() + ")"*/, EditorStyles.boldLabel); //Starting point toggle bool sp = tp.startingPoint; tp.startingPoint = GUILayout.Toggle(sp, "Starting Point"); if (sp != tp.startingPoint) { ChangeStartingPoint(tp); } //Profile Change Dropdown if (GUILayout.Button("V", GUILayout.Width(25))) { GenericMenu profiles = new GenericMenu(); if (availableProfiles == null) { RefreshProfiles(); } foreach (NPCProfile p in availableProfiles) { profiles.AddItem(new GUIContent(p.name.ToString()), false, AssignProfile, p); } tempTP = tp; profiles.ShowAsContext(); } GUILayout.EndHorizontal(); //GUILayout.Space(7); GUILayout.BeginHorizontal(); //Portrais and text if (tp.npc != null && tp.npc.portraits != null && tp.npc.portraits[tp.currentPortrait].image != null) { GUILayout.Label(tp.npc.portraits[tp.currentPortrait].image.texture, GUILayout.Width(64), GUILayout.Height(64)); tp.text = GUILayout.TextArea(tp.text, GUILayout.Width(250 - 64 - 14), GUILayout.Height(64)); } else { GUILayout.Label("NPC Profiles are broken again..."); } GUILayout.EndHorizontal(); //Portrait Changer if (tp.npc != null) { if (GUILayout.Button("V", GUILayout.Width(25))) { GenericMenu portraits = new GenericMenu(); for (int i = 0; i < tp.npc.portraits.Count; i++) { if (tp.currentPortrait == i) { portraits.AddDisabledItem(new GUIContent(i.ToString() + ". " + tp.npc.portraits[i].mood.ToString())); } else { portraits.AddItem(new GUIContent(i.ToString() + ". " + tp.npc.portraits[i].mood.ToString()), false, ChangePortrait, i); } } tempTP = tp; portraits.ShowAsContext(); } } //Events /* * GUILayout.BeginHorizontal(); * GUILayout.Button("+", GUILayout.Width(25)); * GUILayout.Label("Event"); * GUILayout.FlexibleSpace(); * GUILayout.Button("-", GUILayout.Width(25)); * GUILayout.EndHorizontal(); */ //Responses GUILayout.BeginHorizontal(); if (GUILayout.Button("+", GUILayout.Width(25))) { if (tp.responses == null) { tp.responses = new List <TalkingResponse>(); } tp.responses.Add(new TalkingResponse()); tp.h += heightChangePerResponse; } GUILayout.BeginVertical(); if (tp.responses != null) { foreach (var link in tp.responses) { GUILayout.BeginHorizontal(); //text link.text = GUILayout.TextField(link.text, GUILayout.Width(250 - 64 - 14)); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(); if (GUILayout.Button("-", GUILayout.Width(25))) { tp.responses.Remove(link); tp.h -= heightChangePerResponse; break; } if (GUILayout.Button("L", GUILayout.Width(25))) { linkingTalkingPoints = true; currentlyLinkingResponse = link; } GUILayout.EndVertical(); GUILayout.EndHorizontal(); //GUILayout.Label(link.responseID.ToString()); } } GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUI.DragWindow(); }