-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gui.cs
executable file
·99 lines (75 loc) · 3.02 KB
/
Gui.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
// Gui.cs
// (c) 2013 Brett Ernst, Jameson Ernst, Robert Marsters, Gabriel Isenberg https://github.com/gisenberg/tabletop.io.gui
// Licensed under the terms of the MIT license.
using UnityEngine;
namespace Tabletop.io.Gui {
public static class Gui {
static GuiManager s_gui;
public static int ScreenX, ScreenY;
static Gui () {
ScreenX = Screen.width;
ScreenY = Screen.height;
if (s_gui == null) {
var go = new GameObject("Gui Manager");
GameObject.DontDestroyOnLoad(go);
s_gui = go.AddComponent<GuiManager>();
}
}
public static StringCache Strings { get { return s_gui.Strings; } }
public static bool IsInputEnabled { get { return s_gui.IsInputEnabled; } set { s_gui.IsInputEnabled = value; } }
public static bool IsMouseSimulated { get { return s_gui.IsMouseSimulated; } set { s_gui.IsMouseSimulated = value; } }
internal static GuiManager Instance { get { return s_gui; } }
public static void AddResources (AssetBundle bundle) {
s_gui.AddResources(bundle);
}
public static int AddLayer (string name, Camera camera) {
return s_gui.AddLayer(name, camera);
}
public static Camera GetCameraFromLayer (string name) {
return s_gui.GetLayer(name).Camera;
}
public static int GetLayerIndex (string name) {
return s_gui.GetLayer(name).Index;
}
public static Layer GetLayer (string name) {
return s_gui.GetLayer(name);
}
public static Atlas GetAtlas (string name) {
return s_gui.GetAtlas(name);
}
public static BitmapFont GetFont (string name) {
return s_gui.GetFont(name);
}
public static Sprite GetSprite (string spritePath) {
return s_gui.GetSprite(spritePath);
}
public static Shader GetShader (string name) {
return s_gui.GetShader(name);
}
public static void SetFocus (IKeyboardInput control) {
s_gui.SetFocus(control);
}
public static void SetCursor (CursorPriority priority, Cursor cursor) {
s_gui.SetCursor(priority, cursor);
}
public static void AddUpdateHook (IUpdate hook) {
s_gui.AddUpdateHook(hook);
}
public static bool RemoveUpdateHook (IUpdate hook) {
return s_gui.RemoveUpdateHook(hook);
}
public static float ZIndex (float zIndex) {
return 500f - zIndex;
}
public static float ZIndex (float zIndex, IControl relativeTo) {
return relativeTo.Position.z - zIndex;
}
public static Vector2 GetSpriteSize (string path) {
var s = s_gui.GetSprite(path);
return s.Size;
}
public static void SuppressInput (object transitionTag) {
s_gui.SuppressInput(transitionTag);
}
}
}