rework networking indicator dot
This commit is contained in:
@@ -1,7 +1,4 @@
|
|||||||
use crate::util::consts::{
|
use crate::util::consts::game::{EXE_ENHANCED, EXE_LEGACY};
|
||||||
colours,
|
|
||||||
game::{EXE_ENHANCED, EXE_LEGACY},
|
|
||||||
};
|
|
||||||
use std::{
|
use std::{
|
||||||
path::Path,
|
path::Path,
|
||||||
time::{Duration, Instant},
|
time::{Duration, Instant},
|
||||||
@@ -44,16 +41,6 @@ impl From<bool> for BlockedStatus {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<BlockedStatus> for eframe::egui::Color32 {
|
|
||||||
fn from(value: BlockedStatus) -> Self {
|
|
||||||
match value {
|
|
||||||
BlockedStatus::Blocked => colours::RED,
|
|
||||||
BlockedStatus::Failed => colours::YELLOW,
|
|
||||||
BlockedStatus::Unblocked => colours::GREEN,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl BlockedStatus {
|
impl BlockedStatus {
|
||||||
pub fn to_color32(self) -> eframe::egui::Color32 {
|
pub fn to_color32(self) -> eframe::egui::Color32 {
|
||||||
self.into()
|
self.into()
|
||||||
|
|||||||
+12
-8
@@ -139,9 +139,20 @@ impl App {
|
|||||||
.outer_margin(egui::vec2(0.0, -2.0))
|
.outer_margin(egui::vec2(0.0, -2.0))
|
||||||
.show(ui, |ui| {
|
.show(ui, |ui| {
|
||||||
let response = ui.add_enabled_ui(self.flags.elevated, |ui| {
|
let response = ui.add_enabled_ui(self.flags.elevated, |ui| {
|
||||||
|
let label = ui.horizontal(|ui| {
|
||||||
let label = ui.label("Game's network access");
|
let label = ui.label("Game's network access");
|
||||||
|
ui.add_space(1.0);
|
||||||
|
ui.add(
|
||||||
|
egui::Image::new(egui::include_image!("../../assets/circle.svg"))
|
||||||
|
.max_size([4.0, 4.0].into())
|
||||||
|
.tint(self.game_networking.blocked_status.to_color32()),
|
||||||
|
)
|
||||||
|
.on_hover_text("This turns yellow if GTA Tools\ncannot find your game.");
|
||||||
|
self.game_networking.if_failed_return_to_unblocked();
|
||||||
|
label
|
||||||
|
});
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
let available_width = label.rect.width();
|
let available_width = label.inner.rect.width();
|
||||||
let spacing = ui.spacing().item_spacing.x;
|
let spacing = ui.spacing().item_spacing.x;
|
||||||
let button_width = (available_width - spacing) / 2.0;
|
let button_width = (available_width - spacing) / 2.0;
|
||||||
if ui
|
if ui
|
||||||
@@ -156,13 +167,6 @@ impl App {
|
|||||||
{
|
{
|
||||||
self.game_networking.unblock_all();
|
self.game_networking.unblock_all();
|
||||||
}
|
}
|
||||||
ui.add(
|
|
||||||
egui::Image::new(egui::include_image!("../../assets/circle.svg"))
|
|
||||||
.max_size([4.0, 4.0].into())
|
|
||||||
.tint(self.game_networking.blocked_status.to_color32()),
|
|
||||||
)
|
|
||||||
.on_hover_text("This turns yellow if GTA Tools\ncannot find your game.");
|
|
||||||
self.game_networking.if_failed_return_to_unblocked();
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
response.response.on_disabled_hover_text(
|
response.response.on_disabled_hover_text(
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
use crate::features::game_networking::BlockedStatus;
|
||||||
|
use eframe::egui;
|
||||||
|
|
||||||
|
pub const RED: egui::Color32 = egui::Color32::from_rgb(255, 128, 128);
|
||||||
|
pub const YELLOW: egui::Color32 = egui::Color32::from_rgb(255, 255, 128);
|
||||||
|
pub const GREEN: egui::Color32 = egui::Color32::from_rgb(128, 255, 128);
|
||||||
|
|
||||||
|
impl From<BlockedStatus> for egui::Color32 {
|
||||||
|
fn from(value: BlockedStatus) -> Self {
|
||||||
|
match value {
|
||||||
|
BlockedStatus::Blocked => RED,
|
||||||
|
BlockedStatus::Failed => YELLOW,
|
||||||
|
BlockedStatus::Unblocked => GREEN,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
mod app;
|
mod app;
|
||||||
|
mod colours;
|
||||||
mod debug;
|
mod debug;
|
||||||
pub mod run;
|
pub mod run;
|
||||||
pub mod settings;
|
pub mod settings;
|
||||||
|
|||||||
@@ -8,10 +8,3 @@ pub mod game {
|
|||||||
pub const EXE_LEGACY: &str = "GTA5.exe";
|
pub const EXE_LEGACY: &str = "GTA5.exe";
|
||||||
pub const WINDOW_TITLE: &str = "Grand Theft Auto V";
|
pub const WINDOW_TITLE: &str = "Grand Theft Auto V";
|
||||||
}
|
}
|
||||||
|
|
||||||
pub mod colours {
|
|
||||||
use eframe::egui::Color32;
|
|
||||||
pub const RED: Color32 = Color32::from_rgb(249, 101, 84);
|
|
||||||
pub const YELLOW: Color32 = Color32::from_rgb(249, 236, 84);
|
|
||||||
pub const GREEN: Color32 = Color32::from_rgb(104, 249, 84);
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user