1
0
mirror of synced 2024-11-24 15:40:22 +01:00

Modal queue and Coin modals base code (No SFX or text yet

This commit is contained in:
0aubsq 2022-03-07 10:55:49 +01:00
parent c4315e33da
commit a98eb680b9
4 changed files with 161 additions and 31 deletions

View File

@ -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;
}
}

View File

@ -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<Modal>[] { new Queue<Modal>(), new Queue<Modal>() };
_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<Modal>[] _modalQueues;
}
}

View File

@ -649,6 +649,25 @@ namespace TJAPlayer3
#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;
this.ctPhase1 = null;
@ -1359,6 +1378,18 @@ namespace TJAPlayer3
#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,13 +1462,25 @@ namespace TJAPlayer3
#endregion
#region [ Return to song select screen ]
else
{
if (!mqModals.tIsQueueEmpty(0)
&& (
TJAPlayer3.Pad.b押されたDGB(Eパッド.LRed)
|| TJAPlayer3.Pad.b押されたDGB(Eパッド.RRed)
|| TJAPlayer3.Input管理.Keyboard.bキーが押された((int)SlimDXKeys.Key.Return)
)
)
{
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選曲)// TJAPlayer3.stage選曲.n確定された曲の難易度[0] != (int)Difficulty.Dan)
if (TJAPlayer3.latestSongSelect == TJAPlayer3.stage選曲)
if (TJAPlayer3.stage選曲.r現在選択中の曲.r親ード != null)
TJAPlayer3.stage選曲.act曲リスト.tBOXを出る();
@ -1450,11 +1493,24 @@ namespace TJAPlayer3
TJAPlayer3.Skin.bgmDanResult.t停止する();
TJAPlayer3.Skin.bgmTowerResult.t停止する();
}
}
#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.

View File

@ -121,6 +121,7 @@
<Compile Include="Animations\IAnimatable.cs" />
<Compile Include="Animations\Linear.cs" />
<Compile Include="Common\CCrypto.cs" />
<Compile Include="Common\ModalQueue.cs" />
<Compile Include="Common\Modal.cs" />
<Compile Include="Common\CSongDict.cs" />
<Compile Include="Common\Favorites.cs" />