protected void DrawTransform() { state = UIModifierUtils.DrawContentHeader("Transform", state); if (state) { UIModifierUtils.BeginContents(UIModifierUtils.DefaultContentColor); #region Sprie LocalPosition GUILayout.Space(3f); GUILayout.BeginHorizontal(); bool reset = GUILayout.Button("P", GUILayout.Width(20f)); EditorGUIUtility.labelWidth = 12; Trans.x = EditorGUILayout.FloatField("x", Trans.x, GUILayout.MinWidth(30f)); Trans.y = EditorGUILayout.FloatField("y", Trans.y, GUILayout.MinWidth(30f)); Trans.z = EditorGUILayout.FloatField("z", Trans.z, GUILayout.MinWidth(30f)); EditorGUIUtility.labelWidth = 70; if (reset) { Trans.x = 0; Trans.y = 0; Trans.z = 0; } EditorGUIUtility.labelWidth = 70; GUILayout.EndHorizontal(); #endregion UIModifierUtils.EndContents(UIModifierUtils.DefaultContentColor); } }
protected void OnGUI() { GUILayout.Space(20); string[] m_ViewHeaders = new string[m_ViewItems.Count]; m_ViewItems.Keys.CopyTo(m_ViewHeaders, 0); if (CurrentViewHeader == null) { Initialize(); } CurrentViewHeader = UIModifierUtils.DrawHeaderButtons(m_ViewHeaders, 60, CurrentViewHeader, 60); m_ViewItems[CurrentViewHeader](); }
public override void DrawSubProperty() { state = UIModifierUtils.DrawContentHeader("UILabel", state); if (state) { #region Font EditorGUILayout.HelpBox("暂时只支持Dynamic Fonts替换", MessageType.Warning); GUILayout.BeginHorizontal(); EditorGUI.BeginDisabledGroup(true); Font_Type = (UILabelInspector.FontType)EditorGUILayout.EnumPopup(Font_Type, "DropDown", GUILayout.Width(74f)); EditorGUI.EndDisabledGroup(); if (GUILayout.Button("Font", "DropDown", GUILayout.Width(64f))) { ComponentSelector.Show <UIFont>(OnNGUIFont); } EditorGUILayout.ObjectField(UI_Font, typeof(UIFont), false); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { GUILayout.Label("Font Size", GUILayout.Width(66)); Font_Size = EditorGUILayout.IntField("", Font_Size, GUILayout.Width(142f)); Font_Style = (FontStyle)EditorGUILayout.EnumPopup(Font_Style); GUILayout.Space(18f); } GUILayout.EndHorizontal(); #endregion GUILayout.BeginHorizontal(); GUILayout.Label("Modifier", GUILayout.Width(66)); Modifier_Type = (UILabel.Modifier)EditorGUILayout.EnumPopup(Modifier_Type); GUILayout.Space(18f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Alignment", GUILayout.Width(66)); Alig_Type = (NGUIText.Alignment)EditorGUILayout.EnumPopup(Alig_Type); GUILayout.Space(18f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Effect", GUILayout.Width(66)); Effect_Type = (UILabel.Effect)EditorGUILayout.EnumPopup(Effect_Type); if (Effect_Type != UILabel.Effect.None) { Effect_Color = EditorGUILayout.ColorField(Effect_Color, GUILayout.MinWidth(10f)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { GUILayout.Label(" ", GUILayout.Width(66)); EditorGUIUtility.labelWidth = 20f; Effect_Distance.x = EditorGUILayout.FloatField("X", Effect_Distance.x, GUILayout.MinWidth(40f)); Effect_Distance.y = EditorGUILayout.FloatField("Y", Effect_Distance.y, GUILayout.MinWidth(40f)); EditorGUIUtility.labelWidth = 70; } } GUILayout.Space(18f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Overflow", GUILayout.Width(66)); Overflow_Method = (UILabel.Overflow)EditorGUILayout.EnumPopup(Overflow_Method); GUILayout.Space(18f); GUILayout.EndHorizontal(); //EditorGUI.indentLevel++; if (Overflow_Method == UILabel.Overflow.ClampContent) { GUILayout.BeginHorizontal(); GUILayout.Label(" ", GUILayout.Width(66)); UseEllipsis = EditorGUILayout.ToggleLeft("Use Ellipsis", UseEllipsis); GUILayout.EndHorizontal(); } else if (Overflow_Method == UILabel.Overflow.ResizeFreely) { GUILayout.BeginHorizontal(); GUILayout.Label(" ", GUILayout.Width(66)); Overflow_Width = EditorGUILayout.IntField("Max Width", Overflow_Width, GUILayout.MinWidth(100)); if (Overflow_Width < 1) { GUILayout.Label("unlimited"); } GUILayout.Space(18f); GUILayout.EndHorizontal(); } //EditorGUI.indentLevel--; GUILayout.BeginHorizontal(); Gradient = EditorGUILayout.Toggle("Gradient", Gradient, GUILayout.Width(80)); EditorGUI.BeginDisabledGroup(!Gradient); { EditorGUIUtility.labelWidth = 40; Gradient_Top_Color = EditorGUILayout.ColorField("Top", Gradient_Top_Color, GUILayout.MinWidth(60)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(" ", GUILayout.Width(80)); Gradient_Bottom_Color = EditorGUILayout.ColorField("Bottom", Gradient_Bottom_Color, GUILayout.MinWidth(60)); EditorGUIUtility.labelWidth = 70; } EditorGUI.EndDisabledGroup(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); BBCode = EditorGUILayout.Toggle("BBCode", BBCode, GUILayout.Width(80)); EditorGUI.BeginDisabledGroup(!BBCode); Symbol_Style = (NGUIText.SymbolStyle)EditorGUILayout.EnumPopup("Symbols", Symbol_Style); EditorGUI.EndDisabledGroup(); GUILayout.Space(18); GUILayout.EndHorizontal(); Max_Lines = EditorGUILayout.IntField("Max Lines", Max_Lines, GUILayout.Width(120)); EditorGUILayout.HelpBox("依据官方文档,强制修改Keep Crisp为Never", MessageType.Warning); EditorGUI.BeginDisabledGroup(true); Crisp = UILabel.Crispness.Never; GUILayout.BeginHorizontal(); GUILayout.Label("Keep Crisp", GUILayout.Width(66)); Crisp = (UILabel.Crispness)EditorGUILayout.EnumPopup(Crisp); GUILayout.Space(18f); GUILayout.EndHorizontal(); EditorGUI.EndDisabledGroup(); } }
public override void DrawSubProperty() { state = UIModifierUtils.DrawContentHeader("UISprite", state); if (state) { GUILayout.BeginHorizontal(); if (GUILayout.Button("Atlas", "DropDown", GUILayout.Width(70))) { ComponentSelector.Show <UIAtlas>(OnSelectAtlas); } EditorGUILayout.ObjectField(Atlas, typeof(UIFont), false); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Sprite", "DropDown", GUILayout.Width(70))) { NGUISettings.atlas = Atlas; NGUISettings.selectedSprite = Sprite_Name; SpriteSelector.Show(SelectSprite); } GUILayout.Label(Sprite_Name, "HelpBox", GUILayout.Height(18f)); GUILayout.Space(18f); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); { Flip_Type = (UIBasicSprite.Flip)EditorGUILayout.EnumPopup("Flip", Flip_Type); Sprite_Type = (UIBasicSprite.Type)EditorGUILayout.EnumPopup("Sprite Type", Sprite_Type); EditorGUI.indentLevel++; { if (Sprite_Type == UISprite.Type.Simple) { GUILayout.BeginHorizontal(); Gradient = EditorGUILayout.Toggle("Gradient", Gradient, GUILayout.Width(80)); EditorGUI.BeginDisabledGroup(!Gradient); { EditorGUIUtility.labelWidth = 40; Gradient_Top_Color = EditorGUILayout.ColorField("Top", Gradient_Top_Color, GUILayout.MinWidth(60)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(" ", GUILayout.Width(80)); Gradient_Bottom_Color = EditorGUILayout.ColorField("Bottom", Gradient_Bottom_Color, GUILayout.MinWidth(60)); EditorGUIUtility.labelWidth = 70; } EditorGUI.EndDisabledGroup(); GUILayout.EndHorizontal(); } else if (Sprite_Type == UISprite.Type.Tiled) { } else if (Sprite_Type == UISprite.Type.Sliced) { Fill_Center = EditorGUILayout.Toggle("Fill Center", Fill_Center); GUILayout.BeginHorizontal(); Gradient = EditorGUILayout.Toggle("Gradient", Gradient, GUILayout.Width(80)); EditorGUI.BeginDisabledGroup(!Gradient); { Gradient_Top_Color = EditorGUILayout.ColorField("Top", Gradient_Top_Color, GUILayout.MinWidth(60)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label(" ", GUILayout.Width(80)); Gradient_Bottom_Color = EditorGUILayout.ColorField("Bottom", Gradient_Bottom_Color, GUILayout.MinWidth(60)); } EditorGUI.EndDisabledGroup(); GUILayout.EndHorizontal(); } else if (Sprite_Type == UISprite.Type.Filled) { FillDirection_Type = (UIBasicSprite.FillDirection)EditorGUILayout.EnumPopup("Flip", FillDirection_Type, GUILayout.MinWidth(20f)); Fill_Amount = EditorGUILayout.Slider("Amount", Fill_Amount, 0, 1f, GUILayout.MinWidth(20f)); Invert = EditorGUILayout.Toggle("Invert", Invert); } else if (Sprite_Type == UISprite.Type.Advanced) { Left_Type = (UIBasicSprite.AdvancedType)EditorGUILayout.EnumPopup("Left", Left_Type); Right_Type = (UIBasicSprite.AdvancedType)EditorGUILayout.EnumPopup("Right", Right_Type); Bottom_Type = (UIBasicSprite.AdvancedType)EditorGUILayout.EnumPopup("Bottom", Bottom_Type); Top_Type = (UIBasicSprite.AdvancedType)EditorGUILayout.EnumPopup("Top", Top_Type); Center_Type = (UIBasicSprite.AdvancedType)EditorGUILayout.EnumPopup("Center", Center_Type);; } } EditorGUI.indentLevel--; } GUILayout.EndVertical(); GUILayout.Space(18); GUILayout.EndHorizontal(); } }
public void DrawProperty() { UIModifierUtils.BeginContents(UIModifierUtils.DefaultContentColor); EditorGUILayout.HelpBox("进行UI替换前先执行下面按钮升级UIImageButton组件", MessageType.Error); GUILayout.Space(3); Color temp = GUI.color; GUI.color = Color.cyan; if (GUILayout.Button("AUTO-UPGRADE UIIMAGEBUTTON")) { if (OnUpdateClick != null) { OnUpdateClick(); } } GUILayout.Space(20f); if (GUILayout.Button("RESET CONDITIONS")) { Reset(); } GUILayout.Space(20f); GUI.color = temp; state = UIModifierUtils.DrawContentHeader("UIButton", state); if (state) { GUILayout.Space(3); EditorGUIUtility.labelWidth = 100; EnableColor = EditorGUILayout.Toggle("EnableColor", EnableColor); EditorGUIUtility.labelWidth = 70; EditorGUI.BeginDisabledGroup(!EnableColor); m_Color_Folder_State = EditorGUILayout.Foldout(m_Color_Folder_State, "Colors", true); if (m_Color_Folder_State) { EditorGUI.indentLevel++; Normal_Color = EditorGUILayout.ColorField("Normal", Normal_Color); Hover_Color = EditorGUILayout.ColorField("Hover", Hover_Color); Pressed_Color = EditorGUILayout.ColorField("Pressed", Pressed_Color); Disabled_Color = EditorGUILayout.ColorField("Disabled", Disabled_Color); EditorGUI.indentLevel--; } EditorGUI.EndDisabledGroup(); GUILayout.Space(10); EditorGUIUtility.labelWidth = 100; EnableSprite = EditorGUILayout.Toggle("EnabelSprite", EnableSprite); EditorGUIUtility.labelWidth = 70; EditorGUI.BeginDisabledGroup(!EnableSprite); m_Sprite_Folder_State = EditorGUILayout.Foldout(m_Sprite_Folder_State, "Sprite", true); if (m_Sprite_Folder_State) { GUILayout.BeginHorizontal(); GUILayout.Space(18); if (GUILayout.Button("Atlas", "DropDown", GUILayout.Width(70))) { ComponentSelector.Show <UIAtlas>(OnSelectAtlas); } EditorGUILayout.ObjectField(Atlas, typeof(UIAtlas), false); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(18); GUILayout.Label("Normal", GUILayout.Width(70)); if (GUILayout.Button(Normal_Sprite, "DropDown", GUILayout.MinWidth(70))) { m_CurrentSelectSpriteIndex = 1; NGUISettings.atlas = Atlas; NGUISettings.selectedSprite = Normal_Sprite; SpriteSelector.Show(SelectSprite); } GUILayout.Space(18); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(18); GUILayout.Label("Hover", GUILayout.Width(70)); if (GUILayout.Button(Hover_Sprite, "DropDown", GUILayout.MinWidth(70))) { m_CurrentSelectSpriteIndex = 2; NGUISettings.atlas = Atlas; NGUISettings.selectedSprite = Hover_Sprite; SpriteSelector.Show(SelectSprite); } GUILayout.Space(18); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(18); GUILayout.Label("Press", GUILayout.Width(70)); if (GUILayout.Button(Pressed_Sprite, "DropDown", GUILayout.MinWidth(70))) { m_CurrentSelectSpriteIndex = 3; NGUISettings.atlas = Atlas; NGUISettings.selectedSprite = Pressed_Sprite; SpriteSelector.Show(SelectSprite); } GUILayout.Space(18); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(18); GUILayout.Label("Disabled", GUILayout.Width(70)); if (GUILayout.Button(Disabled_Sprite, "DropDown", GUILayout.MinWidth(70))) { m_CurrentSelectSpriteIndex = 4; NGUISettings.atlas = Atlas; NGUISettings.selectedSprite = Disabled_Sprite; SpriteSelector.Show(SelectSprite); } GUILayout.Space(18); GUILayout.EndHorizontal(); } EditorGUI.EndDisabledGroup(); EditorGUI.BeginDisabledGroup(EnableSprite); m_Sprite2D_Folder_State = EditorGUILayout.Foldout(m_Sprite2D_Folder_State, "Sprite2D", true); if (m_Sprite2D_Folder_State) { GUILayout.BeginHorizontal(); GUILayout.Space(18); GUILayout.Label("Normal", GUILayout.Width(70)); Normal_Sprite2D = (UnityEngine.Sprite)EditorGUILayout.ObjectField(Normal_Sprite2D, typeof(UnityEngine.Sprite), true); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(18); GUILayout.Label("Hover", GUILayout.Width(70)); Hover_Sprite2D = (UnityEngine.Sprite)EditorGUILayout.ObjectField(Hover_Sprite2D, typeof(UnityEngine.Sprite), true); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(18); GUILayout.Label("Press", GUILayout.Width(70)); Pressed_Sprite2D = (UnityEngine.Sprite)EditorGUILayout.ObjectField(Pressed_Sprite2D, typeof(UnityEngine.Sprite), true); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Space(18); GUILayout.Label("Disable", GUILayout.Width(70)); Disabled_Sprite2D = (UnityEngine.Sprite)EditorGUILayout.ObjectField(Disabled_Sprite2D, typeof(UnityEngine.Sprite), true); GUILayout.EndHorizontal(); } EditorGUI.EndDisabledGroup(); } GUILayout.Space(3); GUI.color = Color.cyan; if (GUILayout.Button("Modify All Properties", GUILayout.MinHeight(300))) { if (OnAllPropertiesChanged != null) { OnAllPropertiesChanged(); } } GUI.color = temp; UIModifierUtils.EndContents(UIModifierUtils.DefaultContentColor); }
protected void DrawWidget() { state = UIModifierUtils.DrawContentHeader("Widget", state); if (state) { //GUILayout.Space(10f); UIModifierUtils.BeginContents(UIModifierUtils.DefaultContentColor); #region Pivot GUILayout.Space(3f); int newPivotH = PivotH, newPivotV = PivotV; GUILayout.BeginHorizontal(); GUILayout.Label("Pivot", GUILayout.Width(66f)); if (GUILayout.Toggle(newPivotH == 0, "\u25C4", "ButtonLeft")) { newPivotH = 0; } if (GUILayout.Toggle(newPivotH == 1, "\u25AC", "ButtonMid")) { newPivotH = 1; } if (GUILayout.Toggle(newPivotH == 2, "\u25BA", "ButtonRight")) { newPivotH = 2; } if (GUILayout.Toggle(newPivotV == 0, "\u25B2", "ButtonLeft")) { newPivotV = 0; } if (GUILayout.Toggle(newPivotV == 1, "\u258C", "ButtonMid")) { newPivotV = 1; } if (GUILayout.Toggle(newPivotV == 2, "\u25BC", "ButtonRight")) { newPivotV = 2; } GUILayout.EndHorizontal(); if (PivotH != newPivotH) { PivotH = newPivotH; } if (PivotV != newPivotV) { PivotV = newPivotV; } //if (GUILayout.Button("Change Pivot")) //{ // UIWidget.Pivot pivot = (UIWidget.Pivot)(3 * PivotV + PivotH); // //Debug.Log(pivot.ToString()); // if (OnPivotChanged != null) // OnPivotChanged(pivot); //} #endregion #region DrawDepth GUILayout.Space(3); GUILayout.BeginHorizontal(); GUILayout.Label("Depth", GUILayout.Width(66f)); if (GUILayout.Button("Back", GUILayout.MinWidth(46f))) { Depth -= 1; } GUILayout.Space(5); int newDepth = EditorGUILayout.IntField("", Depth, GUILayout.MinWidth(50)); if (newDepth != Depth) { Depth = newDepth; } GUILayout.Space(5); if (GUILayout.Button("Forward", GUILayout.MinWidth(60f))) { Depth += 1; } GUILayout.EndHorizontal(); //if (GUILayout.Button("Change Depth")) //{ // //Debug.Log("Current Depth: " + Depth); // if (OnDepthChanged != null) // OnDepthChanged(Depth); //} #endregion #region DrawDimensions GUILayout.Space(3); GUILayout.BeginHorizontal(); EditorGUIUtility.labelWidth = 70; Width = EditorGUILayout.IntField("Size", Width, GUILayout.MinWidth(30f)); EditorGUIUtility.labelWidth = 12; Height = EditorGUILayout.IntField("x", Height, GUILayout.MinWidth(30f)); EditorGUIUtility.labelWidth = 70; if (GUILayout.Button("Snap", GUILayout.Width(60f))) { if (OnSnap != null) { OnSnap(); } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { EditorGUI.BeginDisabledGroup(true); EditorGUILayout.IntField("Aspect", -1, GUILayout.MinWidth(30f)); EditorGUILayout.EnumPopup(UIWidget.AspectRatioSource.Free); EditorGUI.EndDisabledGroup(); } GUILayout.EndHorizontal(); //if (GUILayout.Button("Change Dimensions")) //{ // //Debug.LogError("UNDONE: Change this button to toggle"); // if (OnDimensionsChanged != null) // OnDimensionsChanged(Width, Height); //} #endregion #region DrawAspect //GUILayout.BeginHorizontal(); //{ // EditorGUI.BeginDisabledGroup(true); // EditorGUILayout.IntField("Aspect", -1, GUILayout.MinWidth(30f)); // EditorGUI.EndDisabledGroup(); //} //GUILayout.EndHorizontal(); #endregion UIModifierUtils.EndContents(UIModifierUtils.DefaultContentColor); } }