|
|
|
|
@ -58,6 +58,7 @@ fn init_editor(
|
|
|
|
|
|
|
|
|
|
fn open_editor(
|
|
|
|
|
mut ws: Query<&mut Window, With<Editor>>,
|
|
|
|
|
state: Res<State<EditorState>>,
|
|
|
|
|
) {
|
|
|
|
|
ws.iter_mut().for_each(|mut w| {
|
|
|
|
|
w.visible = true;
|
|
|
|
|
@ -66,6 +67,7 @@ fn open_editor(
|
|
|
|
|
|
|
|
|
|
fn close_editor(
|
|
|
|
|
mut ws: Query<&mut Window, With<Editor>>,
|
|
|
|
|
state: Res<State<EditorState>>,
|
|
|
|
|
) {
|
|
|
|
|
ws.iter_mut().for_each(|mut w| {
|
|
|
|
|
w.visible = false;
|
|
|
|
|
@ -75,10 +77,16 @@ fn close_editor(
|
|
|
|
|
fn toggle_editor(
|
|
|
|
|
state: Res<State<EditorState>>,
|
|
|
|
|
mut next_state: ResMut<NextState<EditorState>>,
|
|
|
|
|
keys: Res<ButtonInput<KeyCode>>,
|
|
|
|
|
mut catch: Local<bool>,
|
|
|
|
|
) {
|
|
|
|
|
info!("Toggling editor on/off");
|
|
|
|
|
if keys.pressed(KeyCode::F3) && !*catch {
|
|
|
|
|
*catch = true;
|
|
|
|
|
match state.get() {
|
|
|
|
|
EditorState::Open => next_state.set(EditorState::Closed),
|
|
|
|
|
EditorState::Closed => next_state.set(EditorState::Open),
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
*catch = false;
|
|
|
|
|
}
|
|
|
|
|
}
|