This commit is contained in:
fdenef 2022-11-18 10:53:36 +01:00
parent 94ba4b698c
commit 505aed8138

View File

@ -1,5 +1,5 @@
use eframe::egui::Ui;
use eframe::egui::widgets::DragValue; use eframe::egui::widgets::DragValue;
use eframe::egui::Ui;
use crate::gui::SheetGui; use crate::gui::SheetGui;
@ -72,7 +72,12 @@ impl CharacterSheet {
} }
impl SheetGui for CharacterSheet { impl SheetGui for CharacterSheet {
fn shortcut(&self, ui: &mut Ui, category: &str, character_field: &Characteristic) -> (u32, u32, u32) { fn shortcut(
&self,
ui: &mut Ui,
category: &str,
character_field: &Characteristic,
) -> (u32, u32, u32) {
let mut base = character_field.base; let mut base = character_field.base;
let mut carac = character_field.carac; let mut carac = character_field.carac;
let mut materiel = character_field.materiel; let mut materiel = character_field.materiel;
@ -93,23 +98,27 @@ impl SheetGui for CharacterSheet {
fn gui_address(&mut self, ui: &mut Ui) { fn gui_address(&mut self, ui: &mut Ui) {
let workaround: &CharacterSheet = self; let workaround: &CharacterSheet = self;
(self.address.base, self.address.carac, self.address.materiel) = self.shortcut(ui, "Habileté", workaround.address()); (self.address.base, self.address.carac, self.address.materiel) =
self.shortcut(ui, "Habileté", workaround.address());
ui.label("Ne peut dépasser 5"); ui.label("Ne peut dépasser 5");
} }
fn gui_stamina(&mut self, ui: &mut Ui) { fn gui_stamina(&mut self, ui: &mut Ui) {
let workaround: &CharacterSheet = self; let workaround: &CharacterSheet = self;
(self.stamina.base, self.stamina.carac, self.stamina.materiel) = self.shortcut(ui, "Endurance", workaround.stamina()); (self.stamina.base, self.stamina.carac, self.stamina.materiel) =
self.shortcut(ui, "Endurance", workaround.stamina());
} }
fn gui_luck(&mut self, ui: &mut Ui) { fn gui_luck(&mut self, ui: &mut Ui) {
let workaround: &CharacterSheet = self; let workaround: &CharacterSheet = self;
(self.luck.base, self.luck.carac, self.luck.materiel) = self.shortcut(ui, "Chance", workaround.luck()); (self.luck.base, self.luck.carac, self.luck.materiel) =
self.shortcut(ui, "Chance", workaround.luck());
} }
fn gui_skill(&mut self, ui: &mut Ui) { fn gui_skill(&mut self, ui: &mut Ui) {
let workaround: &CharacterSheet = self; let workaround: &CharacterSheet = self;
(self.skill.base, self.skill.carac, self.skill.materiel) = self.shortcut(ui, "Habileté", workaround.skill()); (self.skill.base, self.skill.carac, self.skill.materiel) =
self.shortcut(ui, "Habileté", workaround.skill());
} }
fn secondary_stats(&mut self, ui: &mut Ui) { fn secondary_stats(&mut self, ui: &mut Ui) {