Some other bullshit

This commit is contained in:
2026-09-12 14:55:40 +02:00
parent 74a635785e
commit 6e01147125
21 changed files with 206 additions and 89 deletions
+3 -2
View File
@@ -1,13 +1,14 @@
use bevy::{picking::Pickable, prelude::*, text::FontSourceTemplate, ui::widget::ImageNodeSize};
use crate::{
fighter::{FighterId, manifest::FighterManifest}, menus::{button::FGUiButton, style::FGUiButtonType},
fighter::{FighterId, manifest::FighterManifest},
menus::{button::FGUiButton, style::FGUiButtonType},
};
#[derive(Component, Clone, FromTemplate)]
pub struct CharacterBox {
pub fighter_manifest: Handle<FighterManifest>,
pub fighter_id: FighterId
pub fighter_id: FighterId,
}
impl CharacterBox {
+1 -3
View File
@@ -1,3 +1 @@
pub enum CharacterSelectErrors {
}
pub enum CharacterSelectErrors {}
+20 -6
View File
@@ -5,8 +5,20 @@ use bevy::{
use bevy_egui::egui::accesskit::TextAlign;
use crate::{
AppState, fighter::manifest::{FighterManifest, FighterManifestRegistry}, game_settings::CommonAssets, input::{LocalInputAssignments, LocalInputSource}, menus::{
MenuMarker, build_menu_with_props, button::FGUiButton, character_select::{character_box::CharacterBox, token::CharacterSelectToken}, cursor::{FGMenuCursor, MenuCursorInputSource}, errors::MenuErrors::{self, FighterManifestNotFound}, match_config::{MenuMatchConfig, MenuMatchPlayerSlot}, scaling, spawn_menu, style::{FGUiButtonType, FGUiStyle}, wrap_menu,
AppState,
fighter::manifest::{FighterManifest, FighterManifestRegistry},
game_settings::CommonAssets,
input::{LocalInputAssignments, LocalInputSource},
menus::{
MenuMarker, build_menu_with_props,
button::FGUiButton,
character_select::{character_box::CharacterBox, token::CharacterSelectToken},
cursor::{FGMenuCursor, MenuCursorInputSource},
errors::MenuErrors::{self, FighterManifestNotFound},
match_config::{MenuMatchConfig, MenuMatchPlayerSlot},
scaling, spawn_menu,
style::{FGUiButtonType, FGUiStyle},
wrap_menu,
},
};
@@ -142,7 +154,6 @@ pub fn handle_fighter_slot_addition(
common_assets: Res<CommonAssets>,
styles: Res<Assets<FGUiStyle>>,
) {
for addition in addition.read() {
let slot = addition.slot;
create_portrait(
@@ -155,7 +166,6 @@ pub fn handle_fighter_slot_addition(
&addition.input_source,
);
}
}
pub fn css_auto_assign_slots(
@@ -220,7 +230,11 @@ pub fn update_start_banner_visibility(
config: Res<MenuMatchConfig>,
) {
let match_ready = config.all_players_ready();
commands.entity(banner.into_inner()).insert(if match_ready {Visibility::Visible} else {Visibility::Hidden});
commands.entity(banner.into_inner()).insert(if match_ready {
Visibility::Visible
} else {
Visibility::Hidden
});
}
pub fn copy_cursor_transform_to_token(
@@ -269,4 +283,4 @@ pub fn despawn_tokens(tokens: Query<Entity, With<CharacterSelectToken>>, mut com
for token in tokens {
commands.entity(token).despawn();
}
}
}
+9 -8
View File
@@ -7,16 +7,13 @@ use crate::menus::style::FGUiStyle;
#[derive(Component, Clone)]
pub struct CharacterSelectToken {
pub slot: usize,
pub cursor: Entity
pub cursor: Entity,
}
impl CharacterSelectToken {
pub fn create(cursor: Entity, slot: usize, style: &FGUiStyle) -> impl Bundle {
(
CharacterSelectToken {
slot,
cursor
},
CharacterSelectToken { slot, cursor },
Pickable::IGNORE,
Node {
position_type: PositionType::Absolute,
@@ -26,9 +23,13 @@ impl CharacterSelectToken {
},
ImageNode {
image: style.css_token.handle.handle.clone(),
color: style.player_colors.get(slot).copied().unwrap_or(Color::WHITE),
color: style
.player_colors
.get(slot)
.copied()
.unwrap_or(Color::WHITE),
..default()
}
},
)
}
}
}