Imported UI Assets

This commit is contained in:
MarcoHampel
2024-02-01 22:45:59 -05:00
parent 95a3f673f0
commit 5192d8b669
1355 changed files with 518302 additions and 153 deletions

View File

@ -0,0 +1,63 @@
using UnityEngine;
using TMPro;
namespace Michsky.UI.Heat
{
[CreateAssetMenu(fileName = "New UI Manager", menuName = "Heat UI/New UI Manager")]
public class UIManager : ScriptableObject
{
public static string buildID = "R201-230930";
// Settings
public bool enableDynamicUpdate = true;
// Achievements
public AchievementLibrary achievementLibrary;
public Color commonColor = new Color32(255, 255, 255, 255);
public Color rareColor = new Color32(255, 255, 255, 255);
public Color legendaryColor = new Color32(255, 255, 255, 255);
// Audio
public AudioClip hoverSound;
public AudioClip clickSound;
public AudioClip notificationSound;
// Colors
public Color accentColor = new Color32(255, 255, 255, 255);
public Color accentColorInvert = new Color32(255, 255, 255, 255);
public Color primaryColor = new Color32(255, 255, 255, 255);
public Color secondaryColor = new Color32(255, 255, 255, 255);
public Color negativeColor = new Color32(255, 255, 255, 255);
public Color backgroundColor = new Color32(255, 255, 255, 255);
// Fonts
public TMP_FontAsset fontLight;
public TMP_FontAsset fontRegular;
public TMP_FontAsset fontMedium;
public TMP_FontAsset fontSemiBold;
public TMP_FontAsset fontBold;
public TMP_FontAsset customFont;
// Localization
public bool enableLocalization;
public LocalizationSettings localizationSettings;
public static string localizationSaveKey = "GameLanguage_";
public LocalizationLanguage currentLanguage;
public static bool isLocalizationEnabled = false;
// Logo
public Sprite brandLogo;
public Sprite gameLogo;
// Splash Screen
public bool enableSplashScreen = true;
public bool showSplashScreenOnce = true;
public PressAnyKeyTextType pakType;
public string pakText = "Press {Any Key} To Start";
public string pakLocalizationText = "PAK_Part1 {PAK_Key} PAK_Part2";
public enum BackgroundType { Transparent, Dynamic, Static }
public enum PressAnyKeyTextType { Default, Custom }
public enum InputType { Legacy, InputSystem }
}
}

View File

@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: 9501c69babff75f45abcc8c316f59088
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- hoverSound: {instanceID: 0}
- clickSound: {instanceID: 0}
- dynamicBackground: {instanceID: 0}
- staticBackground: {instanceID: 0}
- fontLight: {instanceID: 0}
- fontRegular: {instanceID: 0}
- fontMedium: {instanceID: 0}
- fontSemiBold: {instanceID: 0}
- fontBold: {instanceID: 0}
- customFont: {instanceID: 0}
- localizationSettings: {fileID: 11400000, guid: 2cbd73cf0fc79bf4ab2e27e18b1ba7c8,
type: 2}
- brandLogo: {instanceID: 0}
- gameLogo: {instanceID: 0}
executionOrder: 0
icon: {fileID: 2800000, guid: 1c54b5f1316b2994e80ad22dbb16c23a, type: 3}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 264857
packageName: Heat - Complete Modern UI
packageVersion: 1.0.4
assetPath: Assets/Heat - Complete Modern UI/Scripts/UI Manager/UIManager.cs
uploadId: 629893

View File

@ -0,0 +1,71 @@
using UnityEngine;
using UnityEngine.Audio;
namespace Michsky.UI.Heat
{
[DisallowMultipleComponent]
[RequireComponent(typeof(AudioSource))]
public class UIManagerAudio : MonoBehaviour
{
// Static Instance
public static UIManagerAudio instance;
// Resources
public UIManager UIManagerAsset;
[SerializeField] private AudioMixer audioMixer;
public AudioSource audioSource;
[SerializeField] private SliderManager masterSlider;
[SerializeField] private SliderManager musicSlider;
[SerializeField] private SliderManager SFXSlider;
[SerializeField] private SliderManager UISlider;
void Awake()
{
instance = this;
}
void Start()
{
if (audioSource == null) { gameObject.GetComponent<AudioSource>(); }
InitVolume();
}
public void InitVolume()
{
if (audioMixer == null)
{
Debug.Log("Audio Mixer is missing, cannot initialize the volume.", this);
return;
}
if (masterSlider != null)
{
audioMixer.SetFloat("Master", Mathf.Log10(PlayerPrefs.GetFloat("Slider_" + masterSlider.saveKey)) * 20);
masterSlider.mainSlider.onValueChanged.AddListener(SetMasterVolume);
}
if (musicSlider != null)
{
audioMixer.SetFloat("Music", Mathf.Log10(PlayerPrefs.GetFloat("Slider_" + musicSlider.saveKey)) * 20);
musicSlider.mainSlider.onValueChanged.AddListener(SetMusicVolume);
}
if (SFXSlider != null)
{
audioMixer.SetFloat("SFX", Mathf.Log10(PlayerPrefs.GetFloat("Slider_" + SFXSlider.saveKey)) * 20);
SFXSlider.mainSlider.onValueChanged.AddListener(SetSFXVolume);
}
if (UISlider != null)
{
audioMixer.SetFloat("UI", Mathf.Log10(PlayerPrefs.GetFloat("Slider_" + UISlider.saveKey)) * 20);
UISlider.mainSlider.onValueChanged.AddListener(SetUIVolume);
}
}
public void SetMasterVolume(float volume) { audioMixer.SetFloat("Master", Mathf.Log10(volume) * 20); }
public void SetMusicVolume(float volume) { audioMixer.SetFloat("Music", Mathf.Log10(volume) * 20); }
public void SetSFXVolume(float volume) { audioMixer.SetFloat("SFX", Mathf.Log10(volume) * 20); }
public void SetUIVolume(float volume) { audioMixer.SetFloat("UI", Mathf.Log10(volume) * 20); }
}
}

View File

@ -0,0 +1,25 @@
fileFormatVersion: 2
guid: ebb92b8c96c064044866433e713124c5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- UIManagerAsset: {fileID: 11400000, guid: 98972d851a944df4a9402eac62a896e7, type: 2}
- audioMixer: {fileID: 24100000, guid: fd2e95e311c5b5e4da32b572f6628427, type: 2}
- audioSource: {instanceID: 0}
- masterSlider: {instanceID: 0}
- musicSlider: {instanceID: 0}
- SFXSlider: {instanceID: 0}
- UISlider: {instanceID: 0}
executionOrder: 0
icon: {fileID: 2800000, guid: a423f273d3e14b1428a9709cc6fece1a, type: 3}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 264857
packageName: Heat - Complete Modern UI
packageVersion: 1.0.4
assetPath: Assets/Heat - Complete Modern UI/Scripts/UI Manager/UIManagerAudio.cs
uploadId: 629893

