本文整理汇总了C#中UnityEngine.GUILayoutOption类的典型用法代码示例。如果您正苦于以下问题:C# GUILayoutOption类的具体用法?C# GUILayoutOption怎么用?C# GUILayoutOption使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GUILayoutOption类属于UnityEngine命名空间,在下文中一共展示了GUILayoutOption类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GUIWordWrapSizer
public GUIWordWrapSizer(GUIStyle _style, GUIContent _content, GUILayoutOption[] options) : base(0f, 0f, 0f, 0f, _style)
{
this.content = new GUIContent(_content);
base.ApplyOptions(options);
this.forcedMinHeight = this.minHeight;
this.forcedMaxHeight = this.maxHeight;
}
示例2: OnGUI
void OnGUI()
{
GUILayoutOption[] width200 = new GUILayoutOption[] {GUILayout.Width(200)};
GUILayout.BeginArea(new Rect((Screen.width / 2) - 200, (Screen.height / 2) - 100, 400, 200));
GUILayout.BeginVertical();
GUILayout.Label("Time Left:" + this.timeLeft.ToString("0.000"));
if (this.gs == gameState.waiting || this.gs == gameState.running)
{
if (GUILayout.Button("Click me as much as you can in " + this.startTime.ToString("0") + " seconds!"))
{
this.totalScore++;
this.gs = gameState.running;
}
GUILayout.Label("Total Score: " + this.totalScore.ToString());
}
if (this.gs == gameState.enterscore)
{
GUILayout.Label("Total Score: " + this.totalScore.ToString());
GUILayout.BeginHorizontal();
GUILayout.Label("Your Name: ");
this.playerName = GUILayout.TextField(this.playerName, width200);
if (GUILayout.Button("Save Score"))
{
// add the score...
dl.AddScore(this.playerName, totalScore);
this.gs = gameState.leaderboard;
}
GUILayout.EndHorizontal();
}
if (this.gs == gameState.leaderboard)
{
GUILayout.Label("High Scores:");
DreamloLeaderBoard.Score[] scoreList = dl.ToScoreArray();
if (scoreList == null)
{
GUILayout.Label("(loading...)");
}
else
{
foreach (DreamloLeaderBoard.Score currentScore in scoreList)
{
GUILayout.BeginHorizontal();
GUILayout.Label(currentScore.PlayerName, width200);
GUILayout.Label(currentScore.PlayerScore.ToString(), width200);
GUILayout.EndHorizontal();
}
}
}
GUILayout.EndVertical();
GUILayout.EndArea();
}
示例3: 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;
}
示例4: Show
public static void Show(SerializedProperty bodyMask, int count)
{
if (styles.UnityDude.image != null)
{
GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MaxWidth((float) styles.UnityDude.image.width) };
Rect position = GUILayoutUtility.GetRect(styles.UnityDude, GUIStyle.none, options);
position.x += (GUIView.current.position.width - position.width) / 2f;
Color color = GUI.color;
GUI.color = (bodyMask.GetArrayElementAtIndex(0).intValue != 1) ? Color.red : Color.green;
if (styles.BodyPart[0].image != null)
{
GUI.DrawTexture(position, styles.BodyPart[0].image);
}
GUI.color = new Color(0.2f, 0.2f, 0.2f, 1f);
GUI.DrawTexture(position, styles.UnityDude.image);
for (int i = 1; i < count; i++)
{
GUI.color = (bodyMask.GetArrayElementAtIndex(i).intValue != 1) ? Color.red : Color.green;
if (styles.BodyPart[i].image != null)
{
GUI.DrawTexture(position, styles.BodyPart[i].image);
}
}
GUI.color = color;
DoPicking(position, bodyMask, count);
}
}
示例5: LayoutedWindow
internal LayoutedWindow(GUI.WindowFunction f, Rect _screenRect, GUIContent _content, GUILayoutOption[] _options, GUIStyle _style)
{
this.func = f;
this.screenRect = _screenRect;
this.options = _options;
this.style = _style;
}
示例6: BakeButtons
private void BakeButtons()
{
float width = 95f;
GUILayout.BeginHorizontal(new GUILayoutOption[0]);
GUILayout.FlexibleSpace();
bool flag = !EditorApplication.isPlayingOrWillChangePlaymode;
GUI.enabled = (StaticOcclusionCulling.umbraDataSize != 0) && flag;
GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(width) };
if (GUILayout.Button("Clear", options))
{
StaticOcclusionCulling.Clear();
}
GUI.enabled = flag;
if (StaticOcclusionCulling.isRunning)
{
GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width(width) };
if (GUILayout.Button("Cancel", optionArray2))
{
StaticOcclusionCulling.Cancel();
}
}
else
{
GUILayoutOption[] optionArray3 = new GUILayoutOption[] { GUILayout.Width(width) };
if (GUILayout.Button("Bake", optionArray3))
{
StaticOcclusionCulling.GenerateInBackground();
}
}
GUILayout.EndHorizontal();
GUI.enabled = true;
}
示例7: ApplyOptions
public override void ApplyOptions(GUILayoutOption[] options)
{
if (options != null)
{
base.ApplyOptions(options);
foreach (GUILayoutOption option in options)
{
switch (option.type)
{
case GUILayoutOption.Type.fixedWidth:
case GUILayoutOption.Type.minWidth:
case GUILayoutOption.Type.maxWidth:
this.m_UserSpecifiedHeight = true;
break;
case GUILayoutOption.Type.fixedHeight:
case GUILayoutOption.Type.minHeight:
case GUILayoutOption.Type.maxHeight:
this.m_UserSpecifiedWidth = true;
break;
case GUILayoutOption.Type.spacing:
this.spacing = (int) option.value;
break;
}
}
}
}
示例8: DrawAudioFilterGUI
public void DrawAudioFilterGUI(MonoBehaviour behaviour)
{
int customFilterChannelCount = AudioUtil.GetCustomFilterChannelCount(behaviour);
if (customFilterChannelCount > 0)
{
if (this.dataOut == null)
{
this.dataOut = new EditorGUI.VUMeter.SmoothingData[customFilterChannelCount];
}
double num2 = ((double) AudioUtil.GetCustomFilterProcessTime(behaviour)) / 1000000.0;
float r = ((float) num2) / ((((float) AudioSettings.outputSampleRate) / 1024f) / ((float) customFilterChannelCount));
GUILayout.BeginHorizontal(new GUILayoutOption[0]);
GUILayout.Space(13f);
GUILayout.BeginVertical(new GUILayoutOption[0]);
EditorGUILayout.Space();
for (int i = 0; i < customFilterChannelCount; i++)
{
GUILayoutOption[] optionArray1 = new GUILayoutOption[] { GUILayout.MinWidth(50f), GUILayout.Height(5f) };
EditorGUILayout.VUMeterHorizontal(AudioUtil.GetCustomFilterMaxOut(behaviour, i), ref this.dataOut[i], optionArray1);
}
GUILayout.EndVertical();
Color color = GUI.color;
GUI.color = new Color(r, 1f - r, 0f, 1f);
GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinWidth(40f), GUILayout.Height(20f) };
GUILayout.Box(string.Format("{0:00.00}ms", num2), options);
GUI.color = color;
GUILayout.EndHorizontal();
EditorGUILayout.Space();
GUIView.current.Repaint();
}
}
示例9: 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;
}
示例10: ShowEntry
private void ShowEntry(GUIContent logo, string url, GUIContent header, GUIContent text, string analyticsAction)
{
GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Height(55f) };
GUILayout.BeginHorizontal(options);
GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width(120f) };
GUILayout.BeginHorizontal(optionArray2);
GUILayout.FlexibleSpace();
if (GUILayout.Button(logo, GUIStyle.none, new GUILayoutOption[0]))
{
this.ShowHelpPageOrBrowseURL(url, analyticsAction);
}
EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);
GUILayout.Space(10f);
GUILayout.EndHorizontal();
GUILayout.BeginVertical(new GUILayoutOption[0]);
if (GUILayout.Button(header, "HeaderLabel", new GUILayoutOption[0]))
{
this.ShowHelpPageOrBrowseURL(url, analyticsAction);
}
EditorGUIUtility.AddCursorRect(GUILayoutUtility.GetLastRect(), MouseCursor.Link);
GUILayoutOption[] optionArray3 = new GUILayoutOption[] { GUILayout.Width(400f) };
GUILayout.Label(text, "WordWrappedLabel", optionArray3);
GUILayout.EndVertical();
GUILayout.EndHorizontal();
}
示例11: BottomArea
private void BottomArea()
{
GUILayout.BeginVertical(Styles.bottomBarBg, new GUILayoutOption[0]);
GUILayout.Space(8f);
GUILayout.BeginHorizontal(new GUILayoutOption[0]);
GUILayout.Space(10f);
GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(50f) };
if (GUILayout.Button(Styles.allText, options))
{
this.m_Tree.SetAllEnabled(1);
}
GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width(50f) };
if (GUILayout.Button(Styles.noneText, optionArray2))
{
this.m_Tree.SetAllEnabled(0);
}
GUILayout.Space(10f);
EditorGUI.BeginChangeCheck();
this.m_IncludeDependencies = GUILayout.Toggle(this.m_IncludeDependencies, Styles.includeDependenciesText, new GUILayoutOption[0]);
if (EditorGUI.EndChangeCheck())
{
this.RefreshAssetList();
}
GUILayout.FlexibleSpace();
if (GUILayout.Button(EditorGUIUtility.TextContent("Export..."), new GUILayoutOption[0]))
{
this.Export();
GUIUtility.ExitGUI();
}
GUILayout.Space(10f);
GUILayout.EndHorizontal();
GUILayout.Space(5f);
GUILayout.EndVertical();
}
示例12: GUIWordWrapSizer
public GUIWordWrapSizer(GUIStyle style, GUIContent content, GUILayoutOption[] options) : base(0f, 0f, 0f, 0f, style)
{
this.m_Content = new GUIContent(content);
this.ApplyOptions(options);
this.m_ForcedMinHeight = base.minHeight;
this.m_ForcedMaxHeight = base.maxHeight;
}
示例13: OnInspectorGUI
public override void OnInspectorGUI()
{
base.serializedObject.Update();
GUI.changed = false;
GUILayout.BeginHorizontal(new GUILayoutOption[0]);
EditorGUILayout.PrefixLabel("Size", EditorStyles.popup);
GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinWidth(40f) };
EditorGUILayout.PropertyField(this.m_Width, GUIContent.none, options);
GUILayout.Label("x", new GUILayoutOption[0]);
GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.MinWidth(40f) };
EditorGUILayout.PropertyField(this.m_Height, GUIContent.none, optionArray2);
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
EditorGUILayout.IntPopup(this.m_AntiAliasing, kRenderTextureAntiAliasing, kRenderTextureAntiAliasingValues, EditorGUIUtility.TempContent("Anti-Aliasing"), new GUILayoutOption[0]);
EditorGUILayout.PropertyField(this.m_ColorFormat, EditorGUIUtility.TempContent("Color Format"), new GUILayoutOption[0]);
EditorGUILayout.PropertyField(this.m_DepthFormat, EditorGUIUtility.TempContent("Depth Buffer"), new GUILayoutOption[0]);
RenderTexture target = this.target as RenderTexture;
if (GUI.changed && (target != null))
{
target.Release();
}
base.isInspectorDirty = true;
EditorGUILayout.Space();
base.DoWrapModePopup();
base.DoFilterModePopup();
EditorGUI.BeginDisabledGroup(this.RenderTextureHasDepth());
base.DoAnisoLevelSlider();
EditorGUI.EndDisabledGroup();
if (this.RenderTextureHasDepth())
{
base.m_Aniso.intValue = 0;
EditorGUILayout.HelpBox("RenderTextures with depth must have an Aniso Level of 0.", MessageType.Info);
}
base.serializedObject.ApplyModifiedProperties();
}
示例14: OnGUI
void OnGUI()
{
GUILayoutOption[] ops = new GUILayoutOption[]{};
GUI.skin.label.fontSize = 30;
GUI.skin.textArea.fontSize = 30;
GUI.skin.button.fontSize = 30;
if (GUILayout.Button ("UUID", ops)) {
currentUUID = SystemInfo.deviceUniqueIdentifier;
Debug.Log ("CurrentUUID: [" + currentUUID + "]");
}
GUILayout.TextArea (currentUUID, ops);
if (GUILayout.Button ("Load UUID", ops)) {
saveUUID = KeyChain.BindGetKeyChainUser ();
Debug.Log ("LoadUUID: [" + saveUUID + "]");
}
GUILayout.TextArea (saveUUID, ops);
if (GUILayout.Button ("Save UUID", ops)) {
currentUUID = SystemInfo.deviceUniqueIdentifier;
KeyChain.BindSetKeyChainUser ("0", currentUUID);
Debug.Log ("SaveUUID: [" + currentUUID + "]");
}
if (GUILayout.Button ("Delete UUID", ops)) {
KeyChain.BindDeleteKeyChainUser ();
}
}
示例15: OnInspectorGUI
public override void OnInspectorGUI()
{
GUILayout.Label(Styles.sketchUpLabel, EditorStyles.boldLabel, new GUILayoutOption[0]);
EditorGUILayout.PropertyField(this.m_GenerateBackFace, Styles.generateBackFaceLabel, new GUILayoutOption[0]);
EditorGUILayout.PropertyField(this.m_MergeCoplanarFaces, Styles.mergeCoplanarFaces, new GUILayoutOption[0]);
EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.MinWidth(EditorGUIUtility.labelWidth) };
GUILayout.Label(Styles.fileUnitLabel, options);
GUILayout.Label("1", new GUILayoutOption[0]);
GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.MaxWidth(100f) };
EditorGUILayout.Popup(this.m_FileUnit, Styles.measurementOptions, GUIContent.Temp(""), optionArray2);
this.lengthToUnit = ConvertGlobalScaleToUnit((EFileUnit) this.m_FileUnit.intValue, this.m_GlobalScale.floatValue);
GUILayout.Label("=", new GUILayoutOption[0]);
this.lengthToUnit = EditorGUILayout.FloatField(this.lengthToUnit, new GUILayoutOption[0]);
this.m_GlobalScale.floatValue = CovertUnitToGlobalScale((EFileUnit) this.m_FileUnit.intValue, this.lengthToUnit);
EditorGUILayout.EndHorizontal();
using (new EditorGUI.DisabledScope(true))
{
EditorGUILayout.FloatField(Styles.longitudeLabel, this.m_Longitude.floatValue, new GUILayoutOption[0]);
EditorGUILayout.FloatField(Styles.latitudeLabel, this.m_Latitude.floatValue, new GUILayoutOption[0]);
EditorGUILayout.FloatField(Styles.northCorrectionLabel, this.m_NorthCorrection.floatValue, new GUILayoutOption[0]);
}
EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
if (GUILayout.Button(Styles.selectNodeButton, new GUILayoutOption[0]))
{
SketchUpImportDlg.Launch(this.m_Target.GetNodes(), this);
GUIUtility.ExitGUI();
}
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
base.OnInspectorGUI();
}