mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-06-12 11:17:39 +02:00
Timekeeping Improvements and Small Optimizations (#544)
* make BeatActions coroutines instead of componentrs * pooled scheduled sounds implement S' entity seek * remove debug prints from last two changes * implement absolute time tracking implement DSP time resyncing * optimize GameManager * update TMPro * update IDE packages * fix dsp sync making the drift worse * fix issue with the JSL dll * relocate debug print * make scheduled pitch setter functional * any cpu
This commit is contained in:
@ -17,16 +17,16 @@ using System.IO;
|
||||
|
||||
namespace HeavenStudio
|
||||
{
|
||||
|
||||
|
||||
public class Minigames
|
||||
{
|
||||
|
||||
|
||||
public static void InitPreprocessor()
|
||||
{
|
||||
RiqBeatmap.OnUpdateBeatmap += PreProcessBeatmap;
|
||||
}
|
||||
|
||||
public static Dictionary<string, object> propertiesModel = new()
|
||||
public static Dictionary<string, object> propertiesModel = new()
|
||||
{
|
||||
// mapper set properties? (future: use this to flash the button)
|
||||
{"propertiesmodified", false},
|
||||
@ -165,7 +165,7 @@ namespace HeavenStudio
|
||||
Debug.Log($"k: {item.Key}, v: {item.Value}");
|
||||
if (item.Key == "track")
|
||||
continue;
|
||||
if (item.Value == null)
|
||||
if (item.Value == null)
|
||||
continue;
|
||||
var value = item.Value;
|
||||
if (value.GetType() == typeof(long))
|
||||
@ -271,7 +271,7 @@ namespace HeavenStudio
|
||||
|
||||
public class Minigame
|
||||
{
|
||||
|
||||
|
||||
public string name;
|
||||
public string displayName;
|
||||
public string color;
|
||||
@ -507,18 +507,19 @@ namespace HeavenStudio
|
||||
// overengineered af but it's a modified version of
|
||||
// https://stackoverflow.com/a/19877141
|
||||
static List<Func<EventCaller, Minigame>> loadRunners;
|
||||
static void BuildLoadRunnerList() {
|
||||
static void BuildLoadRunnerList()
|
||||
{
|
||||
loadRunners = System.Reflection.Assembly.GetExecutingAssembly()
|
||||
.GetTypes()
|
||||
.Where(x => x.Namespace == "HeavenStudio.Games.Loaders" && x.GetMethod("AddGame", BindingFlags.Public | BindingFlags.Static) != null)
|
||||
.Select(t => (Func<EventCaller, Minigame>) Delegate.CreateDelegate(
|
||||
typeof(Func<EventCaller, Minigame>),
|
||||
null,
|
||||
.Select(t => (Func<EventCaller, Minigame>)Delegate.CreateDelegate(
|
||||
typeof(Func<EventCaller, Minigame>),
|
||||
null,
|
||||
t.GetMethod("AddGame", BindingFlags.Public | BindingFlags.Static),
|
||||
false
|
||||
))
|
||||
.ToList();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void Init(EventCaller eventCaller)
|
||||
@ -527,8 +528,8 @@ namespace HeavenStudio
|
||||
{
|
||||
new Minigame("gameManager", "Game Manager", "", false, true, new List<GameAction>()
|
||||
{
|
||||
new GameAction("switchGame", "Switch Game", 0.5f, false,
|
||||
function: delegate { var e = eventCaller.currentEntity; GameManager.instance.SwitchGame(eventCaller.currentSwitchGame, eventCaller.currentEntity.beat, e["toggle"]); },
|
||||
new GameAction("switchGame", "Switch Game", 0.5f, false,
|
||||
function: delegate { var e = eventCaller.currentEntity; GameManager.instance.SwitchGame(eventCaller.currentSwitchGame, eventCaller.currentEntity.beat, e["toggle"]); },
|
||||
parameters: new List<Param>()
|
||||
{
|
||||
new Param("toggle", true, "Black Flash", "Enable or disable the black screen for this Game Switch")
|
||||
@ -536,8 +537,8 @@ namespace HeavenStudio
|
||||
inactiveFunction: delegate { var e = eventCaller.currentEntity; GameManager.instance.SwitchGame(eventCaller.currentSwitchGame, eventCaller.currentEntity.beat, e["toggle"]); }
|
||||
),
|
||||
new GameAction("end", "End Remix",
|
||||
function: delegate {
|
||||
Debug.Log("end");
|
||||
function: delegate {
|
||||
Debug.Log("end");
|
||||
if (Timeline.instance != null)
|
||||
Timeline.instance?.Stop(0);
|
||||
else
|
||||
@ -569,7 +570,7 @@ namespace HeavenStudio
|
||||
),
|
||||
|
||||
// These are still here for backwards-compatibility but are hidden in the editor
|
||||
new GameAction("flash", "", 1f, true,
|
||||
new GameAction("flash", "", 1f, true,
|
||||
new List<Param>()
|
||||
{
|
||||
new Param("colorA", Color.white, "Start Color"),
|
||||
@ -580,7 +581,7 @@ namespace HeavenStudio
|
||||
},
|
||||
hidden: true
|
||||
),
|
||||
new GameAction("move camera", "", 1f, true, new List<Param>()
|
||||
new GameAction("move camera", "", 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("valA", new EntityTypes.Float(-50, 50, 0), "Right / Left"),
|
||||
new Param("valB", new EntityTypes.Float(-50, 50, 0), "Up / Down"),
|
||||
@ -588,7 +589,7 @@ namespace HeavenStudio
|
||||
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type")
|
||||
},
|
||||
hidden: true ),
|
||||
new GameAction("rotate camera", "", 1f, true, new List<Param>()
|
||||
new GameAction("rotate camera", "", 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("valA", new EntityTypes.Integer(-360, 360, 0), "Pitch"),
|
||||
new Param("valB", new EntityTypes.Integer(-360, 360, 0), "Yaw"),
|
||||
@ -631,7 +632,7 @@ namespace HeavenStudio
|
||||
new GameAction("and", "And", 0.5f,
|
||||
function: delegate { SoundEffects.And(); }
|
||||
),
|
||||
new GameAction("go!", "Go!", 1f, false,
|
||||
new GameAction("go!", "Go!", 1f, false,
|
||||
new List<Param>()
|
||||
{
|
||||
new Param("toggle", false, "Alt", "Whether or not the alternate version should be played")
|
||||
@ -658,7 +659,7 @@ namespace HeavenStudio
|
||||
|
||||
new Minigame("vfx", "Visual Effects", "", false, true, new List<GameAction>()
|
||||
{
|
||||
new GameAction("flash", "Flash", 1f, true,
|
||||
new GameAction("flash", "Flash", 1f, true,
|
||||
new List<Param>()
|
||||
{
|
||||
new Param("colorA", Color.white, "Start Color"),
|
||||
@ -677,7 +678,7 @@ namespace HeavenStudio
|
||||
new Param("fadeout", new EntityTypes.Float(0, 100, 0), "Fade Out")
|
||||
}
|
||||
),
|
||||
new GameAction("move camera", "Move Camera", 1f, true, new List<Param>()
|
||||
new GameAction("move camera", "Move Camera", 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("valA", new EntityTypes.Float(-50, 50, 0), "Right / Left", "Next position on the X axis"),
|
||||
new Param("valB", new EntityTypes.Float(-50, 50, 0), "Up / Down", "Next position on the Y axis"),
|
||||
@ -686,14 +687,14 @@ namespace HeavenStudio
|
||||
new Param("axis", GameCamera.CameraAxis.All, "Axis", "The axis to move the camera on" )
|
||||
}
|
||||
),
|
||||
new GameAction("rotate camera", "Rotate Camera", 1f, true, new List<Param>()
|
||||
new GameAction("rotate camera", "Rotate Camera", 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("valA", new EntityTypes.Integer(-360, 360, 0), "Pitch", "Next rotation on the X axis"),
|
||||
new Param("valB", new EntityTypes.Integer(-360, 360, 0), "Yaw", "Next rotation on the Y axis"),
|
||||
new Param("valC", new EntityTypes.Integer(-360, 360, 0), "Roll", "Next rotation on the Z axis"),
|
||||
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"),
|
||||
new Param("axis", GameCamera.CameraAxis.All, "Axis", "The axis to move the camera on" )
|
||||
}
|
||||
}
|
||||
),
|
||||
new GameAction("camera background color", "Camera Background Color", 1, true, new List<Param>()
|
||||
{
|
||||
@ -702,7 +703,7 @@ namespace HeavenStudio
|
||||
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type")
|
||||
}
|
||||
),
|
||||
new GameAction("pan view", "Pan Viewport", 1f, true, new List<Param>()
|
||||
new GameAction("pan view", "Pan Viewport", 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("valA", new EntityTypes.Float(-50, 50, 0), "Right / Left", "Next position on the X axis"),
|
||||
new Param("valB", new EntityTypes.Float(-50, 50, 0), "Up / Down", "Next position on the Y axis"),
|
||||
@ -710,13 +711,13 @@ namespace HeavenStudio
|
||||
new Param("axis", StaticCamera.ViewAxis.All, "Axis", "The axis to pan the viewport in" )
|
||||
}
|
||||
),
|
||||
new GameAction("rotate view", "Rotate Viewport", 1f, true, new List<Param>()
|
||||
new GameAction("rotate view", "Rotate Viewport", 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("valA", new EntityTypes.Float(-360, 360, 0), "Rotation", "Next viewport rotation"),
|
||||
new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"),
|
||||
}
|
||||
),
|
||||
new GameAction("scale view", "Scale Viewport", 1f, true, new List<Param>()
|
||||
new GameAction("scale view", "Scale Viewport", 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("valA", new EntityTypes.Float(0, 50, 1), "Width", "Next viewport width"),
|
||||
new Param("valB", new EntityTypes.Float(0, 50, 1), "Height", "Next viewport height"),
|
||||
@ -733,7 +734,7 @@ namespace HeavenStudio
|
||||
}
|
||||
),
|
||||
|
||||
new GameAction("display textbox", "Display Textbox", 1f, true, new List<Param>()
|
||||
new GameAction("display textbox", "Display Textbox", 1f, true, new List<Param>()
|
||||
{
|
||||
new Param("text1", "", "Text", "The text to display in the textbox (Rich Text is supported!)"),
|
||||
new Param("type", Games.Global.Textbox.TextboxAnchor.TopMiddle, "Anchor", "Where to anchor the textbox"),
|
||||
@ -741,24 +742,24 @@ namespace HeavenStudio
|
||||
new Param("valB", new EntityTypes.Float(0.5f, 8, 1), "Textbox Height", "Textbox height multiplier")
|
||||
}
|
||||
),
|
||||
new GameAction("display open captions", "Display Open Captions", 1f, true,
|
||||
new List<Param>()
|
||||
new GameAction("display open captions", "Display Open Captions", 1f, true,
|
||||
new List<Param>()
|
||||
{
|
||||
new Param("text1", "", "Text", "The text to display in the captions (Rich Text is supported!)"),
|
||||
new Param("type", Games.Global.Textbox.TextboxAnchor.BottomMiddle, "Anchor", "Where to anchor the captions"),
|
||||
new Param("valA", new EntityTypes.Float(0.25f, 4, 1), "Captions Width", "Captions width multiplier"),
|
||||
new Param("valB", new EntityTypes.Float(0.5f, 8, 1), "Captions Height", "Captions height multiplier")
|
||||
}
|
||||
}
|
||||
),
|
||||
new GameAction("display closed captions", "Display Closed Captions", 1f, true,
|
||||
new List<Param>()
|
||||
new GameAction("display closed captions", "Display Closed Captions", 1f, true,
|
||||
new List<Param>()
|
||||
{
|
||||
new Param("text1", "", "Text", "The text to display in the captions (Rich Text is supported!)"),
|
||||
new Param("type", Games.Global.Textbox.ClosedCaptionsAnchor.Top, "Anchor", "Where to anchor the captions"),
|
||||
new Param("valA", new EntityTypes.Float(0.5f, 4, 1), "Captions Height", "Captions height multiplier")
|
||||
}
|
||||
),
|
||||
new GameAction("display song artist", "Display Song Info", 1f, true,
|
||||
new GameAction("display song artist", "Display Song Info", 1f, true,
|
||||
new List<Param>()
|
||||
{
|
||||
new Param("text1", "", "Title", "Text to display in the upper label (Rich Text is supported!)"),
|
||||
@ -769,7 +770,7 @@ namespace HeavenStudio
|
||||
};
|
||||
|
||||
BuildLoadRunnerList();
|
||||
foreach(var load in loadRunners)
|
||||
foreach (var load in loadRunners)
|
||||
{
|
||||
Debug.Log("Running game loader " + RuntimeReflectionExtensions.GetMethodInfo(load).DeclaringType.Name);
|
||||
eventCaller.minigames.Add(load(eventCaller));
|
||||
|
Reference in New Issue
Block a user