View File

@ -0,0 +1,48 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
namespace Michsky.UI.Heat
{
[CanEditMultipleObjects]
[CustomEditor(typeof(UIManagerAudio))]
public class UIManagerAudioEditor : Editor
{
private UIManagerAudio uimaTarget;
private GUISkin customSkin;
private void OnEnable()
{
uimaTarget = (UIManagerAudio)target;
if (EditorGUIUtility.isProSkin == true) { customSkin = HeatUIEditorHandler.GetDarkEditor(customSkin); }
else { customSkin = HeatUIEditorHandler.GetLightEditor(customSkin); }
}
public override void OnInspectorGUI()
{
var UIManagerAsset = serializedObject.FindProperty("UIManagerAsset");
var audioMixer = serializedObject.FindProperty("audioMixer");
var audioSource = serializedObject.FindProperty("audioSource");
var masterSlider = serializedObject.FindProperty("masterSlider");
var musicSlider = serializedObject.FindProperty("musicSlider");
var SFXSlider = serializedObject.FindProperty("SFXSlider");
var UISlider = serializedObject.FindProperty("UISlider");
HeatUIEditorHandler.DrawHeader(customSkin, "Core Header", 6);
HeatUIEditorHandler.DrawProperty(UIManagerAsset, customSkin, "UI Manager");
HeatUIEditorHandler.DrawProperty(audioMixer, customSkin, "Audio Mixer");
HeatUIEditorHandler.DrawProperty(audioSource, customSkin, "Audio Source");
HeatUIEditorHandler.DrawProperty(masterSlider, customSkin, "Master Slider");
HeatUIEditorHandler.DrawProperty(musicSlider, customSkin, "Music Slider");
HeatUIEditorHandler.DrawProperty(SFXSlider, customSkin, "SFX Slider");
HeatUIEditorHandler.DrawProperty(UISlider, customSkin, "UI Slider");
if (Application.isPlaying == true)
return;
serializedObject.ApplyModifiedProperties();
}
}
}
#endif

View File

@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: e341fe9eb7f33f84c89d11187d695dd4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 264857
packageName: Heat - Complete Modern UI
packageVersion: 1.0.4
assetPath: Assets/Heat - Complete Modern UI/Scripts/UI Manager/UIManagerAudioEditor.cs
uploadId: 629893

View File

@ -0,0 +1,57 @@
using UnityEngine;
namespace Michsky.UI.Heat
{
[AddComponentMenu("Heat UI/UI Manager/UI Manager Color Changer")]
public class UIManagerColorChanger : MonoBehaviour
{
[Header("Resources")]
public UIManager targetUIManager;
[Header("Colors")]
public Color accent = new Color32(0, 200, 255, 255);
public Color accentMatch = new Color32(25, 35, 45, 255);
public Color primary = new Color32(255, 255, 255, 255);
public Color secondary = new Color32(255, 255, 255, 255);
public Color negative = new Color32(255, 75, 75, 255);
public Color background = new Color32(25, 35, 45, 255);
[Header("Settings")]
[SerializeField] private bool applyOnStart;
void Start()
{
if (applyOnStart == true)
{
ApplyColors();
}
}
public void ApplyColors()
{
if (targetUIManager == null)
{
Debug.LogError("Cannot apply the changes due to missing 'Target UI Manager'.", this);
return;
}
targetUIManager.accentColor = accent;
targetUIManager.accentColorInvert = accentMatch;
targetUIManager.primaryColor = primary;
targetUIManager.secondaryColor = secondary;
targetUIManager.negativeColor = negative;
targetUIManager.backgroundColor = background;
if (targetUIManager.enableDynamicUpdate == false)
{
targetUIManager.enableDynamicUpdate = true;
Invoke("DisableDynamicUpdate", 1);
}
}
void DisableDynamicUpdate()
{
targetUIManager.enableDynamicUpdate = false;
}
}
}

View File

@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: a3c25080034f88644b8605258cc435d0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- targetUIManager: {fileID: 11400000, guid: 98972d851a944df4a9402eac62a896e7, type: 2}
executionOrder: 0
icon: {fileID: 2800000, guid: 1c54b5f1316b2994e80ad22dbb16c23a, type: 3}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 264857
packageName: Heat - Complete Modern UI
packageVersion: 1.0.4
assetPath: Assets/Heat - Complete Modern UI/Scripts/UI Manager/UIManagerColorChanger.cs
uploadId: 629893

View File

@ -0,0 +1,360 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
using UnityEditor.Presets;
namespace Michsky.UI.Heat
{
[CustomEditor(typeof(UIManager))]
[System.Serializable]
public class UIManagerEditor : Editor
{
GUISkin customSkin;
private UIManager uimTarget;
protected static float foldoutItemSpace = 2;
protected static float foldoutTopSpace = 5;
protected static float foldoutBottomSpace = 2;
protected static bool showAch = false;
protected static bool showAudio = false;
protected static bool showColors = false;
protected static bool showFonts = false;
protected static bool showLocalization = false;
protected static bool showLogo = false;
protected static bool showSplashScreen = false;
private void OnEnable()
{
uimTarget = (UIManager)target;
if (EditorGUIUtility.isProSkin == true) { customSkin = HeatUIEditorHandler.GetDarkEditor(customSkin); }
else { customSkin = HeatUIEditorHandler.GetLightEditor(customSkin); }
}
public override void OnInspectorGUI()
{
if (customSkin == null)
{
EditorGUILayout.HelpBox("Editor resources are missing. You can manually fix this by deleting " +
"Heat UI > Editor 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: " + UIManager.buildID, MessageType.Error);
if (GUILayout.Button("Contact")) { Email(); }
return;
}
// Foldout style
GUIStyle foldoutStyle = customSkin.FindStyle("UIM Foldout");
// UIM Header
HeatUIEditorHandler.DrawHeader(customSkin, "UIM Header", 8);
#region Achievements
GUILayout.BeginVertical(EditorStyles.helpBox);
GUILayout.Space(foldoutTopSpace);
GUILayout.BeginHorizontal();
showAch = EditorGUILayout.Foldout(showAch, "Achievements", true, foldoutStyle);
showAch = GUILayout.Toggle(showAch, new GUIContent(""), customSkin.FindStyle("Toggle Helper"));
GUILayout.EndHorizontal();
GUILayout.Space(foldoutBottomSpace);
if (showAch)
{
var achievementLibrary = serializedObject.FindProperty("achievementLibrary");
var commonColor = serializedObject.FindProperty("commonColor");
var rareColor = serializedObject.FindProperty("rareColor");
var legendaryColor = serializedObject.FindProperty("legendaryColor");
HeatUIEditorHandler.DrawProperty(achievementLibrary, customSkin, "Achievement Library");
if (uimTarget.achievementLibrary != null && GUILayout.Button("Show Library", customSkin.button)) { Selection.activeObject = uimTarget.achievementLibrary; }
HeatUIEditorHandler.DrawProperty(commonColor, customSkin, "Common Color");
HeatUIEditorHandler.DrawProperty(rareColor, customSkin, "Rare Color");
HeatUIEditorHandler.DrawProperty(legendaryColor, customSkin, "Legendary Color");
}
GUILayout.EndVertical();
GUILayout.Space(foldoutItemSpace);
#endregion
#region Audio
GUILayout.BeginVertical(EditorStyles.helpBox);
GUILayout.Space(foldoutTopSpace);
GUILayout.BeginHorizontal();
showAudio = EditorGUILayout.Foldout(showAudio, "Audio", true, foldoutStyle);
showAudio = GUILayout.Toggle(showAudio, new GUIContent(""), customSkin.FindStyle("Toggle Helper"));
GUILayout.EndHorizontal();
GUILayout.Space(foldoutBottomSpace);
if (showAudio)
{
var hoverSound = serializedObject.FindProperty("hoverSound");
var clickSound = serializedObject.FindProperty("clickSound");
var notificationSound = serializedObject.FindProperty("notificationSound");
HeatUIEditorHandler.DrawProperty(hoverSound, customSkin, "Hover Sound");
HeatUIEditorHandler.DrawProperty(clickSound, customSkin, "Click Sound");
HeatUIEditorHandler.DrawProperty(notificationSound, customSkin, "Notification Sound");
}
GUILayout.EndVertical();
GUILayout.Space(foldoutItemSpace);
#endregion
#region Colors
GUILayout.BeginVertical(EditorStyles.helpBox);
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)
{
var accentColor = serializedObject.FindProperty("accentColor");
var accentColorInvert = serializedObject.FindProperty("accentColorInvert");
var primaryColor = serializedObject.FindProperty("primaryColor");
var secondaryColor = serializedObject.FindProperty("secondaryColor");
var negativeColor = serializedObject.FindProperty("negativeColor");
var backgroundColor = serializedObject.FindProperty("backgroundColor");
var altBackgroundColor = serializedObject.FindProperty("altBackgroundColor");
HeatUIEditorHandler.DrawProperty(accentColor, customSkin, "Accent Color");
HeatUIEditorHandler.DrawProperty(accentColorInvert, customSkin, "Accent Match");
HeatUIEditorHandler.DrawProperty(primaryColor, customSkin, "Primary Color");
HeatUIEditorHandler.DrawProperty(secondaryColor, customSkin, "Secondary Color");
HeatUIEditorHandler.DrawProperty(negativeColor, customSkin, "Negative Color");
HeatUIEditorHandler.DrawProperty(backgroundColor, customSkin, "Background Color");
}
GUILayout.EndVertical();
GUILayout.Space(foldoutItemSpace);
#endregion
#region Fonts
GUILayout.BeginVertical(EditorStyles.helpBox);
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)
{
var fontLight = serializedObject.FindProperty("fontLight");
var fontRegular = serializedObject.FindProperty("fontRegular");
var fontMedium = serializedObject.FindProperty("fontMedium");
var fontSemiBold = serializedObject.FindProperty("fontSemiBold");
var fontBold = serializedObject.FindProperty("fontBold");
var customFont = serializedObject.FindProperty("customFont");
HeatUIEditorHandler.DrawProperty(fontLight, customSkin, "Light Font");
HeatUIEditorHandler.DrawProperty(fontRegular, customSkin, "Regular Font");
HeatUIEditorHandler.DrawProperty(fontMedium, customSkin, "Medium Font");
HeatUIEditorHandler.DrawProperty(fontSemiBold, customSkin, "Semibold Font");
HeatUIEditorHandler.DrawProperty(fontBold, customSkin, "Bold Font");
HeatUIEditorHandler.DrawProperty(customFont, customSkin, "Custom Font");
}
GUILayout.EndVertical();
GUILayout.Space(foldoutItemSpace);
#endregion
#region Localization
GUILayout.BeginVertical(EditorStyles.helpBox);
GUILayout.Space(foldoutTopSpace);
GUILayout.BeginHorizontal();
showLocalization = EditorGUILayout.Foldout(showLocalization, "Localization", true, foldoutStyle);
showLocalization = GUILayout.Toggle(showLocalization, new GUIContent(""), customSkin.FindStyle("Toggle Helper"));
GUILayout.EndHorizontal();
GUILayout.Space(foldoutBottomSpace);
if (showLocalization)
{
var enableLocalization = serializedObject.FindProperty("enableLocalization");
var localizationSettings = serializedObject.FindProperty("localizationSettings");
enableLocalization.boolValue = HeatUIEditorHandler.DrawToggle(enableLocalization.boolValue, customSkin, "Enable Localization (Beta)");
if (enableLocalization.boolValue == true)
{
HeatUIEditorHandler.DrawPropertyCW(localizationSettings, customSkin, "Localization Settings", 130);
if (uimTarget.localizationSettings != null)
{
if (GUILayout.Button("Open Localization Settings", customSkin.button)) { Selection.activeObject = uimTarget.localizationSettings; }
EditorGUILayout.HelpBox("Localization is enabled. You can use the localization settings asset to manage localization.", MessageType.Info);
}
else { EditorGUILayout.HelpBox("Localization is enabled, but 'Localization Settings' is missing.", MessageType.Warning); }
}
}
GUILayout.EndVertical();
GUILayout.Space(foldoutItemSpace);
#endregion
#region Logo
GUILayout.BeginVertical(EditorStyles.helpBox);
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)
{
var brandLogo = serializedObject.FindProperty("brandLogo");
var gameLogo = serializedObject.FindProperty("gameLogo");
HeatUIEditorHandler.DrawProperty(brandLogo, customSkin, "Brand Logo");
HeatUIEditorHandler.DrawProperty(gameLogo, customSkin, "Game Logo");
}
GUILayout.EndVertical();
GUILayout.Space(foldoutItemSpace);
#endregion
#region Splash Screen
GUILayout.BeginVertical(EditorStyles.helpBox);
GUILayout.Space(foldoutTopSpace);
GUILayout.BeginHorizontal();
showSplashScreen = EditorGUILayout.Foldout(showSplashScreen, "Splash Screen", true, foldoutStyle);
showSplashScreen = GUILayout.Toggle(showSplashScreen, new GUIContent(""), customSkin.FindStyle("Toggle Helper"));
GUILayout.EndHorizontal();
GUILayout.Space(foldoutBottomSpace);
if (showSplashScreen)
{
var enableSplashScreen = serializedObject.FindProperty("enableSplashScreen");
var showSplashScreenOnce = serializedObject.FindProperty("showSplashScreenOnce");
var pakType = serializedObject.FindProperty("pakType");
var pakText = serializedObject.FindProperty("pakText");
var pakLocalizationText = serializedObject.FindProperty("pakLocalizationText");
enableSplashScreen.boolValue = HeatUIEditorHandler.DrawToggle(enableSplashScreen.boolValue, customSkin, "Enable Splash Screen");
if (enableSplashScreen.boolValue == false) { GUI.enabled = false; }
showSplashScreenOnce.boolValue = HeatUIEditorHandler.DrawToggle(showSplashScreenOnce.boolValue, customSkin, "Show Only Once", "Only appears in the current session when enabled.");
HeatUIEditorHandler.DrawProperty(pakType, customSkin, "Press Any Key Type");
if (pakType.enumValueIndex == 0)
{
if (uimTarget.enableLocalization == true)
{
HeatUIEditorHandler.DrawProperty(pakLocalizationText, customSkin, "Press Any Key Text");
EditorGUILayout.HelpBox("Localization formatting: {StringKey}" + "\nDefault: PAK_Part1 {PAK_Key} PAK_Part3"
+ "\nDefault output: Press [Any Key] To Start", MessageType.Info);
}
else
{
HeatUIEditorHandler.DrawProperty(pakText, customSkin, "Press Any Key Text");
EditorGUILayout.HelpBox("Formatting: {Key Text}" + "\nSample: Press {Any Key} To Start", MessageType.Info);
}
}
}
GUI.enabled = true;
GUILayout.EndVertical();
GUILayout.Space(foldoutItemSpace);
#endregion
#region Settings
HeatUIEditorHandler.DrawHeader(customSkin, "Options Header", 14);
var enableDynamicUpdate = serializedObject.FindProperty("enableDynamicUpdate");
GUILayout.BeginVertical(EditorStyles.helpBox);
GUILayout.Space(-2);
GUILayout.BeginHorizontal();
enableDynamicUpdate.boolValue = GUILayout.Toggle(enableDynamicUpdate.boolValue, new GUIContent("Enable Dynamic Update"), customSkin.FindStyle("Toggle"));
enableDynamicUpdate.boolValue = GUILayout.Toggle(enableDynamicUpdate.boolValue, new GUIContent(""), customSkin.FindStyle("Toggle Helper"));
GUILayout.EndHorizontal();
GUILayout.Space(4);
if (enableDynamicUpdate.boolValue == true)
{
EditorGUILayout.HelpBox("When this option is enabled, all objects connected to this manager will be dynamically updated synchronously. " +
"Basically; consumes more resources, but allows dynamic changes at runtime/editor.", MessageType.Info);
}
else
{
EditorGUILayout.HelpBox("When this option is disabled, all objects connected to this manager will be updated only once on awake. " +
"Basically; has better performance, but it's static.", MessageType.Info);
}
GUILayout.EndVertical();
GUILayout.BeginHorizontal();
if (GUILayout.Button("Reset to defaults", customSkin.button)) { ResetToDefaults(); }
GUILayout.EndHorizontal();
#endregion
#region Integrations
HeatUIEditorHandler.DrawHeader(customSkin, "Integrations Header", 16);
if (GUILayout.Button("Assembly Definition Patch", customSkin.button)) { Application.OpenURL("https://docs.michsky.com/docs/heat-ui/others/"); }
#endregion
#region Support
HeatUIEditorHandler.DrawHeader(customSkin, "Support Header", 16);
GUILayout.BeginVertical();
GUILayout.BeginHorizontal();
GUILayout.Label("Need help? Contact me via:", customSkin.FindStyle("Text"));
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
if (GUILayout.Button("Discord", customSkin.button)) { Discord(); }
if (GUILayout.Button("Twitter", customSkin.button)) { Twitter(); }
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
if (GUILayout.Button("Documentation", customSkin.button)) { Docs(); }
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: " + UIManager.buildID);
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.Space(6);
#endregion
serializedObject.ApplyModifiedProperties();
if (Application.isPlaying == false) { Repaint(); }
}
void Discord() { Application.OpenURL("https://discord.gg/VXpHyUt"); }
void Docs() { Application.OpenURL("https://docs.michsky.com/docs/heat-ui/"); }
void Email() { Application.OpenURL("https://www.michsky.com/contact/"); }
void Twitter() { Application.OpenURL("https://www.twitter.com/michskyHQ"); }
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>("HUIM Presets/Default");
defaultPreset.ApplyTo(Resources.Load("Heat UI Manager"));
Selection.activeObject = null;
Selection.activeObject = Resources.Load("Heat UI Manager");
Debug.Log("<b>[UI Manager]</b> Resetting successful.");
}
catch { Debug.LogWarning("<b>[UI Manager]</b> Resetting failed. Default preset seems to be missing."); }
}
}
}
}
#endif

