private void DrawNode(Node node, GUIStyle style) { Rect nodeRect = new Rect(node.m_position.x, node.m_position.y, node.m_dimension.x, node.m_dimension.y); // draw plugs on specific node DrawPlug(node.m_inputPlug, nodeRect, m_inputPlugStyle, 1, 1); int plug_count = 1; Plug delete_plug = null; foreach (KeyValuePair <int, Plug> output_plug in node.m_outputPlugs) { if (delete_plug == null) { delete_plug = DrawPlug(output_plug.Value, nodeRect, m_outputPlugStyle, plug_count, node.m_outputPlugs.Count); } else { DrawPlug(output_plug.Value, nodeRect, m_outputPlugStyle, plug_count, node.m_outputPlugs.Count); } ++plug_count; } if (delete_plug != null) { m_nodeGraphModel.RemoveOutputPlugFromNode(delete_plug.m_plugId, delete_plug.m_nodeId); } // drawing the node itself with the contents in it DialogueData data = m_nodeGraphModel.GetDataFromNodeID(node.m_id); if ((data.questsToAdd.Count > 0) || (data.questsToComplete.Count > 0) || (data.itemsToGive.Count > 0)) { style = m_actionNodeStyle; } GUI.Box(nodeRect, "", style); float padding = 7f; Rect nodeContentRect = new Rect(node.m_position.x + padding, node.m_position.y + padding, node.m_dimension.x - (2 * padding), node.m_dimension.y - (2 * padding)); BeginArea(nodeContentRect); Label("Dialogue", EditorStyles.boldLabel); if (data != null) { List <string> errors = m_nodeGraphModel.GetErrorMesssages(node.m_id); if (errors.Count > 0) { GUIStyle error_label = new GUIStyle(); error_label.fontStyle = FontStyle.Bold; error_label.normal.textColor = new Color(171f / 255f, 19f / 255f, 0); Label("Errors!!", error_label); } Label(data.characterName); string tag_pattern = "<[^>]+>"; string displayText = Regex.Replace(data.dialogueText, tag_pattern, ""); Label(displayText, Height(node.m_dimension.y)); } EndArea(); }
public void DisplayErrorMessages(int node_id) { List <string> error_messages = m_nodeGraphModel.GetErrorMesssages(node_id); GUIStyle error_label = new GUIStyle(); error_label.fontStyle = FontStyle.Bold; error_label.fontSize = 16; error_label.normal.textColor = new Color(171f / 255f, 19f / 255f, 0); if (error_messages.Count > 0) { Label("AAAAAAAA Errors!", error_label); Label(""); error_label.fontSize = 13; foreach (var error in error_messages) { Label(error, error_label); } Label(""); } }