From 400dd348c758f96c7a15d659295ce92fa8e0322e Mon Sep 17 00:00:00 2001 From: 0aubsq <0aubsq@gmail.com> Date: Tue, 26 Oct 2021 03:28:46 +0200 Subject: [PATCH] Main menu buttons are now displayed using text and translated in English/French (ModeSelect_Bar_Text.png files will be obsoleted as soon as menu details will be textified), fixed a small bug that reseted the lang setting while entering on the settings menu. --- Documentation/I18N/DictionnaryIndexes.md | 7 ++ TJAPlayer3/Common/CConfigIni.cs | 19 +++-- TJAPlayer3/Common/CPrivateFastFont.cs | 16 ++-- TJAPlayer3/Common/CPrivateFont.cs | 31 +++++++- TJAPlayer3/I18N/CLang_en.cs | 7 ++ TJAPlayer3/I18N/CLang_fr.cs | 7 ++ TJAPlayer3/I18N/CLang_jp.cs | 7 ++ TJAPlayer3/Stages/02.Title/CStageタイトル.cs | 78 +++++++++++++++++-- .../05.SongSelect/CActSelect曲リスト.cs | 9 ++- 9 files changed, 154 insertions(+), 27 deletions(-) diff --git a/Documentation/I18N/DictionnaryIndexes.md b/Documentation/I18N/DictionnaryIndexes.md index e79214aa..ef53a14b 100644 --- a/Documentation/I18N/DictionnaryIndexes.md +++ b/Documentation/I18N/DictionnaryIndexes.md @@ -21,4 +21,11 @@ 15 : Score 16 : "Layout type" option title 17 : "Layout type" description +18 : Ensou main menu button +19 : Dan main menu button +20 : Tower main menu button +21 : Shop main menu button +22 : Bouken main menu button +23 : Settings main menu button +24 : Quit main menu button ``` \ No newline at end of file diff --git a/TJAPlayer3/Common/CConfigIni.cs b/TJAPlayer3/Common/CConfigIni.cs index 819fa0d5..fbcef04e 100644 --- a/TJAPlayer3/Common/CConfigIni.cs +++ b/TJAPlayer3/Common/CConfigIni.cs @@ -737,9 +737,15 @@ namespace TJAPlayer3 public bool bAuto先生の連打; public bool b大音符判定; public int n両手判定の待ち時間; - public int nBranchAnime; - - public bool bJudgeCountDisplay; + public int nBranchAnime; + + // I18N choosen language + public string sLang; + + // Song select screen layout type + public int nLayoutType; + + public bool bJudgeCountDisplay; public bool bEnableCountdownTimer; @@ -875,11 +881,7 @@ namespace TJAPlayer3 public bool FastRender; // 事前画像描画モード public int MusicPreTimeMs; // 音源再生前の待機時間ms - // I18N choosen language - public string sLang = "jp"; - - // Song select screen layout type - public int nLayoutType = 0; + /// /// DiscordのRitch Presenceに再生中の.tjaファイルの情報を送信するかどうか。 @@ -2195,6 +2197,7 @@ namespace TJAPlayer3 else if( str3.Equals("Lang")) { + this.sLang = str4; CLangManager.langAttach(str4); } diff --git a/TJAPlayer3/Common/CPrivateFastFont.cs b/TJAPlayer3/Common/CPrivateFastFont.cs index 4d8edb67..20abe3ef 100644 --- a/TJAPlayer3/Common/CPrivateFastFont.cs +++ b/TJAPlayer3/Common/CPrivateFastFont.cs @@ -83,8 +83,8 @@ namespace TJAPlayer3 public new Bitmap DrawPrivateFont(string drawstr, Color fontColor, Color edgeColor, int edgePt) { return DrawPrivateFont_E(drawstr, DrawMode.Edge, fontColor, edgeColor, Color.White, Color.White, edgePt); - } - + } + /// /// 文字列を描画したテクスチャを返す /// @@ -92,11 +92,11 @@ namespace TJAPlayer3 /// 描画色 /// 縁取色 /// 描画済テクスチャ - public new Bitmap DrawPrivateFont(string drawstr, Color fontColor, Color edgeColor) + public new Bitmap DrawPrivateFont(string drawstr, Color fontColor, Color edgeColor, Color? secondBorder = null) { - return DrawPrivateFont(drawstr, DrawMode.Edge, fontColor, edgeColor, Color.White, Color.White); - } - + return DrawPrivateFont(drawstr, (secondBorder == null) ? DrawMode.Edge : (DrawMode.Edge | DrawMode.DoubleEdge), fontColor, edgeColor, Color.White, Color.White, secondBorder); + } + /// /// 文字列を描画したテクスチャを返す /// @@ -270,7 +270,7 @@ namespace TJAPlayer3 } } - protected new Bitmap DrawPrivateFont(string drawstr, DrawMode drawmode, Color fontColor, Color edgeColor, Color gradationTopColor, Color gradationBottomColor) + protected new Bitmap DrawPrivateFont(string drawstr, DrawMode drawmode, Color fontColor, Color edgeColor, Color gradationTopColor, Color gradationBottomColor, Color? secondBorder = null) { #region [ 以前レンダリングしたことのある文字列/フォントか? (キャッシュにヒットするか?) ] int index = listFontCache.FindIndex( @@ -293,7 +293,7 @@ namespace TJAPlayer3 // キャッシュにヒットせず。 #region [ レンダリングして、キャッシュに登録 ] FontCache fc = new FontCache(); - fc.bmp = base.DrawPrivateFont(drawstr, drawmode, fontColor, edgeColor, gradationTopColor, gradationBottomColor); + fc.bmp = base.DrawPrivateFont(drawstr, drawmode, fontColor, edgeColor, gradationTopColor, gradationBottomColor, secondBorder); fc.drawstr = drawstr; fc.drawmode = drawmode; fc.fontColor = fontColor; diff --git a/TJAPlayer3/Common/CPrivateFont.cs b/TJAPlayer3/Common/CPrivateFont.cs index c154eee3..0b05e388 100644 --- a/TJAPlayer3/Common/CPrivateFont.cs +++ b/TJAPlayer3/Common/CPrivateFont.cs @@ -174,7 +174,8 @@ namespace TJAPlayer3 Normal, Edge, Gradation, - Vertical + Vertical, + DoubleEdge } #region [ DrawPrivateFontのオーバーロード群 ] @@ -391,7 +392,7 @@ namespace TJAPlayer3 /// グラデーション 上側の色 /// グラデーション 下側の色 /// 描画済テクスチャ - protected Bitmap DrawPrivateFont(string drawstr, DrawMode drawmode, Color fontColor, Color edgeColor, Color gradationTopColor, Color gradationBottomColor) + protected Bitmap DrawPrivateFont(string drawstr, DrawMode drawmode, Color fontColor, Color edgeColor, Color gradationTopColor, Color gradationBottomColor, Color? secondBorder = null) { int Interval = 5; @@ -411,10 +412,22 @@ namespace TJAPlayer3 bool bEdge = ((drawmode & DrawMode.Edge) == DrawMode.Edge); bool bGradation = ((drawmode & DrawMode.Gradation) == DrawMode.Gradation); + bool bDoubleEdge = ((drawmode & DrawMode.DoubleEdge) == DrawMode.DoubleEdge); + // 縁取りの縁のサイズは、とりあえずフォントの大きさの1/4とする //int nEdgePt = (bEdge)? _pt / 4 : 0; //int nEdgePt = (bEdge) ? (_pt / 3) : 0; // 縁取りが少なすぎるという意見が多かったため変更。 (AioiLight) int nEdgePt = (bEdge) ? (10 * _pt / TJAPlayer3.Skin.Font_Edge_Ratio) : 0; //SkinConfigにて設定可能に(rhimm) + int nFatEdgePt = 0; + + if (bDoubleEdge) + { + nEdgePt = 4 * _pt / TJAPlayer3.Skin.Font_Edge_Ratio; + nFatEdgePt = 10 * _pt / TJAPlayer3.Skin.Font_Edge_Ratio; + } + + + int largest = Math.Max(nEdgePt, nFatEdgePt); // 描画サイズを測定する Size stringSize = System.Windows.Forms.TextRenderer.MeasureText(drawstr, this._font, new Size(int.MaxValue, int.MaxValue), @@ -425,7 +438,7 @@ namespace TJAPlayer3 stringSize.Height += 5; //取得した描画サイズを基に、描画先のbitmapを作成する - Bitmap bmp = new Bitmap(stringSize.Width + nEdgePt * 2, stringSize.Height + nEdgePt * 2); + Bitmap bmp = new Bitmap(stringSize.Width + nEdgePt * 2, stringSize.Height + largest * 2); bmp.MakeTransparent(); Graphics g = Graphics.FromImage(bmp); g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; @@ -436,7 +449,9 @@ namespace TJAPlayer3 sf.FormatFlags = StringFormatFlags.NoWrap; // どんなに長くて単語の区切りが良くても改行しない (AioiLight) sf.Trimming = StringTrimming.None; // どんなに長くてもトリミングしない (AioiLight) // レイアウト枠 - Rectangle r = new Rectangle(0, 0, stringSize.Width + nEdgePt * 2 + (TJAPlayer3.Skin.Text_Correction_X * stringSize.Width / 100), stringSize.Height + nEdgePt * 2 + (TJAPlayer3.Skin.Text_Correction_Y * stringSize.Height / 100)); + Rectangle r = new Rectangle(0, 0, stringSize.Width + largest * 2 + + (TJAPlayer3.Skin.Text_Correction_X * stringSize.Width / 100), stringSize.Height + largest * 2 + + (TJAPlayer3.Skin.Text_Correction_Y * stringSize.Height / 100)); if (bEdge) // 縁取り有りの描画 { @@ -447,7 +462,15 @@ namespace TJAPlayer3 System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath(); gp.AddString(drawstr, this._fontfamily, (int)this._font.Style, sizeInPixels, r, sf); + if (bDoubleEdge) + { + Pen fat = new Pen((Color)secondBorder, nFatEdgePt); + fat.LineJoin = System.Drawing.Drawing2D.LineJoin.Round; + g.DrawPath(fat, gp); + } + // 縁取りを描画する + // Edge drawn here Pen p = new Pen(edgeColor, nEdgePt); p.LineJoin = System.Drawing.Drawing2D.LineJoin.Round; g.DrawPath(p, gp); diff --git a/TJAPlayer3/I18N/CLang_en.cs b/TJAPlayer3/I18N/CLang_en.cs index 76e548dc..4926d3ec 100644 --- a/TJAPlayer3/I18N/CLang_en.cs +++ b/TJAPlayer3/I18N/CLang_en.cs @@ -48,6 +48,13 @@ namespace TJAPlayer3 "2 : Down to up diagonal\n" + "3 : Half-circle facing right\n" + "4 : Half-circle facing left", + [18] = "Rhythm Game", + [19] = "Exam Dojo", + [20] = "Taiko towers", + [21] = "Shop", + [22] = "Taiko adventure", + [23] = "Settings", + [24] = "Exit", }; } } \ No newline at end of file diff --git a/TJAPlayer3/I18N/CLang_fr.cs b/TJAPlayer3/I18N/CLang_fr.cs index c4821c97..c0f0ec1b 100644 --- a/TJAPlayer3/I18N/CLang_fr.cs +++ b/TJAPlayer3/I18N/CLang_fr.cs @@ -48,6 +48,13 @@ namespace TJAPlayer3 "2 : Diagonale bas-haut\n" + "3 : Demi-cercle orienté à droite\n" + "4 : Demi-cercle orienté à gauche", + [18] = "Partie rapide", + [19] = "Défis du Dojo", + [20] = "Tours rhytmiques", + [21] = "Magasin", + [22] = "Aventure", + [23] = "Paramètres", + [24] = "Quitter le jeu", }; } } \ No newline at end of file diff --git a/TJAPlayer3/I18N/CLang_jp.cs b/TJAPlayer3/I18N/CLang_jp.cs index 77e5aeb3..c7bb0226 100644 --- a/TJAPlayer3/I18N/CLang_jp.cs +++ b/TJAPlayer3/I18N/CLang_jp.cs @@ -48,6 +48,13 @@ namespace TJAPlayer3 "Q\n" + "RE\n" + "S", + [18] = "tQ[", + [19] = "iʓ", + [20] = "ۃ^[", + [21] = "_X", + [22] = "ۑ`", + [23] = "ݒ", + [24] = "Q[I", }; } } \ No newline at end of file diff --git a/TJAPlayer3/Stages/02.Title/CStageタイトル.cs b/TJAPlayer3/Stages/02.Title/CStageタイトル.cs index 05e7120d..24cf3509 100644 --- a/TJAPlayer3/Stages/02.Title/CStageタイトル.cs +++ b/TJAPlayer3/Stages/02.Title/CStageタイトル.cs @@ -6,6 +6,7 @@ using System.Diagnostics; using System.Drawing; using FDK; using System.Reflection; +using static TJAPlayer3.CActSelect曲リスト; namespace TJAPlayer3 { @@ -63,6 +64,9 @@ namespace TJAPlayer3 this.n現在の選択行プレイヤーエントリー = 1; + + + for (int i = 0; i < this.nbModes; i++) { this.stModeBar[i].BarTexture = TJAPlayer3.Tx.ModeSelect_Bar[i]; @@ -99,11 +103,36 @@ namespace TJAPlayer3 } public override void OnManagedリソースの作成() { - + if (base.b活性化してない) + return; + + if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName)) + { + this.pfMenuTitle = new CPrivateFastFont(new FontFamily(TJAPlayer3.ConfigIni.FontName), 36); + } + else + { + this.pfMenuTitle = new CPrivateFastFont(new FontFamily("MS UI Gothic"), 36); + } + + this.ttkEnsou = new TitleTextureKey(CLangManager.LangInstance.GetString(18), this.pfMenuTitle, Color.White, Color.FromArgb(233, 53, 71), 700, Color.Black); + this.ttkDan = new TitleTextureKey(CLangManager.LangInstance.GetString(19), this.pfMenuTitle, Color.White, Color.FromArgb(71, 64, 135), 700, Color.Black); + this.ttkTower = new TitleTextureKey(CLangManager.LangInstance.GetString(20), this.pfMenuTitle, Color.White, Color.FromArgb(255, 180, 42), 700, Color.Black); + this.ttkShop = new TitleTextureKey(CLangManager.LangInstance.GetString(21), this.pfMenuTitle, Color.White, Color.FromArgb(16, 255, 255), 700, Color.Black); + this.ttkBouken = new TitleTextureKey(CLangManager.LangInstance.GetString(22), this.pfMenuTitle, Color.White, Color.FromArgb(128, 0, 128), 700, Color.Black); + this.ttkSettings = new TitleTextureKey(CLangManager.LangInstance.GetString(23), this.pfMenuTitle, Color.White, Color.FromArgb(128, 128, 128), 700, Color.Black); + this.ttkExit = new TitleTextureKey(CLangManager.LangInstance.GetString(24), this.pfMenuTitle, Color.White, Color.FromArgb(72, 72, 72), 700, Color.Black); + + base.OnManagedリソースの作成(); } public override void OnManagedリソースの解放() { + if (!base.b活性化してない) + return; + TJAPlayer3.t安全にDisposeする(ref pfMenuTitle); + + base.OnManagedリソースの解放(); } public override int On進行描画() { @@ -578,12 +607,17 @@ namespace TJAPlayer3 TJAPlayer3.Tx.ModeSelect_Bar_Chara[i].t2D中心基準描画(TJAPlayer3.app.Device, 640 + TJAPlayer3.Tx.ModeSelect_Bar_Chara[i].szテクスチャサイズ.Width / 4 - 114 + anime, 360, new Rectangle(TJAPlayer3.Tx.ModeSelect_Bar_Chara[i].szテクスチャサイズ.Width / 2, 0, TJAPlayer3.Tx.ModeSelect_Bar_Chara[i].szテクスチャサイズ.Width / 2, TJAPlayer3.Tx.ModeSelect_Bar_Chara[i].szテクスチャサイズ.Height)); - TJAPlayer3.Tx.ModeSelect_Bar_Text[i].Opacity = 255; - TJAPlayer3.Tx.ModeSelect_Bar_Text[i]?.t2D中心基準描画(TJAPlayer3.app.Device, 640, 355 - BarAnimeCount / 1.5f, new Rectangle(0, 0, 642, 122)); + // TJAPlayer3.Tx.ModeSelect_Bar_Text[i].Opacity = 255; + // TJAPlayer3.Tx.ModeSelect_Bar_Text[i]?.t2D中心基準描画(TJAPlayer3.app.Device, 640, 355 - BarAnimeCount / 1.5f, new Rectangle(0, 0, 642, 122)); + + TJAPlayer3.stage選曲.act曲リスト.ResolveTitleTexture(idxToTex(i))?.t2D中心基準描画(TJAPlayer3.app.Device, 631, 379 - BarAnimeCount / 1.5f); + TJAPlayer3.Tx.ModeSelect_Bar_Text[i].Opacity = (int)(BarAnimeCount * 2.55f); TJAPlayer3.Tx.ModeSelect_Bar_Text[i]?.t2D中心基準描画(TJAPlayer3.app.Device, 640, 355 + 132 / 2, new Rectangle(0, 122, 642, 148)); + + } else { @@ -615,8 +649,11 @@ namespace TJAPlayer3 TJAPlayer3.Tx.ModeSelect_Bar[this.nbModes].vc拡大縮小倍率.Y = 1.0f; this.stModeBar[i].BarTexture.t2D描画(TJAPlayer3.app.Device, pos.X + BarAnimeX - BarMoveX, pos.Y + BarAnimeY - BarMoveY); TJAPlayer3.Tx.ModeSelect_Bar[this.nbModes].t2D描画(TJAPlayer3.app.Device, pos.X + BarAnimeX - BarMoveX, pos.Y + BarAnimeY - BarMoveY); - TJAPlayer3.Tx.ModeSelect_Bar_Text[i].Opacity = 255; - TJAPlayer3.Tx.ModeSelect_Bar_Text[i]?.t2D描画(TJAPlayer3.app.Device, pos.X + BarAnimeX - BarMoveX, pos.Y + BarAnimeY - BarMoveY - 13, new Rectangle(0, 0, 642, 122)); + + // TJAPlayer3.Tx.ModeSelect_Bar_Text[i].Opacity = 255; + // TJAPlayer3.Tx.ModeSelect_Bar_Text[i]?.t2D描画(TJAPlayer3.app.Device, pos.X + BarAnimeX - BarMoveX, pos.Y + BarAnimeY - BarMoveY - 13, new Rectangle(0, 0, 642, 122)); + + TJAPlayer3.stage選曲.act曲リスト.ResolveTitleTexture(idxToTex(i))?.t2D中心基準描画(TJAPlayer3.app.Device, pos.X + BarAnimeX - BarMoveX + 311, pos.Y + BarAnimeY - BarMoveY + 72); } } } @@ -734,6 +771,15 @@ namespace TJAPlayer3 private PuchiChara PuchiChara; + private CPrivateFastFont pfMenuTitle; + private TitleTextureKey ttkEnsou; + private TitleTextureKey ttkDan; + private TitleTextureKey ttkTower; + private TitleTextureKey ttkShop; + private TitleTextureKey ttkBouken; + private TitleTextureKey ttkSettings; + private TitleTextureKey ttkExit; + private bool bバナパス読み込み; private bool bバナパス読み込み失敗; private bool bプレイヤーエントリー; @@ -785,6 +831,28 @@ namespace TJAPlayer3 return new Point(posX, posY); } + private TitleTextureKey idxToTex(int idx) + { + switch (idx) + { + case 6: + return this.ttkExit; + case 5: + return this.ttkSettings; + case 4: + return this.ttkBouken; + case 3: + return this.ttkShop; + case 2: + return this.ttkTower; + case 1: + return this.ttkDan; + case 0: + default: + return this.ttkEnsou; + } + } + private bool b音声再生; private CActFIFOBlack actFI; private CActFIFOBlack actFIfromSetup; diff --git a/TJAPlayer3/Stages/05.SongSelect/CActSelect曲リスト.cs b/TJAPlayer3/Stages/05.SongSelect/CActSelect曲リスト.cs index 8b4a4a28..86777c13 100644 --- a/TJAPlayer3/Stages/05.SongSelect/CActSelect曲リスト.cs +++ b/TJAPlayer3/Stages/05.SongSelect/CActSelect曲リスト.cs @@ -2341,7 +2341,7 @@ namespace TJAPlayer3 private static CTexture GenerateTitleTexture(TitleTextureKey titleTextureKey) { using (var bmp = new Bitmap(titleTextureKey.cPrivateFastFont.DrawPrivateFont( - titleTextureKey.str文字, titleTextureKey.forecolor, titleTextureKey.backcolor))) + titleTextureKey.str文字, titleTextureKey.forecolor, titleTextureKey.backcolor, titleTextureKey.secondEdge))) { CTexture tx文字テクスチャ = TJAPlayer3.tテクスチャの生成(bmp, false); if (tx文字テクスチャ.szテクスチャサイズ.Width > titleTextureKey.maxWidth) @@ -2371,14 +2371,16 @@ namespace TJAPlayer3 public readonly Color forecolor; public readonly Color backcolor; public readonly int maxWidth; + public readonly Color? secondEdge; - public TitleTextureKey(string str文字, CPrivateFastFont cPrivateFastFont, Color forecolor, Color backcolor, int maxHeight) + public TitleTextureKey(string str文字, CPrivateFastFont cPrivateFastFont, Color forecolor, Color backcolor, int maxHeight, Color? secondEdge = null) { this.str文字 = str文字; this.cPrivateFastFont = cPrivateFastFont; this.forecolor = forecolor; this.backcolor = backcolor; this.maxWidth = maxHeight; + this.secondEdge = secondEdge; } private bool Equals(TitleTextureKey other) @@ -2387,6 +2389,7 @@ namespace TJAPlayer3 cPrivateFastFont.Equals(other.cPrivateFastFont) && forecolor.Equals(other.forecolor) && backcolor.Equals(other.backcolor) && + secondEdge.Equals(other.secondEdge) && maxWidth == other.maxWidth; } @@ -2406,6 +2409,8 @@ namespace TJAPlayer3 hashCode = (hashCode * 397) ^ forecolor.GetHashCode(); hashCode = (hashCode * 397) ^ backcolor.GetHashCode(); hashCode = (hashCode * 397) ^ maxWidth; + if (secondEdge != null) + hashCode = (hashCode * 397) ^ secondEdge.GetHashCode(); return hashCode; } }