static public bool drawGUIBox(Rect rect, edit_class edit, float fontSize, bool label2, float labelHeight, Color backgroundColor, Color highlightColor, Color highlightColor2, Color textColor, bool border, int width, Rect screen, bool select, Color select_color, bool active) { if (!select) { highlightColor += new Color(-0.3f, -0.3f, -0.3f); highlightColor2 += new Color(-0.3f, -0.3f, -0.3f); } GUI.color = highlightColor; EditorGUI.DrawPreviewTexture(new Rect(rect.x, rect.y, rect.width, labelHeight), tex2); bool result = drawText(rect, edit, false, textColor, new Color(0.1f, 0.1f, 0.1f, 1), fontSize, true, 6); if (label2) { GUI.color = highlightColor2; EditorGUI.DrawPreviewTexture(new Rect(rect.x, rect.yMax - labelHeight, rect.width, labelHeight), tex2); GUI.color = Color.white; if (!active) { Drawing_tc1.DrawLine(new Vector2(rect.x + 1, rect.y + labelHeight + 1), new Vector2(rect.xMax - 1, rect.yMax - labelHeight - 1), new Color(1, 0, 0, 0.7f), 3, false, screen); Drawing_tc1.DrawLine(new Vector2(rect.x + 1, rect.yMax - labelHeight - 1), new Vector2(rect.xMax - 1, rect.y + labelHeight + 1), new Color(1, 0, 0, 0.7f), 3, false, screen); } } else if (!active) { Drawing_tc1.DrawLine(new Vector2(rect.x + 1, rect.y + labelHeight + 1), new Vector2(rect.xMax - 1, rect.yMax - 1), new Color(1, 0, 0, 0.7f), 3, false, screen); Drawing_tc1.DrawLine(new Vector2(rect.x + 1, rect.yMax - 1), new Vector2(rect.xMax - 1, rect.y + labelHeight + 1), new Color(1, 0, 0, 0.7f), 3, false, screen); } if (border) { DrawRect(rect, highlightColor, width, screen); Drawing_tc1.DrawLine(new Vector2(rect.x, rect.y + labelHeight), new Vector2(rect.xMax, rect.y + labelHeight), highlightColor, width, false, screen); if (label2) { Drawing_tc1.DrawLine(new Vector2(rect.x, rect.yMax - labelHeight), new Vector2(rect.xMax, rect.yMax - labelHeight), highlightColor, width, false, screen); } } GUI.color = Color.white; return(result); }
public override bool drawGUIBox(Rect rect, edit_class edit, float fontSize, bool label2, float labelHeight, Color backgroundColor, Color highlightColor, Color highlightColor2, Color textColor, bool border, int width, Rect screen, bool select, Color select_color, bool active) { if (!select) { highlightColor += new Color(-0.3f, -0.3f, -0.3f); highlightColor2 += new Color(-0.3f, -0.3f, -0.3f); } GUI.color = highlightColor; bool result = this.drawText(rect, edit, false, textColor, new Color(0.1f, 0.1f, 0.1f, (float)1), fontSize, true, 6); if (label2) { GUI.color = highlightColor2; GUI.color = Color.white; if (!active) { Drawing_tc1.DrawLine(new Vector2(rect.x + (float)1, rect.y + labelHeight + (float)1), new Vector2(rect.xMax - (float)1, rect.yMax - labelHeight - (float)1), new Color((float)1, (float)0, (float)0, 0.7f), (float)3, false, screen); Drawing_tc1.DrawLine(new Vector2(rect.x + (float)1, rect.yMax - labelHeight - (float)1), new Vector2(rect.xMax - (float)1, rect.y + labelHeight + (float)1), new Color((float)1, (float)0, (float)0, 0.7f), (float)3, false, screen); } } else if (!active) { Drawing_tc1.DrawLine(new Vector2(rect.x + (float)1, rect.y + labelHeight + (float)1), new Vector2(rect.xMax - (float)1, rect.yMax - (float)1), new Color((float)1, (float)0, (float)0, 0.7f), (float)3, false, screen); Drawing_tc1.DrawLine(new Vector2(rect.x + (float)1, rect.yMax - (float)1), new Vector2(rect.xMax - (float)1, rect.y + labelHeight + (float)1), new Color((float)1, (float)0, (float)0, 0.7f), (float)3, false, screen); } if (border) { this.DrawRect(rect, highlightColor, (float)width, screen); Drawing_tc1.DrawLine(new Vector2(rect.x, rect.y + labelHeight), new Vector2(rect.xMax, rect.y + labelHeight), highlightColor, (float)width, false, screen); if (label2) { Drawing_tc1.DrawLine(new Vector2(rect.x, rect.yMax - labelHeight), new Vector2(rect.xMax, rect.yMax - labelHeight), highlightColor, (float)width, false, screen); } } GUI.color = Color.white; return(result); }
static public bool drawText(Rect rect, edit_class edit, bool background, Color color, Color backgroundColor, float fontSize, bool bold, int mode) { Vector2 vector = new Vector2(); int fontSize2; FontStyle fontStyle; Color color2 = GUI.color; Vector2 size = new Vector2(); if (background) { GUI.color = backgroundColor; EditorGUI.DrawPreviewTexture(new Rect(vector.x, vector.y, size.x, size.y), tex2); } GUI.color = color; if (!edit.edit) { fontSize2 = GUI.skin.label.fontSize; fontStyle = GUI.skin.label.fontStyle; GUI.skin.label.fontSize = (int)fontSize; if (bold) { GUI.skin.label.fontStyle = FontStyle.Bold; } else { GUI.skin.label.fontStyle = FontStyle.Normal; } size = GUI.skin.GetStyle("Label").CalcSize(new GUIContent(edit.default_text)); vector = Mathw.calc_rect_allign(rect, size, mode); GUI.Label(new Rect(vector.x, vector.y, size.x, size.y), edit.default_text); GUI.skin.label.fontSize = fontSize2; GUI.skin.label.fontStyle = fontStyle; } else { fontSize2 = GUI.skin.textField.fontSize; fontStyle = GUI.skin.textField.fontStyle; GUI.skin.textField.fontSize = (int)fontSize; if (bold) { GUI.skin.textField.fontStyle = FontStyle.Bold; } else { GUI.skin.textField.fontStyle = FontStyle.Normal; } size = GUI.skin.GetStyle("TextField").CalcSize(new GUIContent(edit.text)); if (size.x < rect.width) { size.x = rect.width; } size.x += 10; vector = Mathw.calc_rect_allign(rect, size, mode); edit.text = GUI.TextField(new Rect(vector.x, vector.y, size.x, size.y), edit.text); GUI.skin.textField.fontSize = fontSize2; GUI.skin.textField.fontStyle = fontStyle; } if (Event.current.button == 0 && Event.current.clickCount == 2 && Event.current.type == 0 && new Rect(vector.x, vector.y, size.x, size.y).Contains(Event.current.mousePosition)) { edit.edit = !edit.edit; } bool arg_330_0; if (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.Escape) { edit.edit = false; GUI.color = color2; arg_330_0 = true; } else { GUI.color = color2; arg_330_0 = false; } return(arg_330_0); }