-
-
Notifications
You must be signed in to change notification settings - Fork 27
/
ScopeExample.cs
58 lines (46 loc) · 1.47 KB
/
ScopeExample.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System.Collections.Generic;
using UnityEngine;
namespace RapidGUI.Example
{
/// <summary>
/// Scope examples
/// </summary>
public class ScopeExample : ExampleBase
{
public class CustomClass
{
public int value0;
public int value1;
}
CustomClass customClass = new CustomClass();
protected override string title => "Scope";
static readonly Dictionary<string, string> customLabelTable = new Dictionary<string, string>() { { "value1", "value1 is replaced" } };
public override void DoGUI()
{
using (new RGUI.IndentScope())
{
GUILayout.Label("IndentScope");
}
using (new RGUI.EnabledScope(false))
{
GUILayout.Label("EnabledScope");
}
using (new RGUI.ColorScope(Color.green))
{
GUILayout.Label("ColorScope");
}
using (new RGUI.BackgroundColorScope(Color.red))
{
GUILayout.Button("BackgroundColorScope");
}
using (new RGUI.CustomLabelScope(customLabelTable))
{
RGUI.Field(customClass, "CustomLabelScope - replace value1 to custom label");
}
using(new RGUI.IgnoreFieldScope("value1"))
{
RGUI.Field(customClass, "IgnoreFieldScope - ignore value1 field");
}
}
}
}