diff --git a/TJAPlayer3/Common/Discord.cs b/TJAPlayer3/Common/Discord.cs index d806ba8c..1e9a48a2 100644 --- a/TJAPlayer3/Common/Discord.cs +++ b/TJAPlayer3/Common/Discord.cs @@ -50,17 +50,21 @@ namespace TJAPlayer3 [DllImport("discord-rpc", EntryPoint = "Discord_Shutdown", CallingConvention = CallingConvention.Cdecl)] public static extern void Shutdown(); + /* [DllImport("discord-rpc", EntryPoint = "Discord_RunCallbacks", CallingConvention = CallingConvention.Cdecl)] public static extern void RunCallbacks(); + */ [DllImport("discord-rpc", EntryPoint = "Discord_UpdatePresence", CallingConvention = CallingConvention.Cdecl)] public static extern void UpdatePresence(ref RichPresence presence); + /* [DllImport("discord-rpc", EntryPoint = "Discord_ClearPresence", CallingConvention = CallingConvention.Cdecl)] public static extern void ClearPresence(); [DllImport("discord-rpc", EntryPoint = "Discord_UpdateHandlers", CallingConvention = CallingConvention.Cdecl)] public static extern void UpdateHandlers(ref EventHandlers handlers); + */ } public static class Discord @@ -100,8 +104,8 @@ namespace TJAPlayer3 if (startTimeStamp != 0) presence.startTimestamp = startTimeStamp; if (endTimeStamp != 0) presence.endTimestamp = endTimeStamp; - presence.largeImageKey = StrToPtr("rewrite"); - presence.largeImageText = StrToPtr("Ver." + TJAPlayer3.VERSION); + presence.largeImageKey = StrToPtr("OpenTaiko".ToLowerInvariant()); + presence.largeImageText = StrToPtr(TJAPlayer3.AppDisplayThreePartVersion); if (!string.IsNullOrEmpty(smallImageKey)) presence.smallImageKey = StrToPtr(smallImageKey); if (!string.IsNullOrEmpty(smallImageText)) presence.smallImageText = StrToPtr(smallImageText); diff --git a/TJAPlayer3/Stages/07.Game/CAct演奏ステージ失敗.cs b/TJAPlayer3/Stages/07.Game/CAct演奏ステージ失敗.cs index dff99259..bb1fe3cf 100644 --- a/TJAPlayer3/Stages/07.Game/CAct演奏ステージ失敗.cs +++ b/TJAPlayer3/Stages/07.Game/CAct演奏ステージ失敗.cs @@ -132,21 +132,21 @@ namespace TJAPlayer3 int[] y = new int[] { 0, 176 }; this.ctEnd_ClearFailed.t進行(); - if (this.ctEnd_ClearFailed.n現在の値 <= 20) + if (this.ctEnd_ClearFailed.n現在の値 <= 20 || TJAPlayer3.Tx.ClearFailed == null) { - TJAPlayer3.Tx.End_ClearFailed[this.ctEnd_ClearFailed.n現在の値].t2D描画(TJAPlayer3.app.Device, 505, y[i] + 145); + TJAPlayer3.Tx.End_ClearFailed[Math.Min(this.ctEnd_ClearFailed.n現在の値, TJAPlayer3.Tx.End_ClearFailed.Length - 1)]?.t2D描画(TJAPlayer3.app.Device, 505, y[i] + 145); } - if (this.ctEnd_ClearFailed.n現在の値 >= 20 && this.ctEnd_ClearFailed.n現在の値 <= 67) + else if(this.ctEnd_ClearFailed.n現在の値 >= 20 && this.ctEnd_ClearFailed.n現在の値 <= 67) { - TJAPlayer3.Tx.ClearFailed.t2D描画(TJAPlayer3.app.Device, 502, y[i] + 192); + TJAPlayer3.Tx.ClearFailed?.t2D描画(TJAPlayer3.app.Device, 502, y[i] + 192); } else if (this.ctEnd_ClearFailed.n現在の値 == 68) { - TJAPlayer3.Tx.ClearFailed1.t2D描画(TJAPlayer3.app.Device, 502, y[i] + 192); + TJAPlayer3.Tx.ClearFailed1?.t2D描画(TJAPlayer3.app.Device, 502, y[i] + 192); } else if (this.ctEnd_ClearFailed.n現在の値 >= 69) { - TJAPlayer3.Tx.ClearFailed2.t2D描画(TJAPlayer3.app.Device, 502, y[i] + 192); + TJAPlayer3.Tx.ClearFailed2?.t2D描画(TJAPlayer3.app.Device, 502, y[i] + 192); } } diff --git a/TJAPlayer3/Stages/07.Game/Taiko/CStage演奏ドラム画面.cs b/TJAPlayer3/Stages/07.Game/Taiko/CStage演奏ドラム画面.cs index 8030560d..fd5a6d63 100644 --- a/TJAPlayer3/Stages/07.Game/Taiko/CStage演奏ドラム画面.cs +++ b/TJAPlayer3/Stages/07.Game/Taiko/CStage演奏ドラム画面.cs @@ -288,13 +288,17 @@ namespace TJAPlayer3 // this.stream = new StreamWriter("noteTest.txt", false); //} // Discord Presence の更新 + var endTimeStamp = TJAPlayer3.DTX.listChip.Count == 0 + ? 0 + : Discord.GetUnixTime() + (long)TJAPlayer3.DTX.listChip[TJAPlayer3.DTX.listChip.Count - 1].n発声時刻ms / 1000; var difficultyName = TJAPlayer3.DifficultyNumberToEnum(TJAPlayer3.stage選曲.n確定された曲の難易度[0]).ToString(); + Discord.UpdatePresence(TJAPlayer3.ConfigIni.SendDiscordPlayingInformation ? TJAPlayer3.DTX.strファイル名 : "", Properties.Discord.Stage_InGame + (TJAPlayer3.ConfigIni.b太鼓パートAutoPlay == true ? " (" + Properties.Discord.Info_IsAuto + ")" : ""), 0, - Discord.GetUnixTime() + (long)TJAPlayer3.DTX.listChip[TJAPlayer3.DTX.listChip.Count - 1].n発声時刻ms / 1000, + endTimeStamp, TJAPlayer3.ConfigIni.SendDiscordPlayingInformation ? difficultyName.ToLower() : "", - TJAPlayer3.ConfigIni.SendDiscordPlayingInformation ? String.Format("COURSE:{0} ({1})", difficultyName, TJAPlayer3.stage選曲.n確定された曲の難易度) : ""); + TJAPlayer3.ConfigIni.SendDiscordPlayingInformation ? String.Format("COURSE:{0} ({1})", difficultyName, TJAPlayer3.stage選曲.n確定された曲の難易度[0]) : ""); } public override void On非活性化() { diff --git a/TJAPlayer3/Stages/08.Result/CStage結果.cs b/TJAPlayer3/Stages/08.Result/CStage結果.cs index 48b20db5..082d0afc 100644 --- a/TJAPlayer3/Stages/08.Result/CStage結果.cs +++ b/TJAPlayer3/Stages/08.Result/CStage結果.cs @@ -474,7 +474,7 @@ namespace TJAPlayer3 } // Discord Presenseの更新 - Discord.UpdatePresence(TJAPlayer3.DTX.TITLE + ".tja", Properties.Discord.Stage_Result + (TJAPlayer3.ConfigIni.b太鼓パートAutoPlay == true ? " (" + Properties.Discord.Info_IsAuto + ")" : ""), TJAPlayer3.StartupTime); + Discord.UpdatePresence(TJAPlayer3.DTX.strファイル名 + ".tja", Properties.Discord.Stage_Result + (TJAPlayer3.ConfigIni.b太鼓パートAutoPlay == true ? " (" + Properties.Discord.Info_IsAuto + ")" : ""), TJAPlayer3.StartupTime); #region [Earned medals] diff --git a/TJAPlayer3/TJAPlayer3.csproj b/TJAPlayer3/TJAPlayer3.csproj index d801c6e3..3ec0a3ec 100644 --- a/TJAPlayer3/TJAPlayer3.csproj +++ b/TJAPlayer3/TJAPlayer3.csproj @@ -104,9 +104,6 @@ True - - ..\Test\dll\Newtonsoft.Json.dll - @@ -352,6 +349,9 @@ 1.0.5 + + 13.0.1 + 1.3.1.2 diff --git a/Test/dll/Newtonsoft.Json.dll b/Test/dll/Newtonsoft.Json.dll index e4a63399..7af125a2 100644 Binary files a/Test/dll/Newtonsoft.Json.dll and b/Test/dll/Newtonsoft.Json.dll differ