View File

@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 015246d3bc6694040b823e2c0c740baa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 264857
packageName: Heat - Complete Modern UI
packageVersion: 1.0.4
assetPath: Assets/Heat - Complete Modern UI/Scripts/UI Manager/UIManagerEditor.cs
uploadId: 629893

View File

@ -0,0 +1,58 @@
using UnityEngine;
using TMPro;
namespace Michsky.UI.Heat
{
[AddComponentMenu("Heat UI/UI Manager/UI Manager Font Changer")]
public class UIManagerFontChanger : MonoBehaviour
{
[Header("Resources")]
public UIManager targetUIManager;
[Header("Fonts")]
public TMP_FontAsset lightFont;
public TMP_FontAsset regularFont;
public TMP_FontAsset mediumFont;
public TMP_FontAsset semiboldFont;
public TMP_FontAsset boldFont;
public TMP_FontAsset customFont;
[Header("Settings")]
[SerializeField] private bool applyOnStart;
void Start()
{
if (applyOnStart == true)
{
ApplyFonts();
}
}
public void ApplyFonts()
{
if (targetUIManager == null)
{
Debug.LogError("Cannot apply the changes due to missing 'Target UI Manager'.", this);
return;
}
if (lightFont != null) { targetUIManager.fontLight = lightFont; }
if (regularFont != null) { targetUIManager.fontRegular = regularFont; }
if (mediumFont != null) { targetUIManager.fontMedium = mediumFont; }
if (semiboldFont != null) { targetUIManager.fontSemiBold = semiboldFont; }
if (boldFont != null) { targetUIManager.fontBold = boldFont; }
if (customFont != null) { targetUIManager.customFont = customFont; }
if (targetUIManager.enableDynamicUpdate == false)
{
targetUIManager.enableDynamicUpdate = true;
Invoke("DisableDynamicUpdate", 1);
}
}
void DisableDynamicUpdate()
{
targetUIManager.enableDynamicUpdate = false;
}
}
}

