menus
This commit is contained in:
1 parent
cf55d7034d
commit
4d24939a2b
9 files changed
+5132
-1596
No files matched your search
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.VFX;
|
||||
using UnityEngine.UI;
|
||||
using Assets.WasapiAudio.Scripts.Unity;
|
||||
|
||||
public class Loader : MonoBehaviour {
|
||||
public KeyCode NextButton = KeyCode.Space;
|
||||
@@ -27,6 +28,12 @@ public class Loader : MonoBehaviour {
|
||||
// but their vfx components are disabled in editor
|
||||
v.SetActive(false);
|
||||
v.GetComponent<VisualEffect>().enabled = true;
|
||||
// v.GetComponent<VfxAudioSpectrumDataBinder>().enabled = true;
|
||||
|
||||
// look for a canvas in children
|
||||
// bit sketchy...
|
||||
Canvas v_menu = v.GetComponentInChildren<Canvas>();
|
||||
if (v_menu) v_menu.enabled = false;
|
||||
}
|
||||
|
||||
ToggleMenu(_menu_visible);
|
||||
@@ -58,6 +65,9 @@ public class Loader : MonoBehaviour {
|
||||
_current = i;
|
||||
vis[i].SetActive(true);
|
||||
currentVis.text = vis[i].name;
|
||||
|
||||
// ensure menu is synced on vis change
|
||||
ToggleMenu(_menu_visible);
|
||||
}
|
||||
|
||||
void LoadNextVis() {
|
||||
@@ -66,11 +76,18 @@ public class Loader : MonoBehaviour {
|
||||
LoadVis(next);
|
||||
}
|
||||
|
||||
void VisMenuVisible(int i, bool v) {
|
||||
Canvas v_menu = vis[i].GetComponentInChildren<Canvas>();
|
||||
if (v_menu) v_menu.enabled = v;
|
||||
}
|
||||
|
||||
void ToggleMenu(bool visible) {
|
||||
if (visible) {
|
||||
menu.GetComponent<Canvas>().enabled = true;
|
||||
VisMenuVisible(_current, true);
|
||||
} else {
|
||||
menu.GetComponent<Canvas>().enabled = false;
|
||||
VisMenuVisible(_current, false);
|
||||
}
|
||||
|
||||
_menu_visible = visible;
|
||||
|
||||
Reference in new issue
Block a user