1
0
mirror of synced 2024-11-27 17:00:50 +01:00
This commit is contained in:
0auBSQ 2024-07-26 21:39:38 +09:00
parent 756a9370b0
commit 6ca0743f50
11 changed files with 1178 additions and 1445 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,5 @@
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;

View File

@ -193,14 +193,14 @@ namespace TJAPlayer3 {
[JsonProperty("titleType")] [JsonProperty("titleType")]
public int TitleType = 0; public int TitleType = 0;
[JsonIgnore] [JsonIgnore]
public int TitleRarityInt = 1; public int TitleRarityInt = 1;
[JsonIgnore] [JsonIgnore]
public int TitleId = -1; public int TitleId = -1;
[JsonProperty("puchiChara")] [JsonProperty("puchiChara")]
public string PuchiChara = "0"; public string PuchiChara = "0";
[JsonProperty("medals")] [JsonProperty("medals")]

View File

@ -1,26 +1,17 @@
using System; using System.Diagnostics;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Drawing; using System.Drawing;
using System.Diagnostics; using System.Globalization;
using System.IO;
using System.Threading;
using System.Net.NetworkInformation; using System.Net.NetworkInformation;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters.Binary; using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using DiscordRPC;
using FDK; using FDK;
using SampleFramework; using SampleFramework;
using System.Reflection;
using System.Threading.Tasks;
using System.Linq;
using Silk.NET.Maths; using Silk.NET.Maths;
using SkiaSharp; using SkiaSharp;
using DiscordRPC;
using Rectangle = System.Drawing.Rectangle; using Rectangle = System.Drawing.Rectangle;
using Point = System.Drawing.Point;
using Color = System.Drawing.Color;
using System.Runtime.InteropServices;
namespace TJAPlayer3 { namespace TJAPlayer3 {
internal class TJAPlayer3 : Game { internal class TJAPlayer3 : Game {
@ -2028,8 +2019,7 @@ for (int i = 0; i < 3; i++) {
if (r現在のステージ != null && r現在のステージ.eStageID != CStage.EStage.StartUp && TJAPlayer3.Tx.Network_Connection != null) { if (r現在のステージ != null && r現在のステージ.eStageID != CStage.EStage.StartUp && TJAPlayer3.Tx.Network_Connection != null) {
if (Math.Abs(SoundManager.PlayTimer.SystemTimeMs - this.ms) > 10000) { if (Math.Abs(SoundManager.PlayTimer.SystemTimeMs - this.ms) > 10000) {
this.ms = SoundManager.PlayTimer.SystemTimeMs; this.ms = SoundManager.PlayTimer.SystemTimeMs;
Task.Factory.StartNew(() => Task.Factory.StartNew(() => {
{
//IPv4 8.8.8.8にPingを送信する(timeout 5000ms) //IPv4 8.8.8.8にPingを送信する(timeout 5000ms)
PingReply reply = new Ping().Send("8.8.8.8", 5000); PingReply reply = new Ping().Send("8.8.8.8", 5000);
this.bネットワークに接続中 = reply.Status == IPStatus.Success; this.bネットワークに接続中 = reply.Status == IPStatus.Success;

View File

@ -142,25 +142,25 @@ namespace TJAPlayer3 {
while (reader.Read()) { while (reader.Read()) {
SaveFile sf = new SaveFile(); SaveFile sf = new SaveFile();
sf.data.SaveId = (Int64)reader["SaveId"]; sf.data.SaveId = (Int64)reader["SaveId"];
sf.data.Name = (string)reader["PlayerName"]; sf.data.Name = (string)reader["PlayerName"];
sf.data.Title = (string)reader["PlayerNameplateTitle"]; sf.data.Title = (string)reader["PlayerNameplateTitle"];
sf.data.Dan = (string)reader["PlayerDanTitle"]; sf.data.Dan = (string)reader["PlayerDanTitle"];
sf.data.DanGold = Convert.ToBoolean((Int64)reader["PlayerDanGold"]); sf.data.DanGold = Convert.ToBoolean((Int64)reader["PlayerDanGold"]);
sf.data.DanType = (int)(Int64)reader["PlayerDanType"]; sf.data.DanType = (int)(Int64)reader["PlayerDanType"];
sf.data.TitleType = (int)(Int64)reader["PlayerNameplateType"]; sf.data.TitleType = (int)(Int64)reader["PlayerNameplateType"];
sf.data.PuchiChara = (string)reader["PlayerPuchichara"]; sf.data.PuchiChara = (string)reader["PlayerPuchichara"];
sf.data.Character = (int)(Int64)reader["PlayerCharacter"]; sf.data.Character = (int)(Int64)reader["PlayerCharacter"];
sf.data.CharacterName = (string)reader["PlayerCharacterName"]; sf.data.CharacterName = (string)reader["PlayerCharacterName"];
sf.data.Medals = (Int64)reader["CurrentMedals"]; sf.data.Medals = (Int64)reader["CurrentMedals"];
sf.data.TotalEarnedMedals = (Int64)reader["TotalEarnedMedals"]; sf.data.TotalEarnedMedals = (Int64)reader["TotalEarnedMedals"];
sf.data.TotalPlaycount = (int)(Int64)reader["TotalPlaycount"]; sf.data.TotalPlaycount = (int)(Int64)reader["TotalPlaycount"];
sf.data.AIBattleModePlaycount = (int)(Int64)reader["AIBattleModePlaycount"]; sf.data.AIBattleModePlaycount = (int)(Int64)reader["AIBattleModePlaycount"];
sf.data.AIBattleModeWins = (int)(Int64)reader["AIBattleModeWins"]; sf.data.AIBattleModeWins = (int)(Int64)reader["AIBattleModeWins"];
sf.data.TitleRarityInt = (int)(Int64)reader["PlayerNameplateRarityInt"]; sf.data.TitleRarityInt = (int)(Int64)reader["PlayerNameplateRarityInt"];
sf.data.TitleId = (int)(Int64)reader["PlayerNameplateId"]; sf.data.TitleId = (int)(Int64)reader["PlayerNameplateId"];
sf.tInitSaveFile(); sf.tInitSaveFile();
sf.tLoadUnlockables(); sf.tLoadUnlockables();
_instances[_file] = sf; _instances[_file] = sf;
_file++; _file++;

View File

@ -23,28 +23,24 @@ namespace TJAPlayer3 {
} }
public string str項目名; public string str項目名;
public string strName public string strName {
{ get {
get return str項目名;
{
return str項目名;
} }
} }
public string str説明文; public string str説明文;
public string strDescription public string strDescription {
{ get {
get return str説明文;
{
return str説明文;
} }
} }
// コンストラクタ // コンストラクタ
public CItemBase() { public CItemBase() {
this.str項目名 = ""; this.str項目名 = "";
@ -110,13 +106,11 @@ namespace TJAPlayer3 {
return null; return null;
} }
public string tGetValueText() public string tGetValueText() {
{ object value = obj現在値();
object value = obj現在値(); return value == null ? "" : value.ToString();
return value == null ? "" : value.ToString(); }
} public virtual int GetIndex() {
public virtual int GetIndex()
{
return 0; return 0;
} }
public virtual void SetIndex(int index) { public virtual void SetIndex(int index) {

View File

@ -1,271 +1,231 @@
using System; using System.Diagnostics;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.Linq;
using System.Text; using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes; using System.Text.Json.Nodes;
using System.Threading.Tasks;
using FDK; using FDK;
using NLua; using NLua;
using static KeraLua.LuaGC;
using Silk.NET.OpenGLES;
using SkiaSharp;
using TJAPlayer3;
using static TJAPlayer3.CActSelect曲リスト; using static TJAPlayer3.CActSelect曲リスト;
namespace TJAPlayer3 namespace TJAPlayer3 {
{ class CLuaScript : IDisposable {
class CLuaScript : IDisposable private static List<CLuaScript> listScripts = new List<CLuaScript>();
{ public static void tReloadLanguage(string lang) {
private static List<CLuaScript> listScripts = new List<CLuaScript>(); foreach (var item in listScripts) {
public static void tReloadLanguage(string lang) item.ReloadLanguage(lang);
{ }
foreach (var item in listScripts) }
{
item.ReloadLanguage(lang);
}
}
public string strDir { get; private set; } public string strDir { get; private set; }
public string strTexturesDir { get; private set; } public string strTexturesDir { get; private set; }
public string strSounsdDir { get; private set; } public string strSounsdDir { get; private set; }
public bool bLoadedAssets { get; private set; } public bool bLoadedAssets { get; private set; }
public bool bDisposed { get; private set; } public bool bDisposed { get; private set; }
public bool bCrashed { get; protected set; } public bool bCrashed { get; protected set; }
protected Lua LuaScript { get; private set; } protected Lua LuaScript { get; private set; }
private LuaFunction lfLoadAssets; private LuaFunction lfLoadAssets;
private LuaFunction lfReloadLanguage; private LuaFunction lfReloadLanguage;
private CLuaInfo luaInfo; private CLuaInfo luaInfo;
private CLuaFps luaFPS = new CLuaFps(); private CLuaFps luaFPS = new CLuaFps();
private List<IDisposable> listDisposables = new List<IDisposable>(); private List<IDisposable> listDisposables = new List<IDisposable>();
protected bool Avaibale protected bool Avaibale {
{ get {
get return bLoadedAssets && !bDisposed && !bCrashed;
{ }
return bLoadedAssets && !bDisposed && !bCrashed; }
}
}
private double getNum(JsonValue x) private double getNum(JsonValue x) {
{ return (double)x;
return (double)x; }
}
private string getText(JsonValue x) private string getText(JsonValue x) {
{ return (string)x;
return (string)x; }
}
private List<double> getNumArray(JsonArray x) private List<double> getNumArray(JsonArray x) {
{ List<double> array = new List<double>();
List<double> array = new List<double>();
foreach (double value in x) foreach (double value in x) {
{ array.Add(value);
array.Add(value); }
} return array;
return array; }
}
private List<string> getTextArray(JsonArray x) private List<string> getTextArray(JsonArray x) {
{ List<string> array = new List<string>();
List<string> array = new List<string>();
foreach (string value in x) foreach (string value in x) {
{ array.Add(value);
array.Add(value); }
} return array;
return array; }
}
protected object[] RunLuaCode(LuaFunction luaFunction, params object[] args) protected object[] RunLuaCode(LuaFunction luaFunction, params object[] args) {
{ try {
try var ret = luaFunction.Call(args);
{
var ret = luaFunction.Call(args);
LuaScript.State.GarbageCollector(KeraLua.LuaGC.Collect, 0); LuaScript.State.GarbageCollector(KeraLua.LuaGC.Collect, 0);
return ret; return ret;
} } catch (Exception exception) {
catch (Exception exception) Crash(exception);
{ }
Crash(exception); return new object[0];
} }
return new object[0];
}
private JsonNode LoadConfig(string name) private JsonNode LoadConfig(string name) {
{ using Stream stream = File.OpenRead($"{strDir}/{name}");
using Stream stream = File.OpenRead($"{strDir}/{name}"); JsonNode jsonNode = JsonNode.Parse(stream);
JsonNode jsonNode = JsonNode.Parse(stream); return jsonNode;
return jsonNode; }
}
private CTexture LoadTexture(string name) private CTexture LoadTexture(string name) {
{ CTexture texture = new CTexture($"{strTexturesDir}/{name}", false);
CTexture texture = new CTexture($"{strTexturesDir}/{name}", false);
listDisposables.Add(texture); listDisposables.Add(texture);
return texture; return texture;
} }
private void DebugLog(string message) private void DebugLog(string message) {
{ Trace.TraceInformation("<Lua Log>: " + message);
Trace.TraceInformation("<Lua Log>: " + message); }
}
private CSound LoadSound(string name, string soundGroupName) private CSound LoadSound(string name, string soundGroupName) {
{ ESoundGroup soundGroup;
ESoundGroup soundGroup; switch (soundGroupName) {
switch (soundGroupName) case "soundeffect":
{ soundGroup = ESoundGroup.SoundEffect;
case "soundeffect": break;
soundGroup = ESoundGroup.SoundEffect; case "voice":
break; soundGroup = ESoundGroup.Voice;
case "voice": break;
soundGroup = ESoundGroup.Voice; case "songpreview":
break; soundGroup = ESoundGroup.SongPreview;
case "songpreview": break;
soundGroup = ESoundGroup.SongPreview; case "songplayback":
break; soundGroup = ESoundGroup.SongPlayback;
case "songplayback": break;
soundGroup = ESoundGroup.SongPlayback; default:
break; soundGroup = ESoundGroup.Unknown;
default: break;
soundGroup = ESoundGroup.Unknown; }
break; CSound sound = TJAPlayer3.SoundManager?.tCreateSound($"{strSounsdDir}/{name}", soundGroup);
}
CSound sound = TJAPlayer3.SoundManager?.tCreateSound($"{strSounsdDir}/{name}", soundGroup);
listDisposables.Add(sound); listDisposables.Add(sound);
return sound; return sound;
} }
private CCachedFontRenderer LoadFontRenderer(int size, string fontStyleName) private CCachedFontRenderer LoadFontRenderer(int size, string fontStyleName) {
{ CFontRenderer.FontStyle fontStyle;
CFontRenderer.FontStyle fontStyle; switch (fontStyleName) {
switch (fontStyleName) case "regular":
{ fontStyle = CFontRenderer.FontStyle.Regular;
case "regular": break;
fontStyle = CFontRenderer.FontStyle.Regular; case "bold":
break; fontStyle = CFontRenderer.FontStyle.Bold;
case "bold": break;
fontStyle = CFontRenderer.FontStyle.Bold; case "italic":
break; fontStyle = CFontRenderer.FontStyle.Italic;
case "italic": break;
fontStyle = CFontRenderer.FontStyle.Italic; case "underline":
break; fontStyle = CFontRenderer.FontStyle.Underline;
case "underline": break;
fontStyle = CFontRenderer.FontStyle.Underline; case "strikeout":
break; fontStyle = CFontRenderer.FontStyle.Strikeout;
case "strikeout": break;
fontStyle = CFontRenderer.FontStyle.Strikeout; default:
break; fontStyle = CFontRenderer.FontStyle.Regular;
default: break;
fontStyle = CFontRenderer.FontStyle.Regular; }
break; CCachedFontRenderer fontRenderer = HPrivateFastFont.tInstantiateMainFont(size, fontStyle);
}
CCachedFontRenderer fontRenderer = HPrivateFastFont.tInstantiateMainFont(size, fontStyle);
listDisposables.Add(fontRenderer); listDisposables.Add(fontRenderer);
return fontRenderer; return fontRenderer;
} }
private TitleTextureKey CreateTitleTextureKey(string title, CCachedFontRenderer fontRenderer, int maxSize, Color? color = null, Color? edgeColor = null) 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);
return new TitleTextureKey(title, fontRenderer, color ?? Color.White, edgeColor ?? Color.Black, maxSize); }
}
private CTexture GetTextTex(CActSelect曲リスト.TitleTextureKey titleTextureKey, bool vertical, bool keepCenter) private CTexture GetTextTex(CActSelect曲リスト.TitleTextureKey titleTextureKey, bool vertical, bool keepCenter) {
{ return TJAPlayer3.stageSongSelect.actSongList.ResolveTitleTexture(titleTextureKey, vertical, keepCenter);
return TJAPlayer3.stageSongSelect.actSongList.ResolveTitleTexture(titleTextureKey, vertical, keepCenter); }
}
public CLuaScript(string dir, string? texturesDir = null, string? soundsDir = null, bool loadAssets = true) public CLuaScript(string dir, string? texturesDir = null, string? soundsDir = null, bool loadAssets = true) {
{ strDir = dir;
strDir = dir; strTexturesDir = texturesDir ?? $"{dir}/Textures";
strTexturesDir = texturesDir ?? $"{dir}/Textures"; strSounsdDir = soundsDir ?? $"{dir}/Sounds";
strSounsdDir = soundsDir ?? $"{dir}/Sounds";
LuaScript = new Lua(); LuaScript = new Lua();
LuaScript.LoadCLRPackage(); LuaScript.LoadCLRPackage();
LuaScript.State.Encoding = Encoding.UTF8; LuaScript.State.Encoding = Encoding.UTF8;
LuaScript.DoFile($"{strDir}/Script.lua"); LuaScript.DoFile($"{strDir}/Script.lua");
LuaScript["info"] = luaInfo = new CLuaInfo(strDir); LuaScript["info"] = luaInfo = new CLuaInfo(strDir);
LuaScript["fps"] = luaFPS; LuaScript["fps"] = luaFPS;
lfLoadAssets = (LuaFunction)LuaScript["loadAssets"]; lfLoadAssets = (LuaFunction)LuaScript["loadAssets"];
lfReloadLanguage = (LuaFunction)LuaScript["reloadLanguage"]; lfReloadLanguage = (LuaFunction)LuaScript["reloadLanguage"];
LuaScript["loadConfig"] = LoadConfig; LuaScript["loadConfig"] = LoadConfig;
LuaScript["loadTexture"] = LoadTexture; LuaScript["loadTexture"] = LoadTexture;
LuaScript["loadSound"] = LoadSound; LuaScript["loadSound"] = LoadSound;
LuaScript["loadFontRenderer"] = LoadFontRenderer; LuaScript["loadFontRenderer"] = LoadFontRenderer;
LuaScript["createTitleTextureKey"] = CreateTitleTextureKey; LuaScript["createTitleTextureKey"] = CreateTitleTextureKey;
LuaScript["getTextTex"] = GetTextTex; LuaScript["getTextTex"] = GetTextTex;
LuaScript["getNum"] = getNum; LuaScript["getNum"] = getNum;
LuaScript["getText"] = getText; LuaScript["getText"] = getText;
LuaScript["getNumArray"] = getNumArray; LuaScript["getNumArray"] = getNumArray;
LuaScript["getTextArray"] = getTextArray; LuaScript["getTextArray"] = getTextArray;
LuaScript["displayDanPlate"] = CActSelect段位リスト.tDisplayDanPlate; LuaScript["displayDanPlate"] = CActSelect段位リスト.tDisplayDanPlate;
LuaScript["debugLog"] = DebugLog; LuaScript["debugLog"] = DebugLog;
if (loadAssets) LoadAssets(); if (loadAssets) LoadAssets();
listScripts.Add(this); listScripts.Add(this);
} }
public void LoadAssets(params object[] args) public void LoadAssets(params object[] args) {
{ if (bLoadedAssets) return;
if (bLoadedAssets) return;
RunLuaCode(lfLoadAssets, args); RunLuaCode(lfLoadAssets, args);
bLoadedAssets = true; bLoadedAssets = true;
bDisposed = false; bDisposed = false;
} }
public void ReloadLanguage(params object[] args) public void ReloadLanguage(params object[] args) {
{ RunLuaCode(lfReloadLanguage, args);
RunLuaCode(lfReloadLanguage, args); }
}
public void Dispose() public void Dispose() {
{ if (bDisposed) return;
if (bDisposed) return;
foreach (IDisposable disposable in listDisposables) foreach (IDisposable disposable in listDisposables) {
{ disposable.Dispose();
disposable.Dispose(); }
} listDisposables.Clear();
listDisposables.Clear();
LuaScript.Dispose(); LuaScript.Dispose();
bDisposed = true; bDisposed = true;
bLoadedAssets = false; bLoadedAssets = false;
listScripts.Remove(this); listScripts.Remove(this);
} }
private void Crash(Exception exception) private void Crash(Exception exception) {
{ bCrashed = true;
bCrashed = true;
LogNotification.PopError($"Lua Script Error: {exception.ToString()}"); LogNotification.PopError($"Lua Script Error: {exception.ToString()}");
} }
} }
} }

View File

@ -1,14 +1,6 @@
using System; namespace TJAPlayer3 {
using System.Collections.Generic; internal class CLuaFps {
using System.Linq; public double deltaTime => TJAPlayer3.FPS.DeltaTime;
using System.Text; public int fps => TJAPlayer3.FPS.NowFPS;
using System.Threading.Tasks; }
namespace TJAPlayer3
{
internal class CLuaFps
{
public double deltaTime => TJAPlayer3.FPS.DeltaTime;
public int fps => TJAPlayer3.FPS.NowFPS;
}
} }

View File

@ -1,24 +1,15 @@
using System; namespace TJAPlayer3 {
using System.Collections.Generic; internal class CLuaInfo {
using System.Linq; public int playerCount => TJAPlayer3.ConfigIni.nPlayerCount;
using System.Text; public string lang => TJAPlayer3.ConfigIni.sLang;
using System.Threading.Tasks; public bool simplemode => TJAPlayer3.ConfigIni.SimpleMode;
public bool p1IsBlue => TJAPlayer3.P1IsBlue();
public bool online => TJAPlayer3.app.bネットワークに接続中;
namespace TJAPlayer3 public string dir { get; init; }
{
internal class CLuaInfo
{
public int playerCount => TJAPlayer3.ConfigIni.nPlayerCount;
public string lang => TJAPlayer3.ConfigIni.sLang;
public bool simplemode => TJAPlayer3.ConfigIni.SimpleMode;
public bool p1IsBlue => TJAPlayer3.P1IsBlue();
public bool online => TJAPlayer3.app.bネットワークに接続中;
public string dir { get; init; } public CLuaInfo(string dir) {
this.dir = dir;
public CLuaInfo(string dir) }
{ }
this.dir = dir;
}
}
} }

View File

@ -1,72 +1,58 @@
using FDK; using FDK;
using NLua; using NLua;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TJAPlayer3 namespace TJAPlayer3 {
{ internal class CLuaNamePlateScript : CLuaScript {
internal class CLuaNamePlateScript : CLuaScript private LuaFunction lfGetCharaOffset;
{ private LuaFunction lfSetInfos;
private LuaFunction lfGetCharaOffset; private LuaFunction lfDrawDan;
private LuaFunction lfSetInfos; private LuaFunction lfDrawTitlePlate;
private LuaFunction lfDrawDan; private LuaFunction lfUpdate;
private LuaFunction lfDrawTitlePlate; private LuaFunction lfDraw;
private LuaFunction lfUpdate;
private LuaFunction lfDraw;
public CLuaNamePlateScript(string dir, string? texturesDir = null, string? soundsDir = null, bool loadAssets = true) : base(dir, texturesDir, soundsDir, loadAssets) public CLuaNamePlateScript(string dir, string? texturesDir = null, string? soundsDir = null, bool loadAssets = true) : base(dir, texturesDir, soundsDir, loadAssets) {
{ lfGetCharaOffset = (LuaFunction)LuaScript["getCharaOffset"];
lfGetCharaOffset = (LuaFunction)LuaScript["getCharaOffset"]; lfSetInfos = (LuaFunction)LuaScript["setInfos"];
lfSetInfos = (LuaFunction)LuaScript["setInfos"]; lfDrawDan = (LuaFunction)LuaScript["drawDan"];
lfDrawDan = (LuaFunction)LuaScript["drawDan"]; lfDrawTitlePlate = (LuaFunction)LuaScript["drawTitlePlate"];
lfDrawTitlePlate = (LuaFunction)LuaScript["drawTitlePlate"]; lfUpdate = (LuaFunction)LuaScript["update"];
lfUpdate = (LuaFunction)LuaScript["update"]; lfDraw = (LuaFunction)LuaScript["draw"];
lfDraw = (LuaFunction)LuaScript["draw"]; }
}
public int GetCharaOffset() public int GetCharaOffset() {
{ if (!Avaibale) return 0;
if (!Avaibale) return 0; double result = (double)RunLuaCode(lfGetCharaOffset)[0];
double result = (double)RunLuaCode(lfGetCharaOffset)[0]; return (int)result;
return (int)result; }
}
public void SetInfos(int player, string name, string title, string dan, SaveFile.Data data) public void SetInfos(int player, string name, string title, string dan, SaveFile.Data data) {
{ if (!Avaibale) return;
if (!Avaibale) return;
RunLuaCode(lfSetInfos, player, name ?? "", title ?? "", dan ?? "", data); RunLuaCode(lfSetInfos, player, name ?? "", title ?? "", dan ?? "", data);
} }
public void DrawDan(int x, int y, int opacity, int danGrade, CTexture titleTex) public void DrawDan(int x, int y, int opacity, int danGrade, CTexture titleTex) {
{ if (!Avaibale) return;
if (!Avaibale) return;
RunLuaCode(lfDrawDan, x, y, opacity, danGrade, titleTex); RunLuaCode(lfDrawDan, x, y, opacity, danGrade, titleTex);
} }
public void DrawTitlePlate(int x, int y, int opacity, int type, CTexture titleTex, int rarity, int nameplateId) public void DrawTitlePlate(int x, int y, int opacity, int type, CTexture titleTex, int rarity, int nameplateId) {
{ if (!Avaibale) return;
if (!Avaibale) return;
RunLuaCode(lfDrawTitlePlate, x, y, opacity, type, titleTex, rarity, nameplateId); RunLuaCode(lfDrawTitlePlate, x, y, opacity, type, titleTex, rarity, nameplateId);
} }
public void Update(params object[] args) public void Update(params object[] args) {
{ if (!Avaibale) return;
if (!Avaibale) return;
RunLuaCode(lfUpdate, args); RunLuaCode(lfUpdate, args);
} }
public void Draw(int x, int y, int opacity, int player, int side) public void Draw(int x, int y, int opacity, int player, int side) {
{ if (!Avaibale) return;
if (!Avaibale) return;
RunLuaCode(lfDraw, x, y, opacity, player, side); RunLuaCode(lfDraw, x, y, opacity, player, side);
} }
} }
} }

View File

@ -1,21 +1,8 @@
using FDK; namespace TJAPlayer3 {
using System; class CNamePlate {
using System.Collections.Generic; public CLuaNamePlateScript lcNamePlate { get; private set; }
using System.ComponentModel.Design; public void RefleshSkin() {
using System.Drawing; /*
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static TJAPlayer3.CActSelect曲リスト;
namespace TJAPlayer3
{
class CNamePlate
{
public CLuaNamePlateScript lcNamePlate { get; private set; }
public void RefleshSkin()
{
/*
for (int player = 0; player < 5; player++) for (int player = 0; player < 5; player++)
{ {
this.pfName[player]?.Dispose(); this.pfName[player]?.Dispose();
@ -32,32 +19,29 @@ namespace TJAPlayer3
this.pfTitle = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.NamePlate_Font_Title_Size); this.pfTitle = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.NamePlate_Font_Title_Size);
this.pfdan = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.NamePlate_Font_Dan_Size); this.pfdan = HPrivateFastFont.tInstantiateMainFont(TJAPlayer3.Skin.NamePlate_Font_Dan_Size);
*/ */
lcNamePlate?.Dispose(); lcNamePlate?.Dispose();
lcNamePlate = new CLuaNamePlateScript(CSkin.Path("Modules/NamePlate")); lcNamePlate = new CLuaNamePlateScript(CSkin.Path("Modules/NamePlate"));
for (int player = 0; player < 5; player++) for (int player = 0; player < 5; player++) {
{ tNamePlateRefreshTitles(player);
tNamePlateRefreshTitles(player); }
} }
}
public CNamePlate() public CNamePlate() {
{ for (int player = 0; player < 5; player++) {
for (int player = 0; player < 5; player++) if (TJAPlayer3.SaveFileInstances[player].data.DanType < 0) TJAPlayer3.SaveFileInstances[player].data.DanType = 0;
{ else if (TJAPlayer3.SaveFileInstances[player].data.DanType > 2) TJAPlayer3.SaveFileInstances[player].data.DanType = 2;
if (TJAPlayer3.SaveFileInstances[player].data.DanType < 0) TJAPlayer3.SaveFileInstances[player].data.DanType = 0;
else if (TJAPlayer3.SaveFileInstances[player].data.DanType > 2) TJAPlayer3.SaveFileInstances[player].data.DanType = 2;
if (TJAPlayer3.SaveFileInstances[player].data.TitleType < 0) TJAPlayer3.SaveFileInstances[player].data.TitleType = 0; if (TJAPlayer3.SaveFileInstances[player].data.TitleType < 0) TJAPlayer3.SaveFileInstances[player].data.TitleType = 0;
} }
RefleshSkin(); RefleshSkin();
//ctNamePlateEffect = new CCounter(0, 120, 16.6f, TJAPlayer3.Timer); //ctNamePlateEffect = new CCounter(0, 120, 16.6f, TJAPlayer3.Timer);
//ctAnimatedNamePlateTitle = new CCounter(0, 10000, 60.0f, TJAPlayer3.Timer); //ctAnimatedNamePlateTitle = new CCounter(0, 10000, 60.0f, TJAPlayer3.Timer);
} }
/* /*
public void tNamePlateDisplayNamePlateBase(int x, int y, int item) public void tNamePlateDisplayNamePlateBase(int x, int y, int item)
{ {
int namePlateBaseX = TJAPlayer3.Tx.NamePlateBase.szTextureSize.Width; int namePlateBaseX = TJAPlayer3.Tx.NamePlateBase.szTextureSize.Width;
@ -77,63 +61,57 @@ namespace TJAPlayer3
} }
*/ */
public void tNamePlateRefreshTitles(int player) public void tNamePlateRefreshTitles(int player) {
{ int actualPlayer = TJAPlayer3.GetActualPlayer(player);
int actualPlayer = TJAPlayer3.GetActualPlayer(player);
string[] stages = { "初", "二", "三", "四", "五", "六", "七", "八", "九", "極" }; string[] stages = { "初", "二", "三", "四", "五", "六", "七", "八", "九", "極" };
string name; string name;
string title; string title;
string dan; string dan;
bool isAI = TJAPlayer3.ConfigIni.bAIBattleMode && player == 1; bool isAI = TJAPlayer3.ConfigIni.bAIBattleMode && player == 1;
if (isAI) if (isAI) {
{ name = CLangManager.LangInstance.GetString("AI_NAME");
name = CLangManager.LangInstance.GetString("AI_NAME"); title = CLangManager.LangInstance.GetString("AI_TITLE");
title = CLangManager.LangInstance.GetString("AI_TITLE"); dan = stages[Math.Max(0, TJAPlayer3.ConfigIni.nAILevel - 1)] + "面";
dan = stages[Math.Max(0, TJAPlayer3.ConfigIni.nAILevel - 1)] + "面"; } else {
} name = TJAPlayer3.SaveFileInstances[player].data.Name;
else title = TJAPlayer3.SaveFileInstances[player].data.Title;
{ dan = TJAPlayer3.SaveFileInstances[player].data.Dan;
name = TJAPlayer3.SaveFileInstances[player].data.Name; }
title = TJAPlayer3.SaveFileInstances[player].data.Title; bIsPrevAI[player] = isAI;
dan = TJAPlayer3.SaveFileInstances[player].data.Dan;
}
bIsPrevAI[player] = isAI;
/* /*
txTitle[player] = TJAPlayer3.stageSongSelect.actSongList.ResolveTitleTexture(new TitleTextureKey(title, pfTitle, Color.Black, Color.Empty, 1000)); 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)); 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)); 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)); else txdan[player] = TJAPlayer3.stageSongSelect.actSongList.ResolveTitleTexture(new TitleTextureKey(dan, pfdan, Color.White, Color.Black, 1000));
*/ */
if (TJAPlayer3.SaveFileInstances[player].data.DanGold) if (TJAPlayer3.SaveFileInstances[player].data.DanGold)
lcNamePlate.SetInfos(player, name, title, $"<g.#FFE34A.#EA9622>{dan}</g>", TJAPlayer3.SaveFileInstances[player].data); lcNamePlate.SetInfos(player, name, title, $"<g.#FFE34A.#EA9622>{dan}</g>", TJAPlayer3.SaveFileInstances[player].data);
else else
lcNamePlate.SetInfos(player, name, title, dan, TJAPlayer3.SaveFileInstances[player].data); lcNamePlate.SetInfos(player, name, title, dan, TJAPlayer3.SaveFileInstances[player].data);
} }
public void tNamePlateDraw(int x, int y, int player, bool bTitle = false, int Opacity = 255) public void tNamePlateDraw(int x, int y, int player, bool bTitle = false, int Opacity = 255) {
{ float resolutionScaleX = TJAPlayer3.Skin.Resolution[0] / 1280.0f;
float resolutionScaleX = TJAPlayer3.Skin.Resolution[0] / 1280.0f; float resolutionScaleY = TJAPlayer3.Skin.Resolution[1] / 720.0f;
float resolutionScaleY = TJAPlayer3.Skin.Resolution[1] / 720.0f;
int basePlayer = player; int basePlayer = player;
player = TJAPlayer3.GetActualPlayer(player); player = TJAPlayer3.GetActualPlayer(player);
bool isAI = TJAPlayer3.ConfigIni.bAIBattleMode && basePlayer == 1; bool isAI = TJAPlayer3.ConfigIni.bAIBattleMode && basePlayer == 1;
if (bIsPrevAI[basePlayer] != isAI) if (bIsPrevAI[basePlayer] != isAI) {
{ tNamePlateRefreshTitles(player);
tNamePlateRefreshTitles(player); }
} bIsPrevAI[basePlayer] = isAI;
bIsPrevAI[basePlayer] = isAI;
lcNamePlate.Draw(x, y, Opacity, basePlayer, player); lcNamePlate.Draw(x, y, Opacity, basePlayer, player);
} }
private bool[] bIsPrevAI = new bool[5]; private bool[] bIsPrevAI = new bool[5];
} }
} }