View File

@ -0,0 +1,25 @@
fileFormatVersion: 2
guid: e81cb6854ffcc004b9fcfa2249bfc36b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- targetUIManager: {fileID: 11400000, guid: 98972d851a944df4a9402eac62a896e7, type: 2}
- lightFont: {fileID: 11400000, guid: a4412f15afcccfd4591f5f064f5004b4, type: 2}
- regularFont: {fileID: 11400000, guid: 2a97c72100ce9a34eb2d3c2e68bca265, type: 2}
- mediumFont: {fileID: 11400000, guid: 8322a83c36dbf604db8a075474b12c47, type: 2}
- semiboldFont: {fileID: 11400000, guid: e62ece968382eaf44897316c9daaf99e, type: 2}
- boldFont: {fileID: 11400000, guid: f89ce2922ef89ae46adc711adf2e04ef, type: 2}
- customFont: {instanceID: 0}
executionOrder: 0
icon: {fileID: 2800000, guid: 1c54b5f1316b2994e80ad22dbb16c23a, type: 3}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 264857
packageName: Heat - Complete Modern UI
packageVersion: 1.0.4
assetPath: Assets/Heat - Complete Modern UI/Scripts/UI Manager/UIManagerFontChanger.cs
uploadId: 629893

View File

@ -0,0 +1,65 @@
using UnityEngine;
using UnityEngine.UI;
namespace Michsky.UI.Heat
{
[ExecuteInEditMode]
[DisallowMultipleComponent]
[RequireComponent(typeof(Image))]
[AddComponentMenu("Heat UI/UI Manager/UI Manager Image")]
public class UIManagerImage : MonoBehaviour
{
// Resources
public UIManager UIManagerAsset;
private Image objImage;
// Settings
public ColorType colorType = ColorType.Primary;
public bool useCustomColor;
public bool useCustomAlpha;
public enum ColorType { Accent, AccentMatch, Primary, Secondary, Negative, Background }
void Awake()
{
this.enabled = true;
if (UIManagerAsset == null) { UIManagerAsset = Resources.Load<UIManager>("Heat UI Manager"); }
if (objImage == null) { objImage = GetComponent<Image>(); }
if (UIManagerAsset.enableDynamicUpdate == false) { UpdateImage(); this.enabled = false; }
}
void Update()
{
if (UIManagerAsset == null) { return; }
if (UIManagerAsset.enableDynamicUpdate == true) { UpdateImage(); }
}
void UpdateImage()
{
if (objImage == null || useCustomColor == true)
return;
if (useCustomAlpha == false)
{
if (colorType == ColorType.Primary && objImage.color != UIManagerAsset.primaryColor) { objImage.color = UIManagerAsset.primaryColor; }
else if (colorType == ColorType.Secondary && objImage.color != UIManagerAsset.secondaryColor) { objImage.color = UIManagerAsset.secondaryColor; }
else if (colorType == ColorType.Accent && objImage.color != UIManagerAsset.accentColor) { objImage.color = UIManagerAsset.accentColor; }
else if (colorType == ColorType.AccentMatch && objImage.color != UIManagerAsset.accentColorInvert) { objImage.color = UIManagerAsset.accentColorInvert; }
else if (colorType == ColorType.Negative && objImage.color != UIManagerAsset.negativeColor) { objImage.color = UIManagerAsset.negativeColor; }
else if (colorType == ColorType.Background && objImage.color != UIManagerAsset.backgroundColor) { objImage.color = UIManagerAsset.backgroundColor; }
}
else
{
if (colorType == ColorType.Primary) { objImage.color = new Color(UIManagerAsset.primaryColor.r, UIManagerAsset.primaryColor.g, UIManagerAsset.primaryColor.b, objImage.color.a); }
else if (colorType == ColorType.Secondary) { objImage.color = new Color(UIManagerAsset.secondaryColor.r, UIManagerAsset.secondaryColor.g, UIManagerAsset.secondaryColor.b, objImage.color.a); }
else if (colorType == ColorType.Accent) { objImage.color = new Color(UIManagerAsset.accentColor.r, UIManagerAsset.accentColor.g, UIManagerAsset.accentColor.b, objImage.color.a); }
else if (colorType == ColorType.AccentMatch) { objImage.color = new Color(UIManagerAsset.accentColorInvert.r, UIManagerAsset.accentColorInvert.g, UIManagerAsset.accentColorInvert.b, objImage.color.a); }
else if (colorType == ColorType.Negative) { objImage.color = new Color(UIManagerAsset.negativeColor.r, UIManagerAsset.negativeColor.g, UIManagerAsset.negativeColor.b, objImage.color.a); }
else if (colorType == ColorType.Background) { objImage.color = new Color(UIManagerAsset.backgroundColor.r, UIManagerAsset.backgroundColor.g, UIManagerAsset.backgroundColor.b, objImage.color.a); }
}
}
}
}

View File

@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 4b2b57f7cfdb57f40b117d700d46eb6a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- UIManagerAsset: {fileID: 11400000, guid: 98972d851a944df4a9402eac62a896e7, type: 2}
executionOrder: 0
icon: {fileID: 2800000, guid: 1c54b5f1316b2994e80ad22dbb16c23a, type: 3}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 264857
packageName: Heat - Complete Modern UI
packageVersion: 1.0.4
assetPath: Assets/Heat - Complete Modern UI/Scripts/UI Manager/UIManagerImage.cs
uploadId: 629893

View File

