/// <summary> /// Creates a new empty GUI skin in the specified folder. /// </summary> /// <param name="folder">Folder relative to project library to create the GUI skin in.</param> public static void CreateEmptyGUISkin(string folder) { string path = Path.Combine(folder, "New GUI Skin.asset"); path = GetUniquePath(path); GUISkin guiSkin = new GUISkin(); ProjectLibrary.Create(guiSkin, path); }
/// <summary> /// Constructor for this user control /// </summary> /// <param id="id">Id of this control</param> /// <param id="position">Position of this control</param> /// <param id="size">Size of this control</param> /// <param id="skin">Style of this control</param> public MultilineLabel(string id, Vector2 position, Vector2 size, GUISkin skin) { this.Id = id; this.Position = position; this.Size = size; this.Skin = skin; }
/// <summary> /// Constructor of this user control /// </summary> /// <param id="id">Id of this control</param> /// <param id="position">Position of this control</param> /// <param id="newText">Text of this control</param> /// <param id="skin">Style of this control</param> public Label(string id, Vector2 position, string text, GUISkin skin) { this.Id = id; this.Position = position; this.Text = text; this.Skin = skin; }
/// <summary> /// Constructor of this class /// </summary> /// <param id="id">Id of the control</param> /// <param id="position">Position of the control</param> /// <param id="size">Size of the control</param> /// <param id="newText">Text in the control</param> /// <param id="skin">Style of this control</param> public Button(string id, Vector2 position, Vector2 size, string text, GUISkin skin) { this.Id = id; this.Position = position; this.Size = size; this.Text = text; this.Skin = skin; }
/// <summary> /// Initialization of the MapUI, the control variables and the control buttons /// </summary> public void Initialize() { screenOffset = new Vector2(-100, -60); mouseSelectingTexture = UI.Instance.GetGuiTex(DRAG_SELECTION_TEX_NAME); this.selectedObjects = new List<GameObject>(); mouseoverTileTracking = false; gameObjectTracking = true; mouseSelecting = false; int i = 0; int width = 100; int height = 32; int spacing = 32; int starty = 40; var controlFont = UI.Instance.GetFont("verdana16b"); var buttonSkin = new GUISkin(UI.Instance.GetGuiTex("blueOverlay2"), controlFont, Color.Black, false, true); cm = new ControlManager(); cm.AddControl(new Button("objMove", new Vector2(5, starty + spacing * i++), new Vector2(width, height), "Move[M]", buttonSkin) { onLClickSubscriber = _ => ChangeIngameState(InGameStateEnum.Movement) }); cm.AddControl(new Button("objCast", new Vector2(5, starty + spacing * i++), new Vector2(width, height), "Cast[P]", buttonSkin) { onLClickSubscriber = _ => ChangeIngameState(InGameStateEnum.Spell) }); cm.AddControl(new Button("objAttack", new Vector2(5, starty + spacing * i++), new Vector2(width, height), "Attack[T]", buttonSkin) { onLClickSubscriber = _ => ChangeIngameState(InGameStateEnum.Attack) }); cm.AddControl(new Button("objGather", new Vector2(5, starty + spacing * i++), new Vector2(width, height), "Gather[G]", buttonSkin) { onLClickSubscriber = _ => ChangeIngameState(InGameStateEnum.Gather) }); cm.AddControl(new Button("objTrain", new Vector2(5, starty + spacing * i++), new Vector2(width, height), "Train[R]", buttonSkin) { onLClickSubscriber = _ => ChangeIngameState(InGameStateEnum.Train) }); cm.AddControl(new Button("objBuild", new Vector2(5, starty + spacing * i++), new Vector2(width, height), "Build[B]", buttonSkin) { onLClickSubscriber = _ => ChangeIngameState(InGameStateEnum.BuildingPlacement) }); cm.AddControl(new Button("objConstruct", new Vector2(5, starty + spacing * i++), new Vector2(width, height), "Construct[B]", buttonSkin) { onLClickSubscriber = _ => ChangeIngameState(InGameStateEnum.Building) }); UpdateUserControls(inGameState); }
/// <summary> /// Creates a new default Unity skin if there are no existing skins with the given <paramref name="name"/>. /// </summary> /// <param name="name">Name for the new skin.</param> /// <param name="skinInitializer">Optional skin initializer.</param> /// <param name="baseSkin">Optional base skin to copy from.</param> /// <returns>New or cached skin.</returns> public static GUISkin RegisterDerivedOnce(string name, Action <GUISkin> skinInitializer = null, GUISkin baseSkin = null) { if (!guiSkins.ContainsKey(name)) { GUISkin newSkin = RegisterDerived(name, baseSkin); skinInitializer?.Invoke(newSkin); } return(guiSkins[name]); }
public void OpenExplorer(GraphExplorerWindow _window, Graph _rootGraph, FREditorSettings _settings, GUISkin _editorSkin, GraphEditor _editor) { _editor.graphExplorer = new GraphExplorer(_rootGraph, _settings, _editorSkin, _editor); editor = _editor; _window.Show(); }
private void HandleCollisionGroupEntryPair(CollisionGroupEntryPair entryPair, GUISkin skin) { GUILayout.BeginHorizontal(); { GUILayout.BeginVertical(GUILayout.Width(12)); { GUILayout.Space(4); GUILayout.Label(GUI.MakeLabel("[", 22), skin.label, GUILayout.Height(32), GUILayout.Width(12)); } GUILayout.EndVertical(); GUILayout.BeginVertical(); { HandleCollisionGroupEntry(entryPair.First, skin); HandleCollisionGroupEntry(entryPair.Second, skin); } GUILayout.EndVertical(); } GUILayout.EndHorizontal(); }
public override void DrawGUI(string _title, int _id, Graph _graph, GUISkin _editorSkin) { base.DrawGUI(nodeData.title, _id, _graph, _editorSkin); }
void Start() { skin = Resources.Load("GUISkin") as GUISkin; }
/// <summary> /// Draws the window if it is visible. /// </summary> public void Draw( ) { if (!IsVisible) { return; } if (!GameHelper.AllowChecklistWindow( )) { IsVisible = false; OnCloseEvent(this, EventArgs.Empty); } if (_skin == null) { // Initialize our skin and styles. _skin = GameObject.Instantiate(HighLogic.Skin) as GUISkin; _skin.horizontalScrollbarThumb.fixedHeight = wScale(13); _skin.horizontalScrollbar.fixedHeight = wScale(13); _labelStyle = new GUIStyle(_skin.label) { fontSize = wScale(11), fontStyle = FontStyle.Italic, }; _progressLabelStyle = new GUIStyle(_skin.label) { fontStyle = FontStyle.BoldAndItalic, alignment = TextAnchor.MiddleCenter, fontSize = wScale(11), normal = { textColor = new Color(0.322f, 0.298f, 0.004f), }, }; _situationStyle = new GUIStyle(_progressLabelStyle) { fontSize = wScale(13), alignment = TextAnchor.MiddleCenter, fontStyle = FontStyle.Normal, fixedHeight = wScale(25), contentOffset = wScale(new Vector2(0, 6)), wordWrap = true, normal = { textColor = new Color(0.7f, 0.8f, 0.8f), } }; _experimentProgressLabelStyle = new GUIStyle(_skin.label) { fontSize = wScale(16), alignment = TextAnchor.MiddleLeft, padding = wScale(new RectOffset(0, 0, 4, 0)) }; _textFieldStyle = new GUIStyle(_skin.textField) { fontSize = wScale(16), alignment = TextAnchor.MiddleLeft, }; _horizontalScrollbarOnboardStyle = new GUIStyle(_skin.horizontalScrollbar) { normal = { background = _emptyTexture, }, }; _compactWindowStyle = new GUIStyle(_skin.window) { padding = wScale(new RectOffset(0, 4, 4, 4)) }; _compactLabelStyle = new GUIStyle(_labelStyle) { fontSize = wScale(9) }; _compactSituationStyle = new GUIStyle(_situationStyle) { fontSize = wScale(11), contentOffset = wScale(new Vector2(0, 3)) }; _compactButtonStyle = new GUIStyle(_skin.button) { padding = new RectOffset(), fixedHeight = wScale(16) }; _closeButtonStyle = new GUIStyle(_skin.button) { // int left, int right, int top, int bottom padding = wScale(new RectOffset(2, 2, 2, 2)), margin = wScale(new RectOffset(1, 1, 1, 1)), stretchWidth = false, stretchHeight = false, alignment = TextAnchor.MiddleCenter, }; _windowStyle = new GUIStyle(_skin.window) { fontSize = (int)(_skin.window.fontSize * _parent.Config.UiScale), padding = wScale(_skin.window.padding), margin = wScale(_skin.window.margin), border = wScale(_skin.window.border), contentOffset = wScale(_skin.window.contentOffset), }; _skin.window = _windowStyle; } var oldSkin = GUI.skin; GUI.skin = _skin; if (_compactMode) { _rect3 = GUILayout.Window(_window3Id, _rect3, DrawCompactControls, string.Empty, _compactWindowStyle); } else { _rect = GUILayout.Window(_windowId, _rect, DrawControls, "[x] Science!"); } if (!string.IsNullOrEmpty(_lastTooltip)) { _tooltipStyle = _tooltipStyle ?? new GUIStyle(_skin.window) { normal = { background = GUI.skin.window.normal.background }, wordWrap = true }; _tooltipBoxStyle = _tooltipBoxStyle ?? new GUIStyle(_skin.box) { // fontSize = wScale(11), // int left, int right, int top, int bottom padding = wScale(new RectOffset(4, 4, 4, 4)), wordWrap = true }; float boxHeight = _tooltipBoxStyle.CalcHeight(new GUIContent(_lastTooltip), wScale(190)); GUI.Window(_window2Id, new Rect(Mouse.screenPos.x + wScale(15), Mouse.screenPos.y + wScale(15), wScale(200), boxHeight + wScale(10)), x => { GUI.Box(new Rect(wScale(5), wScale(5), wScale(190), boxHeight), _lastTooltip, _tooltipBoxStyle); }, string.Empty, _tooltipStyle); } GUI.skin = oldSkin; }
internal static void CallWindowDelegate(WindowFunction func, int id, GUISkin _skin, int forceRect, float width, float height, GUIStyle style){}
protected virtual void OnInspectorGUI(HeatmapSettings settings, AnalyticsServiceItem item, System.Action onReset, GUISkin skin) { }
private void OnGUI() { #region 保存编辑器的设置 m_DefaultSkin = GUI.skin; GUI.skin = EditorDefine.S_CustomerGUISkin; #endregion // m_ScrollRect= EditorGUILayout.BeginScrollView(m_ScrollRect, false, true); EditorGUILayout.BeginVertical(); #region 版本提示 GUILayout.BeginArea(new Rect(0, 0, EditorGUIUtility.currentViewWidth, 20)); if (m_LastPreviousVersion == null) { GUI.skin.label.alignment = TextAnchor.MiddleRight; GUILayout.Label("添加第一个主版本:", GUILayout.Width(200)); m_LastPreviousVersion = new VersionInfor(); List <int> subVersion = new List <int>(); subVersion.Add(0); subVersion.Add(0); subVersion.Add(1); m_LastPreviousVersion.DefaultVersion(subVersion, 1, "第一个版本"); } if (m_NewVersion == null) { m_NewVersion = m_LastPreviousVersion; } GUILayout.EndArea(); #endregion // m_ScrollRect = GUILayout.BeginScrollView(m_ScrollRect, false, true); #region 一个版本信息 m_PreviousVersionRect = new Rect(0, 20, EditorGUIUtility.currentViewWidth, 100); GUI.DrawTexture(m_PreviousVersionRect, m_GrayImage, ScaleMode.ScaleAndCrop); GUILayout.BeginArea(m_PreviousVersionRect, new GUIContent("上一个版本的信息")); #region 整个版本号 GUILayout.BeginArea(new Rect(0, 20, EditorGUIUtility.currentViewWidth, 30)); EditorGUILayout.BeginHorizontal(GUILayout.Width(EditorGUIUtility.currentViewWidth)); GUI.skin.label.alignment = TextAnchor.MiddleRight; GUILayout.Label("上一个版本号:", GUILayout.Width(100)); GUI.skin.label.alignment = TextAnchor.MiddleLeft; GUILayout.Label(m_LastPreviousVersion.ToString(), GUILayout.ExpandWidth(true)); EditorGUILayout.EndHorizontal(); GUILayout.EndArea(); #endregion #region 主版本 GUILayout.BeginArea(new Rect(0, 50, EditorGUIUtility.currentViewWidth, 30)); EditorGUILayout.BeginHorizontal(GUILayout.Width(EditorGUIUtility.currentViewWidth)); GUI.skin.label.alignment = TextAnchor.MiddleRight; GUILayout.Label("上一个主版本:", GUILayout.Width(100)); GUI.skin.label.alignment = TextAnchor.MiddleLeft; GUILayout.Label(m_LastPreviousVersion.m_MainVersion.ToString(), GUILayout.ExpandWidth(true)); EditorGUILayout.EndHorizontal(); GUILayout.EndArea(); #endregion #region 子版本 GUILayout.BeginArea(new Rect(0, 80, EditorGUIUtility.currentViewWidth, 30)); EditorGUILayout.BeginHorizontal(); GUI.skin.label.alignment = TextAnchor.MiddleRight; GUILayout.Label("子版本:", GUILayout.Width(100)); GUI.skin.label.alignment = TextAnchor.MiddleLeft; GUILayout.Label(m_LastPreviousVersion.GetSubVersion(), GUILayout.ExpandWidth(true)); EditorGUILayout.EndHorizontal(); GUILayout.EndArea(); #endregion GUILayout.EndArea(); #endregion #region 要添加得版本 #region 编辑新版本 m_CurVersionRect = m_PreviousVersionRect.AddRect(new Rect(0, m_PreviousVersionRect.height + 50, 0, m_AddFrameWorkVersionWin.position.height - m_PreviousVersionRect.height - 400)); GUI.DrawTexture(m_CurVersionRect, m_GrayImage, ScaleMode.ScaleAndCrop); //这里需要先绘制背景图在后在绘制区域 GUILayout.BeginArea(m_CurVersionRect); EditorGUILayout.BeginVertical(); #region 主版本 EditorGUILayout.BeginHorizontal(); GUI.skin.label.alignment = TextAnchor.MiddleRight; GUILayout.Label("主版本:", GUILayout.Width(100)); GUI.skin.label.alignment = TextAnchor.MiddleLeft; m_NewVersion.m_MainVersion = int.Parse(GUILayout.TextField(m_NewVersion.m_MainVersion.ToString(), GUILayout.Width(100))); EditorGUILayout.EndHorizontal(); #endregion #region 子版本 EditorGUILayout.BeginHorizontal(); GUI.skin.label.alignment = TextAnchor.MiddleRight; GUILayout.Label("子版本:", GUILayout.Width(100)); for (int dex = 0; dex < m_NewVersion.m_SubVersion.Count; ++dex) { m_NewVersion.m_SubVersion[dex] = int.Parse(GUILayout.TextField(m_NewVersion.m_SubVersion[dex].ToString(), GUILayout.Width(50))); } EditorGUILayout.EndHorizontal(); #endregion #region 版本描述 m_VersionInforRect = m_CurVersionRect.ReduceRect(0, -300, 0, 800); m_SubScrollRect = GUILayout.BeginScrollView(m_SubScrollRect, false, true); m_NewVersion.m_OtherVersionInfor = GUILayout.TextArea(m_NewVersion.m_OtherVersionInfor.ToString(), GUILayout.Width(EditorGUIUtility.currentViewWidth), GUILayout.Height(m_VersionInforRect.height - 20)); GUILayout.EndScrollView(); #endregion #endregion GUILayout.Space(10); if (GUILayout.Button(new GUIContent("添加新版本"))) { // AddGameFramWorkVersion(); } EditorGUILayout.EndVertical(); GUILayout.EndArea(); #endregion EditorGUILayout.EndVertical(); // EditorGUILayout.EndScrollView(); #region 恢复编辑器的颜色等设置 //GUI.skin.label.fontSize = m_DefaultFontSize; //GUI.color = m_DefaultFontColor; GUI.skin = EditorDefine.S_CustomerGUISkin; #endregion }
public Styles() { this.skin = Resources.Load <GUISkin>("UI.Windows/Core/Styles/" + (EditorGUIUtility.isProSkin == true ? "SkinDark" : "SkinLight")); this.transitionA = this.skin.FindStyle("TransitionA"); this.transitionB = this.skin.FindStyle("TransitionB"); }
void OnGUI() { if (m_Styles == null) { TutorialStyles.DisplayErrorMessage("TutorialModalWindow.cs"); return; } if (m_WelcomePage == null) { return; } if (Event.current.isKey && Event.current.keyCode == KeyCode.Escape) { Close(); return; } GUISkin oldSkin = GUI.skin; GUI.skin = m_Styles.skin; using (new EditorGUILayout.VerticalScope(AllTutorialStyles.background ?? GUIStyle.none, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true))) { GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Box(m_WelcomePage.icon, GUI.skin.box, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); if (m_DrawAsCompleted) { GUILayout.BeginHorizontal(); GUILayout.Box(GUIContent.none, AllTutorialStyles.line ?? GUIStyle.none); GUILayout.Label("Completed", AllTutorialStyles.instructionLabel, GUILayout.ExpandWidth(false)); GUILayout.Box(GUIContent.none, AllTutorialStyles.line ?? GUIStyle.none); GUILayout.EndHorizontal(); } else { GUILayout.Box(GUIContent.none, AllTutorialStyles.line ?? GUIStyle.none); } GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); GUILayout.Label(m_WelcomePage.title, AllTutorialStyles.headerLabel ?? GUIStyle.none); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); var btnStyle = GUI.skin.button; btnStyle.fixedWidth = 0; btnStyle.stretchWidth = true; if (GUILayout.Button(m_DrawAsCompleted ? m_WelcomePage.finishButtonLabel : " ", btnStyle)) { Close(); } } GUI.skin = oldSkin; }
static NodeStyles() { GUISkin skin = new GUISkin(); NodeStyles.nodeStyleCache = new Dictionary <string, GUIStyle> (); NodeStyles.gridMinorColor = EditorGUIUtility.isProSkin? new Color(0f, 0f, 0f, 0.18f):new Color(0f, 0f, 0f, 0.1f); NodeStyles.gridMajorColor = EditorGUIUtility.isProSkin? new Color(0f, 0f, 0f, 0.28f):new Color(0f, 0f, 0f, 0.15f); NodeStyles.popupIcon = EditorGUIUtility.FindTexture("_popup"); NodeStyles.helpIcon = EditorGUIUtility.FindTexture("_help"); NodeStyles.errorIcon = EditorGUIUtility.FindTexture("d_console.erroricon.sml"); NodeStyles.warnIcon = EditorGUIUtility.FindTexture("console.warnicon"); NodeStyles.infoIcon = EditorGUIUtility.FindTexture("console.infoicon"); NodeStyles.toolbarPlus = EditorGUIUtility.FindTexture("Toolbar Plus"); NodeStyles.toolbarMinus = EditorGUIUtility.FindTexture("Toolbar Minus"); NodeStyles.ControlHighlight = (GUIStyle)"U2D.createRect"; NodeStyles.canvasBackground = "flow background"; NodeStyles.selectionRect = "SelectionRect"; NodeStyles.elementBackground = new GUIStyle("PopupCurveSwatchBackground") { padding = new RectOffset() }; NodeStyles.breadcrumbLeft = "GUIEditor.BreadcrumbLeft"; NodeStyles.breadcrumbMiddle = "GUIEditor.BreadcrumbMid"; NodeStyles.toggleTrigger = (GUIStyle)"Radio"; NodeStyles.dele = (GUIStyle)"OL Minus"; NodeStyles.wrappedLabel = new GUIStyle("label") { fixedHeight = 0, wordWrap = true }; NodeStyles.wrappedLabelLeft = new GUIStyle("label") { fixedHeight = 0, wordWrap = true, alignment = TextAnchor.UpperLeft }; NodeStyles.variableHeader = "flow overlay header lower left"; NodeStyles.label = "label"; NodeStyles.inspectorTitle = "IN Title"; NodeStyles.inspectorTitleText = "IN TitleText"; NodeStyles.iCodeLogo = (Texture2D)Resources.Load("ICodeLogo"); NodeStyles.stateLabelGizmo = new GUIStyle("HelpBox") { alignment = TextAnchor.UpperCenter, fontSize = 21 }; NodeStyles.centeredLabel = new GUIStyle("Label") { alignment = TextAnchor.UpperCenter, }; NodeStyles.instructionLabel = new GUIStyle("TL Transition H2") { padding = new RectOffset(3, 3, 3, 3), contentOffset = NodeStyles.wrappedLabel.contentOffset, alignment = TextAnchor.UpperLeft, fixedHeight = 0, wordWrap = true }; NodeStyles.shortcutLabel = new GUIStyle("ObjectPickerLargeStatus") { padding = new RectOffset(3, 3, 3, 3), alignment = TextAnchor.UpperLeft }; NodeStyles.browserPopup = new GUIStyle("label") { contentOffset = new Vector2(0, 2) }; NodeStyles.fsmColor = (int)NodeColor.Blue; NodeStyles.startNodeColor = (int)NodeColor.Orange; NodeStyles.anyStateColor = (int)NodeColor.Aqua; NodeStyles.defaultNodeColor = (int)NodeColor.Grey; }
public static float Draw(GUIContent label, float value, float minimumValue, float maximumValue, GUISkin skin) { return(Draw(label, value, minimumValue, maximumValue, skin, false, false, 100)); }
void OnGUI() { GUISkin tempSkin = GUI.skin; if (guiSkin != null) { GUI.skin = guiSkin; } if (state == State.Show) { //GUI.DrawTexture(Rect(Screen.width * x, Screen.height * y, Screen.width * width, Screen.height * height), dialogBG, ScaleMode.ScaleToFit, false, 0); //GUI.DrawTexture(Rect(Screen.width * 0.18, Screen.height * 0.28, Screen.width * 0.64, Screen.height * 0.44), dialogBg); if (dialogBG != null) { GUI.DrawTexture(new Rect(Screen.width * x, Screen.height * y, Screen.width * width, Screen.height * height), dialogBG); } if (titleBG != null) { GUI.DrawTexture(new Rect(Screen.width * titleX, Screen.height * titleY, Screen.width * titleWidth, Screen.height * titleHeight), titleBG); } if (title != null && title != "") { if (titleFont != null) { GUI.skin.font = titleFont; } GUI.Label(new Rect(Screen.width * (titleX + padding), Screen.height * (titleY + titlePadding), Screen.width * (titleWidth - padding * 2), Screen.height * (titleHeight - titlePadding * 2)), title); } if (texts != null && texts.Length != 0) { if (textFont != null) { GUI.skin.font = textFont; } GUI.Label(new Rect(Screen.width * bodyX, Screen.height * bodyY, Screen.width * bodyWidth, Screen.height * bodyHeight), texts[index]); if (index == texts.Length - 1) { if (titleFont != null) { GUI.skin.font = titleFont; } if (GUI.Button(new Rect(Screen.width * midX, Screen.height * btnY, Screen.width * btnWidth, Screen.height * btnHeight), "关闭")) { hide(); } } else { if (index < texts.Length - 1) { if (titleFont != null) { GUI.skin.font = titleFont; } if (GUI.Button(new Rect(Screen.width * leftX, Screen.height * btnY, Screen.width * btnWidth, Screen.height * btnHeight), "关闭")) { hide(); } if (GUI.Button(new Rect(Screen.width * rightX, Screen.height * btnY, Screen.width * btnWidth, Screen.height * btnHeight), "下一页")) { index++; } } } } else { if (titleFont != null) { GUI.skin.font = titleFont; } if (GUI.Button(new Rect(Screen.width * midX, Screen.height * btnY, Screen.width * btnWidth, Screen.height * btnHeight), "关闭")) { hide(); } } } GUI.skin = tempSkin; }
public static float Draw(GUIContent label, float value, float minimumValue, float maximumValue, GUISkin skin, bool showValue, bool sliderOnRight, float sliderWidth) { float _fieldValue = 0; using (new GUILayout.HorizontalScope(skin.FindStyle("FieldValue"))) { EditorGUILayout.LabelField(label, skin.FindStyle("SliderLabel"), GUILayout.Width(skin.FindStyle("SliderLabel").CalcSize(label).x)); if (sliderOnRight) { GUILayout.FlexibleSpace(); } else { GUILayout.Space(20); } using (new GUILayout.HorizontalScope()) { GUILayout.Label(minimumValue.ToString(), skin.FindStyle("SliderValues")); _fieldValue = GUILayout.HorizontalSlider(value, minimumValue, maximumValue, GUILayout.Width(sliderWidth)); GUILayout.Label(maximumValue.ToString(), skin.FindStyle("SliderValues")); _fieldValue = (float)System.Math.Round(_fieldValue, 2); if (showValue) { GUIContent valueContent = new GUIContent(_fieldValue.ToString()); EditorGUILayout.LabelField(valueContent, skin.FindStyle("SliderLabel"), GUILayout.Width(skin.FindStyle("SliderLabel").CalcSize(valueContent).x)); } } if (!sliderOnRight) { GUILayout.FlexibleSpace(); GUILayout.Space(10); } else { GUILayout.Space(10); } } return(_fieldValue); }
protected override void DoInspectorGUI(ScriptableObject settings, ServiceItem item, System.Action onReset, GUISkin skin) { this.OnInspectorGUI(settings as GameDataSettings, item as GameDataServiceItem, onReset, skin); }
public WindowHeaderResources(GUISkin controls, GUISkin layout) { Group = layout.GetStyle("Window header"); ButtonStyle = controls.GetStyle("Window header button"); SearchBoxStyle = controls.GetStyle("Window header search box"); }
public DwarfGUI(DwarfGame game, SpriteFont defaultFont, SpriteFont titleFont, SpriteFont smallFont, InputManager input) { EnableMouseEvents = true; IsMouseVisible = true; MouseMode = GUISkin.MousePointer.Pointer; SmallFont = smallFont; Graphics = game.GraphicsDevice; this.game = game; RootComponent = new GUIComponent(this, null) { LocalBounds = new Rectangle(0, 0, 0, 0) }; DefaultFont = defaultFont; Skin = new GUISkin(TextureManager.GetTexture(ContentPaths.GUI.gui_widgets), 32, 32, TextureManager.GetTexture(ContentPaths.GUI.pointers), 16, 16); Skin.SetDefaults(); TitleFont = titleFont; GlobalOffset = Vector2.Zero; FocusComponent = null; Input = input; DrawAfter = new List<GUIComponent>(); DefaultTextColor = new Color(48, 27, 0); DefaultStrokeColor = Color.Transparent; DebugDraw = false; ToolTipManager = new ToolTipManager(this); LastScrollWheel = 0; }
void Start() { skin = Resources.Load("GUISkin2") as GUISkin; skin1 = Resources.Load("GUISkin3") as GUISkin; }
void OnGUI() { Vector2 mousePosition = new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y); if (GameController.Instance.Calculating) { GUILayout.Label("Calculating..."); } GUISkin current = GUI.skin; GUI.skin = GameSkin; Vector2 size; Color currentColor = GUI.color; GUI.color = Color.green; size = GUI.skin.label.CalcSize(new GUIContent("WHITE'S TURN!")); _pOneTurnRect.width = size.x; _pOneTurnRect.height = size.y; if (GameController.Instance.WhitesMove) { GUI.Label(_pOneTurnRect, "WHITE'S TURN!"); } size = GUI.skin.label.CalcSize(new GUIContent("BLACK'S TURN!")); _pTwoTurnRect.width = size.x; _pTwoTurnRect.height = size.y; if (GameController.Instance.BlacksMove) { GUI.Label(_pTwoTurnRect, "BLACK'S TURN!"); } size = GUI.skin.label.CalcSize(new GUIContent("WHITE")); _playerOneRect.width = _pOneTurnRect.width; _playerOneRect.height = size.y; GUI.Label(_playerOneRect, "WHITE"); size = GUI.skin.label.CalcSize(new GUIContent("BLACK")); _playerTwoRect.width = _pTwoTurnRect.width; _playerTwoRect.height = size.y; GUI.Label(_playerTwoRect, "BLACK"); GUI.color = currentColor; size = GUI.skin.label.CalcSize(new GUIContent(GameController.Instance.WhiteScore.ToString())); _pOneScoreRect.width = _pOneTurnRect.width; _pOneScoreRect.height = size.y; GUI.Label(_pOneScoreRect, GameController.Instance.WhiteScore.ToString()); size = GUI.skin.label.CalcSize(new GUIContent(GameController.Instance.BlackScore.ToString())); _pTwoScoreRect.width = _pTwoTurnRect.width; _pTwoScoreRect.height = size.y; GUI.Label(_pTwoScoreRect, GameController.Instance.BlackScore.ToString()); size = GUI.skin.label.CalcSize(new GUIContent("BACK TO MENU")); _quitRect.width = size.x; _quitRect.height = size.y; _quitRect.y = Screen.height - 10 - size.y; if (GameController.Instance.Calculating) { GUI.color = new Color(0.25f, 0.25f, 0.25f, 1); GUI.Label(_quitRect, "BACK TO MENU"); } else if (_quitRect.Contains(mousePosition)) { GUI.color = Color.green; GUI.Label(_quitRect, "BACK TO MENU"); if (GUI.Button(_quitRect, "", "Label")) { Application.LoadLevel("scene_start"); } } else { GUI.Label(_quitRect, "BACK TO MENU"); } GUI.color = currentColor; if (GameController.Instance.GameOver) { GUI.DrawTexture(_gameOverRect, _gameOverTexture); } GUI.skin = current; }
void OnGUI() { //Force the GUI color to always be white, so the tutorial window //will not be darkened while in playmode GUI.color = Color.white; GUISkin oldSkin = GUI.skin; GUI.skin = styles.skin; if (m_AuthoringMode) { ToolbarGUI(); } if (styles == null) { TutorialStyles.DisplayErrorMessage("TutorialWindow.cs"); return; } if (m_CurrentTutorial == null) { EditorGUILayout.HelpBox("No tutorial currently loaded. Please load one to begin.", MessageType.Info); return; } //Might be used later if a completed page is desired /*if (m_CurrentTutorial.IsCompletedPageShowing) * { * DrawCompletedPage(); * }*/ var useGrayBackground = m_CurrentTutorial.currentPage != null && m_CurrentTutorial.currentPage.paragraphs.All(element => element.type == ParagraphType.Narrative); using (var background = new EditorGUILayout.VerticalScope(useGrayBackground ? AllTutorialStyles.fullGreyBackground : AllTutorialStyles.background ?? GUIStyle.none, GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true))) { TopBar(); if (m_CurrentTutorial.currentPage == null) { GUILayout.Label(string.Format("No step {0} assigned for {1}.", m_CurrentTutorial.currentPageIndex, m_CurrentTutorial)); } else { // disable GUI except scrollbar/toolbar/gutter when revisiting a previously completed page to clearly indicate its tasks are no longer active var pageCompleted = m_CurrentTutorial.currentPageIndex <= m_FarthestPageCompleted; if (!string.IsNullOrEmpty(m_CurrentTutorial.currentPage.sectionTitle)) { using (var bg = new EditorGUILayout.HorizontalScope(AllTutorialStyles.sectionTitleBackground, GUILayout.ExpandWidth(true))) { using (new EditorGUI.DisabledScope(pageCompleted)) GUILayout.Label(m_CurrentTutorial.currentPage.sectionTitle, AllTutorialStyles.sectionTitleLabel); } } var previousTaskState = true; using (var scrollView = new EditorGUILayout.ScrollViewScope(m_ScrollPosition, GUIStyle.none, GUI.skin.verticalScrollbar)) { using (new EditorGUI.DisabledScope(pageCompleted)) { foreach (var paragraph in m_Paragraphs) { if (paragraph.paragraph.type == ParagraphType.Instruction) { GUILayout.Space(2f); } paragraph.Draw(ref previousTaskState, pageCompleted); } } m_ScrollPosition = scrollView.scrollPosition; GUILayout.FlexibleSpace(); } GutterGUI(m_CurrentTutorial.currentPageIndex, m_CurrentTutorial.pageCount, background.rect); } } GUI.skin = oldSkin; }
public abstract GUIStyle getGUIStyle(GUISkin skin);
private static GUISkin BuildPanelSkin() { GUISkin theSkin = Instantiate(HighLogic.Skin); // Use Instantiate to make a copy of the Skin Object // Now alter the parts of theSkin that we want to change: // theSkin.window = new GUIStyle(HighLogic.Skin.window); theSkin.box.fontSize = 11; theSkin.box.padding = new RectOffset(5, 3, 3, 5); theSkin.box.margin = new RectOffset(1, 1, 1, 1); theSkin.label.fontSize = 11; theSkin.textField.fontSize = 11; theSkin.textField.padding = new RectOffset(0, 0, 0, 0); theSkin.textField.margin = new RectOffset(1, 1, 1, 1); theSkin.textArea.fontSize = 11; theSkin.textArea.padding = new RectOffset(0, 0, 0, 0); theSkin.textArea.margin = new RectOffset(1, 1, 1, 1); theSkin.toggle.fontSize = 10; theSkin.button.fontSize = 11; // And these are new styles for our own use in special cases: // headingLabelStyle = new GUIStyle(theSkin.label) { fontSize = 13, padding = new RectOffset(2, 2, 2, 2) }; vesselNameStyle = new GUIStyle(theSkin.box) { fontSize = 12, normal = { textColor = Color.white } }; tooltipLabelStyle = new GUIStyle(theSkin.label) { fontSize = 11, padding = new RectOffset(0, 2, 0, 2), normal = { textColor = Color.white }, wordWrap = false }; smallLabelStyle = new GUIStyle(theSkin.label) { fontSize = 11, padding = new RectOffset(0, 2, 0, 2), normal = { textColor = Color.white }, wordWrap = true }; partNameStyle = new GUIStyle(theSkin.box) { hover = { textColor = new Color(0.6f, 1.0f, 1.0f) } }; boxOnStyle = new GUIStyle(theSkin.box) { hover = { textColor = new Color(0.6f, 1.0f, 1.0f) }, normal = { textColor = new Color(0.4f, 1.0f, 0.4f) } // brighter green, higher saturation. }; boxOffStyle = new GUIStyle(theSkin.box) { hover = { textColor = new Color(0.6f, 1.0f, 1.0f) }, normal = { textColor = new Color(0.6f, 0.7f, 0.6f) } // dimmer green, more washed out and grey. }; boxDisabledStyle = new GUIStyle(theSkin.box) { hover = { textColor = new Color(0.6f, 1.0f, 1.0f) }, normal = { textColor = Color.white } }; return(theSkin); }
public override void OnPreTargetMembersGUI(GUISkin skin) { var disabledPairs = Manager.DisabledPairs; bool clearPressed = false; bool addPressed = false; CollisionGroupEntryPair erasePair = null; GUILayout.Label(GUI.MakeLabel("Collision Groups Manager", 18, true), new GUIStyle(skin.label) { alignment = TextAnchor.MiddleCenter }); GUI.Separator3D(); GUILayout.Label(GUI.MakeLabel("Add pair", true), new GUIStyle(skin.label) { alignment = TextAnchor.MiddleCenter }); GUILayout.BeginVertical(skin.textArea); { HandleCollisionGroupEntryPair(m_groupEntryPairToAdd, skin); GUILayout.BeginHorizontal(); { GUILayout.FlexibleSpace(); UnityEngine.GUI.enabled = m_groupEntryPairToAdd.First.Tag.Length > 0 || m_groupEntryPairToAdd.Second.Tag.Length > 0; GUILayout.BeginVertical(); { GUILayout.Space(8); using (new GUI.ColorBlock(Color.Lerp(UnityEngine.GUI.color, Color.red, 0.1f))) clearPressed = GUILayout.Button(GUI.MakeLabel("Clear"), skin.button, GUILayout.Width(64), GUILayout.Height(16)); } GUILayout.EndVertical(); UnityEngine.GUI.enabled = m_groupEntryPairToAdd.First.Tag.Length > 0 && m_groupEntryPairToAdd.Second.Tag.Length > 0; using (new GUI.ColorBlock(Color.Lerp(UnityEngine.GUI.color, Color.green, 0.1f))) addPressed = GUILayout.Button(GUI.MakeLabel("Add", false, "Add pair to disabled pairs."), skin.button, GUILayout.Width(64), GUILayout.Height(22)); UnityEngine.GUI.enabled = true; } GUILayout.EndHorizontal(); } GUILayout.EndVertical(); GUI.Separator3D(); if (GUI.Foldout(FoldoutDataEntry, GUI.MakeLabel("Disabled Pairs [" + disabledPairs.Length + "]"), skin)) { using (new GUI.Indent(12)) { foreach (var disabledPair in disabledPairs) { GUILayout.BeginHorizontal(); { GUI.Separator(1, 10); using (new GUI.ColorBlock(Color.Lerp(UnityEngine.GUI.color, Color.red, 0.1f))) if (GUILayout.Button(GUI.MakeLabel(GUI.Symbols.ListEraseElement.ToString()), skin.button, GUILayout.Width(18), GUILayout.Height(14))) { erasePair = disabledPair; } } GUILayout.EndHorizontal(); HandleCollisionGroupEntryPair(disabledPair, skin); } } } GUI.Separator3D(); if (clearPressed) { m_groupEntryPairToAdd.First.Tag = m_groupEntryPairToAdd.Second.Tag = string.Empty; } if (addPressed) { Manager.SetEnablePair(m_groupEntryPairToAdd.First.Tag, m_groupEntryPairToAdd.Second.Tag, false); m_groupEntryPairToAdd.First.Tag = m_groupEntryPairToAdd.Second.Tag = string.Empty; FoldoutDataEntry.Bool = true; } if (erasePair != null) { if (EditorUtility.DisplayDialog("Remove pair", "Erase disabled pair: " + erasePair.First.Tag + " and " + erasePair.Second.Tag + "?", "Yes", "No")) { Manager.SetEnablePair(erasePair.First.Tag, erasePair.Second.Tag, true); } } }
public void OnGUI() { if (!guiInitialized) { GUISkin t_skin = EditorGUIUtility.GetBuiltinSkin(EditorGUIUtility.isProSkin ? EditorSkin.Scene : EditorSkin.Inspector); pbStyle.padding = new RectOffset(2, 2, 1, 1); pbStyle.border = new RectOffset(6, 6, 4, 4); pbStyle.normal.background = t_skin.GetStyle("Button").normal.background; pbStyle.margin = new RectOffset(4, 2, 2, 2); pbStyle.contentOffset = new Vector2(0, 0); } if (!EditorGUIUtility.isProSkin) { oldColor = GUI.backgroundColor; GUI.backgroundColor = pgButtonColor; } EditorGUI.BeginChangeCheck(); t_snapValue = EditorGUILayout.FloatField("", t_snapValue, GUILayout.MinWidth(BUTTON_SIZE), GUILayout.MaxWidth(BUTTON_SIZE)); if (EditorGUI.EndChangeCheck()) { #if PRO // If user sets new snap value, make the default multiplier 100 again. SetSnapValue(snapUnit, t_snapValue, 100); #endif } gc_SnapEnabled.image = snapEnabled ? gui_SnapEnabled_on : gui_SnapEnabled_off; if (GUILayout.Button(gc_SnapEnabled, pbStyle, GUILayout.MaxWidth(BUTTON_SIZE))) { SetSnapEnabled(!snapEnabled); } gc_GridEnabled.image = drawGrid ? gui_GridEnabled_on : gui_GridEnabled_off; if (GUILayout.Button(gc_GridEnabled, pbStyle, GUILayout.MaxWidth(BUTTON_SIZE))) { SetGridEnabled(!drawGrid); } // if(!ortho) GUI.enabled = false; gc_AngleEnabled.image = drawAngles ? gui_AngleEnabled_on : gui_AngleEnabled_off; if (GUILayout.Button(gc_AngleEnabled, pbStyle, GUILayout.MaxWidth(BUTTON_SIZE))) { SetDrawAngles(!drawAngles); } EditorGUI.BeginChangeCheck(); angleValue = EditorGUILayout.FloatField(gc_AngleValue, angleValue, GUILayout.MinWidth(BUTTON_SIZE), GUILayout.MaxWidth(BUTTON_SIZE)); if (EditorGUI.EndChangeCheck()) { SceneView.RepaintAll(); } // GUI.enabled = true; if (GUILayout.Button(gc_SnapToGrid, pbStyle, GUILayout.MaxWidth(BUTTON_SIZE))) //, GUILayout.MaxWidth(50), GUILayout.MinHeight(16))) { SnapToGrid(Selection.transforms); } GUILayout.Label(gui_Divider, GUILayout.MaxWidth(BUTTON_SIZE)); gc_RenderPlaneX.image = (renderPlane & Axis.X) == Axis.X && !fullGrid ? gui_PlaneX_on : gui_PlaneX_off; if (GUILayout.Button(gc_RenderPlaneX, pbStyle, GUILayout.MaxWidth(BUTTON_SIZE))) { SetRenderPlane(Axis.X); } gc_RenderPlaneY.image = (renderPlane & Axis.Y) == Axis.Y && !fullGrid ? gui_PlaneY_on : gui_PlaneY_off; if (GUILayout.Button(gc_RenderPlaneY, pbStyle, GUILayout.MaxWidth(BUTTON_SIZE))) { SetRenderPlane(Axis.Y); } gc_RenderPlaneZ.image = (renderPlane & Axis.Z) == Axis.Z && !fullGrid ? gui_PlaneZ_on : gui_PlaneZ_off; if (GUILayout.Button(gc_RenderPlaneZ, pbStyle, GUILayout.MaxWidth(BUTTON_SIZE))) { SetRenderPlane(Axis.Z); } gc_RenderPerspectiveGrid.image = fullGrid ? gui_fullGrid_on : gui_fullGrid_off; if (GUILayout.Button(gc_RenderPerspectiveGrid, pbStyle, GUILayout.MaxWidth(BUTTON_SIZE))) { fullGrid = !fullGrid; gridRepaint = true; EditorPrefs.SetBool(pg_Constant.PerspGrid, fullGrid); SceneView.RepaintAll(); } gc_LockGrid.image = lockGrid ? gui_LockGrid_on : gui_LockGrid_off; if (GUILayout.Button(gc_LockGrid, pbStyle, GUILayout.MaxWidth(BUTTON_SIZE))) { lockGrid = !lockGrid; EditorPrefs.SetBool(pg_Constant.LockGrid, lockGrid); EditorPrefs.SetString(pg_Constant.LockedGridPivot, pivot.ToString()); // if we've modified the nudge value, reset the pivot here if (!lockGrid) { offset = 0f; } gridRepaint = true; SceneView.RepaintAll(); } #if PROFILE_TIMES if (GUILayout.Button("Times")) { profiler.DumpTimes(); } if (GUILayout.Button("Reset")) { profiler.ClearValues(); } #endif if (!EditorGUIUtility.isProSkin) { GUI.backgroundColor = oldColor; } }
void OnGUI() { if (_components.Count == 0) { return; } int prevDepth = GUI.depth; GUI.depth = _depth; GUISkin prevSkin = GUI.skin; GUI.skin = _skin; if (_showExplorer) { GUILayout.BeginHorizontal(); GUILayout.BeginVertical("box", GUILayout.MinWidth(250), GUILayout.MaxHeight(150)); if (GUILayout.Button("Select DeckLink Object")) { _currDeckLink = null; } _lastScrollPos = GUILayout.BeginScrollView(_lastScrollPos); foreach (DeckLink component in _components) { if (component == _currDeckLink) { GUI.color = Color.green; } if (GUILayout.Button(component.gameObject.name)) { _currDeckLink = component; } GUI.color = Color.white; } GUILayout.EndScrollView(); GUILayout.EndVertical(); if (_currDeckLink != null) { _currDeckLink.RenderExplorer(); } if (GUILayout.Button("x", GUILayout.MaxWidth(20))) { _showExplorer = false; _maxButtonTime = 0f; } GUILayout.EndHorizontal(); } else { if (_maxButtonTime < _showMaxButtonTime) { if (GUILayout.Button("Explorer", GUILayout.Width(100))) { _showExplorer = true; } } } GUI.skin = prevSkin; GUI.depth = prevDepth; }
void InitGUISkin() { string guiSkinToUse = BuildReportTool.Window.Settings.DEFAULT_GUI_SKIN_FILENAME; if (EditorGUIUtility.isProSkin) { guiSkinToUse = BuildReportTool.Window.Settings.DARK_GUI_SKIN_FILENAME; } // try default path _usedSkin = AssetDatabase.LoadAssetAtPath(BuildReportTool.Options.BUILD_REPORT_TOOL_DEFAULT_PATH + "/GUI/" + guiSkinToUse, typeof(GUISkin)) as GUISkin; if (_usedSkin == null) { #if BRT_SHOW_MINOR_WARNINGS Debug.LogWarning(BuildReportTool.Options.BUILD_REPORT_PACKAGE_MOVED_MSG); #endif string folderPath = BuildReportTool.Util.FindAssetFolder(Application.dataPath, BuildReportTool.Options.BUILD_REPORT_TOOL_DEFAULT_FOLDER_NAME); if (!string.IsNullOrEmpty(folderPath)) { folderPath = folderPath.Replace('\\', '/'); int assetsIdx = folderPath.IndexOf("/Assets/"); if (assetsIdx != -1) { folderPath = folderPath.Substring(assetsIdx + 8, folderPath.Length - assetsIdx - 8); } //Debug.Log(folderPath); _usedSkin = AssetDatabase.LoadAssetAtPath("Assets/" + folderPath + "/GUI/" + guiSkinToUse, typeof(GUISkin)) as GUISkin; } else { Debug.LogError(BuildReportTool.Options.BUILD_REPORT_PACKAGE_MISSING_MSG); } //Debug.Log("_usedSkin " + (_usedSkin != null)); } if (_usedSkin != null) { if (!EditorGUIUtility.isProSkin) { GUISkin nativeSkin = EditorGUIUtility.GetBuiltinSkin(EditorSkin.Inspector); _usedSkin.verticalScrollbar = nativeSkin.verticalScrollbar; _usedSkin.verticalScrollbarThumb = nativeSkin.verticalScrollbarThumb; _usedSkin.verticalScrollbarUpButton = nativeSkin.verticalScrollbarUpButton; _usedSkin.verticalScrollbarDownButton = nativeSkin.verticalScrollbarDownButton; _usedSkin.horizontalScrollbar = nativeSkin.horizontalScrollbar; _usedSkin.horizontalScrollbarThumb = nativeSkin.horizontalScrollbarThumb; _usedSkin.horizontalScrollbarLeftButton = nativeSkin.horizontalScrollbarLeftButton; _usedSkin.horizontalScrollbarRightButton = nativeSkin.horizontalScrollbarRightButton; // change the toggle skin to use the Unity builtin look, but keep our settings GUIStyle toggleSaved = new GUIStyle(_usedSkin.toggle); // make our own copy of the native skin toggle so that editing it won't affect the rest of the editor GUI GUIStyle nativeToggleCopy = new GUIStyle(nativeSkin.toggle); _usedSkin.toggle = nativeToggleCopy; _usedSkin.toggle.border = toggleSaved.border; _usedSkin.toggle.margin = toggleSaved.margin; _usedSkin.toggle.padding = toggleSaved.padding; _usedSkin.toggle.overflow = toggleSaved.overflow; _usedSkin.toggle.contentOffset = toggleSaved.contentOffset; _usedSkin.box = nativeSkin.box; _usedSkin.label = nativeSkin.label; _usedSkin.textField = nativeSkin.textField; _usedSkin.button = nativeSkin.button; _usedSkin.label.wordWrap = true; } // ---------------------------------------------------- _toolbarIconLog = _usedSkin.GetStyle("Icon-Toolbar-Log").normal.background; _toolbarIconOpen = _usedSkin.GetStyle("Icon-Toolbar-Open").normal.background; _toolbarIconSave = _usedSkin.GetStyle("Icon-Toolbar-Save").normal.background; _toolbarIconOptions = _usedSkin.GetStyle("Icon-Toolbar-Options").normal.background; _toolbarIconHelp = _usedSkin.GetStyle("Icon-Toolbar-Help").normal.background; _toolbarLabelLog = new GUIContent(Labels.REFRESH_LABEL, _toolbarIconLog); _toolbarLabelOpen = new GUIContent(Labels.OPEN_LABEL, _toolbarIconOpen); _toolbarLabelSave = new GUIContent(Labels.SAVE_LABEL, _toolbarIconSave); _toolbarLabelOptions = new GUIContent(Labels.OPTIONS_CATEGORY_LABEL, _toolbarIconOptions); _toolbarLabelHelp = new GUIContent(Labels.HELP_CATEGORY_LABEL, _toolbarIconHelp); } }
void Awake() { this.character = GameObject.Find("CharacterModel"); this.loadingImage = Resources.Load<Texture>("Sprites/SplashImages/LoadingImage"); this.incr = Random.Range(-0.02f, 0.02f); this.incg = Random.Range(-0.02f, 0.02f); this.incb = Random.Range(-0.02f, 0.02f); this.manager = GetComponent<NetworkManager>(); this.skin = Resources.Load<GUISkin>("Sprites/GUIskin/skin"); this.skin.GetStyle("chat").fontSize = (int)(Screen.height * 0.025f); this.skin.GetStyle("chat").alignment = TextAnchor.MiddleCenter; this.skin.GetStyle("chat").fontStyle = FontStyle.Bold; this.skin.textField.fontSize = (int)(Screen.height * 0.025f); this.skin.textField.fontStyle = FontStyle.Bold; this.skin.GetStyle("button").fontSize = (int)(Screen.height * 0.025f); this.posX = (int)(Screen.width / 2.6f); this.posY = (int)(Screen.height / 2.5f); this.width = Screen.width / 4; this.height = Screen.height / 30; this.spacing = this.height * 2; this.playerName = PlayerPrefs.GetString("PlayerName", ""); SystemLanguage langue = PlayerPrefs.GetInt("langue", 1) == 1 ? SystemLanguage.English : SystemLanguage.French; this.categoryCloth = CategoryCloth.None; Text.SetLanguage(langue); this.firstScene = GameObject.Find("Map").GetComponent<FirstScene>(); if (!Directory.Exists(Application.dataPath + "/Saves")) Directory.CreateDirectory(Application.dataPath + "/Saves"); this.skin.GetStyle("loading").normal.textColor = Color.black; try { string skintStr = PlayerPrefs.GetString("Skin", ""); this.skinCharacter = Skin.Load(skintStr); this.skinCharacter.ForceApply(this.character); } catch { this.characterShown = true; this.skinCharacter = new Skin(Clothing.NormalBrownBeard, Clothing.NormalBrownHair, Clothing.NoneHat, Clothing.BasicBody, Clothing.NoneTshirt, Clothing.BrownOveralls, Clothing.BrownGloves, Clothing.BlackEye); this.skinCharacter.ForceApply(this.character); } }
void Start() { newSkin = Resources.Load("Menu Skin") as GUISkin; }
public static bool Init() { // Textures Background = ResourceManager.LoadTexture("Textures/background.png"); AALineTex = ResourceManager.LoadTexture("Textures/AALine.png"); switch (state) { case NodeEditorState.Mission: GUIBox = ResourceManager.LoadTexture("Textures/NE_MissionCanvasBox.png"); NE_LightColor = new Color(0.0f, 0.4f, 0.0f); NE_TextColor = new Color(0.0f, 0.8f, 0.0f); break; case NodeEditorState.Dialogue: GUIBox = ResourceManager.LoadTexture("Textures/NE_DialogueCanvasBox.png"); NE_LightColor = new Color(0.0f, 0.4f, 0.4f); NE_TextColor = new Color(0.0f, 0.8f, 0.8f); break; case NodeEditorState.Sector: GUIBox = ResourceManager.LoadTexture("Textures/NE_SectorCanvasBox.png"); NE_LightColor = new Color(0.8f, 0.4f, 0.0f); NE_TextColor = new Color(1.0f, 0.6f, 0.1f); break; } 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"); 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(3, 3, 3, 3); toolbar.margin = new RectOffset(0, 0, 0, 0); toolbar.padding = new RectOffset(0, 0, 0, 0); toolbarLabel = new GUIStyle(nodeSkin.box); toolbarLabel.normal.background = GUIToolbarButton; toolbarLabel.border = new RectOffset(3, 3, 3, 3); toolbarLabel.margin = new RectOffset(0, 0, 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); }
void OnGUI() { if (!skin) { skin = Resources.Load("skin") as GUISkin; } GUI.skin = skin; this.minSize = rect; this.titleContent = new GUIContent("Character", null, "Third Person Character Creator"); GUILayout.BeginVertical("Character Creator Window", "window"); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); GUILayout.BeginVertical("box"); if (!charObj) { EditorGUILayout.HelpBox("Make sure your FBX model is set as Humanoid!", MessageType.Info); } else if (!charExist) { EditorGUILayout.HelpBox("Missing a Animator Component", MessageType.Error); } else if (!isHuman) { EditorGUILayout.HelpBox("This is not a Humanoid", MessageType.Error); } else if (!isValidAvatar) { EditorGUILayout.HelpBox(charObj.name + " is a invalid Humanoid", MessageType.Info); } charObj = EditorGUILayout.ObjectField("FBX Model", charObj, typeof(GameObject), true, GUILayout.ExpandWidth(true)) as GameObject; if (GUI.changed && charObj != null && charObj.GetComponent <vThirdPersonController>() == null) { humanoidpreview = Editor.CreateEditor(charObj); } if (charObj != null && charObj.GetComponent <vThirdPersonController>() != null) { EditorGUILayout.HelpBox("This gameObject already contains the component vThirdPersonController", MessageType.Warning); } controller = EditorGUILayout.ObjectField("Animator Controller: ", controller, typeof(RuntimeAnimatorController), false) as RuntimeAnimatorController; GUILayout.EndVertical(); GUILayout.BeginHorizontal("box"); EditorGUILayout.LabelField("Need to know how it works?"); if (GUILayout.Button("Video Tutorial")) { Application.OpenURL("https://www.youtube.com/watch?v=KQ5xha36tfE&index=1&list=PLvgXGzhT_qehtuCYl2oyL-LrWoT7fhg9d"); } GUILayout.EndHorizontal(); if (charObj) { charAnimator = charObj.GetComponent <Animator>(); } charExist = charAnimator != null; isHuman = charExist ? charAnimator.isHuman : false; isValidAvatar = charExist ? charAnimator.avatar.isValid : false; if (CanCreate()) { DrawHumanoidPreview(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (controller != null) { if (GUILayout.Button("Create")) { Create(); } } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); } GUILayout.EndVertical(); }
static void setSkinTransparency(int alpha, GUISkin skin) { foreach (GUIDefaultColor i in Enum.GetValues(typeof(GUIDefaultColor))) { Color c = skin.GetColor(i); c.Alpha = alpha; skin.SetColor(c, i); } }
public override bool DoDialog() { bool result = false; GUISkin skin = GUI.skin; GUI.skin = GUISkinFinder.Instance.GetGUISkin(); DoTitle(); DoBoard(); DoPrizes(); DoTcStatus(); DoMoney(); DoStroking(); DoTooltip(); DoFlying(); DoRareFx(); noConfirm = GUI.Toggle(crdNoConfirm, noConfirm, StringMgr.Instance.Get("DONT_ASK_GAMBLE")); bool enabled = GUI.enabled; GUI.enabled = (resetStep == RESET_STEP.NONE && tcStatus != null && 0 < MyInfoManager.Instance.FreeCoin && 0 <= curTicket && curTicket < tcBoard.Count && tcBoard[curTicket] > 0 && tcStatus.CoinPrice != 0); if (GlobalVars.Instance.MyButton(crdFreeBtn, StringMgr.Instance.Get("FREE"), "BtnAction")) { if (noConfirm) { CSNetManager.Instance.Sock.SendCS_TC_OPEN_PRIZE_TAG_REQ(tcStatus.Seq, curTicket, freeCoin: true); } else { areYouSure = (RandomBoxSureDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.RANDOMBOX_SURE, exclusive: false); if (areYouSure != null) { areYouSure.InitDialog(tcStatus.Seq, curTicket, 0); } } } GUI.enabled = (resetStep == RESET_STEP.NONE && tcStatus != null && tcStatus.TokenPrice <= MyInfoManager.Instance.Cash && 0 <= curTicket && curTicket < tcBoard.Count && tcBoard[curTicket] > 0 && tcStatus.TokenPrice != 0); if (GlobalVars.Instance.MyButton(crdTokenBtn, TokenManager.Instance.GetTokenString(), "BtnAction")) { if (noConfirm) { CSNetManager.Instance.Sock.SendCS_TC_OPEN_PRIZE_TAG_REQ(tcStatus.Seq, curTicket, freeCoin: false); } else { areYouSure = (RandomBoxSureDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.RANDOMBOX_SURE, exclusive: false); if (areYouSure != null) { areYouSure.InitDialog(tcStatus.Seq, curTicket, tcStatus.TokenPrice); } } } GUI.enabled = enabled; if (GlobalVars.Instance.MyButton(crdX, string.Empty, "BtnClose")) { result = true; } if (GlobalVars.Instance.MyButton(crdBack, string.Empty, "BtnBack") || (!DialogManager.Instance.IsPopup(DialogManager.DIALOG_INDEX.RANDOMBOX_SURE) && GlobalVars.Instance.IsEscapePressed())) { CSNetManager.Instance.Sock.SendCS_TC_LEAVE_REQ(); ((TCGateDialog)DialogManager.Instance.Popup(DialogManager.DIALOG_INDEX.TCGATE, exclusive: true))?.InitDialog(); } if (!ContextMenuManager.Instance.IsPopup) { WindowUtil.EatEvent(); } GUI.skin = skin; return(result); }
protected virtual void OnInspectorGUI(ABTestingSettings settings, ABTestingServiceItem item, System.Action onReset, GUISkin skin) { }
public override void UpdateNodeGUI(Event e, Rect viewRect, GUISkin viewSkin) => base.UpdateNodeGUI(e, viewRect, viewSkin);
private static Rect INTERNAL_CALL_DoWindow(int id, ref Rect clientRect, WindowFunction func, GUIContent title, GUIStyle style, GUISkin skin, bool forceRectOnLayout){}
private static void UpdateSkin() { skin = null; skin = GetSkin(); }
protected virtual void OnInspectorGUI(GameDataSettings settings, GameDataServiceItem item, System.Action onReset, GUISkin skin) { }
void Start() { Lock = Resources.Load <Texture>("Sprites/UI/Lock"); BlackFG = Resources.Load <Texture>("Sprites/UI/MenuSmallBG"); SmallBG = Resources.Load <Texture>("Sprites/UI/BGScreen"); Choise = Resources.Load <Texture>("Sprites/UI/Choise"); MarginalAct = Resources.Load <Texture>("Sprites/UI/Logo_MA_Pixel_Light"); OptionsTextures = new Texture[3]; for (int i = 0; i < 2; i++) { OptionsTextures[i] = Resources.Load <Texture>("Sprites/UI/OptionsTexture" + i); } OptionsTextures[OptionsTextures.Length - 1] = Resources.Load <Texture>("Sprites/UI/Back"); MenuTextures = new Texture[3]; for (int i = 0; i < MenuTextures.Length; i++) { MenuTextures[i] = Resources.Load <Texture>("Sprites/UI/MenuTexture" + i); } SmallMenuTextures = new Texture[3]; SmallMenuTextures[0] = Resources.Load <Texture>("Sprites/UI/MenuTexture0"); SmallMenuTextures[1] = Resources.Load <Texture>("Sprites/UI/MenuTexture1"); SmallMenuTextures[2] = Resources.Load <Texture>("Sprites/UI/Back"); VisualTextures = new Texture[3]; for (int i = 0; i < 2; i++) { VisualTextures[i] = Resources.Load <Texture>("Sprites/UI/VisualTexture" + i); } VisualTextures[VisualTextures.Length - 1] = Resources.Load <Texture>("Sprites/UI/Back"); SoundTextures = new Texture[4]; for (int i = 0; i < 3; i++) { SoundTextures[i] = Resources.Load <Texture>("Sprites/UI/SoundTexture" + i); } SoundTextures[SoundTextures.Length - 1] = Resources.Load <Texture>("Sprites/UI/Back"); if (SceneManager.GetActiveScene().name == "StartMenu") { Options = true; } EnterClip = Resources.Load <AudioClip>("Sound/UI/Accept"); ChoiseClip = Resources.Load <AudioClip>("Sound/UI/Click"); InnerOptions = MenuTextures; SoundVolume = new int[3] { 8, 7, 7 }; FullScreenString = new string[2]; OptionNamesInLine = new string[5]; if (Cursor.visible) { Cursor.visible = false; } //ArrowUp = Resources.Load<Texture>("Sprites/UI/Arrow_Up"); //ArrowDown = Resources.Load<Texture>("Sprites/UI/Arrow_Down"); ArrowLeft = Resources.Load <Texture>("Sprites/UI/LeftArrow"); ArrowRight = Resources.Load <Texture>("Sprites/UI/RightArrow"); ScreenResStrings = new string[3] { "1366 * 768", "1280 * 720", "1024 * 768" }; LanguageString = new string[2] { "RU", "EN" }; //AuC = new string[3] { "Master", "Background","Objects"}; Sc_width = new int[4] { 1920, 1366, 1280, 1024 }; Sc_height = new int[4] { 1080, 768, 720, 768 }; /*En = Resources.Load<Texture>("Sprites/UI/English"); * Ru = Resources.Load<Texture>("Sprites/UI/Russian");*/ skin = Resources.Load <GUISkin>("Prefabs/New GUISkin"); if (GetComponent <AudioSource>() == null) { print("NO_AUDIO_ON_START! IN MENU"); } AU = GetComponent <AudioSource>(); for (int i = 0; i < 10; i++) { rect_options[i] = new Rect(200f, 80f + 40f * i, 400f, 60f); } Load(); if (PlayerPrefs.GetFloat("Language") == 0) { PlayerPrefs.SetFloat("Language", language); } }
/// <summary> /// Initializes the screen /// </summary> /// <param id="sm">ScreenManager that handles this screen</param> public virtual void Initialize(ScreenManager sm) { TitleFont = UI.Instance.GetFont(TITLE_FONT_NAME); ControlFont = UI.Instance.GetFont(CONTROL_FONT_NAME); ButtonSkin = new GUISkin(UI.Instance.GetGuiTex(BUTTON_SKIN_NAME), ControlFont, BUTTON_TEXT_COLOR, false, true); LabelSkin = new GUISkin(UI.Instance.GetGuiTex(BUTTON_SKIN_NAME), ControlFont, UI_TEXT_COLOR, false, true); TextBoxSkin = new GUISkin(UI.Instance.GetGuiTex(TEXTBOX_SKIN_NAME), ControlFont, TEXTBOX_TEXT_COLOR, false, false); this.sm = sm; }
protected virtual void OnInspectorGUI(LocalizationSettings settings, LocalizationServiceItem item, System.Action onReset, GUISkin skin) { }