Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
projet-cdaw
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Quentin Vrel
projet-cdaw
Commits
de3c0ef8
Commit
de3c0ef8
authored
Dec 03, 2020
by
Zohten
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
model madness
parent
024af59f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
101 additions
and
44 deletions
+101
-44
Player.js
frontend/src/model/Player.js
+15
-0
Round.js
frontend/src/model/Round.js
+15
-0
Tile.js
frontend/src/model/Tile.js
+69
-42
Lobby.vue
frontend/src/views/Lobby.vue
+1
-1
Profile.vue
frontend/src/views/Profile.vue
+1
-1
No files found.
frontend/src/model/Player.js
0 → 100644
View file @
de3c0ef8
export
default
class
User
{
constructor
()
{
this
.
state
=
{
id
:
id
,
users
:
[],
players
:
[]
};
}
/**
*
*/
async
registerPlayer
(
id
)
{
}
}
\ No newline at end of file
frontend/src/model/Round.js
0 → 100644
View file @
de3c0ef8
export
default
class
Round
{
constructor
(
players
)
{
this
.
state
=
{
id
:
id
,
users
:
[],
players
:
[]
};
}
/**
* Register player
*/
async
registerPlayer
(
id
)
{
}
}
\ No newline at end of file
frontend/src/model/Tile.js
View file @
de3c0ef8
const
TILE_NAMES
=
{
"0"
:
"
b
amboo 1"
,
"1"
:
"
b
amboo 2"
,
"2"
:
"
b
amboo 3"
,
"3"
:
"
b
amboo 4"
,
"4"
:
"
b
amboo 5"
,
"5"
:
"
b
amboo 6"
,
"6"
:
"
b
amboo 7"
,
"7"
:
"
b
amboo 8"
,
"8"
:
"
b
amboo 9"
,
"9"
:
"
c
haracters 1"
,
"10"
:
"
c
haracters 2"
,
"11"
:
"
c
haracters 3"
,
"12"
:
"
c
haracters 4"
,
"13"
:
"
c
haracters 5"
,
"14"
:
"
c
haracters 6"
,
"15"
:
"
c
haracters 7"
,
"16"
:
"
c
haracters 8"
,
"17"
:
"
c
haracters 9"
,
"18"
:
"
d
ots 1"
,
"19"
:
"
d
ots 2"
,
"20"
:
"
d
ots 3"
,
"21"
:
"
d
ots 4"
,
"22"
:
"
d
ots 5"
,
"23"
:
"
d
ots 6"
,
"24"
:
"
d
ots 7"
,
"25"
:
"
d
ots 8"
,
"26"
:
"
d
ots 9"
,
"27"
:
"
e
ast"
,
"28"
:
"
s
outh"
,
"29"
:
"
w
est"
,
"30"
:
"
n
orth"
,
"31"
:
"
g
reen dragon"
,
"32"
:
"
r
ed dragon"
,
"33"
:
"
w
hite dragon"
"0"
:
"
B
amboo 1"
,
"1"
:
"
B
amboo 2"
,
"2"
:
"
B
amboo 3"
,
"3"
:
"
B
amboo 4"
,
"4"
:
"
B
amboo 5"
,
"5"
:
"
B
amboo 6"
,
"6"
:
"
B
amboo 7"
,
"7"
:
"
B
amboo 8"
,
"8"
:
"
B
amboo 9"
,
"9"
:
"
C
haracters 1"
,
"10"
:
"
C
haracters 2"
,
"11"
:
"
C
haracters 3"
,
"12"
:
"
C
haracters 4"
,
"13"
:
"
C
haracters 5"
,
"14"
:
"
C
haracters 6"
,
"15"
:
"
C
haracters 7"
,
"16"
:
"
C
haracters 8"
,
"17"
:
"
C
haracters 9"
,
"18"
:
"
D
ots 1"
,
"19"
:
"
D
ots 2"
,
"20"
:
"
D
ots 3"
,
"21"
:
"
D
ots 4"
,
"22"
:
"
D
ots 5"
,
"23"
:
"
D
ots 6"
,
"24"
:
"
D
ots 7"
,
"25"
:
"
D
ots 8"
,
"26"
:
"
D
ots 9"
,
"27"
:
"
E
ast"
,
"28"
:
"
S
outh"
,
"29"
:
"
W
est"
,
"30"
:
"
N
orth"
,
"31"
:
"
G
reen dragon"
,
"32"
:
"
R
ed dragon"
,
"33"
:
"
W
hite dragon"
};
const
TILE_CODES
=
{
...
...
@@ -110,15 +110,42 @@ const TILE_NAMES = {
};
const
SUIT_NAMES
=
{
"0"
:
"
b
amboo"
,
"1"
:
"
c
haracters"
,
"2"
:
"
d
ots"
,
"3"
:
"
w
inds"
,
"4"
:
"
d
ragons"
"0"
:
"
B
amboo"
,
"1"
:
"
C
haracters"
,
"2"
:
"
D
ots"
,
"3"
:
"
W
inds"
,
"4"
:
"
D
ragons"
};
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
frontend/src/views/Lobby.vue
View file @
de3c0ef8
...
...
@@ -33,7 +33,7 @@ import UserRibbon from '@/components/UserRibbon.vue'
import
PageTitle
from
'@/components/PageTitle.vue'
import
ButtonText
from
'@/components/ButtonText.vue'
import
TextInput
from
'@/components/form/TextInput.vue'
import
User
from
'@/model/
u
ser.js'
import
User
from
'@/model/
U
ser.js'
export
default
{
name
:
'lobby'
,
...
...
frontend/src/views/Profile.vue
View file @
de3c0ef8
...
...
@@ -38,7 +38,7 @@
import
Avatar
from
'../components/Avatar.vue'
;
import
PageTitle
from
'../components/PageTitle.vue'
;
import
SvgButton
from
'../components/SvgButton.vue'
;
import
User
from
'@/model/
u
ser.js'
import
User
from
'@/model/
U
ser.js'
// @ is an alias to /src
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment