Add: onClickChocobal
This commit is contained in:
@@ -46,12 +46,32 @@ var Game = {
|
||||
},
|
||||
|
||||
initVariables: function() {
|
||||
this.firstChocoballArray = this.makeChocoballArray(1, 25);
|
||||
this.secondChocoballArray = this.makeChocoballArray(26, 50);
|
||||
|
||||
this.chocoballs = new Array();
|
||||
for(var i = 0; i < 25; i++) {
|
||||
var chocoball = new Chocoball(i, this.onClickChocoball);
|
||||
chocoball.setNumber(i);
|
||||
var chocoball = new Chocoball(
|
||||
i,
|
||||
(function(chocoball) { this.onClickChocoball(chocoball); }).bind(this)
|
||||
);
|
||||
chocoball.setNumber(this.firstChocoballArray[i]);
|
||||
this.chocoballs.push(chocoball);
|
||||
}
|
||||
|
||||
this.god = new God(game.world.width - 120, Game.GOD_POSITION_Y + 100, this);
|
||||
|
||||
this.nextNumber = 1;
|
||||
},
|
||||
|
||||
makeChocoballArray(firstNumber, lastNumber) {
|
||||
var numberArray = new Array();
|
||||
for(var i = firstNumber; i < lastNumber + 1; i++) {
|
||||
numberArray.push(i);
|
||||
}
|
||||
|
||||
var randomArray = Phaser.ArrayUtils.shuffle(numberArray);
|
||||
return randomArray;
|
||||
},
|
||||
|
||||
back: function() {
|
||||
@@ -61,12 +81,32 @@ var Game = {
|
||||
|
||||
|
||||
onClickChocoball: function(chocoball) {
|
||||
console.log(chocoball.index);
|
||||
// console.log(chocoball.index);
|
||||
console.log(chocoball.number);
|
||||
|
||||
if(chocoball.number == 1)
|
||||
this.stopWatch.start();
|
||||
|
||||
if(chocoball.number != this.nextNumber) {
|
||||
console.log("wrong");
|
||||
return;
|
||||
} else {
|
||||
this.nextNumber++;
|
||||
}
|
||||
|
||||
if(chocoball.number < 25)
|
||||
chocoball.setNumber(this.secondChocoballArray[chocoball.index]);
|
||||
else
|
||||
chocoball.setActive(false);
|
||||
|
||||
if(chocoball.number == 50) {
|
||||
console.log("game clear");
|
||||
this.gameClear();
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
startGame: function() {
|
||||
this.stopWatch.start();
|
||||
},
|
||||
|
||||
gameClear: function() {
|
||||
@@ -75,6 +115,7 @@ var Game = {
|
||||
if(!isExperienceMaestroAccount())
|
||||
this.updateResultRecord();
|
||||
|
||||
var missionClearText = new MissionClearText();
|
||||
game.time.events.add(Game.GAME_OVER_WAIT_TIME_MS, this.goResult, this);
|
||||
},
|
||||
|
||||
@@ -88,10 +129,14 @@ var Game = {
|
||||
if(!isExperienceMaestroAccount())
|
||||
this.updateResultRecord();
|
||||
|
||||
var timeOverText = new TimeOverText();
|
||||
game.time.events.add(Game.GAME_OVER_WAIT_TIME_MS, this.goResult, this);
|
||||
},
|
||||
|
||||
updateResultRecord: function() {
|
||||
console.log("update record : " + sessionStorageManager.getRecord());
|
||||
return;
|
||||
|
||||
if(sessionStorageManager.getMaestroAccountType() < 100) { // experience account
|
||||
this.dbConnectManager.updateResultRecord(
|
||||
sessionStorageManager.getMaestroID(),
|
||||
|
||||
Reference in New Issue
Block a user