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
3520945f
Commit
3520945f
authored
5 years ago
by
Ivar Nordvik Myrstad
Browse files
Options
Downloads
Plain Diff
Merge branch '63-show-finished-tournaments' into 'dev'
Resolve "Show finished tournaments" Closes
#63
See merge request
!60
parents
3672f13f
500a6c49
No related branches found
No related tags found
1 merge request
!60
Resolve "Show finished tournaments"
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
frontend/core/src/com/gameware/game/states/CreateJoinTournamentState.java
+48
-1
48 additions, 1 deletion
...c/com/gameware/game/states/CreateJoinTournamentState.java
with
48 additions
and
1 deletion
frontend/core/src/com/gameware/game/states/CreateJoinTournamentState.java
+
48
−
1
View file @
3520945f
...
...
@@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.Texture;
import
com.badlogic.gdx.graphics.g2d.SpriteBatch
;
import
com.badlogic.gdx.graphics.g2d.TextureRegion
;
import
com.badlogic.gdx.scenes.scene2d.InputEvent
;
import
com.badlogic.gdx.scenes.scene2d.ui.CheckBox
;
import
com.badlogic.gdx.scenes.scene2d.ui.Label
;
import
com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
;
import
com.badlogic.gdx.scenes.scene2d.ui.Table
;
...
...
@@ -39,10 +40,15 @@ public class CreateJoinTournamentState extends State {
private
String
statusColText
=
"Status"
;
private
String
isPlayedTrueText
=
"Waiting"
;
private
String
isPlayedFalseText
=
"Your turn"
;
private
String
isFinishedText
=
"Finished"
;
private
String
noAvailableTournamentsText
=
"No available tournaments"
;
private
String
joinedText
=
"Joined "
;
private
String
includeFinTournamentsLabelText
=
"Include finished \n tournaments?"
;
private
boolean
includeFinishedTournaments
=
false
;
private
List
<
Tournament
>
tournaments
=
new
ArrayList
<>();
private
List
<
Tournament
>
finTournaments
=
new
ArrayList
<>();
public
class
EnterClickListener
extends
ClickListener
{
private
Tournament
tournament
;
...
...
@@ -74,6 +80,8 @@ public class CreateJoinTournamentState extends State {
super
(
gsm
);
try
{
tournaments
=
QueryIntermediate
.
getTournamentsForPlayer
(
GameWare
.
getInstance
().
getPlayer
().
getId
(),
true
);
finTournaments
=
QueryIntermediate
.
getTournamentsForPlayer
(
GameWare
.
getInstance
().
getPlayer
().
getId
(),
false
);
}
catch
(
Exception
e
){
System
.
out
.
println
(
e
);
}
...
...
@@ -108,6 +116,9 @@ public class CreateJoinTournamentState extends State {
outerTable
.
add
(
joinTournamentFeedbackLabel
).
spaceBottom
(
spacingOnBottom
);;
outerTable
.
row
();
Table
btnTable
=
new
Table
();
btnTable
.
add
(
new
Label
(
includeFinTournamentsLabelText
,
skin
,
"big"
)).
spaceBottom
(
spacingOnBottom
);
btnTable
.
add
(
makeIncludeCheckbox
()).
spaceBottom
(
spacingOnBottom
);
btnTable
.
row
();
btnTable
.
add
(
makeCreateBtn
()).
size
(
buttonWidth
,
buttonHeight
).
spaceBottom
(
spacingOnBottomInputFIeld
).
spaceRight
(
spacingOnBottom
);
btnTable
.
add
(
makeJoinBtn
()).
size
(
buttonWidth
,
buttonHeight
).
spaceBottom
(
spacingOnBottomInputFIeld
);
btnTable
.
row
();
...
...
@@ -143,6 +154,27 @@ public class CreateJoinTournamentState extends State {
innerTable
.
add
(
leaveBtn
).
padRight
(
spacingOnBottom
).
spaceLeft
(
spacingOnBottom
);
innerTable
.
row
().
spaceBottom
(
spacingOnBottom
);
}
//If the include checkbox is pressed, then the finished tournaments will render.
if
(
includeFinishedTournaments
){
for
(
Tournament
t
:
finTournaments
)
{
Label
tournamentLabel
=
new
Label
(
t
.
getName
(),
skin
);
try
{
Round
r
=
null
;
tournamentLabel
.
addListener
(
new
EnterClickListener
(
t
,
r
));
innerTable
.
add
(
tournamentLabel
).
expandX
().
padLeft
(
spacingOnBottom
);
innerTable
.
add
(
new
Label
(
isFinishedText
,
skin
)).
spaceLeft
(
spacingOnBottom
);
}
catch
(
Exception
e
){
System
.
out
.
println
(
e
);
innerTable
.
add
(
new
Label
(
"N/A"
,
skin
)).
spaceLeft
(
spacingOnBottom
);
}
Label
leaveBtn
=
new
Label
(
"X"
,
skin
,
"error"
);
leaveBtn
.
setFontScale
(
4
f
);
leaveBtn
.
addListener
(
new
LeaveClickListener
(
t
));
innerTable
.
add
(
leaveBtn
).
padRight
(
spacingOnBottom
).
spaceLeft
(
spacingOnBottom
);
innerTable
.
row
().
spaceBottom
(
spacingOnBottom
);
}
}
}
else
{
innerTable
.
add
(
new
Label
(
noTournamentsText
,
skin
));
}
...
...
@@ -181,6 +213,21 @@ public class CreateJoinTournamentState extends State {
return
backBtn
;
}
private
CheckBox
makeIncludeCheckbox
(){
final
CheckBox
includeCB
=
new
CheckBox
(
""
,
skin
);
includeCB
.
addListener
(
new
ClickListener
()
{
@Override
public
void
clicked
(
InputEvent
e
,
float
x
,
float
y
){
includeFinishedTournaments
=
!
includeFinishedTournaments
;
stage
.
clear
();
makeStage
();
}
});
includeCB
.
getImage
().
setScale
(
3
);
includeCB
.
setChecked
(
includeFinishedTournaments
);
return
includeCB
;
}
@Override
protected
void
handleInput
()
{
}
...
...
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