1
0
mirror of synced 2024-11-28 09:20:53 +01:00
OpenTaiko/TJAPlayer3/Songs/Cスコア.cs
DragonRatTiger 656d88efcd
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)
2022-10-10 19:29:58 +09:00

356 lines
9.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters.Binary;
using FDK;
using System.Drawing;
namespace TJAPlayer3
{
[Serializable]
internal class Cスコア
{
// プロパティ
public STScoreIni情報 ScoreIni情報;
[Serializable]
[StructLayout( LayoutKind.Sequential )]
public struct STScoreIni情報
{
public DateTime ;
public long ;
public STScoreIni情報( DateTime , long )
{
this. = ;
this. = ;
}
}
public STファイル情報 ;
[Serializable]
[StructLayout( LayoutKind.Sequential )]
public struct STファイル情報
{
public string ;
public string ;
public DateTime ;
public long ;
public STファイル情報( string , string , DateTime , long )
{
this. = ;
this. = ;
this. = ;
this. = ;
}
}
public ST譜面情報 ;
// Smaller version of ST譜面情報 to keep the main info for each player (High scores, clear status, score ranks
public STGamePlayInformations[] GPInfo = new STGamePlayInformations[2];
[Serializable]
[StructLayout(LayoutKind.Sequential)]
public struct STGamePlayInformations
{
public int[] nHighScore;
public int[] nClear; //0:未クリア 1:クリア 2:フルコンボ 3:ドンダフルコンボ
public int[] nScoreRank; //0:未取得 1:白粋 2:銅粋 3:銀粋 4:金雅 5:桃雅 6:紫雅 7:虹極
}
[Serializable]
[StructLayout( LayoutKind.Sequential )]
public struct ST譜面情報
{
public string ;
public string ;
public string ;
public string ;
public string Preimage;
public string Premovie;
public string Presound;
public string Backgound;
public STDGBVALUE<int> ;
public STRANK ;
public STSKILL ;
public STDGBVALUE<bool> ;
public STDGBVALUE<int> ;
public STHISTORY ;
public bool ;
public CDTX.E種別 ;
public double Bpm;
public int Duration;
public string strBGMファイル名;
public int SongVol;
public LoudnessMetadata? SongLoudnessMetadata;
public int nデモBGMオフセット;
public bool[] b譜面分岐;
public int ;
public int[] nハイスコア;
public string strサブタイトル;
public int[] nレベル;
public int[] nクリア; //0:未クリア 1:クリア 2:フルコンボ 3:ドンダフルコンボ
public int[] nスコアランク; //0:未取得 1:白粋 2:銅粋 3:銀粋 4:金雅 5:桃雅 6:紫雅 7:虹極
// Tower lifes
public int nLife;
public int nTotalFloor;
public int nTowerType;
public int nDanTick;
public Color cDanTickColor;
public List<int[]> nExamResult;
[Serializable]
[StructLayout( LayoutKind.Sequential )]
public struct STHISTORY
{
public string 1;
public string 2;
public string 3;
public string 4;
public string 5;
public string 6;
public string 7;
public string this[ int index ]
{
get
{
switch( index )
{
case 0:
return this.1;
case 1:
return this.2;
case 2:
return this.3;
case 3:
return this.4;
case 4:
return this.5;
case 5:
return this.6;
case 6:
return this.7;
}
throw new IndexOutOfRangeException();
}
set
{
switch( index )
{
case 0:
this.1 = value;
return;
case 1:
this.2 = value;
return;
case 2:
this.3 = value;
return;
case 3:
this.4 = value;
return;
case 4:
this.5 = value;
return;
case 5:
this.6 = value;
return;
case 6:
this.7 = value;
return;
}
throw new IndexOutOfRangeException();
}
}
}
[Serializable]
[StructLayout( LayoutKind.Sequential )]
public struct STRANK
{
public int Drums;
public int Guitar;
public int Bass;
public int this[ int index ]
{
get
{
switch( index )
{
case 0:
return this.Drums;
case 1:
return this.Guitar;
case 2:
return this.Bass;
}
throw new IndexOutOfRangeException();
}
set
{
if ( ( value < (int)CScoreIni.ERANK.SS ) || ( ( value != (int)CScoreIni.ERANK.UNKNOWN ) && ( value > (int)CScoreIni.ERANK.E ) ) )
{
throw new ArgumentOutOfRangeException();
}
switch( index )
{
case 0:
this.Drums = value;
return;
case 1:
this.Guitar = value;
return;
case 2:
this.Bass = value;
return;
}
throw new IndexOutOfRangeException();
}
}
}
[Serializable]
[StructLayout( LayoutKind.Sequential )]
public struct STSKILL
{
public double Drums;
public double Guitar;
public double Bass;
public double this[ int index ]
{
get
{
switch( index )
{
case 0:
return this.Drums;
case 1:
return this.Guitar;
case 2:
return this.Bass;
}
throw new IndexOutOfRangeException();
}
set
{
if( ( value < 0.0 ) || ( value > 100.0 ) )
{
throw new ArgumentOutOfRangeException();
}
switch( index )
{
case 0:
this.Drums = value;
return;
case 1:
this.Guitar = value;
return;
case 2:
this.Bass = value;
return;
}
throw new IndexOutOfRangeException();
}
}
}
}
public bool bSongDBにキャッシュがあった;
public bool bスコアが有効である
{
get
{
return ( ( ( this..[ 0 ] + this..[ 1 ] ) + this..[ 2 ] ) != 0 );
}
}
// コンストラクタ
public Cスコア()
{
this.ScoreIni情報 = new STScoreIni情報( DateTime.MinValue, 0L );
this.bSongDBにキャッシュがあった = false;
this. = new STファイル情報( "", "", DateTime.MinValue, 0L );
this. = new ST譜面情報();
this.. = "";
this.. = "";
this.. = "";
this.. = "";
this..Preimage = "";
this..Premovie = "";
this..Presound = "";
this..Backgound = "";
this.. = new STDGBVALUE<int>();
this.. = new ST譜面情報.STRANK();
this...Drums = (int)CScoreIni.ERANK.UNKNOWN;
this...Guitar = (int)CScoreIni.ERANK.UNKNOWN;
this...Bass = (int)CScoreIni.ERANK.UNKNOWN;
this.. = new STDGBVALUE<bool>();
this.. = new STDGBVALUE<int>();
this.. = new ST譜面情報.STHISTORY();
this...1 = "";
this...2 = "";
this...3 = "";
this...4 = "";
this...5 = "";
this...6 = "";
this...7 = "";
this.. = false;
this.. = new ST譜面情報.STSKILL();
this.. = CDTX.E種別.DTX;
this..Bpm = 120.0;
this..Duration = 0;
this..strBGMファイル名 = "";
this..SongVol = CSound.DefaultSongVol;
this..SongLoudnessMetadata = null;
this..nデモBGMオフセット = 0;
this..b譜面分岐 = new bool[(int)Difficulty.Total];
this.. = 0;
this..nハイスコア = new int[(int)Difficulty.Total];
this..strサブタイトル = "";
this..nレベル = new int[(int)Difficulty.Total] { -1, -1, -1, -1, -1, -1, -1};
this..nクリア = new int[5];
this..nスコアランク = new int[5];
for (int i = 0; i < 2; i++)
{
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;
}
}
}