1
0
mirror of synced 2024-11-28 09:20:53 +01:00

Saving & Loading Dan-i Dojo exam scores to ScoreIni (File only; No visuals) (#318)

* Localizing TJAs by parsing language-specific Title/Subtitle

Follows a similar style to Taiko Web's localized title/subtitle metadata by adding an abbreviation of the user's selected language to the TITLE and SUBTITLE command name.

* Using a more proper method for localizing title/subtitle

Hang on, that was a really bad method now that I looked at it.

Now has a readonly string instead of constantly concating strings.

* Saving Dan Dojo values to ScoreIni (W.I.P.; Global values bugged)

Dan Dojo scores are saved in `ExamResult#_#=#` format.

Global values currently return 0 regardless of what the user has scored. Currently looking into issue.

* Save & load Dan Dojo exam results (Global Exams fixed)
This commit is contained in:
DragonRatTiger 2022-10-10 06:29:58 -04:00 committed by GitHub
parent 3ffcf3f495
commit 656d88efcd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 96 additions and 5 deletions

View File

@ -218,6 +218,7 @@ namespace TJAPlayer3
public Dan_C[] Dan_C;
public int[] nクリア; //0:未クリア 1:クリア 2:フルコンボ 3:ドンダフルコンボ
public int[] nスコアランク; //0:未取得 1:白粋 2:銅粋 3:銀粋 4:金雅 5:桃雅 6:紫雅 7:虹極
public List<int[]> nExamResult; //
public C演奏記録()
{
@ -294,6 +295,11 @@ namespace TJAPlayer3
this.nクリア = new int[5];
this.nスコアランク = new int[5];
Dan_C = new Dan_C[CExamInfo.cMaxExam];
this.nExamResult = new List<int[]> { };
//for (int i = 0; i < TJAPlayer3.stage選曲.r確定された曲.DanSongs.Count; i++)
// {
// nExamResult.Add(new int[CExamInfo.cMaxExam]);
// }
}
public bool bフルコンボじゃない
@ -1179,6 +1185,31 @@ namespace TJAPlayer3
{
c演奏記録.nスコアランク[i] = int.Parse(para);
}
else
{
#region [Dan-i Dojo Exam Results]
if (item.StartsWith("ExamResult"))
{
int a = int.Parse(item.Substring(10, item.IndexOf('_') - 10));
int b = int.Parse(item.Substring(item.IndexOf('_') + 1));
try
{
c演奏記録.nExamResult[a][b] = int.Parse(para);
}
catch (ArgumentOutOfRangeException) // it's terrible but it works well lol
{
c演奏記録.nExamResult.Insert(a, new int[CExamInfo.cMaxExam]);
for (int c = 0; c < c演奏記録.nExamResult[a].Length; c++)
{
c演奏記録.nExamResult[a][c] = -1;
}
c演奏記録.nExamResult[a][b] = int.Parse(para);
}
}
#endregion
}
}
}
//else if ( item.Equals( "HiScore5" ) )
@ -1321,6 +1352,22 @@ namespace TJAPlayer3
writer.WriteLine("ScoreRank2={0}", this.stセクション[i].nスコアランク[2]);
writer.WriteLine("ScoreRank3={0}", this.stセクション[i].nスコアランク[3]);
writer.WriteLine("ScoreRank4={0}", this.stセクション[i].nスコアランク[4]);
// Dan Dojo exam results
for (int section = 0; section < stセクション[i].nExamResult.Count; ++section)
{
for (int part = 0; part < stセクション[i].nExamResult[section].Length; ++part)
{
try
{
if (stセクション[i].nExamResult[section][part] > -1)
writer.WriteLine("ExamResult{0}_{1}={2}", section, part, this.stセクション[i].nExamResult[section][part]);
}
catch (NullReferenceException)
{
}
}
}
}
writer.Close();
}

View File

