diff --git a/Cargo.toml b/Cargo.toml index a915c2a..b4fb2b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,8 +10,9 @@ members = ["ray_format"] [dependencies] anyhow = "1.0.71" bevy = { version = "0.10.1" } +bevy_eventlistener = "0.2.2" bevy_framepace = "0.12.1" -bevy_mod_picking = { git = "https://github.com/aevyrie/bevy_mod_picking/", branch = "ui-fix", default-features = false, features = ["backend_bevy_ui", "debug"] } +bevy_mod_picking = { version = "0.14", default-features = false, features = ["backend_bevy_ui", "debug"] } bevy_mod_scripting = { version = "0.3.0", features = ["rhai"] } bevy_ninepatch = "0.10.0" bevy_tweening = "0.7.0" diff --git a/src/ui/levels.rs b/src/ui/levels.rs index 9a12b69..0d24b79 100644 --- a/src/ui/levels.rs +++ b/src/ui/levels.rs @@ -1,6 +1,7 @@ use std::{collections::HashMap, marker::PhantomData, time::Duration}; use bevy::prelude::*; +use bevy_eventlistener::callbacks::ListenerInput; use bevy_mod_picking::prelude::*; use bevy_ninepatch::*; use bevy_tweening::{lens::UiPositionLens, *}; @@ -32,8 +33,8 @@ pub struct ArrowDrag { _data: PhantomData, } -impl From> for ArrowDrag { - fn from(value: ListenedEvent) -> Self { +impl From>> for ArrowDrag { + fn from(value: ListenerInput>) -> Self { ArrowDrag { target: value.target, delta: value.delta, @@ -184,7 +185,9 @@ pub(super) fn spawn_levels( ..default() }) .insert(MicLevelArrow) - .insert(OnPointer::::send_event::>()); + .insert( + On::>::send_event::>(), + ); parent .spawn(NinePatchBundle { style: Style { @@ -202,35 +205,37 @@ pub(super) fn spawn_levels( .insert(MicLevelContainer); }); }); - parent.spawn(NodeBundle { - style: Style { - flex_direction: FlexDirection::Column, - gap: Size::height(Val::Px(10.)), - ..default() - } , - ..default() - }).with_children(|parent| { - parent.spawn(ImageBundle { - image: UiImage::new(ass.load("lips.png")), - background_color: Color::BLACK.into(), - ..default() - }); - let mut content = HashMap::new(); - content.insert((), active_bar); - parent.spawn(NinePatchBundle { + parent + .spawn(NodeBundle { style: Style { - size: Size::new(Val::Px(32.), Val::Percent(100.)), - ..default() - }, - nine_patch_data: NinePatchData { - texture: bar_img.clone(), - nine_patch: bar_patch.clone(), - content: Some(content), + flex_direction: FlexDirection::Column, + gap: Size::height(Val::Px(10.)), ..default() }, ..default() + }) + .with_children(|parent| { + parent.spawn(ImageBundle { + image: UiImage::new(ass.load("lips.png")), + background_color: Color::BLACK.into(), + ..default() + }); + let mut content = HashMap::new(); + content.insert((), active_bar); + parent.spawn(NinePatchBundle { + style: Style { + size: Size::new(Val::Px(32.), Val::Percent(100.)), + ..default() + }, + nine_patch_data: NinePatchData { + texture: bar_img.clone(), + nine_patch: bar_patch.clone(), + content: Some(content), + ..default() + }, + ..default() + }); }); - }); }); }