Rendering Fixes and Other Adjustments (#384)

* fix game view alpha issues

* fix right-clicking on parameter-less entity locking event selection

* reduce ram use of rendertextures

* fix missing sprite references

fix cheer readers sprite masks not working

* fix lockstep rendering discrepancy

* fix section medal toggle not matching described behaviour in UI

* fix game settings masking issue

* dj school "Scratchy Music" toggle on by default

* import new sheets for fan club, mahou tsukai

* make dj school audio FX persist between game change

* make one shot sounds not create extra objects when not needed

* fix potential issue with new one shots

* make string properties apply changes for every keystroke
This commit is contained in:
minenice55
2023-04-03 00:17:55 -04:00
committed by GitHub
parent be78d1567e
commit 3984c8353f
29 changed files with 1913 additions and 173 deletions

View File

@ -511,6 +511,7 @@ namespace HeavenStudio
Destroy(SoundObjects[i].gameObject);
SoundObjects.Clear();
Util.Jukebox.KillOneShots();
}
#endregion

View File

@ -56,7 +56,7 @@ namespace HeavenStudio.Games.Loaders
},
new GameAction("dj voice lines", "DJ Yellow Banter")
{
function = delegate { DJSchool.instance.voiceLines(eventCaller.currentEntity.beat, eventCaller.currentEntity["type"]); },
function = delegate { DJSchool.instance.VoiceLines(eventCaller.currentEntity.beat, eventCaller.currentEntity["type"]); },
defaultLength = 2f,
inactiveFunction = delegate { DJSchool.WarnDJVoiceLines(eventCaller.currentEntity.beat, eventCaller.currentEntity["type"]); },
parameters = new List<Param>()
@ -66,11 +66,11 @@ namespace HeavenStudio.Games.Loaders
},
new GameAction("sound FX", "Scratchy Music")
{
function = delegate { DJSchool.instance.soundFX(eventCaller.currentEntity["toggle"]); },
function = delegate { DJSchool.SoundFX(eventCaller.currentEntity["toggle"]); },
defaultLength = 0.5f,
parameters = new List<Param>()
{
new Param("toggle", false, "Radio FX", "Toggle on and off for Radio Effects")
new Param("toggle", true, "Radio FX", "Toggle on and off for Radio Effects")
}
},
new GameAction("forceHold", "Force Hold")
@ -156,7 +156,7 @@ namespace HeavenStudio.Games
}
else if(wantDJVoiceLines != Single.MinValue)
{
voiceLines(wantDJVoiceLines, 0);
VoiceLines(wantDJVoiceLines, 0);
wantDJVoiceLines = Single.MinValue;
}
}
@ -549,11 +549,11 @@ namespace HeavenStudio.Games
// student.ResetState();
//}
public void soundFX(bool toggle)
public static void SoundFX(bool toggle)
{
student.soundFX = toggle;
Student.soundFX = toggle;
}
public void voiceLines(float beat, int type)
public void VoiceLines(float beat, int type)
{
string[] sounds;
var sound = new MultiSound.Sound[] { };

View File

@ -12,6 +12,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
public class Student : PlayerActionObject
{
public Animator anim;
public static bool soundFX;
[Header("Properties")]
public float holdBeat;
@ -21,7 +22,6 @@ namespace HeavenStudio.Games.Scripts_DJSchool
public bool eligible;
public bool missed;
public bool swiping;
public bool soundFX;
bool canBoo = true;
[Header("Components")]

View File

@ -104,6 +104,10 @@ namespace HeavenStudio.Editor
active = true;
}
else
{
active = false;
}
}
private void AddParam(string propertyName, object type, string caption, string tooltip = "")

View File

