|
|
@@ -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; |
|
|
|
} |
|
|
|
} |
|
|
|
} |