Merge branch 'master' of https://github.com/megaminerjenny/HeavenStudio into master-old
This commit is contained in:
commit
6432a587e5
|
@ -22473,6 +22473,145 @@ MonoBehaviour:
|
|||
m_Script: {fileID: 11500000, guid: c8bf5d56f80c8814489e7b35cc9421ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
SoundSequences:
|
||||
- name: arisa_hai
|
||||
sequence:
|
||||
game: 1
|
||||
force: 0
|
||||
clips:
|
||||
- clip: fanClub/arisa_hai_1_jp
|
||||
beat: 0
|
||||
pitch: 1
|
||||
volume: 1
|
||||
looping: 0
|
||||
offset: 0
|
||||
- clip: fanClub/arisa_hai_2_jp
|
||||
beat: 1
|
||||
pitch: 1
|
||||
volume: 1
|
||||
looping: 0
|
||||
offset: 0
|
||||
- clip: fanClub/arisa_hai_3_jp
|
||||
beat: 2
|
||||
pitch: 1
|
||||
volume: 1
|
||||
looping: 0
|
||||
offset: 0
|
||||
- name: crowd_hai
|
||||
sequence:
|
||||
game: 1
|
||||
force: 0
|
||||
clips:
|
||||
- clip: fanClub/crowd_hai_jp
|
||||
beat: 0
|
||||
pitch: 1
|
||||
volume: 1
|
||||
looping: 0
|
||||
offset: 0
|
||||
- clip: fanClub/crowd_hai_jp
|
||||
beat: 1
|
||||
pitch: 1
|
||||
volume: 1
|
||||
looping: 0
|
||||
offset: 0
|
||||
- clip: fanClub/crowd_hai_jp
|
||||
beat: 2
|
||||
pitch: 1
|
||||
volume: 1
|
||||
looping: 0
|
||||
offset: 0
|
||||
- clip: fanClub/crowd_hai_jp
|
||||
beat: 3
|
||||
pitch: 1
|
||||
volume: 1
|
||||
looping: 0
|
||||
offset: 0
|
||||
- name: arisa_kamone
|
||||
sequence:
|
||||
game: 1
|
||||
force: 0
|
||||
clips:
|
||||
- clip: fanClub/arisa_ka_jp
|
||||
beat: 0
|
||||
pitch: 1
|
||||
volume: 1
|
||||
looping: 0
|
||||
offset: 0
|
||||
- clip: fanClub/arisa_mo_jp
|
||||
beat: 0.5
|
||||
pitch: 1
|
||||
volume: 1
|
||||
looping: 0
|
||||
offset: 0.07407407
|
||||
- clip: fanClub/arisa_ne_jp
|
||||
beat: 1
|
||||
pitch: 1
|
||||
volume: 1
|
||||
looping: 0
|
||||
offset: 0.07407407
|
||||
- name: arisa_kamone_fast
|
||||
sequence:
|
||||
game: 1
|
||||
force: 0
|
||||
clips:
|
||||
- clip: fanClub/arisa_ka_fast_jp
|
||||
beat: 0
|
||||
pitch: 1
|
||||
volume: 1
|
||||
looping: 0
|
||||
offset: 0
|
||||
- clip: fanClub/arisa_mo_fast_jp
|
||||
beat: 0.25
|
||||
pitch: 1
|
||||
volume: 1
|
||||
looping: 0
|
||||
offset: 0
|
||||
- clip: fanClub/arisa_ne_fast_jp
|
||||
beat: 0.5
|
||||
pitch: 1
|
||||
volume: 1
|
||||
looping: 0
|
||||
offset: 0
|
||||
- name: crowd_kamone
|
||||
sequence:
|
||||
game: 1
|
||||
force: 0
|
||||
clips:
|
||||
- clip: fanClub/crowd_ka_jp
|
||||
beat: 0
|
||||
pitch: 1
|
||||
volume: 1
|
||||
looping: 0
|
||||
offset: 0
|
||||
- clip: fanClub/crowd_mo_jp
|
||||
beat: 1.5
|
||||
pitch: 1
|
||||
volume: 1
|
||||
looping: 0
|
||||
offset: 0
|
||||
- clip: fanClub/crowd_ne_jp
|
||||
beat: 2
|
||||
pitch: 1
|
||||
volume: 1
|
||||
looping: 0
|
||||
offset: 0
|
||||
- clip: fanClub/crowd_hey_jp
|
||||
beat: 3
|
||||
pitch: 1
|
||||
volume: 1
|
||||
looping: 0
|
||||
offset: 0
|
||||
- name: crowd_big_ready
|
||||
sequence:
|
||||
game: 1
|
||||
force: 0
|
||||
clips:
|
||||
- clip: fanClub/crowd_big_ready
|
||||
beat: 0
|
||||
pitch: 1
|
||||
volume: 1
|
||||
looping: 0
|
||||
offset: 0
|
||||
EligibleHits: []
|
||||
scheduledInputs: []
|
||||
firstEnable: 0
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEngine;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
@ -344,8 +345,33 @@ namespace HeavenStudio
|
|||
System.Type type, pType;
|
||||
foreach (var e in entities)
|
||||
{
|
||||
game = EventCaller.instance.GetMinigame(e.datamodel.Split(0));
|
||||
action = EventCaller.instance.GetGameAction(game, e.datamodel.Split(1));
|
||||
var gameName = e.datamodel.Split(0);
|
||||
var actionName = e.datamodel.Split(1);
|
||||
game = EventCaller.instance.GetMinigame(gameName);
|
||||
if (game == null)
|
||||
{
|
||||
Debug.LogWarning($"Unknown game {gameName} found in remix.json! Adding game...");
|
||||
game = new Minigames.Minigame(gameName, DisplayName(gameName) + " \n<color=#eb5454>[inferred from remix.json]</color>", "", false, true, new List<Minigames.GameAction>());
|
||||
EventCaller.instance.minigames.Add(game);
|
||||
Editor.Editor.instance.AddIcon(game);
|
||||
}
|
||||
action = EventCaller.instance.GetGameAction(game, actionName);
|
||||
if (action == null)
|
||||
{
|
||||
Debug.LogWarning($"Unknown action {gameName}/{actionName} found in remix.json! Adding action...");
|
||||
var parameters = new List<Minigames.Param>();
|
||||
foreach (var item in e.DynamicData)
|
||||
{
|
||||
var value = item.Value;
|
||||
if (value.GetType() == typeof(long))
|
||||
value = new EntityTypes.Integer(int.MinValue, int.MaxValue, (int)value);
|
||||
else if (value.GetType() == typeof(double))
|
||||
value = new EntityTypes.Float(float.NegativeInfinity, float.PositiveInfinity, (float)value);
|
||||
parameters.Add(new Minigames.Param(item.Key, value, item.Key, "[inferred from remix.json]"));
|
||||
}
|
||||
action = new Minigames.GameAction(actionName, DisplayName(actionName), e.length, true, parameters);
|
||||
game.actions.Add(action);
|
||||
}
|
||||
Dictionary<string, dynamic> dynamicData = new Dictionary<string, dynamic>();
|
||||
//check each param of the action
|
||||
if (action.parameters != null)
|
||||
|
@ -361,9 +387,9 @@ namespace HeavenStudio
|
|||
{
|
||||
Debug.LogWarning($"Property {param.propertyName} does not exist in the entity's dynamic data! Adding...");
|
||||
if (type == typeof(EntityTypes.Integer))
|
||||
dynamicData.Add(param.propertyName, (int)param.parameter);
|
||||
dynamicData.Add(param.propertyName, ((EntityTypes.Integer)param.parameter).val);
|
||||
else if (type == typeof(EntityTypes.Float))
|
||||
dynamicData.Add(param.propertyName, (float)param.parameter);
|
||||
dynamicData.Add(param.propertyName, ((EntityTypes.Float)param.parameter).val);
|
||||
else if (type.IsEnum && param.propertyName != "ease")
|
||||
dynamicData.Add(param.propertyName, (int)param.parameter);
|
||||
else
|
||||
|
@ -408,5 +434,29 @@ namespace HeavenStudio
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string DisplayName(string name)
|
||||
{
|
||||
// "gameName" -> "Game Name"
|
||||
// "action name" -> "Action Name"
|
||||
if (!name.Contains(" "))
|
||||
name = SplitCamelCase(name);
|
||||
System.Globalization.TextInfo textInfo = new System.Globalization.CultureInfo("en-US", false).TextInfo;
|
||||
return textInfo.ToTitleCase(name);
|
||||
}
|
||||
|
||||
// https://stackoverflow.com/a/5796793
|
||||
public static string SplitCamelCase(string str)
|
||||
{
|
||||
return Regex.Replace(
|
||||
Regex.Replace(
|
||||
str,
|
||||
@"(\P{Ll})(\P{Ll}\p{Ll})",
|
||||
"$1 $2"
|
||||
),
|
||||
@"(\p{Ll})(\P{Ll})",
|
||||
"$1 $2"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
79
Assets/Scripts/Common/SoundSequence.cs
Normal file
79
Assets/Scripts/Common/SoundSequence.cs
Normal file
|
@ -0,0 +1,79 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using UnityEngine;
|
||||
|
||||
namespace HeavenStudio.Util
|
||||
{
|
||||
/// <summary>
|
||||
/// MultiSound that is serializable in the inspector, etc.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class SoundSequence
|
||||
{
|
||||
[Tooltip("Should sequence use game specific-sounds?")]
|
||||
[SerializeField] bool game;
|
||||
[Tooltip("Should sequence force playback even if corresponding game is not loaded?")]
|
||||
[SerializeField] bool force;
|
||||
[Tooltip("Clips to play in the sequence")]
|
||||
[SerializeField] private List<SequenceClip> clips = new List<SequenceClip>();
|
||||
|
||||
public SoundSequence(bool game, bool force, params SequenceClip[] clips)
|
||||
{
|
||||
this.game = game;
|
||||
this.force = force;
|
||||
this.clips = new List<SequenceClip>(clips);
|
||||
}
|
||||
|
||||
public MultiSound Play(float startBeat)
|
||||
{
|
||||
List<MultiSound.Sound> sounds = new List<MultiSound.Sound>();
|
||||
|
||||
foreach (SequenceClip clip in clips)
|
||||
{
|
||||
sounds.Add(new MultiSound.Sound(clip.clip, startBeat + clip.beat, clip.pitch, clip.volume, clip.looping, clip.offset));
|
||||
}
|
||||
|
||||
return MultiSound.Play(sounds.ToArray(), game, force);
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct SequenceClip
|
||||
{
|
||||
public SequenceClip(string clip, float beat, float pitch = 1f, float volume = 1f, bool looping = false, float offset = 0f)
|
||||
{
|
||||
this.clip = clip;
|
||||
this.beat = beat;
|
||||
this.pitch = pitch;
|
||||
this.volume = volume;
|
||||
this.looping = looping;
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
[Tooltip("Filename of clip to use (will look in assetbundles before resources)")]
|
||||
public string clip;
|
||||
[Tooltip("Beat to play clip at relative to start of sequence")]
|
||||
public float beat;
|
||||
[Tooltip("Pitch to play clip at")]
|
||||
[DefaultValue(1f)]
|
||||
public float pitch;
|
||||
[Tooltip("Volume to play clip at")]
|
||||
[DefaultValue(1f)]
|
||||
public float volume;
|
||||
[Tooltip("Whether to loop the clip")]
|
||||
public bool looping;
|
||||
[Tooltip("Offset to start playing clip")]
|
||||
public float offset;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct SequenceKeyValue
|
||||
{
|
||||
[Tooltip("Name of sequence (game scripts will call sequences to play using this name")]
|
||||
public string name;
|
||||
[Tooltip("Sequence to play")]
|
||||
public SoundSequence sequence;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Common/SoundSequence.cs.meta
Normal file
11
Assets/Scripts/Common/SoundSequence.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 643b435927934b34599a4250da088992
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -22,16 +22,22 @@ namespace HeavenStudio
|
|||
// Current song position, in seconds
|
||||
private double songPos; // for Conductor use only
|
||||
public float songPosition => (float) songPos;
|
||||
public double songPositionAsDouble => songPos;
|
||||
|
||||
// Current song position, in beats
|
||||
private double songPosBeat; // for Conductor use only
|
||||
public float songPositionInBeats => (float) songPosBeat;
|
||||
public double songPositionInBeatsAsDouble => songPosBeat;
|
||||
|
||||
// Current time of the song
|
||||
private double time;
|
||||
|
||||
double lastAbsTime;
|
||||
|
||||
// the dspTime we started at
|
||||
private double dspStartTime;
|
||||
public double dspStartTimeAsDouble => dspStartTime;
|
||||
|
||||
// an AudioSource attached to this GameObject that will play the music.
|
||||
public AudioSource musicSource;
|
||||
|
||||
|
@ -52,6 +58,7 @@ namespace HeavenStudio
|
|||
|
||||
// Metronome tick sound enabled
|
||||
public bool metronome = false;
|
||||
Util.Sound metronomeSound;
|
||||
|
||||
public float timeSinceLastTempoChange = Single.MinValue;
|
||||
|
||||
|
@ -142,6 +149,7 @@ namespace HeavenStudio
|
|||
}
|
||||
}
|
||||
lastAbsTime = Time.realtimeSinceStartupAsDouble;
|
||||
dspStartTime = AudioSettings.dspTime;
|
||||
|
||||
// GameManager.instance.SetCurrentEventToClosest(songPositionInBeats);
|
||||
}
|
||||
|
@ -189,13 +197,21 @@ namespace HeavenStudio
|
|||
{
|
||||
if (ReportBeat(ref lastReportedBeat))
|
||||
{
|
||||
Util.Jukebox.PlayOneShot("metronome");
|
||||
metronomeSound = Util.Jukebox.PlayOneShot("metronome", lastReportedBeat + 1f);
|
||||
}
|
||||
else if (songPositionInBeats < lastReportedBeat)
|
||||
{
|
||||
lastReportedBeat = Mathf.Round(songPositionInBeats);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (metronomeSound != null)
|
||||
{
|
||||
metronomeSound.Delete();
|
||||
metronomeSound = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool ReportBeat(ref float lastReportedBeat, float offset = 0, bool shiftBeatToOffset = true)
|
||||
|
|
|
@ -89,6 +89,23 @@ namespace HeavenStudio
|
|||
}
|
||||
}
|
||||
|
||||
public void CallPreEvent(DynamicBeatmap.DynamicEntity entity)
|
||||
{
|
||||
string[] details = entity.datamodel.Split('/');
|
||||
Minigames.Minigame game = minigames.Find(c => c.name == details[0]);
|
||||
try
|
||||
{
|
||||
currentEntity = entity;
|
||||
|
||||
Minigames.GameAction action = game.actions.Find(c => c.actionName == details[1]);
|
||||
action.preFunction.Invoke();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogWarning("Event not found! May be spelled wrong or it is not implemented.\n" + ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static List<DynamicBeatmap.DynamicEntity> GetAllInGameManagerList(string gameName, string[] include)
|
||||
{
|
||||
List<DynamicBeatmap.DynamicEntity> temp1 = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel.Split('/')[0] == gameName);
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace HeavenStudio
|
|||
|
||||
[Header("Properties")]
|
||||
public int currentEvent, currentTempoEvent, currentVolumeEvent, currentSectionEvent,
|
||||
currentPreEvent, currentPreSwitch;
|
||||
currentPreEvent, currentPreSwitch, currentPreSequence;
|
||||
public float endBeat;
|
||||
public float startOffset;
|
||||
public bool playOnStart;
|
||||
|
@ -48,7 +48,7 @@ namespace HeavenStudio
|
|||
return (Conductor.instance.songPositionInBeats - currentSection.beat) / (nextSection.beat - currentSection.beat);
|
||||
}}
|
||||
|
||||
public event Action<float> onBeatChanged;
|
||||
public event Action<float> onBeatChanged;
|
||||
public event Action<DynamicBeatmap.ChartSection> onSectionChange;
|
||||
|
||||
public int BeatmapEntities()
|
||||
|
@ -69,6 +69,7 @@ namespace HeavenStudio
|
|||
{
|
||||
currentPreEvent= 0;
|
||||
currentPreSwitch = 0;
|
||||
currentPreSequence = 0;
|
||||
|
||||
this.transform.localScale = new Vector3(30000000, 30000000);
|
||||
|
||||
|
@ -221,6 +222,24 @@ namespace HeavenStudio
|
|||
}
|
||||
}
|
||||
|
||||
public void SeekAheadAndDoPreEvent(float start, float seekTime = 1f)
|
||||
{
|
||||
List<float> entities = Beatmap.entities.Select(c => c.beat).ToList();
|
||||
if (currentPreSequence < Beatmap.entities.Count && currentPreSequence >= 0)
|
||||
{
|
||||
if (start + seekTime >= entities[currentPreSequence])
|
||||
{
|
||||
float beat = Beatmap.entities[currentPreSequence].beat;
|
||||
var entitiesAtSameBeat = Beatmap.entities.FindAll(c => c.beat == Beatmap.entities[currentPreSequence].beat);
|
||||
foreach (DynamicBeatmap.DynamicEntity entity in entitiesAtSameBeat)
|
||||
{
|
||||
eventCaller.CallPreEvent(entity);
|
||||
}
|
||||
currentPreSequence++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// LateUpdate works a bit better(?) but causes some bugs (like issues with bop animations).
|
||||
private void Update()
|
||||
{
|
||||
|
@ -274,6 +293,8 @@ namespace HeavenStudio
|
|||
//seek ahead to preload games that have assetbundles
|
||||
SeekAheadAndPreload(Conductor.instance.songPositionInBeats, seekTime);
|
||||
|
||||
SeekAheadAndDoPreEvent(Conductor.instance.songPositionInBeats, 1f);
|
||||
|
||||
if (currentEvent < Beatmap.entities.Count && currentEvent >= 0)
|
||||
{
|
||||
if (Conductor.instance.songPositionInBeats >= entities[currentEvent] /*&& SongPosLessThanClipLength(Conductor.instance.songPositionInBeats)*/)
|
||||
|
@ -392,6 +413,7 @@ namespace HeavenStudio
|
|||
|
||||
currentEvent = entities.IndexOf(Mathp.GetClosestInList(entities, beat));
|
||||
currentPreEvent = entities.IndexOf(Mathp.GetClosestInList(entities, beat));
|
||||
currentPreSequence = entities.IndexOf(Mathp.GetClosestInList(entities, beat));
|
||||
|
||||
var gameSwitchs = Beatmap.entities.FindAll(c => c.datamodel.Split(1) == "switchGame");
|
||||
|
||||
|
@ -579,14 +601,18 @@ namespace HeavenStudio
|
|||
{
|
||||
if (gameInfo.fxOnly)
|
||||
{
|
||||
name = Beatmap.entities.FindAll(c => {
|
||||
var gameEntities = Beatmap.entities.FindAll(c => {
|
||||
var gameName = c.datamodel.Split(0);
|
||||
var newGameInfo = GetGameInfo(gameName);
|
||||
if (newGameInfo == null)
|
||||
return false;
|
||||
else
|
||||
return !newGameInfo.fxOnly;
|
||||
}).ToList()[0].datamodel.Split(0);
|
||||
}).ToList();
|
||||
if (gameEntities.Count != 0)
|
||||
name = gameEntities[0].datamodel.Split(0);
|
||||
else
|
||||
name = "noGame";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -160,7 +160,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
|
|||
tableAnim.speed = 1;
|
||||
tableAnim.Play("Student_Turntable_Swipe", 0, 0);
|
||||
|
||||
Instantiate(slamFX).SetActive(true);
|
||||
Instantiate(slamFX, this.transform.parent).SetActive(true);
|
||||
mixer.audioMixer.FindSnapshot("Main").TransitionTo(.01f);
|
||||
}
|
||||
else
|
||||
|
@ -177,7 +177,7 @@ namespace HeavenStudio.Games.Scripts_DJSchool
|
|||
tableAnim.speed = 1;
|
||||
tableAnim.Play("Student_Turntable_Swipe", 0, 0);
|
||||
|
||||
Instantiate(slamFX).SetActive(true);
|
||||
Instantiate(slamFX, this.transform.parent).SetActive(true);
|
||||
mixer.audioMixer.FindSnapshot("Main").TransitionTo(.01f);
|
||||
}
|
||||
|
||||
|
|
|
@ -183,7 +183,6 @@ namespace HeavenStudio.Games
|
|||
private void Awake()
|
||||
{
|
||||
instance = this;
|
||||
|
||||
Spectators = new List<GameObject>();
|
||||
idolAnimator = Arisa.GetComponent<Animator>();
|
||||
|
||||
|
@ -529,12 +528,7 @@ namespace HeavenStudio.Games
|
|||
public void CallHai(float beat, bool noSound = false, int type = 0)
|
||||
{
|
||||
if (!noSound)
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound("fanClub/arisa_hai_1_jp", beat),
|
||||
new MultiSound.Sound("fanClub/arisa_hai_2_jp", beat + 1f),
|
||||
new MultiSound.Sound("fanClub/arisa_hai_3_jp", beat + 2f),
|
||||
});
|
||||
|
||||
PlaySoundSequence("arisa_hai", beat);
|
||||
responseToggle = false;
|
||||
DisableBop(beat, 8f);
|
||||
|
||||
|
@ -557,12 +551,7 @@ namespace HeavenStudio.Games
|
|||
new BeatAction.Action(beat + 7f, delegate { PlayOneClap(beat + 7f); DoIdolClaps();}),
|
||||
});
|
||||
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound("fanClub/crowd_hai_jp", beat + 4f),
|
||||
new MultiSound.Sound("fanClub/crowd_hai_jp", beat + 5f),
|
||||
new MultiSound.Sound("fanClub/crowd_hai_jp", beat + 6f),
|
||||
new MultiSound.Sound("fanClub/crowd_hai_jp", beat + 7f),
|
||||
});
|
||||
PlaySoundSequence("crowd_hai", beat + 4f);
|
||||
}
|
||||
|
||||
public static void WarnHai(float beat, bool noSound = false, int type = 0)
|
||||
|
@ -587,27 +576,12 @@ namespace HeavenStudio.Games
|
|||
bool doJump = (responseType == (int) KamoneResponseType.Jump || responseType == (int) KamoneResponseType.JumpFast);
|
||||
bool isBig = (responseType == (int) KamoneResponseType.ThroughFast || responseType == (int) KamoneResponseType.JumpFast);
|
||||
DisableResponse(beat, 2f);
|
||||
if (isBig)
|
||||
if (!noSound)
|
||||
{
|
||||
if (!noSound)
|
||||
{
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound("fanClub/arisa_ka_fast_jp", beat),
|
||||
new MultiSound.Sound("fanClub/arisa_mo_fast_jp", beat + 0.25f),
|
||||
new MultiSound.Sound("fanClub/arisa_ne_fast_jp", beat + 0.5f),
|
||||
});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!noSound)
|
||||
{
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound("fanClub/arisa_ka_jp", beat),
|
||||
new MultiSound.Sound("fanClub/arisa_mo_jp", beat + 0.5f, offset: 0.07407407f),
|
||||
new MultiSound.Sound("fanClub/arisa_ne_jp", beat + 1f, offset: 0.07407407f),
|
||||
});
|
||||
}
|
||||
if (isBig)
|
||||
PlaySoundSequence("arisa_kamone_fast", beat);
|
||||
else
|
||||
PlaySoundSequence("arisa_kamone", beat);
|
||||
}
|
||||
|
||||
responseToggle = true;
|
||||
|
@ -641,12 +615,7 @@ namespace HeavenStudio.Games
|
|||
}),
|
||||
});
|
||||
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound("fanClub/crowd_ka_jp", beat + 2f),
|
||||
new MultiSound.Sound("fanClub/crowd_mo_jp", beat + 3.5f),
|
||||
new MultiSound.Sound("fanClub/crowd_ne_jp", beat + 4f),
|
||||
new MultiSound.Sound("fanClub/crowd_hey_jp", beat + 5f),
|
||||
});
|
||||
PlaySoundSequence("crowd_kamone", beat + 2f);
|
||||
}
|
||||
|
||||
public static void WarnKamone(float beat, bool noSound = false, int type = 0, int responseType = (int) KamoneResponseType.Through)
|
||||
|
@ -680,11 +649,11 @@ namespace HeavenStudio.Games
|
|||
const float BIGCALL_LENGTH = 2.75f;
|
||||
public void CallBigReady(float beat, bool noSound = false)
|
||||
{
|
||||
if (!noSound)
|
||||
PlaySoundSequence("crowd_big_ready", beat);
|
||||
|
||||
Prepare(beat + 1.5f);
|
||||
Prepare(beat + 2f);
|
||||
|
||||
if (!noSound)
|
||||
Jukebox.PlayOneShotGame("fanClub/crowd_big_ready");
|
||||
|
||||
DisableSpecBop(beat, 3.75f);
|
||||
|
||||
|
@ -702,7 +671,7 @@ namespace HeavenStudio.Games
|
|||
{
|
||||
wantBigReady = beat;
|
||||
if (noSound) return;
|
||||
Jukebox.PlayOneShotGame("fanClub/crowd_big_ready");
|
||||
Jukebox.PlayOneShotGame("fanClub/crowd_big_ready", beat);
|
||||
}
|
||||
|
||||
public void ContinueBigReady(float beat)
|
||||
|
|
|
@ -2,11 +2,15 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
using HeavenStudio.Util;
|
||||
|
||||
namespace HeavenStudio.Games
|
||||
{
|
||||
public class Minigame : MonoBehaviour
|
||||
{
|
||||
public static float earlyTime = 0.1f, perfectTime = 0.08f, aceEarlyTime = 0.025f, aceLateTime = 0.025f, lateTime = 0.08f, endTime = 0.1f;
|
||||
[SerializeField] public SoundSequence.SequenceKeyValue[] SoundSequences;
|
||||
|
||||
public List<Minigame.Eligible> EligibleHits = new List<Minigame.Eligible>();
|
||||
|
||||
[System.Serializable]
|
||||
|
@ -211,5 +215,18 @@ namespace HeavenStudio.Games
|
|||
|
||||
return sameTime;
|
||||
}
|
||||
|
||||
public MultiSound PlaySoundSequence(string name, float startBeat)
|
||||
{
|
||||
foreach (SoundSequence.SequenceKeyValue pair in SoundSequences)
|
||||
{
|
||||
if (pair.name == name)
|
||||
{
|
||||
return pair.sequence.Play(startBeat);
|
||||
}
|
||||
}
|
||||
Debug.LogWarning($"Sound sequence {name} not found in game {this.name} (did you build AssetBundles?)");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace HeavenStudio.Games.Loaders
|
|||
new Param("type", PajamaParty.SleepType.Normal, "Sleep Type", "Type of sleep action to use"),
|
||||
new Param("toggle", false, "Alt. Animation", "Use an alternate animation for Mako")
|
||||
},
|
||||
inactiveFunction = delegate {var e = eventCaller.currentEntity; PajamaParty.WarnSleepSequence(e.beat, e["toggle"]);}
|
||||
inactiveFunction = delegate {var e = eventCaller.currentEntity; PajamaParty.WarnSleepSequence(e.beat, e["toggle"], e["type"]);}
|
||||
},
|
||||
new GameAction("throw", "Throw Pillows")
|
||||
{
|
||||
|
@ -281,7 +281,7 @@ namespace HeavenStudio.Games
|
|||
});
|
||||
}
|
||||
|
||||
public static void WarnSleepSequence(float beat, bool alt = false)
|
||||
public static void WarnSleepSequence(float beat, bool alt = false, int action = (int) PajamaParty.SleepType.Normal)
|
||||
{
|
||||
MultiSound.Play(new MultiSound.Sound[] {
|
||||
new MultiSound.Sound("pajamaParty/siesta1", beat),
|
||||
|
@ -292,6 +292,7 @@ namespace HeavenStudio.Games
|
|||
}, forcePlay: true);
|
||||
WantSleepSequence = beat;
|
||||
WantSleepType = alt;
|
||||
WantSleepAction = action;
|
||||
}
|
||||
|
||||
public void DoBedImpact()
|
||||
|
|
|
@ -100,15 +100,8 @@ namespace HeavenStudio.Editor
|
|||
GameManager.instance.Init();
|
||||
Timeline.Init();
|
||||
|
||||
for (int i = 0; i < EventCaller.instance.minigames.Count; i++)
|
||||
{
|
||||
GameObject GameIcon_ = Instantiate(GridGameSelector.GetChild(0).gameObject, GridGameSelector);
|
||||
GameIcon_.GetComponent<Image>().sprite = GameIcon(EventCaller.instance.minigames[i].name);
|
||||
GameIcon_.GetComponent<GridGameSelectorGame>().MaskTex = GameIconMask(EventCaller.instance.minigames[i].name);
|
||||
GameIcon_.GetComponent<GridGameSelectorGame>().UnClickIcon();
|
||||
GameIcon_.gameObject.SetActive(true);
|
||||
GameIcon_.name = EventCaller.instance.minigames[i].displayName;
|
||||
}
|
||||
foreach (var minigame in EventCaller.instance.minigames)
|
||||
AddIcon(minigame);
|
||||
|
||||
Tooltip.AddTooltip(NewBTN.gameObject, "New <color=#adadad>[Ctrl+N]</color>");
|
||||
Tooltip.AddTooltip(OpenBTN.gameObject, "Open <color=#adadad>[Ctrl+O]</color>");
|
||||
|
@ -128,6 +121,16 @@ namespace HeavenStudio.Editor
|
|||
BuildDateDisplay.text = GlobalGameManager.buildTime;
|
||||
}
|
||||
|
||||
public void AddIcon(Minigames.Minigame minigame)
|
||||
{
|
||||
GameObject GameIcon_ = Instantiate(GridGameSelector.GetChild(0).gameObject, GridGameSelector);
|
||||
GameIcon_.GetComponent<Image>().sprite = GameIcon(minigame.name);
|
||||
GameIcon_.GetComponent<GridGameSelectorGame>().MaskTex = GameIconMask(minigame.name);
|
||||
GameIcon_.GetComponent<GridGameSelectorGame>().UnClickIcon();
|
||||
GameIcon_.gameObject.SetActive(true);
|
||||
GameIcon_.name = minigame.displayName;
|
||||
}
|
||||
|
||||
public void LateUpdate()
|
||||
{
|
||||
#region Keyboard Shortcuts
|
||||
|
|
|
@ -21,6 +21,7 @@ namespace HeavenStudio
|
|||
{
|
||||
public class Minigame
|
||||
{
|
||||
|
||||
public string name;
|
||||
public string displayName;
|
||||
public string color;
|
||||
|
|
|
@ -151,8 +151,6 @@ namespace HeavenStudio.Util
|
|||
return null;
|
||||
}
|
||||
|
||||
//TODO: playing sounds from assetbundles
|
||||
|
||||
public static void KillLoop(Sound source, float fadeTime)
|
||||
{
|
||||
// Safeguard against previously-destroyed sounds.
|
||||
|
|
|
@ -8,10 +8,10 @@ namespace HeavenStudio.Util
|
|||
public class MultiSound : MonoBehaviour
|
||||
{
|
||||
private float startBeat;
|
||||
private int index;
|
||||
private bool game;
|
||||
private bool forcePlay;
|
||||
public List<Sound> sounds = new List<Sound>();
|
||||
public List<Util.Sound> playingSounds = new List<Util.Sound>();
|
||||
|
||||
public class Sound
|
||||
{
|
||||
|
@ -37,39 +37,35 @@ namespace HeavenStudio.Util
|
|||
public static MultiSound Play(Sound[] snds, bool game = true, bool forcePlay = false)
|
||||
{
|
||||
List<Sound> sounds = snds.ToList();
|
||||
GameObject gameObj = new GameObject();
|
||||
MultiSound ms = gameObj.AddComponent<MultiSound>();
|
||||
GameObject go = new GameObject("MultiSound");
|
||||
MultiSound ms = go.AddComponent<MultiSound>();
|
||||
ms.sounds = sounds;
|
||||
ms.startBeat = sounds[0].beat;
|
||||
ms.game = game;
|
||||
ms.forcePlay = forcePlay;
|
||||
gameObj.name = "MultiSound";
|
||||
|
||||
GameManager.instance.SoundObjects.Add(gameObj);
|
||||
for (int i = 0; i < sounds.Count; i++)
|
||||
{
|
||||
Util.Sound s;
|
||||
if (game)
|
||||
s = Jukebox.PlayOneShotGame(sounds[i].name, sounds[i].beat - Conductor.instance.GetRestFromRealTime(sounds[i].offset), sounds[i].pitch, sounds[i].volume, sounds[i].looping, forcePlay);
|
||||
else
|
||||
s = Jukebox.PlayOneShot(sounds[i].name, sounds[i].beat - Conductor.instance.GetRestFromRealTime(sounds[i].offset), sounds[i].pitch, sounds[i].volume, sounds[i].looping);
|
||||
ms.playingSounds.Add(s);
|
||||
}
|
||||
|
||||
GameManager.instance.SoundObjects.Add(go);
|
||||
return ms;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
float songPositionInBeats = Conductor.instance.songPositionInBeats;
|
||||
|
||||
for (int i = 0; i < sounds.Count; i++)
|
||||
foreach (Util.Sound sound in playingSounds)
|
||||
{
|
||||
if (songPositionInBeats >= sounds[i].beat - Conductor.instance.GetRestFromRealTime(sounds[i].offset) && index == i)
|
||||
{
|
||||
if (game)
|
||||
Jukebox.PlayOneShotGame(sounds[i].name, sounds[i].beat - Conductor.instance.GetRestFromRealTime(sounds[i].offset), sounds[i].pitch, sounds[i].volume, sounds[i].looping, forcePlay);
|
||||
else
|
||||
Jukebox.PlayOneShot(sounds[i].name, sounds[i].beat - Conductor.instance.GetRestFromRealTime(sounds[i].offset), sounds[i].pitch, sounds[i].volume, sounds[i].looping);
|
||||
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
if (songPositionInBeats >= (sounds[sounds.Count - 1].beat - Conductor.instance.GetRestFromRealTime(sounds[sounds.Count - 1].offset)))
|
||||
{
|
||||
Delete();
|
||||
if (sound != null)
|
||||
return;
|
||||
}
|
||||
Delete();
|
||||
}
|
||||
|
||||
public void Delete()
|
||||
|
|
|
@ -23,12 +23,13 @@ namespace HeavenStudio.Util
|
|||
|
||||
private int pauseTimes = 0;
|
||||
|
||||
private float startTime;
|
||||
private double startTime;
|
||||
|
||||
public float beat;
|
||||
public float scheduledPitch = 1f;
|
||||
|
||||
bool playInstant = false;
|
||||
int playIndex = 0;
|
||||
bool played = false;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
|
@ -40,39 +41,50 @@ namespace HeavenStudio.Util
|
|||
|
||||
if (beat == -1 && !scheduled)
|
||||
{
|
||||
audioSource.PlayScheduled(Time.time);
|
||||
audioSource.PlayScheduled(AudioSettings.dspTime);
|
||||
playInstant = true;
|
||||
playIndex++;
|
||||
played = true;
|
||||
startTime = Conductor.instance.songPositionAsDouble;
|
||||
StartCoroutine(NotRelyOnBeatSound());
|
||||
}
|
||||
else
|
||||
{
|
||||
playInstant = false;
|
||||
scheduledPitch = Conductor.instance.musicSource.pitch;
|
||||
startTime = (AudioSettings.dspTime + (Conductor.instance.GetSongPosFromBeat(beat) - Conductor.instance.songPositionAsDouble)/(double)scheduledPitch);
|
||||
audioSource.PlayScheduled(startTime);
|
||||
Debug.Log($"Scheduling future sound {clip.name} for beat {beat} (scheduled: {startTime}, current time: {AudioSettings.dspTime})");
|
||||
}
|
||||
|
||||
startTime = Conductor.instance.songPosition;
|
||||
|
||||
if (!scheduled && !looping)
|
||||
StartCoroutine(NotRelyOnBeatSound());
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (playIndex < 1)
|
||||
if (!played)
|
||||
{
|
||||
if (scheduled)
|
||||
{
|
||||
if (AudioSettings.dspTime > scheduledTime)
|
||||
{
|
||||
StartCoroutine(NotRelyOnBeatSound());
|
||||
playIndex++;
|
||||
played = true;
|
||||
}
|
||||
}
|
||||
else if (!playInstant)
|
||||
{
|
||||
if (Conductor.instance.songPositionInBeats > beat)
|
||||
if (AudioSettings.dspTime > startTime)
|
||||
{
|
||||
audioSource.PlayScheduled(Time.time);
|
||||
playIndex++;
|
||||
played = true;
|
||||
StartCoroutine(NotRelyOnBeatSound());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!played && scheduledPitch != Conductor.instance.musicSource.pitch)
|
||||
{
|
||||
scheduledPitch = Conductor.instance.musicSource.pitch;
|
||||
startTime = (AudioSettings.dspTime + (Conductor.instance.GetSongPosFromBeat(beat) - Conductor.instance.songPositionAsDouble)/(double)scheduledPitch);
|
||||
audioSource.SetScheduledStartTime(startTime);
|
||||
Debug.Log($"Rescheduling future sound {clip.name} for beat {beat} (scheduled: {startTime}, current time: {AudioSettings.dspTime})");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +106,7 @@ namespace HeavenStudio.Util
|
|||
{
|
||||
if (!looping) // Looping sounds are destroyed manually.
|
||||
{
|
||||
yield return new WaitForSeconds(clip.length);
|
||||
yield return new WaitForSeconds(clip.length / pitch);
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
ManifestFileVersion: 0
|
||||
CRC: 3293131261
|
||||
CRC: 1243838037
|
||||
AssetBundleManifest:
|
||||
AssetBundleInfos:
|
||||
Info_0:
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
ManifestFileVersion: 0
|
||||
CRC: 3064660800
|
||||
CRC: 1167382196
|
||||
Hashes:
|
||||
AssetFileHash:
|
||||
serializedVersion: 2
|
||||
Hash: 996e27defaede200a0288a246ceb7785
|
||||
Hash: 91ca0253f29ae5f7a1df107a25dc7c75
|
||||
TypeTreeHash:
|
||||
serializedVersion: 2
|
||||
Hash: 77ce82dcd01e7c9c803f77daf119d967
|
||||
Hash: 222d3ac4260743916f7d5e044ddd31d4
|
||||
HashAppended: 0
|
||||
ClassTypes:
|
||||
- Class: 1
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
ManifestFileVersion: 0
|
||||
CRC: 1203693992
|
||||
CRC: 149759227
|
||||
Hashes:
|
||||
AssetFileHash:
|
||||
serializedVersion: 2
|
||||
Hash: ae05e1e9fb4eb8cd2f29733c9a5bf155
|
||||
Hash: 462778359784eea47ee51c3c63402505
|
||||
TypeTreeHash:
|
||||
serializedVersion: 2
|
||||
Hash: 4dc83e2b35ad62bed4e41f3ad2721117
|
||||
Hash: fc2a2e95963d1b3faf439c84ecb440b4
|
||||
HashAppended: 0
|
||||
ClassTypes:
|
||||
- Class: 1
|
||||
|
|
Binary file not shown.
|
@ -1,12 +1,12 @@
|
|||
ManifestFileVersion: 0
|
||||
CRC: 3719062968
|
||||
CRC: 1663830856
|
||||
Hashes:
|
||||
AssetFileHash:
|
||||
serializedVersion: 2
|
||||
Hash: eee37f302cb3e8cbe079bb5500cb45ed
|
||||
Hash: 688c0aa50fbd25fe17346b36c6bf2176
|
||||
TypeTreeHash:
|
||||
serializedVersion: 2
|
||||
Hash: 1341d321cd8444a4f78a51a8a0c6daff
|
||||
Hash: 51d10f004f46f35e758498b711eedb2f
|
||||
HashAppended: 0
|
||||
ClassTypes:
|
||||
- Class: 1
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
ManifestFileVersion: 0
|
||||
CRC: 2932507538
|
||||
CRC: 3480558300
|
||||
Hashes:
|
||||
AssetFileHash:
|
||||
serializedVersion: 2
|
||||
Hash: 845f3b143b8a238d7e73a606faea2df6
|
||||
Hash: cfaae0e9f9c81b2d255e8da0db667aae
|
||||
TypeTreeHash:
|
||||
serializedVersion: 2
|
||||
Hash: 558e305ab690efbcd3eff9455cc9f4dc
|
||||
Hash: a669441aae6ee39a06c1090efd6d25bc
|
||||
HashAppended: 0
|
||||
ClassTypes:
|
||||
- Class: 1
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
ManifestFileVersion: 0
|
||||
CRC: 2623096210
|
||||
CRC: 1706991399
|
||||
Hashes:
|
||||
AssetFileHash:
|
||||
serializedVersion: 2
|
||||
Hash: a3e9151f97985d2782330fc634507e3d
|
||||
Hash: ae519aaff83042895009b1d4dbae0a79
|
||||
TypeTreeHash:
|
||||
serializedVersion: 2
|
||||
Hash: 6f0c5ebd30d7d3be8aad1c86837b5cc9
|
||||
Hash: 994ea96351ef9c039cf2db2caf2c1169
|
||||
HashAppended: 0
|
||||
ClassTypes:
|
||||
- Class: 1
|
||||
|
@ -50,6 +50,12 @@ ClassTypes:
|
|||
SerializeReferenceClassIdentifiers:
|
||||
- AssemblyName: Assembly-CSharp
|
||||
ClassName: HeavenStudio.Games.Minigame/Eligible
|
||||
- AssemblyName: Assembly-CSharp
|
||||
ClassName: HeavenStudio.Util.SoundSequence
|
||||
- AssemblyName: Assembly-CSharp
|
||||
ClassName: HeavenStudio.Util.SoundSequence/SequenceClip
|
||||
- AssemblyName: Assembly-CSharp
|
||||
ClassName: HeavenStudio.Util.SoundSequence/SequenceKeyValue
|
||||
Assets:
|
||||
- Assets/Resources/Sprites/Games/FanClub/Animations/Arisa/Arrange/IdolBigCall1Arrange.anim
|
||||
- Assets/Resources/Sprites/Games/FanClub/Animations/Fan/Head/FanHead.controller
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
ManifestFileVersion: 0
|
||||
CRC: 899825387
|
||||
CRC: 3961443211
|
||||
Hashes:
|
||||
AssetFileHash:
|
||||
serializedVersion: 2
|
||||
Hash: 62b9184eb5747ae7a297e55e34ce0d0d
|
||||
Hash: c56eae7afab3c51aa0d877ecb5fa6484
|
||||
TypeTreeHash:
|
||||
serializedVersion: 2
|
||||
Hash: 788d5843115df613774b9a4b273d2334
|
||||
Hash: 9a9bdfe5fc84d62897a4e311b61519be
|
||||
HashAppended: 0
|
||||
ClassTypes:
|
||||
- Class: 1
|
||||
|
|
Loading…
Reference in a new issue