Blocks ruleset config if ruleset not found.
This commit is contained in:
Binary file not shown.
@@ -1,4 +1,5 @@
|
|||||||
using Newtonsoft.Json;
|
using JetBrains.Annotations;
|
||||||
|
using Newtonsoft.Json;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@@ -24,6 +25,11 @@ namespace Cryville.Crtr.Config {
|
|||||||
FileInfo file = new FileInfo(
|
FileInfo file = new FileInfo(
|
||||||
Game.GameDataPath + "/rulesets/" + Settings.Default.LoadRuleset
|
Game.GameDataPath + "/rulesets/" + Settings.Default.LoadRuleset
|
||||||
);
|
);
|
||||||
|
if (!file.Exists) {
|
||||||
|
Popup.Create("Ruleset for the chart not found\nMake sure you have imported the ruleset");
|
||||||
|
ReturnToMenu();
|
||||||
|
return;
|
||||||
|
}
|
||||||
DirectoryInfo dir = file.Directory;
|
DirectoryInfo dir = file.Directory;
|
||||||
using (StreamReader reader = new StreamReader(file.FullName, Encoding.UTF8)) {
|
using (StreamReader reader = new StreamReader(file.FullName, Encoding.UTF8)) {
|
||||||
ruleset = JsonConvert.DeserializeObject<Ruleset>(reader.ReadToEnd(), new JsonSerializerSettings() {
|
ruleset = JsonConvert.DeserializeObject<Ruleset>(reader.ReadToEnd(), new JsonSerializerSettings() {
|
||||||
@@ -62,7 +68,7 @@ namespace Cryville.Crtr.Config {
|
|||||||
cat.SetActive(true);
|
cat.SetActive(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReturnToMenu() {
|
public void SaveAndReturnToMenu() {
|
||||||
Game.InputManager.Deactivate();
|
Game.InputManager.Deactivate();
|
||||||
m_inputConfigPanel.proxy.SaveTo(_rscfg.inputs);
|
m_inputConfigPanel.proxy.SaveTo(_rscfg.inputs);
|
||||||
m_inputConfigPanel.proxy.Dispose();
|
m_inputConfigPanel.proxy.Dispose();
|
||||||
@@ -72,6 +78,9 @@ namespace Cryville.Crtr.Config {
|
|||||||
using (StreamWriter cfgwriter = new StreamWriter(cfgfile.FullName, false, Encoding.UTF8)) {
|
using (StreamWriter cfgwriter = new StreamWriter(cfgfile.FullName, false, Encoding.UTF8)) {
|
||||||
cfgwriter.Write(JsonConvert.SerializeObject(_rscfg, Game.GlobalJsonSerializerSettings));
|
cfgwriter.Write(JsonConvert.SerializeObject(_rscfg, Game.GlobalJsonSerializerSettings));
|
||||||
}
|
}
|
||||||
|
ReturnToMenu();
|
||||||
|
}
|
||||||
|
public void ReturnToMenu() {
|
||||||
GameObject.Find("Master").GetComponent<Master>().ShowMenu();
|
GameObject.Find("Master").GetComponent<Master>().ShowMenu();
|
||||||
#if UNITY_5_5_OR_NEWER
|
#if UNITY_5_5_OR_NEWER
|
||||||
SceneManager.UnloadSceneAsync("Config");
|
SceneManager.UnloadSceneAsync("Config");
|
||||||
|
Reference in New Issue
Block a user