public abstract Respond ( Response, response ) : void | ||
response | Response, | |
리턴 | void |
void OnGUI() { if (conversation == null) { return; } GUIStyle guiStyle = GUI.skin.box; guiStyle.wordWrap = true; guiStyle.font = GUI.skin.font; GUI.Box(new Rect(Screen.width / 2 - width / 2, Screen.height / 2 - height / 2, width, height), conversation.GetText(), guiStyle); int response_height = 0; foreach (DictionaryEntry response in conversation.GetResponses()) { string response_text = response.Value as string; if (GUI.Button(new Rect(Screen.width / 2 + width / 2 + 10, Screen.height / 2 - height / 2 + response_height, 200, 50), response_text)) { conversation.Respond(response.Key as Object); } response_height += 60; } if (GUI.Button(new Rect(Screen.width / 2 + width / 2 + 10, Screen.height / 2 - height / 2 + response_height, 200, 50), "(Exit)")) { conversation = null; } }
void OnGUI() { if (conversation == null) { return; } GUIStyle guiStyle = GUI.skin.box; guiStyle.wordWrap = true; guiStyle.font = font; guiStyle.normal.background = Resources.Load("Textures/SyntaxHighlightBlue") as Texture2D; guiStyle.alignment = TextAnchor.MiddleCenter; guiStyle.fontSize = 17; GUI.Box(new Rect(Screen.width / 2 - width / 2, Screen.height / 2 - height / 2, width, height), conversation.GetText(), guiStyle); int response_height = 0; if (conversation.GetResponses() != null) { foreach (object responseObject in conversation.GetResponses()) { Response response = responseObject as Response; string response_text = response.getResponseText(); GUIStyle buttonStyle = GUI.skin.box; buttonStyle.wordWrap = true; buttonStyle.font = font; buttonStyle.normal.background = Resources.Load("Textures/SyntaxHighlightGreen") as Texture2D; buttonStyle.alignment = TextAnchor.MiddleCenter; buttonStyle.fontSize = 17; if (GUI.Button(new Rect(Screen.width / 2 + width / 2 + 10, Screen.height / 2 - height / 2 + response_height, 200, 50), response_text, buttonStyle)) { conversation.Respond(response); if (response.isExit()) { conversation = null; } } response_height += 60; } } }
void OnGUI() { if (conversation == null || !enabled) { return; } GUI.Box(new Rect(0, 0, Screen.width, Screen.height), ""); GUI.BeginGroup(new Rect(Screen.width / 2 - width / 2, Screen.height / 2 - height / 2, width + 210, height)); GUIStyle guiStyle = new GUIStyle(); guiStyle.wordWrap = true; guiStyle.font = font; guiStyle.normal.background = Resources.Load("Textures/SyntaxHighlightBlue") as Texture2D; guiStyle.alignment = TextAnchor.MiddleCenter; guiStyle.fontSize = 20; guiStyle.normal.textColor = Color.white; GUI.Box(new Rect(0, 0, width, height), conversation.GetText(), guiStyle); int response_height = 0; mouse_over_button = false; if (conversation.GetResponses() != null) { foreach (object responseObject in conversation.GetResponses()) { Response response = responseObject as Response; string response_text = response.getResponseText(); GUIStyle buttonStyle = new GUIStyle(); buttonStyle.wordWrap = true; buttonStyle.font = font; buttonStyle.normal.background = Resources.Load("Textures/SyntaxHighlightGreen") as Texture2D; buttonStyle.alignment = TextAnchor.MiddleCenter; buttonStyle.fontSize = 20; buttonStyle.normal.textColor = Color.white; //Check if the mouse is over a button Rect button_rect = new Rect(width + 10, response_height, 200, 50); if (button_rect.Contains(Input.mousePosition)) { mouse_over_button = true; } if (GUI.Button(button_rect, response_text, buttonStyle)) { conversation.Respond(response); if (response.isExit()) { exit(); } } response_height += 60; } } GUI.EndGroup(); if (Event.current.type == EventType.MouseDown && !mouse_over_button) { Event.current.Use(); exit(); return; } }