|
|
@@ -33,7 +33,7 @@ namespace TechbloxModdingAPI.Interface.IMGUI |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private static Font _riffic = null; |
|
|
|
private static Font _font = null; |
|
|
|
|
|
|
|
private static Texture2D _blueBackground = null; |
|
|
|
private static Texture2D _grayBackground = null; |
|
|
@@ -49,12 +49,13 @@ namespace TechbloxModdingAPI.Interface.IMGUI |
|
|
|
private static GUISkin BuildDefaultGUISkin() |
|
|
|
{ |
|
|
|
_defaultCompletion = 0; |
|
|
|
if (_riffic == null) return GUI.skin; |
|
|
|
//if (_font == null) return GUI.skin; |
|
|
|
// build GUISkin |
|
|
|
GUISkin gui = ScriptableObject.CreateInstance<GUISkin>(); |
|
|
|
gui.font = _riffic; |
|
|
|
gui.font = _font; |
|
|
|
gui.settings.selectionColor = Color.white; |
|
|
|
gui.settings.tripleClickSelectsLine = true; |
|
|
|
Color textColour = new Color(0.706f, 0.706f, 0.706f); |
|
|
|
// set properties off all UI elements |
|
|
|
foreach (PropertyInfo p in typeof(GUISkin).GetProperties()) |
|
|
|
{ |
|
|
@@ -63,29 +64,30 @@ namespace TechbloxModdingAPI.Interface.IMGUI |
|
|
|
{ |
|
|
|
style.richText = true; |
|
|
|
style.alignment = TextAnchor.MiddleCenter; |
|
|
|
style.fontSize = 30; |
|
|
|
style.fontSize = 16; |
|
|
|
style.wordWrap = true; |
|
|
|
style.border = new RectOffset(4, 4, 4, 4); |
|
|
|
style.margin = new RectOffset(4, 4, 4, 4); |
|
|
|
style.padding = new RectOffset(4, 4, 4, 4); |
|
|
|
// normal state |
|
|
|
style.normal.background = _blueBackground; |
|
|
|
style.normal.textColor = Color.white; |
|
|
|
style.normal.background = _grayBackground; |
|
|
|
style.normal.textColor = textColour; |
|
|
|
// hover state |
|
|
|
style.hover.background = _grayBackground; |
|
|
|
style.hover.textColor = Color.white; |
|
|
|
style.hover.textColor = textColour; |
|
|
|
// focused |
|
|
|
style.focused.background = _grayBackground; |
|
|
|
style.focused.textColor = Color.white; |
|
|
|
style.focused.textColor = textColour; |
|
|
|
// clicking state |
|
|
|
style.active.background = _whiteBackground; |
|
|
|
style.active.textColor = Color.white; |
|
|
|
style.active.textColor = textColour; |
|
|
|
|
|
|
|
p.SetValue(gui, style); // probably unnecessary |
|
|
|
} |
|
|
|
} |
|
|
|
// set element-specific styles |
|
|
|
// label |
|
|
|
gui.label.fontSize = 20; |
|
|
|
gui.label.normal.background = null; |
|
|
|
gui.label.hover.background = null; |
|
|
|
gui.label.focused.background = null; |
|
|
@@ -115,35 +117,29 @@ namespace TechbloxModdingAPI.Interface.IMGUI |
|
|
|
|
|
|
|
private static void LoadGUIAssets() |
|
|
|
{ |
|
|
|
AsyncOperationHandle<Font> rifficHandle = Addressables.LoadAssetAsync<Font>("Assets/Art/Fonts/riffic-bold.ttf"); |
|
|
|
rifficHandle.Completed += handle => |
|
|
|
/*AsyncOperationHandle<Font> fontHandle = Addressables.LoadAssetAsync<Font>("Assets/Plugins/TextMesh Pro/Fonts/LiberationSans.ttf"); |
|
|
|
fontHandle.Completed += handle => |
|
|
|
{ |
|
|
|
_riffic = handle.Result; |
|
|
|
_font = handle.Result; |
|
|
|
_defaultCompletion++; |
|
|
|
}; |
|
|
|
};*/ |
|
|
|
_font = Resources.Load<Font>("Assets/Plugins/TextMesh Pro/Fonts/LiberationSans.ttf"); |
|
|
|
// TODO generate larger textures with borders on them so it actually looks more like Techblox |
|
|
|
_blueBackground = new Texture2D(1, 1); |
|
|
|
_blueBackground.SetPixel(0, 0, new Color(0.004f, 0.522f, 0.847f) /* Techblox Blue */); |
|
|
|
_blueBackground.SetPixel(0, 0, new Color(0.004f, 0.522f, 0.847f) /* Gamecraft Blue, unused */); |
|
|
|
_blueBackground.Apply(); |
|
|
|
_grayBackground = new Texture2D(1, 1); |
|
|
|
_grayBackground.SetPixel(0, 0, new Color(0.745f, 0.745f, 0.745f) /* Gray */); |
|
|
|
_grayBackground.SetPixel(0, 0, new Color(0.11f, 0.11f, 0.11f, 1f) /* Very dark gray */); |
|
|
|
_grayBackground.Apply(); |
|
|
|
_whiteBackground = new Texture2D(1, 1); |
|
|
|
_whiteBackground.SetPixel(0, 0, new Color(0.898f, 0.898f, 0.898f) /* Very light gray */); |
|
|
|
_whiteBackground.SetPixel(0, 0, new Color(0.961f, 0.961f, 0.961f) /* Very light gray */); |
|
|
|
_whiteBackground.Apply(); |
|
|
|
_textInputBackground = new Texture2D(1, 1); |
|
|
|
_textInputBackground.SetPixel(0, 0, new Color(0f, 0f, 0f, 0.25f) /* Translucent gray */); |
|
|
|
_textInputBackground.SetPixel(0, 0, new Color(0.961f, 0.961f, 0.961f) /* Very light gray */); |
|
|
|
_textInputBackground.Apply(); |
|
|
|
_areaBackground = new Texture2D(1, 1); |
|
|
|
_areaBackground.SetPixel(0, 0, new Color(0f, 0f, 0f, 0.25f) /* Translucent gray */); |
|
|
|
_areaBackground.SetPixel(0, 0, new Color(0.051f, 0.051f, 0.051f, 1f) /* Very very dark gray */); |
|
|
|
_areaBackground.Apply(); |
|
|
|
/* // this is actually gray (used for the loading screen) |
|
|
|
AsyncOperationHandle<Texture2D> backgroundHandle = |
|
|
|
Addressables.LoadAssetAsync<Texture2D>("Assets/Art/Textures/UI/FrontEndMap/RCX_Blue_Background_5k.jpg"); |
|
|
|
backgroundHandle.Completed += handle => |
|
|
|
{ |
|
|
|
_blueBackground = handle.Result; |
|
|
|
_defaultCompletion++; |
|
|
|
};*/ |
|
|
|
_defaultCompletion++; |
|
|
|
} |
|
|
|
} |