Add visuals while importing Score.ini files (#680)
This commit is contained in:
parent
35664808bf
commit
be18ecd036
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -8,7 +8,9 @@ namespace OpenTaiko {
|
||||
public static void ImportScoreInisToSavesDb3() {
|
||||
Trace.TraceInformation("Importing score.ini files to Saves.db3 database!");
|
||||
|
||||
Status = "Establishing connection to database...";
|
||||
//Status = "Establishing connection to database..."; // I don't think the player needs to know this info ¯\_(ツ)_/¯
|
||||
Status = CLangManager.LangInstance.GetString("SETTINGS_SYSTEM_IMPORTSCOREINI_STATUS1");
|
||||
|
||||
SqliteConnection? connection = DBSaves.GetSavesDBConnection();
|
||||
if (connection == null) {
|
||||
Trace.TraceError("Could not establish a connection to Saves.db3 database. Aborting score import.");
|
||||
@ -16,16 +18,23 @@ namespace OpenTaiko {
|
||||
return;
|
||||
}
|
||||
|
||||
Status = "Searching for scores...";
|
||||
List<string> _scoreFiles = new List<string>();
|
||||
foreach (string path in OpenTaiko.ConfigIni.strSongsPath.Split(';', StringSplitOptions.RemoveEmptyEntries)) {
|
||||
_scoreFiles.AddRange(Directory.GetFiles(path, "*.score.ini", SearchOption.AllDirectories));
|
||||
}
|
||||
Trace.TraceInformation($"{_scoreFiles.Count} score.ini files have been found. Beginning import.");
|
||||
|
||||
int importcount = 0;
|
||||
Status = "Importing scores...";
|
||||
int totalcount = 0;
|
||||
int successcount = 0;
|
||||
int skipcount = 0;
|
||||
int errorcount = 0;
|
||||
|
||||
foreach (string _score in _scoreFiles) {
|
||||
|
||||
Status = CLangManager.LangInstance.GetString("SETTINGS_SYSTEM_IMPORTSCOREINI_STATUS2", _scoreFiles.Count, successcount, totalcount, skipcount, errorcount, Path.GetFileName(_score));
|
||||
//Status = $"Importing {_scoreFiles.Count} scores...\n{importcount} of {totalcount} imported ({skipcount} skipped / {errorcount} failed)\n\n{Path.GetFileName(_score)}";
|
||||
|
||||
//Trace.TraceInformation(Status);
|
||||
try {
|
||||
string directory = Path.GetDirectoryName(_score);
|
||||
DirectoryInfo dir_parent = Directory.GetParent(directory);
|
||||
@ -187,6 +196,7 @@ namespace OpenTaiko {
|
||||
}
|
||||
}
|
||||
|
||||
bool success = false;
|
||||
for (int i = 0; i < Level.Length; i++) {
|
||||
int score_index = i < 5 ? i : 0;
|
||||
if (Level[i] != -1 && HighScore[score_index] > 0) {
|
||||
@ -224,15 +234,17 @@ namespace OpenTaiko {
|
||||
)
|
||||
ON CONFLICT(ChartUniqueId,ChartDifficulty,PlayMods) DO NOTHING
|
||||
";
|
||||
if (cmd.ExecuteNonQuery() > 0)
|
||||
importcount++;
|
||||
if (cmd.ExecuteNonQuery() > 0) { successcount++; success = true; }
|
||||
}
|
||||
}
|
||||
if (!success) { skipcount++; }
|
||||
} catch (Exception ex) {
|
||||
Trace.TraceWarning($"Failed to import {_score} into new database. More details:\n{ex}");
|
||||
errorcount++;
|
||||
}
|
||||
finally { totalcount++; }
|
||||
}
|
||||
Trace.TraceInformation($"Imported {importcount} of {_scoreFiles.Count} scores from score.ini files.");
|
||||
Trace.TraceInformation($"Imported {successcount} of {_scoreFiles.Count} scores from score.ini files. ({errorcount} failed imports; {skipcount} skipped imports;)");
|
||||
Status = "";
|
||||
}
|
||||
|
||||
|
@ -706,8 +706,8 @@ namespace OpenTaiko {
|
||||
OpenTaiko.stageSongSelect.actSongList.ResetSongIndex();
|
||||
} else if (this.list項目リスト[this.n現在の選択項目] == this.isSystemImportingScore) {
|
||||
// Running in a separate thread so the game doesn't freeze
|
||||
Thread thread = new Thread(CScoreIni_Importer.ImportScoreInisToSavesDb3);
|
||||
thread.Start();
|
||||
ScoreIniImportThread = new Thread(CScoreIni_Importer.ImportScoreInisToSavesDb3);
|
||||
ScoreIniImportThread.Start();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
@ -1681,6 +1681,16 @@ namespace OpenTaiko {
|
||||
private CItemBase isSystemImportingScore;
|
||||
//private CItemInteger iSystemMasterVolume; // #33700 2014.4.26 yyagi
|
||||
|
||||
public Thread ScoreIniImportThread { get; private set; }
|
||||
public bool ScoreIniImportThreadIsActive
|
||||
{
|
||||
get
|
||||
{
|
||||
if (ScoreIniImportThread == null) return false;
|
||||
return ScoreIniImportThread.IsAlive;
|
||||
}
|
||||
}
|
||||
|
||||
private int t前の項目(int nItem) {
|
||||
if (--nItem < 0) {
|
||||
nItem = this.list項目リスト.Count - 1;
|
||||
|
@ -377,6 +377,28 @@ namespace OpenTaiko {
|
||||
actCalibrationMode.Update();
|
||||
actCalibrationMode.Draw();
|
||||
}
|
||||
else if (actList.ScoreIniImportThreadIsActive) {
|
||||
if (OpenTaiko.Tx.Tile_Black != null) {
|
||||
OpenTaiko.Tx.Tile_Black.Opacity = 191;
|
||||
for (int i = 0; i <= SampleFramework.GameWindowSize.Width; i += OpenTaiko.Tx.Tile_Black.szTextureSize.Width) {
|
||||
for (int j = 0; j <= SampleFramework.GameWindowSize.Height; j += OpenTaiko.Tx.Tile_Black.szTextureSize.Height) {
|
||||
OpenTaiko.Tx.Tile_Black.t2D描画(i, j);
|
||||
}
|
||||
}
|
||||
OpenTaiko.Tx.Tile_Black.Opacity = 255;
|
||||
}
|
||||
using (var prvFont = HPrivateFastFont.tInstantiateMainFont(OpenTaiko.Skin.Config_Font_Scale)) {
|
||||
using (var status_text = new CTexture(prvFont.DrawText(
|
||||
CScoreIni_Importer.Status,
|
||||
Color.White,
|
||||
Color.Black,
|
||||
null,
|
||||
30,
|
||||
true))) {
|
||||
status_text.t2D_DisplayImage_AnchorCenter(SampleFramework.GameWindowSize.Width / 2, SampleFramework.GameWindowSize.Height / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 曲データの一覧取得中は、キー入力を無効化する
|
||||
else if (!OpenTaiko.EnumSongs.IsEnumerating || OpenTaiko.actEnumSongs.bコマンドでの曲データ取得 != true) {
|
||||
if (!OpenTaiko.Skin.bgmコンフィグ画面.bIsPlaying)
|
||||
|
Loading…
Reference in New Issue
Block a user