diff --git a/TJAPlayer3/Common/Modal.cs b/TJAPlayer3/Common/Modal.cs index 5dc916a4..67465a4c 100644 --- a/TJAPlayer3/Common/Modal.cs +++ b/TJAPlayer3/Common/Modal.cs @@ -10,18 +10,15 @@ namespace TJAPlayer3 { internal class Modal { - public Modal(EModalType mt, int ra, int re, EModalFormat mf, int p = 0) + public Modal(EModalType mt, int ra, int re) { modalType = mt; - modalFormat = mf; rarity = ra; reference = re; - player = p; - - tSetupModal(); + _isSet = false; } - private void tSetupModal() + public void tSetupModal() { CTexture[] arrRef; @@ -47,13 +44,16 @@ namespace TJAPlayer3 ? 1280 : 640, 720); + + _isSet = true; } public void tDisplayModal() { - - - _box?.t2D描画(TJAPlayer3.app.Device, 0, 0, _boxRect); + if (_isSet == true) + { + _box?.t2D描画(TJAPlayer3.app.Device, 640 * player, 0, _boxRect); + } } public enum EModalType @@ -84,5 +84,7 @@ namespace TJAPlayer3 private CTexture _box; private Rectangle _boxRect; + + private bool _isSet; } } diff --git a/TJAPlayer3/Common/ModalQueue.cs b/TJAPlayer3/Common/ModalQueue.cs new file mode 100644 index 00000000..ec311900 --- /dev/null +++ b/TJAPlayer3/Common/ModalQueue.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TJAPlayer3 +{ + internal class ModalQueue + { + public ModalQueue(Modal.EModalFormat mf) + { + _modalQueues = new Queue[] { new Queue(), new Queue() }; + _modalFormat = mf; + } + + // Add two modals (one per player) at the same time + public void tAddModal(Modal mp1, Modal mp2) + { + mp1.modalFormat = _modalFormat; + mp2.modalFormat = _modalFormat; + mp1.player = 0; + mp2.player = 1; + mp1.tSetupModal(); + mp2.tSetupModal(); + + if (mp1 != null) + _modalQueues[0].Enqueue(mp1); + if (mp2 != null) + _modalQueues[1].Enqueue(mp2); + } + + // Add a single modal + public void tAddModal(Modal mp, int player) + { + mp.modalFormat = _modalFormat; + mp.player = player; + mp.tSetupModal(); + + if (mp != null && player >= 0 && player < TJAPlayer3.ConfigIni.nPlayerCount) + _modalQueues[player].Enqueue(mp); + } + + public Modal tPopModal(int player) + { + if (!tIsQueueEmpty(player)) + return _modalQueues[player].Dequeue(); + return null; + } + + public bool tIsQueueEmpty(int player) + { + if (player < 0 || player >= TJAPlayer3.ConfigIni.nPlayerCount) + return true; + + return _modalQueues[player].Count < 1; + } + + public bool tAreBothQueuesEmpty() + { + return tIsQueueEmpty(0) && tIsQueueEmpty(1); + } + + private Modal.EModalFormat _modalFormat; + private Queue[] _modalQueues; + } +} diff --git a/TJAPlayer3/Stages/08.Result/CStage結果.cs b/TJAPlayer3/Stages/08.Result/CStage結果.cs index 1f1b16e5..b8b27df4 100644 --- a/TJAPlayer3/Stages/08.Result/CStage結果.cs +++ b/TJAPlayer3/Stages/08.Result/CStage結果.cs @@ -647,6 +647,25 @@ namespace TJAPlayer3 TJAPlayer3.NamePlateConfig.tEarnCoins(this.nEarnedMedalsCount); + #endregion + + #region [Modals preprocessing] + + mqModals = new ModalQueue((TJAPlayer3.ConfigIni.nPlayerCount > 1) ? Modal.EModalFormat.Half : Modal.EModalFormat.Full); + + for (int i = 0; i < TJAPlayer3.ConfigIni.nPlayerCount; i++) + { + if (this.nEarnedMedalsCount[i] > 0) + mqModals.tAddModal( + new Modal( + Modal.EModalType.Coin, + 0, + this.nEarnedMedalsCount[i]), + i); + } + + displayedModals = new Modal[] { null, null }; + #endregion TJAPlayer3.stage選曲.act曲リスト.bFirstCrownLoad = false; @@ -1355,10 +1374,22 @@ namespace TJAPlayer3 pos = 1; TJAPlayer3.NamePlate.tNamePlateDraw((pos == 1) ? 1280 - 28 - TJAPlayer3.Tx.NamePlateBase.szテクスチャサイズ.Width : 28, 621, i); - } - + } + #endregion - + + + #region [Display modals] + + // Display modal is present + for (int i = 0; i < TJAPlayer3.ConfigIni.nPlayerCount; i++) + { + if (displayedModals[i] != null) + displayedModals[i].tDisplayModal(); + } + + #endregion + if (base.eフェーズID == CStage.Eフェーズ.共通_フェードイン) { if (this.actFI.On進行描画() != 0) @@ -1431,30 +1462,55 @@ namespace TJAPlayer3 #endregion - #region [ Return to song select screen ] - else { - actFI.tフェードアウト開始(); - - if (TJAPlayer3.latestSongSelect == TJAPlayer3.stage選曲)// TJAPlayer3.stage選曲.n確定された曲の難易度[0] != (int)Difficulty.Dan) - if (TJAPlayer3.stage選曲.r現在選択中の曲.r親ノード != null) - TJAPlayer3.stage選曲.act曲リスト.tBOXを出る(); - - t後処理(); - + if (!mqModals.tIsQueueEmpty(0) + && ( + TJAPlayer3.Pad.b押されたDGB(Eパッド.LRed) + || TJAPlayer3.Pad.b押されたDGB(Eパッド.RRed) + || TJAPlayer3.Input管理.Keyboard.bキーが押された((int)SlimDXKeys.Key.Return) + ) + ) { - base.eフェーズID = CStage.Eフェーズ.共通_フェードアウト; - this.eフェードアウト完了時の戻り値 = E戻り値.完了; - TJAPlayer3.Skin.bgmリザルト音.t停止する(); - TJAPlayer3.Skin.bgmDanResult.t停止する(); - TJAPlayer3.Skin.bgmTowerResult.t停止する(); + displayedModals[0] = mqModals.tPopModal(0); + } + else if (TJAPlayer3.ConfigIni.nPlayerCount == 1 || mqModals.tIsQueueEmpty(1)) + { + #region [ Return to song select screen ] + + actFI.tフェードアウト開始(); + + if (TJAPlayer3.latestSongSelect == TJAPlayer3.stage選曲) + if (TJAPlayer3.stage選曲.r現在選択中の曲.r親ノード != null) + TJAPlayer3.stage選曲.act曲リスト.tBOXを出る(); + + t後処理(); + + { + base.eフェーズID = CStage.Eフェーズ.共通_フェードアウト; + this.eフェードアウト完了時の戻り値 = E戻り値.完了; + TJAPlayer3.Skin.bgmリザルト音.t停止する(); + TJAPlayer3.Skin.bgmDanResult.t停止する(); + TJAPlayer3.Skin.bgmTowerResult.t停止する(); + } + + #endregion } } - - #endregion - } + else if ((TJAPlayer3.ConfigIni.nPlayerCount > 1 && ( + TJAPlayer3.Pad.b押されたDGB(Eパッド.LRed2P) + || TJAPlayer3.Pad.b押されたDGB(Eパッド.RRed2P) + ))) { + if (!mqModals.tIsQueueEmpty(1) && this.actParameterPanel.ct全体進行.n現在の値 >= this.actParameterPanel.MountainAppearValue) + { + TJAPlayer3.Skin.sound決定音.t再生する(); + + displayedModals[1] = mqModals.tPopModal(1); + } + } + + if (TJAPlayer3.Input管理.Keyboard.bキーが押されている((int)SlimDXKeys.Key.LeftArrow) || TJAPlayer3.Pad.b押された(E楽器パート.DRUMS, Eパッド.LBlue) || TJAPlayer3.Input管理.Keyboard.bキーが押されている((int)SlimDXKeys.Key.RightArrow) || @@ -1814,7 +1870,11 @@ namespace TJAPlayer3 private CPrivateFastFont pfTowerText48; private CPrivateFastFont pfTowerText72; - // Don medals information + // Modal queues + private ModalQueue mqModals; + private Modal[] displayedModals; + + // Coins information private int[] nEarnedMedalsCount = { 0, 0 }; #region [ #24609 リザルト画像をpngで保存する ] // #24609 2011.3.14 yyagi; to save result screen in case BestRank or HiSkill. diff --git a/TJAPlayer3/TJAPlayer3.csproj b/TJAPlayer3/TJAPlayer3.csproj index 6d056387..2de22921 100644 --- a/TJAPlayer3/TJAPlayer3.csproj +++ b/TJAPlayer3/TJAPlayer3.csproj @@ -121,6 +121,7 @@ +