From 203b607074a644dd00fe1a25102d278e73767317 Mon Sep 17 00:00:00 2001 From: "NGnius (Graham)" Date: Sat, 4 Jul 2020 15:05:17 -0400 Subject: [PATCH] Rename to GameSDKcraft with tweaks --- GamecraftRPC.sln => GameSDKcraft.sln | 2 +- .../CallbackUtility.cs | 0 .../Discord/ActivityManager.cs | 0 .../Discord/Constants.cs | 0 .../Discord/Core.cs | 0 .../Discord/ImageManager.cs | 0 .../Discord/LobbyManager.cs | 0 .../Discord/StorageManager.cs | 0 .../Discord/StoreManager.cs | 0 .../Engines/PlayerCountEngine.cs | 0 .../GameSDKcraft.csproj | 2 +- {GamecraftRPC => GameSDKcraft}/Plugin.cs | 21 +++++++++++++++---- .../PresenceUtility.cs | 0 13 files changed, 19 insertions(+), 6 deletions(-) rename GamecraftRPC.sln => GameSDKcraft.sln (88%) rename {GamecraftRPC => GameSDKcraft}/CallbackUtility.cs (100%) rename {GamecraftRPC => GameSDKcraft}/Discord/ActivityManager.cs (100%) rename {GamecraftRPC => GameSDKcraft}/Discord/Constants.cs (100%) rename {GamecraftRPC => GameSDKcraft}/Discord/Core.cs (100%) rename {GamecraftRPC => GameSDKcraft}/Discord/ImageManager.cs (100%) rename {GamecraftRPC => GameSDKcraft}/Discord/LobbyManager.cs (100%) rename {GamecraftRPC => GameSDKcraft}/Discord/StorageManager.cs (100%) rename {GamecraftRPC => GameSDKcraft}/Discord/StoreManager.cs (100%) rename {GamecraftRPC => GameSDKcraft}/Engines/PlayerCountEngine.cs (100%) rename GamecraftRPC/GamecraftRPC.csproj => GameSDKcraft/GameSDKcraft.csproj (99%) rename {GamecraftRPC => GameSDKcraft}/Plugin.cs (90%) rename {GamecraftRPC => GameSDKcraft}/PresenceUtility.cs (100%) diff --git a/GamecraftRPC.sln b/GameSDKcraft.sln similarity index 88% rename from GamecraftRPC.sln rename to GameSDKcraft.sln index 4b1b05c..716339f 100644 --- a/GamecraftRPC.sln +++ b/GameSDKcraft.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29609.76 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GamecraftRPC", "GamecraftRPC\GamecraftRPC.csproj", "{E0EEA15D-AB3C-4C73-A000-C49B5AE9EA66}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GameSDKcraft", "GameSDKcraft\GameSDKcraft.csproj", "{E0EEA15D-AB3C-4C73-A000-C49B5AE9EA66}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/GamecraftRPC/CallbackUtility.cs b/GameSDKcraft/CallbackUtility.cs similarity index 100% rename from GamecraftRPC/CallbackUtility.cs rename to GameSDKcraft/CallbackUtility.cs diff --git a/GamecraftRPC/Discord/ActivityManager.cs b/GameSDKcraft/Discord/ActivityManager.cs similarity index 100% rename from GamecraftRPC/Discord/ActivityManager.cs rename to GameSDKcraft/Discord/ActivityManager.cs diff --git a/GamecraftRPC/Discord/Constants.cs b/GameSDKcraft/Discord/Constants.cs similarity index 100% rename from GamecraftRPC/Discord/Constants.cs rename to GameSDKcraft/Discord/Constants.cs diff --git a/GamecraftRPC/Discord/Core.cs b/GameSDKcraft/Discord/Core.cs similarity index 100% rename from GamecraftRPC/Discord/Core.cs rename to GameSDKcraft/Discord/Core.cs diff --git a/GamecraftRPC/Discord/ImageManager.cs b/GameSDKcraft/Discord/ImageManager.cs similarity index 100% rename from GamecraftRPC/Discord/ImageManager.cs rename to GameSDKcraft/Discord/ImageManager.cs diff --git a/GamecraftRPC/Discord/LobbyManager.cs b/GameSDKcraft/Discord/LobbyManager.cs similarity index 100% rename from GamecraftRPC/Discord/LobbyManager.cs rename to GameSDKcraft/Discord/LobbyManager.cs diff --git a/GamecraftRPC/Discord/StorageManager.cs b/GameSDKcraft/Discord/StorageManager.cs similarity index 100% rename from GamecraftRPC/Discord/StorageManager.cs rename to GameSDKcraft/Discord/StorageManager.cs diff --git a/GamecraftRPC/Discord/StoreManager.cs b/GameSDKcraft/Discord/StoreManager.cs similarity index 100% rename from GamecraftRPC/Discord/StoreManager.cs rename to GameSDKcraft/Discord/StoreManager.cs diff --git a/GamecraftRPC/Engines/PlayerCountEngine.cs b/GameSDKcraft/Engines/PlayerCountEngine.cs similarity index 100% rename from GamecraftRPC/Engines/PlayerCountEngine.cs rename to GameSDKcraft/Engines/PlayerCountEngine.cs diff --git a/GamecraftRPC/GamecraftRPC.csproj b/GameSDKcraft/GameSDKcraft.csproj similarity index 99% rename from GamecraftRPC/GamecraftRPC.csproj rename to GameSDKcraft/GameSDKcraft.csproj index 1ed4f7c..2c1f97a 100644 --- a/GamecraftRPC/GamecraftRPC.csproj +++ b/GameSDKcraft/GameSDKcraft.csproj @@ -3,7 +3,7 @@ net472 true - 1.0.0 + 1.0.1 Me MIT https://git.exmods.org/???/??? diff --git a/GamecraftRPC/Plugin.cs b/GameSDKcraft/Plugin.cs similarity index 90% rename from GamecraftRPC/Plugin.cs rename to GameSDKcraft/Plugin.cs index bf3df70..3359ee0 100644 --- a/GamecraftRPC/Plugin.cs +++ b/GameSDKcraft/Plugin.cs @@ -69,7 +69,7 @@ namespace GamecraftRPC if (isWineDetected) { // info for getting this to work through Wine/Proton - GamecraftModdingAPI.Utility.Logging.MetaLog("\n--------------------------------\n\nIt looks like you may be using Wine/Proton, cool!\nPlease install https://github.com/0e4ef622/wine-discord-ipc-bridge to get this to work.\n\n--------------------------------"); + GamecraftModdingAPI.Utility.Logging.MetaLog("\n--------------------------------\n\nIt looks like you may be using Wine/Proton, cool!\nPlease install https://github.com/0e4ef622/wine-discord-ipc-bridge to get this to work.\nAlso, please note that multiplayer is broken in Wine/Proton.\n\n--------------------------------"); } // Initialize this mod @@ -85,7 +85,8 @@ namespace GamecraftRPC LobbyManager lm = DiscordRPC.GetLobbyManager(); lm.OnMemberConnect += CallbackUtility.DiscordUserJoin; - SetDiscordActivity(state: $"{UnityEngine.Application.version} ({Version})", details: $"Initializing...", start: (int)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds); + // init Discord game activity status + SetDiscordActivity(state: $"{UnityEngine.Application.version}", details: $"Initializing..."); Game.Edit += CallbackUtility.BuildEnter; Game.Enter += CallbackUtility.GameEnter; @@ -136,7 +137,7 @@ namespace GamecraftRPC { Game game = Game.CurrentGame(); Client client = new Client(); - GamecraftModdingAPI.Utility.Logging.CommandLog($"Gamecraft {client.Version}\nUnity {client.UnityVersion}\n{Name} {Version}\nSDK {DiscordRPC.ToString()}\nGame {game.Name}"); + GamecraftModdingAPI.Utility.Logging.CommandLog($"Gamecraft {client.Version}\nUnity {client.UnityVersion}\n{PluginInfo()}\nSDK {DiscordRPC.ToString()}\nGame {game.Name}"); } else { @@ -205,7 +206,7 @@ namespace GamecraftRPC if (DiscordRPC != null ) DiscordRPC.RunCallbacks(); } - public static void SetDiscordActivity(string state = null, string details = null, long start = 0, long end = 0, string largeImg = "gamecraft-logo-g", string largeTxt = "Gamecraft", string smallImg = "exmods-logo-xm2", string smallTxt = "Exmods", string partyId = null, int partyCurrentSize = 0, int partyMaxSize = 0, string matchSecret = null, string joinSecret = null, string spectateSecret = null, bool instance = true, string debug = "") + public static void SetDiscordActivity(string state = null, string details = null, long start = 0, long end = 0, string largeImg = "gamecraft-logo-g", string largeTxt = "Gamecraft", string smallImg = "exmods-logo-xm2", string smallTxt = null, string partyId = null, int partyCurrentSize = 0, int partyMaxSize = 0, string matchSecret = null, string joinSecret = null, string spectateSecret = null, bool instance = true, string debug = "") { if (DiscordRPC == null) return; @@ -223,6 +224,7 @@ namespace GamecraftRPC } if (!string.IsNullOrEmpty(smallImg)) { + if (smallTxt == null) smallTxt = PluginInfo(); activity.Assets.SmallImage = smallImg; activity.Assets.SmallText = smallTxt; } @@ -263,5 +265,16 @@ namespace GamecraftRPC GamecraftModdingAPI.Utility.Logging.MetaLog($"Update Activity Result: {result} {debug}"); }); } + + internal static string PluginInfo() + { + Version version = Assembly.GetExecutingAssembly().GetName().Version; +#if DEBUG + string v = version.Major + "." + version.Minor + "." + version.Build + "alpha"; +#else + string v = version.Major + "." + version.Minor + "." + version.Build; +#endif + return Assembly.GetExecutingAssembly().GetName().Name + " " + v; + } } } \ No newline at end of file diff --git a/GamecraftRPC/PresenceUtility.cs b/GameSDKcraft/PresenceUtility.cs similarity index 100% rename from GamecraftRPC/PresenceUtility.cs rename to GameSDKcraft/PresenceUtility.cs