mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-22 09:35:11 +00:00
Merge pull request #469 from minenice55/jukebox-update
Jukebox Package Update
This commit is contained in:
commit
6105bb4f64
6 changed files with 34 additions and 12 deletions
|
@ -55,7 +55,7 @@ namespace HeavenStudio
|
||||||
{
|
{
|
||||||
if (editorGO == null && OpeningManager.OnOpenFile.IndexOfAny(Path.GetInvalidPathChars()) == -1)
|
if (editorGO == null && OpeningManager.OnOpenFile.IndexOfAny(Path.GetInvalidPathChars()) == -1)
|
||||||
{
|
{
|
||||||
if (File.Exists(OpeningManager.OnOpenFile))
|
if (File.Exists(OpeningManager.OnOpenFile) && Path.GetExtension(OpeningManager.OnOpenFile) == ".riq")
|
||||||
{
|
{
|
||||||
input = OpeningManager.OnOpenFile;
|
input = OpeningManager.OnOpenFile;
|
||||||
fromCmd = true;
|
fromCmd = true;
|
||||||
|
|
|
@ -6,8 +6,7 @@ using UnityEngine;
|
||||||
|
|
||||||
using Starpelly;
|
using Starpelly;
|
||||||
using Jukebox;
|
using Jukebox;
|
||||||
using Jukebox.Legacy;
|
using HeavenStudio.Util;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using HeavenStudio.Games;
|
using HeavenStudio.Games;
|
||||||
using HeavenStudio.Common;
|
using HeavenStudio.Common;
|
||||||
|
|
||||||
|
@ -47,6 +46,9 @@ namespace HeavenStudio
|
||||||
[NonSerialized] public RiqEntity currentSection, nextSection;
|
[NonSerialized] public RiqEntity currentSection, nextSection;
|
||||||
public double sectionProgress { get; private set; }
|
public double sectionProgress { get; private set; }
|
||||||
|
|
||||||
|
bool AudioLoadDone;
|
||||||
|
bool ChartLoadError;
|
||||||
|
|
||||||
public event Action<double> onBeatChanged;
|
public event Action<double> onBeatChanged;
|
||||||
public event Action<RiqEntity> onSectionChange;
|
public event Action<RiqEntity> onSectionChange;
|
||||||
|
|
||||||
|
@ -105,6 +107,8 @@ namespace HeavenStudio
|
||||||
|
|
||||||
public void Init(bool preLoaded = false)
|
public void Init(bool preLoaded = false)
|
||||||
{
|
{
|
||||||
|
AudioLoadDone = false;
|
||||||
|
ChartLoadError = false;
|
||||||
currentPreEvent= 0;
|
currentPreEvent= 0;
|
||||||
currentPreSwitch = 0;
|
currentPreSwitch = 0;
|
||||||
currentPreSequence = 0;
|
currentPreSequence = 0;
|
||||||
|
@ -142,6 +146,7 @@ namespace HeavenStudio
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
RiqFileHandler.ClearCache();
|
||||||
NewRemix();
|
NewRemix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +169,8 @@ namespace HeavenStudio
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NewRemix()
|
public void NewRemix()
|
||||||
{
|
{
|
||||||
|
AudioLoadDone = false;
|
||||||
Beatmap = new("1", "HeavenStudio");
|
Beatmap = new("1", "HeavenStudio");
|
||||||
Beatmap.data.properties = Minigames.propertiesModel;
|
Beatmap.data.properties = Minigames.propertiesModel;
|
||||||
Beatmap.AddNewTempoChange(0, 120f);
|
Beatmap.AddNewTempoChange(0, 120f);
|
||||||
|
@ -172,10 +178,12 @@ namespace HeavenStudio
|
||||||
Beatmap.data.offset = 0f;
|
Beatmap.data.offset = 0f;
|
||||||
Conductor.instance.musicSource.clip = null;
|
Conductor.instance.musicSource.clip = null;
|
||||||
RiqFileHandler.WriteRiq(Beatmap);
|
RiqFileHandler.WriteRiq(Beatmap);
|
||||||
|
AudioLoadDone = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerator LoadMusic()
|
public IEnumerator LoadMusic()
|
||||||
{
|
{
|
||||||
|
ChartLoadError = false;
|
||||||
IEnumerator load = RiqFileHandler.LoadSong();
|
IEnumerator load = RiqFileHandler.LoadSong();
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
@ -192,20 +200,27 @@ namespace HeavenStudio
|
||||||
{
|
{
|
||||||
Debug.LogWarning("chart has no music: " + f.Message);
|
Debug.LogWarning("chart has no music: " + f.Message);
|
||||||
Conductor.instance.musicSource.clip = null;
|
Conductor.instance.musicSource.clip = null;
|
||||||
|
AudioLoadDone = true;
|
||||||
|
yield break;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.LogError($"Failed to load music: {e.Message}");
|
Debug.LogError($"Failed to load music: {e.Message}");
|
||||||
GlobalGameManager.ShowErrorMessage("Error Loading Music", e.Message + "\n\n" + e.StackTrace);
|
GlobalGameManager.ShowErrorMessage("Error Loading Music", e.Message + "\n\n" + e.StackTrace);
|
||||||
|
AudioLoadDone = true;
|
||||||
|
ChartLoadError = true;
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
yield return current;
|
yield return current;
|
||||||
}
|
}
|
||||||
Conductor.instance.musicSource.clip = RiqFileHandler.StreamedAudioClip;
|
Conductor.instance.musicSource.clip = RiqFileHandler.StreamedAudioClip;
|
||||||
|
AudioLoadDone = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadRemix(bool editor = false)
|
public void LoadRemix(bool editor = false)
|
||||||
{
|
{
|
||||||
|
AudioLoadDone = false;
|
||||||
|
ChartLoadError = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Beatmap = RiqFileHandler.ReadRiq();
|
Beatmap = RiqFileHandler.ReadRiq();
|
||||||
|
@ -214,6 +229,7 @@ namespace HeavenStudio
|
||||||
{
|
{
|
||||||
Debug.LogError($"Failed to load remix: {e.Message}");
|
Debug.LogError($"Failed to load remix: {e.Message}");
|
||||||
GlobalGameManager.ShowErrorMessage("Error Loading RIQ", e.Message + "\n\n" + e.StackTrace);
|
GlobalGameManager.ShowErrorMessage("Error Loading RIQ", e.Message + "\n\n" + e.StackTrace);
|
||||||
|
ChartLoadError = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!editor)
|
if (!editor)
|
||||||
|
@ -237,6 +253,15 @@ namespace HeavenStudio
|
||||||
{
|
{
|
||||||
SetGame("noGame");
|
SetGame("noGame");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (editor)
|
||||||
|
{
|
||||||
|
Debug.Log(Beatmap.data.riqOrigin);
|
||||||
|
if (Beatmap.data.riqOrigin != "HeavenStudio")
|
||||||
|
{
|
||||||
|
GlobalGameManager.ShowErrorMessage("Warning", "This chart was made for another game,\nand thus may not be playable in Heaven Studio.\n<color=\"yellow\">You may be able to edit this chart in Heaven Studio to be used in its original game.</color>\n\n<alpha=#AA>Chart Origin: " + Beatmap.data.riqOrigin.DisplayName());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ScoreInputAccuracy(double accuracy, bool late, double time, double weight = 1, bool doDisplay = true)
|
public void ScoreInputAccuracy(double accuracy, bool late, double time, double weight = 1, bool doDisplay = true)
|
||||||
|
@ -551,7 +576,7 @@ namespace HeavenStudio
|
||||||
// wait for first game to be loaded
|
// wait for first game to be loaded
|
||||||
yield return new WaitUntil(() => Beatmap != null && Beatmap.Entities.Count > 0);
|
yield return new WaitUntil(() => Beatmap != null && Beatmap.Entities.Count > 0);
|
||||||
//wait for audio clip to be loaded
|
//wait for audio clip to be loaded
|
||||||
yield return new WaitUntil(() => Conductor.instance.musicSource.clip != null);
|
yield return new WaitUntil(() => AudioLoadDone || (ChartLoadError && !GlobalGameManager.IsShowingDialog));
|
||||||
|
|
||||||
SkillStarManager.instance.KillStar();
|
SkillStarManager.instance.KillStar();
|
||||||
TimingAccuracyDisplay.instance.StopStarFlash();
|
TimingAccuracyDisplay.instance.StopStarFlash();
|
||||||
|
|
|
@ -386,9 +386,7 @@ namespace HeavenStudio.Editor
|
||||||
{
|
{
|
||||||
var extensions = new[]
|
var extensions = new[]
|
||||||
{
|
{
|
||||||
new ExtensionFilter("All Supported Files ", new string[] { "riq", "tengoku", "rhmania" }),
|
|
||||||
new ExtensionFilter("Heaven Studio Remix File ", new string[] { "riq" }),
|
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) =>
|
StandaloneFileBrowser.OpenFilePanelAsync("Open Remix", "", extensions, false, (string[] paths) =>
|
||||||
|
|
|
@ -170,15 +170,13 @@ namespace HeavenStudio
|
||||||
if (item.Key == "track")
|
if (item.Key == "track")
|
||||||
continue;
|
continue;
|
||||||
if (item.Value == null)
|
if (item.Value == null)
|
||||||
{
|
continue;
|
||||||
e[item.Key] = 0;
|
|
||||||
}
|
|
||||||
var value = item.Value;
|
var value = item.Value;
|
||||||
if (value.GetType() == typeof(long))
|
if (value.GetType() == typeof(long))
|
||||||
value = new EntityTypes.Integer(int.MinValue, int.MaxValue, (int)value);
|
value = new EntityTypes.Integer(int.MinValue, int.MaxValue, (int)value);
|
||||||
else if (value.GetType() == typeof(double))
|
else if (value.GetType() == typeof(double))
|
||||||
value = new EntityTypes.Float(float.NegativeInfinity, float.PositiveInfinity, (float)value);
|
value = new EntityTypes.Float(float.NegativeInfinity, float.PositiveInfinity, (float)value);
|
||||||
parameters.Add(new Minigames.Param(item.Key, value, item.Key, "[inferred from remix.json]"));
|
parameters.Add(new Minigames.Param(item.Key, value, item.Key.DisplayName(), "[inferred from remix.json]"));
|
||||||
}
|
}
|
||||||
action = new Minigames.GameAction(actionName, actionName.DisplayName(), e.length, true, parameters);
|
action = new Minigames.GameAction(actionName, actionName.DisplayName(), e.length, true, parameters);
|
||||||
game.actions.Add(action);
|
game.actions.Add(action);
|
||||||
|
|
|
@ -42,6 +42,7 @@ namespace HeavenStudio.Common
|
||||||
|
|
||||||
void Pause()
|
void Pause()
|
||||||
{
|
{
|
||||||
|
if (GlobalGameManager.IsShowingDialog) return;
|
||||||
if (!Conductor.instance.isPlaying) return;
|
if (!Conductor.instance.isPlaying) return;
|
||||||
Conductor.instance.Pause();
|
Conductor.instance.Pause();
|
||||||
pauseBeat = Conductor.instance.songPositionInBeatsAsDouble;
|
pauseBeat = Conductor.instance.songPositionInBeatsAsDouble;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"com.unity.nuget.newtonsoft-json": "3.2.1"
|
"com.unity.nuget.newtonsoft-json": "3.2.1"
|
||||||
},
|
},
|
||||||
"hash": "619442ba26163fb6a00dd50ba52e2fdeaea33e37"
|
"hash": "f1813255c1d322b6fe207de4361bbf288f9cda03"
|
||||||
},
|
},
|
||||||
"com.unity.2d.sprite": {
|
"com.unity.2d.sprite": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
|
Loading…
Reference in a new issue