Add: experience app timer

This commit is contained in:
2018-09-27 12:43:28 +09:00
parent 4f34218c80
commit 988d289a70
8 changed files with 98 additions and 2 deletions
+77
View File
@@ -0,0 +1,77 @@
function ExperienceAppTimer() {
if(!isExperienceMaestroAccount()) {
return;
}
this.leftTime = ExperienceAppTimer.DEFAULT_LEFT_TIME_SEC;
this.onTimeOver = null;
var timeLeftText = game.add.text(
game.world.centerX + ExperienceAppTimer.OFFSET_POS_X,
game.world.height - ExperienceAppTimer.OFFSET_POS_Y,
"앱 체험 종료까지 ",
this.getFontStyle()
);
timeLeftText.anchor.set(1, 0.5);
timeLeftText.alpha = 0.5;
// timeLeftText.stroke = '#000';
// timeLeftText.strokeThickness = 3;
this.timerText = game.add.text(
game.world.centerX + ExperienceAppTimer.OFFSET_POS_X,
game.world.height - ExperienceAppTimer.OFFSET_POS_Y,
this.getLeftTimeText(),
this.getFontStyle()
);
this.timerText.anchor.set(0, 0.5);
// this.timerText.stroke = '#000';
// this.timerText.strokeThickness = 3;
// this.setTimeLimit(4);
this.loopTimer = game.time.events.loop(Phaser.Timer.SECOND, this.updateTimer, this);
};
ExperienceAppTimer.prototype.getFontStyle = function() {
return { font: "24px Arial", fill: "#f86", align: "left", boundsAlignH: "left", boundsAlignV: "bottom" };
}
ExperienceAppTimer.prototype.getLeftTimeText = function() {
return this.leftTime + " 초";
}
ExperienceAppTimer.prototype.setTimeOverListener = function(onTimeOver) {
this.onTimeOver = onTimeOver;
}
ExperienceAppTimer.prototype.setTimeLimit = function(leftTime) {
this.leftTime = leftTime;
this.timerText.text = this.getLeftTimeText();
}
ExperienceAppTimer.prototype.updateTimer = function() {
this.leftTime--;
if(this.leftTime == 5) {
this.timerText.fill = "#f42";
} else if(this.leftTime == 0) {
this.timerText.fill = "#f00";
}
if(this.leftTime > 0) {
this.timerText.text = this.getLeftTimeText();
} else {
this.timerText.text = this.getLeftTimeText();
if(this.loopTimer != null)
game.time.events.remove(this.loopTimer);
if(this.onTimeOver != null)
this.onTimeOver();
}
}
ExperienceAppTimer.DEFAULT_LEFT_TIME_SEC = 20;
ExperienceAppTimer.OFFSET_POS_X = 60;
ExperienceAppTimer.OFFSET_POS_Y = 60;
+5
View File
@@ -5,6 +5,11 @@ var Game = {
sessionStorageManager.setIsNewBestRecord(false);
var experienceAppTimer = new ExperienceAppTimer();
experienceAppTimer.setTimeOverListener(
(function() { this.gameOver(); }).bind(this)
);
// top ui
var screenTopUI = new ScreenTopUI();
screenTopUI.makeBackButton( function() {
+6
View File
@@ -1,4 +1,5 @@
var TypingPractice = {
create: function() {
var self = this;
@@ -7,6 +8,11 @@ var TypingPractice = {
this.initTypingData();
sessionStorageManager.setIsNewBestRecord(false);
var experienceAppTimer = new ExperienceAppTimer();
experienceAppTimer.setTimeOverListener(
(function() { this.gameOver(); }).bind(this)
);
game.stage.backgroundColor = '#4d4d4d';
// top ui
+6 -1
View File
@@ -1,11 +1,16 @@
var TypingTest = {
create: function() {
self = this;
var self = this;
this.initTypingData();
sessionStorageManager.setIsNewBestRecord(false);
var experienceAppTimer = new ExperienceAppTimer();
experienceAppTimer.setTimeOverListener(
(function() { this.gameOver(); }).bind(this)
);
game.stage.backgroundColor = '#4d4d4d';
// top ui
+1
View File
@@ -28,6 +28,7 @@
<script src="../../game/lib/db_connect_manager.js"></script>
<script src="../../game/lib/screen_top_ui.js"></script>
<script src="../../game/lib/screen_bottom_ui.js"></script>
<script src="../../game/lib/experience_app_timer.js"></script>
<script src="../../game/lib/game_over_text.js"></script>
<!-- Space Invaders : source files -->
+1
View File
@@ -26,6 +26,7 @@
<script src="../../game/lib/db_connect_manager.js"></script>
<script src="../../game/lib/screen_top_ui.js"></script>
<script src="../../game/lib/screen_bottom_ui.js"></script>
<script src="../../game/lib/experience_app_timer.js"></script>
<script src="../../game/lib/game_over_text.js"></script>
<script src="../../game/lib/animal.js"></script>
+1
View File
@@ -26,6 +26,7 @@
<script src="../../game/lib/db_connect_manager.js"></script>
<script src="../../game/lib/screen_top_ui.js"></script>
<script src="../../game/lib/screen_bottom_ui.js"></script>
<script src="../../game/lib/experience_app_timer.js"></script>
<script src="../../game/lib/game_over_text.js"></script>
<script src="../../game/lib/animal.js"></script>
+1 -1
View File
@@ -104,7 +104,7 @@ function deactivateApp(appID) {
<br/>
▶ 체험판 [마에스트로 앱] 기능 제한 안내<br/>
- 타자, 마우스 앱 연습 결과가 서버에 저장되지 않습니다.<br/>
- 모든 컨텐츠는 30초만 플레이하실 수 있습니다.<br/>
- 모든 컨텐츠는 20초만 플레이하실 수 있습니다.<br/>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>