Imported UI Assets
This commit is contained in:
@ -0,0 +1,24 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Michsky.UI.Heat
|
||||
{
|
||||
public class HeatUIInternalTools : MonoBehaviour
|
||||
{
|
||||
public static float GetAnimatorClipLength(Animator _animator, string _clipName)
|
||||
{
|
||||
float _lengthValue = -1;
|
||||
RuntimeAnimatorController _rac = _animator.runtimeAnimatorController;
|
||||
|
||||
for (int i = 0; i < _rac.animationClips.Length; i++)
|
||||
{
|
||||
if (_rac.animationClips[i].name == _clipName)
|
||||
{
|
||||
_lengthValue = _rac.animationClips[i].length;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return _lengthValue;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09a474342020a0144bfa8fe19e57e741
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: ee083492dcf46e24daded170502f8f55, 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/Core/HeatUIInternalTools.cs
|
||||
uploadId: 629893
|
@ -0,0 +1,136 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
namespace Michsky.UI.Heat
|
||||
{
|
||||
[DisallowMultipleComponent]
|
||||
public class MenuManager : MonoBehaviour
|
||||
{
|
||||
// Resources
|
||||
public UIManager UIManagerAsset;
|
||||
public Animator splashScreen;
|
||||
[SerializeField] private GameObject mainContent;
|
||||
[SerializeField] private ImageFading initPanel;
|
||||
|
||||
// Helpers
|
||||
float splashInTime;
|
||||
float splashOutTime;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
Time.timeScale = 1;
|
||||
|
||||
if (initPanel != null) { initPanel.gameObject.SetActive(true); }
|
||||
if (splashScreen != null) { splashScreen.gameObject.SetActive(false); }
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
StartCoroutine("StartInitialize");
|
||||
}
|
||||
|
||||
public void DisableSplashScreen()
|
||||
{
|
||||
StopCoroutine("DisableSplashScreenAnimator");
|
||||
StartCoroutine("FinalizeSplashScreen");
|
||||
|
||||
splashScreen.enabled = true;
|
||||
splashScreen.Play("Out");
|
||||
}
|
||||
|
||||
void Initialize()
|
||||
{
|
||||
if (UIManagerAsset == null || mainContent == null)
|
||||
{
|
||||
Debug.LogError("<b>[Heat UI]</b> Cannot initialize the resources due to missing resources.", this);
|
||||
return;
|
||||
}
|
||||
|
||||
mainContent.gameObject.SetActive(false);
|
||||
bool enableSplashAfter = false;
|
||||
|
||||
if (UIManagerAsset.enableSplashScreen && UIManagerAsset.showSplashScreenOnce && GameObject.Find("[Heat UI - Splash Screen Helper]") != null)
|
||||
{
|
||||
UIManagerAsset.enableSplashScreen = false;
|
||||
enableSplashAfter = true;
|
||||
}
|
||||
|
||||
if (UIManagerAsset.enableSplashScreen)
|
||||
{
|
||||
if (splashScreen == null)
|
||||
{
|
||||
Debug.LogError("<b>[Heat UI]</b> Splash Screen is enabled but its resource is missing. Please assign the correct variable for 'Splash Screen'.", this);
|
||||
return;
|
||||
}
|
||||
|
||||
// Getting in and out animation length
|
||||
AnimationClip[] clips = splashScreen.runtimeAnimatorController.animationClips;
|
||||
splashInTime = clips[0].length;
|
||||
splashOutTime = clips[1].length;
|
||||
|
||||
splashScreen.enabled = true;
|
||||
splashScreen.gameObject.SetActive(true);
|
||||
StartCoroutine("DisableSplashScreenAnimator");
|
||||
|
||||
if (UIManagerAsset.showSplashScreenOnce)
|
||||
{
|
||||
GameObject tempHelper = new GameObject();
|
||||
tempHelper.name = "[Heat UI - Splash Screen Helper]";
|
||||
DontDestroyOnLoad(tempHelper);
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (mainContent == null)
|
||||
{
|
||||
Debug.LogError("<b>[Heat UI]</b> 'Main Panels' is missing. Please assign the correct variable for 'Main Panels'.", this);
|
||||
return;
|
||||
}
|
||||
|
||||
if (splashScreen != null) { splashScreen.gameObject.SetActive(false); }
|
||||
mainContent.gameObject.SetActive(false);
|
||||
StartCoroutine("FinalizeSplashScreen");
|
||||
}
|
||||
|
||||
if (enableSplashAfter && UIManagerAsset.showSplashScreenOnce)
|
||||
{
|
||||
UIManagerAsset.enableSplashScreen = true;
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator StartInitialize()
|
||||
{
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
if (initPanel != null) { initPanel.FadeOut(); }
|
||||
Initialize();
|
||||
}
|
||||
|
||||
IEnumerator DisableSplashScreenAnimator()
|
||||
{
|
||||
yield return new WaitForSeconds(splashInTime + 0.1f);
|
||||
splashScreen.enabled = false;
|
||||
}
|
||||
|
||||
IEnumerator FinalizeSplashScreen()
|
||||
{
|
||||
yield return new WaitForSeconds(splashOutTime + 0.1f);
|
||||
|
||||
if (UIManagerAsset != null && UIManagerAsset.enableSplashScreen)
|
||||
{
|
||||
splashScreen.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
mainContent.gameObject.SetActive(true);
|
||||
|
||||
if (ControllerManager.instance != null
|
||||
&& ControllerManager.instance.gamepadEnabled
|
||||
&& ControllerManager.instance.firstSelected != null
|
||||
&& ControllerManager.instance.firstSelected.activeInHierarchy)
|
||||
{
|
||||
EventSystem.current.SetSelectedGameObject(ControllerManager.instance.firstSelected);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a361a3179177dcd43a32bf89f6e8f310
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: fd3012dcfab95cb469aa3dd70c6af50b, 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/Core/MenuManager.cs
|
||||
uploadId: 629893
|
@ -0,0 +1,72 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
|
||||
namespace Michsky.UI.Heat
|
||||
{
|
||||
[CanEditMultipleObjects]
|
||||
[CustomEditor(typeof(MenuManager))]
|
||||
public class MenuManagerEditor : Editor
|
||||
{
|
||||
private MenuManager mmTarget;
|
||||
private GUISkin customSkin;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
mmTarget = (MenuManager)target;
|
||||
|
||||
if (EditorGUIUtility.isProSkin == true) { customSkin = HeatUIEditorHandler.GetDarkEditor(customSkin); }
|
||||
else { customSkin = HeatUIEditorHandler.GetLightEditor(customSkin); }
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
var UIManagerAsset = serializedObject.FindProperty("UIManagerAsset");
|
||||
var splashScreen = serializedObject.FindProperty("splashScreen");
|
||||
var mainContent = serializedObject.FindProperty("mainContent");
|
||||
var initPanel = serializedObject.FindProperty("initPanel");
|
||||
|
||||
HeatUIEditorHandler.DrawHeader(customSkin, "Core Header", 6);
|
||||
HeatUIEditorHandler.DrawProperty(UIManagerAsset, customSkin, "UI Manager");
|
||||
HeatUIEditorHandler.DrawProperty(splashScreen, customSkin, "Splash Screen");
|
||||
HeatUIEditorHandler.DrawProperty(mainContent, customSkin, "Main Content");
|
||||
HeatUIEditorHandler.DrawProperty(initPanel, customSkin, "Init Screen");
|
||||
|
||||
if (mmTarget.UIManagerAsset != null)
|
||||
{
|
||||
HeatUIEditorHandler.DrawHeader(customSkin, "Options Header", 10);
|
||||
GUILayout.BeginHorizontal(EditorStyles.helpBox);
|
||||
mmTarget.UIManagerAsset.enableSplashScreen = GUILayout.Toggle(mmTarget.UIManagerAsset.enableSplashScreen, "Enable Splash Screen", customSkin.FindStyle("Toggle"));
|
||||
mmTarget.UIManagerAsset.enableSplashScreen = GUILayout.Toggle(mmTarget.UIManagerAsset.enableSplashScreen, new GUIContent(""), customSkin.FindStyle("Toggle Helper"));
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
if (mmTarget.splashScreen != null)
|
||||
{
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
if (Application.isPlaying == false)
|
||||
{
|
||||
if (mmTarget.splashScreen.gameObject.activeSelf == false && GUILayout.Button("Show Splash Screen", customSkin.button))
|
||||
{
|
||||
mmTarget.splashScreen.gameObject.SetActive(true);
|
||||
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
|
||||
}
|
||||
|
||||
else if (mmTarget.splashScreen.gameObject.activeSelf == true && GUILayout.Button("Hide Splash Screen", customSkin.button))
|
||||
{
|
||||
mmTarget.splashScreen.gameObject.SetActive(false);
|
||||
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
|
||||
}
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Select Splash Screen", customSkin.button)) { Selection.activeObject = mmTarget.splashScreen; }
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
}
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e0da5054d9e84642abe2f729dbed1b6
|
||||
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/Core/MenuManagerEditor.cs
|
||||
uploadId: 629893
|
@ -0,0 +1,142 @@
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace Michsky.UI.Heat
|
||||
{
|
||||
public class PauseMenuManager : MonoBehaviour
|
||||
{
|
||||
// Resources
|
||||
public GameObject pauseMenuCanvas;
|
||||
[SerializeField] private ButtonManager continueButton;
|
||||
[SerializeField] private PanelManager panelManager;
|
||||
[SerializeField] private ImageFading background;
|
||||
|
||||
// Settings
|
||||
[SerializeField] private bool setTimeScale = true;
|
||||
[Range(0, 1)] public float inputBlockDuration = 0.2f;
|
||||
public CursorLockMode menuCursorState = CursorLockMode.None;
|
||||
public CursorLockMode gameCursorState = CursorLockMode.Locked;
|
||||
[SerializeField] private InputAction hotkey;
|
||||
|
||||
// Events
|
||||
public UnityEvent onOpen;
|
||||
public UnityEvent onClose;
|
||||
|
||||
// Helpers
|
||||
bool isOn = false;
|
||||
bool allowClosing = true;
|
||||
float disableAfter = 0.6f;
|
||||
|
||||
public enum CursorVisibility { Invisible, Visible }
|
||||
|
||||
void Awake()
|
||||
{
|
||||
if (pauseMenuCanvas == null)
|
||||
{
|
||||
Debug.LogError("<b>[Pause Menu Manager]</b> Pause Menu Canvas is missing!", this);
|
||||
this.enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
pauseMenuCanvas.SetActive(true);
|
||||
}
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (panelManager != null) { disableAfter = HeatUIInternalTools.GetAnimatorClipLength(panelManager.panels[panelManager.currentPanelIndex].panelObject, "MainPanel_Out"); }
|
||||
if (continueButton != null) { continueButton.onClick.AddListener(ClosePauseMenu); }
|
||||
|
||||
pauseMenuCanvas.SetActive(false);
|
||||
hotkey.Enable();
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (hotkey.triggered) { AnimatePauseMenu(); }
|
||||
}
|
||||
|
||||
public void AnimatePauseMenu()
|
||||
{
|
||||
if (isOn == false) { OpenPauseMenu(); }
|
||||
else { ClosePauseMenu(); }
|
||||
}
|
||||
|
||||
public void OpenPauseMenu()
|
||||
{
|
||||
if (isOn == true) { return; }
|
||||
if (setTimeScale == true) { Time.timeScale = 0; }
|
||||
if (inputBlockDuration > 0)
|
||||
{
|
||||
AllowClosing(false);
|
||||
StopCoroutine("InputBlockProcess");
|
||||
StartCoroutine("InputBlockProcess");
|
||||
}
|
||||
|
||||
StopCoroutine("DisablePauseCanvas");
|
||||
|
||||
isOn = true;
|
||||
pauseMenuCanvas.SetActive(false);
|
||||
pauseMenuCanvas.SetActive(true);
|
||||
onOpen.Invoke();
|
||||
FadeInBackground();
|
||||
Cursor.lockState = menuCursorState;
|
||||
|
||||
if (continueButton != null && Gamepad.current != null)
|
||||
{
|
||||
EventSystem.current.SetSelectedGameObject(null);
|
||||
EventSystem.current.SetSelectedGameObject(continueButton.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
public void ClosePauseMenu()
|
||||
{
|
||||
if (isOn == false || allowClosing == false) { return; }
|
||||
if (setTimeScale == true) { Time.timeScale = 1; }
|
||||
if (panelManager != null) { panelManager.HideCurrentPanel(); }
|
||||
|
||||
StopCoroutine("DisablePauseCanvas");
|
||||
StartCoroutine("DisablePauseCanvas");
|
||||
|
||||
isOn = false;
|
||||
onClose.Invoke();
|
||||
FadeOutBackground();
|
||||
Cursor.lockState = gameCursorState;
|
||||
}
|
||||
|
||||
public void FadeInBackground()
|
||||
{
|
||||
if (background == null)
|
||||
return;
|
||||
|
||||
background.FadeIn();
|
||||
}
|
||||
|
||||
public void FadeOutBackground()
|
||||
{
|
||||
if (background == null)
|
||||
return;
|
||||
|
||||
background.FadeOut();
|
||||
}
|
||||
|
||||
public void AllowClosing(bool value)
|
||||
{
|
||||
allowClosing = value;
|
||||
}
|
||||
|
||||
IEnumerator DisablePauseCanvas()
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(disableAfter);
|
||||
pauseMenuCanvas.SetActive(false);
|
||||
}
|
||||
|
||||
IEnumerator InputBlockProcess()
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(inputBlockDuration);
|
||||
AllowClosing(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: acd5405ad257ceb49986ab821a76b0ae
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: fd3012dcfab95cb469aa3dd70c6af50b, 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/Core/PauseMenuManager.cs
|
||||
uploadId: 629893
|
@ -0,0 +1,84 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
|
||||
namespace Michsky.UI.Heat
|
||||
{
|
||||
[CanEditMultipleObjects]
|
||||
[CustomEditor(typeof(PauseMenuManager))]
|
||||
public class PauseMenuManagerEditor : Editor
|
||||
{
|
||||
private PauseMenuManager pmmTarget;
|
||||
private GUISkin customSkin;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
pmmTarget = (PauseMenuManager)target;
|
||||
|
||||
if (EditorGUIUtility.isProSkin == true) { customSkin = HeatUIEditorHandler.GetDarkEditor(customSkin); }
|
||||
else { customSkin = HeatUIEditorHandler.GetLightEditor(customSkin); }
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
var pauseMenuCanvas = serializedObject.FindProperty("pauseMenuCanvas");
|
||||
var continueButton = serializedObject.FindProperty("continueButton");
|
||||
var panelManager = serializedObject.FindProperty("panelManager");
|
||||
var background = serializedObject.FindProperty("background");
|
||||
|
||||
var setTimeScale = serializedObject.FindProperty("setTimeScale");
|
||||
var inputBlockDuration = serializedObject.FindProperty("inputBlockDuration");
|
||||
var menuCursorState = serializedObject.FindProperty("menuCursorState");
|
||||
var gameCursorState = serializedObject.FindProperty("gameCursorState");
|
||||
var hotkey = serializedObject.FindProperty("hotkey");
|
||||
|
||||
var onOpen = serializedObject.FindProperty("onOpen");
|
||||
var onClose = serializedObject.FindProperty("onClose");
|
||||
|
||||
if (pmmTarget.pauseMenuCanvas != null)
|
||||
{
|
||||
HeatUIEditorHandler.DrawHeader(customSkin, "Content Header", 6);
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
if (Application.isPlaying == false)
|
||||
{
|
||||
if (pmmTarget.pauseMenuCanvas.gameObject.activeSelf == false && GUILayout.Button("Show Pause Menu", customSkin.button))
|
||||
{
|
||||
pmmTarget.pauseMenuCanvas.gameObject.SetActive(true);
|
||||
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
|
||||
}
|
||||
|
||||
else if (pmmTarget.pauseMenuCanvas.gameObject.activeSelf == true && GUILayout.Button("Hide Pause Menu", customSkin.button))
|
||||
{
|
||||
pmmTarget.pauseMenuCanvas.gameObject.SetActive(false);
|
||||
EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
|
||||
}
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Select Object", customSkin.button)) { Selection.activeObject = pmmTarget.pauseMenuCanvas; }
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
HeatUIEditorHandler.DrawHeader(customSkin, "Core Header", 10);
|
||||
HeatUIEditorHandler.DrawProperty(pauseMenuCanvas, customSkin, "Pause Canvas");
|
||||
HeatUIEditorHandler.DrawProperty(continueButton, customSkin, "Continue Button");
|
||||
HeatUIEditorHandler.DrawProperty(panelManager, customSkin, "Panel Manager");
|
||||
HeatUIEditorHandler.DrawProperty(background, customSkin, "Background");
|
||||
|
||||
HeatUIEditorHandler.DrawHeader(customSkin, "Options Header", 10);
|
||||
setTimeScale.boolValue = HeatUIEditorHandler.DrawToggle(setTimeScale.boolValue, customSkin, "Set Time Scale", "Sets the time scale depending on the pause menu state.");
|
||||
HeatUIEditorHandler.DrawProperty(inputBlockDuration, customSkin, "Input Block Duration", "Block input in specific amount of time to provide smooth visuals.");
|
||||
HeatUIEditorHandler.DrawProperty(menuCursorState, customSkin, "Menu Cursor State");
|
||||
HeatUIEditorHandler.DrawProperty(gameCursorState, customSkin, "Game Cursor State");
|
||||
EditorGUILayout.PropertyField(hotkey, new GUIContent("Hotkey"), true);
|
||||
|
||||
HeatUIEditorHandler.DrawHeader(customSkin, "Events Header", 10);
|
||||
EditorGUILayout.PropertyField(onOpen, new GUIContent("On Open"), true);
|
||||
EditorGUILayout.PropertyField(onClose, new GUIContent("On Close"), true);
|
||||
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 855e8e244f547d64db36223f5020e342
|
||||
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/Core/PauseMenuManagerEditor.cs
|
||||
uploadId: 629893
|
Reference in New Issue
Block a user