@ -103,6 +103,8 @@ namespace TJAPlayer3
public int nDanTick;
public Color cDanTickColor;
public List<int[]> nExamResult;
[Serializable]
[StructLayout( LayoutKind.Sequential )]
public struct STHISTORY
@ -338,8 +340,13 @@ namespace TJAPlayer3
this.GPInfo[i].nHighScore = new int[(int)Difficulty.Total];
this.GPInfo[i].nClear = new int[5];
this.GPInfo[i].nScoreRank = new int[5];
}
}
this..nExamResult = new List<int[]> { };
//for (int i = 0; i < TJAPlayer3.stage選曲.r確定された曲.DanSongs.Count; i++)
//{
// 譜面情報.nExamResult.Add(new int[CExamInfo.cMaxExam]);
//}
this..nLife = 5;
this..nTotalFloor = 140;

View File

@ -57,10 +57,11 @@ namespace TJAPlayer3
for (int i = 1; i < CExamInfo.cMaxExam; i++)
ExamChange[i] = false;
for (int j = 1; j < CExamInfo.cMaxExam; j++) //段位条件のループ(魂ゲージを除く) 縦(y)
for (int j = 0; j < CExamInfo.cMaxExam; j++)
{
if (TJAPlayer3.stage選曲.r確定された曲.DanSongs[0].Dan_C[j] != null)
{
{
Challenge[j] = TJAPlayer3.stage選曲.r確定された曲.DanSongs[NowShowingNumber].Dan_C[j];
if (TJAPlayer3.stage選曲.r確定された曲.DanSongs[TJAPlayer3.stage選曲.r確定された曲.DanSongs.Count - 1].Dan_C[j] != null
&& TJAPlayer3.stage選曲.r確定された曲.DanSongs.Count > 1) // Individual exams, not counted if dan is only a single song
{
@ -73,7 +74,6 @@ namespace TJAPlayer3
TJAPlayer3.stage選曲.r確定された曲.DanSongs[NowShowingNumber].Dan_C[j].Amount = 0;
}
Challenge[j] = TJAPlayer3.stage選曲.r確定された曲.DanSongs[NowShowingNumber].Dan_C[j];
ExamChange[j] = true;
}
}

View File

@ -337,6 +337,43 @@ namespace TJAPlayer3
ini[0].stセクション[0].nクリア[0] = Math.Max(ini[0].stセクション[0].nクリア[0], clearValue);
ini[0].stセクション[0].nハイスコア[0] = Math.Max(ini[0].stセクション[0].nハイスコア[0], (int)TJAPlayer3.stage演奏ドラム画面.actScore.Get(E楽器パート.DRUMS, 0)); ;
#region [ Update Dan Dojo exam results ]
for (int i = 0; i < TJAPlayer3.stage選曲.r確定された曲.DanSongs.Count; i++)
{
if (ini[0].stセクション[0].nExamResult.Count < TJAPlayer3.stage選曲.r確定された曲.DanSongs.Count)
{
ini[0].stセクション[0].nExamResult.Add(new int[CExamInfo.cMaxExam]);
for (int h = 0; h < ini[0].stセクション[0].nExamResult.Last().Length; h++)
{
ini[0].stセクション[0].nExamResult.Last()[h] = -1;
}
}
for (int j = 0; j < TJAPlayer3.stage選曲.r確定された曲.DanSongs[i].Dan_C.Length; j++)
{
if (TJAPlayer3.stage選曲.r確定された曲.DanSongs[i].Dan_C[j] != null && TJAPlayer3.stage選曲.r確定された曲.DanSongs[i].Dan_C[j].GetEnable())
{
int amount = TJAPlayer3.stage選曲.r確定された曲.DanSongs[i].Dan_C[j].GetAmount();
int current = ini[0].stセクション[0].nExamResult[i][j];
if (ini[0].stセクション[0].nExamResult[i][j] == -1)
{
ini[0].stセクション[0].nExamResult[i][j] = amount;
}
else if (TJAPlayer3.stage選曲.r確定された曲.DanSongs[i].Dan_C[j].GetExamRange() == Exam.Range.More)
{
ini[0].stセクション[0].nExamResult[i][j] = (amount > current) ? amount : current;
}
else if (TJAPlayer3.stage選曲.r確定された曲.DanSongs[i].Dan_C[j].GetExamRange() == Exam.Range.Less)
{
ini[0].stセクション[0].nExamResult[i][j] = (amount < current) ? amount : current;
}
}
}
}
#endregion
if (TJAPlayer3.ConfigIni.bScoreIniを出力する)
ini[0].t書き出し(str[0]);
}