Skip to content
This repository was archived by the owner on Mar 10, 2019. It is now read-only.

Commit 5ad4afa

Browse files
committed
Merge branch 'develop'
2 parents 4673585 + c801435 commit 5ad4afa

30 files changed

+871
-165
lines changed

WebContent/cardcast/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ <h3 class="mdc-list-group__subheader">Order by</h3>
7474

7575
<main class="mdc-layout-grid mdc-toolbar-fixed-adjust" id="cardcast-container">
7676
<div class="mdc-layout-grid__inner list"></div>
77-
<h1 class="mdc-typography--display1 message md-dark">No decks found.</h1>
77+
<h1 class="mdc-typography--display1 message">No decks found.</h1>
7878
<div class="pagination">
7979
<div class="pagination__inner"></div>
8080
</div>

WebContent/cardcast/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ function addDeckToGame(code) {
390390
Notifier.error("Failed contacting the server.", data, false, true);
391391
}).done(function (data) {
392392
if (data.gid === -1) {
393-
Notifier.timeout(Notifier.WARN, "In order to add the deck you have to be the host of the game.");
393+
Notifier.timeout(Notifier.WARN, "You have to be in a game.");
394394
} else {
395395
$.post("/AjaxServlet", "o=cac&gid=" + data.gid + "&cci=" + code).fail(function (data) {
396396
if ("responseJSON" in data) {

WebContent/css/game.css

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
#gameLayout {
2+
width: 100%;
3+
}
4+
5+
#gameLayout > .message {
6+
margin-top: 48px;
7+
}
8+
19
#drawer > .mdc-drawer__drawer {
210
padding: 16px;
311
display: flex;
@@ -30,4 +38,34 @@
3038
#chat > .mdc-text-field {
3139
width: 100%;
3240
flex-shrink: 0;
41+
}
42+
43+
.error::before {
44+
font-family: 'Material Icons';
45+
font-weight: normal;
46+
font-style: normal;
47+
font-size: 24px; /* Preferred icon size */
48+
display: inline-block;
49+
line-height: 1;
50+
text-transform: none;
51+
letter-spacing: normal;
52+
word-wrap: normal;
53+
white-space: nowrap;
54+
direction: ltr;
55+
56+
/* Support for all WebKit browsers. */
57+
-webkit-font-smoothing: antialiased;
58+
/* Support for Safari and Chrome. */
59+
text-rendering: optimizeLegibility;
60+
61+
/* Support for Firefox. */
62+
-moz-osx-font-smoothing: grayscale;
63+
64+
/* Support for IE. */
65+
font-feature-settings: 'liga';
66+
67+
content: 'error';
68+
vertical-align: middle;
69+
padding-right: 8px;
70+
color: #D32F2F; /* Red 700 */
3371
}

WebContent/css/pyx-reloaded.css

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.message {
22
text-align: center;
3-
color: var(--mdc-theme-text-secondary-on-light, rgba(0, 0, 0, .54))
3+
color: var(--mdc-theme-text-secondary-on-background, rgba(0, 0, 0, .54))
44
}
55

66
.mdc-switch-label {
@@ -19,11 +19,6 @@
1919
max-height: 60vh;
2020
}
2121

22-
.mdc-toolbar .mdc-text-field {
23-
margin-top: 0 !important;
24-
margin-bottom: 16px !important;
25-
}
26-
2722
/* Hide stuff in toolbar on mobile */
2823
.mdc-toolbar ._refresh, .mdc-toolbar ._themingDialog {
2924
display: none;
@@ -53,11 +48,29 @@
5348
color: var(--mdc-theme-text-primary-on-primary);
5449
}
5550

51+
.mdc-toolbar .mdc-text-field {
52+
margin-top: 0 !important;
53+
margin-bottom: 16px !important;
54+
}
55+
5656
/* Chip in toolbar */
5757
.mdc-toolbar .mdc-chip-set > .mdc-chip > .mdc-chip__text {
5858
color: var(--mdc-theme-text-secondary-on-primary);
5959
}
6060

61+
/* Tabs in toolbar */
62+
.mdc-toolbar .mdc-tab {
63+
color: var(--mdc-theme-text-secondary-on-primary);
64+
}
65+
66+
.mdc-toolbar .mdc-tab.mdc-tab--active {
67+
color: var(--mdc-theme-text-primary-on-primary);
68+
}
69+
70+
.mdc-toolbar .mdc-tab-bar .mdc-tab-bar__indicator {
71+
background-color: var(--mdc-theme-text-primary-on-primary);
72+
}
73+
6174
main {
6275
overflow-y: auto;
6376
}

WebContent/game.html

Lines changed: 67 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
<link rel="stylesheet" href="//fonts.googleapis.com/icon?family=Material+Icons">
88
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Roboto:300,400,500">
99
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/noty/3.1.4/noty.min.css"/>
10+
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/tooltipster/3.3.0/css/tooltipster.min.css"/>
11+
<link rel="stylesheet"
12+
href="//cdnjs.cloudflare.com/ajax/libs/tooltipster/3.3.0/css/themes/tooltipster-light.min.css"/>
1013
<link rel="stylesheet" href="/css/pyx-reloaded.css">
1114
<link rel="stylesheet" href="/css/cards.css">
1215
<link rel="stylesheet" href="/css/game.css">
@@ -54,6 +57,14 @@ <h3 class="mdc-typography mdc-typography--title">Chat</h3>
5457
</div>
5558
</section>
5659

60+
<section class="mdc-toolbar__section mdc-toolbar__section--shrink-to-fit">
61+
<nav id="tabs" class="mdc-tab-bar">
62+
<a class="mdc-tab mdc-tab--active">Game</a>
63+
<a class="mdc-tab">Other stuff</a>
64+
<span class="mdc-tab-bar__indicator"></span>
65+
</nav>
66+
</section>
67+
5768
<section class="mdc-toolbar__section mdc-toolbar__section--align-end">
5869
<button class="material-icons align-icons mdc-toolbar__icon" style="display: none;" id="startGame">
5970
done
@@ -65,9 +76,34 @@ <h3 class="mdc-typography mdc-typography--title">Chat</h3>
6576
</header>
6677

6778
<main class="mdc-toolbar-fixed-adjust" style="display: flex; flex-flow: row">
68-
<div id="blackCard"></div>
69-
<div id="whiteCards">
70-
<div class="list"></div>
79+
<div id="gameLayout" style="display: none">
80+
<h1 class="message mdc-typography--display1">Game hasn't started yet.</h1>
81+
<div id="blackCard"></div>
82+
<div id="whiteCards">
83+
<div class="list"></div>
84+
</div>
85+
</div>
86+
<div id="otherStuffLayout" class="mdc-layout-grid" style="display: none">
87+
<div class="mdc-layout-grid__inner">
88+
<div id="spectatorsList" class="mdc-card mdc-layout-grid__cell">
89+
<div class="mdc-card__primary">
90+
<h1 class="mdc-card__title mdc-typography--title">Spectators</h1>
91+
</div>
92+
<section class="mdc-card__supporting-text">
93+
<ul class="mdc-list list mdc-list--non-interactive"></ul>
94+
<h1 class="message mdc-typography--headline">No spectators.</h1>
95+
</section>
96+
</div>
97+
<div id="suggestedGameOptions" class="mdc-card mdc-layout-grid__cell">
98+
<div class="mdc-card__primary">
99+
<h1 class="mdc-card__title mdc-typography--title">Suggested game options modifications</h1>
100+
</div>
101+
<section class="mdc-card__supporting-text">
102+
<ul class="mdc-list list mdc-list--non-interactive"></ul>
103+
<h1 class="message mdc-typography--headline">No suggested game options.</h1>
104+
</section>
105+
</div>
106+
</div>
71107
</div>
72108
</main>
73109
</div>
@@ -117,27 +153,54 @@ <h4 class="mdc-typography--subheading1">Draw <span class="_draw"></span></h4>
117153
</h4>
118154
</section>
119155
</div>
156+
157+
<li id="spectatorTemplate" class="mdc-list-item">
158+
<span class="_name"></span>
159+
</li>
160+
161+
<li id="suggestedGameOptionsTemplate" class="mdc-list-item">
162+
<span class="material-icons _info" style="margin-right: 8px">info</span>
163+
<span class="_suggester" style="flex-grow: 1">{{Suggester}}</span>
164+
<button class="mdc-button _accept">Accept</button>
165+
<button class="mdc-button _decline">Decline</button>
166+
</li>
167+
168+
<div id="gameOptionsDiffTooltipTemplate">
169+
<h1 class="_goal mdc-typography--body1"></h1>
170+
<h1 class="_playersLimit mdc-typography--body1"></h1>
171+
<h1 class="_spectatorsLimit mdc-typography--body1"></h1>
172+
<h1 class="_blanksLimit mdc-typography--body1"></h1>
173+
<h1 class="_timeMultiplier mdc-typography--body1"></h1>
174+
<h1 class="_winBy mdc-typography--body1"></h1>
175+
<h1 class="_password mdc-typography--body1"></h1>
176+
<h1 class="_decks mdc-typography--body1"></h1>
177+
</div>
120178
</div>
121179

122180
<script src="//code.jquery.com/jquery-latest.min.js"></script>
123181
<script src="//unpkg.com/material-components-web@0.30.0/dist/material-components-web.min.js"></script>
124182
<script src="//cdnjs.cloudflare.com/ajax/libs/list.js/1.5.0/list.min.js"></script>
125183
<script src="//unpkg.com/masonry-layout@4/dist/masonry.pkgd.min.js"></script>
126184
<script src="//cdnjs.cloudflare.com/ajax/libs/noty/3.1.4/noty.min.js"></script>
185+
<script src="//cdnjs.cloudflare.com/ajax/libs/tooltipster/3.3.0/js/jquery.tooltipster.min.js"></script>
127186
<script src="/js/utils.js"></script>
128187
<script src="/js/bottom_sheet.js"></script>
188+
<script src="/js/tabs.helper.js"></script>
129189
<script src="/js/cardcast.helper.js"></script>
130190
<script src="/js/notifs.helper.js"></script>
131191
<script src="/js/events.helper.js"></script>
132192
<script src="/game_options/dialog.js"></script>
133193
<script src="/js/game.js"></script>
194+
<script src="/js/game.other_stuff.js"></script>
134195
<script>
135196
window.mdc.autoInit();
197+
TabsManager.init("tabs", ["gameLayout", "otherStuffLayout"]);
198+
136199
const gameManager = new GameManager(getLastPathSegment());
137200
if (gameManager.id === null) {
138201
window.location = "/games/";
139202
} else {
140-
setupGameOptionsDialog($('#gameOptions'), "Game options", false, "Apply", (go) => {
203+
setupGameOptionsDialog($('#gameOptions'), "Game options", false, "??", (go) => {
141204
gameManager.changeGameOptions(go);
142205
}, (gameOptionsDialog) => {
143206
loadUI(gameManager, gameOptionsDialog);

WebContent/game_options/dialog.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,15 @@ class MDCMultiSelect extends mdc.select.MDCSelect {
8383
}
8484

8585
class GameOptionsDialog {
86-
constructor(id, title, acceptText, accept) {
86+
constructor(id, title, acceptText, acceptListener) {
8787
this._dialog = $('#' + id);
8888
this.dialog = new mdc.dialog.MDCDialog(this._dialog[0]);
8989
this.dialog.listen('MDCDialog:accept', () => this._acceptDialog());
9090

9191
this._dialog.find('.mdc-dialog__header__title').text(title);
9292

9393
this._accept = this._dialog.find('.mdc-dialog__footer__button--accept');
94-
this._accept.text(acceptText);
94+
this.acceptText = acceptText;
9595

9696
this.scoreLimit = new mdc.select.MDCSelect(this._dialog.find('#scoreLimit')[0]);
9797
this.playersLimit = new mdc.select.MDCSelect(this._dialog.find('#playersLimit')[0]);
@@ -133,7 +133,7 @@ class GameOptionsDialog {
133133
this._password = this._dialog.find('#gamePassword');
134134
mdc.textField.MDCTextField.attachTo(this._password.parent()[0]);
135135

136-
this.acceptListener = accept;
136+
this.acceptListener = acceptListener;
137137

138138
/**
139139
* @param {int} dgo.vL - Spectators limit
@@ -160,11 +160,6 @@ class GameOptionsDialog {
160160
this.reset();
161161
}
162162

163-
set acceptVisible(set) {
164-
if (set) this._accept.show();
165-
else this._accept.hide();
166-
}
167-
168163
/**
169164
*
170165
* @param dropdown
@@ -263,6 +258,10 @@ class GameOptionsDialog {
263258
this.acceptListener(go);
264259
}
265260

261+
set acceptText(text) {
262+
this._accept.text(text);
263+
}
264+
266265
show(reset = false) {
267266
if (reset) this.reset();
268267
this.dialog.show();
@@ -494,11 +493,11 @@ class GameOptionsDialog {
494493
}
495494
}
496495

497-
function setupGameOptionsDialog(trigger, title, resetBeforeShow = false, acceptText, accept, done = undefined) {
496+
function setupGameOptionsDialog(trigger, title, resetBeforeShow = false, acceptText, acceptListener, done = undefined) {
498497
$.get("/game_options/dialog.html").done(function (data) {
499498
$('body').append($(data));
500499

501-
const gameOptionsDialog = new GameOptionsDialog('gameOptionsDialog', title, acceptText, accept);
500+
const gameOptionsDialog = new GameOptionsDialog('gameOptionsDialog', title, acceptText, acceptListener);
502501
if (done !== undefined) done(gameOptionsDialog);
503502
trigger.on('click', () => gameOptionsDialog.show(resetBeforeShow))
504503
}).fail(function (data) {

0 commit comments

Comments
 (0)