コード例 #1
0
        public static void OnJobStart(string cargo, int weight, string origin, string destination, string truck_brand_id, string truck)
        {
            Console.WriteLine("job start");
            FreeRoamSpeedUpdateTimer.Stop();
            TelemetryHandler.freeroamactive = false;
            string DiscordLargeImageKey = getTruckImageKey(truck_brand_id);

            jobRPC = new RichPresence()
            {
                Details = translation.DISCORD_JOB_CARGO + ": " + cargo + "(" + weight / 1000 + "t)",
                State   = origin + "->" + destination,

                Assets = new Assets()
                {
                    LargeImageKey  = DiscordLargeImageKey,
                    LargeImageText = translation.DISCORD_DRIVING + " " + truck,
                    SmallImageKey  = DiscordSmallImageKey,
                    SmallImageText = "v" + Config.ClientVersion
                }
            };
            jobRPC = jobRPC.WithTimestamps(Timestamps.Now);
            client.SetPresence(jobRPC);
            JobInfoActive = true;
            onJobInfoTimer.Start();
        }
コード例 #2
0
        /// <summary>
        /// Shows the current track's details.
        /// </summary>
        private void ShowTrackDetails()
        {
            try
            {
                if (this.playbackService.CurrentTrack == null)
                {
                    return;
                }

                RichPresence presence = new RichPresence()
                {
                    Details = this.playbackService.CurrentTrack.TrackTitle,
                    State   = $"{ResourceUtils.GetString("Language_Discord_By")} {this.playbackService.CurrentTrack.ArtistName}",
                    Assets  = new Assets()
                    {
                        LargeImageKey  = "icon",
                        LargeImageText = ResourceUtils.GetString("Language_Discord_Playing_With_Dopamine")
                    },
                };

                // If the track is playing, we show its remaining duration
                // and an icon
                if (this.playbackService.IsPlaying)
                {
                    // Sets the duration
                    presence.WithTimestamps(new Timestamps()
                    {
                        Start = DateTime.UtcNow,
                        End   = DateTime.UtcNow.AddMilliseconds(this.playbackService.CurrentTrack.Track.Duration.Value - this.playbackService.GetCurrentTime.TotalMilliseconds)
                    });

                    // Sets the "playing" image
                    presence.Assets.SmallImageKey  = "play";
                    presence.Assets.SmallImageText = ResourceUtils.GetString("Language_Discord_Playing");
                }

                // If the track is paused, we don't set the timestamps and
                // we show the appropriate icon
                else
                {
                    presence.Assets.SmallImageKey  = "pause";
                    presence.Assets.SmallImageText = ResourceUtils.GetString("Language_Discord_Paused");
                }


                this.client.SetPresence(presence);
            }
            catch (Exception ex)
            {
                LogClient.Error($"Could not show track details. Exception: {ex.Message}");
            }
        }
コード例 #3
0
        public void onTour(string destination, string depature, string freight, string weight)
        {
            RichPresence rpc = new RichPresence()
            {
                Details = "Fracht: " + freight + "(" + weight + "t)",
                State   = "von " + depature + " nach " + destination,

                Assets = new Assets()
                {
                    LargeImageKey  = "truck-icon",
                    LargeImageText = "Beyond the limits",
                    SmallImageKey  = "vtcm-logo"
                }
            };

            rpc = rpc.WithTimestamps(Timestamps.Now);
            client.SetPresence(rpc);
            client.Invoke();
        }
コード例 #4
0
        public void onTour(string destination, string depature, string freight, string weight)
        {
            if (active)
            {
                RichPresence rpc = new RichPresence()
                {
                    Details = "Fracht: " + freight + "(" + weight + "t)",
                    State   = "von " + depature + " nach " + destination,

                    Assets = new Assets()
                    {
                        LargeImageKey  = Information.DiscordLargeImageKey,
                        LargeImageText = "Beyond the limits",
                        SmallImageKey  = Information.DiscordSmallImageKey,
                        SmallImageText = "VTCManager Version " + Information.ClientVersion
                    }
                };
                rpc = rpc.WithTimestamps(Timestamps.Now);
                client.SetPresence(rpc);
                client.Invoke();
            }
        }
コード例 #5
0
        private void updateUIFunction()
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new Action(() =>
                {
                    toolStripStatusLabel1.Text = currentWatcher.ps2IP.ToString();
                    if (currentWatcher.states.currentState == enums.state.Connected)
                    {
                        toolStripStatusLabel2.Image = Properties.Resources.Connected; toolStripStatusLabel2.ToolTipText = "PS2 is connected to the network";
                    }
                    else if (currentWatcher.states.currentState == enums.state.Disconnected)
                    {
                        toolStripStatusLabel2.Image = Properties.Resources.Disconnected; toolStripStatusLabel2.ToolTipText = "PS2 is disconnected to the network";
                    }
                    else if (currentWatcher.states.currentState == enums.state.Awaiting_Connection)
                    {
                        toolStripStatusLabel2.Image = Properties.Resources.Awaiting_Connection; toolStripStatusLabel2.ToolTipText = "PS2 is connected to the network but not files were requested yet" + System.Environment.NewLine + "If you are playing a game before opening up this app, it won't show.";
                    }

                    if (currentWatcher.nowPlayingName == null)
                    {
                        toolStripStatusLabel3.Text       = "";
                        playingToolStripMenuItem.Visible = false;
                        try
                        {
                            currentWatcher.time = null;
                            client.ClearPresence();
                        }
                        catch (Exception ex) { }
                    }
                    else
                    {
                        playingToolStripMenuItem.Visible = true;
                        playingToolStripMenuItem.Text    = "Playing: " + currentWatcher.nowPlayingSerial;
                        toolStripStatusLabel3.Text       = "Playing: " + currentWatcher.nowPlayingName + " " + currentWatcher.states.nowPlayingType;
                        presence.Details = currentWatcher.nowPlayingName;
                        presence.State   = currentWatcher.nowPlayingSerial;
                        presence.WithTimestamps(currentWatcher.time);
                        string play = "";
                        string logo = "";
                        if (currentWatcher.states.nowPlayingType == enums.playing.PS2)
                        {
                            play = "Now playing a Playstation 2 Game";
                            logo = "ps2logo";
                        }
                        else
                        {
                            play = "Now playing a Playstation 1 Game";
                            logo = "ps1logo";
                        }
                        presence.Assets = new Assets()
                        {
                            LargeImageKey  = "pslogo",
                            SmallImageKey  = logo,
                            SmallImageText = play,
                        };
                        try
                        {
                            client.SetPresence(presence);
                        }
                        catch (Exception ex) { }
                    }
                    client.Invoke();
                }));
            }
        }
コード例 #6
0
 /// <summary>
 /// Resets the presence timestamps to null, meaning they disappear
 /// </summary>
 public void ResetTimestamps()
 {
     _presence.WithTimestamps(null);
 }