Commit de3c0ef8 authored by Zohten's avatar Zohten

model madness

parent 024af59f
export default class User {
constructor() {
this.state = {
id: id,
users: [],
players: []
};
}
/**
*
*/
async registerPlayer(id) {
}
}
\ No newline at end of file
export default class Round {
constructor(players) {
this.state = {
id: id,
users: [],
players: []
};
}
/**
* Register player
*/
async registerPlayer(id) {
}
}
\ No newline at end of file
const TILE_NAMES = { const TILE_NAMES = {
"0": "bamboo 1", "0": "Bamboo 1",
"1": "bamboo 2", "1": "Bamboo 2",
"2": "bamboo 3", "2": "Bamboo 3",
"3": "bamboo 4", "3": "Bamboo 4",
"4": "bamboo 5", "4": "Bamboo 5",
"5": "bamboo 6", "5": "Bamboo 6",
"6": "bamboo 7", "6": "Bamboo 7",
"7": "bamboo 8", "7": "Bamboo 8",
"8": "bamboo 9", "8": "Bamboo 9",
"9": "characters 1", "9": "Characters 1",
"10": "characters 2", "10": "Characters 2",
"11": "characters 3", "11": "Characters 3",
"12": "characters 4", "12": "Characters 4",
"13": "characters 5", "13": "Characters 5",
"14": "characters 6", "14": "Characters 6",
"15": "characters 7", "15": "Characters 7",
"16": "characters 8", "16": "Characters 8",
"17": "characters 9", "17": "Characters 9",
"18": "dots 1", "18": "Dots 1",
"19": "dots 2", "19": "Dots 2",
"20": "dots 3", "20": "Dots 3",
"21": "dots 4", "21": "Dots 4",
"22": "dots 5", "22": "Dots 5",
"23": "dots 6", "23": "Dots 6",
"24": "dots 7", "24": "Dots 7",
"25": "dots 8", "25": "Dots 8",
"26": "dots 9", "26": "Dots 9",
"27": "east", "27": "East",
"28": "south", "28": "South",
"29": "west", "29": "West",
"30": "north", "30": "North",
"31": "green dragon", "31": "Green dragon",
"32": "red dragon", "32": "Red dragon",
"33": "white dragon" "33": "White dragon"
}; };
const TILE_CODES = { const TILE_CODES = {
...@@ -110,15 +110,42 @@ const TILE_NAMES = { ...@@ -110,15 +110,42 @@ const TILE_NAMES = {
}; };
const SUIT_NAMES = { const SUIT_NAMES = {
"0": "bamboo", "0": "Bamboo",
"1": "characters", "1": "Characters",
"2": "dots", "2": "Dots",
"3": "winds", "3": "Winds",
"4": "dragons" "4": "Dragons"
}; };
export default class Tile { export default class Tile {
constructor() { constructor(id) {
this.id = id;
}
getName(){
return TILE_NAMES[this.id];
}
getImage(){
return TILE_GLYPHS[this.id];
}
getCode(){
return TILE_CODES[this.id];
}
getFamily(){
const divEucl = Math.floor(this.id/9);
if(divEucl<=3){
return SUIT_NAMES[divEucl];
}else if(this.id<=30 && this.id>=27){
return SUIT_NAMES[3];
}else if(this.id<=33 && this.id>=31){
return SUIT_NAMES[4];
}else{
return 'Unknown';
}
} }
} }
const test = new Tile(26);
console.log(test.getFamily());
\ No newline at end of file
...@@ -33,7 +33,7 @@ import UserRibbon from '@/components/UserRibbon.vue' ...@@ -33,7 +33,7 @@ import UserRibbon from '@/components/UserRibbon.vue'
import PageTitle from '@/components/PageTitle.vue' import PageTitle from '@/components/PageTitle.vue'
import ButtonText from '@/components/ButtonText.vue' import ButtonText from '@/components/ButtonText.vue'
import TextInput from '@/components/form/TextInput.vue' import TextInput from '@/components/form/TextInput.vue'
import User from '@/model/user.js' import User from '@/model/User.js'
export default { export default {
name: 'lobby', name: 'lobby',
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
import Avatar from '../components/Avatar.vue'; import Avatar from '../components/Avatar.vue';
import PageTitle from '../components/PageTitle.vue'; import PageTitle from '../components/PageTitle.vue';
import SvgButton from '../components/SvgButton.vue'; import SvgButton from '../components/SvgButton.vue';
import User from '@/model/user.js' import User from '@/model/User.js'
// @ is an alias to /src // @ is an alias to /src
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment