2021-12-23 00:08:35 +00:00
|
|
|
using System;
|
2021-12-22 00:42:01 +00:00
|
|
|
using System.Collections.Generic;
|
2022-03-19 12:46:38 +00:00
|
|
|
using System.ComponentModel;
|
2022-02-08 01:07:03 +00:00
|
|
|
using UnityEngine;
|
|
|
|
|
2022-01-15 22:52:53 +00:00
|
|
|
using Newtonsoft.Json;
|
2021-12-22 00:42:01 +00:00
|
|
|
|
2022-03-14 14:21:05 +00:00
|
|
|
using HeavenStudio.Util;
|
2022-02-04 22:16:22 +00:00
|
|
|
|
2022-03-14 14:21:05 +00:00
|
|
|
namespace HeavenStudio
|
2021-12-22 00:42:01 +00:00
|
|
|
{
|
2021-12-23 00:08:35 +00:00
|
|
|
[Serializable]
|
|
|
|
public class Beatmap
|
2021-12-22 00:42:01 +00:00
|
|
|
{
|
2021-12-23 02:28:05 +00:00
|
|
|
public float bpm;
|
2022-03-19 12:46:38 +00:00
|
|
|
|
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
|
|
|
|
[DefaultValue(100)]
|
|
|
|
public int musicVolume; // In percent (1-100)
|
|
|
|
|
2022-01-08 16:42:48 +00:00
|
|
|
public List<Entity> entities = new List<Entity>();
|
2022-01-28 02:50:57 +00:00
|
|
|
public List<TempoChange> tempoChanges = new List<TempoChange>();
|
2022-07-04 14:28:40 +00:00
|
|
|
public List<VolumeChange> volumeChanges = new List<VolumeChange>();
|
2022-02-24 14:02:21 +00:00
|
|
|
public float firstBeatOffset;
|
2021-12-22 00:42:01 +00:00
|
|
|
|
2021-12-23 00:08:35 +00:00
|
|
|
[Serializable]
|
|
|
|
public class Entity : ICloneable
|
|
|
|
{
|
|
|
|
public float beat;
|
|
|
|
public int track;
|
2022-03-11 18:20:24 +00:00
|
|
|
|
|
|
|
// consideration: use arrays instead of hardcoding fixed parameter names
|
2022-08-12 03:39:30 +00:00
|
|
|
// note from zeo: yeah definately use arrays
|
2022-01-15 22:52:53 +00:00
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float length;
|
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valA;
|
2022-02-08 01:07:03 +00:00
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valB;
|
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float valC;
|
2022-03-01 07:27:49 +00:00
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public bool toggle;
|
2022-01-15 22:52:53 +00:00
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type;
|
2022-02-27 17:02:46 +00:00
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type2;
|
2022-03-11 18:20:24 +00:00
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type3;
|
2022-08-12 03:39:30 +00:00
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type4;
|
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type5;
|
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public int type6;
|
2022-02-04 22:16:22 +00:00
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public EasingFunction.Ease ease;
|
2022-02-08 01:07:03 +00:00
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorA;
|
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorB;
|
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorC;
|
2022-07-10 02:42:28 +00:00
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorD;
|
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorE;
|
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public Color colorF;
|
2022-06-04 03:15:05 +00:00
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public string text1;
|
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public string text2;
|
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public string text3;
|
2022-02-24 14:12:19 +00:00
|
|
|
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)] public float swing;
|
2021-12-23 00:08:35 +00:00
|
|
|
public string datamodel;
|
2022-01-28 02:50:57 +00:00
|
|
|
[JsonIgnore] public Editor.Track.TimelineEventObj eventObj;
|
|
|
|
|
|
|
|
public object Clone()
|
|
|
|
{
|
|
|
|
return this.MemberwiseClone();
|
|
|
|
}
|
2022-02-03 22:20:26 +00:00
|
|
|
|
2022-07-04 17:09:23 +00:00
|
|
|
public Entity DeepCopy()
|
|
|
|
{
|
|
|
|
//lol the AI generated this
|
|
|
|
return JsonConvert.DeserializeObject<Entity>(JsonConvert.SerializeObject(this));
|
|
|
|
}
|
|
|
|
|
2022-02-03 22:20:26 +00:00
|
|
|
public object this[string propertyName]
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return typeof(Entity).GetField(propertyName).GetValue(this);
|
|
|
|
}
|
|
|
|
set
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
typeof(Entity).GetField(propertyName).SetValue(this, value);
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
2022-07-28 05:17:02 +00:00
|
|
|
UnityEngine.Debug.LogError($"You probably misspelled a parameter, or defined the object type wrong. Exception log: {ex}");
|
2022-02-03 22:20:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-01-28 02:50:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
public class TempoChange : ICloneable
|
|
|
|
{
|
|
|
|
public float beat;
|
|
|
|
public float length;
|
|
|
|
public float tempo;
|
2021-12-23 00:08:35 +00:00
|
|
|
|
|
|
|
public object Clone()
|
|
|
|
{
|
|
|
|
return this.MemberwiseClone();
|
|
|
|
}
|
|
|
|
}
|
2022-07-04 14:28:40 +00:00
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
public class VolumeChange : ICloneable
|
|
|
|
{
|
|
|
|
public float beat;
|
|
|
|
public float length;
|
|
|
|
public float volume;
|
|
|
|
|
|
|
|
public object Clone()
|
|
|
|
{
|
|
|
|
return this.MemberwiseClone();
|
|
|
|
}
|
|
|
|
}
|
2021-12-22 00:42:01 +00:00
|
|
|
}
|
2021-12-23 00:08:35 +00:00
|
|
|
}
|