Fix: library path
This commit is contained in:
@@ -1,109 +0,0 @@
|
||||
function Animal(type, index, x, y) {
|
||||
this.animalType = type;
|
||||
|
||||
this.sprite = null;
|
||||
this.posX = x;
|
||||
this.posY = y;
|
||||
|
||||
this.sprite = game.add.sprite(this.posX, this.posY, "animals");
|
||||
this.sprite.anchor.set(0.5);
|
||||
this.sprite.animations.add("stand", [index * 2]);
|
||||
this.sprite.animations.play("stand");
|
||||
this.sprite.animations.add("run", [index * 2, index * 2 + 1]);
|
||||
|
||||
this.species = Animal.SPECIES_DATA[index];
|
||||
}
|
||||
|
||||
|
||||
Animal.prototype.setScale = function(value) {
|
||||
this.sprite.scale.set(value);
|
||||
}
|
||||
|
||||
Animal.prototype.setSpecies = function(species) {
|
||||
console.log(species);
|
||||
this.species = species;
|
||||
}
|
||||
|
||||
Animal.prototype.setAlpha = function(value) {
|
||||
this.sprite.alpha = value;
|
||||
}
|
||||
|
||||
|
||||
Animal.prototype.tweenAnimation = function(animationType) {
|
||||
switch(animationType) {
|
||||
case Animal.ANIMATION_TYPE_CHANGE:
|
||||
this.sprite.width = 100;
|
||||
this.sprite.height = 100;
|
||||
game.add.tween(this.sprite).to( { width: 50, height: 50 }, 500, Phaser.Easing.Bounce.Out, true);
|
||||
break;
|
||||
|
||||
case Animal.ANIMATION_TYPE_DAMAGE:
|
||||
this.sprite.width = 100;
|
||||
this.sprite.height = 50;
|
||||
game.add.tween(this.sprite).to( { width: 50 }, 500, Phaser.Easing.Bounce.In, true);
|
||||
// game.add.tween(this.sprite).to( { width: 50 }, 500, Phaser.Easing.Elastic.Out, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Animal.prototype.startAnimation = function(species) {
|
||||
this.sprite.animations.play("run", this.species.fps, true);
|
||||
}
|
||||
|
||||
Animal.prototype.stopAnimation = function() {
|
||||
this.sprite.animations.stop("run");
|
||||
}
|
||||
|
||||
|
||||
Animal.animalLevelIDByRecord = function(record, gameType) {
|
||||
for(var i = Animal.SPECIES_DATA.length - 1; i > 0; i--) {
|
||||
if(record >= this.typingCount(Animal.SPECIES_DATA[i], gameType))
|
||||
return i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Animal.getAnimalPracticeTypingCount = function(animalIndex) {
|
||||
return Animal.SPECIES_DATA[animalIndex].practiceTypingCount;
|
||||
}
|
||||
|
||||
Animal.typingCount = function(speciesData, gameType) {
|
||||
if(gameType === Animal.TYPE_PRACTICE)
|
||||
return speciesData.practiceTypingCount;
|
||||
else
|
||||
return speciesData.testTypingCount;
|
||||
}
|
||||
|
||||
Animal.loadResources = function() {
|
||||
game.load.spritesheet('animals', '../../../resources/image/character/animal/animals.png', 50, 50);
|
||||
}
|
||||
|
||||
|
||||
Animal.TYPE_ANIMATION = 0;
|
||||
Animal.TYPE_ICON = 1;
|
||||
|
||||
Animal.TYPE_PRACTICE = 0;
|
||||
Animal.TYPE_TEST = 1;
|
||||
|
||||
Animal.ANIMATION_TYPE_CHANGE = 0;
|
||||
Animal.ANIMATION_TYPE_DAMAGE = 1;
|
||||
|
||||
|
||||
Animal.SPECIES_DATA = [
|
||||
{ "species" : "snail", "fps" : 1, "practiceTypingCount" : 0, "testTypingCount" : 0 },
|
||||
{ "species" : "turtle", "fps" : 2, "practiceTypingCount" : 5, "testTypingCount" : 20 },
|
||||
{ "species" : "chick", "fps" : 5, "practiceTypingCount" : 10, "testTypingCount" : 40 },
|
||||
{ "species" : "mouse", "fps" : 12, "practiceTypingCount" : 15, "testTypingCount" : 70 },
|
||||
{ "species" : "chicken", "fps" : 11, "practiceTypingCount" : 20, "testTypingCount" : 100 },
|
||||
{ "species" : "pig", "fps" : 5, "practiceTypingCount" : 25, "testTypingCount" : 150 },
|
||||
{ "species" : "cat", "fps" : 10, "practiceTypingCount" : 30, "testTypingCount" : 200 },
|
||||
{ "species" : "deer", "fps" : 9, "practiceTypingCount" : 40, "testTypingCount" : 250 },
|
||||
{ "species" : "kangaroo", "fps" : 4, "practiceTypingCount" : 50, "testTypingCount" : 300 },
|
||||
{ "species" : "rabbit", "fps" : 12, "practiceTypingCount" : 60, "testTypingCount" : 350 },
|
||||
{ "species" : "dog", "fps" : 9, "practiceTypingCount" : 70, "testTypingCount" : 400 },
|
||||
{ "species" : "zebra", "fps" : 12, "practiceTypingCount" : 80, "testTypingCount" : 450 },
|
||||
{ "species" : "ostrich", "fps" : 15, "practiceTypingCount" : 90, "testTypingCount" : 500 },
|
||||
{ "species" : "lion", "fps" : 10, "practiceTypingCount" : 100, "testTypingCount" : 600 },
|
||||
{ "species" : "cheetah", "fps" : 15, "practiceTypingCount" : 110, "testTypingCount" : 700 }
|
||||
];
|
||||
@@ -1,59 +0,0 @@
|
||||
function AnimalList(y) {
|
||||
this.animals = [];
|
||||
this.activeAnimalIndex = -1;
|
||||
|
||||
var animalCount = Animal.SPECIES_DATA.length;
|
||||
var lineWidth = GAME_SCREEN_SIZE.x - AnimalList.MARGIN_X * 2;
|
||||
// console.log("lineWidth : " + lineWidth);
|
||||
var offsetAnimal = lineWidth / (animalCount - 1);
|
||||
// console.log("animalCount : " + animalCount);
|
||||
// console.log("offsetAnimal : " + offsetAnimal);
|
||||
|
||||
this.activeAnimalIndex = 0;
|
||||
|
||||
for(var i = 0; i < animalCount; i++) {
|
||||
this.animals[i] = new Animal(
|
||||
Animal.TYPE_ICON,
|
||||
i,
|
||||
AnimalList.MARGIN_X + offsetAnimal * i,
|
||||
y
|
||||
);
|
||||
this.inactivate(i);
|
||||
}
|
||||
|
||||
this.activate(this.activeAnimalIndex);
|
||||
this.tweenAnimation(Animal.ANIMATION_TYPE_DAMAGE);
|
||||
}
|
||||
|
||||
AnimalList.prototype.activate = function(index) {
|
||||
this.inactivate(this.activeAnimalIndex);
|
||||
|
||||
this.activeAnimalIndex = index;
|
||||
|
||||
this.animals[this.activeAnimalIndex].setScale(2);
|
||||
this.animals[index].setAlpha(1);
|
||||
this.animate(this.activeAnimalIndex);
|
||||
}
|
||||
|
||||
AnimalList.prototype.inactivate = function(index) {
|
||||
this.animals[index].stopAnimation();
|
||||
this.animals[index].setScale(1);
|
||||
this.animals[index].setAlpha(AnimalList.ALPHA_INACTIVE);
|
||||
}
|
||||
|
||||
AnimalList.prototype.animate = function(index) {
|
||||
var animalData = Animal.SPECIES_DATA[index];
|
||||
this.animals[index].startAnimation(animalData);
|
||||
}
|
||||
|
||||
AnimalList.prototype.stopAnimation = function() {
|
||||
this.animals[this.activeAnimalIndex].stopAnimation();
|
||||
}
|
||||
|
||||
AnimalList.prototype.tweenAnimation = function(animationType) {
|
||||
this.animals[this.activeAnimalIndex].tweenAnimation(animationType);
|
||||
}
|
||||
|
||||
|
||||
AnimalList.MARGIN_X = 100;
|
||||
AnimalList.ALPHA_INACTIVE = 0.1;
|
||||
@@ -0,0 +1,170 @@
|
||||
var LANGUAGE_KOREAN = "korean";
|
||||
var LANGUAGE_ENGLISH = "english";
|
||||
|
||||
var MODE_RELEASE = "release";
|
||||
var MODE_DEBUG = "debug";
|
||||
var runMode = MODE_DEBUG;
|
||||
|
||||
function isDebugMode() {
|
||||
// console.log("debug mode ? " + runMode);
|
||||
return runMode == MODE_DEBUG ? true : false;
|
||||
}
|
||||
|
||||
function isReleaseMode() {
|
||||
// console.log("release mode ? " + runMode);
|
||||
return runMode == MODE_RELEASE ? true : false;
|
||||
}
|
||||
|
||||
|
||||
var GAME_SCREEN_SIZE = { x: 1024, y: 768 }
|
||||
|
||||
|
||||
|
||||
var sessionStorageManager = new SessionStorageManager();
|
||||
{
|
||||
if(isDebugMode()) {
|
||||
console.log("maestroName : " + sessionStorageManager.getMaestroName());
|
||||
console.log("maestroID : " + sessionStorageManager.getMaestroID());
|
||||
console.log("maestroAccountType : " + sessionStorageManager.getMaestroAccountType());
|
||||
console.log("playerName : " + sessionStorageManager.getPlayerName());
|
||||
console.log("playerID : " + sessionStorageManager.getPlayerID());
|
||||
console.log("playerAccountType : " + sessionStorageManager.getPlayerAccountType());
|
||||
console.log("playingAppID : " + sessionStorageManager.getPlayingAppID());
|
||||
console.log("playingAppName : " + sessionStorageManager.getPlayingAppName());
|
||||
console.log("playingAppKoreanName : " + sessionStorageManager.getPlayingAppKoreanName());
|
||||
console.log("record : " + sessionStorageManager.getRecord());
|
||||
console.log("appHighestRecord : " + sessionStorageManager.getAppHighestRecord());
|
||||
}
|
||||
|
||||
if(sessionStorageManager.getMaestroID() === null && !isLogin()) {
|
||||
goLogin();
|
||||
}
|
||||
}
|
||||
|
||||
function isLogin() {
|
||||
var filename = location.pathname.substring(location.pathname.lastIndexOf("/") + 1);
|
||||
|
||||
if(filename === "login.html")
|
||||
return true;
|
||||
else if(filename === "license_timer.html")
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function goLogin() {
|
||||
location.href = "login.html";
|
||||
}
|
||||
|
||||
function isTypingGameApp() {
|
||||
if(sessionStorageManager.getPlayingAppName() == null)
|
||||
return false;
|
||||
|
||||
if(sessionStorageManager.getPlayingAppID < 50 || sessionStorageManager.getPlayingAppID > 100)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function isMouseGameApp() {
|
||||
if(sessionStorageManager.getPlayingAppName() == null)
|
||||
return false;
|
||||
|
||||
if(sessionStorageManager.getPlayingAppID > 100)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function isTypingPracticeApp() {
|
||||
var appName = sessionStorageManager.getPlayingAppName();
|
||||
|
||||
if(appName.indexOf("practice_") > -1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isTypingTestApp() {
|
||||
var appName = sessionStorageManager.getPlayingAppName();
|
||||
|
||||
if(appName.indexOf("test_") > -1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isEnglishTypingApp() {
|
||||
if(sessionStorageManager.getPlayingAppName().indexOf("english") > -1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isKoreanTypingApp() {
|
||||
if(sessionStorageManager.getPlayingAppName().indexOf("korean") > -1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isTypingWordApp() {
|
||||
var appName = sessionStorageManager.getPlayingAppName();
|
||||
|
||||
if(appName.indexOf("_word") > -1)
|
||||
return true;
|
||||
|
||||
// if((isTypingPracticeApp() || isTypingTestApp()) && appName.indexOf("_word") > -1)
|
||||
// return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isTypingSentenceApp() {
|
||||
var appName = sessionStorageManager.getPlayingAppName();
|
||||
|
||||
if(appName.indexOf("_sentence") > -1)
|
||||
return true;
|
||||
|
||||
// if((isTypingPracticeApp() || isTypingTestApp()) && appName.indexOf("_sentence") > -1)
|
||||
// return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isExperiencePlayerAccount() {
|
||||
if(sessionStorageManager.getMaestroAccountType() == 100)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isExperienceMaestroAccount() {
|
||||
if(sessionStorageManager.getMaestroAccountType() == 101)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function getGameAppName() {
|
||||
var appName = sessionStorageManager.getPlayingAppName();
|
||||
|
||||
if(isTypingPracticeApp())
|
||||
return "typing_practice";
|
||||
else if(isTypingTestApp())
|
||||
return "typing_test";
|
||||
else if(isTypingGameApp()) {
|
||||
if(isKoreanTypingApp())
|
||||
return appName.substring("typing_korean_".length);
|
||||
else if(isEnglishTypingApp())
|
||||
return appName.substring("typing_english_".length);
|
||||
}
|
||||
|
||||
return appName;
|
||||
}
|
||||
|
||||
|
||||
var textStyleBasic = { font: "bold 32px Arial", fill: "#fff", align: "center", boundsAlignH: "center", boundsAlignV: "middle" };
|
||||
@@ -0,0 +1,108 @@
|
||||
var LANGUAGE_KOREAN = "korean";
|
||||
var LANGUAGE_ENGLISH = "english";
|
||||
|
||||
var MODE_RELEASE = "release";
|
||||
var MODE_DEBUG = "debug";
|
||||
var runMode = MODE_DEBUG;
|
||||
|
||||
function isDebugMode() {
|
||||
// console.log("debug mode ? " + runMode);
|
||||
return runMode == MODE_DEBUG ? true : false;
|
||||
}
|
||||
|
||||
function isReleaseMode() {
|
||||
// console.log("release mode ? " + runMode);
|
||||
return runMode == MODE_RELEASE ? true : false;
|
||||
}
|
||||
|
||||
|
||||
var GAME_SCREEN_SIZE = { x: 1024, y: 768 }
|
||||
|
||||
|
||||
|
||||
var sessionStorageManager = new SessionStorageManager();
|
||||
{
|
||||
// if(isDebugMode()) {
|
||||
// sessionStorageManager.playerName = "부현율";
|
||||
// sessionStorageManager.playerID = 8;
|
||||
// sessionStorageManager.playingAppID = 101;
|
||||
// sessionStorageManager.playingAppName = "space_invaders";
|
||||
// sessionStorageManager.score = 1000;
|
||||
// sessionStorageManager.highScore = 2000;
|
||||
// }
|
||||
|
||||
console.log("maestroID : " + sessionStorageManager.maestroID);
|
||||
console.log("maestroAccountType : " + sessionStorageManager.maestroAccountType);
|
||||
console.log("playerName : " + sessionStorageManager.playerName);
|
||||
console.log("playerID : " + sessionStorageManager.playerID);
|
||||
console.log("playerAccountType : " + sessionStorageManager.playerAccountType);
|
||||
console.log("playingAppID : " + sessionStorageManager.playingAppID);
|
||||
console.log("playingAppName : " + sessionStorageManager.playingAppName);
|
||||
console.log("playingAppKoreanName : " + sessionStorageManager.playingAppKoreanName);
|
||||
console.log("record : " + sessionStorageManager.record);
|
||||
console.log("bestRecord : " + sessionStorageManager.bestRecord);
|
||||
|
||||
if(sessionStorageManager.maestroID === null && !isLogin()) {
|
||||
goLogin();
|
||||
}
|
||||
}
|
||||
|
||||
function isLogin() {
|
||||
var filename = location.pathname.substring(location.pathname.lastIndexOf("/") + 1);
|
||||
// console.log(filename);
|
||||
|
||||
return filename === "login.html" ? true : false;
|
||||
}
|
||||
|
||||
function goLogin() {
|
||||
location.href = "login.html";
|
||||
}
|
||||
|
||||
function isTypingGame() {
|
||||
if(sessionStorageManager.playingAppName === null)
|
||||
return false;
|
||||
|
||||
if(sessionStorageManager.playingAppName.indexOf("typing") < 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function isTypingPracticeStage() {
|
||||
var appName = sessionStorageManager.playingAppName;
|
||||
|
||||
if(appName.indexOf("practice_") > -1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isTypingTestStage() {
|
||||
var appName = sessionStorageManager.playingAppName;
|
||||
|
||||
if(appName.indexOf("test_") > -1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isTypingWordStage() {
|
||||
var appName = sessionStorageManager.playingAppName;
|
||||
|
||||
if((isTypingPracticeStage() || isTypingTestStage()) && appName.indexOf("_word") > -1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isTypingSentenceStage() {
|
||||
var appName = sessionStorageManager.playingAppName;
|
||||
|
||||
if((isTypingPracticeStage() || isTypingTestStage()) && appName.indexOf("_sentence") > -1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
var textStyleBasic = { font: "bold 32px Arial", fill: "#fff", align: "center", boundsAlignH: "center", boundsAlignV: "middle" };
|
||||
@@ -0,0 +1,108 @@
|
||||
var LANGUAGE_KOREAN = "korean";
|
||||
var LANGUAGE_ENGLISH = "english";
|
||||
|
||||
var MODE_RELEASE = "release";
|
||||
var MODE_DEBUG = "debug";
|
||||
var runMode = MODE_RELEASE;
|
||||
|
||||
function isDebugMode() {
|
||||
// console.log("debug mode ? " + runMode);
|
||||
return runMode == MODE_DEBUG ? true : false;
|
||||
}
|
||||
|
||||
function isReleaseMode() {
|
||||
// console.log("release mode ? " + runMode);
|
||||
return runMode == MODE_RELEASE ? true : false;
|
||||
}
|
||||
|
||||
|
||||
var GAME_SCREEN_SIZE = { x: 1024, y: 768 }
|
||||
|
||||
|
||||
|
||||
var sessionStorageManager = new SessionStorageManager();
|
||||
{
|
||||
// if(isDebugMode()) {
|
||||
// sessionStorageManager.playerName = "부현율";
|
||||
// sessionStorageManager.playerID = 8;
|
||||
// sessionStorageManager.playingAppID = 101;
|
||||
// sessionStorageManager.playingAppName = "space_invaders";
|
||||
// sessionStorageManager.score = 1000;
|
||||
// sessionStorageManager.highScore = 2000;
|
||||
// }
|
||||
|
||||
console.log("maestroID : " + sessionStorageManager.maestroID);
|
||||
console.log("maestroAccountType : " + sessionStorageManager.maestroAccountType);
|
||||
console.log("playerName : " + sessionStorageManager.playerName);
|
||||
console.log("playerID : " + sessionStorageManager.playerID);
|
||||
console.log("playerAccountType : " + sessionStorageManager.playerAccountType);
|
||||
console.log("playingAppID : " + sessionStorageManager.playingAppID);
|
||||
console.log("playingAppName : " + sessionStorageManager.playingAppName);
|
||||
console.log("playingAppKoreanName : " + sessionStorageManager.playingAppKoreanName);
|
||||
console.log("record : " + sessionStorageManager.record);
|
||||
console.log("bestRecord : " + sessionStorageManager.bestRecord);
|
||||
|
||||
if(sessionStorageManager.maestroID === null && !isLogin()) {
|
||||
goLogin();
|
||||
}
|
||||
}
|
||||
|
||||
function isLogin() {
|
||||
var filename = location.pathname.substring(location.pathname.lastIndexOf("/") + 1);
|
||||
// console.log(filename);
|
||||
|
||||
return filename === "login.html" ? true : false;
|
||||
}
|
||||
|
||||
function goLogin() {
|
||||
location.href = "login.html";
|
||||
}
|
||||
|
||||
function isTypingGame() {
|
||||
if(sessionStorageManager.playingAppName === null)
|
||||
return false;
|
||||
|
||||
if(sessionStorageManager.playingAppName.indexOf("typing") < 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function isTypingPracticeStage() {
|
||||
var appName = sessionStorageManager.playingAppName;
|
||||
|
||||
if(appName.indexOf("practice_") > -1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isTypingTestStage() {
|
||||
var appName = sessionStorageManager.playingAppName;
|
||||
|
||||
if(appName.indexOf("test_") > -1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isTypingWordStage() {
|
||||
var appName = sessionStorageManager.playingAppName;
|
||||
|
||||
if((isTypingPracticeStage() || isTypingTestStage()) && appName.indexOf("_word") > -1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isTypingSentenceStage() {
|
||||
var appName = sessionStorageManager.playingAppName;
|
||||
|
||||
if((isTypingPracticeStage() || isTypingTestStage()) && appName.indexOf("_sentence") > -1)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
var textStyleBasic = { font: "bold 32px Arial", fill: "#fff", align: "center", boundsAlignH: "center", boundsAlignV: "middle" };
|
||||
Reference in New Issue
Block a user