public static void PushState(Map map) { var world = Current.Game != null ? Current.Game.World : null; if (world == null) { RimRPC.prsnc.details = "Main Menu"; } else { float latitude = (map == null) ? 0f : Find.WorldGrid.LongLatOf(map.Tile).y; float longitude = (map == null) ? 0f : Find.WorldGrid.LongLatOf(map.Tile).x; colonyname = GetColonyName(); years = days / 60; colonistnumber = (float)PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_FreeColonists.Count <Pawn>(); days = GenDate.DaysPassed; dayhour = GenDate.HourOfDay(Find.TickManager.TicksAbs, longitude); quadrum = GenDate.Quadrum(Find.TickManager.TicksAbs, longitude); BiomeDef biome = Find.WorldGrid[map.uniqueID].biome; RimRPC.prsnc.state = BuildString("state"); RimRPC.prsnc.details = BuildString("details"); RimRPC.prsnc.largeImageText = "RimWorld"; RimRPC.prsnc.smallImageKey = "inmap"; RimRPC.prsnc.smallImageText = "Playing!"; if (RWRPCMod.settings.RPC_Time) { RimRPC.prsnc.startTimestamp = RimRPC.started; } } DiscordRPC.UpdatePresence(ref RimRPC.prsnc); }
public static void PushState(Map map) { var world = Current.Game != null ? Current.Game.World : null; if (world == null) { RimRPC.prsnc.details = "Main Menu"; } else { float latitude = (map == null) ? 0f : Find.WorldGrid.LongLatOf(map.Tile).y; float longitude = (map == null) ? 0f : Find.WorldGrid.LongLatOf(map.Tile).x; colonyname = GetColonyName(); days = GenDate.DaysPassed; dayhour = GenDate.HourOfDay(Find.TickManager.TicksAbs, longitude); //Season season = GenDate.Season(Find.TickManager.TicksAbs, latitude, longitude); //Quadrum updates seem enough. Quadrum quadrum = GenDate.Quadrum(Find.TickManager.TicksAbs, longitude); BiomeDef biome = Find.WorldGrid[map.uniqueID].biome; RimRPC.prsnc.state = "Day " + days + " (" + dayhour + "h) | " + quadrum; RimRPC.prsnc.details = colonyname; RimRPC.prsnc.largeImageText = "RimWorld"; RimRPC.prsnc.smallImageKey = "inmap"; RimRPC.prsnc.smallImageText = "Playing!"; } DiscordRPC.UpdatePresence(ref RimRPC.prsnc); Log.Message("[RichPressence] Pushed presence update to RPC."); }
public static void PushState(Map map) { var world = Current.Game != null ? Current.Game.World : null; if (world == null) { RimRPC.prsnc.details = "Main Menu"; } else { float latitude = (map == null) ? 0f : Find.WorldGrid.LongLatOf(map.Tile).y; float longitude = (map == null) ? 0f : Find.WorldGrid.LongLatOf(map.Tile).x; colonyname = GetColonyName(); years = days / 60; days = GenDate.DaysPassed; dayhour = GenDate.HourOfDay(Find.TickManager.TicksAbs, longitude); colonistnumber = (float)PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_FreeColonists.Count <Pawn>(); //Season season = GenDate.Season(Find.TickManager.TicksAbs, latitude, longitude); //Quadrum updates seem enough. Quadrum quadrum = GenDate.Quadrum(Find.TickManager.TicksAbs, longitude); BiomeDef biome = Find.WorldGrid[map.uniqueID].biome; RimRPC.prsnc.state = "Year " + years + " Day " + days + " (" + dayhour + "h) | " + quadrum; RimRPC.prsnc.details = colonyname + ", " + colonistnumber + " Colonists"; RimRPC.prsnc.largeImageText = "RimWorld"; RimRPC.prsnc.smallImageKey = "inmap"; RimRPC.prsnc.smallImageText = "Playing!"; } DiscordRPC.UpdatePresence(ref RimRPC.prsnc); //Log.Message("[RichPressence] Pushed presence update to RPC."); commented to remove log spam }
public static void MenuState() { RimRPC.prsnc.details = "Main Menu"; RimRPC.prsnc.state = null; RimRPC.prsnc.smallImageKey = null; RimRPC.prsnc.smallImageText = null; DiscordRPC.UpdatePresence(ref RimRPC.prsnc); }
public static void MenuState() { RimRPC.prsnc.details = "Main Menu"; RimRPC.prsnc.state = null; RimRPC.prsnc.smallImageKey = null; RimRPC.prsnc.smallImageText = null; DiscordRPC.UpdatePresence(ref RimRPC.prsnc); Log.Message("[RichPresence] Pushed presence update to RPC."); }
public static void BootMeUp() { DiscordRPC.EventHandlers eventHandlers = default(DiscordRPC.EventHandlers); eventHandlers.readyCallback = (DiscordRPC.ReadyCallback)Delegate.Combine(eventHandlers.readyCallback, new DiscordRPC.ReadyCallback(ReadyCallback)); eventHandlers.disconnectedCallback = (DiscordRPC.DisconnectedCallback)Delegate.Combine(eventHandlers.disconnectedCallback, new DiscordRPC.DisconnectedCallback(DisconnectedCallback)); eventHandlers.errorCallback = (DiscordRPC.ErrorCallback)Delegate.Combine(eventHandlers.errorCallback, new DiscordRPC.ErrorCallback(ErrorCallback)); eventHandlers.joinCallback = (DiscordRPC.JoinCallback)Delegate.Combine(eventHandlers.joinCallback, new DiscordRPC.JoinCallback(JoinCallback)); eventHandlers.spectateCallback = (DiscordRPC.SpectateCallback)Delegate.Combine(eventHandlers.spectateCallback, new DiscordRPC.SpectateCallback(SpectateCallback)); eventHandlers.requestCallback = (DiscordRPC.RequestCallback)Delegate.Combine(eventHandlers.requestCallback, new DiscordRPC.RequestCallback(RequestCallback)); DiscordRPC.Initialize("428272711702282252", ref eventHandlers, true, "0612"); prsnc = default(DiscordRPC.RichPresence); prsnc.largeImageKey = "logo"; prsnc.state = "Main Menu"; DiscordRPC.UpdatePresence(ref RimRPC.prsnc); ReadyCallback(); }