@@ -5,19 +5,23 @@ use bevy::ecs::schedule::ScheduleLabel;
|
||||
use bevy::ecs::system::RunSystemOnce;
|
||||
use bevy::prelude::*;
|
||||
use bevy::utils::HashMap;
|
||||
use bevy_xr::session::{status_changed_to, XrStatus};
|
||||
use openxr::sys::ActionSuggestedBinding;
|
||||
|
||||
use crate::resources::OxrInstance;
|
||||
use crate::{init::OxrPreUpdateSet, resources::OxrInstance, session::OxrSessionStatusEvent};
|
||||
|
||||
impl Plugin for OxrActionBindingPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_schedule(Schedule::new(OxrSendActionBindings));
|
||||
app.add_event::<OxrSuggestActionBinding>();
|
||||
app.add_systems(
|
||||
Update,
|
||||
PostUpdate,
|
||||
run_action_binding_sugestion
|
||||
.run_if(status_changed_to(XrStatus::Ready).and_then(run_once())),
|
||||
.run_if(|mut session_state: EventReader<OxrSessionStatusEvent>| {
|
||||
session_state
|
||||
.read()
|
||||
.any(|s| *s == OxrSessionStatusEvent::Created)
|
||||
})
|
||||
.after(OxrPreUpdateSet::HandleEvents),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user