2020-08-18 17:11:58 +10:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using Object = UnityEngine.Object;
|
|
|
|
|
|
|
|
|
|
namespace Explorer
|
|
|
|
|
{
|
|
|
|
|
public class UIStyles
|
|
|
|
|
{
|
|
|
|
|
public static Color LightGreen = new Color(Color.green.r - 0.3f, Color.green.g - 0.3f, Color.green.b - 0.3f);
|
|
|
|
|
|
|
|
|
|
public static GUISkin WindowSkin
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_customSkin == null)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
_customSkin = CreateWindowSkin();
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
_customSkin = GUI.skin;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _customSkin;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-01 18:03:44 +10:00
|
|
|
|
public static void HorizontalLine(Color _color, bool small = false)
|
2020-08-18 17:11:58 +10:00
|
|
|
|
{
|
2020-09-01 18:03:44 +10:00
|
|
|
|
var orig = GUI.color;
|
|
|
|
|
|
|
|
|
|
GUI.color = _color;
|
2020-09-14 01:42:29 +10:00
|
|
|
|
GUIUnstrip.Box(GUIContent.none, !small ? HorizontalBar : HorizontalBarSmall, null);
|
2020-09-01 18:03:44 +10:00
|
|
|
|
|
|
|
|
|
GUI.color = orig;
|
2020-08-18 17:11:58 +10:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static GUISkin _customSkin;
|
|
|
|
|
|
|
|
|
|
public static Texture2D m_nofocusTex;
|
|
|
|
|
public static Texture2D m_focusTex;
|
|
|
|
|
|
|
|
|
|
private static GUIStyle HorizontalBar
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_horizBarStyle == null)
|
|
|
|
|
{
|
|
|
|
|
_horizBarStyle = new GUIStyle();
|
|
|
|
|
_horizBarStyle.normal.background = Texture2D.whiteTexture;
|
2020-09-07 03:25:43 +10:00
|
|
|
|
var rectOffset = new RectOffset();
|
|
|
|
|
rectOffset.top = 4;
|
|
|
|
|
rectOffset.bottom = 4;
|
|
|
|
|
_horizBarStyle.margin = rectOffset;
|
2020-08-18 17:11:58 +10:00
|
|
|
|
_horizBarStyle.fixedHeight = 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _horizBarStyle;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-09-01 18:03:44 +10:00
|
|
|
|
private static GUIStyle _horizBarStyle;
|
|
|
|
|
|
|
|
|
|
private static GUIStyle HorizontalBarSmall
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
if (_horizBarSmallStyle == null)
|
|
|
|
|
{
|
|
|
|
|
_horizBarSmallStyle = new GUIStyle();
|
|
|
|
|
_horizBarSmallStyle.normal.background = Texture2D.whiteTexture;
|
2020-09-07 03:25:43 +10:00
|
|
|
|
var rectOffset = new RectOffset();
|
|
|
|
|
rectOffset.top = 2;
|
|
|
|
|
rectOffset.bottom = 2;
|
|
|
|
|
_horizBarSmallStyle.margin = rectOffset;
|
2020-09-01 18:03:44 +10:00
|
|
|
|
_horizBarSmallStyle.fixedHeight = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return _horizBarSmallStyle;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
private static GUIStyle _horizBarSmallStyle;
|
2020-08-18 17:11:58 +10:00
|
|
|
|
|
|
|
|
|
private static GUISkin CreateWindowSkin()
|
|
|
|
|
{
|
|
|
|
|
var newSkin = Object.Instantiate(GUI.skin);
|
|
|
|
|
Object.DontDestroyOnLoad(newSkin);
|
|
|
|
|
|
2020-08-30 07:01:13 +10:00
|
|
|
|
m_nofocusTex = MakeTex(1, 1, new Color(0.1f, 0.1f, 0.1f, 0.7f));
|
|
|
|
|
m_focusTex = MakeTex(1, 1, new Color(0.3f, 0.3f, 0.3f, 1f));
|
2020-08-18 17:11:58 +10:00
|
|
|
|
|
|
|
|
|
newSkin.window.normal.background = m_nofocusTex;
|
|
|
|
|
newSkin.window.onNormal.background = m_focusTex;
|
|
|
|
|
|
|
|
|
|
newSkin.box.normal.textColor = Color.white;
|
|
|
|
|
newSkin.window.normal.textColor = Color.white;
|
|
|
|
|
newSkin.button.normal.textColor = Color.white;
|
|
|
|
|
newSkin.textField.normal.textColor = Color.white;
|
|
|
|
|
newSkin.label.normal.textColor = Color.white;
|
|
|
|
|
|
|
|
|
|
return newSkin;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Texture2D MakeTex(int width, int height, Color col)
|
|
|
|
|
{
|
|
|
|
|
Color[] pix = new Color[width * height];
|
|
|
|
|
for (int i = 0; i < pix.Length; ++i)
|
|
|
|
|
{
|
|
|
|
|
pix[i] = col;
|
|
|
|
|
}
|
|
|
|
|
Texture2D result = new Texture2D(width, height);
|
|
|
|
|
result.SetPixels(pix);
|
|
|
|
|
result.Apply();
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|