/// <summary> /// Generates all the styles for this node group based of the color /// </summary> private void GenerateStyles() { // Transparent background Texture2D background = RTEditorGUI.ColorToTex(8, _color * new Color(1, 1, 1, 0.4f)); // lighter, less transparent background Texture2D altBackground = RTEditorGUI.ColorToTex(8, _color * new Color(1, 1, 1, 0.6f)); // nearly opaque background Texture2D opBackground = RTEditorGUI.ColorToTex(8, _color * new Color(1, 1, 1, 0.9f)); backgroundStyle = new GUIStyle(); backgroundStyle.normal.background = background; backgroundStyle.padding = new RectOffset(10, 10, 5, 5); altBackgroundStyle = new GUIStyle(); altBackgroundStyle.normal.background = altBackground; altBackgroundStyle.padding = new RectOffset(10, 10, 5, 5); opBackgroundStyle = new GUIStyle(); opBackgroundStyle.normal.background = opBackground; opBackgroundStyle.padding = new RectOffset(10, 10, 5, 5); // dragHandleStyle = new GUIStyle (); // dragHandleStyle.normal.background = background; // //dragHandleStyle.hover.background = altBackground; // dragHandleStyle.padding = new RectOffset (10, 10, 5, 5); headerTitleStyle = new GUIStyle(); headerTitleStyle.fontSize = 20; headerTitleStyle.normal.textColor = Color.white; headerTitleEditStyle = new GUIStyle(headerTitleStyle); headerTitleEditStyle.normal.background = background; headerTitleEditStyle.focused.background = background; headerTitleEditStyle.focused.textColor = Color.white; }
public static bool Init(bool GUIFunction) { Background = ResourceManager.LoadTexture("Textures/background.png"); AALineTex = ResourceManager.LoadTexture("Textures/AALine.png"); GUIBox = ResourceManager.LoadTexture("Textures/NE_Box.png"); GUIButton = ResourceManager.LoadTexture("Textures/NE_Button.png"); GUIBoxSelection = ResourceManager.LoadTexture("Textures/BoxSelection.png"); if (!(bool)Background || !(bool)AALineTex || !(bool)GUIBox || !(bool)GUIButton) { return(false); } if (!GUIFunction) { return(true); } nodeSkin = Object.Instantiate(GUI.skin); nodeSkin.label.normal.textColor = NE_TextColor; nodeLabel = nodeSkin.label; nodeSkin.box.normal.textColor = NE_TextColor; nodeSkin.box.normal.background = GUIBox; nodeBox = nodeSkin.box; nodeSkin.button.normal.textColor = NE_TextColor; nodeSkin.button.normal.background = GUIButton; nodeSkin.textArea.normal.background = GUIBox; nodeSkin.textArea.active.background = GUIBox; nodeLabelBold = new GUIStyle(nodeLabel); nodeLabelBold.fontStyle = FontStyle.Bold; nodeLabelSelected = new GUIStyle(nodeLabel); nodeLabelSelected.normal.background = RTEditorGUI.ColorToTex(1, NE_LightColor); nodeBoxBold = new GUIStyle(nodeBox); nodeBoxBold.fontStyle = FontStyle.Bold; return(true); }
public static bool Init() { // Textures Background = ResourceManager.LoadTexture("Textures/background.png"); AALineTex = ResourceManager.LoadTexture("Textures/AALine.png"); GUIBox = ResourceManager.LoadTexture("Textures/NE_Box.png"); GUIButton = ResourceManager.LoadTexture("Textures/NE_Button.png"); GUIBoxSelection = ResourceManager.LoadTexture("Textures/BoxSelection.png"); if (!Background || !AALineTex || !GUIBox || !GUIButton) { return(false); } // Skin & Styles nodeSkin = Object.Instantiate <GUISkin> (GUI.skin); // Label nodeSkin.label.normal.textColor = NE_TextColor; nodeLabel = nodeSkin.label; // Box nodeSkin.box.normal.textColor = NE_TextColor; nodeSkin.box.normal.background = GUIBox; nodeBox = nodeSkin.box; // Button nodeSkin.button.normal.textColor = NE_TextColor; nodeSkin.button.normal.background = GUIButton; // TextArea nodeSkin.textArea.normal.background = GUIBox; nodeSkin.textArea.active.background = GUIBox; // Bold Label nodeLabelBold = new GUIStyle(nodeLabel); nodeLabelBold.fontStyle = FontStyle.Bold; // Selected Label nodeLabelSelected = new GUIStyle(nodeLabel); nodeLabelSelected.normal.background = RTEditorGUI.ColorToTex(1, NE_LightColor); // Centered Label nodeLabelCentered = new GUIStyle(nodeLabel); nodeLabelCentered.alignment = TextAnchor.MiddleCenter; // Centered Bold Label nodeLabelBoldCentered = new GUIStyle(nodeLabelBold); nodeLabelBoldCentered.alignment = TextAnchor.MiddleCenter; // Bold Box nodeBoxBold = new GUIStyle(nodeBox); nodeBoxBold.fontStyle = FontStyle.Bold; return(true); }
public static bool Init() { // Textures Background = ResourceManager.LoadTexture("Textures/background.png"); GUIBoxLight = ResourceManager.LoadTexture("Textures/NE_Box_Light.png"); AALineTex = ResourceManager.LoadTexture("Textures/AALine.png"); AALineTexUV = ResourceManager.LoadTexture("Textures/AALineUV.png"); AALineTexRGBA = ResourceManager.LoadTexture("Textures/AALineRGBA.png"); AALineTexSource = ResourceManager.LoadTexture("Textures/AALineSource.png"); GuiShadero = ResourceManager.LoadTexture("Textures/Shadero_Sprite.png"); GUIBox = ResourceManager.LoadTexture("Textures/NE_Box.png"); GUIBoxTitle = ResourceManager.LoadTexture("Textures/NE_Box_2.png"); GUIBoxTitleS = ResourceManager.LoadTexture("Textures/NE_Box_3.png"); GUIButton = ResourceManager.LoadTexture("Textures/NE_Button.png"); GUIBoxSelection = ResourceManager.LoadTexture("Textures/BoxSelection.png"); if (!Background || !AALineTex || !GUIBox || !GUIButton) { return(false); } // Skin & Styles nodeSkin = Object.Instantiate <GUISkin> (GUI.skin); nodeSkin2 = Object.Instantiate <GUISkin> (GUI.skin); // Label nodeSkin.label.fontSize = 14; nodeSkin.label.normal.textColor = NE_TextColor; nodeLabel = nodeSkin.label; // Box nodeSkin.box.normal.textColor = NE_TextColor; nodeSkin.box.normal.background = GUIBox; nodeBox = nodeSkin.box; nodeSkin2.box.normal.textColor = NE_TextColor; nodeSkin2.box.normal.background = GUIBoxTitle; nodeBoxTitle = nodeSkin2.box; // Button nodeSkin.button.fontSize = 14; nodeSkin.button.normal.textColor = NE_TextColor; nodeSkin.button.normal.background = GUIButton; // TextArea nodeSkin.textArea.normal.background = GUIBoxTitle; nodeSkin.textArea.active.background = GUIBoxTitleS; // Bold Label nodeLabelBold = new GUIStyle(nodeLabel); nodeLabelBold.fontStyle = FontStyle.Bold; // Selected Label nodeLabelSelected = new GUIStyle(nodeLabel); nodeLabelSelected.normal.background = RTEditorGUI.ColorToTex(1, NE_LightColor); nodeBoxTitle.fontSize = 16; nodeBoxTitle.alignment = TextAnchor.MiddleCenter; // Bold Box nodeBoxTitleBold = new GUIStyle(nodeBoxTitle); nodeBoxTitleBold.fontSize = 17; nodeBoxTitleBold.fontStyle = FontStyle.Bold; nodeBoxTitleBold.alignment = TextAnchor.MiddleCenter; nodeBoxBold = new GUIStyle(nodeBox); nodeBoxBold.fontStyle = FontStyle.Bold; return(true); }
/// <summary> /// Defines an reload. This should assign knobTexture and return the path to knobTexture. /// </summary> protected virtual void ReloadTexture() { knobTexture = RTEditorGUI.ColorToTex(1, Color.red); }
public static bool Init() { // Textures Background = ResourceManager.LoadTexture("Textures/background.png"); AALineTex = ResourceManager.LoadTexture("Textures/AALine.png"); GUIBox = ResourceManager.LoadTexture("Textures/NE_Box.png"); GUIButton = ResourceManager.LoadTexture("Textures/NE_Button.png"); //GUIBoxSelection = ResourceManager.LoadTexture("Textures/BoxSelection.png"); GUIToolbar = ResourceManager.LoadTexture("Textures/NE_Toolbar.png"); GUIToolbarButton = ResourceManager.LoadTexture("Textures/NE_ToolbarButton.png"); if (!Background || !AALineTex || !GUIBox || !GUIButton || !GUIToolbar || !GUIToolbarButton) { return(false); } // Skin & Styles nodeSkin = Object.Instantiate(GUI.skin); GUI.skin = nodeSkin; foreach (GUIStyle style in GUI.skin) { style.fontSize = 11; //style.normal.textColor = style.active.textColor = style.focused.textColor = style.hover.textColor = NE_TextColor; } // Label nodeSkin.label.normal.textColor = NE_TextColor; nodeLabel = nodeSkin.label; nodeLabelBold = new GUIStyle(nodeLabel) { fontStyle = FontStyle.Bold }; nodeLabelSelected = new GUIStyle(nodeLabel); nodeLabelSelected.normal.background = RTEditorGUI.ColorToTex(1, NE_LightColor); nodeLabelCentered = new GUIStyle(nodeLabel) { alignment = TextAnchor.MiddleCenter }; nodeLabelBoldCentered = new GUIStyle(nodeLabelBold) { alignment = TextAnchor.MiddleCenter }; nodeLabelLeft = new GUIStyle(nodeLabel) { alignment = TextAnchor.MiddleLeft }; nodeLabelRight = new GUIStyle(nodeLabel) { alignment = TextAnchor.MiddleRight }; // Box nodeSkin.box.normal.background = GUIBox; nodeSkin.box.normal.textColor = NE_TextColor; nodeSkin.box.active.textColor = NE_TextColor; nodeBox = nodeSkin.box; nodeBoxBold = new GUIStyle(nodeBox) { fontStyle = FontStyle.Bold }; // Button nodeSkin.button.normal.textColor = NE_TextColor; nodeSkin.button.normal.background = GUIButton; // Toolbar toolbar = GUI.skin.FindStyle("toolbar"); toolbarButton = GUI.skin.FindStyle("toolbarButton"); toolbarLabel = GUI.skin.FindStyle("toolbarButton"); toolbarDropdown = GUI.skin.FindStyle("toolbarDropdown"); toolbarArrow = GUI.skin.FindStyle("GUIEditor.BreadcrumbLeft"); if (toolbar == null || toolbarButton == null || toolbarLabel == null || toolbarDropdown == null) { // No editor styles available - use custom skin toolbar = new GUIStyle(nodeSkin.box); toolbar.normal.background = GUIToolbar; toolbar.active.background = GUIToolbar; toolbar.border = new RectOffset(0, 0, 1, 1); toolbar.margin = new RectOffset(0, 0, 0, 0); toolbar.padding = new RectOffset(10, 10, 1, 1); toolbarLabel = new GUIStyle(nodeSkin.box); toolbarLabel.normal.background = GUIToolbarButton; toolbarLabel.border = new RectOffset(2, 2, 0, 0); toolbarLabel.margin = new RectOffset(-2, -2, 0, 0); toolbarLabel.padding = new RectOffset(6, 6, 4, 4); toolbarButton = new GUIStyle(toolbarLabel); toolbarButton.active.background = RTEditorGUI.ColorToTex(1, NE_LightColor); toolbarDropdown = new GUIStyle(toolbarButton); } GUI.skin = null; return(true); }