public static void Init() { // Get existing open window or if none, make a new one: try { window = GetWindow <MidiFileSetupWindow>(true, "Midi File Setup"); window.minSize = new Vector2(828, 400); styleBold = new GUIStyle(EditorStyles.boldLabel); styleBold.fontStyle = FontStyle.Bold; styleRichText = new GUIStyle(EditorStyles.label); styleRichText.richText = true; styleRichText.alignment = TextAnchor.UpperLeft; heightLine = styleRichText.lineHeight * 1.2f; espace = 5; widthLeft = 500;// 415; itemHeight = 25; buttonWidth = 150; buttonHeight = 18; xpostitlebox = 2; ypostitlebox = 5; } catch (System.Exception ex) { MidiPlayerGlobal.ErrorDetail(ex); } }
public static void Init() { // Get existing open window or if none, make a new one: try { window = GetWindow <MidiFileSetupWindow>(true, "Midi File Setup"); window.minSize = new Vector2(828, 400); //Debug.Log(window.position); int borderSize = 1; // Border size in pixels RectOffset rectBorder = new RectOffset(borderSize, borderSize, borderSize, borderSize); styleBold = new GUIStyle(EditorStyles.boldLabel); styleBold.fontStyle = FontStyle.Bold; styleBold.alignment = TextAnchor.UpperLeft; styleBold.normal.textColor = Color.black; styleMiniButton = new GUIStyle(EditorStyles.miniButtonMid); styleMiniButton.fixedWidth = 16; styleMiniButton.fixedHeight = 16; float gray1 = 0.5f; float gray2 = 0.1f; float gray3 = 0.7f; float gray4 = 0.65f; float gray5 = 0.5f; styleWindow = new GUIStyle("box"); styleWindow.normal.background = ToolsEditor.MakeTex(10, 10, new Color(gray5, gray5, gray5, 1f), rectBorder, new Color(gray2, gray2, gray2, 1f)); styleWindow.alignment = TextAnchor.MiddleCenter; stylePanel = new GUIStyle("box"); stylePanel.normal.background = ToolsEditor.MakeTex(10, 10, new Color(gray4, gray4, gray4, 1f), rectBorder, new Color(gray2, gray2, gray2, 1f)); stylePanel.alignment = TextAnchor.MiddleCenter; styleListTitle = new GUIStyle("box"); styleListTitle.normal.background = ToolsEditor.MakeTex(10, 10, new Color(gray1, gray1, gray1, 1f), rectBorder, new Color(gray2, gray2, gray2, 1f)); styleListTitle.normal.textColor = Color.black; styleListTitle.alignment = TextAnchor.MiddleCenter; styleListRow = new GUIStyle("box"); styleListRow.normal.background = ToolsEditor.MakeTex(10, 10, new Color(gray3, gray3, gray3, 1f), rectBorder, new Color(gray2, gray2, gray2, 1f)); styleListRow.alignment = TextAnchor.MiddleCenter; styleListRowSelected = new GUIStyle("box"); styleListRowSelected.normal.background = ToolsEditor.MakeTex(10, 10, new Color(.6f, .8f, .6f, 1f), rectBorder, new Color(gray2, gray2, gray2, 1f)); styleListRowSelected.alignment = TextAnchor.MiddleCenter; styleListLabel = new GUIStyle("label"); styleListLabel.alignment = TextAnchor.UpperLeft; styleListLabel.normal.textColor = Color.black; styleToggle = new GUIStyle("toggle"); //styleToggle.normal.background = ToolsEditor.MakeTex(10, 10, new Color(gray1, gray1, gray1, 1f), rectBorder, new Color(gray2, gray2, gray2, 1f)); styleToggle.normal.textColor = Color.black; styleToggle.hover.textColor = Color.black; styleToggle.active.textColor = Color.black; styleToggle.focused.textColor = Color.black; //styleToggle.alignment = TextAnchor.MiddleCenter; styleRed = new GUIStyle(EditorStyles.label); styleRed.normal.textColor = new Color(188f / 255f, 56f / 255f, 56f / 255f); //styleRed.fontStyle = FontStyle.Bold; styleRichText = new GUIStyle(EditorStyles.label); styleRichText.richText = true; styleRichText.alignment = TextAnchor.UpperLeft; styleRichText.normal.textColor = Color.black; styleRichTextBorder = new GUIStyle(EditorStyles.label); styleRichTextBorder.richText = true; styleRichTextBorder.alignment = TextAnchor.MiddleLeft; styleRichTextBorder.normal.textColor = Color.black; styleRichTextBorder.normal.background = ToolsEditor.MakeTex(500, 600, new Color(gray5, gray5, gray5, 1f), rectBorder, new Color(gray2, gray2, gray2, 1f)); styleLabelRight = new GUIStyle(EditorStyles.label); styleLabelRight.alignment = TextAnchor.MiddleRight; styleLabelRight.normal.textColor = Color.black; styleLabelCenter = new GUIStyle(EditorStyles.label); styleLabelCenter.alignment = TextAnchor.MiddleCenter; styleLabelCenter.normal.textColor = Color.black; styleLabelLeft = new GUIStyle(EditorStyles.label); styleLabelLeft.alignment = TextAnchor.MiddleLeft; styleLabelLeft.normal.textColor = Color.black; styleLabelUpperLeft = new GUIStyle(EditorStyles.label); styleLabelUpperLeft.alignment = TextAnchor.UpperLeft; styleLabelUpperLeft.normal.textColor = Color.black; styleLabelUpperLeft.hover.textColor = Color.black; } catch (System.Exception ex) { MidiPlayerGlobal.ErrorDetail(ex); } }