@ -0,0 +1,47 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
namespace Michsky.UI.Heat
{
[CustomEditor(typeof(UIManagerImage))]
public class UIManagerImageEditor : Editor
{
private UIManagerImage uimiTarget;
private GUISkin customSkin;
private void OnEnable()
{
uimiTarget = (UIManagerImage)target;
if (EditorGUIUtility.isProSkin == true) { customSkin = HeatUIEditorHandler.GetDarkEditor(customSkin); }
else { customSkin = HeatUIEditorHandler.GetLightEditor(customSkin); }
}
public override void OnInspectorGUI()
{
var UIManagerAsset = serializedObject.FindProperty("UIManagerAsset");
var colorType = serializedObject.FindProperty("colorType");
var useCustomColor = serializedObject.FindProperty("useCustomColor");
var useCustomAlpha = serializedObject.FindProperty("useCustomAlpha");
HeatUIEditorHandler.DrawHeader(customSkin, "Core Header", 6);
HeatUIEditorHandler.DrawProperty(UIManagerAsset, customSkin, "UI Manager");
HeatUIEditorHandler.DrawHeader(customSkin, "Options Header", 10);
if (uimiTarget.UIManagerAsset != null)
{
HeatUIEditorHandler.DrawProperty(colorType, customSkin, "Color Type");
useCustomColor.boolValue = HeatUIEditorHandler.DrawToggle(useCustomColor.boolValue, customSkin, "Use Custom Color");
if (useCustomColor.boolValue == true) { GUI.enabled = false; }
useCustomAlpha.boolValue = HeatUIEditorHandler.DrawToggle(useCustomAlpha.boolValue, customSkin, "Use Custom Alpha");
}
else { EditorGUILayout.HelpBox("UI Manager should be assigned.", MessageType.Error); }
serializedObject.ApplyModifiedProperties();
}
}
}
#endif

View File

@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: ed0aefa62811a2240870e6269a474eeb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 264857
packageName: Heat - Complete Modern UI
packageVersion: 1.0.4
assetPath: Assets/Heat - Complete Modern UI/Scripts/UI Manager/UIManagerImageEditor.cs
uploadId: 629893

View File

@ -0,0 +1,45 @@
using UnityEngine;
using UnityEngine.UI;
namespace Michsky.UI.Heat
{
[ExecuteInEditMode]
[DisallowMultipleComponent]
[AddComponentMenu("Heat UI/UI Manager/UI Manager Logo")]
public class UIManagerLogo : MonoBehaviour
{
// Resources
public UIManager UIManagerAsset;
private Image objImage;
// Settings
[SerializeField] private LogoType logoType = LogoType.GameLogo;
public enum LogoType { GameLogo, BrandLogo }
void Awake()
{
this.enabled = true;
if (UIManagerAsset == null) { UIManagerAsset = Resources.Load<UIManager>("Heat UI Manager"); }
if (objImage == null) { objImage = GetComponent<Image>(); }
if (!UIManagerAsset.enableDynamicUpdate) { UpdateImage(); this.enabled = false; }
}
void Update()
{
if (UIManagerAsset == null) { return; }
if (UIManagerAsset.enableDynamicUpdate) { UpdateImage(); }
}
void UpdateImage()
{
if (objImage == null)
return;
if (logoType == LogoType.GameLogo) { objImage.sprite = UIManagerAsset.gameLogo; }
else if (logoType == LogoType.BrandLogo) { objImage.sprite = UIManagerAsset.brandLogo; }
}
}
}

View File

@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: e4cb9653faa7a9f4bb361cfe64ca0cb4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- UIManagerAsset: {fileID: 11400000, guid: 98972d851a944df4a9402eac62a896e7, type: 2}
executionOrder: 0
icon: {fileID: 2800000, guid: 1c54b5f1316b2994e80ad22dbb16c23a, type: 3}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 264857
packageName: Heat - Complete Modern UI
packageVersion: 1.0.4
assetPath: Assets/Heat - Complete Modern UI/Scripts/UI Manager/UIManagerLogo.cs
uploadId: 629893

View File

@ -0,0 +1,42 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
namespace Michsky.UI.Heat
{
[CustomEditor(typeof(UIManagerLogo))]
public class UIManagerLogoEditor : Editor
{
private UIManagerLogo uimlTarget;
private GUISkin customSkin;
private void OnEnable()
{
uimlTarget = (UIManagerLogo)target;
if (EditorGUIUtility.isProSkin == true) { customSkin = HeatUIEditorHandler.GetDarkEditor(customSkin); }
else { customSkin = HeatUIEditorHandler.GetLightEditor(customSkin); }
}
public override void OnInspectorGUI()
{
var UIManagerAsset = serializedObject.FindProperty("UIManagerAsset");
var logoType = serializedObject.FindProperty("logoType");
HeatUIEditorHandler.DrawHeader(customSkin, "Core Header", 6);
HeatUIEditorHandler.DrawProperty(UIManagerAsset, customSkin, "UI Manager");
HeatUIEditorHandler.DrawHeader(customSkin, "Options Header", 10);
if (uimlTarget.UIManagerAsset != null)
{
HeatUIEditorHandler.DrawProperty(logoType, customSkin, "Logo Type");
}
else { EditorGUILayout.HelpBox("UI Manager should be assigned.", MessageType.Error); }
serializedObject.ApplyModifiedProperties();
}
}
}
#endif

View File

@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: e226d5b1f5ba87e4e9e47ce3bff9427c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 264857
packageName: Heat - Complete Modern UI
packageVersion: 1.0.4
assetPath: Assets/Heat - Complete Modern UI/Scripts/UI Manager/UIManagerLogoEditor.cs
uploadId: 629893

View File

