feat: Implement GameScreen settings with timer settings (#33)
This commit is contained in:
@@ -1,3 +1,182 @@
|
||||
use super::super::components::*;
|
||||
use super::timer_settings::timer_settings;
|
||||
use crate::prelude::*;
|
||||
|
||||
pub fn open_settings(commands: &mut Commands) {}
|
||||
pub fn open_settings(commands: &mut Commands) {
|
||||
commands
|
||||
.spawn((
|
||||
RootMarker::Settings,
|
||||
Node {
|
||||
position_type: PositionType::Absolute,
|
||||
width: percent(100),
|
||||
height: percent(100),
|
||||
justify_content: JustifyContent::Center,
|
||||
align_items: AlignItems::Center,
|
||||
..default()
|
||||
},
|
||||
ZIndex(1),
|
||||
BackgroundColor(Color::srgba(0.0, 0.0, 0.0, 0.8)),
|
||||
))
|
||||
.with_children(|parent| {
|
||||
parent
|
||||
.spawn((
|
||||
Node {
|
||||
flex_direction: FlexDirection::Column,
|
||||
align_items: AlignItems::Center,
|
||||
padding: UiRect::all(px(20.0)),
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(Color::srgb(0.2, 0.2, 0.2)),
|
||||
BorderRadius::all(px(10.0)),
|
||||
))
|
||||
.with_children(|parent| {
|
||||
parent.spawn((
|
||||
Node {
|
||||
width: percent(100.0),
|
||||
justify_content: JustifyContent::SpaceBetween,
|
||||
align_items: AlignItems::Center,
|
||||
margin: UiRect::bottom(px(20.0)),
|
||||
column_gap: px(20.0),
|
||||
..default()
|
||||
},
|
||||
children![
|
||||
(
|
||||
Text::new("Spiel Einstellungen"),
|
||||
TextFont::from_font_size(40.0),
|
||||
TextColor(Color::WHITE),
|
||||
),
|
||||
(
|
||||
Button,
|
||||
ButtonType::SettingsClose,
|
||||
Node {
|
||||
width: px(40.0),
|
||||
height: px(40.0),
|
||||
justify_content: JustifyContent::Center,
|
||||
align_items: AlignItems::Center,
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(Color::srgb(0.8, 0.2, 0.2)),
|
||||
BorderRadius::MAX,
|
||||
children![(
|
||||
Text::new("X"),
|
||||
TextFont::from_font_size(24.0),
|
||||
TextColor(Color::WHITE),
|
||||
)]
|
||||
)
|
||||
],
|
||||
));
|
||||
|
||||
parent
|
||||
.spawn(Node {
|
||||
width: percent(100),
|
||||
flex_direction: FlexDirection::Column,
|
||||
margin: UiRect::top(px(10.0)),
|
||||
row_gap: px(10.0),
|
||||
..default()
|
||||
})
|
||||
.with_children(|parent| {
|
||||
parent.spawn((
|
||||
Button,
|
||||
ButtonType::SettingsExit,
|
||||
Node {
|
||||
width: percent(100),
|
||||
height: px(80),
|
||||
justify_content: JustifyContent::Center,
|
||||
align_items: AlignItems::Center,
|
||||
padding: UiRect::horizontal(px(10.0)),
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(NORMAL_BUTTON),
|
||||
BorderRadius::all(px(10)),
|
||||
children![(
|
||||
Text::new("Spiel verlassen"),
|
||||
TextFont::from_font_size(24.0),
|
||||
TextColor(Color::WHITE)
|
||||
)],
|
||||
));
|
||||
|
||||
parent.spawn((
|
||||
Button,
|
||||
ButtonType::SettingsSave,
|
||||
Node {
|
||||
width: percent(100),
|
||||
height: px(80),
|
||||
justify_content: JustifyContent::Center,
|
||||
align_items: AlignItems::Center,
|
||||
padding: UiRect::horizontal(px(10.0)),
|
||||
..default()
|
||||
},
|
||||
BackgroundColor(NORMAL_BUTTON),
|
||||
BorderRadius::all(px(10)),
|
||||
children![(
|
||||
Text::new("Spiel speichern"),
|
||||
TextFont::from_font_size(24.0),
|
||||
TextColor(Color::WHITE)
|
||||
)],
|
||||
));
|
||||
|
||||
parent.spawn((
|
||||
Node {
|
||||
width: percent(100),
|
||||
flex_direction: FlexDirection::Row,
|
||||
justify_content: JustifyContent::SpaceBetween,
|
||||
align_items: AlignItems::Center,
|
||||
column_gap: px(10),
|
||||
padding: UiRect::horizontal(px(10.0)),
|
||||
..default()
|
||||
},
|
||||
children![
|
||||
(
|
||||
Node {
|
||||
flex_direction: FlexDirection::Column,
|
||||
align_items: AlignItems::Center,
|
||||
row_gap: px(10),
|
||||
..default()
|
||||
},
|
||||
children![
|
||||
(
|
||||
Text::new("Fokus Phase"),
|
||||
TextFont::from_font_size(12.0),
|
||||
TextColor(Color::WHITE)
|
||||
),
|
||||
timer_settings(TimerType::Focus)
|
||||
]
|
||||
),
|
||||
(
|
||||
Node {
|
||||
flex_direction: FlexDirection::Column,
|
||||
align_items: AlignItems::Center,
|
||||
row_gap: px(10),
|
||||
..default()
|
||||
},
|
||||
children![
|
||||
(
|
||||
Text::new("Kurze Pause"),
|
||||
TextFont::from_font_size(12.0),
|
||||
TextColor(Color::WHITE)
|
||||
),
|
||||
timer_settings(TimerType::ShortBreak)
|
||||
]
|
||||
),
|
||||
(
|
||||
Node {
|
||||
flex_direction: FlexDirection::Column,
|
||||
align_items: AlignItems::Center,
|
||||
row_gap: px(10),
|
||||
..default()
|
||||
},
|
||||
children![
|
||||
(
|
||||
Text::new("Lange Pause"),
|
||||
TextFont::from_font_size(12.0),
|
||||
TextColor(Color::WHITE)
|
||||
),
|
||||
timer_settings(TimerType::LongBreak)
|
||||
]
|
||||
)
|
||||
],
|
||||
));
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user