Passion & UI

This commit is contained in:
SoulliesOfficial
2026-06-12 17:11:39 -04:00
parent 7bc1e1722c
commit 6d7ebc5825
3444 changed files with 865284 additions and 463132 deletions

View File

@@ -0,0 +1,22 @@
using UnityEngine;
using UnityEngine.UI;
namespace Michsky.UI.Shift
{
public class CanvasManager : MonoBehaviour
{
[Header("Resources")]
public CanvasScaler canvasScaler;
void Start()
{
if (canvasScaler == null)
canvasScaler = gameObject.GetComponent<CanvasScaler>();
}
public void ScaleCanvas(int scale = 1080)
{
canvasScaler.referenceResolution = new Vector2(canvasScaler.referenceResolution.x, scale);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: dba074f5b1cddaf4fbaa75b9c2b532b2
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/Scripts/Other/CanvasManager.cs
uploadId: 915518

View File

@@ -0,0 +1,32 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Michsky.UI.Shift
{
[ExecuteInEditMode]
public class EditorDemoPositionFix : MonoBehaviour
{
public List<RectTransform> objectToRepaint;
#if UNITY_EDITOR
void Awake()
{
if (Application.isPlaying == true || objectToRepaint.Count == 0)
return;
// Rebuilding the rect in case of incorrect layout calculation
for (int i = 0; i < objectToRepaint.Count; ++i)
{
if (objectToRepaint[i] != null)
{
LayoutRebuilder.ForceRebuildLayoutImmediate(objectToRepaint[i].GetComponentInParent<RectTransform>());
LayoutRebuilder.ForceRebuildLayoutImmediate(objectToRepaint[i]);
LayoutRebuilder.ForceRebuildLayoutImmediate(objectToRepaint[i]);
}
}
}
#endif
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 60198677d32fe8348aa29ac27233e2bf
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/Scripts/Other/EditorDemoPositionFix.cs
uploadId: 915518

View File

@@ -0,0 +1,13 @@
using UnityEngine;
namespace Michsky.UI.Shift
{
public class ExitToSystem : MonoBehaviour
{
public void ExitGame()
{
Debug.Log("Exit function is working on build mode.");
Application.Quit();
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 57fe7425f83c9824fa81663c00e6b21c
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/Scripts/Other/ExitToSystem.cs
uploadId: 915518

View File

@@ -0,0 +1,14 @@
using UnityEngine;
namespace Michsky.UI.Shift
{
public class LaunchURL : MonoBehaviour
{
public string URL;
public void GoToURL()
{
Application.OpenURL(URL);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 848a88a94ba992240a3ce95346011e03
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/Scripts/Other/LaunchURL.cs
uploadId: 915518

View File

@@ -0,0 +1,52 @@
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
namespace Michsky.UI.Shift
{
public class LayoutGroupPositionFix : MonoBehaviour
{
[SerializeField] private bool fixOnEnable = true;
[SerializeField] private bool fixWithDelay = true;
[SerializeField] private RebuildMethod rebuildMethod;
float fixDelay = 0.025f;
public enum RebuildMethod { ForceRebuild, MarkRebuild }
void OnEnable()
{
#if UNITY_EDITOR
LayoutRebuilder.ForceRebuildLayoutImmediate(GetComponent<RectTransform>());
if (Application.isPlaying == false) { return; }
#endif
if (fixWithDelay == false && fixOnEnable == true && rebuildMethod == RebuildMethod.ForceRebuild) { ForceRebuild(); }
else if (fixWithDelay == false && fixOnEnable == true && rebuildMethod == RebuildMethod.MarkRebuild) { MarkRebuild(); }
else if (fixWithDelay == true) { StartCoroutine(FixDelay()); }
}
public void FixLayout()
{
if (fixWithDelay == false && rebuildMethod == RebuildMethod.ForceRebuild) { ForceRebuild(); }
else if (fixWithDelay == false && rebuildMethod == RebuildMethod.MarkRebuild) { MarkRebuild(); }
else { StartCoroutine(FixDelay()); }
}
void ForceRebuild()
{
LayoutRebuilder.ForceRebuildLayoutImmediate(GetComponent<RectTransform>());
}
void MarkRebuild()
{
LayoutRebuilder.MarkLayoutForRebuild(GetComponent<RectTransform>());
}
IEnumerator FixDelay()
{
yield return new WaitForSecondsRealtime(fixDelay);
if (rebuildMethod == RebuildMethod.ForceRebuild) { ForceRebuild(); }
else if (rebuildMethod == RebuildMethod.MarkRebuild) { MarkRebuild(); }
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 68c85f85e0b459f4e9d5b0ab03afd03f
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/Scripts/Other/LayoutGroupPositionFix.cs
uploadId: 915518

View File

@@ -0,0 +1,240 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Audio;
using UnityEngine.Events;
using TMPro;
namespace Michsky.UI.Shift
{
public class QualityManager : MonoBehaviour
{
[Header("Audio")]
public AudioMixer mixer;
public SliderManager masterSlider;
public SliderManager musicSlider;
public SliderManager sfxSlider;
[Header("Resolution")]
public bool preferSelector = true;
public HorizontalSelector resolutionSelector;
public TMP_Dropdown resolutionDropdown;
[System.Serializable]
public class DynamicRes : UnityEvent<int> { }
public DynamicRes clickEvent;
Resolution[] resolutions;
List<string> options = new List<string>();
void Start()
{
mixer.SetFloat("Master", Mathf.Log10(PlayerPrefs.GetFloat(masterSlider.sliderTag + "SliderValue")) * 20);
mixer.SetFloat("Music", Mathf.Log10(PlayerPrefs.GetFloat(musicSlider.sliderTag + "SliderValue")) * 20);
mixer.SetFloat("SFX", Mathf.Log10(PlayerPrefs.GetFloat(sfxSlider.sliderTag + "SliderValue")) * 20);
resolutions = Screen.resolutions;
if (preferSelector == true)
{
if (resolutionDropdown != null) { resolutionDropdown.gameObject.SetActive(false); }
if (resolutionSelector != null) { resolutionSelector.gameObject.SetActive(true); }
else { return; }
resolutionSelector.itemList.RemoveRange(0, resolutionSelector.itemList.Count);
int currentResolutionIndex = -1;
for (int i = 0; i < resolutions.Length; i++)
{
#if UNITY_2022_2_OR_NEWER
string option = resolutions[i].width + "x" + resolutions[i].height + " " + resolutions[i].refreshRateRatio.numerator + "hz";
#else
string option = resolutions[i].width + "x" + resolutions[i].height + " " + resolutions[i].refreshRate + "hz";
#endif
options.Add(option);
resolutionSelector.CreateNewItem(options[i]);
// resolutionSelector.itemList[i].onValueChanged.AddListener(UpdateResolution);
#if UNITY_2022_2_OR_NEWER
if (resolutions[i].width == Screen.currentResolution.width
&& resolutions[i].height == Screen.currentResolution.height
&& resolutions[i].refreshRateRatio.numerator == Screen.currentResolution.refreshRateRatio.numerator)
#else
if (resolutions[i].width == Screen.currentResolution.width
&& resolutions[i].height == Screen.currentResolution.height
&& resolutions[i].refreshRate == Screen.currentResolution.refreshRate)
#endif
{
currentResolutionIndex = i;
resolutionSelector.index = currentResolutionIndex;
}
}
if (currentResolutionIndex == 0) { resolutionSelector.index = resolutionSelector.itemList.Count - 1; }
resolutionSelector.UpdateUI();
}
else
{
if (resolutionSelector != null) { resolutionSelector.gameObject.SetActive(false); }
if (resolutionDropdown != null) { resolutionDropdown.gameObject.SetActive(true); }
else { return; }
resolutionDropdown.ClearOptions();
List<string> options = new List<string>();
int currentResolutionIndex = 0;
for (int i = 0; i < resolutions.Length; i++)
{
#if UNITY_2022_2_OR_NEWER
string option = resolutions[i].width + "x" + resolutions[i].height + " " + resolutions[i].refreshRateRatio.numerator + "hz";
#else
string option = resolutions[i].width + "x" + resolutions[i].height + " " + resolutions[i].refreshRate + "hz";
#endif
options.Add(option);
#if UNITY_2022_2_OR_NEWER
if (resolutions[i].width == Screen.currentResolution.width
&& resolutions[i].height == Screen.currentResolution.height
&& resolutions[i].refreshRateRatio.numerator == Screen.currentResolution.refreshRateRatio.numerator)
#else
if (resolutions[i].width == Screen.currentResolution.width
&& resolutions[i].height == Screen.currentResolution.height
&& resolutions[i].refreshRate == Screen.currentResolution.refreshRate)
#endif
{
currentResolutionIndex = i;
}
}
resolutionDropdown.AddOptions(options);
resolutionDropdown.value = currentResolutionIndex;
resolutionDropdown.RefreshShownValue();
resolutionDropdown.onValueChanged.RemoveAllListeners();
resolutionDropdown.onValueChanged.AddListener(SetResolution);
}
}
public void UpdateResolution()
{
clickEvent.Invoke(resolutionSelector.index);
}
public void SetResolution(int resolutionIndex)
{
Screen.SetResolution(resolutions[resolutionIndex].width, resolutions[resolutionIndex].height, Screen.fullScreen);
}
public void AnisotrpicFilteringEnable()
{
QualitySettings.anisotropicFiltering = AnisotropicFiltering.ForceEnable;
}
public void AnisotrpicFilteringDisable()
{
QualitySettings.anisotropicFiltering = AnisotropicFiltering.Disable;
}
public void AntiAlisasingSet(int index)
{
// 0, 2, 4, 8 - Zero means off
QualitySettings.antiAliasing = index;
}
public void VsyncSet(int index)
{
// 0, 1 - Zero means off
QualitySettings.vSyncCount = index;
}
public void ShadowResolutionSet(int index)
{
if (index == 3)
QualitySettings.shadowResolution = ShadowResolution.VeryHigh;
else if (index == 2)
QualitySettings.shadowResolution = ShadowResolution.High;
else if (index == 1)
QualitySettings.shadowResolution = ShadowResolution.Medium;
else if (index == 0)
QualitySettings.shadowResolution = ShadowResolution.Low;
}
public void ShadowsSet(int index)
{
if (index == 0)
QualitySettings.shadows = ShadowQuality.Disable;
else if (index == 1)
QualitySettings.shadows = ShadowQuality.All;
}
public void ShadowsCascasedSet(int index)
{
//0 = No, 2 = Two, 4 = Four
QualitySettings.shadowCascades = index;
}
public void TextureSet(int index)
{
// 0 = Full, 4 = Eight Resolution
#if UNITY_2022_2_OR_NEWER
QualitySettings.globalTextureMipmapLimit = index;
#else
QualitySettings.masterTextureLimit = index;
#endif
}
public void SoftParticleSet(int index)
{
if (index == 0)
QualitySettings.softParticles = false;
else if (index == 1)
QualitySettings.softParticles = true;
}
public void ReflectionSet(int index)
{
if (index == 0)
QualitySettings.realtimeReflectionProbes = false;
else if (index == 1)
QualitySettings.realtimeReflectionProbes = true;
}
public void VolumeSetMaster(float volume)
{
mixer.SetFloat("Master", Mathf.Log10(volume) * 20);
}
public void VolumeSetMusic(float volume)
{
mixer.SetFloat("Music", Mathf.Log10(volume) * 20);
}
public void VolumeSetSFX(float volume)
{
mixer.SetFloat("SFX", Mathf.Log10(volume) * 20);
}
public void SetOverallQuality(int qualityIndex)
{
QualitySettings.SetQualityLevel(qualityIndex);
}
public void WindowFullscreen()
{
Screen.fullScreen = true;
Screen.fullScreenMode = FullScreenMode.ExclusiveFullScreen;
}
public void WindowBorderless()
{
Screen.fullScreenMode = FullScreenMode.FullScreenWindow;
}
public void WindowWindowed()
{
Screen.fullScreen = false;
Screen.fullScreenMode = FullScreenMode.Windowed;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: d6916e32cbfbb69408e0a98ac54cf42c
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/Scripts/Other/QualityManager.cs
uploadId: 915518

View File

@@ -0,0 +1,43 @@
using UnityEngine;
using UnityEngine.UI;
namespace Michsky.UI.Shift
{
public class ScrollForMore : MonoBehaviour
{
[Header("Resources")]
public Scrollbar listScrollbar;
private Animator SFMAnimator;
[Header("Settings")]
public float fadeOutValue;
public bool invertValue = false;
void Start()
{
SFMAnimator = gameObject.GetComponent<Animator>();
CheckValue();
}
public void CheckValue()
{
if(invertValue == false)
{
if (SFMAnimator != null && listScrollbar.value >= fadeOutValue)
SFMAnimator.Play("SFM In");
else if (SFMAnimator != null && listScrollbar.value <= fadeOutValue)
SFMAnimator.Play("SFM Out");
}
else
{
if (SFMAnimator != null && listScrollbar.value <= fadeOutValue)
SFMAnimator.Play("SFM In");
else if (SFMAnimator != null && listScrollbar.value >= fadeOutValue)
SFMAnimator.Play("SFM Out");
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: fb34e379e7cdce442bf8d77c28ca7f51
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/Scripts/Other/ScrollForMore.cs
uploadId: 915518

View File

@@ -0,0 +1,70 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Michsky.UI.Shift
{
[DisallowMultipleComponent]
[RequireComponent(typeof(Image))]
public class SpriteAnimator : MonoBehaviour
{
[SerializeField] List<Sprite> sprites = new();
[SerializeField, Range(1, 120)] float frameRate = 24;
Image image;
Coroutine animCoroutine;
int currentFrame;
float frameTimer;
void Awake()
{
image = GetComponent<Image>();
if (sprites.Count > 0 && sprites[0] != null)
image.sprite = sprites[0];
}
void OnEnable() => Play();
void OnDisable() => Stop();
public void Play()
{
if (sprites.Count < 2)
return;
Stop();
animCoroutine = StartCoroutine(Animate());
}
public void Stop()
{
if (animCoroutine == null)
return;
StopCoroutine(animCoroutine);
animCoroutine = null;
}
IEnumerator Animate()
{
float frameDuration = 1f / Mathf.Max(frameRate, 0.01f);
while (true)
{
frameTimer += Time.deltaTime;
while (frameTimer >= frameDuration)
{
frameTimer -= frameDuration;
currentFrame = (currentFrame + 1) % sprites.Count;
}
if (sprites[currentFrame] != null)
image.sprite = sprites[currentFrame];
yield return null;
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 15a6eb9cdcdf3164d9c38606fc4340b4
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/Scripts/Other/SpriteAnimator.cs
uploadId: 915518

View File

@@ -0,0 +1,15 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace Michsky.UI.Shift
{
public class UIElementInFront : MonoBehaviour
{
void Start()
{
transform.SetAsLastSibling();
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 64e621b5ded738546a4fd3e477587364
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/Scripts/Other/UIElementInFront.cs
uploadId: 915518