Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Tabu
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dennis Willers
Tabu
Commits
76299016
Commit
76299016
authored
Dec 29, 2020
by
Dennis Willers
🏀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get GameStatus Information
parent
aabd33dc
Pipeline
#290
passed with stages
in 5 minutes and 24 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
57 additions
and
14 deletions
+57
-14
TabuMiddlewareService.ts
src/app/dao/TabuMiddlewareService.ts
+5
-1
gameStatus.ts
src/app/interface/gameStatus.ts
+8
-0
overview.component.ts
src/app/overview/overview.component.ts
+33
-2
select-game.component.html
src/app/select-game/select-game.component.html
+3
-3
select-game.component.ts
src/app/select-game/select-game.component.ts
+8
-8
No files found.
src/app/dao/TabuMiddlewareService.ts
View file @
76299016
...
...
@@ -31,7 +31,11 @@ export class TabuMiddlewareService {
}
addSession
(
req
:
any
):
Promise
<
any
>
{
console
.
log
(
req
);
return
this
.
request
(
'
POST
'
,
`
${
environment
.
tabuMiddlewareURL
}
addSession`
,
req
);
}
getGamestatus
(
req
:
any
):
Promise
<
any
>
{
console
.
log
(
req
);
return
this
.
request
(
'
POST
'
,
`
${
environment
.
tabuMiddlewareURL
}
getGamestatus`
,
req
);
}
}
src/app/interface/gameStatus.ts
0 → 100644
View file @
76299016
export
interface
GameStatus
{
sessionID
:
number
;
red
:
number
;
blue
:
number
;
redTurn
:
boolean
;
activeExplainer
:
boolean
;
activeWatchdog
:
boolean
;
}
src/app/overview/overview.component.ts
View file @
76299016
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
Router
}
from
'
@angular/router
'
;
import
{
ActivatedRoute
,
Router
}
from
'
@angular/router
'
;
import
{
TabuMiddlewareService
}
from
'
../dao/TabuMiddlewareService
'
;
import
{
GameStatus
}
from
'
../interface/gameStatus
'
;
@
Component
({
selector
:
'
app-overview
'
,
...
...
@@ -8,10 +10,39 @@ import {Router} from '@angular/router';
})
export
class
OverviewComponent
implements
OnInit
{
constructor
(
private
router
:
Router
)
{
}
sessionName
=
''
;
gameStatus
:
GameStatus
=
{
sessionID
:
-
1
,
red
:
0
,
blue
:
0
,
redTurn
:
true
,
activeExplainer
:
false
,
activeWatchdog
:
false
};
constructor
(
private
router
:
Router
,
private
activatedRoute
:
ActivatedRoute
,
private
service
:
TabuMiddlewareService
)
{
}
ngOnInit
():
void
{
this
.
activatedRoute
.
paramMap
.
subscribe
(
params
=>
{
this
.
sessionName
=
String
(
params
.
get
(
'
sessionName
'
));
console
.
log
(
'
SessionName:
'
,
this
.
sessionName
);
this
.
service
.
getGamestatus
({
"
spielname
"
:
this
.
sessionName
}).
then
(
value
=>
{
const
status
=
JSON
.
parse
(
value
.
status
);
if
(
status
)
{
this
.
gameStatus
.
sessionID
=
JSON
.
parse
(
value
.
sessionID
);
this
.
gameStatus
.
red
=
JSON
.
parse
(
value
.
red
);
this
.
gameStatus
.
blue
=
JSON
.
parse
(
value
.
blue
);
this
.
gameStatus
.
redTurn
=
JSON
.
parse
(
value
.
redTurn
);
this
.
gameStatus
.
activeExplainer
=
JSON
.
parse
(
value
.
activeExplainer
);
this
.
gameStatus
.
activeWatchdog
=
JSON
.
parse
(
value
.
activeWatchdog
);
}
console
.
log
(
this
.
gameStatus
);
}).
catch
(
reason
=>
console
.
log
(
reason
));
});
}
startGame
():
void
{
this
.
router
.
navigate
([
this
.
router
.
url
+
'
/red/watchdog
'
]);
}
...
...
src/app/select-game/select-game.component.html
View file @
76299016
...
...
@@ -13,13 +13,13 @@
<form>
<mat-form-field>
<mat-label>
Spielname
</mat-label>
<input
#s
pielname
type=
"text"
matInput
(keyup)=
"checkSpielname(spieln
ame.value)"
(keypress)=
"keyPressAlphaNumeric($event)"
>
<input
#s
essionName
type=
"text"
matInput
(keyup)=
"checkSpielname(sessionN
ame.value)"
(keypress)=
"keyPressAlphaNumeric($event)"
>
</mat-form-field>
</form>
</mat-card-content>
<mat-card-actions>
<button
[disabled]=
"buttonCreateGameDisabled"
mat-raised-button
color=
"primary"
(click)=
"createGame(s
pieln
ame.value)"
>
Spiel erstellen
</button>
<button
[disabled]=
"buttonJoinGameDisabled"
mat-raised-button
color=
"primary"
(click)=
"joinGame(s
pieln
ame.value)"
>
Spiel beitreten
</button>
<button
[disabled]=
"buttonCreateGameDisabled"
mat-raised-button
color=
"primary"
(click)=
"createGame(s
essionN
ame.value)"
>
Spiel erstellen
</button>
<button
[disabled]=
"buttonJoinGameDisabled"
mat-raised-button
color=
"primary"
(click)=
"joinGame(s
essionN
ame.value)"
>
Spiel beitreten
</button>
</mat-card-actions>
</mat-card>
</div>
src/app/select-game/select-game.component.ts
View file @
76299016
...
...
@@ -23,12 +23,12 @@ export class SelectGameComponent implements OnInit {
console
.
log
(
'
Response:
'
,
response
);
}
createGame
(
s
pieln
ame
:
string
):
void
{
this
.
server
.
addSession
({
"
spielname
"
:
''
+
spielname
+
''
}).
then
(
value
=>
{
createGame
(
s
essionN
ame
:
string
):
void
{
this
.
server
.
addSession
({
"
spielname
"
:
sessionName
}).
then
(
value
=>
{
console
.
log
(
value
);
const
status
=
JSON
.
parse
(
value
.
status
);
if
(
status
)
{
this
.
router
.
navigate
([
s
pieln
ame
]);
this
.
router
.
navigate
([
s
essionN
ame
]);
}
}).
catch
(
reason
=>
{
console
.
log
(
reason
);
...
...
@@ -36,8 +36,8 @@ export class SelectGameComponent implements OnInit {
});
}
joinGame
(
s
pieln
ame
:
string
):
void
{
this
.
router
.
navigate
([
s
pieln
ame
]);
joinGame
(
s
essionN
ame
:
string
):
void
{
this
.
router
.
navigate
([
s
essionN
ame
]);
}
keyPressAlphaNumeric
(
event
:
KeyboardEvent
):
boolean
{
...
...
@@ -49,13 +49,13 @@ export class SelectGameComponent implements OnInit {
}
}
checkSpielname
(
s
pieln
ame
:
string
):
void
{
if
(
s
pieln
ame
.
length
===
0
)
{
checkSpielname
(
s
essionN
ame
:
string
):
void
{
if
(
s
essionN
ame
.
length
===
0
)
{
this
.
buttonCreateGameDisabled
=
true
;
this
.
buttonJoinGameDisabled
=
true
;
return
;
}
else
{
this
.
server
.
isSession
({
'
spielname
'
:
s
pieln
ame
}).
then
(
value
=>
{
this
.
server
.
isSession
({
'
spielname
'
:
s
essionN
ame
}).
then
(
value
=>
{
console
.
log
(
'
Response:
'
,
value
.
status
);
const
status
=
JSON
.
parse
(
value
.
status
);
if
(
status
)
{
...
...
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