1
0
mirror of synced 2025-02-17 19:09:25 +01:00

Few progress on the online song list

This commit is contained in:
0aubsq 2022-05-05 10:48:57 +02:00
parent 2aa0829bfc
commit f1f7dbe8a2
4 changed files with 99 additions and 3 deletions

View File

@ -1035,6 +1035,7 @@ namespace TJAPlayer3
OnlineLounge_Center_Menu_Bar = TxC(ONLINELOUNGE + @"Center_Menu_Bar.png");
OnlineLounge_Center_Menu_Box_Slot = TxC(ONLINELOUNGE + @"Center_Menu_Box_Slot.png");
OnlineLounge_Side_Menu = TxC(ONLINELOUNGE + @"Side_Menu.png");
OnlineLounge_Context = TxC(ONLINELOUNGE + @"Context.png");
OnlineLounge_Song_Box = TxC(ONLINELOUNGE + @"Song_Box.png");
#endregion
@ -1866,6 +1867,7 @@ namespace TJAPlayer3
OnlineLounge_Center_Menu_Bar,
OnlineLounge_Center_Menu_Box_Slot,
OnlineLounge_Side_Menu,
OnlineLounge_Context,
OnlineLounge_Song_Box;
#endregion

View File

@ -11,23 +11,62 @@ namespace TJAPlayer3
{
internal class API
{
public class APICharterInfo
{
string charter_name;
}
public class APISongData
{
public int Id;
public string SongTitle;
public string SongSubtitle;
public int D0; // Easy
public int D1; // Normal
public int D2; // Hard
public int D3; // Extreme
public int D4; // Extra
public int D5; // Tower
public int D6; // Dan
public int Life; // Tower only
public string Md5;
// Additional
public APICharterInfo charter;
}
#region [ContractResolver override for properties]
public class SongContractResolver : DefaultContractResolver
{
private Dictionary<string, string> PropertyMappings { get; set; }
private string GetAssignedLanguageValue(Dictionary<string, string> ens)
{
if (ens.ContainsKey(TJAPlayer3.ConfigIni.sLang))
return ens[TJAPlayer3.ConfigIni.sLang];
return ens["default"];
}
public SongContractResolver(DBCDN.CDNData cdnData)
{
this.PropertyMappings = new Dictionary<string, string>
{
{"SongTitle", cdnData.Hooks.title["default"]},
{"SongTitle", GetAssignedLanguageValue(cdnData.Hooks.title)},
{"SongSubtitle", GetAssignedLanguageValue(cdnData.Hooks.subtitle)},
{"Md5", GetAssignedLanguageValue(cdnData.Hooks.md5)},
{"Id", cdnData.Hooks.id},
{"D0", cdnData.Hooks.difficulties[0]},
{"D1", cdnData.Hooks.difficulties[1]},
{"D2", cdnData.Hooks.difficulties[2]},
{"D3", cdnData.Hooks.difficulties[3]},
{"D4", cdnData.Hooks.difficulties[4]},
{"D5", cdnData.Hooks.difficulties[5]},
{"D6", cdnData.Hooks.difficulties[6]},
{"Tower", cdnData.Hooks.life},
};
}
@ -82,13 +121,14 @@ namespace TJAPlayer3
var settings = new JsonSerializerSettings();
settings.ContractResolver = new SongContractResolver(cdnData);
settings.NullValueHandling = NullValueHandling.Ignore;
return JsonConvert.DeserializeObject<APISongData[]>(jsonString, settings);
}
}
}
catch (Exception e)
{
//throw e;
}
return null;
}

View File

