diff --git a/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs b/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs index 4ebfe467..899901ae 100644 --- a/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs +++ b/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs @@ -22,6 +22,8 @@ namespace HeavenStudio // software version (MajorMinorPatch, revision) {"productversion", 000}, {"productsubversion", 0}, + //file format version + {"riqversion", 0}, // general chart info {"remixtitle", "New Remix"}, // chart name @@ -73,7 +75,7 @@ namespace HeavenStudio public int track; [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float length; [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float swing; - public Dictionary DynamicData = new Dictionary(); + public Dictionary DynamicData = new Dictionary(); public string datamodel; [JsonIgnore] public Editor.Track.TimelineEventObj eventObj; @@ -89,7 +91,7 @@ namespace HeavenStudio return JsonConvert.DeserializeObject(JsonConvert.SerializeObject(this)); } - public object this[string propertyName] + public dynamic this[string propertyName] { get { @@ -108,7 +110,7 @@ namespace HeavenStudio } } - public void CreateProperty(string name, object defaultValue) + public void CreateProperty(string name, dynamic defaultValue) { if (!DynamicData.ContainsKey(name)) DynamicData.Add(name, defaultValue); @@ -159,5 +161,101 @@ namespace HeavenStudio } } } + + /// + /// converts from the old "rhmania" / "tengoku" format to the new "riq" format + /// + /// a deserialized .rhmania or .tengoku beatmap + /// a .riq beatmap + public static DynamicBeatmap BeatmapConverter(Beatmap beatmap) + { + DynamicBeatmap dynamicBeatmap = new DynamicBeatmap(); + dynamicBeatmap.bpm = beatmap.bpm; + dynamicBeatmap.musicVolume = beatmap.musicVolume; + dynamicBeatmap.firstBeatOffset = beatmap.firstBeatOffset; + + foreach (var entity in beatmap.entities) + { + dynamicBeatmap.entities.Add(new DynamicEntity() + { + beat = entity.beat, + track = entity.track, + length = entity.length, + swing = entity.swing, + datamodel = entity.datamodel, + DynamicData = new Dictionary() + { + { "valA", entity.valA }, + { "valB", entity.valB }, + { "valC", entity.valC }, + + { "toggle", entity.toggle }, + + { "type", entity.type }, + { "type2", entity.type2 }, + { "type3", entity.type3 }, + { "type4", entity.type4 }, + { "type5", entity.type5 }, + { "type6", entity.type6 }, + + { "ease", entity.ease }, + + { "colorA", entity.colorA }, + { "colorB", entity.colorB }, + { "colorC", entity.colorC }, + { "colorD", entity.colorD }, + { "colorE", entity.colorE }, + { "colorF", entity.colorF }, + + { "text1", entity.text1 }, + { "text2", entity.text2 }, + { "text3", entity.text3 }, + } + }); + } + foreach (var tempoChange in beatmap.tempoChanges) + { + dynamicBeatmap.tempoChanges.Add(new TempoChange() + { + beat = tempoChange.beat, + length = tempoChange.length, + tempo = tempoChange.tempo + }); + } + foreach (var volumeChange in beatmap.volumeChanges) + { + dynamicBeatmap.volumeChanges.Add(new VolumeChange() + { + beat = volumeChange.beat, + length = volumeChange.length, + volume = volumeChange.volume + }); + } + return dynamicBeatmap; + } + + /// + /// FUTURE: converts from a karateka mania chart ("bor") to the "riq" format + /// + /// a rawtext .bor chart + /// a .riq beatmap + /// not implemented yet + public static DynamicBeatmap KManiaBorConverter(String bor) + { + return null; + } + + /// + /// updates an "riq" beatmap + /// + /// old beatmap + /// version of old beatmap + /// updated beatmap + /// not implemented yet + public static DynamicBeatmap BeatmapUpdater(DynamicBeatmap beatmap, int version) + { + return beatmap; + } + } } \ No newline at end of file diff --git a/Assets/Scripts/Conductor.cs b/Assets/Scripts/Conductor.cs index 7f60d3cf..0e2dd774 100644 --- a/Assets/Scripts/Conductor.cs +++ b/Assets/Scripts/Conductor.cs @@ -245,9 +245,17 @@ namespace HeavenStudio return tempoChanges; } + private List GetSortedTempoChanges(DynamicBeatmap chart) + { + //iterate over all tempo changes, adding to counter + List tempoChanges = chart.tempoChanges; + tempoChanges.Sort((x, y) => x.beat.CompareTo(y.beat)); //sorts all tempo changes by ascending time (GameManager already does this but juste en cas...) + return tempoChanges; + } + public float GetSongPosFromBeat(float beat) { - Beatmap chart = GameManager.instance.Beatmap; + var chart = GameManager.instance.Beatmap; SetBpm(chart.bpm); //initial counter @@ -257,7 +265,7 @@ namespace HeavenStudio float lastTempoChangeBeat = 0f; //iterate over all tempo changes, adding to counter - List tempoChanges = GetSortedTempoChanges(chart); + var tempoChanges = GetSortedTempoChanges(chart); foreach (var t in tempoChanges) { if (t.beat > beat) @@ -297,12 +305,12 @@ namespace HeavenStudio public float GetBeatFromSongPos(float seconds) { // Debug.Log("Getting beat of seconds " + seconds); - Beatmap chart = GameManager.instance.Beatmap; + var chart = GameManager.instance.Beatmap; float lastTempoChangeBeat = 0f; float lastBpm = chart.bpm; float counterSeconds = -firstBeatOffset; - List tempoChanges = GetSortedTempoChanges(chart); + var tempoChanges = GetSortedTempoChanges(chart); foreach (var t in tempoChanges) { float beatToNext = t.beat - lastTempoChangeBeat; diff --git a/Assets/Scripts/Datamodel.cs b/Assets/Scripts/Datamodel.cs index 2c241457..d2c78672 100644 --- a/Assets/Scripts/Datamodel.cs +++ b/Assets/Scripts/Datamodel.cs @@ -10,5 +10,11 @@ namespace HeavenStudio { return s.Split('/')[index]; } + + public static string GetExtension(this string s) + { + string[] split = s.Split('.'); + return split[split.Length - 1]; + } } } \ No newline at end of file diff --git a/Assets/Scripts/DebugUI.cs b/Assets/Scripts/DebugUI.cs index 6a1449c0..80ace75f 100644 --- a/Assets/Scripts/DebugUI.cs +++ b/Assets/Scripts/DebugUI.cs @@ -71,7 +71,6 @@ namespace HeavenStudio SetText(currEvent, $"CurrentEvent: {GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent - minus].datamodel}"); SetText(eventLength, $"Event Length: {GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent - minus].length}"); - SetText(eventType, $"Event Type: {GameManager.instance.Beatmap.entities[GameManager.instance.currentEvent - minus].type}"); } } diff --git a/Assets/Scripts/EventCaller.cs b/Assets/Scripts/EventCaller.cs index d8449e32..27aab25a 100644 --- a/Assets/Scripts/EventCaller.cs +++ b/Assets/Scripts/EventCaller.cs @@ -9,16 +9,14 @@ namespace HeavenStudio public class EventCaller : MonoBehaviour { public Transform GamesHolder; - public Beatmap.Entity currentEntity = new Beatmap.Entity(); + public DynamicBeatmap.DynamicEntity currentEntity = new DynamicBeatmap.DynamicEntity(); public string currentSwitchGame; public delegate void EventCallback(); public static EventCaller instance { get; private set; } - public List minigames = new List() - { - }; + public List minigames = new List(); public Minigames.Minigame GetMinigame(string gameName) { @@ -34,7 +32,7 @@ namespace HeavenStudio { instance = this; - currentEntity = new Beatmap.Entity(); + currentEntity = new DynamicBeatmap.DynamicEntity(); Minigames.Init(this); @@ -60,7 +58,7 @@ namespace HeavenStudio } - public void CallEvent(Beatmap.Entity entity, bool gameActive) + public void CallEvent(DynamicBeatmap.DynamicEntity entity, bool gameActive) { string[] details = entity.datamodel.Split('/'); Minigames.Minigame game = minigames.Find(c => c.name == details[0]); @@ -86,10 +84,10 @@ namespace HeavenStudio } } - public static List GetAllInGameManagerList(string gameName, string[] include) + public static List GetAllInGameManagerList(string gameName, string[] include) { - List temp1 = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel.Split('/')[0] == gameName); - List temp2 = new List(); + List temp1 = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel.Split('/')[0] == gameName); + List temp2 = new List(); for (int i = 0; i < temp1.Count; i++) { if (include.Any(temp1[i].datamodel.Split('/')[1].Contains)) @@ -100,10 +98,10 @@ namespace HeavenStudio return temp2; } - public static List GetAllInGameManagerListExclude(string gameName, string[] exclude) + public static List GetAllInGameManagerListExclude(string gameName, string[] exclude) { - List temp1 = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel.Split('/')[0] == gameName); - List temp2 = new List(); + List temp1 = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel.Split('/')[0] == gameName); + List temp2 = new List(); for (int i = 0; i < temp1.Count; i++) { if (!exclude.Any(temp1[i].datamodel.Split('/')[1].Contains)) @@ -114,18 +112,18 @@ namespace HeavenStudio return temp2; } - public static List GetAllPlayerEntities(string gameName) + public static List GetAllPlayerEntities(string gameName) { return GameManager.instance.playerEntities.FindAll(c => c.datamodel.Split('/')[0] == gameName); } - public static List GetAllPlayerEntitiesExcept(string gameName) + public static List GetAllPlayerEntitiesExcept(string gameName) { return GameManager.instance.playerEntities.FindAll(c => c.datamodel.Split('/')[0] != gameName); } // elaborate as fuck, boy - public static List GetAllPlayerEntitiesExceptBeforeBeat(string gameName, float beat) + public static List GetAllPlayerEntitiesExceptBeforeBeat(string gameName, float beat) { return GameManager.instance.playerEntities.FindAll(c => c.datamodel.Split('/')[0] != gameName && c.beat < beat); } diff --git a/Assets/Scripts/GameCamera.cs b/Assets/Scripts/GameCamera.cs index 45aa8f73..f4d57538 100644 --- a/Assets/Scripts/GameCamera.cs +++ b/Assets/Scripts/GameCamera.cs @@ -12,10 +12,10 @@ namespace HeavenStudio public static GameCamera instance { get; private set; } public new Camera camera; - private List positionEvents = new List(); - private List rotationEvents = new List(); - private List scaleEvents = new List(); - private List shakeEvents = new List(); + private List positionEvents = new List(); + private List rotationEvents = new List(); + private List scaleEvents = new List(); + private List shakeEvents = new List(); /** default cam position, for quick-resetting @@ -125,15 +125,15 @@ namespace HeavenStudio float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length); if (prog >= 0f) { - EasingFunction.Function func = EasingFunction.GetEasingFunction(e.ease); - float dx = func(positionLast.x, e.valA, Mathf.Min(prog, 1f)); - float dy = func(positionLast.y, e.valB, Mathf.Min(prog, 1f)); - float dz = func(positionLast.z, -e.valC, Mathf.Min(prog, 1f)); + EasingFunction.Function func = EasingFunction.GetEasingFunction(e["ease"]); + float dx = func(positionLast.x, e["valA"], Mathf.Min(prog, 1f)); + float dy = func(positionLast.y, e["valB"], Mathf.Min(prog, 1f)); + float dz = func(positionLast.z, -e["valC"], Mathf.Min(prog, 1f)); position = new Vector3(dx, dy, dz); } if (prog > 1f) { - positionLast = new Vector3(e.valA, e.valB, -e.valC); + positionLast = new Vector3(e["valA"], e["valB"], -e["valC"]); } } } @@ -145,16 +145,16 @@ namespace HeavenStudio float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length); if (prog >= 0f) { - EasingFunction.Function func = EasingFunction.GetEasingFunction(e.ease); - float dx = func(rotEluerLast.x, e.valA, Mathf.Min(prog, 1f)); - float dy = func(rotEluerLast.y, e.valB, Mathf.Min(prog, 1f)); - float dz = func(-rotEluerLast.z, e.valC, Mathf.Min(prog, 1f)); + EasingFunction.Function func = EasingFunction.GetEasingFunction(e["ease"]); + float dx = func(rotEluerLast.x, e["valA"], Mathf.Min(prog, 1f)); + float dy = func(rotEluerLast.y, e["valB"], Mathf.Min(prog, 1f)); + float dz = func(-rotEluerLast.z, e["valC"], Mathf.Min(prog, 1f)); rotEluer = new Vector3(dx, dy, dz); //I'm stupid and forgot to negate the rotation gfd 😢 } if (prog > 1f) { - rotEluerLast = new Vector3(e.valA, e.valB, -e.valC); + rotEluerLast = new Vector3(e["valA"], e["valB"], -e["valC"]); } } } @@ -167,7 +167,7 @@ namespace HeavenStudio if (prog >= 0f) { float fac = Mathf.Cos(Time.time * 80f) * 0.5f; - shakeResult = new Vector3(fac * e.valA, fac * e.valB); + shakeResult = new Vector3(fac * e["valA"], fac * e["valB"]); } if (prog > 1f) { diff --git a/Assets/Scripts/GameManager.cs b/Assets/Scripts/GameManager.cs index c5983495..0b86e52a 100644 --- a/Assets/Scripts/GameManager.cs +++ b/Assets/Scripts/GameManager.cs @@ -13,8 +13,8 @@ namespace HeavenStudio public class GameManager : MonoBehaviour { [Header("Lists")] - public Beatmap Beatmap = new Beatmap(); - [HideInInspector] public List playerEntities = new List(); + public DynamicBeatmap Beatmap = new DynamicBeatmap(); + [HideInInspector] public List playerEntities = new List(); private List preloadedGames = new List(); public List SoundObjects = new List(); @@ -75,7 +75,7 @@ namespace HeavenStudio if (txt != null) { string json = txt.text; - Beatmap = JsonConvert.DeserializeObject(json); + Beatmap = JsonConvert.DeserializeObject(json); } else { @@ -116,20 +116,33 @@ namespace HeavenStudio public void NewRemix() { - Beatmap = new Beatmap(); + Beatmap = new DynamicBeatmap(); Beatmap.bpm = 120f; Beatmap.musicVolume = 100; Beatmap.firstBeatOffset = 0f; Conductor.instance.musicSource.clip = null; } - public void LoadRemix(string json = "") + public void LoadRemix(string json = "", string type = "riq", int version = 0) { SortEventsList(); if (json != "") { - Beatmap = JsonConvert.DeserializeObject(json); + switch (type) + { + case "tengoku": + case "rhmania": + Beatmap toConvert = JsonConvert.DeserializeObject(json); + Beatmap = DynamicBeatmap.BeatmapConverter(toConvert); + break; + case "riq": + Beatmap = JsonConvert.DeserializeObject(json); + break; + default: + NewRemix(); + break; + } } else { @@ -213,7 +226,7 @@ namespace HeavenStudio // Debug.Log("Checking Tempo Change at " + tempoChanges[currentTempoEvent] + ", current beat " + Conductor.instance.songPositionInBeats); if (Conductor.instance.songPositionInBeats >= tempoChanges[currentTempoEvent]) { - // Debug.Log("Tempo Change at " + Conductor.instance.songPositionInBeats + " of bpm " + Beatmap.tempoChanges[currentTempoEvent].tempo); + // Debug.Log("Tempo Change at " + Conductor.instance.songPositionInBeats + " of bpm " + DynamicBeatmap.tempoChanges[currentTempoEvent].tempo); Conductor.instance.SetBpm(Beatmap.tempoChanges[currentTempoEvent].tempo); Conductor.instance.timeSinceLastTempoChange = Time.time; currentTempoEvent++; diff --git a/Assets/Scripts/Games/AirRally/AirRally.cs b/Assets/Scripts/Games/AirRally/AirRally.cs index 8103d93e..6947b821 100644 --- a/Assets/Scripts/Games/AirRally/AirRally.cs +++ b/Assets/Scripts/Games/AirRally/AirRally.cs @@ -18,7 +18,7 @@ namespace HeavenStudio.Games.Loaders { new GameAction("set distance", "Set Distance") { - function = delegate { AirRally.instance.SetDistance(e.currentEntity.type); }, + function = delegate { AirRally.instance.SetDistance(e.currentEntity["type"]); }, defaultLength = .5f, parameters = new List() { @@ -28,7 +28,7 @@ namespace HeavenStudio.Games.Loaders //new GameAction("start rally", delegate { AirRally.instance.StartRally(true); }, .5f, false), new GameAction("rally", "Rally") { - function = delegate { AirRally.instance.Rally(e.currentEntity.beat, e.currentEntity.toggle, e.currentEntity.length); }, + function = delegate { AirRally.instance.Rally(e.currentEntity.beat, e.currentEntity["toggle"], e.currentEntity.length); }, defaultLength = 2f, resizable = true, parameters = new List() @@ -38,7 +38,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("ba bum bum bum", "Ba Bum Bum Bum") { - function = delegate { AirRally.instance.BaBumBumBum(e.currentEntity.beat, e.currentEntity.toggle, e.currentEntity.type); }, + function = delegate { AirRally.instance.BaBumBumBum(e.currentEntity.beat, e.currentEntity["toggle"], e.currentEntity["type"]); }, defaultLength = 7f, parameters = new List() { @@ -48,7 +48,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("forthington voice lines", "Forthington Voice Lines") { - function = delegate { AirRally.instance.ForthVoice(e.currentEntity.type, e.currentEntity.type2); }, + function = delegate { AirRally.instance.ForthVoice(e.currentEntity["type"], e.currentEntity["type2"]); }, parameters = new List() { new Param("type", AirRally.CountSound.one, "Type", "The number Forthington will say"), diff --git a/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs b/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs index 20bbbaf4..eca6583c 100644 --- a/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs +++ b/Assets/Scripts/Games/BuiltToScaleDS/BuiltToScaleDS.cs @@ -21,7 +21,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("play piano", "Play Note") { - function = delegate { BuiltToScaleDS.instance.PlayPiano(eventCaller.currentEntity.beat, eventCaller.currentEntity.length, eventCaller.currentEntity.type); }, + function = delegate { BuiltToScaleDS.instance.PlayPiano(eventCaller.currentEntity.beat, eventCaller.currentEntity.length, eventCaller.currentEntity["type"]); }, resizable = true, parameters = new List() { @@ -87,7 +87,7 @@ namespace HeavenStudio.Games elevatorAnim.Play("MakeRod", 0, 1f); } - List spawnedBlockEvents = new List(); + List spawnedBlockEvents = new List(); void Update() { if (!Conductor.instance.isPlaying && !Conductor.instance.isPaused) diff --git a/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs b/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs index ef5503a4..2e1d94ad 100644 --- a/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs +++ b/Assets/Scripts/Games/ClappyTrio/ClappyTrio.cs @@ -23,7 +23,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("prepare", "Prepare Stance") { - function = delegate { ClappyTrio.instance.Prepare(eventCaller.currentEntity.toggle ? 3 : 0); }, + function = delegate { ClappyTrio.instance.Prepare(eventCaller.currentEntity["toggle"] ? 3 : 0); }, parameters = new List() { new Param("toggle", false, "Alt", "Whether or not the alternate version should be played") @@ -31,7 +31,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("change lion count", "Change Lion Count") { - function = delegate { ClappyTrio.instance.ChangeLionCount((int)eventCaller.currentEntity.valA); }, + function = delegate { ClappyTrio.instance.ChangeLionCount((int)eventCaller.currentEntity["valA"]); }, defaultLength = 0.5f, parameters = new List() { @@ -79,7 +79,7 @@ namespace HeavenStudio.Games } public override void OnGameSwitch(float beat) { - Beatmap.Entity changeLion = GameManager.instance.Beatmap.entities.FindLast(c => c.datamodel == "clappyTrio/change lion count" && c.beat <= beat); + DynamicBeatmap.DynamicEntity changeLion = GameManager.instance.Beatmap.entities.FindLast(c => c.datamodel == "clappyTrio/change lion count" && c.beat <= beat); if(changeLion != null) { EventCaller.instance.CallEvent(changeLion, true); diff --git a/Assets/Scripts/Games/CoinToss/CoinToss.cs b/Assets/Scripts/Games/CoinToss/CoinToss.cs index dd46aa4e..eca4cafa 100644 --- a/Assets/Scripts/Games/CoinToss/CoinToss.cs +++ b/Assets/Scripts/Games/CoinToss/CoinToss.cs @@ -16,7 +16,7 @@ namespace HeavenStudio.Games.Loaders { new GameAction("toss", "Toss Coin") { - function = delegate { CoinToss.instance.TossCoin(eventCaller.currentEntity.beat, eventCaller.currentEntity.toggle); }, + function = delegate { CoinToss.instance.TossCoin(eventCaller.currentEntity.beat, eventCaller.currentEntity["toggle"]); }, defaultLength = 7, parameters = new List() { @@ -25,7 +25,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("set background color", "Set Background Color") { - function = delegate { var e = eventCaller.currentEntity; CoinToss.instance.ChangeBackgroundColor(e.colorA, 0f); CoinToss.instance.ChangeBackgroundColor(e.colorB, 0f, true); }, + function = delegate { var e = eventCaller.currentEntity; CoinToss.instance.ChangeBackgroundColor(e["colorA"], 0f); CoinToss.instance.ChangeBackgroundColor(e["colorB"], 0f, true); }, defaultLength = 0.5f, parameters = new List() { @@ -35,7 +35,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("fade background color", "Fade Background Color") { - function = delegate { var e = eventCaller.currentEntity; CoinToss.instance.FadeBackgroundColor(e.colorA, e.colorB, e.length); CoinToss.instance.FadeBackgroundColor(e.colorC, e.colorD, e.length, true); }, + function = delegate { var e = eventCaller.currentEntity; CoinToss.instance.FadeBackgroundColor(e["colorA"], e["colorB"], e.length); CoinToss.instance.FadeBackgroundColor(e["colorC"], e["colorD"], e.length, true); }, resizable = true, parameters = new List() { @@ -49,7 +49,7 @@ namespace HeavenStudio.Games.Loaders //left in for backwards-compatibility, but cannot be placed new GameAction("set foreground color", "") { - function = delegate { var e = eventCaller.currentEntity; CoinToss.instance.ChangeBackgroundColor(e.colorA, 0f, true); }, + function = delegate { var e = eventCaller.currentEntity; CoinToss.instance.ChangeBackgroundColor(e["colorA"], 0f, true); }, defaultLength = 0.5f, parameters = new List @@ -62,7 +62,7 @@ namespace HeavenStudio.Games.Loaders new GameAction("fade foreground color", "") { - function = delegate { var e = eventCaller.currentEntity; CoinToss.instance.FadeBackgroundColor(e.colorA, e.colorB, e.length, true); }, + function = delegate { var e = eventCaller.currentEntity; CoinToss.instance.FadeBackgroundColor(e["colorA"], e["colorB"], e.length, true); }, resizable = true, parameters = new List() { diff --git a/Assets/Scripts/Games/CropStomp/CropStomp.cs b/Assets/Scripts/Games/CropStomp/CropStomp.cs index 2b71ac99..7b00ed7d 100644 --- a/Assets/Scripts/Games/CropStomp/CropStomp.cs +++ b/Assets/Scripts/Games/CropStomp/CropStomp.cs @@ -174,7 +174,7 @@ namespace HeavenStudio.Games } } - List cuedMoleSounds = new List(); + List cuedMoleSounds = new List(); private void Update() { var cond = Conductor.instance; @@ -329,7 +329,7 @@ namespace HeavenStudio.Games return; } inactiveStart = beat; - Beatmap.Entity gameSwitch = GameManager.instance.Beatmap.entities.Find(c => c.beat >= beat && c.datamodel == "gameManager/switchGame/cropStomp"); + DynamicBeatmap.DynamicEntity gameSwitch = GameManager.instance.Beatmap.entities.Find(c => c.beat >= beat && c.datamodel == "gameManager/switchGame/cropStomp"); if (gameSwitch == null) return; int length = Mathf.CeilToInt((gameSwitch.beat - beat)/2); diff --git a/Assets/Scripts/Games/DJSchool/DJSchool.cs b/Assets/Scripts/Games/DJSchool/DJSchool.cs index 13834ac7..65960238 100644 --- a/Assets/Scripts/Games/DJSchool/DJSchool.cs +++ b/Assets/Scripts/Games/DJSchool/DJSchool.cs @@ -14,7 +14,7 @@ namespace HeavenStudio.Games.Loaders { new GameAction("bop", "Bop") { - function = delegate { DJSchool.instance.Bop(eventCaller.currentEntity.toggle); }, + function = delegate { DJSchool.instance.Bop(eventCaller.currentEntity["toggle"]); }, defaultLength = 0.5f, parameters = new List() { @@ -23,9 +23,9 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("and stop ooh", "And Stop!") { - function = delegate { var e = eventCaller.currentEntity; DJSchool.instance.AndStop(e.beat, e.toggle); }, + function = delegate { var e = eventCaller.currentEntity; DJSchool.instance.AndStop(e.beat, e["toggle"]); }, defaultLength = 2.5f, - inactiveFunction = delegate { var e = eventCaller.currentEntity; DJSchool.WarnAndStop(e.beat, e.toggle); }, + inactiveFunction = delegate { var e = eventCaller.currentEntity; DJSchool.WarnAndStop(e.beat, e["toggle"]); }, parameters = new List() { new Param("toggle", true, "Ooh", "Whether or not the \"ooh\" sound should be played") @@ -33,9 +33,9 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("break c'mon ooh", "Break, C'mon!") { - function = delegate { var e = eventCaller.currentEntity; DJSchool.instance.BreakCmon(e.beat, e.type, e.toggle); }, + function = delegate { var e = eventCaller.currentEntity; DJSchool.instance.BreakCmon(e.beat, e["type"], e["toggle"]); }, defaultLength = 3f, - inactiveFunction = delegate { var e = eventCaller.currentEntity; DJSchool.WarnBreakCmon(e.beat, e.type, e.toggle); }, + inactiveFunction = delegate { var e = eventCaller.currentEntity; DJSchool.WarnBreakCmon(e.beat, e["type"], e["toggle"]); }, parameters = new List() { new Param("type", DJSchool.DJVoice.Standard, "Voice", "The voice line to play"), @@ -44,7 +44,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("scratch-o hey", "Scratch-o") { - function = delegate { DJSchool.instance.ScratchoHey(eventCaller.currentEntity.beat, eventCaller.currentEntity.type, eventCaller.currentEntity.toggle); }, + function = delegate { DJSchool.instance.ScratchoHey(eventCaller.currentEntity.beat, eventCaller.currentEntity["type"], eventCaller.currentEntity["toggle"]); }, defaultLength = 3f, parameters = new List() { @@ -54,9 +54,9 @@ 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); }, + inactiveFunction = delegate { DJSchool.WarnDJVoiceLines(eventCaller.currentEntity.beat, eventCaller.currentEntity["type"]); }, parameters = new List() { new Param("type", DJSchool.DJVoiceLines.CheckItOut, "Voice Lines", "The voice line to play"), @@ -64,7 +64,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("sound FX", "Scratchy Music") { - function = delegate { DJSchool.instance.soundFX(eventCaller.currentEntity.toggle); }, + function = delegate { DJSchool.instance.soundFX(eventCaller.currentEntity["toggle"]); }, defaultLength = 0.5f, parameters = new List() { diff --git a/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs b/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs index c9669717..bc490923 100644 --- a/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs +++ b/Assets/Scripts/Games/DrummingPractice/DrummingPractice.cs @@ -22,7 +22,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("drum", "Hit Drum") { - function = delegate { var e = eventCaller.currentEntity; DrummingPractice.instance.Prepare(e.beat, e.toggle); }, + function = delegate { var e = eventCaller.currentEntity; DrummingPractice.instance.Prepare(e.beat, e["toggle"]); }, defaultLength = 2f, parameters = new List() { @@ -31,7 +31,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("set mii", "Set Miis") { - function = delegate { var e = eventCaller.currentEntity; DrummingPractice.instance.SetMiis(e.type, e.type2, e.type3, e.toggle); }, + function = delegate { var e = eventCaller.currentEntity; DrummingPractice.instance.SetMiis(e["type"], e["type2"], e["type3"], e["toggle"]); }, defaultLength = 0.5f, parameters = new List() { @@ -43,7 +43,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("set background color", "Set Background Color") { - function = delegate {var e = eventCaller.currentEntity; DrummingPractice.instance.SetBackgroundColor(e.colorA, e.colorB, e.colorC); }, + function = delegate {var e = eventCaller.currentEntity; DrummingPractice.instance.SetBackgroundColor(e["colorA"], e["colorB"], e["colorC"]); }, defaultLength = 0.5f, parameters = new List() { @@ -100,7 +100,7 @@ namespace HeavenStudio.Games public override void OnGameSwitch(float beat) { - Beatmap.Entity changeMii = GameManager.instance.Beatmap.entities.FindLast(c => c.datamodel == "drummingPractice/set mii" && c.beat <= beat); + var changeMii = GameManager.instance.Beatmap.entities.FindLast(c => c.datamodel == "drummingPractice/set mii" && c.beat <= beat); if(changeMii != null) { EventCaller.instance.CallEvent(changeMii, true); diff --git a/Assets/Scripts/Games/FanClub/FanClub.cs b/Assets/Scripts/Games/FanClub/FanClub.cs index f4b84159..5594d2fc 100644 --- a/Assets/Scripts/Games/FanClub/FanClub.cs +++ b/Assets/Scripts/Games/FanClub/FanClub.cs @@ -15,7 +15,7 @@ namespace HeavenStudio.Games.Loaders { new GameAction("bop", "Bop") { - function = delegate { var e = eventCaller.currentEntity; FanClub.instance.Bop(e.beat, e.length, e.type); }, + function = delegate { var e = eventCaller.currentEntity; FanClub.instance.Bop(e.beat, e.length, e["type"]); }, defaultLength = 0.5f, resizable = true, parameters = new List() @@ -25,38 +25,38 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("yeah, yeah, yeah", "Yeah, Yeah, Yeah!") { - function = delegate { var e = eventCaller.currentEntity; FanClub.instance.CallHai(e.beat, e.toggle); }, + function = delegate { var e = eventCaller.currentEntity; FanClub.instance.CallHai(e.beat, e["toggle"]); }, defaultLength = 8, parameters = new List() { new Param("toggle", false, "Disable call", "Disable the idol's call") }, - inactiveFunction = delegate { var e = eventCaller.currentEntity; FanClub.WarnHai(e.beat, e.toggle);} + inactiveFunction = delegate { var e = eventCaller.currentEntity; FanClub.WarnHai(e.beat, e["toggle"]);} }, new GameAction("I suppose", "I Suppose!") { - function = delegate { var e = eventCaller.currentEntity; FanClub.instance.CallKamone(e.beat, e.toggle, 0, e.type); }, + function = delegate { var e = eventCaller.currentEntity; FanClub.instance.CallKamone(e.beat, e["toggle"], 0, e["type"]); }, defaultLength = 6, parameters = new List() { new Param("type", FanClub.KamoneResponseType.Through, "Response type", "Type of response to use"), new Param("toggle", false, "Disable call", "Disable the idol's call") }, - inactiveFunction = delegate { var e = eventCaller.currentEntity; FanClub.WarnKamone(e.beat, e.toggle, 0, e.type);} + inactiveFunction = delegate { var e = eventCaller.currentEntity; FanClub.WarnKamone(e.beat, e["toggle"], 0, e["type"]);} }, new GameAction("double clap", "Double Clap") { - function = delegate { var e = eventCaller.currentEntity; FanClub.instance.CallBigReady(e.beat, e.toggle); }, + function = delegate { var e = eventCaller.currentEntity; FanClub.instance.CallBigReady(e.beat, e["toggle"]); }, defaultLength = 4, parameters = new List() { new Param("toggle", false, "Disable call", "Disable the call") }, - inactiveFunction = delegate { var e = eventCaller.currentEntity; FanClub.WarnBigReady(e.beat, e.toggle); } + inactiveFunction = delegate { var e = eventCaller.currentEntity; FanClub.WarnBigReady(e.beat, e["toggle"]); } }, new GameAction("play idol animation", "Idol Coreography") { - function = delegate { var e = eventCaller.currentEntity; FanClub.instance.PlayAnim(e.beat, e.length, e.type); }, + function = delegate { var e = eventCaller.currentEntity; FanClub.instance.PlayAnim(e.beat, e.length, e["type"]); }, resizable = true, parameters = new List() { @@ -65,7 +65,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("play stage animation", "Stage Coreography") { - function = delegate { var e = eventCaller.currentEntity; FanClub.instance.PlayAnimStage(e.beat, e.type); }, + function = delegate { var e = eventCaller.currentEntity; FanClub.instance.PlayAnimStage(e.beat, e["type"]); }, resizable = true, parameters = new List() { @@ -75,13 +75,13 @@ namespace HeavenStudio.Games.Loaders new GameAction("set performance type", "Coreography Type") { - function = delegate { var e = eventCaller.currentEntity; FanClub.SetPerformanceType(e.type);}, + function = delegate { var e = eventCaller.currentEntity; FanClub.SetPerformanceType(e["type"]);}, defaultLength = 0.5f, parameters = new List() { new Param("type", FanClub.IdolPerformanceType.Normal, "Performance Type", "Set of animations for the idol to use") }, - inactiveFunction = delegate { var e = eventCaller.currentEntity; FanClub.SetPerformanceType(e.type); } + inactiveFunction = delegate { var e = eventCaller.currentEntity; FanClub.SetPerformanceType(e["type"]); } }, }, new List() {"ntr", "normal"}, diff --git a/Assets/Scripts/Games/FirstContact/FirstContact.cs b/Assets/Scripts/Games/FirstContact/FirstContact.cs index f0b4e4da..896f7d46 100644 --- a/Assets/Scripts/Games/FirstContact/FirstContact.cs +++ b/Assets/Scripts/Games/FirstContact/FirstContact.cs @@ -19,7 +19,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("alien speak", "Alien Speak") { - function = delegate { FirstContact.instance.alienSpeak(eventCaller.currentEntity.beat, eventCaller.currentEntity.valA); }, + function = delegate { FirstContact.instance.alienSpeak(eventCaller.currentEntity.beat, eventCaller.currentEntity["valA"]); }, defaultLength = 0.5f, parameters = new List() { @@ -37,7 +37,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("mission control", "Show Mission Control") { - function = delegate { var e = eventCaller.currentEntity; FirstContact.instance.missionControlDisplay(e.beat, e.toggle, e.length); }, + function = delegate { var e = eventCaller.currentEntity; FirstContact.instance.missionControlDisplay(e.beat, e["toggle"], e.length); }, resizable = true, parameters = new List { @@ -46,7 +46,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("look at", "Look At") { - function = delegate { FirstContact.instance.lookAtDirection(eventCaller.currentEntity.type, eventCaller.currentEntity.type); }, + function = delegate { FirstContact.instance.lookAtDirection(eventCaller.currentEntity["type"], eventCaller.currentEntity["type"]); }, defaultLength = .5f, parameters = new List() { @@ -56,7 +56,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("live bar beat", "Live Bar Beat") { - function = delegate { FirstContact.instance.liveBarBeat(eventCaller.currentEntity.toggle); }, + function = delegate { FirstContact.instance.liveBarBeat(eventCaller.currentEntity["toggle"]); }, defaultLength = .5f, parameters = new List() { @@ -64,7 +64,7 @@ namespace HeavenStudio.Games.Loaders } }, - //new GameAction("Version of First Contact", delegate { FirstContact.instance.versionOfFirstContact(eventCaller.currentEntity.type); }, .5f, false, new List + //new GameAction("Version of First Contact", delegate { FirstContact.instance.versionOfFirstContact(eventCaller.currentEntity["type"]); }, .5f, false, new List //{ // new Param("type", FirstContact.VersionOfContact.FirstContact, "Version", "Version of First Contact to play"), //}), diff --git a/Assets/Scripts/Games/ForkLifter/ForkLifter.cs b/Assets/Scripts/Games/ForkLifter/ForkLifter.cs index 9ba65292..c1426e04 100644 --- a/Assets/Scripts/Games/ForkLifter/ForkLifter.cs +++ b/Assets/Scripts/Games/ForkLifter/ForkLifter.cs @@ -16,7 +16,7 @@ namespace HeavenStudio.Games.Loaders { new GameAction("flick", "Flick Food") { - function = delegate { var e = eventCaller.currentEntity; ForkLifter.instance.Flick(e.beat, e.type); }, + function = delegate { var e = eventCaller.currentEntity; ForkLifter.instance.Flick(e.beat, e["type"]); }, defaultLength = 3, parameters = new List() { diff --git a/Assets/Scripts/Games/Global/Flash.cs b/Assets/Scripts/Games/Global/Flash.cs index e0c0cd25..94c145b0 100644 --- a/Assets/Scripts/Games/Global/Flash.cs +++ b/Assets/Scripts/Games/Global/Flash.cs @@ -22,7 +22,7 @@ namespace HeavenStudio.Games.Global [SerializeField] private Color currentCol; - private List allFadeEvents = new List(); + private List allFadeEvents = new List(); private void Awake() { @@ -64,7 +64,7 @@ namespace HeavenStudio.Games.Global if (allFadeEvents.Count > 0) { - Beatmap.Entity startEntity = null; + DynamicBeatmap.DynamicEntity startEntity = null; for (int i = 0; i < allFadeEvents.Count; i++) { @@ -85,14 +85,14 @@ namespace HeavenStudio.Games.Global { if (!override_) { - Color colA = startEntity.colorA; - Color colB = startEntity.colorB; + Color colA = startEntity["colorA"]; + Color colB = startEntity["colorB"]; - startCol = new Color(colA.r, colA.g, colA.b, startEntity.valA); - endCol = new Color(colB.r, colB.g, colB.b, startEntity.valB); + startCol = new Color(colA.r, colA.g, colA.b, startEntity["valA"]); + endCol = new Color(colB.r, colB.g, colB.b, startEntity["valB"]); } - SetFade(startEntity.beat, startEntity.length, startCol, endCol, startEntity.ease); + SetFade(startEntity.beat, startEntity.length, startCol, endCol, startEntity["ease"]); } } } diff --git a/Assets/Scripts/Games/Global/Textbox.cs b/Assets/Scripts/Games/Global/Textbox.cs index 9628798d..78056ea6 100644 --- a/Assets/Scripts/Games/Global/Textbox.cs +++ b/Assets/Scripts/Games/Global/Textbox.cs @@ -27,10 +27,10 @@ namespace HeavenStudio.Games.Global Bottom, } - private List textboxEvents = new List(); - private List openCaptionsEvents = new List(); - private List idolEvents = new List(); - private List closedCaptionsEvents = new List(); + private List textboxEvents = new List(); + private List openCaptionsEvents = new List(); + private List idolEvents = new List(); + private List closedCaptionsEvents = new List(); Textbox instance; @@ -114,11 +114,11 @@ namespace HeavenStudio.Games.Global if (prog >= 0f && prog <= 1f) { TextboxEnabler.SetActive(true); - TextboxObject.SetText(e.text1); - TextboxObject.Resize(e.valA, e.valB); + TextboxObject.SetText(e["text1"]); + TextboxObject.Resize(e["valA"], e["valB"]); // ouch - switch (e.type) + switch (e["type"]) { case (int) TextboxAnchor.TopLeft: TextboxEnabler.transform.localPosition = new Vector3(-XAnchor, YAnchor); @@ -170,12 +170,12 @@ namespace HeavenStudio.Games.Global if (prog >= 0f && prog <= 1f) { OpenCaptionsEnabler.SetActive(true); - OpenCaptionsLabel.text = e.text1; + OpenCaptionsLabel.text = e["text1"]; - OpenCaptionsLabelRect.sizeDelta = new Vector2(18f * e.valA, 2.5f * e.valB); + OpenCaptionsLabelRect.sizeDelta = new Vector2(18f * e["valA"], 2.5f * e["valB"]); // ouch - switch (e.type) + switch (e["type"]) { case (int) TextboxAnchor.TopLeft: OpenCaptionsEnabler.transform.localPosition = new Vector3(-XAnchor, YAnchor); @@ -228,8 +228,8 @@ namespace HeavenStudio.Games.Global if (prog >= 0f && prog <= 1f) { float inp = cond.GetPositionFromBeat(e.beat, 1); - IdolSongLabel.text = e.text1; - IdolArtistLabel.text = e.text2; + IdolSongLabel.text = e["text1"]; + IdolArtistLabel.text = e["text2"]; IdolAnimator.Play("IdolShow", -1, Mathf.Min(inp, 1)); IdolAnimator.speed = 0; @@ -264,18 +264,18 @@ namespace HeavenStudio.Games.Global if (prog >= 0f && prog <= 1f) { ClosedCaptionsEnabler.SetActive(true); - ClosedCaptionsLabel.text = e.text1; + ClosedCaptionsLabel.text = e["text1"]; - ClosedCaptionsLabelRect.sizeDelta = new Vector2(9f, e.valA); - ClosedCaptionsBgRect.sizeDelta = new Vector2(9f, e.valA); + ClosedCaptionsLabelRect.sizeDelta = new Vector2(9f, e["valA"]); + ClosedCaptionsBgRect.sizeDelta = new Vector2(9f, e["valA"]); - switch (e.type) + switch (e["type"]) { case (int) ClosedCaptionsAnchor.Bottom: - ClosedCaptionsEnabler.transform.localPosition = new Vector3(0, -2.5f + e.valA/2); + ClosedCaptionsEnabler.transform.localPosition = new Vector3(0, -2.5f + e["valA"]/2); break; default: - ClosedCaptionsEnabler.transform.localPosition = new Vector3(0, 2.5f - e.valA/2); + ClosedCaptionsEnabler.transform.localPosition = new Vector3(0, 2.5f - e["valA"]/2); break; } diff --git a/Assets/Scripts/Games/KarateMan/KarateMan.cs b/Assets/Scripts/Games/KarateMan/KarateMan.cs index 4d571eed..93c8ccac 100644 --- a/Assets/Scripts/Games/KarateMan/KarateMan.cs +++ b/Assets/Scripts/Games/KarateMan/KarateMan.cs @@ -15,16 +15,16 @@ namespace HeavenStudio.Games.Loaders { new GameAction("bop", "Bop") { - function = delegate { KarateMan.instance.ToggleBop(eventCaller.currentEntity.toggle); }, + function = delegate { KarateMan.instance.ToggleBop(eventCaller.currentEntity["toggle"]); }, defaultLength = 0.5f, parameters = new List() { new Param("toggle", true, "Bop", "Whether to bop to the beat or not") }, - inactiveFunction = delegate { KarateMan.ToggleBopUnloaded(eventCaller.currentEntity.toggle); } + inactiveFunction = delegate { KarateMan.ToggleBopUnloaded(eventCaller.currentEntity["toggle"]); } }, new GameAction("hit", "Toss Object") { - function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.CreateItem(e.beat, e.type, e.type2); }, + function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.CreateItem(e.beat, e["type"], e["type2"]); }, defaultLength = 2, parameters = new List() { @@ -34,7 +34,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("bulb", "Toss Lightbulb") { - function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.CreateBulbSpecial(e.beat, e.type, e.colorA, e.type2); }, + function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.CreateBulbSpecial(e.beat, e["type"], e["colorA"], e["type2"]); }, defaultLength = 2, parameters = new List() { @@ -45,7 +45,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("kick", "Special: Kick") { - function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.Kick(e.beat, e.toggle, e.type); }, + function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.Kick(e.beat, e["toggle"], e["type"]); }, defaultLength = 4f, parameters = new List() { @@ -55,7 +55,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("combo", "Special: Combo") { - function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.Combo(e.beat, e.type); }, + function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.Combo(e.beat, e["type"]); }, defaultLength = 4, parameters = new List() { @@ -64,24 +64,24 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("hitX", "Warnings") { - function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.DoWord(e.beat, e.type); }, + function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.DoWord(e.beat, e["type"]); }, defaultLength = 1f, parameters = new List() { new Param("type", KarateMan.HitThree.HitThree, "Type", "The warning text to show") }, - inactiveFunction = delegate { var e = eventCaller.currentEntity; KarateMan.DoWordSound(e.beat, e.type); } + inactiveFunction = delegate { var e = eventCaller.currentEntity; KarateMan.DoWordSound(e.beat, e["type"]); } }, new GameAction("special camera", "Special Camera") { - function = delegate { var e = eventCaller.currentEntity; KarateMan.DoSpecialCamera(e.beat, e.length, e.toggle); }, + function = delegate { var e = eventCaller.currentEntity; KarateMan.DoSpecialCamera(e.beat, e.length, e["toggle"]); }, defaultLength = 8f, resizable = true, parameters = new List() { new Param("toggle", true, "Return Camera", "Camera zooms back in?"), }, - inactiveFunction = delegate { var e = eventCaller.currentEntity; KarateMan.DoSpecialCamera(e.beat, e.length, e.toggle); } + inactiveFunction = delegate { var e = eventCaller.currentEntity; KarateMan.DoSpecialCamera(e.beat, e.length, e["toggle"]); } }, new GameAction("prepare", "Preparation Stance") { @@ -90,7 +90,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("set gameplay modifiers", "Gameplay Modifiers") { - function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.SetGameplayMods(e.beat, e.type, e.toggle); }, + function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.SetGameplayMods(e.beat, e["type"], e["toggle"]); }, defaultLength = 0.5f, parameters = new List() { @@ -100,7 +100,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("set background effects", "Background Appearance") { - function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.SetBgAndShadowCol(e.beat, e.length, e.type, e.type2, e.colorA, e.colorB, e.type3); KarateMan.instance.SetBgTexture(e.type4, e.type5, e.colorC, e.colorD); }, + function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.SetBgAndShadowCol(e.beat, e.length, e["type"], e["type2"], e["colorA"], e["colorB"], e["type3"]); KarateMan.instance.SetBgTexture(e["type4"], e["type5"], e["colorC"], e["colorD"]); }, defaultLength = 0.5f, resizable = true, parameters = new List() @@ -116,11 +116,11 @@ namespace HeavenStudio.Games.Loaders new Param("colorD", new Color(), "Fading Filter Color", "When using the Fade background effect, make filter colour fade to this colour"), }, - inactiveFunction = delegate { var e = eventCaller.currentEntity; KarateMan.SetBgEffectsUnloaded(e.beat, e.length, e.type, e.type2, e.colorA, e.colorB, e.type3, e.type4, e.type5, e.colorC, e.colorD); } + inactiveFunction = delegate { var e = eventCaller.currentEntity; KarateMan.SetBgEffectsUnloaded(e.beat, e.length, e["type"], e["type2"], e["colorA"], e["colorB"], e["type3"], e["type4"], e["type5"], e["colorC"], e["colorD"]); } }, new GameAction("set object colors", "Object Colors") { - function = delegate { var e = eventCaller.currentEntity; KarateMan.UpdateMaterialColour(e.colorA, e.colorB, e.colorC); }, + function = delegate { var e = eventCaller.currentEntity; KarateMan.UpdateMaterialColour(e["colorA"], e["colorB"], e["colorC"]); }, defaultLength = 0.5f, parameters = new List() { @@ -128,11 +128,11 @@ namespace HeavenStudio.Games.Loaders new Param("colorB", new Color(0.81f,0.81f,0.81f,1), "Joe Highlight Color", "The color to use for Karate Joe's highlights"), new Param("colorC", new Color(1,1,1,1), "Item Color", "The color to use for the thrown items"), }, - inactiveFunction = delegate { var e = eventCaller.currentEntity; KarateMan.UpdateMaterialColour(e.colorA, e.colorB, e.colorC); } + inactiveFunction = delegate { var e = eventCaller.currentEntity; KarateMan.UpdateMaterialColour(e["colorA"], e["colorB"], e["colorC"]); } }, new GameAction("particle effects", "Particle Effects") { - function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.SetParticleEffect(e.beat, e.type, e.valA, e.valB); }, + function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.SetParticleEffect(e.beat, e["type"], e["valA"], e["valB"]); }, defaultLength = 0.5f, parameters = new List() { @@ -143,7 +143,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("force facial expression", "Set Facial Expression") { - function = delegate { KarateMan.instance.SetFaceExpression(eventCaller.currentEntity.type); }, + function = delegate { KarateMan.instance.SetFaceExpression(eventCaller.currentEntity["type"]); }, defaultLength = 0.5f, parameters = new List() { @@ -188,7 +188,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("hit3", "") { - function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.DoWord(e.beat, e.type); }, + function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.DoWord(e.beat, e["type"]); }, parameters = new List() { new Param("type", KarateMan.HitThree.HitThree, "Type", "The warning text to show") @@ -203,7 +203,7 @@ namespace HeavenStudio.Games.Loaders new GameAction("set background color", "") { - function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.SetBgAndShadowCol(e.beat, e.length, e.type, e.type2, e.colorA, e.colorB, (int) KarateMan.currentBgEffect); }, + function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.SetBgAndShadowCol(e.beat, e.length, e["type"], e["type2"], e["colorA"], e["colorB"], (int) KarateMan.currentBgEffect); }, defaultLength = 0.5f, parameters = new List() { @@ -217,7 +217,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("set background fx", "") { - function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.SetBgFx(e.type, e.beat, e.length); }, + function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.SetBgFx(e["type"], e.beat, e.length); }, defaultLength = 0.5f, parameters = new List() { @@ -228,7 +228,7 @@ namespace HeavenStudio.Games.Loaders new GameAction("set background texture", "") { - function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.SetBgTexture(e.type, e.type2, e.colorA, e.colorB); }, + function = delegate { var e = eventCaller.currentEntity; KarateMan.instance.SetBgTexture(e["type"], e["type2"], e["colorA"], e["colorB"]); }, defaultLength = 0.5f, parameters = new List() { @@ -542,8 +542,8 @@ namespace HeavenStudio.Games BGEffect.transform.position = new Vector3(GameCamera.instance.transform.position.x, GameCamera.instance.transform.position.y, 0); } - static List allHits = new List(); - static List allEnds = new List(); + static List allHits = new List(); + static List allEnds = new List(); public static int CountHitsToEnd(float fromBeat) { allHits = EventCaller.GetAllInGameManagerList("karateman", new string[] { "hit", "bulb", "kick", "combo" }); @@ -554,7 +554,7 @@ namespace HeavenStudio.Games float endBeat = Single.MaxValue; //get the beat of the closest end event - foreach (Beatmap.Entity end in allEnds) + foreach (var end in allEnds) { if (end.beat > fromBeat) { @@ -569,7 +569,7 @@ namespace HeavenStudio.Games string type; for (int i = 0; i < allHits.Count; i++) { - Beatmap.Entity h = allHits[i]; + var h = allHits[i]; if (h.beat >= fromBeat) { if (h.beat < endBeat) @@ -806,8 +806,8 @@ namespace HeavenStudio.Games var e = bgfx[i]; if (e.beat > beat) break; - SetBgAndShadowCol(e.beat, e.length, e.type, e.type2, e.colorA, e.colorB, e.type3); - SetBgTexture(e.type4, e.type5, e.colorC, e.colorD); + SetBgAndShadowCol(e.beat, e.length, e["type"], e["type2"], e["colorA"], e["colorB"], e["type3"]); + SetBgTexture(e["type4"], e["type5"], e["colorC"], e["colorD"]); } var camfx = GameManager.instance.Beatmap.entities.FindAll(en => en.datamodel == "karateman/special camera"); for (int i = 0; i < camfx.Count; i++) @@ -815,7 +815,7 @@ namespace HeavenStudio.Games var e = camfx[i]; if (e.beat > beat) break; - DoSpecialCamera(e.beat, e.length, e.toggle); + DoSpecialCamera(e.beat, e.length, e["toggle"]); } // has issues when creating a new hitx entity so this is deactivated for now // var hitx = GameManager.instance.Beatmap.entities.FindAll(en => en.datamodel == "karateman/hitX"); @@ -825,7 +825,7 @@ namespace HeavenStudio.Games // if (e.beat > beat) // break; // Debug.Log("hitx"); - // DoWord(e.beat, e.type, false); + // DoWord(e.beat, e["type"], false); // } } diff --git a/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs b/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs index 7da7b4ac..d1b2b82e 100644 --- a/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs +++ b/Assets/Scripts/Games/MrUpbeat/MrUpbeat.cs @@ -30,7 +30,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("ding!", "Finish Stepping") { - function = delegate { MrUpbeat.instance.Ding(eventCaller.currentEntity.toggle); }, + function = delegate { MrUpbeat.instance.Ding(eventCaller.currentEntity["toggle"]); }, defaultLength = 0.5f, parameters = new List() { @@ -82,7 +82,7 @@ namespace HeavenStudio.Games private void Update() { - List gos = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "mrUpbeat/go"); + List gos = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "mrUpbeat/go"); for (int i = 0; i < gos.Count; i++) { if ((gos[i].beat - 0.15f) <= Conductor.instance.songPositionInBeats && (gos[i].beat + gos[i].length) - 0.15f > Conductor.instance.songPositionInBeats) @@ -118,7 +118,7 @@ namespace HeavenStudio.Games public override void OnGameSwitch(float beat) { - foreach (Beatmap.Entity entity in GameManager.instance.Beatmap.entities) + foreach (var entity in GameManager.instance.Beatmap.entities) { if (entity.beat > beat) //the list is sorted based on the beat of the entity, so this should work fine. { diff --git a/Assets/Scripts/Games/PajamaParty/PajamaParty.cs b/Assets/Scripts/Games/PajamaParty/PajamaParty.cs index b83a3d96..1e6e82c8 100644 --- a/Assets/Scripts/Games/PajamaParty/PajamaParty.cs +++ b/Assets/Scripts/Games/PajamaParty/PajamaParty.cs @@ -30,14 +30,14 @@ namespace HeavenStudio.Games.Loaders //idem new GameAction("slumber", "Slumber") { - function = delegate {var e = eventCaller.currentEntity; PajamaParty.instance.DoSleepSequence(e.beat, e.toggle, e.type);}, + function = delegate {var e = eventCaller.currentEntity; PajamaParty.instance.DoSleepSequence(e.beat, e["toggle"], e["type"]);}, defaultLength = 8f, parameters = new List() { 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"]);} }, new GameAction("throw", "Throw Pillows") { diff --git a/Assets/Scripts/Games/RhythmRally/RhythmRally.cs b/Assets/Scripts/Games/RhythmRally/RhythmRally.cs index ea51dd14..871d1a38 100644 --- a/Assets/Scripts/Games/RhythmRally/RhythmRally.cs +++ b/Assets/Scripts/Games/RhythmRally/RhythmRally.cs @@ -61,8 +61,8 @@ namespace HeavenStudio.Games.Loaders { function = delegate { var e = eventCaller.currentEntity; - var rotation = new Vector3(0, e.valA, 0); - RhythmRally.instance.ChangeCameraAngle(rotation, e.valB, e.length, (Ease)e.type, (RotateMode)e.type2); + var rotation = new Vector3(0, e["valA"], 0); + RhythmRally.instance.ChangeCameraAngle(rotation, e["valB"], e.length, (Ease)e["type"], (RotateMode)e["type2"]); }, defaultLength = 4, resizable = true, @@ -259,7 +259,7 @@ namespace HeavenStudio.Games // Check if the opponent should swing. if (!served && timeBeforeNextHit <= 0f) { - List rallies = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "rhythmRally/rally" || c.datamodel == "rhythmRally/slow rally"); + var rallies = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "rhythmRally/rally" || c.datamodel == "rhythmRally/slow rally"); for (int i = 0; i < rallies.Count; i++) { var rally = rallies[i]; diff --git a/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs b/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs index dabfd83d..952d1d77 100644 --- a/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs +++ b/Assets/Scripts/Games/RhythmTweezers/RhythmTweezers.cs @@ -34,7 +34,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("next vegetable", "Swap Vegetable") { - function = delegate { var e = eventCaller.currentEntity; RhythmTweezers.instance.NextVegetable(e.beat, e.type, e.colorA, e.colorB); }, + function = delegate { var e = eventCaller.currentEntity; RhythmTweezers.instance.NextVegetable(e.beat, e["type"], e["colorA"], e["colorB"]); }, defaultLength = 0.5f, parameters = new List() { @@ -45,7 +45,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("change vegetable", "Change Vegetable (Instant)") { - function = delegate { var e = eventCaller.currentEntity; RhythmTweezers.instance.ChangeVegetableImmediate(e.type, e.colorA, e.colorB); }, + function = delegate { var e = eventCaller.currentEntity; RhythmTweezers.instance.ChangeVegetableImmediate(e["type"], e["colorA"], e["colorB"]); }, defaultLength = 0.5f, parameters = new List() { @@ -66,7 +66,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("set background color", "Background Colour") { - function = delegate { var e = eventCaller.currentEntity; RhythmTweezers.instance.ChangeBackgroundColor(e.colorA, 0f); }, + function = delegate { var e = eventCaller.currentEntity; RhythmTweezers.instance.ChangeBackgroundColor(e["colorA"], 0f); }, defaultLength = 0.5f, parameters = new List() { @@ -75,7 +75,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("fade background color", "Background Fade") { - function = delegate { var e = eventCaller.currentEntity; RhythmTweezers.instance.FadeBackgroundColor(e.colorA, e.colorB, e.length); }, + function = delegate { var e = eventCaller.currentEntity; RhythmTweezers.instance.FadeBackgroundColor(e["colorA"], e["colorB"], e.length); }, resizable = true, parameters = new List() { diff --git a/Assets/Scripts/Games/SamuraiSliceNtr/SamuraiSliceNtr.cs b/Assets/Scripts/Games/SamuraiSliceNtr/SamuraiSliceNtr.cs index 0760f32b..930d452b 100644 --- a/Assets/Scripts/Games/SamuraiSliceNtr/SamuraiSliceNtr.cs +++ b/Assets/Scripts/Games/SamuraiSliceNtr/SamuraiSliceNtr.cs @@ -18,7 +18,7 @@ namespace HeavenStudio.Games.Loaders { function = delegate { - SamuraiSliceNtr.instance.ObjectIn(eventCaller.currentEntity.beat, eventCaller.currentEntity.type, (int) eventCaller.currentEntity.valA); + SamuraiSliceNtr.instance.ObjectIn(eventCaller.currentEntity.beat, eventCaller.currentEntity["type"], (int) eventCaller.currentEntity["valA"]); }, defaultLength = 8, parameters = new List() diff --git a/Assets/Scripts/Games/SpaceSoccer/Ball.cs b/Assets/Scripts/Games/SpaceSoccer/Ball.cs index b9c07f60..257e67e0 100644 --- a/Assets/Scripts/Games/SpaceSoccer/Ball.cs +++ b/Assets/Scripts/Games/SpaceSoccer/Ball.cs @@ -47,7 +47,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer return; } - List highKicks = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "spaceSoccer/high kick-toe!"); + var highKicks = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "spaceSoccer/high kick-toe!"); int numHighKicks = 0; //determine what state the ball was in for the previous kick. for(int i = 0; i < highKicks.Count; i++) diff --git a/Assets/Scripts/Games/SpaceSoccer/Kicker.cs b/Assets/Scripts/Games/SpaceSoccer/Kicker.cs index 5023918f..e5e55af6 100644 --- a/Assets/Scripts/Games/SpaceSoccer/Kicker.cs +++ b/Assets/Scripts/Games/SpaceSoccer/Kicker.cs @@ -183,7 +183,7 @@ namespace HeavenStudio.Games.Scripts_SpaceSoccer // } // } - List highKicks = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "spaceSoccer/high kick-toe!"); + var highKicks = GameManager.instance.Beatmap.entities.FindAll(c => c.datamodel == "spaceSoccer/high kick-toe!"); for (int i = 0; i < highKicks.Count; i++) { if ((highKicks[i].beat - 0.15f) <= Conductor.instance.songPositionInBeats && highKicks[i].beat + 1f > Conductor.instance.songPositionInBeats) diff --git a/Assets/Scripts/Games/SpaceSoccer/SpaceSoccer.cs b/Assets/Scripts/Games/SpaceSoccer/SpaceSoccer.cs index a0a7293d..48101ffc 100644 --- a/Assets/Scripts/Games/SpaceSoccer/SpaceSoccer.cs +++ b/Assets/Scripts/Games/SpaceSoccer/SpaceSoccer.cs @@ -14,13 +14,13 @@ namespace HeavenStudio.Games.Loaders { new GameAction("ball dispense", "Ball Dispense") { - function = delegate { SpaceSoccer.instance.Dispense(eventCaller.currentEntity.beat, !eventCaller.currentEntity.toggle); }, + function = delegate { SpaceSoccer.instance.Dispense(eventCaller.currentEntity.beat, !eventCaller.currentEntity["toggle"]); }, defaultLength = 2f, parameters = new List() { new Param("toggle", false, "Disable Sound", "Disables the dispense sound") }, - inactiveFunction = delegate { if (!eventCaller.currentEntity.toggle) { SpaceSoccer.DispenseSound(eventCaller.currentEntity.beat); } } + inactiveFunction = delegate { if (!eventCaller.currentEntity["toggle"]) { SpaceSoccer.DispenseSound(eventCaller.currentEntity.beat); } } }, new GameAction("high kick-toe!", "High Kick-Toe!") { @@ -82,7 +82,7 @@ namespace HeavenStudio.Games public override void OnGameSwitch(float beat) { - foreach(Beatmap.Entity entity in GameManager.instance.Beatmap.entities) + foreach(var entity in GameManager.instance.Beatmap.entities) { if(entity.beat > beat) //the list is sorted based on the beat of the entity, so this should work fine. { diff --git a/Assets/Scripts/Games/Spaceball/Spaceball.cs b/Assets/Scripts/Games/Spaceball/Spaceball.cs index 7302b6b1..1e9bb08c 100644 --- a/Assets/Scripts/Games/Spaceball/Spaceball.cs +++ b/Assets/Scripts/Games/Spaceball/Spaceball.cs @@ -14,7 +14,7 @@ namespace HeavenStudio.Games.Loaders { new GameAction("shoot", "Pitch Ball") { - function = delegate { Spaceball.instance.Shoot(eventCaller.currentEntity.beat, false, eventCaller.currentEntity.type); }, + function = delegate { Spaceball.instance.Shoot(eventCaller.currentEntity.beat, false, eventCaller.currentEntity["type"]); }, defaultLength = 2, parameters = new List() { @@ -23,7 +23,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("shootHigh", "Pitch High Ball") { - function = delegate { Spaceball.instance.Shoot(eventCaller.currentEntity.beat, true, eventCaller.currentEntity.type); }, + function = delegate { Spaceball.instance.Shoot(eventCaller.currentEntity.beat, true, eventCaller.currentEntity["type"]); }, defaultLength = 3, parameters = new List() { @@ -32,7 +32,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("costume", "Change Batter Costume") { - function = delegate { Spaceball.instance.Costume(eventCaller.currentEntity.type); }, + function = delegate { Spaceball.instance.Costume(eventCaller.currentEntity["type"]); }, parameters = new List() { new Param("type", Spaceball.CostumeType.Standard, "Type", "The costume to change to") @@ -94,7 +94,7 @@ namespace HeavenStudio.Games public Sprite[] Balls; - private List allCameraEvents = new List(); + private List allCameraEvents = new List(); public Alien alien; @@ -121,7 +121,7 @@ namespace HeavenStudio.Games { instance = this; var camEvents = EventCaller.GetAllInGameManagerList("spaceball", new string[] { "camera" }); - List tempEvents = new List(); + List tempEvents = new List(); for (int i = 0; i < camEvents.Count; i++) { if (camEvents[i].beat + camEvents[i].beat >= Conductor.instance.songPositionInBeats) @@ -187,26 +187,26 @@ namespace HeavenStudio.Games if (currentZoomIndex < allCameraEvents.Count && currentZoomIndex >= 0) { if (currentZoomIndex - 1 >= 0) - lastCamDistance = allCameraEvents[currentZoomIndex - 1].valA * -1; + lastCamDistance = allCameraEvents[currentZoomIndex - 1]["valA"] * -1; else { if (currentZoomIndex == 0) lastCamDistance = -10; else - lastCamDistance = allCameraEvents[0].valA * -1; + lastCamDistance = allCameraEvents[0]["valA"] * -1; } currentZoomCamBeat = allCameraEvents[currentZoomIndex].beat; currentZoomCamLength = allCameraEvents[currentZoomIndex].length; - float dist = allCameraEvents[currentZoomIndex].valA * -1; + float dist = allCameraEvents[currentZoomIndex]["valA"] * -1; if (dist > 0) currentZoomCamDistance = 0; else currentZoomCamDistance = dist; - lastEase = allCameraEvents[currentZoomIndex].ease; + lastEase = allCameraEvents[currentZoomIndex]["ease"]; } } diff --git a/Assets/Scripts/Games/TapTrial/TapTrial.cs b/Assets/Scripts/Games/TapTrial/TapTrial.cs index 794097e4..8e0469b3 100644 --- a/Assets/Scripts/Games/TapTrial/TapTrial.cs +++ b/Assets/Scripts/Games/TapTrial/TapTrial.cs @@ -16,7 +16,7 @@ namespace HeavenStudio.Games.Loaders { new GameAction("bop", "Bop") { - function = delegate { TapTrial.instance.Bop(eventCaller.currentEntity.toggle); }, + function = delegate { TapTrial.instance.Bop(eventCaller.currentEntity["toggle"]); }, defaultLength = .5f, parameters = new List() { @@ -61,7 +61,7 @@ namespace HeavenStudio.Games.Loaders new GameAction("scroll event", "Scroll Background") { - function = delegate { TapTrial.instance.scrollEvent(eventCaller.currentEntity.toggle, eventCaller.currentEntity.toggle); }, + function = delegate { TapTrial.instance.scrollEvent(eventCaller.currentEntity["toggle"], eventCaller.currentEntity["toggle"]); }, defaultLength = .5f, parameters = new List() { @@ -72,7 +72,7 @@ namespace HeavenStudio.Games.Loaders new GameAction("giraffe events", "Giraffe Animations") { - function = delegate { TapTrial.instance.giraffeEvent(eventCaller.currentEntity.toggle, eventCaller.currentEntity.toggle); }, + function = delegate { TapTrial.instance.giraffeEvent(eventCaller.currentEntity["toggle"], eventCaller.currentEntity["toggle"]); }, defaultLength = .5f, parameters = new List() { diff --git a/Assets/Scripts/Games/Tram&Pauline/TramAndPauline.cs b/Assets/Scripts/Games/Tram&Pauline/TramAndPauline.cs index 43c8ea39..0f1f8bfa 100644 --- a/Assets/Scripts/Games/Tram&Pauline/TramAndPauline.cs +++ b/Assets/Scripts/Games/Tram&Pauline/TramAndPauline.cs @@ -19,7 +19,7 @@ namespace HeavenStudio.Games.Loaders }, new GameAction("SFX", "SFX") { - function = delegate { var e = eventCaller.currentEntity; TramAndPauline.instance.SFX(e.beat, e.toggle); }, + function = delegate { var e = eventCaller.currentEntity; TramAndPauline.instance.SFX(e.beat, e["toggle"]); }, defaultLength = 2.5f, parameters = new List() { diff --git a/Assets/Scripts/Games/TrickClass/TrickClass.cs b/Assets/Scripts/Games/TrickClass/TrickClass.cs index 3c8def0c..c7373cf8 100644 --- a/Assets/Scripts/Games/TrickClass/TrickClass.cs +++ b/Assets/Scripts/Games/TrickClass/TrickClass.cs @@ -19,7 +19,7 @@ namespace HeavenStudio.Games.Loaders { function = delegate { - TrickClass.instance.TossObject(eventCaller.currentEntity.beat, eventCaller.currentEntity.type); + TrickClass.instance.TossObject(eventCaller.currentEntity.beat, eventCaller.currentEntity["type"]); }, defaultLength = 3, parameters = new List() @@ -110,7 +110,7 @@ namespace HeavenStudio.Games if (timeToEvent > 0f && timeToEvent <= 1f) { string anim = "WarnBall"; - switch (e.type) + switch (e["type"]) { case (int) TrickObjType.Plane: anim = "WarnPlane"; diff --git a/Assets/Scripts/Games/WizardsWaltz/WizardsWaltz.cs b/Assets/Scripts/Games/WizardsWaltz/WizardsWaltz.cs index d41d4887..f5966238 100644 --- a/Assets/Scripts/Games/WizardsWaltz/WizardsWaltz.cs +++ b/Assets/Scripts/Games/WizardsWaltz/WizardsWaltz.cs @@ -60,7 +60,7 @@ namespace HeavenStudio.Games instance = this; wizard.Init(); - Beatmap.Entity nextStart = GameManager.instance.Beatmap.entities.Find(c => c.datamodel == "wizardsWaltz/start interval" && c.beat + c.length >= Conductor.instance.songPositionInBeats); + var nextStart = GameManager.instance.Beatmap.entities.Find(c => c.datamodel == "wizardsWaltz/start interval" && c.beat + c.length >= Conductor.instance.songPositionInBeats); if (nextStart != null) { diff --git a/Assets/Scripts/LevelEditor/Commands/Block.cs b/Assets/Scripts/LevelEditor/Commands/Block.cs index deb74105..4d7edbb5 100644 --- a/Assets/Scripts/LevelEditor/Commands/Block.cs +++ b/Assets/Scripts/LevelEditor/Commands/Block.cs @@ -127,7 +127,7 @@ namespace HeavenStudio.Editor.Commands deletedObj = eventObj; Selections.instance.Deselect(eventObj); Timeline.instance.DestroyEventObject(eventObj.entity); - // Beatmap.Entity e = deletedObjs[i].entity; + // DynamicBeatmap.DynamicEntity e = deletedObjs[i].entity; // Timeline.instance.AddEventObject(e.datamodel, false, new Vector3(e.beat, -e.track * Timeline.instance.LayerHeight()), e, true, e.eventObj.eventObjID); } } @@ -166,7 +166,7 @@ namespace HeavenStudio.Editor.Commands { for (int i = 0; i < deletedObjs.Count; i++) { - Beatmap.Entity e = deletedObjs[i].entity; + DynamicBeatmap.DynamicEntity e = deletedObjs[i].entity; eventObjs[i] = Timeline.instance.AddEventObject(e.datamodel, false, new Vector3(e.beat, -e.track * Timeline.instance.LayerHeight()), e, true, e.eventObj.eventObjID); } } @@ -190,7 +190,7 @@ namespace HeavenStudio.Editor.Commands { for (int i = 0; i < copiedObjs.Count; i++) { - Beatmap.Entity e = copiedObjs[i].entity; + DynamicBeatmap.DynamicEntity e = copiedObjs[i].entity; eventObjs[i] = Timeline.instance.AddEventObject(e.datamodel, false, new Vector3(e.beat, -e.track * Timeline.instance.LayerHeight()), e, true, e.eventObj.eventObjID); } } diff --git a/Assets/Scripts/LevelEditor/Editor.cs b/Assets/Scripts/LevelEditor/Editor.cs index dc345fea..d2fc6e23 100644 --- a/Assets/Scripts/LevelEditor/Editor.cs +++ b/Assets/Scripts/LevelEditor/Editor.cs @@ -339,7 +339,7 @@ namespace HeavenStudio.Editor { var extensions = new[] { - new ExtensionFilter("Heaven Studio Remix File", "tengoku") + new ExtensionFilter("Heaven Studio Remix File", "riq") }; StandaloneFileBrowser.SaveFilePanelAsync("Save Remix As", "", "remix_level", extensions, (string path) => @@ -380,9 +380,9 @@ namespace HeavenStudio.Editor LoadRemix(""); } - public void LoadRemix(string json = "") + public void LoadRemix(string json = "", string type = "riq") { - GameManager.instance.LoadRemix(json); + GameManager.instance.LoadRemix(json, type); Timeline.instance.LoadRemix(); Timeline.instance.TempoInfo.UpdateStartingBPMText(); Timeline.instance.VolumeInfo.UpdateStartingVolumeText(); @@ -396,7 +396,8 @@ namespace HeavenStudio.Editor { var extensions = new[] { - new ExtensionFilter("Heaven Studio Remix File", new string[] { "tengoku", "rhmania" }) + new ExtensionFilter("Heaven Studio Remix File", new string[] { "riq" }), + new ExtensionFilter("Legacy Heaven Studio Remix", new string[] { "tengoku", "rhmania" }) }; StandaloneFileBrowser.OpenFilePanelAsync("Open Remix", "", extensions, false, (string[] paths) => @@ -405,6 +406,7 @@ namespace HeavenStudio.Editor if (path == string.Empty) return; loadedMusic = false; + string extension = path.GetExtension(); using var zipFile = File.Open(path, FileMode.Open); using var archive = new ZipArchive(zipFile, ZipArchiveMode.Read); @@ -416,7 +418,7 @@ namespace HeavenStudio.Editor { using var stream = entry.Open(); using var reader = new StreamReader(stream); - LoadRemix(reader.ReadToEnd()); + LoadRemix(reader.ReadToEnd(), extension); break; } @@ -435,7 +437,10 @@ namespace HeavenStudio.Editor } if (!loadedMusic) + { Conductor.instance.musicSource.clip = null; + MusicBytes = null; + } currentRemixPath = path; remixName = Path.GetFileName(path); diff --git a/Assets/Scripts/LevelEditor/EventSelector/EventParameterManager.cs b/Assets/Scripts/LevelEditor/EventSelector/EventParameterManager.cs index 8dcbb582..e531980e 100644 --- a/Assets/Scripts/LevelEditor/EventSelector/EventParameterManager.cs +++ b/Assets/Scripts/LevelEditor/EventSelector/EventParameterManager.cs @@ -20,7 +20,7 @@ namespace HeavenStudio.Editor [SerializeField] private GameObject ColorP; [SerializeField] private GameObject StringP; - public Beatmap.Entity entity; + public DynamicBeatmap.DynamicEntity entity; public bool active; @@ -61,13 +61,13 @@ namespace HeavenStudio.Editor Editor.instance.SetGameEventTitle($"Select game event for {gridGameSelector.SelectedMinigame.Replace("\n", "")}"); } - public void StartParams(Beatmap.Entity entity) + public void StartParams(DynamicBeatmap.DynamicEntity entity) { active = true; AddParams(entity); } - private void AddParams(Beatmap.Entity entity) + private void AddParams(DynamicBeatmap.DynamicEntity entity) { var minigame = EventCaller.instance.GetMinigame(entity.datamodel.Split(0)); int actionIndex = minigame.actions.IndexOf(minigame.actions.Find(c => c.actionName == entity.datamodel.Split(1))); @@ -118,7 +118,7 @@ namespace HeavenStudio.Editor { prefab = DropdownP; } - else if (objType == typeof(Color)) + else if (objType == typeof(Color) || objType == typeof(EntityTypes.SerializableColor)) { prefab = ColorP; } diff --git a/Assets/Scripts/LevelEditor/EventSelector/EventPropertyPrefab.cs b/Assets/Scripts/LevelEditor/EventSelector/EventPropertyPrefab.cs index 99ef48e4..03d3a3cb 100644 --- a/Assets/Scripts/LevelEditor/EventSelector/EventPropertyPrefab.cs +++ b/Assets/Scripts/LevelEditor/EventSelector/EventPropertyPrefab.cs @@ -121,10 +121,11 @@ namespace HeavenStudio.Editor break; case Color _: + case EntityTypes.SerializableColor _: colorPreview.colorPicker.onColorChanged += _ => parameterManager.entity[propertyName] = colorPreview.colorPicker.color; - var paramCol = (Color) parameterManager.entity[propertyName]; + Color paramCol = parameterManager.entity[propertyName]; ColorBTN.onClick.AddListener( () => diff --git a/Assets/Scripts/LevelEditor/Timeline/TempoTimeline.cs b/Assets/Scripts/LevelEditor/Timeline/TempoTimeline.cs index adfa9495..153ad772 100644 --- a/Assets/Scripts/LevelEditor/Timeline/TempoTimeline.cs +++ b/Assets/Scripts/LevelEditor/Timeline/TempoTimeline.cs @@ -29,7 +29,7 @@ namespace HeavenStudio.Editor.Track for (int i = 0; i < GameManager.instance.Beatmap.tempoChanges.Count; i++) { - Beatmap.TempoChange tempoChange = GameManager.instance.Beatmap.tempoChanges[i]; + DynamicBeatmap.TempoChange tempoChange = GameManager.instance.Beatmap.tempoChanges[i]; AddTempoChange(false, tempoChange); } } @@ -140,7 +140,7 @@ namespace HeavenStudio.Editor.Track tempoTimelineObjs.Clear(); } - public void AddTempoChange(bool create, Beatmap.TempoChange tempoChange_ = null) + public void AddTempoChange(bool create, DynamicBeatmap.TempoChange tempoChange_ = null) { GameObject tempoChange = Instantiate(RefTempoChange.gameObject, this.transform); @@ -157,7 +157,7 @@ namespace HeavenStudio.Editor.Track tempoChange.transform.position = new Vector3(Editor.instance.EditorCamera.ScreenToWorldPoint(Input.mousePosition).x + 0.08f, tempoChange.transform.position.y); tempoChange.transform.localPosition = new Vector3(Starpelly.Mathp.Round2Nearest(tempoChange.transform.localPosition.x, Timeline.SnapInterval()), tempoChange.transform.localPosition.y); - Beatmap.TempoChange tempoC = new Beatmap.TempoChange(); + DynamicBeatmap.TempoChange tempoC = new DynamicBeatmap.TempoChange(); tempoC.beat = tempoChange.transform.localPosition.x; tempoC.tempo = GameManager.instance.Beatmap.bpm; diff --git a/Assets/Scripts/LevelEditor/Timeline/TempoTimelineObj.cs b/Assets/Scripts/LevelEditor/Timeline/TempoTimelineObj.cs index 8e48f86b..886e7c6c 100644 --- a/Assets/Scripts/LevelEditor/Timeline/TempoTimelineObj.cs +++ b/Assets/Scripts/LevelEditor/Timeline/TempoTimelineObj.cs @@ -15,7 +15,7 @@ namespace HeavenStudio.Editor.Track [SerializeField] private TMP_Text tempoTXT; [SerializeField] private RectTransform raycastRect; - public Beatmap.TempoChange tempoChange; + public DynamicBeatmap.TempoChange tempoChange; private float startPosX; private bool moving = false; diff --git a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs index 162eacb8..4057ff08 100644 --- a/Assets/Scripts/LevelEditor/Timeline/Timeline.cs +++ b/Assets/Scripts/LevelEditor/Timeline/Timeline.cs @@ -503,7 +503,7 @@ namespace HeavenStudio.Editor.Track #region Functions - public TimelineEventObj AddEventObject(string eventName, bool dragNDrop = false, Vector3 pos = new Vector3(), Beatmap.Entity entity = null, bool addEvent = false, string eventId = "") + public TimelineEventObj AddEventObject(string eventName, bool dragNDrop = false, Vector3 pos = new Vector3(), DynamicBeatmap.DynamicEntity entity = null, bool addEvent = false, string eventId = "") { var game = EventCaller.instance.GetMinigame(eventName.Split(0)); var action = EventCaller.instance.GetGameAction(game, eventName.Split(1)); @@ -561,11 +561,11 @@ namespace HeavenStudio.Editor.Track if (addEvent) { - Beatmap.Entity tempEntity = entity; + DynamicBeatmap.DynamicEntity tempEntity = entity; if (entity == null) { - Beatmap.Entity en = new Beatmap.Entity(); + DynamicBeatmap.DynamicEntity en = new DynamicBeatmap.DynamicEntity(); en.datamodel = eventName; en.eventObj = eventObj; @@ -592,8 +592,17 @@ namespace HeavenStudio.Editor.Track { returnVal = ((EntityTypes.Float)ep[i].parameter).val; } + else if (propertyType == typeof(Color)) + { + returnVal = new EntityTypes.SerializableColor{ Color = (Color)ep[i].parameter }; + } + else if (propertyType.IsEnum) + { + returnVal = (int) ep[i].parameter; + } - tempEntity[ep[i].propertyName] = returnVal; + //tempEntity[ep[i].propertyName] = returnVal; + tempEntity.CreateProperty(ep[i].propertyName, returnVal); } } } @@ -614,7 +623,7 @@ namespace HeavenStudio.Editor.Track private List duplicatedEventObjs = new List(); public TimelineEventObj CopyEventObject(TimelineEventObj e) { - Beatmap.Entity clone = e.entity.DeepCopy(); + DynamicBeatmap.DynamicEntity clone = e.entity.DeepCopy(); TimelineEventObj dup = AddEventObject(clone.datamodel, false, new Vector3(clone.beat, -clone.track * Timeline.instance.LayerHeight()), clone, true, RandomID()); duplicatedEventObjs.Add(dup); @@ -627,7 +636,7 @@ namespace HeavenStudio.Editor.Track duplicatedEventObjs = new List(); } - public void DestroyEventObject(Beatmap.Entity entity) + public void DestroyEventObject(DynamicBeatmap.DynamicEntity entity) { if (EventParameterManager.instance.entity == entity) EventParameterManager.instance.Disable(); diff --git a/Assets/Scripts/LevelEditor/Timeline/TimelineEventObj.cs b/Assets/Scripts/LevelEditor/Timeline/TimelineEventObj.cs index 60fba269..311fd4da 100644 --- a/Assets/Scripts/LevelEditor/Timeline/TimelineEventObj.cs +++ b/Assets/Scripts/LevelEditor/Timeline/TimelineEventObj.cs @@ -29,7 +29,7 @@ namespace HeavenStudio.Editor.Track // private GameObject moveTemp; [Header("Properties")] - public Beatmap.Entity entity; + public DynamicBeatmap.DynamicEntity entity; public float length; public bool eligibleToMove = false; private bool lastVisible; diff --git a/Assets/Scripts/LevelEditor/Timeline/VolumeTimelineObj.cs b/Assets/Scripts/LevelEditor/Timeline/VolumeTimelineObj.cs index e800c5ee..af1ec65c 100644 --- a/Assets/Scripts/LevelEditor/Timeline/VolumeTimelineObj.cs +++ b/Assets/Scripts/LevelEditor/Timeline/VolumeTimelineObj.cs @@ -15,7 +15,7 @@ namespace HeavenStudio.Editor.Track [SerializeField] private TMP_Text volumeTXT; [SerializeField] private RectTransform raycastRect; - public Beatmap.VolumeChange volumeChange; + public DynamicBeatmap.VolumeChange volumeChange; private float startPosX; private bool moving = false; diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index e2ab698b..3691f940 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -259,7 +259,7 @@ namespace HeavenStudio }, delegate { - GameManager.instance.ToggleInputs(eventCaller.currentEntity.toggle); + GameManager.instance.ToggleInputs(eventCaller.currentEntity["toggle"]); } ), @@ -300,14 +300,14 @@ namespace HeavenStudio { new Param("type", SoundEffects.CountInType.Normal, "Type", "The sounds to play for the count-in") }, - delegate { var e = eventCaller.currentEntity; SoundEffects.FourBeatCountIn(e.beat, e.length / 4f, e.type); } + delegate { var e = eventCaller.currentEntity; SoundEffects.FourBeatCountIn(e.beat, e.length / 4f, e["type"]); } ), new GameAction("8 beat count-in", "8 Beat Count-In", 8f, true, new List() { new Param("type", SoundEffects.CountInType.Normal, "Type", "The sounds to play for the count-in") }, - delegate { var e = eventCaller.currentEntity; SoundEffects.EightBeatCountIn(e.beat, e.length / 8f, e.type); } + delegate { var e = eventCaller.currentEntity; SoundEffects.EightBeatCountIn(e.beat, e.length / 8f, e["type"]); } ), new GameAction("count", "Count", 1f, false, new List() @@ -315,7 +315,7 @@ namespace HeavenStudio new Param("type", SoundEffects.CountNumbers.One, "Number", "The sound to play"), new Param("toggle", false, "Alt", "Whether or not the alternate version should be played") }, - delegate { var e = eventCaller.currentEntity; SoundEffects.Count(e.type, e.toggle); } + delegate { var e = eventCaller.currentEntity; SoundEffects.Count(e["type"], e["toggle"]); } ), new GameAction("cowbell", "Cowbell", function: delegate { SoundEffects.Cowbell(); } @@ -331,7 +331,7 @@ namespace HeavenStudio { new Param("toggle", false, "Alt", "Whether or not the alternate version should be played") }, - function: delegate { SoundEffects.Go(eventCaller.currentEntity.toggle); } + function: delegate { SoundEffects.Go(eventCaller.currentEntity["toggle"]); } ), // These are still here for backwards-compatibility but are hidden in the editor diff --git a/Assets/Scripts/Util/EntityTypes.cs b/Assets/Scripts/Util/EntityTypes.cs index 4fb79a84..2a800ee9 100644 --- a/Assets/Scripts/Util/EntityTypes.cs +++ b/Assets/Scripts/Util/EntityTypes.cs @@ -1,7 +1,10 @@ +using System; using System.Collections; using System.Collections.Generic; using UnityEngine; +using Newtonsoft.Json; + namespace HeavenStudio { public class EntityTypes @@ -33,5 +36,30 @@ namespace HeavenStudio this.max = max; } } + + // https://answers.unity.com/questions/772235/cannot-serialize-color.html + // i am crying + [System.Serializable] + public class SerializableColor + { + public float[] colorStore = new float[4] { 1F, 1F, 1F, 1F }; + public Color Color + { + get { return new Color(colorStore[0], colorStore[1], colorStore[2], colorStore[3]); } + set { colorStore = new float[4] { value.r, value.g, value.b, value.a }; } + } + + //makes this class usable as Color, Color normalColor = mySerializableColor; + public static implicit operator Color(SerializableColor instance) + { + return instance.Color; + } + + //makes this class assignable by Color, SerializableColor myColor = Color.white; + public static implicit operator SerializableColor(Color color) + { + return new SerializableColor { Color = color }; + } + } } } \ No newline at end of file