Compare commits

..
Author SHA1 Message Date
EIREXE 15052e7e16 Expose LLVM tools to Windows build
CI / production-build (pull_request) Successful in 22m8s
CI / build-and-test (pull_request) Successful in 1m17s
2026-09-19 23:14:03 +02:00
EIREXE 48896d5c1e Use Clang 19 for Windows cross-builds
CI / build-and-test (pull_request) Successful in 1m22s
CI / production-build (pull_request) Failing after 14m59s
2026-09-19 22:53:19 +02:00
EIREXE 350b37a4da Fix blake build
CI / build-and-test (pull_request) Successful in 6m54s
CI / production-build (pull_request) Failing after 14m15s
2026-09-19 22:28:04 +02:00
EIREXE 4d474227cc Install Windows tooling in production job
CI / build-and-test (pull_request) Successful in 3m10s
CI / production-build (pull_request) Failing after 8m23s
2026-09-19 22:15:16 +02:00
EIREXE b5cc5428d2 Bump gc driver 2026-09-19 22:12:35 +02:00
EIREXE 49b23110ff Build Windows binary in shared Steam depot
CI / build-and-test (pull_request) Successful in 1m46s
CI / production-build (pull_request) Failing after 4m50s
2026-09-19 22:01:52 +02:00
10 changed files with 87 additions and 391 deletions
+7 -5
View File
@@ -32,9 +32,13 @@ use clap::Parser;
use ron_asset_manager::RonAssetPlugin;
use crate::{
camera::MatchCameraPlugin, fighter::manifest::FighterManifest, game_settings::GameSettings,
match_runtime::MatchRuntimePlugin, menus::style::FGUiStyle, schedule::GameplaySchedulePlugin,
stage::manifest::StageManifest, ui::InGameUIPlugin,
camera::MatchCameraPlugin,
fighter::manifest::FighterManifest,
game_settings::GameSettings,
menus::style::FGUiStyle,
schedule::GameplaySchedulePlugin,
stage::manifest::StageManifest,
ui::InGameUIPlugin,
};
mod args;
@@ -44,7 +48,6 @@ pub mod fighter;
pub mod game_settings;
pub mod input;
pub mod match_loading;
pub mod match_runtime;
mod math;
pub mod menus;
pub mod netcode;
@@ -108,7 +111,6 @@ impl Plugin for GamePlugin {
// Brings up GGRS (and with it `GgrsSchedule`), so it goes first.
netcode::FighterNetcodePlugin::default(),
GameplaySchedulePlugin,
MatchRuntimePlugin,
input::FighterInputPlugin,
replay::ReplayPlugin,
debug_tools::DebugToolsPlugin,
+33 -126
View File
@@ -8,29 +8,28 @@ use bevy_ggrs::prelude::Session;
use serde::{Deserialize, Serialize};
use crate::{
AppState,
args::Args,
fighter::{
FighterId, FighterRoster,
animation::AnimKind,
attack::{AttackKind, FighterAttackScriptAssets},
baked_animation::{BAKED_ANIMATION_FPS, BakedFighterAnimations},
baked_animation::{BakedFighterAnimations, BAKED_ANIMATION_FPS},
manifest::{FighterManifest, FighterManifestRegistry},
spawn_fighter,
visual::FighterAnimations,
FighterId, FighterRoster,
},
input::{LocalInputAssignments, LocalInputSource},
match_runtime::MatchState,
math::{int::FGi32, vec::FGVec2},
netcode::{
session::{create_session, ConnectionStatus, SessionConfig},
GGRSCfg,
session::{ConnectionStatus, SessionConfig, create_session},
},
scripting::FighterAttackScript,
stage::{
self,
manifest::{StageId, StageManifest, StageManifestRegistry},
},
AppState,
};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
@@ -39,49 +38,10 @@ pub struct MatchPlayer {
pub fighter: FighterId,
}
#[derive(Resource, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct MatchConfig {
#[derive(Resource, Debug, Clone, PartialEq, Eq)]
pub struct PendingMatch {
pub stage: StageId,
pub players: Vec<MatchPlayer>,
pub rules: MatchRules,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum MatchRules {
Stock {
starting_stocks: u8,
time_limit_frames: Option<u32>,
},
Timed {
time_limit_frames: u32,
},
}
impl Default for MatchRules {
fn default() -> Self {
Self::Stock {
starting_stocks: 3,
time_limit_frames: None,
}
}
}
impl MatchRules {
fn validate(&self) -> Result<(), &'static str> {
match self {
Self::Stock {
starting_stocks: 0, ..
} => Err("stock matches must start with at least one stock"),
Self::Stock {
time_limit_frames: Some(0),
..
} => Err("stock match time limits must be greater than zero frames"),
Self::Timed {
time_limit_frames: 0,
} => Err("timed match limits must be greater than zero frames"),
_ => Ok(()),
}
}
}
pub struct SelectedFighterAssets {
@@ -99,7 +59,7 @@ pub struct MatchAssets {
impl MatchAssets {
fn requested(world: &World) -> Self {
let config = world.resource::<MatchConfig>();
let request = world.resource::<PendingMatch>();
let asset_server = world.resource::<AssetServer>();
let registry = world.resource::<FighterManifestRegistry>();
let stage_registry = world.resource::<StageManifestRegistry>();
@@ -107,7 +67,7 @@ impl MatchAssets {
let stage_manifests = world.resource::<Assets<StageManifest>>();
let stage_handle = stage_registry
.get(config.stage)
.get(request.stage)
.expect("Startup validation guarantees every stage has a manifest");
let stage_manifest = stage_manifests
.get(&stage_handle)
@@ -115,7 +75,7 @@ impl MatchAssets {
Self {
stage: asset_server.load(stage_manifest.model_path.clone()),
fighters: config
fighters: request
.players
.iter()
.map(|player| {
@@ -181,10 +141,10 @@ pub struct MatchRoot;
pub fn initiate_match(
commands: &mut Commands,
next_state: &mut NextState<AppState>,
config: MatchConfig,
request: PendingMatch,
) {
commands.remove_resource::<crate::netcode::session::MatchDisconnected>();
commands.insert_resource(config);
commands.insert_resource(request);
next_state.set(AppState::LoadingMatch);
}
@@ -206,9 +166,12 @@ pub fn initiate_default_match(
if let Some(path) = &args.play_replay {
match crate::replay::load(path) {
Ok(replay) => {
let config = replay.match_config.clone();
let request = PendingMatch {
stage: replay.match_config.stage,
players: replay.match_config.players.clone(),
};
commands.insert_resource(crate::replay::LoadedReplay(replay));
initiate_match(&mut commands, &mut next_state, config);
initiate_match(&mut commands, &mut next_state, request);
}
Err(error) => {
error!("Replay load failed: {error}");
@@ -252,17 +215,16 @@ pub fn initiate_default_match(
initiate_match(
&mut commands,
&mut next_state,
MatchConfig {
PendingMatch {
stage: StageId::TestStage,
players,
rules: MatchRules::default(),
},
);
}
pub fn prepare_match(
mut commands: Commands,
config: Res<MatchConfig>,
request: Res<PendingMatch>,
assets: Res<MatchAssets>,
gltfs: Res<Assets<Gltf>>,
baked_animations: Res<Assets<BakedFighterAnimations>>,
@@ -274,7 +236,7 @@ pub fn prepare_match(
args: Res<Args>,
mut next_state: ResMut<NextState<AppState>>,
) {
if !valid_player_handles(&config.players) {
if !valid_player_handles(&request.players) {
fail_match(
&mut next_state,
"player handles must be unique and cover 0..player_count",
@@ -282,12 +244,7 @@ pub fn prepare_match(
return;
}
if let Err(error) = config.rules.validate() {
fail_match(&mut next_state, error);
return;
}
if assets.fighters.len() != config.players.len() {
if assets.fighters.len() != request.players.len() {
fail_match(
&mut next_state,
"loaded character assets do not match the requested player slots",
@@ -439,7 +396,7 @@ pub fn prepare_match(
));
}
let session_config = match SessionConfig::from_args(&args, config.players.len()) {
let session_config = match SessionConfig::from_args(&args, request.players.len()) {
Ok(config) => config,
Err(error) => {
fail_match(
@@ -449,7 +406,7 @@ pub fn prepare_match(
return;
}
};
let session = match create_session(&args, config.players.len()) {
let session = match create_session(&args, request.players.len()) {
Ok(session) => session,
Err(error) => {
fail_match(
@@ -463,7 +420,7 @@ pub fn prepare_match(
let root = commands.spawn((Name::new("Match"), MatchRoot)).id();
let stage_handle = stage_registry
.get(config.stage)
.get(request.stage)
.expect("Initialization check should ensure all stages exist");
let stage_manifest = stage_manifests
.get(&stage_handle)
@@ -476,11 +433,11 @@ pub fn prepare_match(
stage_manifest.camera.clone(),
);
let mut fighter_roster = Vec::with_capacity(config.players.len());
let mut fighter_roster = Vec::with_capacity(request.players.len());
for (index, (player, (scene, animations, attack_scripts, manifest_handle, model_scale))) in
config.players.iter().zip(prepared).enumerate()
request.players.iter().zip(prepared).enumerate()
{
let spawn_x = (index as i32 * 2 + 1 - config.players.len() as i32) * 5;
let spawn_x = (index as i32 * 2 + 1 - request.players.len() as i32) * 5;
fighter_roster.push(spawn_fighter(
&mut commands,
player.handle,
@@ -494,7 +451,6 @@ pub fn prepare_match(
}
commands.insert_resource(FighterRoster(fighter_roster));
commands.insert_resource(MatchState::from_config(&config));
commands.insert_resource(session_config);
commands.insert_resource(ConnectionStatus::default());
commands.insert_resource::<Session<GGRSCfg>>(session);
@@ -531,8 +487,7 @@ pub fn cleanup_match(
commands.remove_resource::<ConnectionStatus>();
commands.remove_resource::<stage::line::StageCollision>();
commands.remove_resource::<MatchAssets>();
commands.remove_resource::<MatchConfig>();
commands.remove_resource::<MatchState>();
commands.remove_resource::<PendingMatch>();
commands.remove_resource::<FighterRoster>();
}
@@ -541,8 +496,8 @@ mod tests {
use super::*;
#[test]
fn match_config_keeps_duplicate_fighter_slots() {
let config = MatchConfig {
fn match_request_keeps_duplicate_fighter_slots() {
let request = PendingMatch {
stage: StageId::TestStage,
players: vec![
MatchPlayer {
@@ -554,13 +509,12 @@ mod tests {
fighter: FighterId::TestFighter,
},
],
rules: MatchRules::default(),
};
assert_eq!(config.players.len(), 2);
assert_eq!(config.players[0].handle, 0);
assert_eq!(config.players[1].handle, 1);
assert!(valid_player_handles(&config.players));
assert_eq!(request.players.len(), 2);
assert_eq!(request.players[0].handle, 0);
assert_eq!(request.players[1].handle, 1);
assert!(valid_player_handles(&request.players));
}
#[test]
@@ -579,53 +533,6 @@ mod tests {
assert!(!valid_player_handles(&players));
}
#[test]
fn match_rules_reject_zero_limits() {
assert!(
MatchRules::Stock {
starting_stocks: 0,
time_limit_frames: None,
}
.validate()
.is_err()
);
assert!(
MatchRules::Stock {
starting_stocks: 3,
time_limit_frames: Some(0),
}
.validate()
.is_err()
);
assert!(
MatchRules::Timed {
time_limit_frames: 0,
}
.validate()
.is_err()
);
}
#[test]
fn match_rules_accept_valid_modes() {
assert!(MatchRules::default().validate().is_ok());
assert!(
MatchRules::Stock {
starting_stocks: 3,
time_limit_frames: Some(60),
}
.validate()
.is_ok()
);
assert!(
MatchRules::Timed {
time_limit_frames: 60,
}
.validate()
.is_ok()
);
}
#[test]
fn match_loading_waits_for_attack_scripts() {
let mut attack_scripts = HashMap::new();
-102
View File
@@ -1,102 +0,0 @@
//! Rollback-simulated state for an active match.
use bevy::prelude::*;
use bevy_ggrs::prelude::*;
use crate::match_loading::{MatchConfig, MatchRules};
#[derive(Resource, Clone, Debug, Hash, PartialEq, Eq)]
pub struct MatchState {
pub elapsed_frames: u32,
/// Indexed by the player's session handle.
pub players: Vec<PlayerMatchState>,
}
#[derive(Clone, Debug, Hash, PartialEq, Eq)]
pub struct PlayerMatchState {
pub stocks_remaining: Option<u8>,
pub score: i32,
pub deaths: u32,
}
impl MatchState {
pub fn from_config(config: &MatchConfig) -> Self {
let stocks_remaining = match &config.rules {
MatchRules::Stock {
starting_stocks, ..
} => Some(*starting_stocks),
MatchRules::Timed { .. } => None,
};
Self {
elapsed_frames: 0,
players: (0..config.players.len())
.map(|_| PlayerMatchState {
stocks_remaining,
score: 0,
deaths: 0,
})
.collect(),
}
}
}
pub struct MatchRuntimePlugin;
impl Plugin for MatchRuntimePlugin {
fn build(&self, app: &mut App) {
app.rollback_resource_with_clone::<MatchState>()
.checksum_resource_with_hash::<MatchState>();
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::{fighter::FighterId, match_loading::MatchPlayer, stage::manifest::StageId};
fn config(rules: MatchRules) -> MatchConfig {
MatchConfig {
stage: StageId::TestStage,
players: vec![
MatchPlayer {
handle: 1,
fighter: FighterId::TestFighter,
},
MatchPlayer {
handle: 0,
fighter: FighterId::TestFighter,
},
],
rules,
}
}
#[test]
fn stock_state_starts_with_configured_stocks() {
let state = MatchState::from_config(&config(MatchRules::Stock {
starting_stocks: 4,
time_limit_frames: Some(60),
}));
assert_eq!(state.elapsed_frames, 0);
assert_eq!(state.players.len(), 2);
assert!(state.players.iter().all(|player| {
player.stocks_remaining == Some(4) && player.score == 0 && player.deaths == 0
}));
}
#[test]
fn timed_state_has_no_stock_counter() {
let state = MatchState::from_config(&config(MatchRules::Timed {
time_limit_frames: 60,
}));
assert!(
state
.players
.iter()
.all(|player| player.stocks_remaining.is_none())
);
}
}
+3 -22
View File
@@ -3,7 +3,7 @@ use thiserror::Error;
use crate::{
fighter::FighterId,
match_loading::{MatchConfig, MatchPlayer, MatchRules},
match_loading::{MatchPlayer, PendingMatch},
stage::manifest::StageId,
};
@@ -60,7 +60,7 @@ impl MenuMatchConfig {
!has_unselected_fighter
}
pub fn to_match_config(&self) -> Result<MatchConfig, MenuMatchConfigErrors> {
pub fn to_pending_match(&self) -> Result<PendingMatch, MenuMatchConfigErrors> {
let mut match_players = vec![];
let stage = self.stage.ok_or(MenuMatchConfigErrors::StageNotSelected)?;
@@ -78,28 +78,9 @@ impl MenuMatchConfig {
});
}
Ok(MatchConfig {
Ok(PendingMatch {
players: match_players,
stage,
rules: MatchRules::default(),
})
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn menu_config_uses_default_match_rules() {
let menu = MenuMatchConfig {
stage: Some(StageId::TestStage),
players: vec![MenuMatchPlayerSlot {
slot: 0,
fighter: Some(FighterId::TestFighter),
}],
};
assert_eq!(menu.to_match_config().unwrap().rules, MatchRules::default());
}
}
+1 -1
View File
@@ -77,7 +77,7 @@ pub fn stage_selected(
initiate_match(
&mut commands,
&mut next_state,
match_config.to_match_config()?,
match_config.to_pending_match()?,
);
}
Ok(())
+25 -26
View File
@@ -12,12 +12,16 @@ use clap::ValueEnum;
use serde::{Deserialize, Serialize};
use crate::{
AppState, args::Args, input::FighterInputFrame, match_loading::MatchConfig, netcode::GGRSCfg,
AppState,
args::Args,
input::FighterInputFrame,
match_loading::{MatchPlayer, PendingMatch},
netcode::GGRSCfg,
schedule::GameplaySet,
};
const MAGIC: &[u8; 8] = b"SPRPLY01";
pub const REPLAY_VERSION: u32 = 2;
pub const REPLAY_VERSION: u32 = 1;
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, ValueEnum)]
pub enum ReplayFormat {
@@ -30,11 +34,17 @@ pub enum ReplayFormat {
pub struct Replay {
pub replay_version: u32,
pub game_version: String,
pub match_config: MatchConfig,
pub match_config: ReplayMatch,
pub frames: Vec<ReplayFrame>,
pub checksums: Vec<ReplayChecksum>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ReplayMatch {
pub stage: crate::stage::manifest::StageId,
pub players: Vec<MatchPlayer>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct ReplayFrame {
pub frame: i32,
@@ -257,27 +267,27 @@ fn stop_recording(
mut commands: Commands,
stop_request: Option<Res<StopReplayRecording>>,
runtime: Option<ResMut<ReplayRuntime>>,
config: Option<Res<MatchConfig>>,
request: Option<Res<PendingMatch>>,
) {
if stop_request.is_none() {
return;
}
commands.remove_resource::<StopReplayRecording>();
finish_recording_inner(&mut commands, runtime, config);
finish_recording_inner(&mut commands, runtime, request);
}
fn finish_recording(
mut commands: Commands,
runtime: Option<ResMut<ReplayRuntime>>,
config: Option<Res<MatchConfig>>,
request: Option<Res<PendingMatch>>,
) {
finish_recording_inner(&mut commands, runtime, config);
finish_recording_inner(&mut commands, runtime, request);
}
fn finish_recording_inner(
commands: &mut Commands,
runtime: Option<ResMut<ReplayRuntime>>,
config: Option<Res<MatchConfig>>,
request: Option<Res<PendingMatch>>,
) {
let Some(mut runtime) = runtime else { return };
let ReplayMode::Record { path, format } = &runtime.mode else {
@@ -286,13 +296,16 @@ fn finish_recording_inner(
if runtime.finished || runtime.frames.is_empty() {
return;
}
let Some(config) = config else { return };
let Some(request) = request else { return };
let path = path.clone();
let format = *format;
let replay = Replay {
replay_version: REPLAY_VERSION,
game_version: env!("CARGO_PKG_VERSION").into(),
match_config: config.as_ref().clone(),
match_config: ReplayMatch {
stage: request.stage,
players: request.players.clone(),
},
frames: runtime
.frames
.iter()
@@ -342,7 +355,7 @@ mod tests {
use super::*;
use crate::{
fighter::FighterId,
match_loading::{MatchPlayer, MatchRules},
match_loading::MatchPlayer,
math::{int::FGi32, vec::FGVec2},
stage::manifest::StageId,
};
@@ -351,15 +364,12 @@ mod tests {
Replay {
replay_version: REPLAY_VERSION,
game_version: "test".into(),
match_config: MatchConfig {
match_config: ReplayMatch {
stage: StageId::TestStage,
players: vec![MatchPlayer {
handle: 0,
fighter: FighterId::TestFighter,
}],
rules: MatchRules::Timed {
time_limit_frames: 21_600,
},
},
frames: vec![ReplayFrame {
frame: 1,
@@ -396,15 +406,4 @@ mod tests {
replay.frames[0].inputs.clear();
assert!(validate(&replay).is_err());
}
#[test]
fn unsupported_replay_version_is_rejected() {
let mut replay = sample();
replay.replay_version = 1;
assert_eq!(
validate(&replay).unwrap_err(),
"unsupported replay version 1"
);
}
}
+9 -18
View File
@@ -1,29 +1,20 @@
use bevy::prelude::*;
use crate::{
fighter::manifest::{FighterManifest, FighterManifestRegistry},
match_loading::MatchConfig,
ui::{errors::UIErrors, fighter_info::FighterInfoUI},
fighter::manifest::{FighterManifest, FighterManifestRegistry}, match_loading::{PendingMatch}, ui::{errors::UIErrors, fighter_info::FighterInfoUI},
};
#[derive(Component, FromTemplate)]
pub struct BattleUI {}
pub struct BattleUI {
}
pub fn spawn_battle_ui(mut commands: Commands, request: Res<PendingMatch>, fighter_registry: Res<FighterManifestRegistry>, manifests: Res<Assets<FighterManifest>>) -> Result {
pub fn spawn_battle_ui(
mut commands: Commands,
config: Res<MatchConfig>,
fighter_registry: Res<FighterManifestRegistry>,
manifests: Res<Assets<FighterManifest>>,
) -> Result {
let mut fighter_uis = vec![];
for player in &config.players {
let manifest = fighter_registry
.get(player.fighter)
.ok_or_else(|| UIErrors::FighterManifestHandleNotFound(player.fighter))?;
let manifest = manifests
.get(manifest)
.ok_or_else(|| UIErrors::FighterManifestNotFound(player.fighter))?;
for player in &request.players {
let manifest = fighter_registry.get(player.fighter).ok_or_else(|| UIErrors::FighterManifestHandleNotFound(player.fighter))?;
let manifest = manifests.get(manifest).ok_or_else(|| UIErrors::FighterManifestNotFound(player.fighter))?;
fighter_uis.push(FighterInfoUI::build(manifest, player));
}
@@ -63,4 +54,4 @@ pub fn cleanup_battle_ui(mut commands: Commands, battle_ui: Query<Entity, With<B
for entity in battle_ui {
commands.entity(entity).despawn();
}
}
}
+7 -53
View File
@@ -1,17 +1,13 @@
use bevy::prelude::*;
use crate::{
fighter::{attack::FighterDamage, manifest::FighterManifest}, match_loading::{MatchPlayer}, match_runtime::MatchState, player::Player, ui::stock_icon::BattleUIStockIcon,
};
use crate::{fighter::{attack::FighterDamage, manifest::{FighterManifest}}, match_loading::MatchPlayer, player::Player};
#[derive(Component, FromTemplate)]
pub struct FighterInfoUI {
percentage_text: Entity,
stock_icon_container: Entity,
_name_text: Entity,
player_handle: usize,
visible_damage: FighterDamage,
visible_stocks: u8,
}
impl FighterInfoUI {
@@ -20,7 +16,6 @@ impl FighterInfoUI {
bsn! {
FighterInfoUI {
percentage_text: #PercentageText,
stock_icon_container: #StockIconContainer,
_name_text: #NameText,
player_handle: {match_player.handle}
}
@@ -30,10 +25,6 @@ impl FighterInfoUI {
justify_content: JustifyContent::Center,
}
Children [
(
#StockIconContainer
Node
)
(
#PercentageText
Text("0.00%")
@@ -50,54 +41,17 @@ impl FighterInfoUI {
}
}
pub fn update_fighter_info_damage(
fighters: Query<(&Player, &FighterDamage)>,
ui_elements: Query<&mut FighterInfoUI>,
mut commands: Commands,
) {
pub fn update_fighter_info_damage(fighters: Query<(&Player, &FighterDamage)>, ui_elements: Query<&mut FighterInfoUI>, mut commands: Commands) {
for mut ui_element in ui_elements {
let Some((_, damage)) = fighters
.iter()
.find(|(player, _)| player.handle == ui_element.player_handle)
else {
let Some((_, damage)) = fighters.iter().find(|(player, _)| {
player.handle == ui_element.player_handle
}) else {
continue;
};
if *damage != ui_element.visible_damage {
commands
.entity(ui_element.percentage_text)
.insert(Text(format!("{}%", damage)));
commands.entity(ui_element.percentage_text).insert(Text(format!("{}%", damage)));
ui_element.visible_damage = damage.clone();
}
}
}
pub fn update_fighter_info_stocks(
match_state: Res<MatchState>,
ui_elements: Query<&mut FighterInfoUI>,
mut commands: Commands,
) {
for mut ui_element in ui_elements {
let handle = ui_element.player_handle;
let Some(match_player) = match_state.players.get(handle) else {
continue;
};
let Some(stocks) = match_player.stocks_remaining else {
continue;
};
if stocks != ui_element.visible_stocks {
commands
.entity(ui_element.stock_icon_container)
.despawn_children()
.with_children(|spawner| {
for _ in 0..stocks {
spawner.spawn_empty().apply_scene(BattleUIStockIcon::scene());
}
});
ui_element.visible_stocks = stocks;
}
}
}
}
+2 -21
View File
@@ -1,15 +1,10 @@
use bevy::prelude::*;
use crate::{
AppState,
match_loading::{MatchConfig, MatchRules},
match_runtime::MatchState,
};
use crate::AppState;
pub mod battle_ui;
pub mod errors;
pub mod fighter_info;
pub mod stock_icon;
#[derive(Default)]
pub struct InGameUIPlugin;
@@ -18,20 +13,6 @@ impl Plugin for InGameUIPlugin {
fn build(&self, app: &mut App) {
app.add_systems(OnEnter(AppState::InMatch), battle_ui::spawn_battle_ui)
.add_systems(OnExit(AppState::InMatch), battle_ui::cleanup_battle_ui)
.add_systems(PostUpdate, fighter_info::update_fighter_info_damage)
.add_systems(
PostUpdate,
fighter_info::update_fighter_info_stocks.run_if(
resource_exists::<MatchState>
.and_then(resource_exists::<MatchConfig>)
.and_then(|match_config: Res<MatchConfig>| {
if let MatchRules::Stock { .. } = match_config.rules {
true
} else {
false
}
}),
),
);
.add_systems(PostUpdate, fighter_info::update_fighter_info_damage);
}
}
-17
View File
@@ -1,17 +0,0 @@
use bevy::prelude::*;
#[derive(SceneComponent, Clone, FromTemplate)]
pub struct BattleUIStockIcon;
impl BattleUIStockIcon {
pub fn scene() -> impl Scene {
bsn! {
Node {
width: px(32),
height: px(32),
border_radius: BorderRadius::MAX,
}
BackgroundColor({bevy::color::palettes::css::RED})
}
}
}