|
|
|
@ -72,28 +72,34 @@ fn init_dice(
|
|
|
|
mut materials: ResMut<Assets<ColorMaterial>>,
|
|
|
|
mut materials: ResMut<Assets<ColorMaterial>>,
|
|
|
|
mut commands: Commands
|
|
|
|
mut commands: Commands
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
commands.spawn((
|
|
|
|
[
|
|
|
|
GameChoice::Dice, MenuState::Closed,
|
|
|
|
["a", "b", "c", "d", "e", "f"],
|
|
|
|
Die::new(["a", "b", "c", "d", "e", "f"]),
|
|
|
|
["g", "h", "i", "j", "k", "l"],
|
|
|
|
PickableBundle { ..default() },
|
|
|
|
["m", "n", "o", "p", "q", "r"],
|
|
|
|
On::<Pointer<Drag>>::target_component_mut::<Transform>(|m, transform| {
|
|
|
|
].into_iter().enumerate().for_each(|(idx, set)| {
|
|
|
|
transform.translation.x += m.delta.x;
|
|
|
|
commands.spawn((
|
|
|
|
transform.translation.y -= m.delta.y;
|
|
|
|
GameChoice::Dice, MenuState::Closed,
|
|
|
|
})
|
|
|
|
Die::new(set),
|
|
|
|
)).insert(Text2dBundle {
|
|
|
|
PickableBundle { ..default() },
|
|
|
|
text: Text::from_section(
|
|
|
|
On::<Pointer<Drag>>::target_component_mut::<Transform>(|m, transform| {
|
|
|
|
"",
|
|
|
|
transform.translation.x += m.delta.x;
|
|
|
|
TextStyle {
|
|
|
|
transform.translation.y -= m.delta.y;
|
|
|
|
color: Color::BLACK,
|
|
|
|
})
|
|
|
|
font_size: 32.0,
|
|
|
|
)).insert(MaterialMesh2dBundle {
|
|
|
|
..default()
|
|
|
|
mesh: meshes.add(Rectangle { half_size: Vec2::splat(32.0) }).into(),
|
|
|
|
},
|
|
|
|
material: materials.add(Color::PINK),
|
|
|
|
),
|
|
|
|
..default()
|
|
|
|
..default()
|
|
|
|
}).insert(Text2dBundle {
|
|
|
|
}).insert(MaterialMesh2dBundle {
|
|
|
|
text: Text::from_section(
|
|
|
|
mesh: meshes.add(Rectangle { half_size: Vec2::splat(32.0) }).into(),
|
|
|
|
"",
|
|
|
|
material: materials.add(Color::PINK),
|
|
|
|
TextStyle {
|
|
|
|
..default()
|
|
|
|
color: Color::BLACK,
|
|
|
|
|
|
|
|
font_size: 32.0,
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
..default()
|
|
|
|
|
|
|
|
}).insert(Transform::from_xyz(idx as f32 * 100.0, 100.0, 0.0));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|