Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Progark gruppe 3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tobias Ingebrigt Ørstad
Progark gruppe 3
Commits
c3ac00b8
Commit
c3ac00b8
authored
5 years ago
by
Turid Cecilie Dahl
Browse files
Options
Downloads
Plain Diff
Merge branch '64-start-delay-frontend' into 'dev'
Resolve "Start delay frontend" Closes
#64
See merge request
!61
parents
4133c0fa
94008d55
No related branches found
No related tags found
1 merge request
!61
Resolve "Start delay frontend"
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/core/src/com/gameware/game/states/CreateNewTournamentState.java
+19
-2
19 additions, 2 deletions
...rc/com/gameware/game/states/CreateNewTournamentState.java
with
19 additions
and
2 deletions
frontend/core/src/com/gameware/game/states/CreateNewTournamentState.java
+
19
−
2
View file @
c3ac00b8
...
@@ -11,6 +11,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table;
...
@@ -11,6 +11,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Table;
import
com.badlogic.gdx.scenes.scene2d.ui.TextButton
;
import
com.badlogic.gdx.scenes.scene2d.ui.TextButton
;
import
com.badlogic.gdx.scenes.scene2d.ui.TextField
;
import
com.badlogic.gdx.scenes.scene2d.ui.TextField
;
import
com.badlogic.gdx.scenes.scene2d.utils.ClickListener
;
import
com.badlogic.gdx.scenes.scene2d.utils.ClickListener
;
import
com.badlogic.gdx.utils.Align
;
import
com.gameware.game.GameWare
;
import
com.gameware.game.GameWare
;
import
com.gameware.game.QueryIntermediate
;
import
com.gameware.game.QueryIntermediate
;
import
com.gameware.game.models.Game
;
import
com.gameware.game.models.Game
;
...
@@ -26,12 +27,14 @@ public class CreateNewTournamentState extends State {
...
@@ -26,12 +27,14 @@ public class CreateNewTournamentState extends State {
private
Label
title
=
new
Label
(
"Create new\ntournament"
,
skin
,
"big"
);
private
Label
title
=
new
Label
(
"Create new\ntournament"
,
skin
,
"big"
);
private
String
nameText
=
"Name"
;
private
String
nameText
=
"Name"
;
private
TextField
nameInputField
;
private
TextField
nameInputField
;
private
String
timePerRoundText
=
"
Minutes per
round"
;
private
String
timePerRoundText
=
"
Hours to \n complete each
round"
;
private
SelectBox
timePerRoundSelectBox
;
private
SelectBox
timePerRoundSelectBox
;
private
String
maxPlayersText
=
"Max number of players"
;
private
String
maxPlayersText
=
"Max number of players"
;
private
SelectBox
maxPlayersSelectBox
;
private
SelectBox
maxPlayersSelectBox
;
private
String
roundsPerGameText
=
"Round per game"
;
private
String
roundsPerGameText
=
"Round per game"
;
private
SelectBox
roundsPerGameSelectBox
;
private
SelectBox
roundsPerGameSelectBox
;
private
String
startDelayText
=
"Hours waiting for more \n players before start"
;
private
SelectBox
startDelaySelectBox
;
private
Label
errorLabel
=
new
Label
(
""
,
skin
,
"error"
);
private
Label
errorLabel
=
new
Label
(
""
,
skin
,
"error"
);
...
@@ -61,31 +64,42 @@ public class CreateNewTournamentState extends State {
...
@@ -61,31 +64,42 @@ public class CreateNewTournamentState extends State {
table
=
new
Table
();
table
=
new
Table
();
table
.
setFillParent
(
true
);
table
.
setFillParent
(
true
);
table
.
setBackground
(
background
);
title
.
setFontScale
(
titleFontBigScale
);
title
.
setFontScale
(
titleFontBigScale
);
table
.
add
(
title
).
colspan
(
2
).
spaceBottom
(
spacingOnBottomInputFIeld
);
table
.
add
(
title
).
colspan
(
2
).
spaceBottom
(
spacingOnBottomInputFIeld
);
table
.
row
();
table
.
row
();
table
.
add
(
makeLabel
(
nameText
,
skin
));
table
.
add
(
makeLabel
(
nameText
,
skin
));
nameInputField
=
new
TextField
(
""
,
skin
);
nameInputField
=
new
TextField
(
""
,
skin
);
nameInputField
.
setMaxLength
(
10
);
nameInputField
.
setMaxLength
(
10
);
table
.
add
(
nameInputField
).
size
(
nameFieldWidth
,
inputFieldHeight
).
spaceBottom
(
spacingOnBottom
);
table
.
add
(
nameInputField
).
size
(
nameFieldWidth
,
inputFieldHeight
).
spaceBottom
(
spacingOnBottom
);
table
.
row
();
table
.
row
();
table
.
add
(
makeLabel
(
timePerRoundText
,
skin
));
table
.
add
(
makeLabel
(
timePerRoundText
,
skin
));
timePerRoundSelectBox
=
new
SelectBox
(
skin
);
timePerRoundSelectBox
=
new
SelectBox
(
skin
);
timePerRoundSelectBox
.
setItems
(
1
,
2
,
3
,
4
,
5
);
timePerRoundSelectBox
.
setItems
(
1
,
2
,
3
,
4
,
5
);
table
.
add
(
timePerRoundSelectBox
).
spaceBottom
(
spacingOnBottom
);
table
.
add
(
timePerRoundSelectBox
).
spaceBottom
(
spacingOnBottom
);
table
.
row
();
table
.
row
();
table
.
add
(
makeLabel
(
maxPlayersText
,
skin
));
table
.
add
(
makeLabel
(
maxPlayersText
,
skin
));
maxPlayersSelectBox
=
new
SelectBox
(
skin
);
maxPlayersSelectBox
=
new
SelectBox
(
skin
);
maxPlayersSelectBox
.
setItems
(
2
,
3
,
4
,
5
);
maxPlayersSelectBox
.
setItems
(
2
,
3
,
4
,
5
);
table
.
add
(
maxPlayersSelectBox
).
spaceBottom
(
spacingOnBottom
);
table
.
add
(
maxPlayersSelectBox
).
spaceBottom
(
spacingOnBottom
);
table
.
row
();
table
.
row
();
table
.
add
(
makeLabel
(
roundsPerGameText
,
skin
));
table
.
add
(
makeLabel
(
roundsPerGameText
,
skin
));
roundsPerGameSelectBox
=
new
SelectBox
(
skin
);
roundsPerGameSelectBox
=
new
SelectBox
(
skin
);
roundsPerGameSelectBox
.
setItems
(
1
,
2
,
3
);
roundsPerGameSelectBox
.
setItems
(
1
,
2
,
3
);
table
.
add
(
roundsPerGameSelectBox
).
spaceBottom
(
spacingOnBottom
);
table
.
add
(
roundsPerGameSelectBox
).
spaceBottom
(
spacingOnBottom
);
table
.
row
();
table
.
row
();
table
.
add
(
makeLabel
(
startDelayText
,
skin
)).
spaceBottom
(
spacingOnBottom
);
startDelaySelectBox
=
new
SelectBox
(
skin
);
startDelaySelectBox
.
setItems
(
1
,
2
,
3
);
table
.
add
(
startDelaySelectBox
).
spaceBottom
(
spacingOnBottom
);
table
.
row
();
for
(
final
Game
g
:
games
){
for
(
final
Game
g
:
games
){
Label
gameLabel
=
new
Label
(
g
.
getName
(),
skin
);
Label
gameLabel
=
new
Label
(
g
.
getName
(),
skin
);
table
.
add
(
gameLabel
).
spaceBottom
(
spacingOnBottom
);
table
.
add
(
gameLabel
).
spaceBottom
(
spacingOnBottom
);
...
@@ -116,6 +130,7 @@ public class CreateNewTournamentState extends State {
...
@@ -116,6 +130,7 @@ public class CreateNewTournamentState extends State {
private
Label
makeLabel
(
String
text
,
Skin
skin
){
private
Label
makeLabel
(
String
text
,
Skin
skin
){
Label
label
=
new
Label
(
text
,
skin
);
Label
label
=
new
Label
(
text
,
skin
);
label
.
setAlignment
(
Align
.
center
);
return
label
;
return
label
;
}
}
...
@@ -188,7 +203,7 @@ public class CreateNewTournamentState extends State {
...
@@ -188,7 +203,7 @@ public class CreateNewTournamentState extends State {
}
}
try
{
try
{
tournament
=
new
Tournament
(
GameWare
.
getInstance
().
getPlayer
().
getId
(),
chosenGames
,
getTournamentName
(),
getTimePerRound
(),
getMaxPlayers
(),
getRoundsPerGame
(),
1
,
chosenGames
.
size
(),
1
);
tournament
=
new
Tournament
(
GameWare
.
getInstance
().
getPlayer
().
getId
(),
chosenGames
,
getTournamentName
(),
getTimePerRound
(),
getMaxPlayers
(),
getRoundsPerGame
(),
1
,
chosenGames
.
size
(),
getStartDelay
()
);
tournamentFromDB
=
QueryIntermediate
.
createNewTournament
(
tournament
);
tournamentFromDB
=
QueryIntermediate
.
createNewTournament
(
tournament
);
round
=
QueryIntermediate
.
getRoundFromTournament
(
tournamentFromDB
.
get_id
(),
GameWare
.
getInstance
().
getPlayer
().
getId
(),
tournamentFromDB
.
getCurrentRound
());
round
=
QueryIntermediate
.
getRoundFromTournament
(
tournamentFromDB
.
get_id
(),
GameWare
.
getInstance
().
getPlayer
().
getId
(),
tournamentFromDB
.
getCurrentRound
());
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
@@ -213,4 +228,6 @@ public class CreateNewTournamentState extends State {
...
@@ -213,4 +228,6 @@ public class CreateNewTournamentState extends State {
return
(
int
)
roundsPerGameSelectBox
.
getSelected
();
return
(
int
)
roundsPerGameSelectBox
.
getSelected
();
}
}
private
int
getStartDelay
(){
return
(
int
)
startDelaySelectBox
.
getSelected
();
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment