This commit is contained in:
CroakFang
2023-02-14 05:05:42 +08:00
parent 92038d87ec
commit a7f4f8b326
5 changed files with 28 additions and 18 deletions
+2 -4
View File
@@ -36,8 +36,7 @@ public class Config
}
catch (Exception ex)
{
UmaViewerUI.Instance.MessagePannel.SetActive(true);
UmaViewerUI.Instance.MessageText.text = "Config load error. Using default. " + ex.Message;
UmaViewerUI.Instance.ShowMessage("Config load error. Using default. " + ex.Message);
MainPath = $@"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\Cygames\umamusume";
}
}
@@ -48,8 +47,7 @@ public class Config
public void UpdateConfig()
{
File.WriteAllText(configPath, JsonUtility.ToJson(this, true));
UmaViewerUI.Instance.MessagePannel.SetActive(true);
UmaViewerUI.Instance.MessageText.text = "The configuration has changed. Please restart the application.";
UmaViewerUI.Instance.ShowMessage("The configuration has changed. Please restart the application.");
}
}
+10 -2
View File
@@ -199,9 +199,17 @@ public class ManifestDB
}
callback?.Invoke($"Decompress master.mdb");
var masterPath = $"{Path.GetDirectoryName(DBPath)}/master/master.mdb";
var masterPath = $"{Path.GetDirectoryName(DBPath)}/master/master_umaviewer.mdb";
Directory.CreateDirectory(Path.GetDirectoryName(masterPath));
File.WriteAllBytes(masterPath, LZ4Util.DecompressFromFile(path));
try
{
File.WriteAllBytes(masterPath, LZ4Util.DecompressFromFile(path));
}
catch
{
callback?.Invoke($"Decompress master.mdb error");
yield break;
}
}
}
+1 -2
View File
@@ -30,8 +30,7 @@ public class UmaDatabaseEntry
var path = $"{Config.Instance.MainPath}\\dat\\{entry.Url.Substring(0, 2)}\\{entry.Url}";
UmaViewerDownload.DownloadAssetSync(entry, path , delegate(string msg)
{
UmaViewerUI.Instance.MessagePannel.SetActive(true);
UmaViewerUI.Instance.MessageText.text = msg;
UmaViewerUI.Instance.ShowMessage(msg);
});
}
@@ -60,13 +60,14 @@ public class UmaDatabaseController
if(Config.Instance.WorkMode == WorkMode.Standalone)
{
metaDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}\meta_umaviewer;");
masterDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}\master\master_umaviewer.mdb;");
}
else
{
metaDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}\meta;");
masterDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}\master\master.mdb;");
}
masterDb = new SqliteConnection($@"Data Source={Config.Instance.MainPath}\master\master.mdb;");
metaDb.Open();
MetaEntries = ReadMeta(metaDb);
@@ -77,21 +78,19 @@ public class UmaDatabaseController
LiveData = ReadAllLiveData(masterDb);
DressData = ReadAllDressData(masterDb);
}
catch
catch
{
UmaViewerUI.Instance.MessagePannel.SetActive(true);
UmaViewerUI.Instance.MessageText.text = $"Database not found at: {Config.Instance.MainPath}";
CloseAllConnection();
var msg = $"Database not found at: {Config.Instance.MainPath}";
if(Config.Instance.WorkMode == WorkMode.Standalone)
{
UmaViewerUI.Instance.MessageText.text += "\nPlease update the database in the settings panel";
msg += "\nPlease update the database in the settings panel";
}
else
{
UmaViewerUI.Instance.MessageText.text += "\nPlease install the dmm game client";
msg += "\nPlease install the dmm game client";
}
masterDb.Close();
metaDb.Close();
UmaViewerUI.Instance.ShowMessage(msg);
}
}
+7 -1
View File
@@ -1160,7 +1160,7 @@ public class UmaViewerUI : MonoBehaviour
if (UpdateResVerCoroutine != null&&Config.Instance.WorkMode != WorkMode.Standalone) return;
UmaDatabaseController.Instance.CloseAllConnection();
ManifestDB dB = new ManifestDB();
UpdateResVerCoroutine = dB.UpdateResourceVersion(delegate (string msg) { MessagePannel.SetActive(true); MessageText.text = msg; });
UpdateResVerCoroutine = dB.UpdateResourceVersion(delegate (string msg) { ShowMessage(msg); });
StartCoroutine(UpdateResVerCoroutine);
}
@@ -1191,4 +1191,10 @@ public class UmaViewerUI : MonoBehaviour
Shader.SetGlobalFloat("_GlobalOutlineWidth", val);
}
public void ShowMessage(string msg)
{
MessagePannel.SetActive(true);
MessageText.text = msg;
}
}