@ -0,0 +1,160 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
namespace Michsky.UI.Heat
{
[ExecuteInEditMode]
[DisallowMultipleComponent]
public class UIManagerSplashScreen : MonoBehaviour
{
[Header("Settings")]
[SerializeField] private UIManager UIManagerAsset;
[SerializeField] private bool mobileMode;
[Header("Resources")]
[SerializeField] private TextMeshProUGUI PAKStart;
[SerializeField] private TextMeshProUGUI PAKKey;
[SerializeField] private TextMeshProUGUI PAKEnd;
void Awake()
{
this.enabled = true;
if (UIManagerAsset == null) { UIManagerAsset = Resources.Load<UIManager>("Heat UI Manager"); }
if (UIManagerAsset.enableDynamicUpdate == false) { UpdatePAK(); this.enabled = false; }
}
void Update()
{
if (UIManagerAsset == null) { return; }
if (UIManagerAsset.enableDynamicUpdate == true) { UpdatePAK(); }
if (Application.isPlaying == true) { this.enabled = false; }
}
void AnalyzePAKText()
{
if (mobileMode == true)
return;
// Fetch text and process formatting
string tempText = UIManagerAsset.pakText;
string[] outMain = tempText.Split(char.Parse("{"));
string outStart = outMain[0];
// Apply the first part if available
if (!string.IsNullOrEmpty(outStart) && PAKStart != null) { PAKStart.gameObject.SetActive(true); PAKStart.text = outStart.Substring(0, outStart.Length - 1); }
else if (PAKStart != null) { PAKStart.gameObject.SetActive(false); }
// If there is no key text available, return
if (outMain.Length <= 1)
{
if (PAKKey != null) { PAKKey.transform.parent.gameObject.SetActive(false); }
if (PAKEnd != null) { PAKEnd.gameObject.SetActive(false); }
return;
}
// Check for PAK text
string[] outPak = outMain[1].Split(new string[] { "}" }, System.StringSplitOptions.None);
// Apply PAK Text part if available
if (!string.IsNullOrEmpty(outPak[0].ToString()) && PAKKey != null) { PAKKey.transform.parent.gameObject.SetActive(true); PAKKey.text = outPak[0].ToString(); }
else if (PAKKey != null) { PAKKey.transform.parent.gameObject.SetActive(false); }
// If there is no end text available, return
if (outPak.Length <= 1)
{
if (PAKEnd != null) { PAKEnd.gameObject.SetActive(false); }
return;
}
// Apply the last part if available
if (!string.IsNullOrEmpty(outPak[1].ToString()) && PAKEnd != null) { PAKEnd.gameObject.SetActive(true); PAKEnd.text = outPak[1].Substring(1, outPak[1].ToString().Length - 1).ToString(); }
else if (PAKEnd != null) { PAKEnd.gameObject.SetActive(false); }
}
void AnalyzePAKLocalizationText()
{
if (Application.isPlaying == false || mobileMode == true)
return;
LocalizedObject localStart = PAKStart.GetComponent<LocalizedObject>();
LocalizedObject localKey = PAKKey.GetComponent<LocalizedObject>();
LocalizedObject localEnd = PAKEnd.GetComponent<LocalizedObject>();
if (localStart == null || localKey == null || localEnd == null)
return;
// Fetch text and process formatting
string tempText = UIManagerAsset.pakLocalizationText;
string[] outMain = tempText.Split(char.Parse("{"));
string outStart = outMain[0];
// Apply the first part if available
if (!string.IsNullOrEmpty(outStart) && PAKStart != null)
{
outStart = outStart.Substring(0, outStart.Length - 1);
outStart = localStart.GetKeyOutput(outStart);
PAKStart.gameObject.SetActive(true);
PAKStart.text = outStart;
LayoutRebuilder.ForceRebuildLayoutImmediate(PAKStart.transform.parent.GetComponent<RectTransform>());
}
else if (PAKStart != null) { PAKStart.gameObject.SetActive(false); }
// If there is no key text available, return
if (outMain.Length <= 1)
{
if (PAKKey != null) { PAKKey.transform.parent.gameObject.SetActive(false); }
if (PAKEnd != null) { PAKEnd.gameObject.SetActive(false); }
return;
}
// Check for PAK text
string[] outPak = outMain[1].Split(new string[] { "}" }, System.StringSplitOptions.None);
string outPakParsed = outPak[0].ToString();
// Apply PAK Text part if available
if (!string.IsNullOrEmpty(outPak[0].ToString()) && PAKKey != null)
{
outPakParsed = localKey.GetKeyOutput(outPakParsed);
PAKKey.transform.parent.gameObject.SetActive(true);
PAKKey.text = outPakParsed;
LayoutRebuilder.ForceRebuildLayoutImmediate(PAKKey.transform.parent.GetComponent<RectTransform>());
}
else if (PAKKey != null) { PAKKey.transform.parent.gameObject.SetActive(false); }
// If there is no end text available, return
if (outPak.Length <= 1)
{
if (PAKEnd != null) { PAKEnd.gameObject.SetActive(false); }
return;
}
// Apply the last part if available
if (!string.IsNullOrEmpty(outPak[1].ToString()) && PAKEnd != null)
{
string outEndParsed = outPak[1].Substring(1, outPak[1].ToString().Length - 1).ToString();
outEndParsed = localEnd.GetKeyOutput(outEndParsed);
PAKEnd.gameObject.SetActive(true);
PAKEnd.text = outEndParsed;
LayoutRebuilder.ForceRebuildLayoutImmediate(PAKEnd.transform.parent.GetComponent<RectTransform>());
}
else if (PAKEnd != null) { PAKEnd.gameObject.SetActive(false); }
}
void UpdatePAK()
{
if (UIManagerAsset.pakType == UIManager.PressAnyKeyTextType.Custom)
return;
if (UIManagerAsset.pakType == UIManager.PressAnyKeyTextType.Default && UIManagerAsset.enableLocalization == false) { AnalyzePAKText(); }
else if (UIManagerAsset.pakType == UIManager.PressAnyKeyTextType.Default && UIManagerAsset.enableLocalization == true) { AnalyzePAKLocalizationText(); }
}
}
}

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 46010a340d63c074285e30031302d25c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- UIManagerAsset: {fileID: 11400000, guid: 98972d851a944df4a9402eac62a896e7, type: 2}
- PAKStart: {instanceID: 0}
- PAKKey: {instanceID: 0}
- PAKEnd: {instanceID: 0}
executionOrder: 0
icon: {fileID: 2800000, guid: be9764c35790c27449266541582e9308, type: 3}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 264857
packageName: Heat - Complete Modern UI
packageVersion: 1.0.4
assetPath: Assets/Heat - Complete Modern UI/Scripts/UI Manager/UIManagerSplashScreen.cs
uploadId: 629893

View File

