Rename to GameSDKcraft with tweaks

This commit is contained in:
NGnius (Graham) 2020-07-04 15:05:17 -04:00
parent 8d44536ea0
commit 203b607074
13 changed files with 19 additions and 6 deletions

View file

@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 16
VisualStudioVersion = 16.0.29609.76 VisualStudioVersion = 16.0.29609.76
MinimumVisualStudioVersion = 10.0.40219.1 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 EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

View file

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>net472</TargetFramework> <TargetFramework>net472</TargetFramework>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Version>1.0.0</Version> <Version>1.0.1</Version>
<Authors>Me</Authors> <Authors>Me</Authors>
<PackageLicenseExpression>MIT</PackageLicenseExpression> <PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>https://git.exmods.org/???/???</PackageProjectUrl> <PackageProjectUrl>https://git.exmods.org/???/???</PackageProjectUrl>

View file

@ -69,7 +69,7 @@ namespace GamecraftRPC
if (isWineDetected) if (isWineDetected)
{ {
// info for getting this to work through Wine/Proton // 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 // Initialize this mod
@ -85,7 +85,8 @@ namespace GamecraftRPC
LobbyManager lm = DiscordRPC.GetLobbyManager(); LobbyManager lm = DiscordRPC.GetLobbyManager();
lm.OnMemberConnect += CallbackUtility.DiscordUserJoin; 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.Edit += CallbackUtility.BuildEnter;
Game.Enter += CallbackUtility.GameEnter; Game.Enter += CallbackUtility.GameEnter;
@ -136,7 +137,7 @@ namespace GamecraftRPC
{ {
Game game = Game.CurrentGame(); Game game = Game.CurrentGame();
Client client = new Client(); 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 else
{ {
@ -205,7 +206,7 @@ namespace GamecraftRPC
if (DiscordRPC != null ) DiscordRPC.RunCallbacks(); 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; if (DiscordRPC == null) return;
@ -223,6 +224,7 @@ namespace GamecraftRPC
} }
if (!string.IsNullOrEmpty(smallImg)) if (!string.IsNullOrEmpty(smallImg))
{ {
if (smallTxt == null) smallTxt = PluginInfo();
activity.Assets.SmallImage = smallImg; activity.Assets.SmallImage = smallImg;
activity.Assets.SmallText = smallTxt; activity.Assets.SmallText = smallTxt;
} }
@ -263,5 +265,16 @@ namespace GamecraftRPC
GamecraftModdingAPI.Utility.Logging.MetaLog($"Update Activity Result: {result} {debug}"); 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;
}
} }
} }