@ -28,7 +28,7 @@ namespace HeavenStudio.Editor
_ =>
Editor.instance.editingInputField = true
);
inputFieldString.onEndEdit.AddListener(
inputFieldString.onValueChanged.AddListener(
_ =>
{;
parameterManager.entity[propertyName] = inputFieldString.text;

View File

@ -28,7 +28,7 @@ namespace HeavenStudio.Editor
_ =>
Editor.instance.editingInputField = true
);
inputFieldString.onEndEdit.AddListener(
inputFieldString.onValueChanged.AddListener(
_ =>
{;
parameterManager.chart[propertyName] = inputFieldString.text;

View File

@ -51,7 +51,7 @@ namespace HeavenStudio.Common
public void OnSectionChange(DynamicBeatmap.ChartSection section)
{
if (section == null) return;
Debug.Log(PersistentDataManager.gameSettings.isMedalOn);
if (!PersistentDataManager.gameSettings.isMedalOn) return;
if (PersistentDataManager.gameSettings.isMedalOn && !isMedalsStarted)
{
isMedalsStarted = true;
@ -67,6 +67,7 @@ namespace HeavenStudio.Common
public void OnRemixEnd()
{
if (!PersistentDataManager.gameSettings.isMedalOn) return;
if (PersistentDataManager.gameSettings.isMedalOn && isMedalsStarted)
{
GameObject medal = Instantiate(isMedalsEligible ? MedalOkPrefab : MedalMissPrefab, MedalsHolder.transform);

View File

@ -7,6 +7,9 @@ namespace HeavenStudio.Util
{
public class Jukebox
{
static GameObject oneShotAudioSourceObject;
static AudioSource oneShotAudioSource;
public enum AudioType
{
OGG,
@ -23,6 +26,14 @@ namespace HeavenStudio.Util
GameObject Jukebox = new GameObject("Jukebox");
Jukebox.AddComponent<AudioSource>();
Jukebox.tag = "Jukebox";
}
if (oneShotAudioSourceObject == null)
{
oneShotAudioSourceObject = new GameObject("OneShot Audio Source");
oneShotAudioSource = oneShotAudioSourceObject.AddComponent<AudioSource>();
UnityEngine.Object.DontDestroyOnLoad(oneShotAudioSourceObject);
}
}
@ -40,15 +51,16 @@ namespace HeavenStudio.Util
FindJukebox().GetComponent<AudioSource>().volume = volume;
}
public static void KillOneShots()
{
if (oneShotAudioSource != null)
{
oneShotAudioSource.Stop();
}
}
public static Sound PlayOneShot(string name, float beat = -1, float pitch = 1f, float volume = 1f, bool looping = false, string game = null)
{
GameObject oneShot = new GameObject("oneShot");
AudioSource audioSource = oneShot.AddComponent<AudioSource>();
//audioSource.outputAudioMixerGroup = Settings.GetSFXMixer();
audioSource.playOnAwake = false;
Sound snd = oneShot.AddComponent<Sound>();
AudioClip clip = null;
if (game != null)
{
@ -72,16 +84,39 @@ namespace HeavenStudio.Util
clip = Resources.Load<AudioClip>($"Sfx/{name}");
}
snd.clip = clip;
snd.beat = beat;
snd.pitch = pitch;
snd.volume = volume;
snd.looping = looping;
// snd.pitch = (clip.length / Conductor.instance.secPerBeat);
if (looping || beat != -1 || pitch != 1f)
{
GameObject oneShot = new GameObject("oneShot");
GameManager.instance.SoundObjects.Add(oneShot);
AudioSource audioSource = oneShot.AddComponent<AudioSource>();
//audioSource.outputAudioMixerGroup = Settings.GetSFXMixer();
audioSource.playOnAwake = false;
return snd;
Sound snd = oneShot.AddComponent<Sound>();
snd.clip = clip;
snd.beat = beat;
snd.pitch = pitch;
snd.volume = volume;
snd.looping = looping;
// snd.pitch = (clip.length / Conductor.instance.secPerBeat);
GameManager.instance.SoundObjects.Add(oneShot);
return snd;
}
else
{
if (oneShotAudioSourceObject == null)
{
oneShotAudioSourceObject = new GameObject("OneShot Audio Source");
oneShotAudioSource = oneShotAudioSourceObject.AddComponent<AudioSource>();
UnityEngine.Object.DontDestroyOnLoad(oneShotAudioSourceObject);
}
oneShotAudioSource.PlayOneShot(clip, volume);
return null;
}
}
public static Sound PlayOneShotScheduled(string name, double targetTime, float pitch = 1f, float volume = 1f, bool looping = false, string game = null)