1
0
mirror of synced 2024-11-27 17:00:50 +01:00

Add visuals while importing Score.ini files (#680)

This commit is contained in:
DragonRatTiger / リュウコ 2024-09-28 02:56:00 -05:00 committed by GitHub
parent 35664808bf
commit be18ecd036
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 4225 additions and 4099 deletions

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

View File

@ -8,7 +8,9 @@ namespace OpenTaiko {
public static void ImportScoreInisToSavesDb3() { public static void ImportScoreInisToSavesDb3() {
Trace.TraceInformation("Importing score.ini files to Saves.db3 database!"); 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(); SqliteConnection? connection = DBSaves.GetSavesDBConnection();
if (connection == null) { if (connection == null) {
Trace.TraceError("Could not establish a connection to Saves.db3 database. Aborting score import."); Trace.TraceError("Could not establish a connection to Saves.db3 database. Aborting score import.");
@ -16,16 +18,23 @@ namespace OpenTaiko {
return; return;
} }
Status = "Searching for scores...";
List<string> _scoreFiles = new List<string>(); List<string> _scoreFiles = new List<string>();
foreach (string path in OpenTaiko.ConfigIni.strSongsPath.Split(';', StringSplitOptions.RemoveEmptyEntries)) { foreach (string path in OpenTaiko.ConfigIni.strSongsPath.Split(';', StringSplitOptions.RemoveEmptyEntries)) {
_scoreFiles.AddRange(Directory.GetFiles(path, "*.score.ini", SearchOption.AllDirectories)); _scoreFiles.AddRange(Directory.GetFiles(path, "*.score.ini", SearchOption.AllDirectories));
} }
Trace.TraceInformation($"{_scoreFiles.Count} score.ini files have been found. Beginning import."); Trace.TraceInformation($"{_scoreFiles.Count} score.ini files have been found. Beginning import.");
int importcount = 0; int totalcount = 0;
Status = "Importing scores..."; int successcount = 0;
int skipcount = 0;
int errorcount = 0;
foreach (string _score in _scoreFiles) { 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 { try {
string directory = Path.GetDirectoryName(_score); string directory = Path.GetDirectoryName(_score);
DirectoryInfo dir_parent = Directory.GetParent(directory); DirectoryInfo dir_parent = Directory.GetParent(directory);
@ -187,6 +196,7 @@ namespace OpenTaiko {
} }
} }
bool success = false;
for (int i = 0; i < Level.Length; i++) { for (int i = 0; i < Level.Length; i++) {
int score_index = i < 5 ? i : 0; int score_index = i < 5 ? i : 0;
if (Level[i] != -1 && HighScore[score_index] > 0) { if (Level[i] != -1 && HighScore[score_index] > 0) {
@ -224,15 +234,17 @@ namespace OpenTaiko {
) )
ON CONFLICT(ChartUniqueId,ChartDifficulty,PlayMods) DO NOTHING ON CONFLICT(ChartUniqueId,ChartDifficulty,PlayMods) DO NOTHING
"; ";
if (cmd.ExecuteNonQuery() > 0) if (cmd.ExecuteNonQuery() > 0) { successcount++; success = true; }
importcount++;
} }
} }
if (!success) { skipcount++; }
} catch (Exception ex) { } catch (Exception ex) {
Trace.TraceWarning($"Failed to import {_score} into new database. More details:\n{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 = ""; Status = "";
} }

View File

@ -706,8 +706,8 @@ namespace OpenTaiko {
OpenTaiko.stageSongSelect.actSongList.ResetSongIndex(); OpenTaiko.stageSongSelect.actSongList.ResetSongIndex();
} else if (this.list項目リスト[this.n現在の選択項目] == this.isSystemImportingScore) { } else if (this.list項目リスト[this.n現在の選択項目] == this.isSystemImportingScore) {
// Running in a separate thread so the game doesn't freeze // Running in a separate thread so the game doesn't freeze
Thread thread = new Thread(CScoreIni_Importer.ImportScoreInisToSavesDb3); ScoreIniImportThread = new Thread(CScoreIni_Importer.ImportScoreInisToSavesDb3);
thread.Start(); ScoreIniImportThread.Start();
} }
#endregion #endregion
} }
@ -1681,6 +1681,16 @@ namespace OpenTaiko {
private CItemBase isSystemImportingScore; private CItemBase isSystemImportingScore;
//private CItemInteger iSystemMasterVolume; // #33700 2014.4.26 yyagi //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) { private int t前の項目(int nItem) {
if (--nItem < 0) { if (--nItem < 0) {
nItem = this.list項目リスト.Count - 1; nItem = this.list項目リスト.Count - 1;

View File

@ -377,6 +377,28 @@ namespace OpenTaiko {
actCalibrationMode.Update(); actCalibrationMode.Update();
actCalibrationMode.Draw(); 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) { else if (!OpenTaiko.EnumSongs.IsEnumerating || OpenTaiko.actEnumSongs.bコマンドでの曲データ取得 != true) {
if (!OpenTaiko.Skin.bgmコンフィグ画面.bIsPlaying) if (!OpenTaiko.Skin.bgmコンフィグ画面.bIsPlaying)