Added New (CTRL+N) Button

Allows you to call GameManager.LoadRemix("") to initialize a blank remix at bpm 120. The New button (or CTRL+N) calls Editor.NewRemix();
This commit is contained in:
Carson Kompon 2022-02-25 22:41:32 -05:00
parent 37a2ed24c7
commit 027a6cddbe
3 changed files with 38 additions and 6 deletions

View file

@ -16383,7 +16383,19 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 1683100751}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_Calls:
- m_Target: {fileID: 1423699437}
m_TargetAssemblyTypeName: RhythmHeavenMania.Editor.Editor, Assembly-CSharp
m_MethodName: NewRemix
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &1683100751
MonoBehaviour:
m_ObjectHideFlags: 0

View file

@ -73,9 +73,7 @@ namespace RhythmHeavenMania
}
else
{
Beatmap = new Beatmap();
Beatmap.bpm = 120f;
Beatmap.firstBeatOffset = 0f;
NewRemix();
}
SortEventsList();
@ -106,11 +104,25 @@ namespace RhythmHeavenMania
}
}
public void LoadRemix(string json)
public void NewRemix()
{
Beatmap = new Beatmap();
Beatmap.bpm = 120f;
Beatmap.firstBeatOffset = 0f;
}
public void LoadRemix(string json = "")
{
SortEventsList();
Beatmap = JsonConvert.DeserializeObject<Beatmap>(json);
if (json != "")
{
Beatmap = JsonConvert.DeserializeObject<Beatmap>(json);
}
else
{
NewRemix();
}
Conductor.instance.SetBpm(Beatmap.bpm);
Conductor.instance.firstBeatOffset = Beatmap.firstBeatOffset;
Stop(0);

View file

@ -319,6 +319,14 @@ namespace RhythmHeavenMania.Editor
}
}
public void NewRemix()
{
GameManager.instance.LoadRemix("");
Timeline.instance.LoadRemix();
Timeline.instance.TempoInfo.UpdateStartingBPMText();
Timeline.instance.TempoInfo.UpdateOffsetText();
}
public void OpenRemix()
{
var extensions = new[]