From 5977e845f1228b1bc3cb55f4cc455d92b73fe195 Mon Sep 17 00:00:00 2001 From: 0aubsq <0aubsq@gmail.com> Date: Sat, 6 Nov 2021 19:21:22 +0100 Subject: [PATCH] Medals lol --- README.md | 3 +- TJAPlayer3/Common/NamePlateConfig.cs | 67 ++++++++++++++++--- TJAPlayer3/Stages/04.Config/CActConfigList.cs | 2 +- TJAPlayer3/Stages/05.SongSelect/CStage選曲.cs | 6 +- TJAPlayer3/Stages/08.Result/CStage結果.cs | 7 ++ 5 files changed, 72 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 8bb8f078..cac52daa 100644 --- a/README.md +++ b/README.md @@ -244,7 +244,8 @@ Pキーを長押ししてください。 ## 短期で実装する予定機能 ``` ☐ 道場結果画面を実装し切る -☐ コイン(ドンメダル)を貯蓄可能にする機能を実装+ドンメダル商店 +☑ コイン(ドンメダル)を貯蓄可能にする機能を実装 +☐ ドンメダル商店 ☑ タワーを実装し切る (COURSE: 5) ☐ タワー結果画面を実装し切る ☐ 複数な背景と踊り子セットを選べる機能を実装 diff --git a/TJAPlayer3/Common/NamePlateConfig.cs b/TJAPlayer3/Common/NamePlateConfig.cs index 4b5aabe0..16f1f8c0 100644 --- a/TJAPlayer3/Common/NamePlateConfig.cs +++ b/TJAPlayer3/Common/NamePlateConfig.cs @@ -13,25 +13,72 @@ namespace TJAPlayer3 public void tNamePlateConfig() { if (!File.Exists("NamePlate.json")) - ConfigManager.SaveConfig(data, "NamePlate.json"); - - data = ConfigManager.GetConfig(@"NamePlate.json"); - } + tSaveFile(); + tLoadFile(); + } + + #region [Medals] + + public void tEarnCoins(int[] amounts) + { + if (amounts.Length < 2) + return; + + for (int i = 0; i < 2; i++) + data.Medals[i] += amounts[i]; + + tSaveFile(); + } + + // Return false if the current amount of coins is to low + public bool tSpendCoins(int amount, int player) + { + if (player > 1 || player < 0) + return false; + + if (data.Medals[player] < amount) + return false; + + data.Medals[player] -= amount; + + tSaveFile(); + + return true; + } + + #endregion + public class Data { - public string[] Name = { "どんちゃん", "かっちゃん" }; - public string[] Title = { "どんちゃんですよ!", "かっちゃんですよ!" }; - public string[] Dan = { "達人", "達人" }; + public string[] Name = { "プレイヤー1", "プレイヤー2" }; + public string[] Title = { "初心者", "初心者" }; + public string[] Dan = { "素人", "素人" }; public bool[] DanGold = { false, false }; - public int[] DanType = { 1, 2 }; - public int[] TitleType = { 1, 2 }; + public int[] DanType = { 0, 0 }; + public int[] TitleType = { 1, 1 }; public int[] PuchiChara = { 2, 11 }; + + public int[] Medals = { 0, 0 }; } - public Data data = new Data(); + public Data data = new Data(); + + #region [private] + + private void tSaveFile() + { + ConfigManager.SaveConfig(data, "NamePlate.json"); + } + + private void tLoadFile() + { + data = ConfigManager.GetConfig(@"NamePlate.json"); + } + + #endregion } } diff --git a/TJAPlayer3/Stages/04.Config/CActConfigList.cs b/TJAPlayer3/Stages/04.Config/CActConfigList.cs index 8d63dbc2..75556834 100644 --- a/TJAPlayer3/Stages/04.Config/CActConfigList.cs +++ b/TJAPlayer3/Stages/04.Config/CActConfigList.cs @@ -510,7 +510,7 @@ namespace TJAPlayer3 " automatically." ); this.list項目リスト.Add( this.iTaikoAutoPlay ); - this.iTaikoAutoPlay2P = new CItemToggle( "AUTO PLAY 2P", TJAPlayer3.ConfigIni.b太鼓パートAutoPlay, + this.iTaikoAutoPlay2P = new CItemToggle( "AUTO PLAY 2P", TJAPlayer3.ConfigIni.b太鼓パートAutoPlay2P, "すべての音符を自動で演奏します。\n" + "", "To play both Taiko\n" + diff --git a/TJAPlayer3/Stages/05.SongSelect/CStage選曲.cs b/TJAPlayer3/Stages/05.SongSelect/CStage選曲.cs index 39bc481e..275666da 100644 --- a/TJAPlayer3/Stages/05.SongSelect/CStage選曲.cs +++ b/TJAPlayer3/Stages/05.SongSelect/CStage選曲.cs @@ -908,11 +908,15 @@ namespace TJAPlayer3 #endregion + // Current board for (int i = 0; i < 10; i++) { tBoardNumberDraw(this.ptBoardNumber[i].X - 10, this.ptBoardNumber[i].Y, i < 7 ? this.act曲リスト.ScoreRankCount[i].ToString() : this.act曲リスト.CrownCount[i - 7].ToString()); } + if (TJAPlayer3.NamePlateConfig.data.Medals[0] >= 0) + tBoardNumberDraw(this.ptBoardNumber[10].X - 10, this.ptBoardNumber[10].Y, TJAPlayer3.NamePlateConfig.data.Medals[0].ToString()); + if (act難易度選択画面.bOption[0]) actPlayOption.On進行描画(0); if (act難易度選択画面.bOption[1]) actPlayOption.On進行描画(1); @@ -1074,7 +1078,7 @@ namespace TJAPlayer3 } private Point[] ptBoardNumber = - { new Point(72, 283), new Point(135, 283), new Point(200, 283), new Point(72, 258), new Point(135, 258), new Point(200, 258), new Point(200, 233), new Point(72, 311), new Point(135, 311), new Point(200, 311) }; + { new Point(72, 283), new Point(135, 283), new Point(200, 283), new Point(72, 258), new Point(135, 258), new Point(200, 258), new Point(200, 233), new Point(72, 311), new Point(135, 311), new Point(200, 311), new Point(100, 360) }; public void tBoardNumberDraw(int x, int y, string str) { diff --git a/TJAPlayer3/Stages/08.Result/CStage結果.cs b/TJAPlayer3/Stages/08.Result/CStage結果.cs index b1485efe..d5458616 100644 --- a/TJAPlayer3/Stages/08.Result/CStage結果.cs +++ b/TJAPlayer3/Stages/08.Result/CStage結果.cs @@ -468,6 +468,13 @@ namespace TJAPlayer3 } } + if (TJAPlayer3.ConfigIni.b太鼓パートAutoPlay) + this.nEarnedMedalsCount[0] = 0; + if (TJAPlayer3.ConfigIni.b太鼓パートAutoPlay2P) + this.nEarnedMedalsCount[1] = 0; + + TJAPlayer3.NamePlateConfig.tEarnCoins(this.nEarnedMedalsCount); + #endregion base.On活性化();