Passion & UI
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
[CustomPropertyDrawer(typeof(Color))]
|
||||
public class ExtendedColorPicker : PropertyDrawer
|
||||
{
|
||||
public static Color colorValue = Color.white;
|
||||
private const float hexFW = 60f;
|
||||
private const float alphaFW = 32f;
|
||||
private const float spacing = 5f;
|
||||
|
||||
public static string ColorToString(Color32 color)
|
||||
{
|
||||
return color.r.ToString("X2") + color.g.ToString("X2") + color.b.ToString("X2") + color.a.ToString("X2");
|
||||
}
|
||||
|
||||
public static Color32 StringToColor(string colorStringValue)
|
||||
{
|
||||
int number = int.Parse(colorStringValue, NumberStyles.HexNumber);
|
||||
|
||||
Color32 colorResult;
|
||||
|
||||
if (colorStringValue.Length == 8)
|
||||
colorResult = new Color32((byte)(number >> 24 & 255), (byte)(number >> 16 & 255), (byte)(number >> 8 & 255), (byte)(number & 255));
|
||||
|
||||
else
|
||||
{
|
||||
if (colorStringValue.Length == 6)
|
||||
colorResult = new Color32((byte)(number >> 16 & 255), (byte)(number >> 8 & 255), (byte)(number & 255), 255);
|
||||
|
||||
else
|
||||
{
|
||||
if (colorStringValue.Length == 4)
|
||||
colorResult = new Color32((byte)((number >> 12 & 15) * 17), (byte)((number >> 8 & 15) * 17), (byte)((number >> 4 & 15) * 17), (byte)((number & 15) * 17));
|
||||
|
||||
else
|
||||
{
|
||||
if (colorStringValue.Length != 3)
|
||||
throw new FormatException("Supports only RRGGBBAA, RRGGBB, RGBA, RGB formats");
|
||||
|
||||
colorResult = new Color32((byte)((number >> 8 & 15) * 17), (byte)((number >> 4 & 15) * 17), (byte)((number & 15) * 17), 255);
|
||||
}
|
||||
}
|
||||
}
|
||||
return colorResult;
|
||||
}
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent title)
|
||||
{
|
||||
if (EditorPrefs.GetInt("ShiftUIManager.EnableExtendedColorPicker") == 1)
|
||||
{
|
||||
title = EditorGUI.BeginProperty(position, title, property);
|
||||
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), title);
|
||||
|
||||
var indent = EditorGUI.indentLevel;
|
||||
EditorGUI.indentLevel = 0;
|
||||
|
||||
float colorWidth = (position.width - hexFW - spacing - alphaFW - spacing);
|
||||
|
||||
Color32 color = property.colorValue;
|
||||
Color32 color2 = EditorGUI.ColorField(new Rect(position.x, position.y, colorWidth, position.height), property.colorValue);
|
||||
|
||||
if (!color2.Equals(color))
|
||||
property.colorValue = color = color2;
|
||||
|
||||
string colorStringValue = EditorGUI.TextField(new Rect((position.x + colorWidth + spacing), position.y, hexFW, position.height), ColorToString(color));
|
||||
|
||||
try
|
||||
{
|
||||
color2 = StringToColor(colorStringValue);
|
||||
|
||||
if (!color2.Equals(color))
|
||||
property.colorValue = color = color2;
|
||||
}
|
||||
|
||||
catch { }
|
||||
|
||||
float newAlpha = EditorGUI.Slider(new Rect((position.x + colorWidth + hexFW + (spacing * 2f)), position.y, alphaFW, position.height), property.colorValue.a, 0f, 1f);
|
||||
|
||||
if (!newAlpha.Equals(property.colorValue.a))
|
||||
property.colorValue = new Color(property.colorValue.r, property.colorValue.g, property.colorValue.b, newAlpha);
|
||||
|
||||
EditorGUI.indentLevel = indent;
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
title = EditorGUI.BeginProperty(position, title, property);
|
||||
position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), title);
|
||||
float colorWidth = (position.width);
|
||||
Color32 color = property.colorValue;
|
||||
Color32 color2 = EditorGUI.ColorField(new Rect(position.x, position.y, colorWidth, position.height), property.colorValue);
|
||||
|
||||
if (!color2.Equals(color))
|
||||
property.colorValue = color = color2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 293df69b897f24b4393214e11f80381b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Editor/Scripts/ExtendedColorPicker.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,28 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class InitShiftUI : MonoBehaviour
|
||||
{
|
||||
[InitializeOnLoad]
|
||||
public class InitOnLoad
|
||||
{
|
||||
static InitOnLoad()
|
||||
{
|
||||
if (!EditorPrefs.HasKey("ShiftUI.HasCustomEditorData"))
|
||||
{
|
||||
EditorPrefs.SetInt("ShiftUI.HasCustomEditorData", 1);
|
||||
|
||||
string mainPath = AssetDatabase.GetAssetPath(Resources.Load("Shift UI Manager"));
|
||||
mainPath = mainPath.Replace("Resources/Shift UI Manager.asset", "").Trim();
|
||||
string darkPath = mainPath + "Editor/Shift UI Skin Dark.guiskin";
|
||||
string lightPath = mainPath + "Editor/Shift UI Skin Light.guiskin";
|
||||
|
||||
EditorPrefs.SetString("ShiftUI.CustomEditorDark", darkPath);
|
||||
EditorPrefs.SetString("ShiftUI.CustomEditorLight", lightPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9572cf90453305b4c884eb7a28b94002
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Editor/Scripts/InitShiftUI.cs
|
||||
uploadId: 915518
|
||||
150
Assets/Shift - Complete Sci-Fi UI/Editor/Scripts/ToolsMenu.cs
Normal file
150
Assets/Shift - Complete Sci-Fi UI/Editor/Scripts/ToolsMenu.cs
Normal file
@@ -0,0 +1,150 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
public class ToolsMenu : Editor
|
||||
{
|
||||
static string objectPath;
|
||||
|
||||
static void GetObjectPath()
|
||||
{
|
||||
objectPath = AssetDatabase.GetAssetPath(Resources.Load("Shift UI Manager"));
|
||||
objectPath = objectPath.Replace("Resources/Shift UI Manager.asset", "").Trim();
|
||||
objectPath = objectPath + "Prefabs/";
|
||||
}
|
||||
|
||||
static void MakeSceneDirty(GameObject source, string sourceName)
|
||||
{
|
||||
if (Application.isPlaying == false)
|
||||
{
|
||||
Undo.RegisterCreatedObjectUndo(source, sourceName);
|
||||
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
|
||||
}
|
||||
}
|
||||
|
||||
static void ShowErrorDialog()
|
||||
{
|
||||
EditorUtility.DisplayDialog("Shift UI", "Cannot create the object due to missing manager file. " +
|
||||
"Make sure you have 'Shift UI Manager' file in Shift UI > Resources folder.", "Okay");
|
||||
}
|
||||
|
||||
static void UpdateCustomEditorPath()
|
||||
{
|
||||
string mainPath = AssetDatabase.GetAssetPath(Resources.Load("Shift UI Manager"));
|
||||
mainPath = mainPath.Replace("Resources/Shift UI Manager.asset", "").Trim();
|
||||
string darkPath = mainPath + "Editor/Shift UI Skin Dark.guiskin";
|
||||
string lightPath = mainPath + "Editor/Shift UI Skin Light.guiskin";
|
||||
|
||||
EditorPrefs.SetString("ShiftUI.CustomEditorDark", darkPath);
|
||||
EditorPrefs.SetString("ShiftUI.CustomEditorLight", lightPath);
|
||||
}
|
||||
|
||||
static void CreateObject(string resourcePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
GetObjectPath();
|
||||
UpdateCustomEditorPath();
|
||||
GameObject clone = Instantiate(AssetDatabase.LoadAssetAtPath(objectPath + resourcePath + ".prefab", typeof(GameObject)), Vector3.zero, Quaternion.identity) as GameObject;
|
||||
|
||||
try
|
||||
{
|
||||
if (Selection.activeGameObject == null)
|
||||
{
|
||||
#if UNITY_2023_2_OR_NEWER
|
||||
var canvas = FindObjectsByType<Canvas>(FindObjectsSortMode.None)[0];
|
||||
#else
|
||||
var canvas = (Canvas)GameObject.FindObjectsOfType(typeof(Canvas))[0];
|
||||
#endif
|
||||
clone.transform.SetParent(canvas.transform, false);
|
||||
}
|
||||
|
||||
else { clone.transform.SetParent(Selection.activeGameObject.transform, false); }
|
||||
|
||||
clone.name = clone.name.Replace("(Clone)", "").Trim();
|
||||
MakeSceneDirty(clone, clone.name);
|
||||
}
|
||||
|
||||
catch
|
||||
{
|
||||
CreateCanvas();
|
||||
#if UNITY_2023_2_OR_NEWER
|
||||
var canvas = FindObjectsByType<Canvas>(FindObjectsSortMode.None)[0];
|
||||
#else
|
||||
var canvas = (Canvas)GameObject.FindObjectsOfType(typeof(Canvas))[0];
|
||||
#endif
|
||||
clone.transform.SetParent(canvas.transform, false);
|
||||
clone.name = clone.name.Replace("(Clone)", "").Trim();
|
||||
MakeSceneDirty(clone, clone.name);
|
||||
}
|
||||
|
||||
Selection.activeObject = clone;
|
||||
}
|
||||
|
||||
catch { ShowErrorDialog(); }
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/Shift UI/Canvas", false, -1)]
|
||||
static void CreateCanvas()
|
||||
{
|
||||
try
|
||||
{
|
||||
GetObjectPath();
|
||||
UpdateCustomEditorPath();
|
||||
GameObject clone = Instantiate(AssetDatabase.LoadAssetAtPath(objectPath + "Other/Canvas" + ".prefab", typeof(GameObject)), Vector3.zero, Quaternion.identity) as GameObject;
|
||||
clone.name = clone.name.Replace("(Clone)", "").Trim();
|
||||
Selection.activeObject = clone;
|
||||
MakeSceneDirty(clone, clone.name);
|
||||
}
|
||||
|
||||
catch { ShowErrorDialog(); }
|
||||
}
|
||||
|
||||
[MenuItem("Tools/Shift UI/Show UI Manager")]
|
||||
static void ShowManager()
|
||||
{
|
||||
Selection.activeObject = Resources.Load("Shift UI Manager");
|
||||
|
||||
if (Selection.activeObject == null)
|
||||
Debug.Log("Can't find a file named 'Shift UI Manager'. Make sure you have 'Shift UI Manager' file in Resources folder.");
|
||||
}
|
||||
|
||||
[MenuItem("GameObject/Shift UI/Buttons/Chapter Button", false, 0)]
|
||||
static void BCB() { CreateObject("Button/Chapter Button"); }
|
||||
|
||||
[MenuItem("GameObject/Shift UI/Buttons/Icon Button", false, 0)]
|
||||
static void BIB() { CreateObject("Button/Icon Button"); }
|
||||
|
||||
[MenuItem("GameObject/Shift UI/Buttons/Main Button", false, 0)]
|
||||
static void BFMB() { CreateObject("Button/Main Button"); }
|
||||
|
||||
[MenuItem("GameObject/Shift UI/Buttons/Spotlight Button", false, 0)]
|
||||
static void BSB() { CreateObject("Button/Spotlight Button"); }
|
||||
|
||||
[MenuItem("GameObject/Shift UI/Dropdown/Standard", false, 0)]
|
||||
static void DST() { CreateObject("Dropdown/Dropdown"); }
|
||||
|
||||
[MenuItem("GameObject/Shift UI/Horizontal Selector/Standard", false, 0)]
|
||||
static void HSHS() { CreateObject("Horizontal Selector/Horizontal Selector"); }
|
||||
|
||||
[MenuItem("GameObject/Shift UI/Input Field/Standard (Left Aligned)", false, 0)]
|
||||
static void IFSLA() { CreateObject("Input Field/Standard (Left Aligned)"); }
|
||||
|
||||
[MenuItem("GameObject/Shift UI/Input Field/Standard (Middle Aligned)", false, 0)]
|
||||
static void IFSMA() { CreateObject("Input Field/Standard (Middle Aligned)"); }
|
||||
|
||||
[MenuItem("GameObject/Shift UI/Loaders/Default Loader", false, 0)]
|
||||
static void SPST() { CreateObject("Loader/Loading"); }
|
||||
|
||||
[MenuItem("GameObject/Shift UI/Scrollbar/Standard", false, 0)]
|
||||
static void SBSB() { CreateObject("Scrollbar/Scrollbar"); }
|
||||
|
||||
[MenuItem("GameObject/Shift UI/Slider/Standard", false, 0)]
|
||||
static void SLSL() { CreateObject("Slider/Slider"); }
|
||||
|
||||
[MenuItem("GameObject/Shift UI/Switch/Standard", false, 0)]
|
||||
static void SWSW() { CreateObject("Switch/Switch"); }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9bd6155d4e803934a9558b4b21949622
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Editor/Scripts/ToolsMenu.cs
|
||||
uploadId: 915518
|
||||
@@ -0,0 +1,276 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Presets;
|
||||
|
||||
namespace Michsky.UI.Shift
|
||||
{
|
||||
[CustomEditor(typeof(UIManager))]
|
||||
[System.Serializable]
|
||||
public class UIManagerEditor : Editor
|
||||
{
|
||||
GUISkin customSkin;
|
||||
protected static string buildID = "B16-20221231";
|
||||
protected static float foldoutItemSpace = 2;
|
||||
protected static float foldoutTopSpace = 5;
|
||||
protected static float foldoutBottomSpace = 2;
|
||||
|
||||
protected static bool showBackground = false;
|
||||
protected static bool showColors = false;
|
||||
protected static bool showFonts = false;
|
||||
protected static bool showLogo = false;
|
||||
protected static bool showParticle = false;
|
||||
protected static bool showSounds = false;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
if (EditorGUIUtility.isProSkin == true) { customSkin = (GUISkin)Resources.Load("Editor\\Shift UI Skin Dark"); }
|
||||
else { customSkin = (GUISkin)Resources.Load("Editor\\Shift UI Skin Light"); }
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
if (customSkin == null)
|
||||
{
|
||||
EditorGUILayout.HelpBox("Editor variables are missing. You can manually fix this by deleting " +
|
||||
"Shift UI > Resources folder and then re-import the package. \n\nIf you're still seeing this " +
|
||||
"dialog even after the re-import, contact me with this ID: " + buildID, MessageType.Error);
|
||||
|
||||
if (GUILayout.Button("Contact")) { Email(); }
|
||||
return;
|
||||
}
|
||||
|
||||
// Foldout style
|
||||
GUIStyle foldoutStyle = customSkin.FindStyle("UIM Foldout");
|
||||
|
||||
// UIM Header
|
||||
ShiftUIEditorHandler.DrawHeader(customSkin, "UIM Header", 8);
|
||||
GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
|
||||
// Background
|
||||
var backgroundType = serializedObject.FindProperty("backgroundType");
|
||||
var backgroundImage = serializedObject.FindProperty("backgroundImage");
|
||||
var backgroundPreserveAspect = serializedObject.FindProperty("backgroundPreserveAspect");
|
||||
var backgroundVideo = serializedObject.FindProperty("backgroundVideo");
|
||||
var backgroundSpeed = serializedObject.FindProperty("backgroundSpeed");
|
||||
var backgroundColorTint = serializedObject.FindProperty("backgroundColorTint");
|
||||
|
||||
GUILayout.Space(foldoutTopSpace);
|
||||
GUILayout.BeginHorizontal();
|
||||
showBackground = EditorGUILayout.Foldout(showBackground, "Background", true, foldoutStyle);
|
||||
showBackground = GUILayout.Toggle(showBackground, new GUIContent(""), customSkin.FindStyle("Toggle Helper"));
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space(foldoutBottomSpace);
|
||||
|
||||
|
||||
if (showBackground && backgroundType.enumValueIndex == 0)
|
||||
{
|
||||
ShiftUIEditorHandler.DrawProperty(backgroundType, customSkin, "Background Type");
|
||||
ShiftUIEditorHandler.DrawProperty(backgroundImage, customSkin, "Background Image");
|
||||
ShiftUIEditorHandler.DrawProperty(backgroundColorTint, customSkin, "Color Tint");
|
||||
ShiftUIEditorHandler.DrawProperty(backgroundPreserveAspect, customSkin, "Preserve Aspect");
|
||||
}
|
||||
|
||||
if (showBackground && backgroundType.enumValueIndex == 1)
|
||||
{
|
||||
ShiftUIEditorHandler.DrawProperty(backgroundType, customSkin, "Background Type");
|
||||
ShiftUIEditorHandler.DrawProperty(backgroundVideo, customSkin, "Background Video");
|
||||
ShiftUIEditorHandler.DrawProperty(backgroundColorTint, customSkin, "Color Tint");
|
||||
ShiftUIEditorHandler.DrawProperty(backgroundSpeed, customSkin, "Animation Speed");
|
||||
EditorGUILayout.HelpBox("Video Player will be used for background on Advanced mode.", MessageType.Info);
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.Space(foldoutItemSpace);
|
||||
GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
|
||||
// Colors
|
||||
var primaryColor = serializedObject.FindProperty("primaryColor");
|
||||
var secondaryColor = serializedObject.FindProperty("secondaryColor");
|
||||
var primaryReversed = serializedObject.FindProperty("primaryReversed");
|
||||
var negativeColor = serializedObject.FindProperty("negativeColor");
|
||||
var backgroundColor = serializedObject.FindProperty("backgroundColor");
|
||||
|
||||
GUILayout.Space(foldoutTopSpace);
|
||||
GUILayout.BeginHorizontal();
|
||||
showColors = EditorGUILayout.Foldout(showColors, "Colors", true, foldoutStyle);
|
||||
showColors = GUILayout.Toggle(showColors, new GUIContent(""), customSkin.FindStyle("Toggle Helper"));
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space(foldoutBottomSpace);
|
||||
|
||||
if (showColors)
|
||||
{
|
||||
ShiftUIEditorHandler.DrawProperty(primaryColor, customSkin, "Primary");
|
||||
ShiftUIEditorHandler.DrawProperty(secondaryColor, customSkin, "Secondary");
|
||||
ShiftUIEditorHandler.DrawProperty(primaryReversed, customSkin, "Primary Reversed");
|
||||
ShiftUIEditorHandler.DrawProperty(negativeColor, customSkin, "Negative");
|
||||
ShiftUIEditorHandler.DrawProperty(backgroundColor, customSkin, "Background");
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.Space(foldoutItemSpace);
|
||||
GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
|
||||
// Fonts
|
||||
var lightFont = serializedObject.FindProperty("lightFont");
|
||||
var regularFont = serializedObject.FindProperty("regularFont");
|
||||
var mediumFont = serializedObject.FindProperty("mediumFont");
|
||||
var semiBoldFont = serializedObject.FindProperty("semiBoldFont");
|
||||
var boldFont = serializedObject.FindProperty("boldFont");
|
||||
|
||||
GUILayout.Space(foldoutTopSpace);
|
||||
GUILayout.BeginHorizontal();
|
||||
showFonts = EditorGUILayout.Foldout(showFonts, "Fonts", true, foldoutStyle);
|
||||
showFonts = GUILayout.Toggle(showFonts, new GUIContent(""), customSkin.FindStyle("Toggle Helper"));
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space(foldoutBottomSpace);
|
||||
|
||||
if (showFonts)
|
||||
{
|
||||
ShiftUIEditorHandler.DrawProperty(lightFont, customSkin, "Light");
|
||||
ShiftUIEditorHandler.DrawProperty(regularFont, customSkin, "Regular");
|
||||
ShiftUIEditorHandler.DrawProperty(mediumFont, customSkin, "Medium");
|
||||
ShiftUIEditorHandler.DrawProperty(semiBoldFont, customSkin, "Semibold");
|
||||
ShiftUIEditorHandler.DrawProperty(boldFont, customSkin, "Bold");
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.Space(foldoutItemSpace);
|
||||
GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
|
||||
// Logo
|
||||
var gameLogo = serializedObject.FindProperty("gameLogo");
|
||||
var logoColor = serializedObject.FindProperty("logoColor");
|
||||
|
||||
GUILayout.Space(foldoutTopSpace);
|
||||
GUILayout.BeginHorizontal();
|
||||
showLogo = EditorGUILayout.Foldout(showLogo, "Logo", true, foldoutStyle);
|
||||
showLogo = GUILayout.Toggle(showLogo, new GUIContent(""), customSkin.FindStyle("Toggle Helper"));
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space(foldoutBottomSpace);
|
||||
|
||||
if (showLogo)
|
||||
{
|
||||
ShiftUIEditorHandler.DrawProperty(gameLogo, customSkin, "Game Logo");
|
||||
ShiftUIEditorHandler.DrawProperty(logoColor, customSkin, "Logo Color");
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.Space(foldoutItemSpace);
|
||||
GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
|
||||
// Particles
|
||||
var particleColor = serializedObject.FindProperty("particleColor");
|
||||
|
||||
GUILayout.Space(foldoutTopSpace);
|
||||
GUILayout.BeginHorizontal();
|
||||
showParticle = EditorGUILayout.Foldout(showParticle, "UI Particles", true, foldoutStyle);
|
||||
showParticle = GUILayout.Toggle(showParticle, new GUIContent(""), customSkin.FindStyle("Toggle Helper"));
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space(foldoutBottomSpace);
|
||||
|
||||
if (showParticle)
|
||||
{
|
||||
ShiftUIEditorHandler.DrawProperty(particleColor, customSkin, "Color");
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.Space(foldoutItemSpace);
|
||||
GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
|
||||
// Sounds
|
||||
var backgroundMusic = serializedObject.FindProperty("backgroundMusic");
|
||||
var hoverSound = serializedObject.FindProperty("hoverSound");
|
||||
var clickSound = serializedObject.FindProperty("clickSound");
|
||||
|
||||
GUILayout.Space(foldoutTopSpace);
|
||||
GUILayout.BeginHorizontal();
|
||||
showSounds = EditorGUILayout.Foldout(showSounds, "Sounds", true, foldoutStyle);
|
||||
showSounds = GUILayout.Toggle(showSounds, new GUIContent(""), customSkin.FindStyle("Toggle Helper"));
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space(foldoutBottomSpace);
|
||||
|
||||
if (showSounds)
|
||||
{
|
||||
ShiftUIEditorHandler.DrawProperty(backgroundMusic, customSkin, "Background Music");
|
||||
ShiftUIEditorHandler.DrawProperty(hoverSound, customSkin, "Hover SFX");
|
||||
ShiftUIEditorHandler.DrawProperty(clickSound, customSkin, "Click SFX");
|
||||
}
|
||||
|
||||
// Settings
|
||||
GUILayout.EndVertical();
|
||||
ShiftUIEditorHandler.DrawHeader(customSkin, "Options Header", 14);
|
||||
|
||||
var enableDynamicUpdate = serializedObject.FindProperty("enableDynamicUpdate");
|
||||
enableDynamicUpdate.boolValue = ShiftUIEditorHandler.DrawToggle(enableDynamicUpdate.boolValue, customSkin, "Update Values");
|
||||
|
||||
var enableExtendedColorPicker = serializedObject.FindProperty("enableExtendedColorPicker");
|
||||
enableExtendedColorPicker.boolValue = ShiftUIEditorHandler.DrawToggle(enableExtendedColorPicker.boolValue, customSkin, "Extended Color Picker");
|
||||
|
||||
if (enableExtendedColorPicker.boolValue == true) { EditorPrefs.SetInt("ShiftUIManager.EnableExtendedColorPicker", 1); }
|
||||
else { EditorPrefs.SetInt("ShiftUIManager.EnableExtendedColorPicker", 0); }
|
||||
|
||||
var editorHints = serializedObject.FindProperty("editorHints");
|
||||
|
||||
GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
GUILayout.Space(-3);
|
||||
editorHints.boolValue = ShiftUIEditorHandler.DrawTogglePlain(editorHints.boolValue, customSkin, "UI Manager Hints");
|
||||
GUILayout.Space(3);
|
||||
|
||||
if (editorHints.boolValue == true)
|
||||
{
|
||||
EditorGUILayout.HelpBox("These values are universal and affect all objects containing 'UI Manager' component.", MessageType.Info);
|
||||
EditorGUILayout.HelpBox("If want to assign unique values, remove 'UI Manager' component from the object ", MessageType.Info);
|
||||
EditorGUILayout.HelpBox("Navigate to 'Tools > Shift UI > Show UI Manager' to open this window quickly.", MessageType.Info);
|
||||
}
|
||||
|
||||
GUILayout.EndVertical();
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
Repaint();
|
||||
|
||||
GUILayout.Space(12);
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
if (GUILayout.Button(new GUIContent("Reset to defaults")))
|
||||
ResetToDefaults();
|
||||
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
// Support
|
||||
ShiftUIEditorHandler.DrawHeader(customSkin, "Support Header", 14);
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("Need help? Contact me via:", customSkin.FindStyle("Text"));
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("E-mail", customSkin.button)) { Email(); }
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.Space(6);
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.Label("ID: " + buildID);
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space(6);
|
||||
}
|
||||
|
||||
void Email() { Application.OpenURL("https://www.michsky.com/contact/"); }
|
||||
|
||||
void ResetToDefaults()
|
||||
{
|
||||
if (EditorUtility.DisplayDialog("Reset to defaults", "Are you sure you want to reset UI Manager values to default?", "Yes", "Cancel"))
|
||||
{
|
||||
try
|
||||
{
|
||||
Preset defaultPreset = Resources.Load<Preset>("Shift UI Presets/Default");
|
||||
defaultPreset.ApplyTo(Resources.Load("Shift UI Manager"));
|
||||
Selection.activeObject = null;
|
||||
Debug.Log("<b>[Shift UI Manager]</b> Resetting is successful.");
|
||||
}
|
||||
|
||||
catch { Debug.LogWarning("<b>[UI Manager]</b> Resetting failed. Default preset seems to be missing"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2cedb26dbd49279468881a7c5fe0cfa0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 157943
|
||||
packageName: Shift - Complete Sci-Fi UI
|
||||
packageVersion: 2.0.12
|
||||
assetPath: Assets/Shift - Complete Sci-Fi UI/Editor/Scripts/UIManagerEditor.cs
|
||||
uploadId: 915518
|
||||
Reference in New Issue
Block a user