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
7c4f58c8
Commit
7c4f58c8
authored
Dec 30, 2020
by
Dennis Willers
🏀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Buggy Tabu
parent
6db94e66
Pipeline
#319
passed with stages
in 5 minutes and 40 seconds
Changes
9
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
63 additions
and
29 deletions
+63
-29
app.component.html
src/app/app.component.html
+2
-2
app.component.ts
src/app/app.component.ts
+11
-2
TabuMiddlewareService.ts
src/app/dao/TabuMiddlewareService.ts
+0
-8
error.component.ts
src/app/error/error.component.ts
+1
-0
game.component.ts
src/app/game/game.component.ts
+13
-10
header.component.ts
src/app/header/header.component.ts
+3
-1
overview.component.ts
src/app/overview/overview.component.ts
+27
-1
environment.prod.ts
src/environments/environment.prod.ts
+2
-1
environment.ts
src/environments/environment.ts
+4
-4
No files found.
src/app/app.component.html
View file @
7c4f58c8
<div
fxLayout=
"column"
fxFlexFill
style=
"background-image: url(/assets/background.jpg); background-repeat: repeat;"
>
<app-header>
<app-header
socket=
"{{socket}}"
>
</app-header>
<div
fxFlex
>
<router-outlet></router-outlet>
<router-outlet
(activate)=
"socket"
></router-outlet>
</div>
<app-footer>
<mat-toolbar
color=
"primary"
>
...
...
src/app/app.component.ts
View file @
7c4f58c8
import
{
Component
}
from
'
@angular/core
'
;
import
{
Component
,
OnInit
,
Output
}
from
'
@angular/core
'
;
import
{
io
}
from
'
socket.io-client
'
;
import
{
environment
}
from
'
../environments/environment
'
;
@
Component
({
selector
:
'
app-root
'
,
templateUrl
:
'
./app.component.html
'
,
styleUrls
:
[
'
./app.component.scss
'
]
})
export
class
AppComponent
{
export
class
AppComponent
implements
OnInit
{
@
Output
()
socket
:
any
;
title
=
'
Tabu
'
;
ngOnInit
():
void
{
//this.socket = io(environment.tabuServerURL);
}
}
src/app/dao/TabuMiddlewareService.ts
View file @
7c4f58c8
...
...
@@ -35,42 +35,34 @@ export class TabuMiddlewareService {
}
getGamestatus
(
req
:
any
):
Promise
<
any
>
{
console
.
log
(
req
);
return
this
.
request
(
'
POST
'
,
`
${
environment
.
tabuMiddlewareURL
}
getGamestatus`
,
req
);
}
getS2C
(
req
:
any
):
Promise
<
any
>
{
console
.
log
(
req
);
return
this
.
request
(
'
POST
'
,
`
${
environment
.
tabuMiddlewareURL
}
getS2C`
,
req
);
}
addPoint
(
req
:
any
):
Promise
<
any
>
{
console
.
log
(
'
TestAddPoint:
'
,
req
);
return
this
.
request
(
'
POST
'
,
`
${
environment
.
tabuMiddlewareURL
}
addPoint`
,
req
);
}
removePoint
(
req
:
any
):
Promise
<
any
>
{
console
.
log
(
req
);
return
this
.
request
(
'
POST
'
,
`
${
environment
.
tabuMiddlewareURL
}
removePoint`
,
req
);
}
newGame
(
req
:
any
):
Promise
<
any
>
{
console
.
log
(
req
);
return
this
.
request
(
'
POST
'
,
`
${
environment
.
tabuMiddlewareURL
}
newGame`
,
req
);
}
newRound
(
req
:
any
):
Promise
<
any
>
{
console
.
log
(
req
);
return
this
.
request
(
'
POST
'
,
`
${
environment
.
tabuMiddlewareURL
}
newRound`
,
req
);
}
endRound
(
req
:
any
):
Promise
<
any
>
{
console
.
log
(
req
);
return
this
.
request
(
'
POST
'
,
`
${
environment
.
tabuMiddlewareURL
}
endRound`
,
req
);
}
getCard
(
req
:
any
):
Promise
<
any
>
{
console
.
log
(
req
);
return
this
.
request
(
'
POST
'
,
`
${
environment
.
tabuMiddlewareURL
}
getCard`
,
req
);
}
}
src/app/error/error.component.ts
View file @
7c4f58c8
...
...
@@ -16,6 +16,7 @@ export class ErrorComponent implements OnInit {
ngOnInit
():
void
{
this
.
socket
=
io
(
environment
.
tabuServerURL
);
this
.
socket
.
disconnect
();
this
.
listen
();
}
...
...
src/app/game/game.component.ts
View file @
7c4f58c8
...
...
@@ -5,7 +5,6 @@ import {TabuMiddlewareService} from '../dao/TabuMiddlewareService';
import
{
ActivatedRoute
,
Router
}
from
'
@angular/router
'
;
import
{
GameStatus
}
from
'
../interface/gameStatus
'
;
import
{
io
}
from
'
socket.io-client
'
;
import
{
Environment
}
from
'
@angular/compiler-cli/src/ngtsc/typecheck/src/environment
'
;
import
{
environment
}
from
'
../../environments/environment
'
;
@
Component
({
...
...
@@ -16,6 +15,7 @@ import {environment} from '../../environments/environment';
export
class
GameComponent
implements
OnInit
{
socket
:
any
;
init
=
true
;
sessionName
=
''
;
isWatchdog
=
false
;
isExplainer
=
false
;
...
...
@@ -65,20 +65,29 @@ export class GameComponent implements OnInit {
this
.
fillGamestatus
();
this
.
team
=
String
(
params
.
get
(
'
team
'
));
this
.
socket
=
io
(
environment
.
tabuServerURL
);
this
.
listen
()
;
this
.
listen
()
});
this
.
startTimer
();
}
listen
():
any
{
this
.
socket
.
on
(
this
.
sessionName
+
'
:newCard
'
,
(
data
:
any
)
=>
{
console
.
log
(
'
CardID:
'
,
data
);
this
.
service
.
getCard
({
cardID
:
data
}).
then
(
value
=>
{
console
.
log
(
'
NewCard:
'
,
value
);
this
.
fillNewCard
(
value
);
this
.
fillGamestatus
();
});
});
this
.
socket
.
on
(
this
.
sessionName
+
'
:endRound
'
,
(
data
:
any
)
=>
{
console
.
log
(
'
GAME:
'
,
data
);
if
(
JSON
.
parse
(
data
))
{
if
(
this
.
init
)
{
this
.
init
=
false
;
}
console
.
log
(
'
GAME END:
'
,
data
);
this
.
socket
.
disconnect
();
this
.
router
.
navigate
([
this
.
sessionName
+
'
/
'
+
this
.
team
]);
}
});
}
onTimesUp
():
void
{
...
...
@@ -109,7 +118,6 @@ export class GameComponent implements OnInit {
this
.
gameStatus
.
red
=
JSON
.
parse
(
value
.
red
);
this
.
gameStatus
.
blue
=
JSON
.
parse
(
value
.
blue
);
});
console
.
log
(
this
.
gameStatus
);
}
wrongAnswer
():
void
{
...
...
@@ -121,18 +129,14 @@ export class GameComponent implements OnInit {
this
.
gameStatus
.
red
=
JSON
.
parse
(
value
.
red
);
this
.
gameStatus
.
blue
=
JSON
.
parse
(
value
.
blue
);
});
console
.
log
(
this
.
gameStatus
);
}
newCard
():
void
{
this
.
service
.
getS2C
({
spielname
:
this
.
sessionName
}).
then
(
value
=>
{
console
.
log
(
'
Test1:
'
,
value
);
const
status
=
JSON
.
parse
(
value
.
status
);
if
(
status
)
{
console
.
log
(
'
Test2:
'
,
value
);
this
.
fillNewCard
(
value
);
}
console
.
log
(
this
.
cardInfo
);
}).
catch
(
reason
=>
console
.
log
(
reason
));
}
...
...
@@ -157,7 +161,6 @@ export class GameComponent implements OnInit {
this
.
gameStatus
.
activeExplainer
=
JSON
.
parse
(
value
.
activeExplainer
);
this
.
gameStatus
.
activeWatchdog
=
JSON
.
parse
(
value
.
activeWatchdog
);
}
console
.
log
(
this
.
gameStatus
);
});
}
}
src/app/header/header.component.ts
View file @
7c4f58c8
import
{
Component
,
OnInit
}
from
'
@angular/core
'
;
import
{
Component
,
Input
,
OnInit
}
from
'
@angular/core
'
;
import
{
Router
}
from
'
@angular/router
'
;
@
Component
({
...
...
@@ -7,6 +7,8 @@ import {Router} from '@angular/router';
styleUrls
:
[
'
./header.component.scss
'
]
})
export
class
HeaderComponent
implements
OnInit
{
@
Input
()
socket
:
any
;
constructor
(
private
router
:
Router
)
{
}
...
...
src/app/overview/overview.component.ts
View file @
7c4f58c8
...
...
@@ -2,7 +2,8 @@ import { Component, OnInit } from '@angular/core';
import
{
ActivatedRoute
,
Router
}
from
'
@angular/router
'
;
import
{
TabuMiddlewareService
}
from
'
../dao/TabuMiddlewareService
'
;
import
{
GameStatus
}
from
'
../interface/gameStatus
'
;
import
{
error
}
from
'
selenium-webdriver
'
;
import
{
io
}
from
'
socket.io-client
'
;
import
{
environment
}
from
'
../../environments/environment
'
;
@
Component
({
selector
:
'
app-overview
'
,
...
...
@@ -10,6 +11,9 @@ import {error} from 'selenium-webdriver';
styleUrls
:
[
'
./overview.component.scss
'
]
})
export
class
OverviewComponent
implements
OnInit
{
wantToBeExplainer
=
false
;
socket
:
any
;
red
=
'
choose
'
;
blue
=
'
choose
'
;
nextTeam
=
'
Blau
'
;
...
...
@@ -56,6 +60,26 @@ export class OverviewComponent implements OnInit {
return
;
}
this
.
getGameStatus
();
this
.
socket
=
io
(
environment
.
tabuServerURL
);
this
.
listen
();
});
}
private
listen
():
any
{
this
.
socket
.
on
(
this
.
sessionName
+
'
:newRound
'
,
(
data
:
any
)
=>
{
if
(
JSON
.
parse
(
data
))
{
console
.
log
(
'
OVERVIEW:
'
,
data
);
if
(((
this
.
team
===
'
red
'
&&
this
.
nextTeam
===
'
Rot
'
)
||
(
this
.
team
===
'
blue
'
&&
this
.
nextTeam
===
'
Blau
'
))
&&
!
this
.
wantToBeExplainer
)
{
this
.
socket
.
disconnect
();
console
.
log
(
'
OVERVIEW GO GUESSER:
'
,
data
);
this
.
router
.
navigate
([
this
.
sessionName
+
'
/
'
+
this
.
team
+
'
/guesser
'
]);
}
else
if
((
this
.
team
===
'
red
'
||
this
.
team
===
'
blue
'
)
&&
!
this
.
wantToBeExplainer
)
{
this
.
socket
.
disconnect
();
console
.
log
(
'
OVERVIEW GO WATCHDOG:
'
,
data
);
this
.
router
.
navigate
([
this
.
sessionName
+
'
/
'
+
this
.
team
+
'
/watchdog
'
]);
}
}
});
}
...
...
@@ -71,6 +95,8 @@ export class OverviewComponent implements OnInit {
}
nextRound
():
void
{
this
.
wantToBeExplainer
=
true
;
this
.
service
.
newRound
({
spielname
:
this
.
sessionName
});
this
.
router
.
navigate
([
this
.
router
.
url
+
'
/explainer
'
]);
}
...
...
src/environments/environment.prod.ts
View file @
7c4f58c8
export
const
environment
=
{
production
:
true
,
tabuMiddlewareURL
:
'
http://tabu-middleware.willers.digital/
'
tabuMiddlewareURL
:
'
http://tabu-middleware.willers.digital/
'
,
tabuServerURL
:
'
http://tabu-server.willers.digital
'
};
src/environments/environment.ts
View file @
7c4f58c8
...
...
@@ -4,10 +4,10 @@
export
const
environment
=
{
production
:
false
,
// tabuMiddlewareURL: 'http://localhost:8080/'
tabuMiddlewareURL
:
'
http://tabu-middleware.willers.digital/
'
,
//
tabuServerURL: 'http://localhost:3000/'
tabuServerURL
:
'
http://tabu-server.willers.digital
'
tabuMiddlewareURL
:
'
http://localhost:8080/
'
,
//
tabuMiddlewareURL: 'http://tabu-middleware.willers.digital/',
tabuServerURL
:
'
http://localhost:3000/
'
//
tabuServerURL: 'http://tabu-server.willers.digital'
};
/*
...
...
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