Insanely huge initial commit

This commit is contained in:
2026-02-21 17:04:05 -08:00
parent 9cdd36191a
commit 613d75914a
22525 changed files with 4035207 additions and 0 deletions

View File

@@ -0,0 +1,226 @@
using System.Collections;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
#if ENABLE_INPUT_SYSTEM
using UnityEngine.InputSystem;
#endif
namespace Michsky.MUIP
{
public class DemoElementSway : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler
{
[Header("Resources")]
[SerializeField] private DemoElementSwayParent swayParent;
[SerializeField] private Canvas mainCanvas;
[SerializeField] private RectTransform swayObject;
[SerializeField] private CanvasGroup normalCG;
[SerializeField] private CanvasGroup highlightedCG;
[SerializeField] private CanvasGroup selectedCG;
[Header("Settings")]
[SerializeField] private float smoothness = 10;
[SerializeField] private float transitionSpeed = 8;
[SerializeField] [Range(0, 1)] private float dissolveAlpha = 0.5f;
[Header("Events")]
[SerializeField] private UnityEvent onClick;
bool allowSway;
[HideInInspector] public bool wmSelected;
Vector3 cursorPos;
Vector2 defaultPos;
void Awake()
{
if (swayParent == null)
{
var tempSway = transform.parent.GetComponent<DemoElementSwayParent>();
if (tempSway == null) { transform.parent.gameObject.AddComponent<DemoElementSwayParent>(); }
swayParent = tempSway;
}
defaultPos = swayObject.anchoredPosition;
normalCG.alpha = 1;
highlightedCG.alpha = 0;
}
void Update()
{
#if ENABLE_LEGACY_INPUT_MANAGER
if (allowSway == true) { cursorPos = Input.mousePosition; }
#elif ENABLE_INPUT_SYSTEM
if (allowSway == true) { cursorPos = Mouse.current.position.ReadValue(); }
#endif
if (mainCanvas.renderMode == RenderMode.ScreenSpaceOverlay) { ProcessOverlay(); }
else if (mainCanvas.renderMode == RenderMode.ScreenSpaceCamera) { ProcessSSC(); }
else if (mainCanvas.renderMode == RenderMode.WorldSpace) { ProcessWorldSpace(); }
}
void ProcessOverlay()
{
if (allowSway == true) { swayObject.position = Vector2.Lerp(swayObject.position, cursorPos, Time.deltaTime * smoothness); }
else { swayObject.localPosition = Vector2.Lerp(swayObject.localPosition, defaultPos, Time.deltaTime * smoothness); }
}
void ProcessSSC()
{
if (allowSway == true) { swayObject.position = Vector2.Lerp(swayObject.position, Camera.main.ScreenToWorldPoint(cursorPos), Time.deltaTime * smoothness); }
else { swayObject.localPosition = Vector2.Lerp(swayObject.localPosition, defaultPos, Time.deltaTime * smoothness); }
}
void ProcessWorldSpace()
{
if (allowSway == true)
{
Vector3 clampedPos = new Vector3(cursorPos.x, cursorPos.y, (mainCanvas.transform.position.z / 6f));
swayObject.position = Vector3.Lerp(swayObject.position, Camera.main.ScreenToWorldPoint(clampedPos), Time.deltaTime * smoothness);
}
else { swayObject.localPosition = Vector3.Lerp(swayObject.localPosition, defaultPos, Time.deltaTime * smoothness); }
}
public void Dissolve()
{
if (wmSelected == true)
return;
StopCoroutine("DissolveHelper");
StopCoroutine("HighlightHelper");
StopCoroutine("ActiveHelper");
StartCoroutine("DissolveHelper");
}
public void Highlight()
{
if (wmSelected == true)
return;
StopCoroutine("DissolveHelper");
StopCoroutine("HighlightHelper");
StopCoroutine("ActiveHelper");
StartCoroutine("HighlightHelper");
}
public void Active()
{
if (wmSelected == true)
return;
StopCoroutine("DissolveHelper");
StopCoroutine("HighlightHelper");
StopCoroutine("HighlightHelper");
StartCoroutine("ActiveHelper");
}
public void WindowManagerSelect()
{
wmSelected = true;
StopCoroutine("ActiveHelper");
StopCoroutine("HighlightHelper");
StartCoroutine("WMSelectHelper");
}
public void WindowManagerDeselect()
{
wmSelected = false;
StartCoroutine("WMDeselectHelper");
StartCoroutine("DissolveHelper");
}
public void OnPointerEnter(PointerEventData data)
{
allowSway = true;
swayParent.DissolveAll(this);
}
public void OnPointerExit(PointerEventData data)
{
allowSway = false;
swayParent.HighlightAll();
}
public void OnPointerClick(PointerEventData data)
{
onClick.Invoke();
}
IEnumerator DissolveHelper()
{
while (normalCG.alpha > dissolveAlpha)
{
normalCG.alpha -= Time.unscaledDeltaTime * transitionSpeed;
highlightedCG.alpha -= Time.unscaledDeltaTime * transitionSpeed;
yield return null;
}
highlightedCG.alpha = 0;
normalCG.alpha = dissolveAlpha;
highlightedCG.gameObject.SetActive(false);
}
IEnumerator HighlightHelper()
{
while (normalCG.alpha < 1)
{
normalCG.alpha += Time.unscaledDeltaTime * transitionSpeed;
highlightedCG.alpha -= Time.unscaledDeltaTime * transitionSpeed;
yield return null;
}
normalCG.alpha = 1;
highlightedCG.alpha = 0;
highlightedCG.gameObject.SetActive(false);
}
IEnumerator ActiveHelper()
{
highlightedCG.gameObject.SetActive(true);
while (highlightedCG.alpha < 1)
{
normalCG.alpha -= Time.unscaledDeltaTime * transitionSpeed;
highlightedCG.alpha += Time.unscaledDeltaTime * transitionSpeed;
yield return null;
}
highlightedCG.alpha = 1;
normalCG.alpha = 0;
}
IEnumerator WMSelectHelper()
{
selectedCG.gameObject.SetActive(true);
while (selectedCG.alpha < 1)
{
normalCG.alpha -= Time.unscaledDeltaTime * transitionSpeed;
highlightedCG.alpha -= Time.unscaledDeltaTime * transitionSpeed;
selectedCG.alpha += Time.unscaledDeltaTime * transitionSpeed;
yield return null;
}
highlightedCG.alpha = 0;
normalCG.alpha = 0;
selectedCG.alpha = 1;
}
IEnumerator WMDeselectHelper()
{
while (selectedCG.alpha > 0)
{
selectedCG.alpha -= Time.unscaledDeltaTime * transitionSpeed;
yield return null;
}
selectedCG.alpha = 0;
selectedCG.gameObject.SetActive(false);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a7afc8c12ad2e104ebc86906fc37ec31
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,83 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
namespace Michsky.MUIP
{
public class DemoElementSwayParent : MonoBehaviour
{
[SerializeField] private Animator titleAnimator;
[SerializeField] private TextMeshProUGUI elementTitle;
[SerializeField] private TextMeshProUGUI elementTitleHelper;
private List<DemoElementSway> elements = new List<DemoElementSway>();
private int prevIndex;
void Awake()
{
foreach (Transform child in transform)
{
elements.Add(child.GetComponent<DemoElementSway>());
}
}
public void DissolveAll(DemoElementSway currentSway)
{
for (int i = 0; i < elements.Count; ++i)
{
if (elements[i] == currentSway)
{
elements[i].Active();
continue;
}
elements[i].Dissolve();
}
}
public void HighlightAll()
{
for (int i = 0; i < elements.Count; ++i)
{
elements[i].Highlight();
}
}
public void SetWindowManagerButton(int index)
{
if (elements.Count == 0)
{
StartCoroutine("SWMHelper", index);
return;
}
for (int i = 0; i < elements.Count; ++i)
{
if (i == index) { elements[i].WindowManagerSelect(); }
else
{
if (elements[i].wmSelected == false) { continue; }
elements[i].WindowManagerDeselect();
}
}
if (titleAnimator == null)
return;
elementTitleHelper.text = elements[prevIndex].gameObject.name;
elementTitle.text = elements[index].gameObject.name;
titleAnimator.Play("Idle");
titleAnimator.Play("Transition");
prevIndex = index;
}
IEnumerator SWMHelper(int index)
{
yield return new WaitForSeconds(0.1f);
SetWindowManagerButton(index);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5fa48de8543315549bf27cc38c7eceea
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,135 @@
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
namespace Michsky.MUIP
{
public class DemoListShadow : MonoBehaviour, IBeginDragHandler
{
[Header("Resources")]
[SerializeField] private Scrollbar listScrollbar;
[SerializeField] private CanvasGroup leftCG;
[SerializeField] private CanvasGroup rightCG;
[Header("Settings")]
[SerializeField] private float scrollTime = 5;
[SerializeField] private float transitionSpeed = 4;
void Awake()
{
CheckForValue(0);
}
public void CheckForValue(float value)
{
if (value > 0.05)
{
StopCoroutine("LeftCGFadeOut");
StartCoroutine("LeftCGFadeIn");
}
else
{
StopCoroutine("LeftCGFadeIn");
StartCoroutine("LeftCGFadeOut");
}
if (value < 0.95)
{
StopCoroutine("RightCGFadeOut");
StartCoroutine("RightCGFadeIn");
}
else
{
StopCoroutine("RightCGFadeIn");
StartCoroutine("RightCGFadeOut");
}
}
public void ScrollUp() { StopCoroutine("ScrollDownHelper"); StartCoroutine("ScrollUpHelper"); }
public void ScrollDown() { StopCoroutine("ScrollUpHelper"); StartCoroutine("ScrollDownHelper"); }
public void OnBeginDrag(PointerEventData data) { StopCoroutine("ScrollUpHelper"); StopCoroutine("ScrollDownHelper"); }
IEnumerator ScrollUpHelper()
{
float elapsedTime = 0;
while (elapsedTime < scrollTime)
{
listScrollbar.value = Mathf.Lerp(listScrollbar.value, 0, elapsedTime / scrollTime);
elapsedTime += Time.unscaledDeltaTime;
yield return new WaitForEndOfFrame();
}
}
IEnumerator ScrollDownHelper()
{
float elapsedTime = 0;
while (elapsedTime < scrollTime)
{
listScrollbar.value = Mathf.Lerp(listScrollbar.value, 1, elapsedTime / scrollTime);
elapsedTime += Time.unscaledDeltaTime;
yield return new WaitForEndOfFrame();
}
}
IEnumerator LeftCGFadeIn()
{
leftCG.interactable = true;
leftCG.blocksRaycasts = true;
while (leftCG.alpha < 0.99f)
{
leftCG.alpha += Time.unscaledDeltaTime * transitionSpeed;
yield return new WaitForEndOfFrame();
}
leftCG.alpha = 1;
}
IEnumerator LeftCGFadeOut()
{
leftCG.interactable = false;
leftCG.blocksRaycasts = false;
while (leftCG.alpha > 0.01f)
{
leftCG.alpha -= Time.unscaledDeltaTime * transitionSpeed;
yield return new WaitForEndOfFrame();
}
leftCG.alpha = 0;
}
IEnumerator RightCGFadeIn()
{
rightCG.interactable = true;
rightCG.blocksRaycasts = true;
while (rightCG.alpha < 0.99f)
{
rightCG.alpha += Time.unscaledDeltaTime * transitionSpeed;
yield return new WaitForEndOfFrame();
}
rightCG.alpha = 1;
}
IEnumerator RightCGFadeOut()
{
rightCG.interactable = false;
rightCG.blocksRaycasts = false;
while (rightCG.alpha > 0.01f)
{
rightCG.alpha -= Time.unscaledDeltaTime * transitionSpeed;
yield return new WaitForEndOfFrame();
}
rightCG.alpha = 0;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e373f9a5f6c9bab449c78beab64a8d53
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,25 @@
using UnityEngine;
using UnityEngine.EventSystems;
#if ENABLE_INPUT_SYSTEM
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.UI;
#endif
namespace Michsky.MUIP
{
public class InputSystemChecker : MonoBehaviour
{
void Awake()
{
#if ENABLE_INPUT_SYSTEM && !ENABLE_LEGACY_INPUT_MANAGER
InputSystemUIInputModule tempModule = gameObject.GetComponent<InputSystemUIInputModule>();
if (tempModule == null)
{
Debug.LogError("<b>[Modern UI Pack]</b> Input System is enabled, but <b>'Input System UI Input Module'</b> is missing. " +
"Select the event system object, and click the <b>'Replace'</b> button.");
}
#endif
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1dfe135108c08d54d8978d026b05b601
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 731973609e4a7a94aa4d2f33c86dc13f
timeCreated: 1493639454
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: