本文整理汇总了C#中UnityEngine.GUIStyle类的典型用法代码示例。如果您正苦于以下问题:C# GUIStyle类的具体用法?C# GUIStyle怎么用?C# GUIStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GUIStyle类属于UnityEngine命名空间,在下文中一共展示了GUIStyle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AspectSelectionGrid
public static int AspectSelectionGrid(int selected, Texture[] textures, int approxSize, GUIStyle style, string emptyString, out bool doubleClick)
{
GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinHeight(10f) };
GUILayout.BeginVertical("box", options);
int num = 0;
doubleClick = false;
if (textures.Length != 0)
{
float num2 = (EditorGUIUtility.currentViewWidth - 20f) / ((float) approxSize);
int num3 = (int) Mathf.Ceil(((float) textures.Length) / num2);
Rect aspectRect = GUILayoutUtility.GetAspectRect(num2 / ((float) num3));
Event current = Event.current;
if (((current.type == EventType.MouseDown) && (current.clickCount == 2)) && aspectRect.Contains(current.mousePosition))
{
doubleClick = true;
current.Use();
}
num = GUI.SelectionGrid(aspectRect, selected, textures, Mathf.RoundToInt(EditorGUIUtility.currentViewWidth - 20f) / approxSize, style);
}
else
{
GUILayout.Label(emptyString, new GUILayoutOption[0]);
}
GUILayout.EndVertical();
return num;
}
示例2: BeginLayoutGroup
internal static GUILayoutGroup BeginLayoutGroup(GUIStyle style, GUILayoutOption[] options, System.Type layoutType)
{
GUILayoutGroup next;
switch (Event.current.type)
{
case EventType.Used:
case EventType.Layout:
next = CreateGUILayoutGroupInstanceOfType(layoutType);
next.style = style;
if (options != null)
{
next.ApplyOptions(options);
}
current.topLevel.Add(next);
break;
default:
next = current.topLevel.GetNext() as GUILayoutGroup;
if (next == null)
{
throw new ArgumentException("GUILayout: Mismatched LayoutGroup." + Event.current.type);
}
next.ResetCursor();
GUIDebugger.LogLayoutGroupEntry(next.rect, next.margin, next.style, next.isVertical);
break;
}
current.layoutGroups.Push(next);
current.topLevel = next;
return next;
}
示例3: SetStyles
public static void SetStyles()
{
WindowStyle = new GUIStyle(GUI.skin.window);
IconStyle = new GUIStyle();
ButtonToggledStyle = new GUIStyle(GUI.skin.button);
ButtonToggledStyle.normal.textColor = Color.green;
ButtonToggledStyle.normal.background = ButtonToggledStyle.onActive.background;
ButtonToggledRedStyle = new GUIStyle(ButtonToggledStyle);
ButtonToggledRedStyle.normal.textColor = Color.red;
ButtonStyle = new GUIStyle(GUI.skin.button);
ButtonStyle.normal.textColor = Color.white;
ErrorLabelRedStyle = new GUIStyle(GUI.skin.label);
ErrorLabelRedStyle.normal.textColor = Color.red;
ErrorLabelRedStyle.fontSize = 10;
LabelStyle = new GUIStyle(GUI.skin.label);
LabelStyleRed = new GUIStyle(LabelStyle);
LabelStyleRed.normal.textColor = Color.red;
LabelStyleYellow = new GUIStyle(LabelStyle);
LabelStyleYellow.normal.textColor = Color.yellow;
}
示例4: OnGUI
public void OnGUI()
{
m_scrollPosition = GUILayout.BeginScrollView( m_scrollPosition );
GUILayout.BeginVertical();
GUILayout.Space( 10 );
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
GUILayout.Box( m_aboutImage, GUIStyle.none );
if ( Event.current.type == EventType.MouseUp && GUILayoutUtility.GetLastRect().Contains( Event.current.mousePosition ) )
Application.OpenURL( "http://www.amplify.pt" );
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUIStyle labelStyle = new GUIStyle( EditorStyles.label );
labelStyle.alignment = TextAnchor.MiddleCenter;
labelStyle.wordWrap = true;
GUILayout.Label( "\nAmplify Color " + VersionInfo.StaticToString(), labelStyle, GUILayout.ExpandWidth( true ) );
GUILayout.Label( "\nCopyright (c) Amplify Creations, Lda. All rights reserved.\n", labelStyle, GUILayout.ExpandWidth( true ) );
GUILayout.EndVertical();
GUILayout.EndScrollView();
}
示例5: buttonStyle
public const double G = 6.674E-11; //this seems to be the value the game uses
#endregion Fields
#region Methods
public static GUIStyle buttonStyle(Color color)
{
GUIStyle style = new GUIStyle(GUI.skin.button);
style.onNormal.textColor = style.onFocused.textColor = style.onHover.textColor = style.onActive.textColor = color;
style.normal.textColor = color;
return style;
}
示例6: OnInspectorGUI
public override void OnInspectorGUI()
{
if (this.m_TextStyle == null)
this.m_TextStyle = (GUIStyle) "ScriptText";
bool enabled = GUI.enabled;
GUI.enabled = true;
TextAsset target = this.target as TextAsset;
if ((UnityEngine.Object) target != (UnityEngine.Object) null)
{
string str;
if (this.targets.Length > 1)
{
str = this.targetTitle;
}
else
{
str = target.ToString();
if (str.Length > 7000)
str = str.Substring(0, 7000) + "...\n\n<...etc...>";
}
Rect rect = GUILayoutUtility.GetRect(EditorGUIUtility.TempContent(str), this.m_TextStyle);
rect.x = 0.0f;
rect.y -= 3f;
rect.width = GUIClip.visibleRect.width + 1f;
GUI.Box(rect, str, this.m_TextStyle);
}
GUI.enabled = enabled;
}
示例7: DrawBox
public static void DrawBox(GUIStyle style)
{
if (Boxing) {
Vector2 Size = BoxEnd - BoxStart;
GUI.Box (new Rect (BoxStart.x, Screen.height - BoxStart.y, Size.x, -Size.y), "", style);
}
}
示例8: Styles
public Styles() {
#if UNITY_EDITOR
this.skin = Resources.Load<GUISkin>("UI.Windows/Core/Styles/Boxes/" + (UnityEditor.EditorGUIUtility.isProSkin == true ? "SkinDark" : "SkinLight"));
this.boxes = new GUIStyle[WindowLayoutStyles.MAX_DEPTH] {
this.skin.FindStyle("flow node 0"),
this.skin.FindStyle("flow node 1"),
this.skin.FindStyle("flow node 2"),
this.skin.FindStyle("flow node 3"),
this.skin.FindStyle("flow node 4"),
this.skin.FindStyle("flow node 5")
};
this.boxesSelected = new GUIStyle[WindowLayoutStyles.MAX_DEPTH] {
this.skin.FindStyle("flow node 0"), // on
this.skin.FindStyle("flow node 1"),
this.skin.FindStyle("flow node 2"),
this.skin.FindStyle("flow node 3"),
this.skin.FindStyle("flow node 4"),
this.skin.FindStyle("flow node 5")
};
this.boxSelected = this.skin.FindStyle("flow node 5");
#endif
}
示例9: Foldout
public static bool Foldout(bool open, GUIContent header, Action content)
{
if (foldoutStyle == null)
{
foldoutStyle = new GUIStyle(GUI.skin.FindStyle("ShurikenModuleBg"));
foldoutStyle.padding = new RectOffset(10, 10, 10, 10);
headerStyle = new GUIStyle(GUI.skin.FindStyle("ShurikenModuleTitle"));
headerStyle.contentOffset = new Vector2(3, -2);
}
GUILayout.BeginVertical("ShurikenEffectBg", GUILayout.MinHeight(1f));
open = GUI.Toggle(GUILayoutUtility.GetRect(0, 16), open, header, headerStyle);
if (open)
{
GUILayout.BeginVertical(foldoutStyle);
content();
GUILayout.EndVertical();
}
GUILayout.EndVertical();
return open;
}
示例10: OnPreviewGUI
public override void OnPreviewGUI(Rect r, GUIStyle background) {
//var color = new Color(0.8f, 0.8f, 1f, 1f);
//color.a = 0.7f;
this.OnPreviewGUI(Color.white, r, GUI.skin.box, true, false);
}
示例11: InitOnMainThread
public static void InitOnMainThread()
{
lock (s_mutex)
{
if (s_mainThread != null)
{
return;
}
if (Runtime.IsEditor)
{
try
{
GUIStyle style = new GUIStyle();
style.CalcHeight(GUIContent.none, 0);
}
catch (ArgumentException)
{
#if LUNAR_DEBUG
UnityEngine.Debug.Log("ThreadUtils.Init() is not called on the main thread");
#endif
return;
}
}
s_mainThread = Thread.CurrentThread;
}
}
示例12: DrawExtraFeatures
private void DrawExtraFeatures() {
if (icon == null) {
string iconFilename = EditorGUIUtility.isProSkin ? DarkSkinIconFilename : LightSkinIconFilename;
icon = AssetDatabase.LoadAssetAtPath(iconFilename, typeof(Texture2D)) as Texture2D;
}
if (dialogueSystemController == null || icon == null) return;
if (iconButtonStyle == null) {
iconButtonStyle = new GUIStyle(EditorStyles.label);
iconButtonStyle.normal.background = icon;
iconButtonStyle.active.background = icon;
}
if (iconButtonContent == null) {
iconButtonContent = new GUIContent(string.Empty, "Click to open Dialogue Editor.");
}
GUILayout.BeginHorizontal();
if (GUILayout.Button(iconButtonContent, iconButtonStyle, GUILayout.Width(icon.width), GUILayout.Height(icon.height))) {
Selection.activeObject = dialogueSystemController.initialDatabase;
PixelCrushers.DialogueSystem.DialogueEditor.DialogueEditorWindow.OpenDialogueEditorWindow();
}
GUILayout.FlexibleSpace();
if (GUILayout.Button("Wizard...", GUILayout.Width(64))) {
DialogueManagerWizard.Init();
}
GUILayout.EndHorizontal();
EditorWindowTools.DrawHorizontalLine();
}
示例13: WindowGUI
private void WindowGUI(int windowID)
{
GUIStyle mySty = new GUIStyle(GUI.skin.button);
mySty.normal.textColor = mySty.focused.textColor = Color.white;
mySty.padding = new RectOffset(8, 8, 8, 8);
GUILayout.BeginHorizontal();
int meterAlt = (int)Math.Truncate(altitude);
String text;
if (altitude > altitudeMax)
text = "Radar Altitude: MAX";
else
text = "Radar Altitude: " + meterAlt;
if (!this.isEnabled)
text = " Disabled ";
if (GUILayout.Button (text, mySty, GUILayout.ExpandWidth (true))) {
this.isEnabled = !this.isEnabled;
var generator = base.GetComponent<ModuleGenerator> ();
if (!isEnabled)
generator.Shutdown ();
else
generator.Activate ();
}
GUILayout.EndHorizontal();
//DragWindow makes the window draggable. The Rect specifies which part of the window it can by dragged by, and is
//clipped to the actual boundary of the window. You can also pass no argument at all and then the window can by
//dragged by any part of it. Make sure the DragWindow command is AFTER all your other GUI input stuff, or else
//it may "cover up" your controls and make them stop responding to the mouse.
GUI.DragWindow(new Rect(0, 0, 10000, 20));
}
示例14: AspectSelectionGridImageAndText
public static int AspectSelectionGridImageAndText(int selected, GUIContent[] textures, int approxSize, GUIStyle style, string emptyString, out bool doubleClick)
{
GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinHeight(10f) };
EditorGUILayout.BeginVertical(GUIContent.none, EditorStyles.helpBox, options);
int num = 0;
doubleClick = false;
if (textures.Length != 0)
{
int xCount = 0;
Rect position = GetBrushAspectRect(textures.Length, approxSize, 12, out xCount);
Event current = Event.current;
if (((current.type == EventType.MouseDown) && (current.clickCount == 2)) && position.Contains(current.mousePosition))
{
doubleClick = true;
current.Use();
}
num = GUI.SelectionGrid(position, selected, textures, xCount, style);
}
else
{
GUILayout.Label(emptyString, new GUILayoutOption[0]);
}
GUILayout.EndVertical();
return num;
}
示例15: Toggle
internal Toggle()
{
Default = new GUIStyle()
{
normal = {
background = Elements.LoadImage("toggle-normal.png"),
},
onNormal = {
background = Elements.LoadImage("toggle-on-normal.png"),
},
hover = {
background = Elements.LoadImage("toggle-hover.png"),
},
onHover = {
background = Elements.LoadImage("toggle-on-hover.png"),
},
active = {
background = Elements.LoadImage("toggle-active.png"),
},
onActive = {
background = Elements.LoadImage("toggle-on-active.png"),
},
margin = { right = 10 }
};
}