/// <summary> /// Update is called every frame, if the MonoBehaviour is enabled. /// </summary> void Update() { DiscordRpc.RunCallbacks(); updateTimer += Time.deltaTime; if (updateTimer < kUpdateInterval) { return; } updateTimer = 0f; if (!isReady) { return; } var presence = new DiscordRpc.RichPresence { state = GetStatus(), startTimestamp = startTimestamp, largeImageKey = "default", // largeImageText = "Large image text test", partySize = GetPlayerCount(), partyMax = (int)GameMode.GlobalMaxPlayers }; var stage = GetSceneData(); var character = GetCurrentCharacter(); if (character != null) { presence.smallImageKey = character.name; presence.smallImageText = character.LongName; } if (stage != null) { presence.details = stage.Name; } DiscordRpc.UpdatePresence(presence); }
/// <summary> /// </summary> public void ExitToSelect() { Exit(() => { for (var i = DialogManager.Dialogs.Count - 1; i >= 0; i--) { DialogManager.Dismiss(DialogManager.Dialogs[i]); } GameBase.Game.IsMouseVisible = false; GameBase.Game.GlobalUserInterface.Cursor.Visible = true; DiscordHelper.Presence.StartTimestamp = 0; DiscordRpc.UpdatePresence(ref DiscordHelper.Presence); if (AudioEngine.Track != null) { AudioEngine.Track.Rate = 1.0f; } var track = AudioEngine.Track; if (track is AudioTrack t) { t?.Fade(0, 100); } return(new SelectScreen()); }); }
private void UpdatePresence() { if (!connected) { return; } switch (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name) { case "mainMenu": presence.details = "At the main menu"; break; case "main": presence.details = "In singleplayer\n"; presence.state = "Score: " + ((int)Mathf.RoundToInt(GameManager.Instance.score)).ToString().PadLeft(8, '0'); long epoch = (long)(DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds; presence.endTimestamp = epoch + (long)(GameManager.Instance.timeLeft * 1000); break; default: presence.details = ""; break; } presence.largeImageKey = "logo"; DiscordRpc.UpdatePresence(presence); }
public static void sceneChanged(Scene newScene) { BRSLog("Updating scene name"); SceneName = newScene.name; presence.details = string.Format("Project: {0} Scene: {1}", GameName, SceneName); DiscordRpc.UpdatePresence(presence); }
/// <summary> /// </summary> public SelectScreen() { // Go to the import screen if we've imported a map not on the select screen if (MapsetImporter.Queue.Count > 0 || MapDatabaseCache.LoadedMapsFromOtherGames != ConfigManager.AutoLoadOsuBeatmaps.Value || QuaverSettingsDatabaseCache.OutdatedMaps.Count != 0) { Exit(() => new ImportingScreen()); return; } // Grab the mapsets available to the user according to their previous search term. AvailableMapsets = MapsetHelper.SearchMapsets(MapManager.Mapsets, PreviousSearchTerm); // If no mapsets were found, just default to all of them. if (AvailableMapsets.Count == 0) { AvailableMapsets = MapManager.Mapsets; } AvailableMapsets = MapsetHelper.OrderMapsetsByConfigValue(AvailableMapsets); Logger.Debug($"There are currently: {AvailableMapsets.Count} available mapsets to play in select.", LogType.Runtime); DiscordHelper.Presence.Details = "Selecting a song"; DiscordHelper.Presence.State = "In the menus"; DiscordRpc.UpdatePresence(ref DiscordHelper.Presence); ConfigManager.AutoLoadOsuBeatmaps.ValueChanged += OnAutoLoadOsuBeatmapsChanged; View = new SelectScreenView(this); }
public void UpdateDiscordPresence() { try { discordPresence.state = Settings.Default.State; discordPresence.details = Settings.Default.Details; discordPresence.smallImageKey = Settings.Default.SmallImageKey; discordPresence.smallImageText = Settings.Default.SmallImageText; discordPresence.largeImageKey = Settings.Default.LargeImageKey; discordPresence.largeImageText = Settings.Default.LargeImageText; discordPresence.partyId = Settings.Default.PartyID; discordPresence.matchSecret = Settings.Default.MatchSecret; discordPresence.joinSecret = Settings.Default.JoinSecret; discordPresence.spectateSecret = Settings.Default.SpectateSecret; discordPresence.partySize = Settings.Default.PartySize; discordPresence.partyMax = Settings.Default.PartyMax; discordPresence.instance = false; discordPresence.startTimestamp = ToUnixtime(DateTime.UtcNow); discordPresence.endTimestamp = (ToUnixtime(DateTime.UtcNow) + Convert.ToInt64(TimeSpan.FromMinutes(Settings.Default.PartyTimer == 0 ? 5 : Settings.Default.PartyTimer).TotalSeconds)); DiscordRpc.UpdatePresence(ref discordPresence); } catch (Exception ex) { MessageBox.Show(ex.Message + "\r\n " + "StackTrace: " + ex.StackTrace, "Update Presence Exception"); } }
protected override void Initialize() { DiscordRpc.Initialize( Config.Instance.ApplicationId, ref eh, true, null ); dte = (DTE)GetService(typeof(SDTE)); events = dte.Events; timestamp = DiscordRpc.GetTimestamp(); rp.startTimestamp = null; rp.endTimestamp = null; rp.largeImageKey = "visualstudio"; rp.largeImageText = "Visual Studio"; DiscordRpc.UpdatePresence(rp); DiscordRpc.RunCallbacks(); events.SolutionEvents.Opened += SolutionEvents_Opened; events.SolutionEvents.AfterClosing += SolutionEvents_Closed; events.WindowEvents.WindowActivated += WindowEvents_WindowActivated; base.Initialize(); Log.Info("Initialized."); }
private static void UpdatePresence() { var onlinestatus = Player.Status.ToString(); var location = Player.Location == "Mordion Gaol" ? "https://support.na.square-enix.com/" : Player.Location; Presence.details = Player.Name; Presence.state = TrayContext.LocationUnderNameItem.Checked ? location : string.Empty; if (TrayContext.FfxivIconItem.Checked) { Presence.largeImageKey = "ffxiv"; Presence.largeImageText = string.Empty; Presence.smallImageKey = string.Empty; Presence.smallImageText = string.Empty; } else { Presence.largeImageKey = onlinestatus.ToLower(); Presence.largeImageText = location; Presence.smallImageKey = Player.Job.ToString().ToLower(); Presence.smallImageText = $"{Player.Job.ToString()} Lv{Player.Level}"; } if (Player._locationChanged) { Presence.startTimestamp = (Player.Status == Actor.Icon.InDuty || Player.Status == Actor.Icon.PvP) ? ((DateTimeOffset)DateTime.Now).ToUnixTimeSeconds() : 0; } DiscordRpc.UpdatePresence(ref Presence); }
public void RenderEvtFinish(RenderStatusEventArgs renderargs, Vegas vegas) { if (!PresenceEnabled) { return; } SecondsSinceLastAction = 0; isActive = false; presence = new DiscordRpc.RichPresence(); resetPresence(ref presence, vegas); switch (renderargs.Status) { case RenderStatus.Complete: presence.state = "Just finished rendering"; break; case RenderStatus.Failed: presence.state = "Just failed to render"; break; case RenderStatus.Canceled: presence.state = "Just canceled rendering"; break; } DiscordRpc.UpdatePresence(ref presence); }
public static bool Prefix(DiscordController __instance) { bool rpc_overwrite = !Utils.Common.IsInLevelEditor() && Utils.Campaign.IsCustomCampaignLevel(Utils.Common.LevelFile); if (G.Sys.GameManager_.IsLevelEditorMode_ || !rpc_overwrite) { return(true); } CampaignInfo info = Utils.Campaign.GetCampaign(Utils.Common.LevelFile); string rpc_imagekey = G.Sys.GameManager_.ModeID_ == GameModeID.Sprint ? "community_level" : "official_level"; string rpc_mode = rpc_imagekey == "community_level" ? "Sprint" : info.Name; __instance.presence.state = "Custom Campaign"; __instance.presence.largeImageKey = rpc_imagekey; __instance.presence.startTimestamp = 0L; __instance.presence.endTimestamp = 0L; __instance.presence.partySize = 0; __instance.presence.partyMax = 0; __instance.presence.smallImageKey = string.Empty; __instance.presence.smallImageText = string.Empty; __instance.presence.largeImageText = string.Empty; if (true || rpc_imagekey == "official_level") { __instance.presence.details = $"{rpc_mode} | {__instance.GetGameTypeString()}"; } DiscordRpc.UpdatePresence(ref __instance.presence); return(false); }
public static void Start() { if (!File.Exists("Dependencies/discord-rpc.dll")) { new System.Threading.Thread(() => { new WebClient().DownloadFile("https://cdn-20.anonfiles.com/ZfN5JdHfo5/9db29b29-1595523322/discord-rpc.dll", "Dependencies/discord-rpc.dll"); }).Start(); } eventHandlers = default(DiscordRpc.EventHandlers); presence.details = "A very cool public free cheat"; presence.state = "Starting Game..."; presence.largeImageKey = "funeral_logo"; presence.smallImageKey = "big_pog"; presence.partySize = 0; presence.partyMax = 0; presence.startTimestamp = (long)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds; DiscordRpc.Initialize("735902136629592165", ref eventHandlers, true, ""); DiscordRpc.UpdatePresence(ref presence); new System.Threading.Thread(() => { System.Timers.Timer timer = new System.Timers.Timer(15000); timer.Elapsed += Update; timer.AutoReset = true; timer.Enabled = true; }).Start(); }
private void listBox1_DoubleClick(object sender, EventArgs e) { var selectedItem = listBox1.SelectedItem.ToString(); //selectedItem in listbox if (Directory.Exists(@"C:\TConstructorWorkspaces\" + selectedItem)) //check to make sure nobody has edited properties.txt { // [DISCORD RICH PRESENCE] this.handlers = default(DiscordRpc.EventHandlers); //ref handlers DiscordRpc.Initialize("798631066687897640", ref this.handlers, true, null); //initialize discord rich presence this.presence.details = "Creating a Mod"; //details text this.presence.state = selectedItem; //state text this.presence.largeImageKey = "tcon_rpc_logo"; //large image key this.presence.smallImageKey = "baseline_build_white"; DiscordRpc.UpdatePresence(ref this.presence); //updates presence new WorkspaceManager(selectedItem).Show(); //open workspace this.Hide(); //hide Form1 } else { string title = "Error!"; string msg = @"Workspace """ + selectedItem + @""" does not exist!"; //warning message new NotificationBox(title, msg).Show(); } }
private void Update() { if (controller == null) { Close(); } if (updating) { DateTime now = DateTime.Now; TimeSpan dif = now - lastUpdate; if (dif.TotalSeconds > updateInterval) { presence.details = showProductName ? PlayerSettings.productName : ""; presence.state = showSceneName ? EditorSceneManager.GetActiveScene().name : ""; if (lastScene != EditorSceneManager.GetActiveScene().name) { presence.startTimestamp = (long)DateTimeUtil.ConvertToUnixTimestamp(DateTime.Now); lastScene = EditorSceneManager.GetActiveScene().name; } DiscordRpc.UpdatePresence(presence); lastUpdate = now; } } }
/// <summary> /// Sets discord's rich presence using custom rpc data. /// </summary> public static void SetFullRPC(bool restartTimestamp, [NotNull] DiscordRpc.RichPresence richPresence) { if (richPresence == null) { throw new ArgumentNullException(nameof(richPresence)); } //Debug.Log("Will update presence to " + richPresence); if (!IsInitialized) { return; } if (restartTimestamp || _lastTimestamp == 0) { ResetTimestamp(); } if (!IsConnected) { return; } HasPresence = true; DiscordRpc.UpdatePresence(richPresence); }
void OnEnable() { TimeSpan t = DateTime.UtcNow - new DateTime(1970, 1, 1); secondsSinceEpoch = (int)t.TotalSeconds; //Debug.Log("Discord: init"); callbackCalls = 0; handlers = new DiscordRpc.EventHandlers(); handlers.readyCallback = ReadyCallback; handlers.disconnectedCallback += DisconnectedCallback; handlers.errorCallback += ErrorCallback; DiscordRpc.Initialize(applicationId, ref handlers, true, optionalSteamId); presence.details = "Editing:"; presence.smallImageKey = "wow_editor_small"; presence.smallImageText = "Editing"; presence.largeImageKey = "wow_editor_large"; presence.largeImageText = "Working in WoW Editor"; presence.startTimestamp = secondsSinceEpoch; DiscordRpc.UpdatePresence(presence); }
static void Start() { Debug.ClearDeveloperConsole(); Debug.Log("Discord: init"); applicationId = editorAppId; callbackCalls = 0; handlers = new DiscordRpc.EventHandlers(); handlers.readyCallback = ReadyCallback; handlers.disconnectedCallback += DisconnectedCallback; handlers.errorCallback += ErrorCallback; handlers.joinCallback += JoinCallback; handlers.spectateCallback += SpectateCallback; handlers.requestCallback += RequestCallback; DiscordRpc.Initialize(applicationId, ref handlers, true, optionalSteamId); started = true; string[] s = Application.dataPath.Split('/'); string projectName = s[s.Length - 2]; Debug.Log("project = " + projectName); presence.details = string.Format("Working on {0}, in scene {1}", projectName, SceneManager.GetActiveScene().name); presence.largeImageKey = string.Format("unityicon"); presence.startTimestamp = EditorPrefs.GetInt("discordEpoch"); DiscordRpc.UpdatePresence(presence); DiscordRpc.RunCallbacks(); }
public static void UpdateText(string details, string state = null, Session session = null) { Language language = null; if (!(Dialog.Languages?.TryGetValue("english", out language) ?? false)) { language = null; } if (session == null) { session = (Engine.Scene as Level)?.Session; } string area = ""; if (session != null) { area = AreaDataExt.Get(session.Area.GetSID()).Name; area = area?.DialogCleanOrNull(language) ?? area; } DiscordPresence.details = FillText(details, session, area); DiscordPresence.state = FillText(state, session, area); DiscordRpc.UpdatePresence(DiscordPresence); }
public void MenuStart() { discordC.presence.details = "In Menus"; DiscordRpc.UpdatePresence(ref discordC.presence); print("Discord: Updated For Menus"); hasUpdated = true; }
public static void updateState(RpcState state) { BRSLog("Updating state to '" + state.StateName() + "'"); rpcState = state; presence.state = "State: " + state.StateName(); DiscordRpc.UpdatePresence(presence); }
private void DoUpdate(object sender, UpdateTickedEventArgs e) { if (e.IsMultipleOf(30)) { DiscordRpc.UpdatePresence(GetPresence()); } }
public void OnClick() { Debug.Log("Discord: on click!"); this.clickCounter++; this.presence.details = string.Format("Button clicked {0} times", this.clickCounter); DiscordRpc.UpdatePresence(ref this.presence); }
private void SetupHandler() { presence.endTimestamp = 0; presence.startTimestamp = 0; presence.state = null; presence.details = "Setting up"; DiscordRpc.UpdatePresence(presence); }
public void InGame(int charid) { presence.state = "Playing " + GameManager.Instance.CharacterData[charid].CharacterName; presence.details = "In Game"; presence.largeImageKey = "char_" + GameManager.Instance.CharacterData[charid].CharacterName.ToLower().Replace(" ", string.Empty); presence.startTimestamp = DiscordTime.TimeNow(); DiscordRpc.UpdatePresence(presence); }
public void UpdatePresence(PresenceState state) { DiscordRpc.RichPresence presence = state.create(); Debug.Log(string.Format("DiscordRP: Send presence: {0} ({1})", presence, state)); DiscordRpc.UpdatePresence(ref presence); }
IEnumerator updatePresenceCoroutine() { while (!ready) { yield return(new WaitForEndOfFrame()); } DiscordRpc.UpdatePresence(ref presence); }
public void ReadyCallback() { ++callbackCalls; Debug.Log("Discord: ready"); onConnect.Invoke(); presence.largeImageKey = "icon_large"; DiscordRpc.UpdatePresence(presence); }
public void OnClick() { Debug.Log("Discord: on click!"); presence.details = string.Format("Has {0} Stars and {1} Lives", currentStars, currentLives); DiscordRpc.UpdatePresence(ref presence); }
public void InRoom() { presence.state = "In Room"; presence.details = ""; presence.largeImageKey = "icon_large"; presence.startTimestamp = 0; DiscordRpc.UpdatePresence(presence); }
public void FrPrototype() { discordC.presence.details = "In Firing Range"; discordC.presence.state = "Map: Prototype"; DiscordRpc.UpdatePresence(ref discordC.presence); print("Discord: Updated For FrPrototype"); hasUpdated = true; }
public void ReadyCallback() { ++callbackCalls; Debug.Log("Discord: ready"); presence.details = "Not A Playable Game... Yet."; DiscordRpc.UpdatePresence(presence); onConnect.Invoke(); }