private void OnGUI() { // OnEnable(); dialogue = EditorGUILayout.ObjectField("Dialogue", dialogue, typeof(Dialogue), false) as Dialogue; if (GUI.Button(new Rect(153, 18, 50, 17), "Reset")) { FakeOnEnable(); } GUI.DrawTexture(new Rect(0, 35, Screen.width, Screen.height), UsualFunction.MakeTex(2, 2, Color.black)); DrawGrid(20, 0.2f, Color.white); DrawGrid(100, 0.4f, Color.white); if (dialogue != null) { CreateStart(); DrawNodes(); DrawConnections(); DrawConnectionLine(Event.current); ProcessNodeEvents(Event.current); ProcessEvents(Event.current); DrawInspector(); } if (GUI.changed) { Repaint(); EditorUtility.SetDirty(dialogue); EditorUtility.SetDirty(this); } }
public void OnGUI() { texName = EditorGUILayout.TextField("Name", texName); texColor = EditorGUILayout.ColorField("Color", texColor); if (GUILayout.Button("Create")) { Texture2D texture = UsualFunction.MakeTex(100, 100, texColor); var yes = texture.EncodeToPNG(); File.WriteAllBytes("Assets/Resources/EditorTextures/" + texName + ".png", yes); AssetDatabase.Refresh(); } }
private void SetStyles() { var sentCol = Resources.Load("EditorTextures/SenStyle") as Texture2D; sentenceStyle = new GUIStyle(); sentenceStyle.alignment = TextAnchor.MiddleCenter; sentenceStyle.normal.background = sentCol; sentenceStyle.border = new RectOffset(12, 12, 12, 12); var selSentCol = Resources.Load("EditorTextures/SelSenStyle") as Texture2D; selectedSentenceStyle = new GUIStyle(); selectedSentenceStyle.alignment = TextAnchor.MiddleCenter; selectedSentenceStyle.normal.background = selSentCol; selectedSentenceStyle.border = new RectOffset(12, 12, 12, 12); var startCol = Resources.Load("EditorTextures/StartStyle") as Texture2D; startStyle = new GUIStyle(); startStyle.alignment = TextAnchor.MiddleCenter; startStyle.normal.background = startCol; startStyle.border = new RectOffset(12, 12, 12, 12); var selStartCol = Resources.Load("EditorTextures/SelStartStyle") as Texture2D; selectedStartStyle = new GUIStyle(); selectedStartStyle.alignment = TextAnchor.MiddleCenter; selectedStartStyle.normal.background = selStartCol; selectedStartStyle.border = new RectOffset(12, 12, 12, 12); var endCol = Resources.Load("EditorTextures/EndStyle") as Texture2D; endStyle = new GUIStyle(); endStyle.alignment = TextAnchor.MiddleCenter; endStyle.normal.background = endCol; endStyle.border = new RectOffset(12, 12, 12, 12); var selEndCol = Resources.Load("EditorTextures/SelEndStyle") as Texture2D; selectedEndStyle = new GUIStyle(); selectedEndStyle.alignment = TextAnchor.MiddleCenter; selectedEndStyle.normal.background = selEndCol; selectedEndStyle.border = new RectOffset(12, 12, 12, 12); var entryCol = UsualFunction.MakeTex(2, 2, new Color(132, 119, 232, 100)); selectedEntryStyle = new GUIStyle(); selectedEntryStyle.alignment = TextAnchor.MiddleCenter; selectedEntryStyle.normal.background = entryCol; selectedEntryStyle.border = new RectOffset(12, 12, 12, 12); var selEntryCol = UsualFunction.MakeTex(2, 2, new Color(132, 119, 232, 75)); selectedEntryStyle = new GUIStyle(); selectedEntryStyle.alignment = TextAnchor.MiddleCenter; selectedEntryStyle.normal.background = selEntryCol; selectedEntryStyle.border = new RectOffset(12, 12, 12, 12); var pointCol = Resources.Load("EditorTextures/PointStyle") as Texture2D; inPointStyle = new GUIStyle(); inPointStyle.normal.background = pointCol; inPointStyle.active.background = pointCol; inPointStyle.border = new RectOffset(4, 4, 12, 12); outPointStyle = new GUIStyle(); outPointStyle.normal.background = pointCol; outPointStyle.active.background = pointCol; outPointStyle.border = new RectOffset(4, 4, 12, 12); labelStyle = new GUIStyle(); labelStyle.fontSize = 20; labelStyle.fontStyle = FontStyle.Bold; labelStyle.alignment = TextAnchor.MiddleLeft; labelStyle.normal.textColor = new Color(0, 0, 0, 1); selectedLabelStyle = new GUIStyle(); selectedLabelStyle.fontSize = 23; selectedLabelStyle.fontStyle = FontStyle.Bold; selectedLabelStyle.alignment = TextAnchor.MiddleLeft; selectedLabelStyle.normal.textColor = new Color(1, 1, 1, 1); }