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.

GamePresenceHandler.cs 1.0KB

1234567891011121314151617181920212223242526272829303132
  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. namespace GamecraftRPC.Events
  10. {
  11. class GamePresenceHandler : SimpleEventHandlerEngine
  12. {
  13. public static readonly string HandlerName = "GamecraftRPCGamePresenceEventHandler";
  14. //private Discord.Discord discordRPC = null;
  15. public static int GameStart = 0;
  16. public static void OnAdd(Discord.Discord discordRPC)
  17. {
  18. GameStart = (int)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
  19. Plugin.SetDiscordActivity(discordRPC, state: "In-Game", details: $"Editing {GameMode.SaveGameDetails.Name}", start: GameStart);
  20. }
  21. public GamePresenceHandler(Discord.Discord _discordRPC) : base((db) => { OnAdd(_discordRPC); }, (db) => { }, EventType.GameSwitchedTo, HandlerName)
  22. {
  23. //this.discordRPC = _discordRPC;
  24. }
  25. }
  26. }