Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Corentin GUILLEVIC
Not Alone
Commits
4758f342
Commit
4758f342
authored
Dec 16, 2020
by
Corentin Guillevic
Browse files
Add status component and player service
parent
2b66891d
Changes
11
Show whitespace changes
Inline
Side-by-side
not-alone-web/src/app/app.module.ts
View file @
4758f342
...
@@ -16,6 +16,7 @@ import { BoardComponent } from './board/board.component';
...
@@ -16,6 +16,7 @@ import { BoardComponent } from './board/board.component';
import
{
PlanetComponent
}
from
'
./planet/planet.component
'
;
import
{
PlanetComponent
}
from
'
./planet/planet.component
'
;
import
{
ReserveComponent
}
from
'
./reserve/reserve.component
'
;
import
{
ReserveComponent
}
from
'
./reserve/reserve.component
'
;
import
{
HandComponent
}
from
'
./hand/hand.component
'
;
import
{
HandComponent
}
from
'
./hand/hand.component
'
;
import
{
StatusComponent
}
from
'
./status/status.component
'
;
@
NgModule
({
@
NgModule
({
declarations
:
[
declarations
:
[
...
@@ -32,7 +33,8 @@ import { HandComponent } from './hand/hand.component';
...
@@ -32,7 +33,8 @@ import { HandComponent } from './hand/hand.component';
BoardComponent
,
BoardComponent
,
PlanetComponent
,
PlanetComponent
,
ReserveComponent
,
ReserveComponent
,
HandComponent
HandComponent
,
StatusComponent
],
],
imports
:
[
imports
:
[
BrowserModule
,
BrowserModule
,
...
...
not-alone-web/src/app/game/game.component.html
View file @
4758f342
...
@@ -2,3 +2,4 @@
...
@@ -2,3 +2,4 @@
<app-planet
[planet]=
"planet"
></app-planet>
<app-planet
[planet]=
"planet"
></app-planet>
<app-reserve
[reserve]=
"reserve"
></app-reserve>
<app-reserve
[reserve]=
"reserve"
></app-reserve>
<app-hand
[hand]=
"hand"
></app-hand>
<app-hand
[hand]=
"hand"
></app-hand>
<app-status
[phase]=
"'2'"
[responses]=
"['Ok', 'KO']"
></app-status>
\ No newline at end of file
not-alone-web/src/app/game/game.component.ts
View file @
4758f342
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
Card
}
from
'
../card
'
;
import
{
Card
}
from
'
../card
'
;
import
{
Hand
}
from
'
../hand
'
;
import
{
Hand
}
from
'
../hand
'
;
import
{
ANGOISSE
,
ANTRE
,
HAND_CREATURE_MOCK
,
HAND_TRAQUE_MOCK
,
PLANET_MOCK
,
RESERVE_MOCK
,
RESISTANCE
}
from
'
../mock-card
'
;
import
{
ANGOISSE
,
ANTRE
,
HAND_CREATURE_MOCK
,
HAND_TRAQUE_MOCK
,
PLANET_MOCK
,
RESERVE_MOCK
,
RESISTANCE
,
SCORE_MOCK
}
from
'
../mock-card
'
;
import
{
Planet
}
from
'
../planet
'
;
import
{
Planet
}
from
'
../planet
'
;
import
{
PlayerService
}
from
'
../player.service
'
;
import
{
Reserve
}
from
'
../reserve
'
;
import
{
Reserve
}
from
'
../reserve
'
;
import
{
Score
}
from
'
../score
'
;
import
{
Score
}
from
'
../score
'
;
@
Component
({
@
Component
({
...
@@ -12,22 +13,34 @@ import { Score } from '../score';
...
@@ -12,22 +13,34 @@ import { Score } from '../score';
})
})
export
class
GameComponent
implements
OnInit
{
export
class
GameComponent
implements
OnInit
{
cards
:
Card
[];
score
:
Score
;
score
:
Score
;
planet
:
Planet
;
planet
:
Planet
;
reserve
:
Reserve
;
reserve
:
Reserve
;
hand
:
Hand
;
hand
:
Hand
;
constructor
()
{
constructor
(
private
playerService
:
PlayerService
)
{
}
this
.
cards
=
[
ANTRE
,
ANGOISSE
,
RESISTANCE
];
this
.
score
=
{
traque
:
18
,
creature
:
2
,
disposition
:
"
FRONT
"
}
this
.
planet
=
PLANET_MOCK
;
this
.
reserve
=
RESERVE_MOCK
;
this
.
hand
=
HAND_TRAQUE_MOCK
;
//this.hand = HAND_CREATURE_MOCK;
}
ngOnInit
()
{
ngOnInit
()
{
console
.
log
(
this
.
playerService
);
this
.
getScore
();
this
.
getPlanet
();
this
.
getReserve
();
this
.
getHand
();
}
getScore
()
:
void
{
this
.
score
=
this
.
playerService
.
getScore
();
}
getPlanet
()
:
void
{
this
.
planet
=
this
.
playerService
.
getPlanet
();
}
getReserve
()
:
void
{
this
.
reserve
=
this
.
playerService
.
getReserve
();
}
getHand
()
:
void
{
this
.
hand
=
this
.
playerService
.
getHand
();
}
}
}
}
not-alone-web/src/app/hand/hand.component.css
View file @
4758f342
...
@@ -32,10 +32,6 @@
...
@@ -32,10 +32,6 @@
margin-bottom
:
0
;
margin-bottom
:
0
;
}
}
#hand
.carte
.pouvoir
{
/*display: none;*/
}
#hand
.carte
.nom
,
#hand
.carte
.nom
,
#hand
.carte
.phase
,
#hand
.carte
.phase
,
#hand
.carte
.numero
{
#hand
.carte
.numero
{
...
...
not-alone-web/src/app/mock-card.ts
View file @
4758f342
...
@@ -2,6 +2,7 @@ import {Card} from './card';
...
@@ -2,6 +2,7 @@ import {Card} from './card';
import
{
Hand
}
from
'
./hand
'
;
import
{
Hand
}
from
'
./hand
'
;
import
{
Planet
}
from
'
./planet
'
;
import
{
Planet
}
from
'
./planet
'
;
import
{
Reserve
}
from
'
./reserve
'
;
import
{
Reserve
}
from
'
./reserve
'
;
import
{
Score
}
from
'
./score
'
;
export
const
ANTRE
:
Card
=
{
name
:
"
L'antre
"
,
type
:
"
PLACE
"
,
description
:
"
Lorem ipsum
"
,
number
:
1
,
color
:
"
sombre
"
,
url
:
"
/assets/img/cartes-lieu/antre.jpg
"
,
phase
:
""
,
symbols
:
[]};
export
const
ANTRE
:
Card
=
{
name
:
"
L'antre
"
,
type
:
"
PLACE
"
,
description
:
"
Lorem ipsum
"
,
number
:
1
,
color
:
"
sombre
"
,
url
:
"
/assets/img/cartes-lieu/antre.jpg
"
,
phase
:
""
,
symbols
:
[]};
export
const
JUNGLE
:
Card
=
{
name
:
"
La jungle
"
,
type
:
"
PLACE
"
,
description
:
"
Lorem ipsum
"
,
number
:
2
,
color
:
"
vert
"
,
url
:
"
/assets/img/cartes-lieu/jungle.jpg
"
,
phase
:
""
,
symbols
:
[]};
export
const
JUNGLE
:
Card
=
{
name
:
"
La jungle
"
,
type
:
"
PLACE
"
,
description
:
"
Lorem ipsum
"
,
number
:
2
,
color
:
"
vert
"
,
url
:
"
/assets/img/cartes-lieu/jungle.jpg
"
,
phase
:
""
,
symbols
:
[]};
...
@@ -69,3 +70,5 @@ export const HAND_CREATURE_MOCK : Hand = {
...
@@ -69,3 +70,5 @@ export const HAND_CREATURE_MOCK : Hand = {
pawnWillingness
:
-
1
,
pawnWillingness
:
-
1
,
jetons
:
[
"
artemia
"
,
"
cible
"
,
"
creature
"
]
jetons
:
[
"
artemia
"
,
"
cible
"
,
"
creature
"
]
}
}
export
const
SCORE_MOCK
:
Score
=
{
traque
:
18
,
creature
:
2
,
disposition
:
"
FRONT
"
}
\ No newline at end of file
not-alone-web/src/app/player.service.spec.ts
0 → 100644
View file @
4758f342
import
{
TestBed
}
from
'
@angular/core/testing
'
;
import
{
PlayerService
}
from
'
./player.service
'
;
describe
(
'
PlayerService
'
,
()
=>
{
beforeEach
(()
=>
TestBed
.
configureTestingModule
({}));
it
(
'
should be created
'
,
()
=>
{
const
service
:
PlayerService
=
TestBed
.
get
(
PlayerService
);
expect
(
service
).
toBeTruthy
();
});
});
not-alone-web/src/app/player.service.ts
0 → 100644
View file @
4758f342
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
Observable
,
of
}
from
'
rxjs
'
import
{
Hand
}
from
'
./hand
'
;
import
{
HAND_TRAQUE_MOCK
,
PLANET_MOCK
,
RESERVE_MOCK
,
SCORE_MOCK
}
from
'
./mock-card
'
;
import
{
Planet
}
from
'
./planet
'
;
import
{
Reserve
}
from
'
./reserve
'
;
import
{
Score
}
from
'
./score
'
;
@
Injectable
({
providedIn
:
'
root
'
})
export
class
PlayerService
{
constructor
()
{
}
getScore
()
:
Observable
<
Score
>
{
return
of
(
SCORE_MOCK
);
}
getPlanet
()
:
Planet
{
return
PLANET_MOCK
;
}
getReserve
()
:
Reserve
{
return
RESERVE_MOCK
;
}
getHand
()
:
Hand
{
return
HAND_TRAQUE_MOCK
;
}
}
not-alone-web/src/app/status/status.component.css
0 → 100644
View file @
4758f342
#status
{
position
:
fixed
;
height
:
25%
;
width
:
15%
;
background-color
:
#34495e
;
top
:
20%
;
left
:
0
;
}
#status
.phase
{
text-align
:
center
;
font-size
:
1.2em
;
height
:
10%
;
}
#status
.message-container
{
width
:
80%
;
margin-left
:
10%
;
max-height
:
90%
;
overflow-y
:
auto
;
}
\ No newline at end of file
not-alone-web/src/app/status/status.component.html
0 → 100644
View file @
4758f342
<div
id=
"status"
>
<p
class=
"phase"
>
Phase {{phase}}
</p>
<div
class=
"message-container"
>
<ul>
<li
*ngFor=
"let response of responses"
>
{{response}}
</li>
</ul>
</div>
</div>
\ No newline at end of file
not-alone-web/src/app/status/status.component.spec.ts
0 → 100644
View file @
4758f342
import
{
async
,
ComponentFixture
,
TestBed
}
from
'
@angular/core/testing
'
;
import
{
StatusComponent
}
from
'
./status.component
'
;
describe
(
'
StatusComponent
'
,
()
=>
{
let
component
:
StatusComponent
;
let
fixture
:
ComponentFixture
<
StatusComponent
>
;
beforeEach
(
async
(()
=>
{
TestBed
.
configureTestingModule
({
declarations
:
[
StatusComponent
]
})
.
compileComponents
();
}));
beforeEach
(()
=>
{
fixture
=
TestBed
.
createComponent
(
StatusComponent
);
component
=
fixture
.
componentInstance
;
fixture
.
detectChanges
();
});
it
(
'
should create
'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
});
});
not-alone-web/src/app/status/status.component.ts
0 → 100644
View file @
4758f342
import
{
Component
,
Input
,
OnInit
}
from
'
@angular/core
'
;
@
Component
({
selector
:
'
app-status
'
,
templateUrl
:
'
./status.component.html
'
,
styleUrls
:
[
'
./status.component.css
'
]
})
export
class
StatusComponent
implements
OnInit
{
@
Input
(
'
phase
'
)
phase
:
string
;
@
Input
(
'
responses
'
)
responses
:
string
[];
constructor
()
{
}
ngOnInit
()
{
}
}
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