mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Update status according the play state
This commit is contained in:
parent
1e40bd09ba
commit
1be8f5e422
@ -5,6 +5,9 @@ use conrod_core::{
|
|||||||
|
|
||||||
use super::{img_ids::Imgs, settings_window::SettingsTab, Fonts, TEXT_COLOR};
|
use super::{img_ids::Imgs, settings_window::SettingsTab, Fonts, TEXT_COLOR};
|
||||||
|
|
||||||
|
#[cfg(feature = "discord")]
|
||||||
|
use crate::{discord, discord_instance};
|
||||||
|
|
||||||
widget_ids! {
|
widget_ids! {
|
||||||
struct Ids {
|
struct Ids {
|
||||||
esc_bg,
|
esc_bg,
|
||||||
@ -150,6 +153,14 @@ impl<'a> Widget for EscMenu<'a> {
|
|||||||
.set(state.ids.menu_button_5, ui)
|
.set(state.ids.menu_button_5, ui)
|
||||||
.was_clicked()
|
.was_clicked()
|
||||||
{
|
{
|
||||||
|
#[cfg(feature = "discord")]
|
||||||
|
{
|
||||||
|
match discord_instance.lock() {
|
||||||
|
Ok(mut disc) => discord::send_menu(&mut disc),
|
||||||
|
Err(e) => log::error!("couldn't send Update to discord: {}", e),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return Some(Event::Logout);
|
return Some(Event::Logout);
|
||||||
};
|
};
|
||||||
// Quit
|
// Quit
|
||||||
|
@ -41,6 +41,9 @@ use specs::Join;
|
|||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
||||||
|
#[cfg(feature = "discord")]
|
||||||
|
use crate::{discord, discord_instance};
|
||||||
|
|
||||||
const XP_COLOR: Color = Color::Rgba(0.59, 0.41, 0.67, 1.0);
|
const XP_COLOR: Color = Color::Rgba(0.59, 0.41, 0.67, 1.0);
|
||||||
const TEXT_COLOR: Color = Color::Rgba(1.0, 1.0, 1.0, 1.0);
|
const TEXT_COLOR: Color = Color::Rgba(1.0, 1.0, 1.0, 1.0);
|
||||||
const TEXT_COLOR_2: Color = Color::Rgba(0.0, 0.0, 0.0, 1.0);
|
const TEXT_COLOR_2: Color = Color::Rgba(0.0, 0.0, 0.0, 1.0);
|
||||||
@ -681,7 +684,17 @@ impl Hud {
|
|||||||
self.show.want_grab = false;
|
self.show.want_grab = false;
|
||||||
self.force_ungrab = true;
|
self.force_ungrab = true;
|
||||||
}
|
}
|
||||||
Some(esc_menu::Event::Logout) => events.push(Event::Logout),
|
Some(esc_menu::Event::Logout) => {
|
||||||
|
events.push(Event::Logout);
|
||||||
|
|
||||||
|
#[cfg(feature = "discord")]
|
||||||
|
{
|
||||||
|
match discord_instance.lock() {
|
||||||
|
Ok(mut disc) => discord::send_menu(&mut disc),
|
||||||
|
Err(e) => log::error!("couldn't send Update to discord: {}", e),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Some(esc_menu::Event::Quit) => events.push(Event::Quit),
|
Some(esc_menu::Event::Quit) => events.push(Event::Quit),
|
||||||
Some(esc_menu::Event::CharacterSelection) => events.push(Event::CharacterSelection),
|
Some(esc_menu::Event::CharacterSelection) => events.push(Event::CharacterSelection),
|
||||||
None => {}
|
None => {}
|
||||||
|
@ -8,6 +8,9 @@ use std::{
|
|||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "discord")]
|
||||||
|
use crate::{discord, discord_instance};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
// Error parsing input string or error resolving host name.
|
// Error parsing input string or error resolving host name.
|
||||||
@ -54,6 +57,24 @@ impl ClientInit {
|
|||||||
Ok(mut client) => {
|
Ok(mut client) => {
|
||||||
client.register(player);
|
client.register(player);
|
||||||
let _ = tx.send(Ok(client));
|
let _ = tx.send(Ok(client));
|
||||||
|
|
||||||
|
#[cfg(feature = "discord")]
|
||||||
|
{
|
||||||
|
match discord_instance.lock() {
|
||||||
|
Ok(mut disc) => {
|
||||||
|
if !server_address.eq("127.0.0.1") {
|
||||||
|
discord::send_singleplayer(&mut disc);
|
||||||
|
disc.tx.send(discord::DiscordUpdate::Details(
|
||||||
|
server_address,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
log::error!("couldn't send Update to discord: {}", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
@ -10,6 +10,9 @@ use std::{
|
|||||||
time::Duration,
|
time::Duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[cfg(feature = "discord")]
|
||||||
|
use crate::{discord, discord_instance};
|
||||||
|
|
||||||
const TPS: u64 = 30;
|
const TPS: u64 = 30;
|
||||||
|
|
||||||
enum Msg {
|
enum Msg {
|
||||||
@ -67,6 +70,14 @@ fn run_server(mut server: Server, rec: Receiver<Msg>) {
|
|||||||
// Set up an fps clock
|
// Set up an fps clock
|
||||||
let mut clock = Clock::start();
|
let mut clock = Clock::start();
|
||||||
|
|
||||||
|
#[cfg(feature = "discord")]
|
||||||
|
{
|
||||||
|
match discord_instance.lock() {
|
||||||
|
Ok(mut disc) => discord::send_singleplayer(&mut disc),
|
||||||
|
Err(e) => log::error!("couldn't send Update to discord: {}", e),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let events = server
|
let events = server
|
||||||
.tick(Input::default(), clock.get_last_delta())
|
.tick(Input::default(), clock.get_last_delta())
|
||||||
|
Loading…
Reference in New Issue
Block a user