init tui
This commit is contained in:
parent
b47ecbf45a
commit
53e4047e6a
8 changed files with 720 additions and 15 deletions
58
src/tiles.rs
Normal file
58
src/tiles.rs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
use bevy::prelude::*;
|
||||
use strum::FromRepr;
|
||||
|
||||
#[derive(Component)]
|
||||
pub(crate) enum Tile {
|
||||
Pin(Number),
|
||||
Sou(Number),
|
||||
Man(Number),
|
||||
Wind(Wind),
|
||||
Dragon(Dragon),
|
||||
}
|
||||
|
||||
#[derive(FromRepr)]
|
||||
pub(crate) enum Number {
|
||||
One = 1,
|
||||
Two,
|
||||
Three,
|
||||
Four,
|
||||
Five,
|
||||
Six,
|
||||
Seven,
|
||||
Eight,
|
||||
Nine,
|
||||
}
|
||||
|
||||
#[derive(FromRepr)]
|
||||
pub(crate) enum Wind {
|
||||
Ton,
|
||||
Nan,
|
||||
Shaa,
|
||||
Pei,
|
||||
}
|
||||
|
||||
#[derive(FromRepr)]
|
||||
pub(crate) enum Dragon {
|
||||
Haku,
|
||||
Hatsu,
|
||||
Chun,
|
||||
}
|
||||
|
||||
#[derive(Component)]
|
||||
pub(crate) struct Dora;
|
||||
|
||||
pub fn init_tiles(mut commands: Commands) {
|
||||
for _ in 0..4 {
|
||||
for i in 1..=9 {
|
||||
commands.spawn((Tile::Pin(Number::from_repr(i).unwrap()),));
|
||||
commands.spawn((Tile::Sou(Number::from_repr(i).unwrap()),));
|
||||
commands.spawn((Tile::Man(Number::from_repr(i).unwrap()),));
|
||||
}
|
||||
for i in 0..4 {
|
||||
commands.spawn((Tile::Wind(Wind::from_repr(i).unwrap()),));
|
||||
}
|
||||
for i in 0..3 {
|
||||
commands.spawn((Tile::Dragon(Dragon::from_repr(i).unwrap()),));
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue