This repository has moved! Please check out the latest version at the new location https://git.exmods.org/NGnius/GameSDKcraft
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

33 lines
1.1KB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using GamecraftModdingAPI.Events;
  7. using Svelto.ECS;
  8. using RobocraftX.Common;
  9. using Discord;
  10. namespace GamecraftRPC.Events
  11. {
  12. class GamePresenceHandler : SimpleEventHandlerEngine
  13. {
  14. public static readonly string HandlerName = "GamecraftRPCGamePresenceEventHandler";
  15. //private Discord.Discord discordRPC = null;
  16. public static void OnAdd(Discord.Discord discordRPC)
  17. {
  18. PresenceUtility.LastGameStart = (int)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
  19. Plugin.SetDiscordActivity(discordRPC, state: "In-Game", details: $"Editing {GameMode.SaveGameDetails.Name}", start: PresenceUtility.LastGameStart, partyId: PresenceUtility.PartyId.ToString(), partyCurrentSize: 1, partyMaxSize: 1, debug: "GamePresence-OnAdd");
  20. }
  21. public GamePresenceHandler(Discord.Discord _discordRPC) : base((db) => { OnAdd(_discordRPC); }, (db) => { }, EventType.GameSwitchedTo, HandlerName)
  22. {
  23. //this.discordRPC = _discordRPC;
  24. }
  25. }
  26. }