@ -0,0 +1,81 @@
using UnityEngine;
using TMPro;
namespace Michsky.UI.Heat
{
[ExecuteInEditMode]
[DisallowMultipleComponent]
[RequireComponent(typeof(TextMeshProUGUI))]
[AddComponentMenu("Heat UI/UI Manager/UI Manager Text")]
public class UIManagerText : MonoBehaviour
{
// Resources
public UIManager UIManagerAsset;
private TextMeshProUGUI objText;
// Settings
public FontType fontType = FontType.Regular;
public ColorType colorType = ColorType.Primary;
public bool useCustomColor;
public bool useCustomAlpha;
public bool useCustomFont;
public enum FontType { Light, Regular, Medium, Semibold, Bold, Custom }
public enum ColorType { Accent, AccentMatch, Primary, Secondary, Negative, Background }
void Awake()
{
this.enabled = true;
if (UIManagerAsset == null) { UIManagerAsset = Resources.Load<UIManager>("Heat UI Manager"); }
if (objText == null) { objText = GetComponent<TextMeshProUGUI>(); }
if (UIManagerAsset.enableDynamicUpdate == false) { UpdateText(); this.enabled = false; }
}
void Update()
{
if (UIManagerAsset == null) { return; }
if (UIManagerAsset.enableDynamicUpdate == true) { UpdateText(); }
}
void UpdateText()
{
if (objText == null)
return;
if (useCustomFont == false)
{
if (fontType == FontType.Light && objText.font != UIManagerAsset.fontLight) { objText.font = UIManagerAsset.fontLight; }
else if (fontType == FontType.Regular && objText.font != UIManagerAsset.fontRegular) { objText.font = UIManagerAsset.fontRegular; }
else if (fontType == FontType.Medium && objText.font != UIManagerAsset.fontMedium) { objText.font = UIManagerAsset.fontMedium; }
else if (fontType == FontType.Semibold && objText.font != UIManagerAsset.fontSemiBold) { objText.font = UIManagerAsset.fontSemiBold; }
else if (fontType == FontType.Bold && objText.font != UIManagerAsset.fontBold) { objText.font = UIManagerAsset.fontBold; }
else if (fontType == FontType.Custom && objText.font != UIManagerAsset.customFont) { objText.font = UIManagerAsset.customFont; }
}
if (useCustomColor == true)
return;
if (useCustomAlpha == false)
{
if (colorType == ColorType.Primary && objText.color != UIManagerAsset.primaryColor) { objText.color = UIManagerAsset.primaryColor; }
else if (colorType == ColorType.Secondary && objText.color != UIManagerAsset.secondaryColor) { objText.color = UIManagerAsset.secondaryColor; }
else if (colorType == ColorType.Accent && objText.color != UIManagerAsset.accentColor) { objText.color = UIManagerAsset.accentColor; }
else if (colorType == ColorType.AccentMatch && objText.color != UIManagerAsset.accentColorInvert) { objText.color = UIManagerAsset.accentColorInvert; }
else if (colorType == ColorType.Negative && objText.color != UIManagerAsset.negativeColor) { objText.color = UIManagerAsset.negativeColor; }
else if (colorType == ColorType.Background && objText.color != UIManagerAsset.backgroundColor) { objText.color = UIManagerAsset.backgroundColor; }
}
else
{
if (colorType == ColorType.Primary) { objText.color = new Color(UIManagerAsset.primaryColor.r, UIManagerAsset.primaryColor.g, UIManagerAsset.primaryColor.b, objText.color.a); }
else if (colorType == ColorType.Secondary) { objText.color = new Color(UIManagerAsset.secondaryColor.r, UIManagerAsset.secondaryColor.g, UIManagerAsset.secondaryColor.b, objText.color.a); }
else if (colorType == ColorType.Accent) { objText.color = new Color(UIManagerAsset.accentColor.r, UIManagerAsset.accentColor.g, UIManagerAsset.accentColor.b, objText.color.a); }
else if (colorType == ColorType.AccentMatch) { objText.color = new Color(UIManagerAsset.accentColorInvert.r, UIManagerAsset.accentColorInvert.g, UIManagerAsset.accentColorInvert.b, objText.color.a); }
else if (colorType == ColorType.Negative) { objText.color = new Color(UIManagerAsset.negativeColor.r, UIManagerAsset.negativeColor.g, UIManagerAsset.negativeColor.b, objText.color.a); }
else if (colorType == ColorType.Background) { objText.color = new Color(UIManagerAsset.backgroundColor.r, UIManagerAsset.backgroundColor.g, UIManagerAsset.backgroundColor.b, objText.color.a); }
}
}
}
}

View File

@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: eb74c25980035a144bb5f9091bc89d83
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences:
- UIManagerAsset: {fileID: 11400000, guid: 98972d851a944df4a9402eac62a896e7, type: 2}
executionOrder: 0
icon: {fileID: 2800000, guid: 1c54b5f1316b2994e80ad22dbb16c23a, type: 3}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 264857
packageName: Heat - Complete Modern UI
packageVersion: 1.0.4
assetPath: Assets/Heat - Complete Modern UI/Scripts/UI Manager/UIManagerText.cs
uploadId: 629893

View File

@ -0,0 +1,54 @@
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
namespace Michsky.UI.Heat
{
[CustomEditor(typeof(UIManagerText))]
public class UIManagerTextEditor : Editor
{
private UIManagerText uimtTarget;
private GUISkin customSkin;
private void OnEnable()
{
uimtTarget = (UIManagerText)target;
if (EditorGUIUtility.isProSkin == true) { customSkin = HeatUIEditorHandler.GetDarkEditor(customSkin); }
else { customSkin = HeatUIEditorHandler.GetLightEditor(customSkin); }
}
public override void OnInspectorGUI()
{
var UIManagerAsset = serializedObject.FindProperty("UIManagerAsset");
var fontType = serializedObject.FindProperty("fontType");
var colorType = serializedObject.FindProperty("colorType");
var useCustomColor = serializedObject.FindProperty("useCustomColor");
var useCustomAlpha = serializedObject.FindProperty("useCustomAlpha");
var useCustomFont = serializedObject.FindProperty("useCustomFont");
HeatUIEditorHandler.DrawHeader(customSkin, "Core Header", 6);
HeatUIEditorHandler.DrawProperty(UIManagerAsset, customSkin, "UI Manager");
HeatUIEditorHandler.DrawHeader(customSkin, "Options Header", 10);
if (uimtTarget.UIManagerAsset != null)
{
if (useCustomFont.boolValue == true) { GUI.enabled = false; }
HeatUIEditorHandler.DrawProperty(fontType, customSkin, "Font Type");
GUI.enabled = true;
HeatUIEditorHandler.DrawProperty(colorType, customSkin, "Color Type");
useCustomColor.boolValue = HeatUIEditorHandler.DrawToggle(useCustomColor.boolValue, customSkin, "Use Custom Color");
if (useCustomColor.boolValue == true) { GUI.enabled = false; }
useCustomAlpha.boolValue = HeatUIEditorHandler.DrawToggle(useCustomAlpha.boolValue, customSkin, "Use Custom Alpha");
GUI.enabled = true;
useCustomFont.boolValue = HeatUIEditorHandler.DrawToggle(useCustomFont.boolValue, customSkin, "Use Custom Font");
}
else { EditorGUILayout.HelpBox("UI Manager should be assigned.", MessageType.Error); }
serializedObject.ApplyModifiedProperties();
}
}
}
#endif

View File

@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 4f7867fa5b9ea234cae1bc0ee9acced0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 264857
packageName: Heat - Complete Modern UI
packageVersion: 1.0.4
assetPath: Assets/Heat - Complete Modern UI/Scripts/UI Manager/UIManagerTextEditor.cs
uploadId: 629893