@ -44,9 +44,16 @@ namespace TJAPlayer3
if (!string.IsNullOrEmpty(TJAPlayer3.ConfigIni.FontName))
{
this.pfOLFont = new CPrivateFastFont(new FontFamily(TJAPlayer3.ConfigIni.FontName), 14);
this.pfOLFontLarge = new CPrivateFastFont(new FontFamily(TJAPlayer3.ConfigIni.FontName), 28);
}
else
{
this.pfOLFont = new CPrivateFastFont(new FontFamily("MS UI Gothic"), 14);
this.pfOLFontLarge = new CPrivateFastFont(new FontFamily("MS UI Gothic"), 28);
}
dbCDN = TJAPlayer3.Databases.DBCDN;
@ -188,20 +195,58 @@ namespace TJAPlayer3
int pos = (_ref.Length * 5 + _selector + i) % _ref.Length;
CTexture tmpTex = TJAPlayer3.stage選曲.act曲リスト.ResolveTitleTexture(_ref[pos]);
CTexture tmpSubtitle = TJAPlayer3.stage選曲.act曲リスト.ResolveTitleTexture(ttkCDNSongSubtitles[pos]);
if (_selector != pos)
if (i != 0)
{
tmpTex.color4 = C変換.ColorToColor4(Color.DarkGray);
tmpSubtitle.color4 = C変換.ColorToColor4(Color.DarkGray);
TJAPlayer3.Tx.OnlineLounge_Song_Box?.tUpdateColor4(C変換.ColorToColor4(Color.DarkGray));
}
else
{
tmpTex.color4 = C変換.ColorToColor4(Color.White);
tmpSubtitle.color4 = C変換.ColorToColor4(Color.White);
TJAPlayer3.Tx.OnlineLounge_Song_Box?.tUpdateColor4(C変換.ColorToColor4(Color.White));
}
TJAPlayer3.Tx.OnlineLounge_Song_Box?.t2D拡大率考慮上中央基準描画(TJAPlayer3.app.Device, 350, baseY + 100 * i);
tmpTex.t2D拡大率考慮上中央基準描画(TJAPlayer3.app.Device, 350, baseY + 18 + 100 * i);
tmpSubtitle.t2D拡大率考慮上中央基準描画(TJAPlayer3.app.Device, 350, baseY + 46 + 100 * i);
if (pos != 0 && i == 0)
{
TJAPlayer3.Tx.OnlineLounge_Context.t2D描画(TJAPlayer3.app.Device, 0, 0);
var song_ = apiMethods.FetchedSongsList[pos - 1];
int[] diffs = new int[]
{
song_.D0,
song_.D1,
song_.D2,
song_.D3,
song_.D4,
song_.D5,
song_.D6,
};
for (int k = 0; k < (int)Difficulty.Total; k++)
{
if (diffs[k] > 0)
{
TJAPlayer3.Tx.Couse_Symbol[k]?.t2D中心基準描画(TJAPlayer3.app.Device, 800, 300 + 60 * k);
var difnb_ = TJAPlayer3.stage選曲.act曲リスト.ResolveTitleTexture(
new TitleTextureKey(diffs[k].ToString(), this.pfOLFontLarge, Color.White, Color.Black, 1000));
difnb_?.t2D中心基準描画(TJAPlayer3.app.Device, 900, 300 + 14 + 60 * k);
}
}
}
}
}
@ -325,12 +370,19 @@ namespace TJAPlayer3
#region [Generate song list values]
this.ttkCDNSongList = new TitleTextureKey[apiMethods.FetchedSongsList.Length + 1];
this.ttkCDNSongSubtitles = new TitleTextureKey[apiMethods.FetchedSongsList.Length + 1];
this.ttkCDNSongList[0] = new TitleTextureKey(CLangManager.LangInstance.GetString(401), this.pfOLFont, Color.White, Color.DarkRed, 1000);
this.ttkCDNSongSubtitles[0] = new TitleTextureKey("", this.pfOLFont, Color.White, Color.DarkRed, 1000);
for (int i = 0; i < apiMethods.FetchedSongsList.Length; i++)
{
this.ttkCDNSongList[i + 1] = new TitleTextureKey(apiMethods.FetchedSongsList[i].SongTitle, this.pfOLFont, Color.White, Color.DarkRed, 1000);
string subtitle_ = apiMethods.FetchedSongsList[i].SongSubtitle;
if (subtitle_.Length >= 2)
subtitle_ = subtitle_.Substring(2);
this.ttkCDNSongSubtitles[i + 1] = new TitleTextureKey(subtitle_, this.pfOLFont, Color.White, Color.DarkRed, 1000);
}
this.cdnSongListIndex = 0;
@ -430,6 +482,7 @@ namespace TJAPlayer3
private CPrivateFastFont pfOLFont;
private CPrivateFastFont pfOLFontLarge;
private DBCDN dbCDN;
private DBCDN.CDNData dbCDNData;
@ -451,6 +504,7 @@ namespace TJAPlayer3
// CDN List songs option
private TitleTextureKey[] ttkCDNSongList;
private TitleTextureKey[] ttkCDNSongSubtitles;
private int cdnSongListIndex;
private class CMenuInfo

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB