first commit
@ -23,10 +23,15 @@
|
||||
<Content Include="Licenses/**" CopyToOutputDirectory="PreserveNewest" />
|
||||
<Content Include="Songs/**" CopyToOutputDirectory="PreserveNewest" />
|
||||
<Content Include="System/**" CopyToOutputDirectory="PreserveNewest" />
|
||||
<None Remove="system\open-world memories\modules\modal\Config.json" />
|
||||
<Content Include="BGScriptAPI.lua" CopyToOutputDirectory="PreserveNewest" />
|
||||
<Content Include="OpenTaiko.ico" CopyToOutputDirectory="PreserveNewest" />
|
||||
<Content Include="README.md" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="System\Open-World Memories\Modules\Modal\Textures\" />
|
||||
<Folder Include="System\Open-World Memories\Modules\Modal\Sounds\" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<Version>0.6.0</Version>
|
||||
<OutputType>WinExe</OutputType>
|
||||
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
|
||||
}
|
168
OpenTaiko/System/Open-World Memories/Modules/Modal/Script.lua
Normal file
@ -0,0 +1,168 @@
|
||||
import ('System.Drawing')
|
||||
|
||||
-- Modal info
|
||||
local modal_current_type = 0
|
||||
local modal_current_rarity = 1
|
||||
local modal_current_player = 1
|
||||
local modal_current_info = nil
|
||||
local modal_current_visual = nil
|
||||
|
||||
-- Modal graphics
|
||||
local icon_players = { }
|
||||
local modal_tx = { }
|
||||
local modal_tx_coin = nil
|
||||
local ttk_modal_header = nil
|
||||
local ttk_modal_body = nil
|
||||
|
||||
-- Modal sounds
|
||||
local modal_sfx = { }
|
||||
local modal_sfx_coin = nil
|
||||
|
||||
-- Fonts
|
||||
local font_modal_header = nil
|
||||
local font_modal_body = nil
|
||||
local font_modal_plate = nil
|
||||
|
||||
-- Modal counter
|
||||
local modal_duration = 2000
|
||||
local modal_counter = 0
|
||||
local script_busy = false
|
||||
|
||||
-- After the item is revealed, a circle glow or smth like that?
|
||||
local modal_loopanim_duration = 1000
|
||||
local modal_loopanim_counter = 0
|
||||
|
||||
-- Tmp (until new format)
|
||||
local modal_asset_id = 0
|
||||
|
||||
function isAnimationFinished()
|
||||
return not script_busy
|
||||
end
|
||||
|
||||
-- modal_asset_informations: Character object, Coin count, Nameplate unlockable whole object, etc... having all the necessary information
|
||||
-- modal_asset_visual_references: Character textures table, Song preimage (?) or supporting visuals, might be null for some modal types
|
||||
function registerNewModal(player, rarity, modal_type, modal_asset_informations, modal_asset_visual_references)
|
||||
local _modal_header = ""
|
||||
local _modal_body = ""
|
||||
modal_current_type = modal_type
|
||||
modal_current_rarity = rarity
|
||||
modal_current_player = player
|
||||
modal_current_info = modal_asset_informations
|
||||
modal_current_visual = modal_asset_visual_references
|
||||
modal_counter = 0
|
||||
modal_loopanim_counter = 0
|
||||
script_busy = true
|
||||
|
||||
if modal_type == 0 then
|
||||
-- Coin
|
||||
modal_current_rarity = 1
|
||||
_modal_header = getLocalizedString("MODAL_TITLE_COIN")
|
||||
_modal_body = getLocalizedString("MODAL_MESSAGE_COIN", tostring(modal_asset_informations), tostring(modal_asset_visual_references)) -- 0: Delta coin, 1: Total coin
|
||||
debugLog(_modal_body)
|
||||
|
||||
modal_sfx_coin:tPlaySound()
|
||||
|
||||
elseif modal_type == 1 then
|
||||
-- Character
|
||||
_modal_header = getLocalizedString("MODAL_TITLE_CHARA")
|
||||
|
||||
elseif modal_type == 2 then
|
||||
-- Puchichara
|
||||
_modal_header = getLocalizedString("MODAL_TITLE_PUCHI")
|
||||
|
||||
elseif modal_type == 3 then
|
||||
-- Title
|
||||
-- > modal_asset_informations: NameplateUnlockable
|
||||
-- > modal_asset_visual_references: CLuaNamePlateScript's DrawTitlePlate callback
|
||||
_modal_header = getLocalizedString("MODAL_TITLE_NAMEPLATE")
|
||||
_modal_body = modal_asset_informations.Value.nameplateInfo.cld:GetString("")
|
||||
ttk_modal_body = createTitleTextureKey(_modal_body, font_modal_plate, 99999, Color.FromArgb(0,0,0,1), Color.FromArgb(0,0,0,0))
|
||||
|
||||
elseif modal_type == 4 then
|
||||
-- Song
|
||||
_modal_header = getLocalizedString("MODAL_TITLE_SONG")
|
||||
|
||||
end
|
||||
|
||||
ttk_modal_header = createTitleTextureKey(_modal_header, font_modal_header, 99999)
|
||||
if modal_type ~= 3 then
|
||||
ttk_modal_body = createTitleTextureKey(_modal_body, font_modal_body, 99999)
|
||||
end
|
||||
|
||||
-- Tmp
|
||||
modal_asset_id = math.max(1, math.min(5, modal_current_rarity))
|
||||
|
||||
if modal_type ~= 0 then
|
||||
modal_sfx[modal_asset_id]:tPlaySound()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function loadAssets()
|
||||
config = loadConfig("Config.json")
|
||||
|
||||
for i = 1, 5 do
|
||||
icon_players[i] = loadTexture(tostring(i).."P.png")
|
||||
end
|
||||
|
||||
-- Tmp, to change with the new structure later
|
||||
for i = 0, 4 do
|
||||
modal_tx[i + 1] = loadTexture(tostring(i)..".png")
|
||||
modal_sfx[i + 1] = loadSound(tostring(i)..".ogg", "soundeffect")
|
||||
end
|
||||
modal_tx_coin = loadTexture("Coin.png")
|
||||
modal_sfx_coin = loadSound("Coin.ogg", "soundeffect")
|
||||
|
||||
font_modal_header = loadFontRenderer(84, "regular")
|
||||
font_modal_body = loadFontRenderer(84, "regular")
|
||||
font_modal_plate = loadFontRenderer(16, "regular")
|
||||
|
||||
end
|
||||
|
||||
function update()
|
||||
if modal_counter <= modal_duration then
|
||||
script_busy = true
|
||||
modal_counter = modal_counter + (1000 * fps.deltaTime)
|
||||
else
|
||||
script_busy = false
|
||||
modal_loopanim_counter = modal_loopanim_counter + (1000 * fps.deltaTime)
|
||||
if modal_loopanim_counter >= modal_loopanim_duration then
|
||||
modal_loopanim_counter = 0
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
-- Idea: If button press and not finished, directly set modal_counter to modal_duration and cut the appearing animation?
|
||||
end
|
||||
|
||||
function draw()
|
||||
icon_players[modal_current_player]:t2D_DisplayImage(0, 0)
|
||||
|
||||
tx_header = getTextTex(ttk_modal_header, false, false)
|
||||
|
||||
if modal_current_type == 0 then
|
||||
-- Coin
|
||||
modal_tx_coin:t2D_DisplayImage(0, 0)
|
||||
|
||||
tx_header:t2D_DisplayImage_AnchorCenter(960,180)
|
||||
tx_body = getTextTex(ttk_modal_body, false, false)
|
||||
tx_body:t2D_DisplayImage_AnchorCenter(960,490)
|
||||
else
|
||||
-- Others
|
||||
modal_tx[modal_asset_id]:t2D_DisplayImage(0, 0)
|
||||
|
||||
tx_header:t2D_DisplayImage_AnchorCenter(960,180)
|
||||
|
||||
|
||||
if modal_current_type == 3 then
|
||||
tx_title = getTextTex(ttk_modal_body, false, false)
|
||||
modal_current_visual:DrawTitlePlate(960, 490, 255, modal_current_info.Value.nameplateInfo.iType, tx_title, modal_current_rarity, modal_current_info.Key)
|
||||
else
|
||||
tx_body = getTextTex(ttk_modal_body, false, false)
|
||||
tx_body:t2D_DisplayImage_AnchorCenter(960,490)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
BIN
OpenTaiko/System/Open-World Memories/Modules/Modal/Sounds/0.ogg
Normal file
BIN
OpenTaiko/System/Open-World Memories/Modules/Modal/Sounds/1.ogg
Normal file
BIN
OpenTaiko/System/Open-World Memories/Modules/Modal/Sounds/2.ogg
Normal file
BIN
OpenTaiko/System/Open-World Memories/Modules/Modal/Sounds/3.ogg
Normal file
BIN
OpenTaiko/System/Open-World Memories/Modules/Modal/Sounds/4.ogg
Normal file
After Width: | Height: | Size: 523 KiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 9.1 KiB |
After Width: | Height: | Size: 847 KiB |
After Width: | Height: | Size: 9.5 KiB |
After Width: | Height: | Size: 514 KiB |
After Width: | Height: | Size: 9.3 KiB |
After Width: | Height: | Size: 914 KiB |
After Width: | Height: | Size: 10 KiB |
After Width: | Height: | Size: 8.5 KiB |
After Width: | Height: | Size: 1.2 MiB |
@ -1,154 +1,13 @@
|
||||
using System.Drawing;
|
||||
using FDK;
|
||||
using static TJAPlayer3.CActSelect曲リスト;
|
||||
|
||||
namespace TJAPlayer3 {
|
||||
namespace TJAPlayer3 {
|
||||
internal class Modal {
|
||||
public Modal(EModalType mt, int ra, params object[] re) {
|
||||
modalType = mt;
|
||||
rarity = ra;
|
||||
reference = re;
|
||||
_isSet = false;
|
||||
// TODO: Add an int (?) or string to find the Puchichara/Character/Song asset to display it
|
||||
}
|
||||
|
||||
public void tSetupModal() {
|
||||
CTexture[] arrRef;
|
||||
|
||||
if (modalFormat == EModalFormat.Half)
|
||||
arrRef = TJAPlayer3.Tx.Modal_Half;
|
||||
else if (modalFormat == EModalFormat.Half_4P)
|
||||
arrRef = TJAPlayer3.Tx.Modal_Half_4P;
|
||||
else if (modalFormat == EModalFormat.Half_5P)
|
||||
arrRef = TJAPlayer3.Tx.Modal_Half_5P;
|
||||
else
|
||||
arrRef = TJAPlayer3.Tx.Modal_Full;
|
||||
|
||||
if (modalType == EModalType.Coin)
|
||||
_box = arrRef[arrRef.Length - 1];
|
||||
else {
|
||||
int usedTex = Math.Max(0, Math.Min(arrRef.Length - 2, rarity));
|
||||
_box = arrRef[usedTex];
|
||||
}
|
||||
|
||||
/*
|
||||
_boxRect = new Rectangle(
|
||||
(modalFormat == EModalFormat.Full || player == 0)
|
||||
? 0
|
||||
: _box.szテクスチャサイズ.Width / 2,
|
||||
0,
|
||||
(modalFormat == EModalFormat.Full)
|
||||
? _box.szテクスチャサイズ.Width
|
||||
: _box.szテクスチャサイズ.Width / 2,
|
||||
_box.szテクスチャサイズ.Height);
|
||||
*/
|
||||
|
||||
_boxRect = new Rectangle(
|
||||
(modalFormat == EModalFormat.Full || player == 0) ? 0 : _box.szTextureSize.Width / 2,
|
||||
0,
|
||||
(modalFormat == EModalFormat.Full) ? _box.szTextureSize.Width : _box.szTextureSize.Width / 2,
|
||||
_box.szTextureSize.Height / (((TJAPlayer3.ConfigIni.nPlayerCount - 1) / 2) + 1));
|
||||
|
||||
tGenerateTextures();
|
||||
|
||||
_isSet = true;
|
||||
}
|
||||
|
||||
public void tDisplayModal() {
|
||||
if (_isSet == true) {
|
||||
_box?.t2D描画(_boxRect.Width * (player % 2), _boxRect.Height * (player / 2), _boxRect);
|
||||
|
||||
int[] title_x;
|
||||
int[] title_y;
|
||||
int[] text_x;
|
||||
int[] text_y;
|
||||
int moveX;
|
||||
int moveY;
|
||||
|
||||
if (modalFormat == EModalFormat.Full) {
|
||||
title_x = new int[] { TJAPlayer3.Skin.Modal_Title_Full[0] };
|
||||
title_y = new int[] { TJAPlayer3.Skin.Modal_Title_Full[1] };
|
||||
|
||||
text_x = new int[] { TJAPlayer3.Skin.Modal_Text_Full[0] };
|
||||
text_y = new int[] { TJAPlayer3.Skin.Modal_Text_Full[1] };
|
||||
|
||||
moveX = TJAPlayer3.Skin.Modal_Text_Full_Move[0];
|
||||
moveY = TJAPlayer3.Skin.Modal_Text_Full_Move[1];
|
||||
} else if (modalFormat == EModalFormat.Half) {
|
||||
title_x = TJAPlayer3.Skin.Modal_Title_Half_X;
|
||||
title_y = TJAPlayer3.Skin.Modal_Title_Half_Y;
|
||||
|
||||
text_x = TJAPlayer3.Skin.Modal_Text_Half_X;
|
||||
text_y = TJAPlayer3.Skin.Modal_Text_Half_Y;
|
||||
|
||||
moveX = TJAPlayer3.Skin.Modal_Text_Half_Move[0];
|
||||
moveY = TJAPlayer3.Skin.Modal_Text_Half_Move[1];
|
||||
} else if (modalFormat == EModalFormat.Half_4P) {
|
||||
title_x = TJAPlayer3.Skin.Modal_Title_Half_X_4P;
|
||||
title_y = TJAPlayer3.Skin.Modal_Title_Half_Y_4P;
|
||||
|
||||
text_x = TJAPlayer3.Skin.Modal_Text_Half_X_4P;
|
||||
text_y = TJAPlayer3.Skin.Modal_Text_Half_Y_4P;
|
||||
|
||||
moveX = TJAPlayer3.Skin.Modal_Text_Half_Move_4P[0];
|
||||
moveY = TJAPlayer3.Skin.Modal_Text_Half_Move_4P[1];
|
||||
} else// 5P
|
||||
{
|
||||
title_x = TJAPlayer3.Skin.Modal_Title_Half_X_5P;
|
||||
title_y = TJAPlayer3.Skin.Modal_Title_Half_Y_5P;
|
||||
|
||||
text_x = TJAPlayer3.Skin.Modal_Text_Half_X_5P;
|
||||
text_y = TJAPlayer3.Skin.Modal_Text_Half_Y_5P;
|
||||
|
||||
moveX = TJAPlayer3.Skin.Modal_Text_Half_Move_5P[0];
|
||||
moveY = TJAPlayer3.Skin.Modal_Text_Half_Move_5P[1];
|
||||
}
|
||||
|
||||
/*
|
||||
Point[] Pos = new Point[]
|
||||
{
|
||||
(modalFormat == EModalFormat.Full) ? new Point(TJAPlayer3.Skin.Modal_Title_Full[0], TJAPlayer3.Skin.Modal_Title_Full[1]) : new Point(TJAPlayer3.Skin.Modal_Title_Half_X[player], TJAPlayer3.Skin.Modal_Title_Half_Y[player]), // title
|
||||
(modalFormat == EModalFormat.Full) ?
|
||||
new Point(TJAPlayer3.Skin.Modal_Text_Full[0] +(tTextCentered () ? TJAPlayer3.Skin.Modal_Text_Full_Move[0] : 0),
|
||||
TJAPlayer3.Skin.Modal_Text_Full[1] + (tTextCentered () ? TJAPlayer3.Skin.Modal_Text_Full_Move[1] : 0)) :
|
||||
|
||||
new Point(TJAPlayer3.Skin.Modal_Text_Half_X[player] + (tTextCentered () ? TJAPlayer3.Skin.Modal_Text_Half_Move[0] : 0),
|
||||
TJAPlayer3.Skin.Modal_Text_Half_Y[player] + (tTextCentered () ? TJAPlayer3.Skin.Modal_Text_Half_Move[1] : 0)), // content
|
||||
};
|
||||
*/
|
||||
|
||||
Point[] Pos = new Point[]
|
||||
{
|
||||
new Point(title_x[player], title_y[player]),
|
||||
new Point(text_x[player] + (tTextCentered () ? moveX : 0),
|
||||
text_y[player] + (tTextCentered () ? moveY : 0)), // content
|
||||
};
|
||||
|
||||
_ModalTitle?.t2D中心基準描画(Pos[0].X, Pos[0].Y);
|
||||
_ModalText?.t2D中心基準描画(Pos[1].X, Pos[1].Y);
|
||||
|
||||
// Extra texture for Puchichara, Character and Titles next
|
||||
}
|
||||
}
|
||||
|
||||
public void tPlayModalSfx() {
|
||||
if (modalType == EModalType.Coin)
|
||||
TJAPlayer3.Skin.soundModal[TJAPlayer3.Skin.soundModal.Length - 1].tPlay();
|
||||
else
|
||||
TJAPlayer3.Skin.soundModal[Math.Max(0, Math.Min(TJAPlayer3.Skin.soundModal.Length - 2, rarity))].tPlay();
|
||||
}
|
||||
|
||||
public static void tInitModalFonts() {
|
||||
if (_pfModalContentHalf != null
|
||||
&& _pfModalTitleHalf != null
|
||||
&& _pfModalContentFull != null
|
||||
&& _pfModalTitleFull != null)
|
||||
return;
|
||||
|
||||
_pfModalContentHalf = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.Modal_Font_ModalContentHalf_Size);
|
||||
_pfModalTitleHalf = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.Modal_Font_ModalTitleHalf_Size);
|
||||
_pfModalContentFull = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.Modal_Font_ModalContentFull_Size);
|
||||
_pfModalTitleFull = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.Modal_Font_ModalTitleFull_Size);
|
||||
public void tRegisterModal(int player) {
|
||||
TJAPlayer3.stage結果.lcModal.RegisterNewModal(player, rarity, modalType, reference);
|
||||
}
|
||||
|
||||
#region [Enum definitions]
|
||||
@ -186,87 +45,5 @@ namespace TJAPlayer3 {
|
||||
|
||||
#endregion
|
||||
|
||||
#region [private]
|
||||
|
||||
// Check if the text is vertically centered or slightly up (to let enough space for the unlocked unit texture)
|
||||
private bool tTextCentered() {
|
||||
if (modalType == EModalType.Coin)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Generate the modal title and content text textures
|
||||
private void tGenerateTextures() {
|
||||
string modalKey = "MODAL_TITLE_COIN";
|
||||
switch (modalType) {
|
||||
case EModalType.Character:
|
||||
modalKey = "MODAL_TITLE_CHARA";
|
||||
break;
|
||||
case EModalType.Puchichara:
|
||||
modalKey = "MODAL_TITLE_PUCHI";
|
||||
break;
|
||||
case EModalType.Title:
|
||||
modalKey = "MODAL_TITLE_NAMEPLATE";
|
||||
break;
|
||||
case EModalType.Song:
|
||||
modalKey = "MODAL_TITLE_SONG";
|
||||
break;
|
||||
}
|
||||
TitleTextureKey _title = new TitleTextureKey(
|
||||
CLangManager.LangInstance.GetString(modalKey),
|
||||
(modalFormat == EModalFormat.Full)
|
||||
? _pfModalTitleFull
|
||||
: _pfModalTitleHalf,
|
||||
Color.White,
|
||||
Color.Black,
|
||||
1800);
|
||||
|
||||
string content = "";
|
||||
|
||||
if (modalType == EModalType.Coin) {
|
||||
content = CLangManager.LangInstance.GetString("MODAL_MESSAGE_COIN", reference[0].ToString(), TJAPlayer3.SaveFileInstances[player].data.Medals.ToString());
|
||||
//content = String.Format("+{0} {1} ({2}: {3})",
|
||||
// (int)reference[0],
|
||||
// CLangManager.LangInstance.GetString(306),
|
||||
// CLangManager.LangInstance.GetString(307),
|
||||
// TJAPlayer3.SaveFileInstances[player].data.Medals
|
||||
// );
|
||||
} else if (modalType == EModalType.Title) {
|
||||
content = ((string)reference[0]).RemoveTags();
|
||||
} else if (modalType == EModalType.Character) {
|
||||
content = ((string)reference[0]).RemoveTags();
|
||||
} else if (modalType == EModalType.Puchichara) {
|
||||
content = ((string)reference[0]).RemoveTags();
|
||||
} else if (modalType == EModalType.Song) {
|
||||
content = ((string)reference[0]).RemoveTags();
|
||||
}
|
||||
|
||||
TitleTextureKey _content = new TitleTextureKey(
|
||||
content,
|
||||
(modalFormat == EModalFormat.Full)
|
||||
? _pfModalContentFull
|
||||
: _pfModalContentHalf,
|
||||
Color.White,
|
||||
Color.Black,
|
||||
1800);
|
||||
|
||||
_ModalText = TJAPlayer3.stageSongSelect.actSongList.ResolveTitleTexture(_content);
|
||||
_ModalTitle = TJAPlayer3.stageSongSelect.actSongList.ResolveTitleTexture(_title);
|
||||
}
|
||||
|
||||
private CTexture _box;
|
||||
private Rectangle _boxRect;
|
||||
|
||||
private bool _isSet;
|
||||
|
||||
private static CCachedFontRenderer _pfModalTitleHalf;
|
||||
private static CCachedFontRenderer _pfModalContentHalf;
|
||||
private static CCachedFontRenderer _pfModalTitleFull;
|
||||
private static CCachedFontRenderer _pfModalContentFull;
|
||||
|
||||
private CTexture _ModalTitle;
|
||||
private CTexture _ModalText;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -5,41 +5,10 @@
|
||||
_modalFormat = mf;
|
||||
}
|
||||
|
||||
// Add two modals (one per player) at the same time
|
||||
public void tAddModal(Modal mp1, Modal mp2, Modal mp3, Modal mp4, Modal mp5) {
|
||||
mp1.modalFormat = _modalFormat;
|
||||
mp2.modalFormat = _modalFormat;
|
||||
mp3.modalFormat = _modalFormat;
|
||||
mp4.modalFormat = _modalFormat;
|
||||
mp5.modalFormat = _modalFormat;
|
||||
mp1.player = 0;
|
||||
mp2.player = 1;
|
||||
mp3.player = 2;
|
||||
mp4.player = 3;
|
||||
mp5.player = 4;
|
||||
mp1.tSetupModal();
|
||||
mp2.tSetupModal();
|
||||
mp3.tSetupModal();
|
||||
mp4.tSetupModal();
|
||||
mp5.tSetupModal();
|
||||
|
||||
if (mp1 != null)
|
||||
_modalQueues[0].Enqueue(mp1);
|
||||
if (mp2 != null)
|
||||
_modalQueues[1].Enqueue(mp2);
|
||||
if (mp3 != null)
|
||||
_modalQueues[2].Enqueue(mp3);
|
||||
if (mp4 != null)
|
||||
_modalQueues[3].Enqueue(mp4);
|
||||
if (mp5 != null)
|
||||
_modalQueues[4].Enqueue(mp5);
|
||||
}
|
||||
|
||||
// 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);
|
||||
@ -51,6 +20,19 @@
|
||||
return null;
|
||||
}
|
||||
|
||||
// 1P => 2P => 3P => 4P => 5P
|
||||
public Modal? tPopModalInOrder() {
|
||||
for (int i = 0; i < TJAPlayer3.ConfigIni.nPlayerCount; i++) {
|
||||
if (!tIsQueueEmpty(i)) {
|
||||
Modal? _m = _modalQueues[i].Dequeue();
|
||||
_m?.tRegisterModal(i + 1);
|
||||
return _m;
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool tIsQueueEmpty(int player) {
|
||||
if (player < 0 || player >= TJAPlayer3.ConfigIni.nPlayerCount)
|
||||
return true;
|
||||
|
@ -2391,9 +2391,6 @@ for (int i = 0; i < 3; i++) {
|
||||
}
|
||||
#endif
|
||||
|
||||
// Init Modal fonts once config.ini parsing is done
|
||||
// Moved here to reference Skin values.
|
||||
Modal.tInitModalFonts();
|
||||
//---------------------
|
||||
#endregion
|
||||
//-----------
|
||||
@ -2622,6 +2619,7 @@ for (int i = 0; i < 3; i++) {
|
||||
stage曲読み込み = new CStage曲読み込み();
|
||||
stage演奏ドラム画面 = new CStage演奏ドラム画面();
|
||||
stage結果 = new CStage結果();
|
||||
stage結果.RefreshSkin();
|
||||
stageChangeSkin = new CStageChangeSkin();
|
||||
stage終了 = new CStage終了();
|
||||
NamePlate = new CNamePlate();
|
||||
@ -3063,6 +3061,7 @@ for (int i = 0; i < 3; i++) {
|
||||
actTextConsole.CreateManagedResource();
|
||||
actTextConsole.CreateUnmanagedResource();
|
||||
TJAPlayer3.NamePlate.RefleshSkin();
|
||||
TJAPlayer3.stage結果.RefreshSkin();
|
||||
CActSelectPopupMenu.RefleshSkin();
|
||||
CActSelect段位リスト.RefleshSkin();
|
||||
}
|
||||
|
@ -78,8 +78,9 @@ namespace TJAPlayer3 {
|
||||
mq.tAddModal(
|
||||
new Modal(
|
||||
Modal.EModalType.Title,
|
||||
HRarity.tRarityToModalInt(item.Value.rarity),
|
||||
item.Value.nameplateInfo.cld.GetString("") // Cannot be null on database
|
||||
HRarity.tRarityToLangInt(item.Value.rarity),
|
||||
item,
|
||||
TJAPlayer3.NamePlate.lcNamePlate
|
||||
),
|
||||
_player);
|
||||
|
||||
|
@ -35,7 +35,7 @@ namespace TJAPlayer3 {
|
||||
|
||||
private List<IDisposable> listDisposables = new List<IDisposable>();
|
||||
|
||||
protected bool Avaibale {
|
||||
protected bool Available {
|
||||
get {
|
||||
return bLoadedAssets && !bDisposed && !bCrashed;
|
||||
}
|
||||
@ -148,6 +148,10 @@ namespace TJAPlayer3 {
|
||||
return fontRenderer;
|
||||
}
|
||||
|
||||
private string GetLocalizedString(string key, params object?[] args) {
|
||||
return CLangManager.LangInstance.GetString(key, args);
|
||||
}
|
||||
|
||||
private TitleTextureKey CreateTitleTextureKey(string title, CCachedFontRenderer fontRenderer, int maxSize, Color? color = null, Color? edgeColor = null) {
|
||||
return new TitleTextureKey(title, fontRenderer, color ?? Color.White, edgeColor ?? Color.Black, maxSize);
|
||||
}
|
||||
@ -184,6 +188,7 @@ namespace TJAPlayer3 {
|
||||
LuaScript["getText"] = getText;
|
||||
LuaScript["getNumArray"] = getNumArray;
|
||||
LuaScript["getTextArray"] = getTextArray;
|
||||
LuaScript["getLocalizedString"] = GetLocalizedString;
|
||||
LuaScript["displayDanPlate"] = CActSelect段位リスト.tDisplayDanPlate;
|
||||
LuaScript["debugLog"] = DebugLog;
|
||||
|
||||
|
46
OpenTaiko/src/Lua/Scripts/CLuaModalScript.cs
Normal file
@ -0,0 +1,46 @@
|
||||
using NLua;
|
||||
|
||||
namespace TJAPlayer3 {
|
||||
internal class CLuaModalScript : CLuaScript {
|
||||
private LuaFunction lfRegisterModal;
|
||||
private LuaFunction lfAnimationFinished;
|
||||
private LuaFunction lfUpdate;
|
||||
private LuaFunction lfDraw;
|
||||
|
||||
public CLuaModalScript(string dir, string? texturesDir = null, string? soundsDir = null, bool loadAssets = true) : base(dir, texturesDir, soundsDir, loadAssets) {
|
||||
|
||||
lfRegisterModal = (LuaFunction)LuaScript["registerNewModal"];
|
||||
lfAnimationFinished = (LuaFunction)LuaScript["isAnimationFinished"];
|
||||
lfUpdate = (LuaFunction)LuaScript["update"];
|
||||
lfDraw = (LuaFunction)LuaScript["draw"];
|
||||
}
|
||||
|
||||
// Function to retrieve if the currently playing modal animation (etc) finished playing, allowing to send the next modal
|
||||
public bool AnimationFinished() {
|
||||
if (!Available) return false;
|
||||
bool result = (bool)RunLuaCode(lfAnimationFinished)[0];
|
||||
return result;
|
||||
}
|
||||
|
||||
// Informations of the newly added modal are initialized here
|
||||
public void RegisterNewModal(int player, int rarity, Modal.EModalType modalType, params object[] args) {
|
||||
if (!Available) return;
|
||||
|
||||
object[] newParams = new object[] { player, rarity, (int)modalType }.Concat(args).ToArray();
|
||||
RunLuaCode(lfRegisterModal, newParams);
|
||||
}
|
||||
|
||||
// Handle inputs here (if necessary, like to add a shortcut to accelerate the animation etc
|
||||
public void Update(params object[] args) {
|
||||
if (!Available) return;
|
||||
|
||||
RunLuaCode(lfUpdate, args);
|
||||
}
|
||||
|
||||
public void Draw(params object[] args) {
|
||||
if (!Available) return;
|
||||
|
||||
RunLuaCode(lfDraw, args);
|
||||
}
|
||||
}
|
||||
}
|
@ -20,39 +20,41 @@ namespace TJAPlayer3 {
|
||||
}
|
||||
|
||||
public int GetCharaOffset() {
|
||||
if (!Avaibale) return 0;
|
||||
if (!Available) return 0;
|
||||
double result = (double)RunLuaCode(lfGetCharaOffset)[0];
|
||||
return (int)result;
|
||||
}
|
||||
|
||||
public void SetInfos(int player, string name, string title, string dan, SaveFile.Data data) {
|
||||
if (!Avaibale) return;
|
||||
if (!Available) return;
|
||||
|
||||
RunLuaCode(lfSetInfos, player, name ?? "", title ?? "", dan ?? "", data);
|
||||
}
|
||||
|
||||
// For My Room
|
||||
public void DrawDan(int x, int y, int opacity, int danGrade, CTexture titleTex) {
|
||||
if (!Avaibale) return;
|
||||
if (!Available) return;
|
||||
|
||||
RunLuaCode(lfDrawDan, x, y, opacity, danGrade, titleTex);
|
||||
}
|
||||
|
||||
// For My Room
|
||||
public void DrawTitlePlate(int x, int y, int opacity, int type, CTexture titleTex, int rarity, int nameplateId) {
|
||||
if (!Avaibale) return;
|
||||
if (!Available) return;
|
||||
|
||||
RunLuaCode(lfDrawTitlePlate, x, y, opacity, type, titleTex, rarity, nameplateId);
|
||||
}
|
||||
|
||||
public void Update(params object[] args) {
|
||||
if (!Avaibale) return;
|
||||
if (!Available) return;
|
||||
|
||||
RunLuaCode(lfUpdate, args);
|
||||
}
|
||||
|
||||
public void Draw(int x, int y, int opacity, int player, int side) {
|
||||
if (!Avaibale) return;
|
||||
if (!Available) return;
|
||||
|
||||
RunLuaCode(lfDraw, x, y, opacity, player, side);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,16 @@ using static TJAPlayer3.CActSelect曲リスト;
|
||||
|
||||
namespace TJAPlayer3 {
|
||||
internal class CStage結果 : CStage {
|
||||
// Modals Lua management
|
||||
|
||||
public CLuaModalScript lcModal { get; private set; }
|
||||
|
||||
public void RefreshSkin() {
|
||||
lcModal?.Dispose();
|
||||
lcModal = new CLuaModalScript(CSkin.Path("Modules/Modal"));
|
||||
|
||||
}
|
||||
|
||||
// プロパティ
|
||||
|
||||
public STDGBVALUE<bool> b新記録スキル;
|
||||
@ -593,7 +603,9 @@ namespace TJAPlayer3 {
|
||||
new Modal(
|
||||
Modal.EModalType.Coin,
|
||||
0,
|
||||
this.nEarnedMedalsCount[i]),
|
||||
(long)this.nEarnedMedalsCount[i],
|
||||
TJAPlayer3.SaveFileInstances[TJAPlayer3.GetActualPlayer(i)].data.Medals
|
||||
),
|
||||
i);
|
||||
|
||||
// Check unlockables
|
||||
@ -612,7 +624,7 @@ namespace TJAPlayer3 {
|
||||
|
||||
}
|
||||
|
||||
displayedModals = new Modal[] { null, null, null, null, null };
|
||||
displayedModals = null;
|
||||
|
||||
#endregion
|
||||
|
||||
@ -1357,10 +1369,9 @@ namespace TJAPlayer3 {
|
||||
|
||||
#region [Display modals]
|
||||
|
||||
// Display modal is present
|
||||
for (int i = 0; i < TJAPlayer3.ConfigIni.nPlayerCount; i++) {
|
||||
if (displayedModals[i] != null)
|
||||
displayedModals[i].tDisplayModal();
|
||||
if (displayedModals != null) {
|
||||
lcModal?.Update();
|
||||
lcModal?.Draw();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@ -1415,90 +1426,59 @@ namespace TJAPlayer3 {
|
||||
|| (TJAPlayer3.Pad.bPressed(EInstrumentPad.DRUMS, EPad.LC)
|
||||
|| (TJAPlayer3.Pad.bPressedDGB(EPad.Decide)
|
||||
|| TJAPlayer3.InputManager.Keyboard.KeyPressed((int)SlimDXKeys.Key.Return))))) {
|
||||
TJAPlayer3.Skin.soundDecideSFX.tPlay();
|
||||
|
||||
|
||||
#region [ Skip animations ]
|
||||
|
||||
if (TJAPlayer3.stageSongSelect.nChoosenSongDifficulty[0] < (int)Difficulty.Tower
|
||||
&& this.actParameterPanel.ctMainCounter.CurrentValue < this.actParameterPanel.MountainAppearValue) {
|
||||
TJAPlayer3.Skin.soundDecideSFX.tPlay();
|
||||
this.actParameterPanel.tSkipResultAnimations();
|
||||
} else if (TJAPlayer3.stageSongSelect.nChoosenSongDifficulty[0] == (int)Difficulty.Dan
|
||||
&& (ctPhase1 != null && ctPhase1.IsUnEnded)) {
|
||||
TJAPlayer3.Skin.soundDecideSFX.tPlay();
|
||||
ctPhase1.CurrentValue = (int)ctPhase1.EndValue;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
else {
|
||||
if (!mqModals.tIsQueueEmpty(0)
|
||||
&& (
|
||||
TJAPlayer3.Pad.bPressedDGB(EPad.Decide)
|
||||
|| TJAPlayer3.InputManager.Keyboard.KeyPressed((int)SlimDXKeys.Key.Return)
|
||||
)
|
||||
) {
|
||||
displayedModals[0] = mqModals.tPopModal(0);
|
||||
displayedModals[0]?.tPlayModalSfx();
|
||||
} else if (TJAPlayer3.ConfigIni.nPlayerCount == 1 || mqModals.tAreBothQueuesEmpty()) {
|
||||
#region [ Return to song select screen ]
|
||||
if ((lcModal?.AnimationFinished() ?? true)) {
|
||||
TJAPlayer3.Skin.soundDecideSFX.tPlay();
|
||||
|
||||
actFI.tフェードアウト開始();
|
||||
if (!mqModals.tAreBothQueuesEmpty()
|
||||
&& (TJAPlayer3.Pad.bPressedDGB(EPad.Decide)
|
||||
|| TJAPlayer3.InputManager.Keyboard.KeyPressed((int)SlimDXKeys.Key.Return))) {
|
||||
displayedModals = mqModals.tPopModalInOrder();
|
||||
|
||||
if (TJAPlayer3.latestSongSelect == TJAPlayer3.stageSongSelect)
|
||||
if (TJAPlayer3.stageSongSelect.rNowSelectedSong.rParentNode != null)
|
||||
TJAPlayer3.stageSongSelect.actSongList.tCloseBOX();
|
||||
|
||||
tPostprocessing();
|
||||
} else if (TJAPlayer3.ConfigIni.nPlayerCount == 1 || mqModals.tAreBothQueuesEmpty()) {
|
||||
|
||||
{
|
||||
base.ePhaseID = CStage.EPhase.Common_FADEOUT;
|
||||
this.eフェードアウト完了時の戻り値 = E戻り値.完了;
|
||||
bgmResultLoop.tStop();
|
||||
TJAPlayer3.Skin.bgmDanResult.tStop();
|
||||
TJAPlayer3.Skin.bgmTowerResult.tStop();
|
||||
if (!mqModals.tAreBothQueuesEmpty())
|
||||
LogNotification.PopError("Unexpected Error: Exited results screen with remaining modals, this is likely due to a Lua script issue.");
|
||||
|
||||
#region [ Return to song select screen ]
|
||||
|
||||
actFI.tフェードアウト開始();
|
||||
|
||||
if (TJAPlayer3.latestSongSelect == TJAPlayer3.stageSongSelect)
|
||||
if (TJAPlayer3.stageSongSelect.rNowSelectedSong.rParentNode != null)
|
||||
TJAPlayer3.stageSongSelect.actSongList.tCloseBOX();
|
||||
|
||||
tPostprocessing();
|
||||
|
||||
{
|
||||
base.ePhaseID = CStage.EPhase.Common_FADEOUT;
|
||||
this.eフェードアウト完了時の戻り値 = E戻り値.完了;
|
||||
bgmResultLoop.tStop();
|
||||
TJAPlayer3.Skin.bgmDanResult.tStop();
|
||||
TJAPlayer3.Skin.bgmTowerResult.tStop();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
} else if ((TJAPlayer3.ConfigIni.nPlayerCount > 1 && (
|
||||
TJAPlayer3.Pad.bPressedDGB(EPad.LRed2P)
|
||||
|| TJAPlayer3.Pad.bPressedDGB(EPad.RRed2P)
|
||||
))) {
|
||||
if (!mqModals.tIsQueueEmpty(1) && this.actParameterPanel.ctMainCounter.CurrentValue >= this.actParameterPanel.MountainAppearValue) {
|
||||
TJAPlayer3.Skin.soundDecideSFX.tPlay();
|
||||
|
||||
displayedModals[1] = mqModals.tPopModal(1);
|
||||
displayedModals[1]?.tPlayModalSfx();
|
||||
}
|
||||
} else if ((TJAPlayer3.ConfigIni.nPlayerCount > 2 && (
|
||||
TJAPlayer3.Pad.bPressedDGB(EPad.LRed3P)
|
||||
|| TJAPlayer3.Pad.bPressedDGB(EPad.RRed3P)
|
||||
))) {
|
||||
if (!mqModals.tIsQueueEmpty(2) && this.actParameterPanel.ctMainCounter.CurrentValue >= this.actParameterPanel.MountainAppearValue) {
|
||||
TJAPlayer3.Skin.soundDecideSFX.tPlay();
|
||||
|
||||
displayedModals[2] = mqModals.tPopModal(2);
|
||||
displayedModals[2]?.tPlayModalSfx();
|
||||
}
|
||||
} else if ((TJAPlayer3.ConfigIni.nPlayerCount > 3 && (
|
||||
TJAPlayer3.Pad.bPressedDGB(EPad.LRed4P)
|
||||
|| TJAPlayer3.Pad.bPressedDGB(EPad.RRed4P)
|
||||
))) {
|
||||
if (!mqModals.tIsQueueEmpty(3) && this.actParameterPanel.ctMainCounter.CurrentValue >= this.actParameterPanel.MountainAppearValue) {
|
||||
TJAPlayer3.Skin.soundDecideSFX.tPlay();
|
||||
|
||||
displayedModals[3] = mqModals.tPopModal(3);
|
||||
displayedModals[3]?.tPlayModalSfx();
|
||||
}
|
||||
} else if ((TJAPlayer3.ConfigIni.nPlayerCount > 4 && (
|
||||
TJAPlayer3.Pad.bPressedDGB(EPad.LRed5P)
|
||||
|| TJAPlayer3.Pad.bPressedDGB(EPad.RRed5P)
|
||||
))) {
|
||||
if (!mqModals.tIsQueueEmpty(4) && this.actParameterPanel.ctMainCounter.CurrentValue >= this.actParameterPanel.MountainAppearValue) {
|
||||
TJAPlayer3.Skin.soundDecideSFX.tPlay();
|
||||
|
||||
displayedModals[4] = mqModals.tPopModal(4);
|
||||
displayedModals[4]?.tPlayModalSfx();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1804,7 +1784,7 @@ namespace TJAPlayer3 {
|
||||
|
||||
// Modal queues
|
||||
private ModalQueue mqModals;
|
||||
private Modal[] displayedModals;
|
||||
private Modal? displayedModals;
|
||||
|
||||
// Coins information
|
||||
private int[] nEarnedMedalsCount = { 0, 0, 0, 0, 0 };
|
||||
|
@ -2,23 +2,6 @@
|
||||
class CNamePlate {
|
||||
public CLuaNamePlateScript lcNamePlate { get; private set; }
|
||||
public void RefleshSkin() {
|
||||
/*
|
||||
for (int player = 0; player < 5; player++)
|
||||
{
|
||||
this.pfName[player]?.Dispose();
|
||||
|
||||
if (TJAPlayer3.SaveFileInstances[player].data.Title == "" || TJAPlayer3.SaveFileInstances[player].data.Title == null)
|
||||
this.pfName[player] = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.NamePlate_Font_Name_Size_Normal);
|
||||
else
|
||||
this.pfName[player] = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.NamePlate_Font_Name_Size_WithTitle);
|
||||
}
|
||||
|
||||
this.pfTitle?.Dispose();
|
||||
this.pfdan?.Dispose();
|
||||
|
||||
this.pfTitle = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.NamePlate_Font_Title_Size);
|
||||
this.pfdan = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.NamePlate_Font_Dan_Size);
|
||||
*/
|
||||
lcNamePlate?.Dispose();
|
||||
lcNamePlate = new CLuaNamePlateScript(CSkin.Path("Modules/NamePlate"));
|
||||
|
||||
@ -36,31 +19,8 @@
|
||||
|
||||
}
|
||||
RefleshSkin();
|
||||
|
||||
//ctNamePlateEffect = new CCounter(0, 120, 16.6f, TJAPlayer3.Timer);
|
||||
//ctAnimatedNamePlateTitle = new CCounter(0, 10000, 60.0f, TJAPlayer3.Timer);
|
||||
}
|
||||
|
||||
/*
|
||||
public void tNamePlateDisplayNamePlateBase(int x, int y, int item)
|
||||
{
|
||||
int namePlateBaseX = TJAPlayer3.Tx.NamePlateBase.szTextureSize.Width;
|
||||
int namePlateBaseY = TJAPlayer3.Tx.NamePlateBase.szTextureSize.Height / 12;
|
||||
|
||||
TJAPlayer3.Tx.NamePlateBase?.t2D描画(x, y, new RectangleF(0, item * namePlateBaseY, namePlateBaseX, namePlateBaseY));
|
||||
|
||||
}
|
||||
|
||||
public void tNamePlateDisplayNamePlate_Extension(int x, int y, int item)
|
||||
{
|
||||
int namePlateBaseX = TJAPlayer3.Tx.NamePlate_Extension.szTextureSize.Width;
|
||||
int namePlateBaseY = TJAPlayer3.Tx.NamePlate_Extension.szTextureSize.Height / 12;
|
||||
|
||||
TJAPlayer3.Tx.NamePlate_Extension?.t2D描画(x, y, new RectangleF(0, item * namePlateBaseY, namePlateBaseX, namePlateBaseY));
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
public void tNamePlateRefreshTitles(int player) {
|
||||
int actualPlayer = TJAPlayer3.GetActualPlayer(player);
|
||||
|
||||
@ -82,13 +42,6 @@
|
||||
}
|
||||
bIsPrevAI[player] = isAI;
|
||||
|
||||
/*
|
||||
txTitle[player] = TJAPlayer3.stageSongSelect.actSongList.ResolveTitleTexture(new TitleTextureKey(title, pfTitle, Color.Black, Color.Empty, 1000));
|
||||
txName[player] = TJAPlayer3.stageSongSelect.actSongList.ResolveTitleTexture(new TitleTextureKey(name, pfName[player], Color.White, Color.Black, 1000));
|
||||
if (TJAPlayer3.SaveFileInstances[player].data.DanGold) txdan[player] = TJAPlayer3.stageSongSelect.actSongList.ResolveTitleTexture(new TitleTextureKey($"<g.#FFE34A.#EA9622>{dan}</g>", pfdan, Color.White, Color.Black, 1000));
|
||||
else txdan[player] = TJAPlayer3.stageSongSelect.actSongList.ResolveTitleTexture(new TitleTextureKey(dan, pfdan, Color.White, Color.Black, 1000));
|
||||
*/
|
||||
|
||||
if (TJAPlayer3.SaveFileInstances[player].data.DanGold)
|
||||
lcNamePlate.SetInfos(player, name, title, $"<g.#FFE34A.#EA9622>{dan}</g>", TJAPlayer3.SaveFileInstances[player].data);
|
||||
else
|
||||
|