Add: RecordUtil
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
function RecordUtil() {
|
||||||
|
}
|
||||||
|
|
||||||
|
RecordUtil.getRecordValueWithUnit = function(record, appID) {
|
||||||
|
var recordValue = RecordUtil.getRecordValueText(record, appID);
|
||||||
|
var recordUnit = RecordUtil.getRecordUnit(appID);
|
||||||
|
|
||||||
|
return recordValue + recordUnit;
|
||||||
|
}
|
||||||
|
|
||||||
|
RecordUtil.getRecordValueText = function(record, appID) {
|
||||||
|
if(appID == 104)
|
||||||
|
return record.toFixed(2);
|
||||||
|
else
|
||||||
|
NumberUtil.numberWithCommas(Math.floor(record));
|
||||||
|
}
|
||||||
|
|
||||||
|
RecordUtil.getRecordUnit = function(appID) {
|
||||||
|
if(appID == 104)
|
||||||
|
return " 초";
|
||||||
|
else if(appID < 100)
|
||||||
|
return " 타";
|
||||||
|
else
|
||||||
|
return " 점";
|
||||||
|
}
|
||||||
@@ -63,9 +63,10 @@ ScreenBottomUI.prototype.printText = function(textObject, text, align) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ScreenBottomUI.prototype.printLeftTextWithAppHighestRecord = function(bestRecord) {
|
ScreenBottomUI.prototype.printLeftTextWithAppHighestRecord = function(bestRecord) {
|
||||||
var roundUpBestRecord = Math.round(bestRecord);
|
this.printLeftText(
|
||||||
var highScoreWithCommas = NumberUtil.numberWithCommas(roundUpBestRecord);
|
"최고 기록 : "
|
||||||
this.printLeftText("최고 기록 : " + highScoreWithCommas);
|
+ RecordUtil.getRecordValueWithUnit(bestRecord, sessionStorageManager.getPlayingAppID())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScreenBottomUI.prototype.getFontStyle = function() {
|
ScreenBottomUI.prototype.getFontStyle = function() {
|
||||||
|
|||||||
@@ -1,178 +0,0 @@
|
|||||||
Alien.prototype = Object.create(Phaser.Sprite.prototype);
|
|
||||||
Alien.constructor = Alien;
|
|
||||||
|
|
||||||
function Alien(spaceship, onCollisionFunction) {
|
|
||||||
this.spaceship = spaceship;
|
|
||||||
|
|
||||||
this.onCollisionFunction = onCollisionFunction;
|
|
||||||
|
|
||||||
this.isActivated = false;
|
|
||||||
this.speed = Alien.DEFAULT_SPEED_DOT_PER_SEC;
|
|
||||||
this.boostSpeed = Alien.DEFAULT_SPEED_DOT_PER_SEC / 10;
|
|
||||||
|
|
||||||
this.angleFromSpaceship = 0;
|
|
||||||
this.angleFromAlien = 0;
|
|
||||||
|
|
||||||
this.responRadius = 0;
|
|
||||||
|
|
||||||
this.speedLevel = 0;
|
|
||||||
|
|
||||||
|
|
||||||
Phaser.Sprite.call(this, game, 0, 0, 'alien');
|
|
||||||
this.anchor.set(0.5);
|
|
||||||
|
|
||||||
game.add.existing(this);
|
|
||||||
// game.physics.enable(this, Phaser.Physics.ARCADE);
|
|
||||||
game.physics.arcade.enable(this);
|
|
||||||
|
|
||||||
this.moveRandomPosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Alien.prototype.moveRandomPosition = function() {
|
|
||||||
this.angleFromAlien = game.rnd.integerInRange(0, 360);
|
|
||||||
// console.log(this.angleFromAlien);
|
|
||||||
|
|
||||||
var radians = this.angleFromAlien * Math.PI / 180;
|
|
||||||
|
|
||||||
this.responRadius = Alien.START_Radius_PX * ( ( (100 + game.rnd.integerInRange(0, Alien.START_RANDOM_Radius_PERCENT) ) / 100) );
|
|
||||||
var posX = Math.sin(radians) * this.responRadius;
|
|
||||||
var posY = Math.cos(radians) * this.responRadius;
|
|
||||||
|
|
||||||
this.x = game.world.centerX + posX;
|
|
||||||
this.y = game.world.centerY + posY;
|
|
||||||
// this.x = this.spaceship.x + posX;
|
|
||||||
// this.y = this.spaceship.y + posY;
|
|
||||||
|
|
||||||
|
|
||||||
var AlienAngle = this.getAngle(this.spaceship.x, this.spaceship.y, this.x, this.y);
|
|
||||||
this.angle = this.getSpriteAngle(AlienAngle);
|
|
||||||
|
|
||||||
this.angleFromAlien = AlienAngle;
|
|
||||||
|
|
||||||
this.upgradeLevel();
|
|
||||||
}
|
|
||||||
|
|
||||||
Alien.prototype.update = function() {
|
|
||||||
if(!this.isActivated)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// game.physics.arcade.overlap(this.spaceship, this, this.collisionHandler, null, this);
|
|
||||||
game.physics.arcade.collide(this.spaceship, this, this.collisionHandler, null, this);
|
|
||||||
var deltaTime = game.time.elapsed / 1000;
|
|
||||||
|
|
||||||
var radians = this.angleFromAlien * Math.PI / 180;
|
|
||||||
var moveX = Math.sin(radians) * this.speed * deltaTime;
|
|
||||||
var moveY = Math.cos(radians) * this.speed * deltaTime;
|
|
||||||
|
|
||||||
this.x -= moveX;
|
|
||||||
this.y -= moveY;
|
|
||||||
|
|
||||||
var distanceX = this.x - game.world.centerX;
|
|
||||||
var distanceY = this.y - game.world.centerY;
|
|
||||||
var distanceFromCenter = Math.sqrt(Math.abs(distanceX * distanceX) + Math.abs(distanceY * distanceY));
|
|
||||||
if(distanceFromCenter > this.responRadius)
|
|
||||||
this.moveRandomPosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Alien.prototype.collisionHandler = function() {
|
|
||||||
this.stop();
|
|
||||||
this.onCollisionFunction();
|
|
||||||
}
|
|
||||||
|
|
||||||
Alien.prototype.stop = function() {
|
|
||||||
this.setActive(false);
|
|
||||||
this.body.enable = false;
|
|
||||||
this.alpha = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Alien.prototype.setActive = function(isActivated) {
|
|
||||||
this.isActivated = isActivated;
|
|
||||||
}
|
|
||||||
|
|
||||||
Alien.prototype.getSpriteAngle = function (angle){
|
|
||||||
return 360 - angle;
|
|
||||||
}
|
|
||||||
|
|
||||||
Alien.prototype.getAngle = function (x1, y1, x2, y2){
|
|
||||||
var dx = x2 - x1;
|
|
||||||
var dy = y2 - y1;
|
|
||||||
|
|
||||||
var rad= Math.atan2(dx, dy);
|
|
||||||
var degree = (rad * 180) / Math.PI ;
|
|
||||||
if(degree < 0)
|
|
||||||
degree += 360;
|
|
||||||
|
|
||||||
return degree;
|
|
||||||
}
|
|
||||||
|
|
||||||
Alien.prototype.upgradeLevel = function() {
|
|
||||||
if(this.speedLevel == 5)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var rand = game.rnd.integerInRange(0, 100);
|
|
||||||
|
|
||||||
var successNumber = 0;
|
|
||||||
switch(this.speedLevel) {
|
|
||||||
case 0:
|
|
||||||
successNumber = 90;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
successNumber = 80;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
successNumber = 70;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
successNumber = 60;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 4:
|
|
||||||
successNumber = 50;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(rand < successNumber)
|
|
||||||
this.speedUp();
|
|
||||||
}
|
|
||||||
|
|
||||||
Alien.prototype.speedUp = function() {
|
|
||||||
this.speedLevel++;
|
|
||||||
|
|
||||||
this.speed = Alien.DEFAULT_SPEED_DOT_PER_SEC + (this.boostSpeed * this.speedLevel);
|
|
||||||
|
|
||||||
switch(this.speedLevel) {
|
|
||||||
case 1:
|
|
||||||
this.tint = 0xffffff;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
this.tint = 0xffaaaa;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3:
|
|
||||||
this.tint = 0xaaffaa;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 4:
|
|
||||||
this.tint = 0xaaaaff;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 5:
|
|
||||||
this.tint = 0xaaaaaa;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Alien.DEFAULT_SPEED_DOT_PER_SEC = 150;
|
|
||||||
|
|
||||||
Alien.START_Radius_PX = 600;
|
|
||||||
Alien.START_RANDOM_Radius_PERCENT = 40;
|
|
||||||
@@ -1,5 +1,9 @@
|
|||||||
var Game = {
|
var Game = {
|
||||||
|
|
||||||
|
preload: function() {
|
||||||
|
game.stage.disableVisibilityChange = true;
|
||||||
|
},
|
||||||
|
|
||||||
create: function() {
|
create: function() {
|
||||||
game.physics.enable(this, Phaser.Physics.ARCADE);
|
game.physics.enable(this, Phaser.Physics.ARCADE);
|
||||||
|
|
||||||
@@ -25,9 +29,7 @@ var Game = {
|
|||||||
|
|
||||||
// game stage
|
// game stage
|
||||||
var stars = game.add.group();
|
var stars = game.add.group();
|
||||||
|
for (var i = 0; i < 128; i++) {
|
||||||
for (var i = 0; i < 128; i++)
|
|
||||||
{
|
|
||||||
var randomY = game.rnd.integerInRange(60, GAME_SCREEN_SIZE.y - 80);
|
var randomY = game.rnd.integerInRange(60, GAME_SCREEN_SIZE.y - 80);
|
||||||
stars.create(game.world.randomX, randomY, 'star');
|
stars.create(game.world.randomX, randomY, 'star');
|
||||||
}
|
}
|
||||||
@@ -39,7 +41,7 @@ var Game = {
|
|||||||
|
|
||||||
this.aliens = [];
|
this.aliens = [];
|
||||||
for(var i = 0; i < 100; i++) {
|
for(var i = 0; i < 100; i++) {
|
||||||
var alien = new Alien(this.spaceship,
|
var alien = new Missile(this.spaceship,
|
||||||
(function() {
|
(function() {
|
||||||
this.spaceship.alpha = 0;
|
this.spaceship.alpha = 0;
|
||||||
this.spaceship.body.enable = false;
|
this.spaceship.body.enable = false;
|
||||||
@@ -58,20 +60,6 @@ var Game = {
|
|||||||
screenTopUI.makeBackButton( (function() { this.back(); }).bind(this) );
|
screenTopUI.makeBackButton( (function() { this.back(); }).bind(this) );
|
||||||
screenTopUI.makeFullScreenButton();
|
screenTopUI.makeFullScreenButton();
|
||||||
|
|
||||||
/*
|
|
||||||
var scoreBoard = new ScoreBoard();
|
|
||||||
this.scoreManager.addOnChangeScoreListener( function(score) {
|
|
||||||
sessionStorageManager.setRecord(score);
|
|
||||||
scoreBoard.printScore(NumberUtil.numberWithCommas(score));
|
|
||||||
});
|
|
||||||
this.scoreManager.addOnChangeHighScoreListener( function(highScore) {
|
|
||||||
// console.log(highScore);
|
|
||||||
// sessionStorageManager.setAppHighestRecord(highScore);
|
|
||||||
sessionStorageManager.setIsNewBestRecrd(true);
|
|
||||||
// screenBottomUI.printLeftTextWithAppHighestRecord(sessionStorageManager.getAppHighestRecord());
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
|
|
||||||
this.stopWatch = new StopWatch(
|
this.stopWatch = new StopWatch(
|
||||||
60, // sec
|
60, // sec
|
||||||
(function() {
|
(function() {
|
||||||
@@ -91,8 +79,8 @@ var Game = {
|
|||||||
|
|
||||||
// this.startGame();
|
// this.startGame();
|
||||||
|
|
||||||
this.spaceship.setActive(true);
|
|
||||||
this.countDown();
|
this.countDown();
|
||||||
|
this.spaceship.setActive(true);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
@@ -202,7 +190,7 @@ var Game = {
|
|||||||
hitStarEmitter.maxParticleScale = 3;
|
hitStarEmitter.maxParticleScale = 3;
|
||||||
hitStarEmitter.forEach(
|
hitStarEmitter.forEach(
|
||||||
function(particle) {
|
function(particle) {
|
||||||
particle.tint = 0xFFd700;
|
particle.tint = 0xadff2f;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
hitStarEmitter.gravity = 0;
|
hitStarEmitter.gravity = 0;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ function Missile(spaceship, onCollisionFunction) {
|
|||||||
|
|
||||||
this.isActivated = false;
|
this.isActivated = false;
|
||||||
this.speed = Missile.DEFAULT_SPEED_DOT_PER_SEC;
|
this.speed = Missile.DEFAULT_SPEED_DOT_PER_SEC;
|
||||||
this.boostSpeed = Missile.DEFAULT_SPEED_DOT_PER_SEC / 10;
|
this.boostSpeed = Missile.DEFAULT_SPEED_DOT_PER_SEC / 5;
|
||||||
|
|
||||||
this.angleFromSpaceship = 0;
|
this.angleFromSpaceship = 0;
|
||||||
this.angleFromMissile = 0;
|
this.angleFromMissile = 0;
|
||||||
@@ -22,7 +22,6 @@ function Missile(spaceship, onCollisionFunction) {
|
|||||||
this.anchor.set(0.5);
|
this.anchor.set(0.5);
|
||||||
|
|
||||||
game.add.existing(this);
|
game.add.existing(this);
|
||||||
// game.physics.enable(this, Phaser.Physics.ARCADE);
|
|
||||||
game.physics.arcade.enable(this);
|
game.physics.arcade.enable(this);
|
||||||
|
|
||||||
this.moveRandomPosition();
|
this.moveRandomPosition();
|
||||||
@@ -32,8 +31,8 @@ function Missile(spaceship, onCollisionFunction) {
|
|||||||
|
|
||||||
|
|
||||||
Missile.prototype.moveRandomPosition = function() {
|
Missile.prototype.moveRandomPosition = function() {
|
||||||
|
// move random position
|
||||||
this.angleFromMissile = game.rnd.integerInRange(0, 360);
|
this.angleFromMissile = game.rnd.integerInRange(0, 360);
|
||||||
// console.log(this.angleFromMissile);
|
|
||||||
|
|
||||||
var radians = this.angleFromMissile * Math.PI / 180;
|
var radians = this.angleFromMissile * Math.PI / 180;
|
||||||
|
|
||||||
@@ -43,16 +42,22 @@ Missile.prototype.moveRandomPosition = function() {
|
|||||||
|
|
||||||
this.x = game.world.centerX + posX;
|
this.x = game.world.centerX + posX;
|
||||||
this.y = game.world.centerY + posY;
|
this.y = game.world.centerY + posY;
|
||||||
// this.x = this.spaceship.x + posX;
|
|
||||||
// this.y = this.spaceship.y + posY;
|
|
||||||
|
|
||||||
|
|
||||||
var MissileAngle = this.getAngle(this.spaceship.x, this.spaceship.y, this.x, this.y);
|
// set missile direction
|
||||||
|
var spaceshipAreaX = this.spaceship.x + this.getRandomArea();
|
||||||
|
var spaceshipAreaY = this.spaceship.y + this.getRandomArea();
|
||||||
|
|
||||||
|
var MissileAngle = this.getAngle(spaceshipAreaX, spaceshipAreaY, this.x, this.y);
|
||||||
this.angle = this.getSpriteAngle(MissileAngle);
|
this.angle = this.getSpriteAngle(MissileAngle);
|
||||||
|
|
||||||
this.angleFromMissile = MissileAngle;
|
this.angleFromMissile = MissileAngle;
|
||||||
|
}
|
||||||
|
|
||||||
this.upgradeLevel();
|
Missile.prototype.getRandomArea = function() {
|
||||||
|
var randomValue = Math.random();
|
||||||
|
var randomArea = Missile.SPACESHIP_RANDOM_AREA_MARGIN * randomValue - Missile.SPACESHIP_RANDOM_AREA_MARGIN / 2;
|
||||||
|
return randomArea;
|
||||||
}
|
}
|
||||||
|
|
||||||
Missile.prototype.update = function() {
|
Missile.prototype.update = function() {
|
||||||
@@ -73,8 +78,10 @@ Missile.prototype.update = function() {
|
|||||||
var distanceX = this.x - game.world.centerX;
|
var distanceX = this.x - game.world.centerX;
|
||||||
var distanceY = this.y - game.world.centerY;
|
var distanceY = this.y - game.world.centerY;
|
||||||
var distanceFromCenter = Math.sqrt(Math.abs(distanceX * distanceX) + Math.abs(distanceY * distanceY));
|
var distanceFromCenter = Math.sqrt(Math.abs(distanceX * distanceX) + Math.abs(distanceY * distanceY));
|
||||||
if(distanceFromCenter > this.responRadius)
|
if(distanceFromCenter > this.responRadius) {
|
||||||
this.moveRandomPosition();
|
this.moveRandomPosition();
|
||||||
|
this.upgradeLevel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -174,5 +181,7 @@ Missile.prototype.speedUp = function() {
|
|||||||
|
|
||||||
Missile.DEFAULT_SPEED_DOT_PER_SEC = 150;
|
Missile.DEFAULT_SPEED_DOT_PER_SEC = 150;
|
||||||
|
|
||||||
Missile.START_Radius_PX = 600;
|
Missile.START_Radius_PX = 600;
|
||||||
Missile.START_RANDOM_Radius_PERCENT = 40;
|
Missile.START_RANDOM_Radius_PERCENT = 40;
|
||||||
|
|
||||||
|
Missile.SPACESHIP_RANDOM_AREA_MARGIN = 100;
|
||||||
@@ -5,13 +5,14 @@ function Spaceship() {
|
|||||||
this.isActivated = false;
|
this.isActivated = false;
|
||||||
this.speed = Spaceship.DEFAULT_SPEED;
|
this.speed = Spaceship.DEFAULT_SPEED;
|
||||||
|
|
||||||
Phaser.Sprite.call(this, game, game.world.centerX, game.world.centerY, 'spaceship');
|
Phaser.Sprite.call(this, game, game.world.centerX, game.world.centerY, 'alien');
|
||||||
game.add.existing(this);
|
game.add.existing(this);
|
||||||
|
game.physics.arcade.enable(this);
|
||||||
|
|
||||||
this.scale.set(1);
|
this.scale.set(1);
|
||||||
this.anchor.set(0.5);
|
this.anchor.set(0.5);
|
||||||
this.halfWidth = this.width / 2;
|
this.halfWidth = this.width / 2;
|
||||||
|
|
||||||
game.physics.arcade.enable(this);
|
|
||||||
|
|
||||||
// this.setActive(true);
|
// this.setActive(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
function StopWatch() {
|
function StopWatch() {
|
||||||
this.ellpasedTime = 0;
|
this.ellpasedTime = 0;
|
||||||
this.startTime = 0;
|
this.startTime = 0;
|
||||||
|
this.isPaused = true;
|
||||||
|
|
||||||
var fontStyle = StopWatch.DEFAULT_TEXT_FONT;
|
var fontStyle = StopWatch.DEFAULT_TEXT_FONT;
|
||||||
|
|
||||||
fontStyle.align = "right";
|
this.timerText = game.add.text(game.world.centerX, 35, "", fontStyle);
|
||||||
fontStyle.boundsAlignH = "right";
|
this.timerText.anchor.set(0.5);
|
||||||
this.timerText = game.add.text(game.world.width - 200, 35, "", fontStyle);
|
|
||||||
this.timerText.anchor.set(0, 0.5);
|
|
||||||
|
|
||||||
// var grd = this.label.context.createLinearGradient(0, 0, 0, StopWatch.FONT_HEIGHT_PX);
|
// var grd = this.label.context.createLinearGradient(0, 0, 0, StopWatch.FONT_HEIGHT_PX);
|
||||||
// grd.addColorStop(0, '#8ED6FF');
|
// grd.addColorStop(0, '#8ED6FF');
|
||||||
@@ -20,15 +19,16 @@ function StopWatch() {
|
|||||||
// this.label.strokeThickness = 3;
|
// this.label.strokeThickness = 3;
|
||||||
|
|
||||||
this.timerEvent = null;
|
this.timerEvent = null;
|
||||||
};
|
}
|
||||||
|
|
||||||
StopWatch.prototype.start = function() {
|
StopWatch.prototype.start = function() {
|
||||||
|
this.isPaused = false;
|
||||||
this.startTime = game.time.totalElapsedSeconds();
|
this.startTime = game.time.totalElapsedSeconds();
|
||||||
console.log(this.startTime);
|
|
||||||
this.printTime();
|
this.printTime();
|
||||||
|
|
||||||
if(this.timerEvent === null)
|
if(this.timerEvent === null)
|
||||||
this.timerEvent = game.time.events.loop(Phaser.Timer.SECOND / 10, this.updateTimer, this);
|
this.timerEvent = game.time.events.loop(Phaser.Timer.SECOND / 100, this.updateTimer, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
StopWatch.prototype.pause = function() {
|
StopWatch.prototype.pause = function() {
|
||||||
@@ -57,12 +57,7 @@ StopWatch.prototype.updateTimer = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
StopWatch.prototype.printTime = function() {
|
StopWatch.prototype.printTime = function() {
|
||||||
var ellapsedTimeText = this.ellpasedTime.toString();
|
var timeText = this.ellpasedTime.toFixed(2);
|
||||||
var timeText = "";
|
|
||||||
if(ellapsedTimeText.length == 1)
|
|
||||||
timeText = ellapsedTimeText + ".0";
|
|
||||||
else
|
|
||||||
timeText = ellapsedTimeText.substring(0, 3);
|
|
||||||
this.timerText.text = timeText + "초";
|
this.timerText.text = timeText + "초";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,20 +51,22 @@ HistoryBoard.prototype.calcDate = function(daysBefore) {
|
|||||||
|
|
||||||
|
|
||||||
HistoryBoard.prototype.printRecord = function(index, date, bestRecord) {
|
HistoryBoard.prototype.printRecord = function(index, date, bestRecord) {
|
||||||
var posX = 60;
|
var posX = 130;
|
||||||
var posY = game.world.height / 2 + 90 + 30 * index;
|
var posY = game.world.height / 2 + 90 + 30 * index;
|
||||||
|
|
||||||
var style = { font: "20px Arial", fill: "#ffc", align: "right", boundsAlignH: "right", boundsAlignV: "top" };
|
var style = { font: "20px Arial", fill: "#ffc", align: "right", boundsAlignH: "right", boundsAlignV: "top" };
|
||||||
|
|
||||||
style.boundsAlignH = "center";
|
var dateText = game.add.text(posX, posY, StringUtil.printMonthDay(date), style);
|
||||||
game.add.text(posX, posY, StringUtil.printMonthDay(date), style)
|
dateText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||||
.setTextBounds(0, 0, 100, 60)
|
dateText.anchor.set(1, 0);
|
||||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
|
||||||
|
|
||||||
style.boundsAlignH = "right";
|
var recordText = game.add.text(
|
||||||
game.add.text(posX + 80, posY, StringUtil.getRecordTextWithoutUnit(bestRecord), style)
|
posX + 120, posY,
|
||||||
.setTextBounds(0, 0, 100, 60)
|
RecordUtil.getRecordValueWithUnit(bestRecord, sessionStorageManager.getPlayingAppID()),
|
||||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
style
|
||||||
|
);
|
||||||
|
recordText.anchor.set(1, 0);
|
||||||
|
recordText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
HistoryBoard.prototype.printSample = function() {
|
HistoryBoard.prototype.printSample = function() {
|
||||||
|
|||||||
@@ -126,23 +126,22 @@ RankingBoard.prototype.printRecord = function(type, index, data) {
|
|||||||
var style = { font: "20px Arial", fill: "#fff", align: "right", boundsAlignH: "right", boundsAlignV: "top" };
|
var style = { font: "20px Arial", fill: "#fff", align: "right", boundsAlignH: "right", boundsAlignV: "top" };
|
||||||
|
|
||||||
// rank
|
// rank
|
||||||
style.boundsAlignH = "right";
|
// style.boundsAlignH = "right";
|
||||||
var rankText = game.add.text(this.getPosX(type), this.getPosY(index), data.rank, style);
|
var rankText = game.add.text(this.getPosX(type), this.getPosY(index), data.rank, style);
|
||||||
// .setTextBounds(0, 0, 40, 40)
|
|
||||||
rankText.anchor.set(1, 0);
|
rankText.anchor.set(1, 0);
|
||||||
rankText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
rankText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||||
|
|
||||||
// player name
|
// player name
|
||||||
var playerNameText = game.add.text(this.getPosX(type) + 20, this.getPosY(index), data.playerName, style);
|
var playerNameText = game.add.text(this.getPosX(type) + 20, this.getPosY(index), data.playerName, style);
|
||||||
// .setTextBounds(0, 0, 60, 60)
|
|
||||||
playerNameText.anchor.set(0, 0);
|
playerNameText.anchor.set(0, 0);
|
||||||
playerNameText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
playerNameText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||||
|
|
||||||
// bestRecord
|
// bestRecord
|
||||||
var bestRecord = StringUtil.getRecordTextWithoutUnit(data.bestRecord);
|
var recordText = game.add.text(
|
||||||
style.boundsAlignH = "right";
|
this.getPosX(type) + 180, this.getPosY(index),
|
||||||
var recordText = game.add.text(this.getPosX(type) + 180, this.getPosY(index), bestRecord, style);
|
RecordUtil.getRecordValueWithUnit(data.bestRecord, sessionStorageManager.getPlayingAppID()),
|
||||||
// .setTextBounds(0, 0, 80, 60)
|
style
|
||||||
|
);
|
||||||
recordText.anchor.set(1, 0);
|
recordText.anchor.set(1, 0);
|
||||||
recordText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
recordText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ var Result = {
|
|||||||
|
|
||||||
// bottom ui
|
// bottom ui
|
||||||
var screenBottomUI = new ScreenBottomUI();
|
var screenBottomUI = new ScreenBottomUI();
|
||||||
screenBottomUI.printLeftTextWithAppHighestRecord(Math.floor(sessionStorageManager.getAppHighestRecord()));
|
screenBottomUI.printLeftTextWithAppHighestRecord(sessionStorageManager.getAppHighestRecord());
|
||||||
screenBottomUI.printCenterText(sessionStorageManager.getPlayingAppKoreanName());
|
screenBottomUI.printCenterText(sessionStorageManager.getPlayingAppKoreanName());
|
||||||
screenBottomUI.printRightText(sessionStorageManager.getPlayerName());
|
screenBottomUI.printRightText(sessionStorageManager.getPlayerName());
|
||||||
},
|
},
|
||||||
@@ -87,16 +87,6 @@ var Result = {
|
|||||||
if(sessionStorageManager.getRecord() === null)
|
if(sessionStorageManager.getRecord() === null)
|
||||||
sessionStorageManager.setRecord(0);
|
sessionStorageManager.setRecord(0);
|
||||||
|
|
||||||
var record = 0;
|
|
||||||
if(sessionStorageManager.getPlayingAppID() == 104) {
|
|
||||||
var recordTime = sessionStorageManager.getRecord();
|
|
||||||
record = recordTime.toFixed(3);
|
|
||||||
} else {
|
|
||||||
record = NumberUtil.numberWithCommas(Math.floor(sessionStorageManager.getRecord()));
|
|
||||||
}
|
|
||||||
|
|
||||||
style.font = "80px Arial";
|
|
||||||
|
|
||||||
if(isTypingPracticeApp() || isTypingTestApp()) {
|
if(isTypingPracticeApp() || isTypingTestApp()) {
|
||||||
var animalLevelID = 0;
|
var animalLevelID = 0;
|
||||||
if(isTypingPracticeApp())
|
if(isTypingPracticeApp())
|
||||||
@@ -111,27 +101,17 @@ var Result = {
|
|||||||
rightAnimal.startAnimation(Animal.SPECIES_DATA[animalLevelID]);
|
rightAnimal.startAnimation(Animal.SPECIES_DATA[animalLevelID]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var record = sessionStorageManager.getRecord();
|
||||||
|
style.font = "80px Arial";
|
||||||
var scoreText = game.add.text(
|
var scoreText = game.add.text(
|
||||||
x, y,
|
x, y,
|
||||||
record + StringUtil.getScoreUnit(sessionStorageManager.getPlayingAppID()),
|
RecordUtil.getRecordValueWithUnit(record, sessionStorageManager.getPlayingAppID()),
|
||||||
style
|
style
|
||||||
);
|
);
|
||||||
scoreText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
scoreText.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||||
scoreText.anchor.set(0.5);
|
scoreText.anchor.set(0.5);
|
||||||
},
|
},
|
||||||
|
|
||||||
/*
|
|
||||||
recordUnit: function() {
|
|
||||||
var recordUnit = "";
|
|
||||||
if(sessionStorageManager.getPlayingAppID() == 104)
|
|
||||||
return "초";
|
|
||||||
else if(sessionStorageManager.getPlayingAppID() >= 100)
|
|
||||||
return "점";
|
|
||||||
else
|
|
||||||
return "타";
|
|
||||||
},
|
|
||||||
*/
|
|
||||||
|
|
||||||
printTodayBestRecord: function() {
|
printTodayBestRecord: function() {
|
||||||
var newRecordEmitter = game.add.emitter(game.world.centerX, 140, 300);
|
var newRecordEmitter = game.add.emitter(game.world.centerX, 140, 300);
|
||||||
newRecordEmitter.makeParticles('star');
|
newRecordEmitter.makeParticles('star');
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
})(window,document,'script','dataLayer','GTM-N8PB4F3');</script>
|
})(window,document,'script','dataLayer','GTM-N8PB4F3');</script>
|
||||||
<!-- End Google Tag Manager -->
|
<!-- End Google Tag Manager -->
|
||||||
|
|
||||||
<title>외계인 피하기, 초코마에</title>
|
<title>미사일 피하기, 초코마에</title>
|
||||||
<meta name="description" CONTENT="외계인 피하기 - 마우스 움직임 연습 앱 | 초코마에, Dodge aliens - Mouse moving practice app | chcomae">
|
<meta name="description" CONTENT="미사일 피하기 - 마우스 움직임 연습 앱 | 초코마에, Dodge missiles - Mouse moving practice app | chcomae">
|
||||||
|
|
||||||
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
|
<link rel="icon" href="/favicon.ico" type="image/x-icon" />
|
||||||
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
|
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
|
||||||
@@ -57,8 +57,7 @@
|
|||||||
<!-- Space Invaders : source files -->
|
<!-- Space Invaders : source files -->
|
||||||
<script src="../../game/mouse/dodge/loading.js"></script>
|
<script src="../../game/mouse/dodge/loading.js"></script>
|
||||||
<script src="../../game/mouse/dodge/spaceship.js"></script>
|
<script src="../../game/mouse/dodge/spaceship.js"></script>
|
||||||
<script src="../../game/mouse/dodge/alien.js"></script>
|
<script src="../../game/mouse/dodge/missile.js"></script>
|
||||||
<!-- <script src="../../game/mouse/dodge/missile.js"></script> -->
|
|
||||||
<script src="../../game/mouse/dodge/stop_watch.js"></script>
|
<script src="../../game/mouse/dodge/stop_watch.js"></script>
|
||||||
<script src="../../game/mouse/dodge/game.js"></script>
|
<script src="../../game/mouse/dodge/game.js"></script>
|
||||||
<script src="../../game/mouse/dodge/main.js"></script>
|
<script src="../../game/mouse/dodge/main.js"></script>
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
<script src="../../game/lib/keyboard_shortcut.js"></script>
|
<script src="../../game/lib/keyboard_shortcut.js"></script>
|
||||||
<script src="../../game/lib/number_util.js"></script>
|
<script src="../../game/lib/number_util.js"></script>
|
||||||
<script src="../../game/lib/string_util.js"></script>
|
<script src="../../game/lib/string_util.js"></script>
|
||||||
|
<script src="../../game/lib/record_util.js"></script>
|
||||||
<script src="../../game/lib/date_util.js"></script>
|
<script src="../../game/lib/date_util.js"></script>
|
||||||
<script src="../../game/lib/history_record_manager.js"></script>
|
<script src="../../game/lib/history_record_manager.js"></script>
|
||||||
<script src="../../game/lib/ranking_record_manager.js"></script>
|
<script src="../../game/lib/ranking_record_manager.js"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user