window mode and botany wip
This commit is contained in:
1 parent
f0aa6495c7
commit
0f9576a67b
68 files changed
+8224
-1311
No files matched your search
@@ -0,0 +1,7 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Discord : MonoBehaviour {
|
||||
public void OpenURL() {
|
||||
Application.OpenURL("https://discord.gg/45yymHzf38");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a5af611cdce9cc9458d7792debb27255
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,9 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Display : MonoBehaviour
|
||||
{
|
||||
public void SetWindowed(bool v) {
|
||||
// Toggle fullscreen
|
||||
Screen.fullScreen = !Screen.fullScreen;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 99247b6907a6da441af07cf95950880f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,97 @@
|
||||
using Assets.WasapiAudio.Scripts.Unity;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
using UnityEditor;
|
||||
using UnityEngine.SceneManagement;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.VFX;
|
||||
using UnityEngine;
|
||||
|
||||
|
||||
public class Loader : MonoBehaviour {
|
||||
public Text currentVis;
|
||||
public Canvas vfxMenu;
|
||||
|
||||
private static bool menuVisible;
|
||||
private Scene scene;
|
||||
private KeyCode NextButton = KeyCode.Space;
|
||||
private KeyCode PrevButton = KeyCode.Backspace;
|
||||
private KeyCode MenuButton = KeyCode.Escape;
|
||||
|
||||
void Awake() {
|
||||
ToggleMenu(menuVisible);
|
||||
}
|
||||
|
||||
void Start() {
|
||||
scene = SceneManager.GetActiveScene();
|
||||
currentVis.text = scene.name;
|
||||
// Debug.Log("Active Scene name is: " + scene.name + "\nActive Scene index: " + scene.buildIndex);
|
||||
}
|
||||
|
||||
void Update() {
|
||||
if (Input.GetKeyDown(NextButton)) {
|
||||
NextScene();
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(PrevButton)) {
|
||||
PrevScene();
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(MenuButton)) {
|
||||
ToggleMenu(!menuVisible);
|
||||
}
|
||||
}
|
||||
|
||||
void VfxMenuVisible(bool v) {
|
||||
if (vfxMenu) vfxMenu.enabled = v;
|
||||
}
|
||||
|
||||
void ToggleMenu(bool visible) {
|
||||
if (visible) {
|
||||
gameObject.GetComponent<Canvas>().enabled = true;
|
||||
VfxMenuVisible(true);
|
||||
} else {
|
||||
gameObject.GetComponent<Canvas>().enabled = false;
|
||||
VfxMenuVisible(false);
|
||||
}
|
||||
|
||||
menuVisible = visible;
|
||||
}
|
||||
|
||||
public void NextScene() {
|
||||
int current = scene.buildIndex;
|
||||
int next = (current + 1) % (SceneManager.sceneCountInBuildSettings);
|
||||
|
||||
// welcome is at 0. skip it
|
||||
if (next == 0) next = 1;
|
||||
if (next != current) LoadScene(next);
|
||||
}
|
||||
|
||||
public void PrevScene() {
|
||||
int current = scene.buildIndex;
|
||||
int prev = (current - 1);
|
||||
// check for welcome
|
||||
if (prev <= 0) prev = SceneManager.sceneCountInBuildSettings - 1;
|
||||
if (prev != current) LoadScene(prev);
|
||||
}
|
||||
|
||||
public void LoadScene(int i) {
|
||||
SceneManager.LoadScene(i);
|
||||
}
|
||||
|
||||
public void Quit() {
|
||||
// if (EditorApplication) EditorApplication.isPlaying = false;
|
||||
Application.Quit();
|
||||
}
|
||||
|
||||
// IEnumerator LoadScene(int i) {
|
||||
// AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(i);
|
||||
|
||||
// // Wait until the asynchronous scene fully loads
|
||||
// while (!asyncLoad.isDone)
|
||||
// {
|
||||
// yield return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: edc7f4051961d784f9af9801cc399927
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,37 @@
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
[System.Serializable]
|
||||
public class PreferenceData {
|
||||
// Preference Fields
|
||||
public int themeIndex;
|
||||
|
||||
// Others
|
||||
string _path;
|
||||
|
||||
public PreferenceData(string path) {
|
||||
_path = path;
|
||||
themeIndex = 0;
|
||||
}
|
||||
|
||||
public PreferenceData Load() {
|
||||
try {
|
||||
string json = File.ReadAllText(_path);
|
||||
JsonUtility.FromJsonOverwrite(json, this);
|
||||
return this;
|
||||
} catch {
|
||||
// file doesn't exist yet
|
||||
return Save();
|
||||
}
|
||||
}
|
||||
|
||||
public PreferenceData Save() {
|
||||
File.WriteAllText(_path, JsonUtility.ToJson(this));
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public interface IPreferenceData {
|
||||
PreferenceData LoadPreferences();
|
||||
PreferenceData SavePreferences();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 527dc6c194bc32c4da9ea01e83de6fbe
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.IO;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[ExecuteAlways]
|
||||
public class Preferences : MonoBehaviour {
|
||||
public ThemeSelector themeSelector;
|
||||
public PreferenceData data;
|
||||
|
||||
void Awake() {
|
||||
string path = Path.Combine(Application.persistentDataPath, "preferences.json");
|
||||
data = new PreferenceData(path).Load();
|
||||
// Debug.Log($"ThemeIndex {data.themeIndex}");
|
||||
}
|
||||
|
||||
public void SetThemeIndex(int i) {
|
||||
data.themeIndex = i;
|
||||
data.Save();
|
||||
}
|
||||
|
||||
public Gradient Theme() {
|
||||
return themeSelector.CurrentTheme();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 26b88d85e12af85469a5e3e4cfc3586b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine;
|
||||
|
||||
[RequireComponent(typeof(Dropdown))]
|
||||
public class ThemeSelector : MonoBehaviour {
|
||||
public Gradient[] themeList;
|
||||
public static Gradient theme;
|
||||
public Preferences preferences;
|
||||
|
||||
[SerializeField, ColorUsage(showAlpha: true, hdr: true)]
|
||||
private Color hdrColor;
|
||||
|
||||
void Start() {
|
||||
gameObject.GetComponent<Dropdown>().value = preferences.data.themeIndex;
|
||||
theme = themeList[preferences.data.themeIndex];
|
||||
}
|
||||
|
||||
public void SelectTheme(Dropdown d) {
|
||||
theme = themeList[d.value];
|
||||
preferences.SetThemeIndex(d.value);
|
||||
}
|
||||
|
||||
public Gradient CurrentTheme() {
|
||||
return theme;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a4ecabf05fe7f144948e9229d01468b
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,39 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.VFX.Utility;
|
||||
using UnityEngine.VFX;
|
||||
using UnityEngine;
|
||||
|
||||
[AddComponentMenu("VFX/Property Binders/Kaiju - Theme Binder")]
|
||||
[VFXBinder("Kaiju/Kaiju Theme Binder")]
|
||||
public class ThemeVfxBinder : VFXBinderBase {
|
||||
public Preferences preferences;
|
||||
|
||||
[VFXPropertyBinding("UnityEngine.Gradient"), SerializeField]
|
||||
protected ExposedProperty ThemeParameter = "Theme";
|
||||
|
||||
void Awake() {
|
||||
if (preferences == null) Debug.Log("Theme VFX Binder needs preferences.");
|
||||
}
|
||||
|
||||
public override bool IsValid(VisualEffect component) {
|
||||
return preferences != null
|
||||
&& preferences.Theme() != null
|
||||
&& component.HasGradient(ThemeParameter);
|
||||
}
|
||||
|
||||
public override void UpdateBinding(VisualEffect component) {
|
||||
component.SetGradient(ThemeParameter, preferences.Theme());
|
||||
}
|
||||
|
||||
|
||||
// have to override these to prevent NRE
|
||||
protected override void OnEnable() {
|
||||
// Debug.Log("OnEnable");
|
||||
}
|
||||
|
||||
protected override void OnDisable() {
|
||||
// Debug.Log("OnDisable");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 269234fd88fbc1d4abae3d63a0e04233
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,42 @@
|
||||
using System.Collections.Generic;
|
||||
using Assets.WasapiAudio.Scripts.Unity;
|
||||
using UnityEngine;
|
||||
|
||||
public abstract class TripsitterAve : MonoBehaviour
|
||||
{
|
||||
public WasapiAudioSource source;
|
||||
|
||||
[SerializeReference]
|
||||
[SerializeReferenceButton]
|
||||
private List<SpectrumTransformer> transformers = new List<SpectrumTransformer>();
|
||||
|
||||
[SpectrumDataPreview]
|
||||
public SpectrumData Preview;
|
||||
|
||||
protected int SpectrumSize { get; private set; }
|
||||
public List<SpectrumTransformer> Transformers { get => transformers; set => transformers = value; }
|
||||
|
||||
public virtual void Awake() {
|
||||
SpectrumSize = source.SpectrumSize;
|
||||
Preview = new SpectrumData();
|
||||
}
|
||||
|
||||
protected float[] GetSpectrumData()
|
||||
{
|
||||
// Get raw / unmodified spectrum data
|
||||
var spectrumData = source.GetSpectrumData();
|
||||
|
||||
// Run spectrum data through all configured transformers
|
||||
if (Transformers != null && Transformers.Count > 0)
|
||||
{
|
||||
foreach (var transformer in Transformers)
|
||||
{
|
||||
spectrumData = transformer.Transform(spectrumData);
|
||||
}
|
||||
}
|
||||
|
||||
Preview.Values = spectrumData;
|
||||
|
||||
return spectrumData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0531e4e136b0daa41a7bbd6ac7ceed8c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in new issue
Block a user