1
0
mirror of synced 2025-01-18 09:04:47 +01:00

Externalise Puchicharas metadata, unlock informations and add welcome voice for them (#223)

This commit is contained in:
0aubsq 2022-06-04 19:52:08 +02:00
parent 43fc3056fb
commit fd0fc5f775
14 changed files with 145 additions and 23 deletions

View File

@ -56,7 +56,7 @@ namespace TJAPlayer3
public int On進行描画(int x, int y, bool isGrowing, int alpha = 255, bool isBalloon = false, int player = 0)
{
if (!TJAPlayer3.ConfigIni.ShowPuchiChara) return base.On進行描画();
if (Counter == null || SineCounter == null || TJAPlayer3.Tx.PuchiChara == null) return base.On進行描画();
if (Counter == null || SineCounter == null || TJAPlayer3.Tx.Puchichara == null) return base.On進行描画();
Counter.t進行Loop();
SineCounter.t進行LoopDb();
SineCounterIdle.t進行Loop();
@ -80,9 +80,11 @@ namespace TJAPlayer3
// TJAPlayer3.act文字コンソール.tPrint(700, 580, C文字コンソール.Eフォント種別.白, sineY.ToString());
int puriChar = Math.Max(0, Math.Min(TJAPlayer3.Skin.Puchichara_Ptn - 1, TJAPlayer3.NamePlateConfig.data.PuchiChara[p]));
var chara = TJAPlayer3.Tx.PuchiChara[puriChar];
int puriChar = Math.Max(0, Math.Min(TJAPlayer3.Skin.Puchichara_Ptn - 1, TJAPlayer3.NamePlateConfig.data.PuchiChara[p]));
var chara = TJAPlayer3.Tx.Puchichara[puriChar].tx;
//TJAPlayer3.Tx.PuchiChara[puriChar];
if (chara != null)
{

View File

@ -173,10 +173,10 @@ namespace TJAPlayer3
public Dictionary<string, CNamePlateTitle>[] NamePlateTitles = new Dictionary<string, CNamePlateTitle>[2];
[JsonProperty("unlockedPuchicharas")]
public List<int>[] UnlockedPuchicharas = new List<int>[2]
public List<string>[] UnlockedPuchicharas = new List<string>[2]
{
new List<int>(),
new List<int>()
new List<string>(),
new List<string>()
};
}

View File

@ -19,6 +19,13 @@ namespace TJAPlayer3
public class PuchicharaData
{
public PuchicharaData()
{
Name = "(None)";
Rarity = "Common";
Author = "(None)";
}
public PuchicharaData(string pcn, string pcr, string pca)
{
Name = pcn;

View File

@ -24,6 +24,13 @@ namespace TJAPlayer3
public class CUnlockConditions
{
public CUnlockConditions()
{
Condition = "";
Values = new int[]{ 0 };
Type = "me";
Reference = "";
}
public CUnlockConditions(string cd, int[] vl, string tp, string rf)
{
Condition = cd;
@ -51,6 +58,11 @@ namespace TJAPlayer3
[JsonIgnore]
private int RequiredArgCount = -1;
public bool tHasCondition()
{
return Condition != "";
}
/*
* == Types of conditions ==
* l : "Less than"

View File

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using FDK;
namespace TJAPlayer3
{
class CPuchichara
{
public CTexture tx;
public CSkin.Cシステムサウンド welcome;
public DBPuchichara.PuchicharaData metadata;
public DBUnlockables.CUnlockConditions unlock;
public string _path;
public CPuchichara(string path)
{
_path = path;
// Puchichara textures
tx = TJAPlayer3.Tx.TxCAbsolute($@"{path}\Chara.png");
if (tx != null)
{
tx.vc拡大縮小倍率 = new SharpDX.Vector3(TJAPlayer3.Skin.Game_PuchiChara_Scale[0]);
}
// Puchichara welcome sfx
welcome = new CSkin.Cシステムサウンド($@"{path}\Welcome.ogg", false, false, true, ESoundGroup.Voice);
// Puchichara metadata
if (File.Exists($@"{path}\Metadata.json"))
metadata = ConfigManager.GetConfig<DBPuchichara.PuchicharaData>($@"{path}\Metadata.json");
else
metadata = new DBPuchichara.PuchicharaData();
// Puchichara unlockables
if (File.Exists($@"{path}\Unlock.json"))
unlock = ConfigManager.GetConfig<DBUnlockables.CUnlockConditions>($@"{path}\Unlock.json");
else
unlock = null;
}
}
}

View File

@ -700,13 +700,18 @@ namespace TJAPlayer3
var puchicharaDirs = System.IO.Directory.GetDirectories(TJAPlayer3.strEXEのあるフォルダ + GLOBAL + PUCHICHARA);
TJAPlayer3.Skin.Puchichara_Ptn = puchicharaDirs.Length;
PuchiChara = new CTexture[TJAPlayer3.Skin.Puchichara_Ptn];
// Legacy
//PuchiChara = new CTexture[TJAPlayer3.Skin.Puchichara_Ptn];
Puchichara = new CPuchichara[TJAPlayer3.Skin.Puchichara_Ptn];
TJAPlayer3.Skin.Puchicharas_Name = new string[TJAPlayer3.Skin.Puchichara_Ptn];
for (int i = 0; i < TJAPlayer3.Skin.Puchichara_Ptn; i++)
{
PuchiChara[i] = TxCAbsolute($@"{puchicharaDirs[i]}\Chara.png");
PuchiChara[i].vc拡大縮小倍率 = new SharpDX.Vector3(TJAPlayer3.Skin.Game_PuchiChara_Scale[0]);
Puchichara[i] = new CPuchichara(puchicharaDirs[i]);
//PuchiChara[i] = TxCAbsolute($@"{puchicharaDirs[i]}\Chara.png");
//PuchiChara[i].vc拡大縮小倍率 = new SharpDX.Vector3(TJAPlayer3.Skin.Game_PuchiChara_Scale[0]);
TJAPlayer3.Skin.Puchicharas_Name[i] = System.IO.Path.GetFileName(puchicharaDirs[i]);
}
@ -1851,7 +1856,10 @@ namespace TJAPlayer3
public CTexture DanC_Screen;
#endregion
#region PuchiChara
public CTexture[] PuchiChara;
//public CTexture[] PuchiChara;
public CPuchichara[] Puchichara;
#endregion
#region Training
public CTexture Tokkun_DownBG,

View File

@ -128,6 +128,11 @@ namespace TJAPlayer3
for (int i = 0; i < iPuchiCharaCount; i++)
{
var textColor = tRarityToColor(TJAPlayer3.Tx.Puchichara[i].metadata.Rarity);
ttkPuchiCharaNames[i] = new TitleTextureKey(TJAPlayer3.Tx.Puchichara[i].metadata.Name, this.pfHeyaFont, textColor, Color.Black, 1000);
ttkPuchiCharaAuthors[i] = new TitleTextureKey(TJAPlayer3.Tx.Puchichara[i].metadata.Author, this.pfHeyaFont, Color.White, Color.Black, 1000);
/*
if (dbData.ContainsKey(i))
{
string rarity = dbData[i].Rarity;
@ -137,6 +142,7 @@ namespace TJAPlayer3
ttkPuchiCharaNames[i] = new TitleTextureKey(dbData[i].Name, this.pfHeyaFont, textColor, Color.Black, 1000);
ttkPuchiCharaAuthors[i] = new TitleTextureKey(dbData[i].Author, this.pfHeyaFont, Color.White, Color.Black, 1000);
}
*/
}
#endregion
@ -231,13 +237,13 @@ namespace TJAPlayer3
if (i != 0)
{
TJAPlayer3.Tx.PuchiChara[pos]?.tUpdateColor4(C変換.ColorToColor4(Color.DarkGray));
TJAPlayer3.Tx.Puchichara[pos].tx?.tUpdateColor4(C変換.ColorToColor4(Color.DarkGray));
TJAPlayer3.Tx.Heya_Center_Menu_Box_Slot?.tUpdateColor4(C変換.ColorToColor4(Color.DarkGray));
TJAPlayer3.Tx.Heya_Lock?.tUpdateColor4(C変換.ColorToColor4(Color.DarkGray));
}
else
{
TJAPlayer3.Tx.PuchiChara[pos]?.tUpdateColor4(C変換.ColorToColor4(Color.White));
TJAPlayer3.Tx.Puchichara[pos].tx?.tUpdateColor4(C変換.ColorToColor4(Color.White));
TJAPlayer3.Tx.Heya_Center_Menu_Box_Slot?.tUpdateColor4(C変換.ColorToColor4(Color.White));
TJAPlayer3.Tx.Heya_Lock?.tUpdateColor4(C変換.ColorToColor4(Color.White));
}
@ -247,13 +253,13 @@ namespace TJAPlayer3
int puriColumn = pos % 5;
int puriRow = pos / 5;
TJAPlayer3.Tx.PuchiChara[pos]?.t2D拡大率考慮中央基準描画(TJAPlayer3.app.Device, (620 + 302 * i) + scroll, 320 + (int)(PuchiChara.sineY),
TJAPlayer3.Tx.Puchichara[pos].tx?.t2D拡大率考慮中央基準描画(TJAPlayer3.app.Device, (620 + 302 * i) + scroll, 320 + (int)(PuchiChara.sineY),
new Rectangle((PuchiChara.Counter.n現在の値 + 2 * puriColumn) * TJAPlayer3.Skin.Game_PuchiChara[0],
puriRow * TJAPlayer3.Skin.Game_PuchiChara[1],
TJAPlayer3.Skin.Game_PuchiChara[0],
TJAPlayer3.Skin.Game_PuchiChara[1]));
TJAPlayer3.Tx.PuchiChara[pos]?.tUpdateColor4(C変換.ColorToColor4(Color.White));
TJAPlayer3.Tx.Puchichara[pos].tx?.tUpdateColor4(C変換.ColorToColor4(Color.White));
#region [Database related values]
@ -271,8 +277,8 @@ namespace TJAPlayer3
tmpTex.t2D拡大率考慮上中央基準描画(TJAPlayer3.app.Device, (620 + 302 * i) + scroll, 460);
}
if (puchiUnlockables.ContainsKey(pos)
&& !TJAPlayer3.NamePlateConfig.data.UnlockedPuchicharas[iPlayer].Contains(pos))
if (TJAPlayer3.Tx.Puchichara[pos].unlock != null
&& !TJAPlayer3.NamePlateConfig.data.UnlockedPuchicharas[iPlayer].Contains(TJAPlayer3.Skin.Puchicharas_Name[pos]))
TJAPlayer3.Tx.Heya_Lock?.t2D拡大率考慮上中央基準描画(TJAPlayer3.app.Device, (620 + 302 * i) + scroll, 200);
#endregion
@ -529,17 +535,16 @@ namespace TJAPlayer3
if (ess == ESelectStatus.SELECTED)
{
TJAPlayer3.NamePlateConfig.data.PuchiChara[iPlayer] = iPuchiCharaCurrent;
TJAPlayer3.NamePlateConfig.tApplyHeyaChanges();
TJAPlayer3.Tx.Puchichara[iPuchiCharaCurrent].welcome.t再生する();
iCurrentMenu = -1;
this.tResetOpts();
}
else if (ess == ESelectStatus.SUCCESS)
{
TJAPlayer3.NamePlateConfig.data.UnlockedPuchicharas[iPlayer].Add(iPuchiCharaCurrent);
TJAPlayer3.NamePlateConfig.tSpendCoins(puchiUnlockables[iPuchiCharaCurrent].Values[0], iPlayer);
TJAPlayer3.NamePlateConfig.data.UnlockedPuchicharas[iPlayer].Add(TJAPlayer3.Skin.Puchicharas_Name[iPuchiCharaCurrent]);
TJAPlayer3.NamePlateConfig.tSpendCoins(TJAPlayer3.Tx.Puchichara[iPuchiCharaCurrent].unlock.Values[0], iPlayer);
}
}
@ -783,13 +788,20 @@ namespace TJAPlayer3
{
#region [Check unlockable]
if (puchiUnlockables.ContainsKey(iPuchiCharaCurrent)
/*if (puchiUnlockables.ContainsKey(iPuchiCharaCurrent)
&& !TJAPlayer3.NamePlateConfig.data.UnlockedPuchicharas[iPlayer].Contains(iPuchiCharaCurrent))
{
// To update then when bought unlockables will be implemented
this.ttkInfoSection = new TitleTextureKey(puchiUnlockables[iPuchiCharaCurrent].tConditionMessage()
, this.pfHeyaFont, Color.White, Color.Black, 1000);
}
*/
if (TJAPlayer3.Tx.Puchichara[iPuchiCharaCurrent].unlock != null
&& !TJAPlayer3.NamePlateConfig.data.UnlockedPuchicharas[iPlayer].Contains(TJAPlayer3.Skin.Puchicharas_Name[iPuchiCharaCurrent]))
{
this.ttkInfoSection = new TitleTextureKey(TJAPlayer3.Tx.Puchichara[iPuchiCharaCurrent].unlock.tConditionMessage()
, this.pfHeyaFont, Color.White, Color.Black, 1000);
}
else
this.ttkInfoSection = null;
@ -799,6 +811,7 @@ namespace TJAPlayer3
private ESelectStatus tSelectPuchi()
{
// Add "If unlocked" to select directly
/*
if (puchiUnlockables.ContainsKey(iPuchiCharaCurrent)
&& !TJAPlayer3.NamePlateConfig.data.UnlockedPuchicharas[iPlayer].Contains(iPuchiCharaCurrent))
{
@ -812,6 +825,21 @@ namespace TJAPlayer3
return (response.Item1) ? ESelectStatus.SUCCESS : ESelectStatus.FAILED;
}
*/
if (TJAPlayer3.Tx.Puchichara[iPuchiCharaCurrent].unlock != null
&& !TJAPlayer3.NamePlateConfig.data.UnlockedPuchicharas[iPlayer].Contains(TJAPlayer3.Skin.Puchicharas_Name[iPuchiCharaCurrent]))
{
(bool, string) response = TJAPlayer3.Tx.Puchichara[iPuchiCharaCurrent].unlock.tConditionMet(
new int[] { TJAPlayer3.NamePlateConfig.data.Medals[TJAPlayer3.SaveFile] });
Color responseColor = (response.Item1) ? Color.Lime : Color.Red;
// Send coins here for the unlock, considering that only coin-paid puchicharas can be unlocked directly from the Heya menu
this.ttkInfoSection = new TitleTextureKey(response.Item2, this.pfHeyaFont, responseColor, Color.Black, 1000);
return (response.Item1) ? ESelectStatus.SUCCESS : ESelectStatus.FAILED;
}
this.ttkInfoSection = null;
return ESelectStatus.SELECTED;
@ -826,7 +854,7 @@ namespace TJAPlayer3
private TitleTextureKey[] ttkMainMenuOpt;
private CPrivateFastFont pfHeyaFont;
private Dictionary<int, DBUnlockables.CUnlockConditions> puchiUnlockables = TJAPlayer3.Databases.DBUnlockables.data.Puchichara;
//private Dictionary<int, DBUnlockables.CUnlockConditions> puchiUnlockables = TJAPlayer3.Databases.DBUnlockables.data.Puchichara;
private TitleTextureKey[] ttkDanTitles;

View File

@ -147,6 +147,7 @@
<Compile Include="I18N\CLang_jp.cs" />
<Compile Include="I18N\CLang_zh.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Stages\01.StartUp\CPuchichara.cs" />
<Compile Include="Stages\07.Game\Taiko\NotesManager.cs" />
<Compile Include="Stages\XX.Templates\CStageTemplate.cs" />
<EmbeddedResource Include="Properties\Discord.resx">

View File

@ -0,0 +1,5 @@
{
"name" : "None",
"rarity": "Common",
"author": "-",
}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1,5 @@
{
"name" : "Placeholder",
"rarity": "Uncommon",
"author": "[Author]",
}

View File

@ -0,0 +1,7 @@
{
"condition": "ch",
"type": "me",
"values": [
10,
],
}

Binary file not shown.