Skip to content

Commit 4658f29

Browse files
author
Julien Poulton
committed
Merge branch 'better-error-on-demo-bug' into 'master'
[FIX][sdk] Better error on demo bug See merge request codingame/game-engine!139
2 parents e852888 + 87a4254 commit 4658f29

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

engine/core/src/main/resources/view/core/Drawer.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,19 @@ export class Drawer {
215215
}
216216

217217
var demoContainer = new PIXI.Container()
218-
219-
this.initDefaultFrames(this.demo.playerCount, this.demo.frames, this.demo.agents)
220-
/** **************************************************************************************************************************************** */
221-
this.preconstructScene(this.scope, container, this.initWidth, this.initHeight)
222-
this.initScene(this.scope, demoContainer, this.frames, true)
223-
this.updateScene(this.scope, this.question, this.frames, this.currentFrame, this.progress, 1, this.reasons[this.currentFrame], true)
224-
/** **************************************************************************************************************************************** */
225-
218+
try {
219+
this.initDefaultFrames(this.demo.playerCount, this.demo.frames, this.demo.agents)
220+
/** **************************************************************************************************************************************** */
221+
this.preconstructScene(this.scope, container, this.initWidth, this.initHeight)
222+
this.initScene(this.scope, demoContainer, this.frames, true)
223+
this.updateScene(this.scope, this.question, this.frames, this.currentFrame, this.progress, 1, this.reasons[this.currentFrame], true)
224+
/** **************************************************************************************************************************************** */
225+
} catch (error) {
226+
ErrorLog.push({
227+
cause: error,
228+
message: 'Cannot load demo, you might want to reset the demo'
229+
})
230+
}
226231
scope.demo = demoContainer
227232
scope.demotime = 0
228233

runner/src/main/resources/view/test.css

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,18 @@ button {
129129
font-weight: normal;
130130
word-break: break-word;
131131
}
132-
132+
.outputs-demo {
133+
height: calc(100% - 20px);
134+
padding: 10px 15px;
135+
background-color: #29323c;
136+
border: solid 1px #363e48;
137+
overflow: auto;
138+
white-space: pre-wrap;
139+
font-size: 13px;
140+
font-weight: normal;
141+
word-break: break-word;
142+
color: white;
143+
}
133144
.players-outputs-player-console-title, .game-outputs-title, .game-outputs-down-referee-title, .players-outputs-player-header-title {
134145
font-size: 13px;
135146
font-weight: 600;

runner/src/main/resources/view/test.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@
5353
shareable="false"
5454
show-replay-prompt="false"
5555
game-params="gameParams">
56-
</cg-player>
56+
</cg-player>
57+
<div id="console" class="outputs-demo" ng-bind="errors" ng-if="errors"></div>
5758
<div class="close-button-wrapper">
5859
<button class="close-button" ng-click="closeViewReplayPopup()">Close</button>
5960
</div>

0 commit comments

Comments
 (0)