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.Globalization;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;

View File

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

View File

@ -1,26 +1,17 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.Diagnostics;
using System.Drawing;
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Globalization;
using System.Net.NetworkInformation;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using DiscordRPC;
using FDK;
using SampleFramework;
using System.Reflection;
using System.Threading.Tasks;
using System.Linq;
using Silk.NET.Maths;
using SkiaSharp;
using DiscordRPC;
using Rectangle = System.Drawing.Rectangle;
using Point = System.Drawing.Point;
using Color = System.Drawing.Color;
using System.Runtime.InteropServices;
namespace TJAPlayer3 {
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 (Math.Abs(SoundManager.PlayTimer.SystemTimeMs - this.ms) > 10000) {
this.ms = SoundManager.PlayTimer.SystemTimeMs;
Task.Factory.StartNew(() =>
{
Task.Factory.StartNew(() => {
//IPv4 8.8.8.8にPingを送信する(timeout 5000ms)
PingReply reply = new Ping().Send("8.8.8.8", 5000);
this.bネットワークに接続中 = reply.Status == IPStatus.Success;

View File

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

View File

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

View File

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

View File

@ -1,14 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TJAPlayer3
{
internal class CLuaFps
{
public double deltaTime => TJAPlayer3.FPS.DeltaTime;
public int fps => TJAPlayer3.FPS.NowFPS;
}
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;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TJAPlayer3 {
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ネットワークに接続中;
namespace TJAPlayer3
{
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 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 NLua;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TJAPlayer3
{
internal class CLuaNamePlateScript : CLuaScript
{
private LuaFunction lfGetCharaOffset;
private LuaFunction lfSetInfos;
private LuaFunction lfDrawDan;
private LuaFunction lfDrawTitlePlate;
private LuaFunction lfUpdate;
private LuaFunction lfDraw;
namespace TJAPlayer3 {
internal class CLuaNamePlateScript : CLuaScript {
private LuaFunction lfGetCharaOffset;
private LuaFunction lfSetInfos;
private LuaFunction lfDrawDan;
private LuaFunction lfDrawTitlePlate;
private LuaFunction lfUpdate;
private LuaFunction lfDraw;
public CLuaNamePlateScript(string dir, string? texturesDir = null, string? soundsDir = null, bool loadAssets = true) : base(dir, texturesDir, soundsDir, loadAssets)
{
lfGetCharaOffset = (LuaFunction)LuaScript["getCharaOffset"];
lfSetInfos = (LuaFunction)LuaScript["setInfos"];
lfDrawDan = (LuaFunction)LuaScript["drawDan"];
lfDrawTitlePlate = (LuaFunction)LuaScript["drawTitlePlate"];
lfUpdate = (LuaFunction)LuaScript["update"];
lfDraw = (LuaFunction)LuaScript["draw"];
}
public CLuaNamePlateScript(string dir, string? texturesDir = null, string? soundsDir = null, bool loadAssets = true) : base(dir, texturesDir, soundsDir, loadAssets) {
lfGetCharaOffset = (LuaFunction)LuaScript["getCharaOffset"];
lfSetInfos = (LuaFunction)LuaScript["setInfos"];
lfDrawDan = (LuaFunction)LuaScript["drawDan"];
lfDrawTitlePlate = (LuaFunction)LuaScript["drawTitlePlate"];
lfUpdate = (LuaFunction)LuaScript["update"];
lfDraw = (LuaFunction)LuaScript["draw"];
}
public int GetCharaOffset()
{
if (!Avaibale) return 0;
double result = (double)RunLuaCode(lfGetCharaOffset)[0];
return (int)result;
}
public int GetCharaOffset() {
if (!Avaibale) 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;
public void SetInfos(int player, string name, string title, string dan, SaveFile.Data data) {
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)
{
if (!Avaibale) return;
public void DrawDan(int x, int y, int opacity, int danGrade, CTexture titleTex) {
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)
{
if (!Avaibale) return;
public void DrawTitlePlate(int x, int y, int opacity, int type, CTexture titleTex, int rarity, int nameplateId) {
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)
{
if (!Avaibale) return;
public void Update(params object[] args) {
if (!Avaibale) return;
RunLuaCode(lfUpdate, args);
}
RunLuaCode(lfUpdate, args);
}
public void Draw(int x, int y, int opacity, int player, int side)
{
if (!Avaibale) return;
public void Draw(int x, int y, int opacity, int player, int side) {
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;
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
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()
{
/*
namespace TJAPlayer3 {
class CNamePlate {
public CLuaNamePlateScript lcNamePlate { get; private set; }
public void RefleshSkin() {
/*
for (int player = 0; player < 5; player++)
{
this.pfName[player]?.Dispose();
@ -32,32 +19,29 @@ namespace TJAPlayer3
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"));
lcNamePlate?.Dispose();
lcNamePlate = new CLuaNamePlateScript(CSkin.Path("Modules/NamePlate"));
for (int player = 0; player < 5; player++)
{
tNamePlateRefreshTitles(player);
}
}
for (int player = 0; player < 5; player++) {
tNamePlateRefreshTitles(player);
}
}
public CNamePlate()
{
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;
public CNamePlate() {
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.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);
//ctAnimatedNamePlateTitle = new CCounter(0, 10000, 60.0f, TJAPlayer3.Timer);
}
//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;
@ -77,63 +61,57 @@ namespace TJAPlayer3
}
*/
public void tNamePlateRefreshTitles(int player)
{
int actualPlayer = TJAPlayer3.GetActualPlayer(player);
public void tNamePlateRefreshTitles(int player) {
int actualPlayer = TJAPlayer3.GetActualPlayer(player);
string[] stages = { "初", "二", "三", "四", "五", "六", "七", "八", "九", "極" };
string[] stages = { "初", "二", "三", "四", "五", "六", "七", "八", "九", "極" };
string name;
string title;
string dan;
string name;
string title;
string dan;
bool isAI = TJAPlayer3.ConfigIni.bAIBattleMode && player == 1;
if (isAI)
{
name = CLangManager.LangInstance.GetString("AI_NAME");
title = CLangManager.LangInstance.GetString("AI_TITLE");
dan = stages[Math.Max(0, TJAPlayer3.ConfigIni.nAILevel - 1)] + "面";
}
else
{
name = TJAPlayer3.SaveFileInstances[player].data.Name;
title = TJAPlayer3.SaveFileInstances[player].data.Title;
dan = TJAPlayer3.SaveFileInstances[player].data.Dan;
}
bIsPrevAI[player] = isAI;
bool isAI = TJAPlayer3.ConfigIni.bAIBattleMode && player == 1;
if (isAI) {
name = CLangManager.LangInstance.GetString("AI_NAME");
title = CLangManager.LangInstance.GetString("AI_TITLE");
dan = stages[Math.Max(0, TJAPlayer3.ConfigIni.nAILevel - 1)] + "面";
} else {
name = TJAPlayer3.SaveFileInstances[player].data.Name;
title = TJAPlayer3.SaveFileInstances[player].data.Title;
dan = TJAPlayer3.SaveFileInstances[player].data.Dan;
}
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
lcNamePlate.SetInfos(player, name, title, dan, TJAPlayer3.SaveFileInstances[player].data);
}
if (TJAPlayer3.SaveFileInstances[player].data.DanGold)
lcNamePlate.SetInfos(player, name, title, $"<g.#FFE34A.#EA9622>{dan}</g>", TJAPlayer3.SaveFileInstances[player].data);
else
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)
{
float resolutionScaleX = TJAPlayer3.Skin.Resolution[0] / 1280.0f;
float resolutionScaleY = TJAPlayer3.Skin.Resolution[1] / 720.0f;
public void tNamePlateDraw(int x, int y, int player, bool bTitle = false, int Opacity = 255) {
float resolutionScaleX = TJAPlayer3.Skin.Resolution[0] / 1280.0f;
float resolutionScaleY = TJAPlayer3.Skin.Resolution[1] / 720.0f;
int basePlayer = player;
player = TJAPlayer3.GetActualPlayer(player);
int basePlayer = player;
player = TJAPlayer3.GetActualPlayer(player);
bool isAI = TJAPlayer3.ConfigIni.bAIBattleMode && basePlayer == 1;
if (bIsPrevAI[basePlayer] != isAI)
{
tNamePlateRefreshTitles(player);
}
bIsPrevAI[basePlayer] = isAI;
bool isAI = TJAPlayer3.ConfigIni.bAIBattleMode && basePlayer == 1;
if (bIsPrevAI[basePlayer] != isAI) {
tNamePlateRefreshTitles(player);
}
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];
}
}