diff --git a/Assets/Scripts/BeatmapFormats.meta b/Assets/Scripts/BeatmapFormats.meta new file mode 100644 index 00000000..cca5334e --- /dev/null +++ b/Assets/Scripts/BeatmapFormats.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 06e6e979954795a49824e8435a5298fc +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Beatmap.cs b/Assets/Scripts/BeatmapFormats/Beatmap.cs similarity index 100% rename from Assets/Scripts/Beatmap.cs rename to Assets/Scripts/BeatmapFormats/Beatmap.cs diff --git a/Assets/Scripts/Beatmap.cs.meta b/Assets/Scripts/BeatmapFormats/Beatmap.cs.meta similarity index 83% rename from Assets/Scripts/Beatmap.cs.meta rename to Assets/Scripts/BeatmapFormats/Beatmap.cs.meta index 635d9c74..ba21c2d4 100644 --- a/Assets/Scripts/Beatmap.cs.meta +++ b/Assets/Scripts/BeatmapFormats/Beatmap.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 457977a51a5961a40b33da038cd88e9d +guid: 9ec74fe21af663f4d9645852eb4cfb88 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs b/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs new file mode 100644 index 00000000..1a772f04 --- /dev/null +++ b/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs @@ -0,0 +1,118 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using UnityEngine; + +using Newtonsoft.Json; + +using HeavenStudio.Util; + +namespace HeavenStudio +{ + [Serializable] + public class DynamicBeatmap + { + public float bpm; + + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)] + [DefaultValue(100)] public int musicVolume; // In percent (1-100) + + public Dictionary properties = + new Dictionary() { + {"remixtitle", "New Remix"}, + {"remixauthor", "Your Name"}, + }; + public List entities = new List(); + public List tempoChanges = new List(); + public List volumeChanges = new List(); + public float firstBeatOffset; + + [Serializable] + public class DynamicEntity : ICloneable + { + public float beat; + public int track; + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float length; + [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float swing; + public Dictionary DynamicData = new Dictionary(); + + public string datamodel; + [JsonIgnore] public Editor.Track.TimelineEventObj eventObj; + + public object Clone() + { + return this.MemberwiseClone(); + } + + public DynamicEntity DeepCopy() + { + //lol the AI generated this + return JsonConvert.DeserializeObject(JsonConvert.SerializeObject(this)); + } + + public object this[string propertyName] + { + get + { + return DynamicData[propertyName]; + } + set + { + if (DynamicData.ContainsKey(propertyName)) + { + DynamicData[propertyName] = value; + } + else + { + UnityEngine.Debug.LogError($"This entity does not have a property named {propertyName}! Attempted to insert value of type {value.GetType()}"); + } + } + } + } + + [Serializable] + public class TempoChange : ICloneable + { + public float beat; + public float length; + public float tempo; + + public object Clone() + { + return this.MemberwiseClone(); + } + } + + [Serializable] + public class VolumeChange : ICloneable + { + public float beat; + public float length; + public float volume; + + public object Clone() + { + return this.MemberwiseClone(); + } + } + + public object this[string propertyName] + { + get + { + return properties[propertyName]; + } + set + { + if (properties.ContainsKey(propertyName)) + { + properties[propertyName] = value; + } + else + { + UnityEngine.Debug.LogError($"This beatmap does not have a property named {propertyName}! Attempted to insert value of type {value.GetType()}"); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs.meta b/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs.meta new file mode 100644 index 00000000..d1fd7530 --- /dev/null +++ b/Assets/Scripts/BeatmapFormats/DynamicBeatmap.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ca2149f692fc3d84ba6526d33c132822 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: