示例#1
0
        // Connect button handler
        private void discordConnectButton_Click(object sender, EventArgs e)
        {
            if (initialized)
            {
                return;
            }

            if (DISCORD_CLIENT_ID == "")
            {
                updateStatus("Missing Discord client ID");
                return;
            }

            // Initialize the event handlers and DiscordRpc so we can begin
            // updating our rich presence
            handlers = new DiscordRpc.EventHandlers {
                readyCallback = Ready,
            };

            handlers.disconnectedCallback += Disconnected;
            handlers.errorCallback        += Error;

            DiscordRpc.Initialize(DISCORD_CLIENT_ID, ref handlers, true, null);
            updateStatus("Initialized!");
            DiscordRpc.RunCallbacks();
            initialized    = true;
            timer1.Enabled = true;
        }
    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();
    }
示例#3
0
 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();
 }
示例#4
0
    public void Init()
    {
        Debug.Log("Initializing Discord Rich Presence");
        handlers = new DiscordRpc.EventHandlers();

        DiscordRpc.Initialize(appID, ref handlers, true, "");
    }
示例#5
0
    void Start()
    {
        if (initialized)
        {
            return;
        }
#if UNITY_EDITOR
        if (disableInEditor)
        {
            gameObject.SetActive(false);
            return;
        }
#endif
        if (Application.platform != RuntimePlatform.WindowsPlayer)
        {
            gameObject.SetActive(false);
            return;
        }

        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);
        initialized = true;
    }
示例#6
0
        // Connect button handler
        public static void DiscordConnect(object sender, EventArgs e)
        {
            if (ready)
            {
                return;
            }

            if (DISCORD_CLIENT_ID == "")
            {
                MessageBox.Show("Missing Discord Client ID!", "Discord Play",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                TerminateProgram();
            }

            DiscordRpc.EventHandlers eventHander = new DiscordRpc.EventHandlers();

            eventHander.readyCallback        += Ready;
            eventHander.disconnectedCallback += Disconnected;
            eventHander.errorCallback        += Error;

            Menu.MenuItemCollection menuIndex = notifyIcon.ContextMenu.MenuItems;
            menuIndex.Clear();
            menuIndex.Add(Buttons["init"]);
            menuIndex.Add(Buttons["quit"]);


            timer_connecting.Tick    += new EventHandler(CheckConnected);
            timer_connecting.Interval = 100;
            timer_connecting.Start();

            DiscordRpc.Initialize(DISCORD_CLIENT_ID, ref eventHander, true, null);
        }
示例#7
0
        public static void Init()
        {
            VRCToolsLogger.Info("[DRPC] Initialising...");
            DiscordRpc.EventHandlers eh = new DiscordRpc.EventHandlers();

            presence.state         = "Not in a world";
            presence.partySize     = 0;
            presence.partyMax      = 0;
            presence.details       = "Not logged in" + " (" + (DeobfGetters.IsVRLaunched() ? "VR" : "Desktop") + ")";
            presence.largeImageKey = "logo";
            presence.partyId       = "";

            Thread t = new Thread(new ThreadStart(() => {
                DiscordRpc.Initialize("404400696171954177", ref eh, true, null);

                while (true)
                {
                    Update();
                    Thread.Sleep(5000);
                }
            }));

            t.Name         = "Discord-RPC update thread";
            t.IsBackground = true;
            t.Start();

            VRCToolsLogger.Info("[DRPC] Done !");
        }
示例#8
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            UnGroupCheckBox(partyCheckBox, partyBox);
            UnGroupCheckBox(timeCheckBox, timeBox);
            Settings.Load();
            int lastSelectedApplication = Settings.Main.LastSelectedApplication;

            SetupApplicationList();
            if (lastSelectedApplication != -1 && lastSelectedApplication < appBox.Items.Count)
            {
                appBox.SelectedIndex = lastSelectedApplication;
            }
            handlers = new DiscordRpc.EventHandlers();

            if (Settings.Main.UpdateOnStartup)
            {
                updateButton_Click(this, new EventArgs());
            }

            UpdateChecker.CheckForUpdates();
            if (!UpdateChecker.IsUpToDate)
            {
                Font f = new Font(updatesToolStripMenuItem.Font, FontStyle.Bold);
                updatesToolStripMenuItem.Font = f;
            }
        }
    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);
    }
示例#10
0
        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();
            }
        }
示例#11
0
    void OnEnable()
    {
        Dictionary.DS = this;
        DontDestroyOnLoad(gameObject);
        presence = new DiscordRpc.RichPresence();
        PlayerPrefs.SetInt("USE_DISCORD", 1);
        if (PlayerPrefs.GetInt("USE_DISCORD") == 1) //do zmiany wylaczone dla testów
        {
            Debug.Log("Discord: Now Initiating");

            handlers = new DiscordRpc.EventHandlers();
            handlers.readyCallback += ReadyCallback;
            handlers.errorCallback += ErrorCallback;
            DiscordRpc.Initialize("655464840222998537", ref handlers, true, "");
            if (update20SecLoop)
            {
                StartCoroutine(UpdatePresence());
            }
        }
        else
        {
            Debug.Log("Discord: Not initiating - Disabled");
            Dictionary.CT = Dictionary.ConnectionType.Unconnected;
        }
    }
示例#12
0
 void OnEnable()
 {
     handlers = new DiscordRpc.EventHandlers();
     handlers.readyCallback        += ReadyCallback;
     handlers.disconnectedCallback += DisconnectedCallback;
     handlers.errorCallback        += ErrorCallback;
     DiscordRpc.Initialize(applicationId, ref handlers, true, steamId);
 }
示例#13
0
    void Awake()
    {
        debug("Discord: init");
        callbackCalls = 0;
        #if UNITY_STANDALONE_WIN
        handlers = new DiscordRpc.EventHandlers();
        handlers.readyCallback         = ReadyCallback;
        handlers.disconnectedCallback += DisconnectedCallback;
        handlers.errorCallback        += ErrorCallback;
        DiscordRpc.Initialize(applicationId, ref handlers, true, optionalSteamId);
        presence.startTimestamp = System.Convert.ToInt32((int)(System.DateTime.UtcNow -
                                                               new System.DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc)).TotalSeconds);
        #endif
        SceneManager.sceneLoaded += CheckLevelLoaded;
        if (SaveData.currentSave == null)
        {
            debug("save file created");
            SaveData.currentSave = new SaveData(-1);
        }
        if (global == null)
        {
            global = this;

            Object.DontDestroyOnLoad(this.gameObject);


            if (!PlayerPrefs.HasKey("textSpeed") || !PlayerPrefs.HasKey("musicVolume") ||
                !PlayerPrefs.HasKey("sfxVolume") ||
                !PlayerPrefs.HasKey("frameStyle") || !PlayerPrefs.HasKey("battleScene") ||
                !PlayerPrefs.HasKey("battleStyle") ||
                !PlayerPrefs.HasKey("screenSize") || !PlayerPrefs.HasKey("fullscreen"))
            {
                //if a playerpref isn't set

                PlayerPrefs.SetInt("textSpeed", 2);
                float mVol = (7f / 20f) * (7f / 20f);
                float sVol = (14f / 20f) * (14f / 20f);
                PlayerPrefs.SetFloat("musicVolume", mVol);
                PlayerPrefs.SetFloat("sfxVolume", sVol);
                PlayerPrefs.SetInt("frameStyle", 1);
                PlayerPrefs.SetInt("battleScene", 1);
                PlayerPrefs.SetInt("battleStyle", 0);
                PlayerPrefs.SetInt("screenSize", 1);
                PlayerPrefs.SetInt("fullscreen", 0);
                PlayerPrefs.Save();
            }
            updateResolution();

            RenderTexture.active = GUIDisplay;
            GL.Clear(false, true, new Color(0.0f, 0.0f, 0.0f, 0.0f));

            CreateFileData("Daniel", true);
        }
        else if (global != this)
        {
            Destroy(gameObject);
        }
    }
示例#14
0
 static theblackarmsSDX_DiscordRPC()
 {
     if (EditorPrefs.GetBool("theblackarmsSDX_discordRPC", true))
     {
         chill_zoneLog("Starting discord rpc");
         DiscordRpc.EventHandlers eventHandlers = default(DiscordRpc.EventHandlers);
         DiscordRpc.Initialize("928328701911916594", ref eventHandlers, false, string.Empty);
         UpdateDRPC();
     }
 }
示例#15
0
 private void FNupdate_Load(object sender, EventArgs e)
 {
     this.handlers = default(DiscordRpc.EventHandlers);
     DiscordRpc.Initialize("656175405706772493", ref this.handlers, true, null);
     this.presence.details        = "Viewing Test Servers";
     this.presence.state          = "Created by KyeFNLeaks";
     this.presence.largeImageKey  = "rpc_logo";
     this.presence.largeImageText = "API";
     DiscordRpc.UpdatePresence(ref this.presence);
 }
示例#16
0
        private void InitialiseDiscord()
        {
            var handlers = new DiscordRpc.EventHandlers();

            handlers.readyCallback        += HandleReadyCallback;
            handlers.errorCallback        += HandleErrorCallback;
            handlers.disconnectedCallback += HandleDisconnectedCallback;

            DiscordRpc.Initialize(APPLICATION_ID, ref handlers, true, null);
        }
示例#17
0
 private void toolStripComboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     this.handlers = default(DiscordRpc.EventHandlers);
     DiscordRpc.Initialize("770993580746997780", ref this.handlers, true, null);
     presence.details        = toolStripTextBox2.Text;
     presence.state          = toolStripTextBox1.Text;
     presence.largeImageKey  = toolStripComboBox1.Text;
     presence.largeImageText = "Discord";
     DiscordRpc.UpdatePresence(ref this.presence);
 }
示例#18
0
        public static void Initialize()
        {
            var eventHandlers = new DiscordRpc.EventHandlers();

            eventHandlers.errorCallback = delegate(int code, string msg)
            {
                new Thread(Error).Start($"{code}: {msg}");
            };
            DiscordRpc.Initialize("474675525928091657", ref eventHandlers, true, "");
        }
    void OnEnable()
    {
        Debug.Log("Discord: init");
        handlers = new DiscordRpc.EventHandlers();

        presence.details       = string.Format(DRPCDetails);
        presence.smallImageKey = string.Format(DRPCSmallImage);
        presence.largeImageKey = string.Format(DRPCLargeImage);
        DiscordRpc.Initialize(applicationID, ref handlers, true, optionalSteamID);
    }
示例#20
0
        private void HandleTimer(Object source, ElapsedEventArgs e)
        {
            string title       = "";
            string episodeName = "";

            if (Process.GetProcessesByName("kodi").Length > 0)
            {
                Debug.WriteLine("Seen Kodi");
                bEnable = true;
            }
            else
            {
                if (bEnable)
                {
                    Debug.WriteLine("Shutting down Discord RPC");
                    Discord_RPC_Shutdown();
                }
                bEnable = false;
            }

            if (bEnable)
            {
                if (!bInitialized)
                {
                    Debug.WriteLine("Starting up Discord RPC");
                    handlers        = new DiscordRpc.EventHandlers();
                    discordPresence = new DiscordRpc.RichPresence();
                    DiscordRpc.Initialize(APPLICATION_ID, ref handlers, true, null);
                    bInitialized = true;
                }

                using (WebClient wc = new WebClient()) {
                    try {
                        var     json   = wc.DownloadString(TEST_URL);
                        dynamic parsed = Newtonsoft.Json.JsonConvert.DeserializeObject(json);

                        title       = parsed.result.item.showtitle;
                        episodeName = parsed.result.item.title;

                        if ((title == "") && (episodeName == ""))
                        {
                            title = "In Menus";
                        }
                    }
                    catch {
                        Debug.WriteLine("Unable to Connect to Remote Server");
                    }
                }

                discordPresence.details       = title;
                discordPresence.state         = episodeName;
                discordPresence.largeImageKey = "diskodi_logo";
                DiscordRpc.UpdatePresence(ref discordPresence);
            }
        }
    void OnEnable()
    {
        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);
    }
示例#22
0
            public static void Disable()
            {
                OnGameExit();

                DiscordHandlers = new DiscordRpc.EventHandlers();

                Events.Celeste.OnExiting        -= OnGameExit;
                Events.MainMenu.OnCreateButtons -= OnMainMenu;
                Events.Level.OnLoadLevel        -= OnLoadLevel;
                Events.Level.OnExit             -= OnLevelExit;
            }
示例#23
0
 public void StartDiscord()
 {
     handlers = new DiscordRpc.EventHandlers();
     handlers.readyCallback         = ReadyCallback;
     handlers.disconnectedCallback += DisconnectedCallback;
     handlers.errorCallback        += ErrorCallback;
     handlers.joinCallback         += JoinCallback;
     handlers.spectateCallback     += SpectateCallback;
     handlers.requestCallback      += RequestCallback;
     DiscordRpc.Initialize(settings.AppID, ref handlers, true, "");
 }
示例#24
0
 void OnEnable()
 {
     Debug.Log("Discord: init");
     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);
 }
        /*
         *      =============================================
         *      Private
         *      =============================================
         */

        /// <summary>
        /// Initialize the RPC.
        /// </summary>
        /// <param name="clientId"></param>
        private void Initialize(string clientId)
        {
            handlers = new DiscordRpc.EventHandlers();

            handlers.readyCallback         = ReadyCallback;
            handlers.disconnectedCallback += DisconnectedCallback;
            handlers.errorCallback        += ErrorCallback;

            DiscordRpc.Initialize(clientId, ref handlers, true, null);

            this.SetStatusBarMessage("Initialized.");
        }
 private void OnEnable()
 {
     handlers = new DiscordRpc.EventHandlers();
     DiscordRpc.Initialize("523242657040826400", ref handlers, true, "341800");
     presence.largeImageKey = "ktane";
     presence.details       = "Loading KTaNE";
     DiscordRpc.UpdatePresence(presence);
     _gameInfo = GetComponent <KMGameInfo>();
     _bombInfo = GetComponent <KMBombInfo>();
     _gameInfo.OnStateChange  += StateChange;
     _bombInfo.OnBombExploded += BombExploded;
 }
示例#27
0
        private void Application_Load(object sender, EventArgs e)
        {
            page1Panel.Location = new Point(158, 44);

            this.handlers = default(DiscordRpc.EventHandlers);
            DiscordRpc.Initialize("656175405706772493", ref this.handlers, true, null);
            this.presence.details        = "Viewing the Home Page";
            this.presence.state          = "Created by KyeFNLeaks";
            this.presence.largeImageKey  = "rpc_logo";
            this.presence.largeImageText = "API";
            DiscordRpc.UpdatePresence(ref this.presence);
        }
示例#28
0
 private void Form1_Load(object sender, EventArgs e)
 {
     Hide();
     this.handlers = default(DiscordRpc.EventHandlers);
     DiscordRpc.Initialize("770993580746997780", ref this.handlers, true, null);
     presence.state          = "Chattin'";
     presence.startTimestamp = 0;
     presence.largeImageKey  = "discord";
     presence.largeImageText = "Discord";
     DiscordRpc.UpdatePresence(ref this.presence);
     // dam, a cuttttttt ;))
 }
示例#29
0
        /// <summary>
        ///     Initialize the RPC.
        /// </summary>
        /// <param name="clientId"></param>
        private void Initialize(string clientId)
        {
            handlers = new DiscordRpc.EventHandlers();

            handlers.readyCallback         = ReadyCallback;
            handlers.disconnectedCallback += DisconnectedCallback;
            handlers.errorCallback        += ErrorCallback;

            DiscordRpc.Initialize(clientId, ref handlers, true, null);

            WriteConsole("Initialized.");
        }
示例#30
0
        public void Awake()
        {
            if (_init)
            {
                return;
            }
            _init = true;
            GeneralManager.Instance.LogToFileOrConsole("Discord RPC Loading In.");
            var discordHandlers = new DiscordRpc.EventHandlers();

            DiscordRpc.Initialize(DiscordAppID, ref discordHandlers, false, string.Empty);
        }