Add: license company subject data
This commit is contained in:
@@ -3,8 +3,6 @@ var LicenseTimer = {
|
||||
create: function() {
|
||||
game.stage.backgroundColor = "#4d4d4d";
|
||||
|
||||
this.initVariables();
|
||||
|
||||
// keyboard shortcut
|
||||
this.keyboardShortcut = new KeyboardShortcut();
|
||||
this.keyboardShortcut.addCallback(
|
||||
@@ -32,11 +30,6 @@ var LicenseTimer = {
|
||||
this.inputScore = new InputScore(this.chart);
|
||||
},
|
||||
|
||||
|
||||
initVariables: function() {
|
||||
},
|
||||
|
||||
|
||||
back: function() {
|
||||
sessionStorageManager.resetPlayingAppData();
|
||||
// location.href = '../../web/client/menu_typing_test.html';
|
||||
|
||||
@@ -7,63 +7,71 @@ function InputScore(chart) {
|
||||
game.plugins.add(PhaserInput.Plugin);
|
||||
});
|
||||
|
||||
var inputScorePosY = GAME_SCREEN_SIZE.y - InputScore.INPUT_SCORE_GROUP_OFFSET_Y;
|
||||
|
||||
// bar
|
||||
var bar = game.add.graphics();
|
||||
bar.beginFill(0x303030); //, 0.2);
|
||||
bar.drawRect(0, inputScorePosY, GAME_SCREEN_SIZE.x, 70);
|
||||
bar.drawRect(0, this.inputScorePosY, GAME_SCREEN_SIZE.x, 70);
|
||||
|
||||
|
||||
// contents
|
||||
var setting = new RoundRectButtonSetting(0, 0, 0, 0);
|
||||
setting.strokeWidthPx = 5;
|
||||
setting.x = 60;
|
||||
setting.y = inputScorePosY + 35;
|
||||
setting.y = this.inputScorePosY + 35;
|
||||
setting.width = 100;
|
||||
setting.height = 50;
|
||||
setting.roundAmount = 10;
|
||||
setting.fontStyle.fontSize = 24;
|
||||
setting.fontStyle.fontWeight = "bold";
|
||||
this.subjectButton = new RoundRectButton(
|
||||
setting,
|
||||
null, "과목",
|
||||
(function() { console.log("과목 선택"); }).bind(this)
|
||||
(function() { this.onClickSubjectButton(); }).bind(this)
|
||||
);
|
||||
|
||||
|
||||
var subjectTextSetting = this.makeInputTextSetting(280, "과목 입력");
|
||||
this.subjectText = this.makeInputText(120, inputScorePosY + 10, subjectTextSetting);
|
||||
this.subjectText = this.makeInputText(120, this.inputScorePosY + 10, subjectTextSetting);
|
||||
this.subjectText.setText(this.subject);
|
||||
|
||||
var titleTextStyle = { font: "36px Arial", fill: "#fff", align: "center"};
|
||||
this.titleText = game.add.text(440, inputScorePosY + 40, "점수", titleTextStyle);
|
||||
this.titleText = game.add.text(440, this.inputScorePosY + 40, "점수", titleTextStyle);
|
||||
this.titleText.anchor.set(0, 0.5);
|
||||
|
||||
var recordTextSetting = this.makeInputTextSetting(150, "점수 입력");
|
||||
this.recordText = this.makeInputText(game.world.centerX, inputScorePosY + 10, recordTextSetting);
|
||||
this.recordText = this.makeInputText(game.world.centerX, this.inputScorePosY + 10, recordTextSetting);
|
||||
|
||||
this.titleText = game.add.text(game.world.centerX + 190, inputScorePosY + 40, "마에", titleTextStyle);
|
||||
this.titleText = game.add.text(game.world.centerX + 190, this.inputScorePosY + 40, "마에", titleTextStyle);
|
||||
this.titleText.anchor.set(0, 0.5);
|
||||
|
||||
var passwordTextSetting = this.makeInputTextSetting(110, "비밀번호");
|
||||
passwordTextSetting.type = PhaserInput.InputType.password;
|
||||
this.passwordText = this.makeInputText(game.world.centerX + 260, inputScorePosY + 10, passwordTextSetting);
|
||||
this.passwordText = this.makeInputText(game.world.centerX + 260, this.inputScorePosY + 10, passwordTextSetting);
|
||||
|
||||
|
||||
// set timer buttons
|
||||
setting.x = GAME_SCREEN_SIZE.x - 60;
|
||||
setting.y = inputScorePosY + 35;
|
||||
setting.y = this.inputScorePosY + 35;
|
||||
setting.width = 100;
|
||||
setting.height = 50;
|
||||
var set60SecButton = new RoundRectButton(
|
||||
setting,
|
||||
null, "저장",
|
||||
(function() { console.log(this.subjectText.value); console.log("save score"); }).bind(this)
|
||||
(function() { this.onClickSendToServerButton(); }).bind(this)
|
||||
);
|
||||
|
||||
this.makeLicenseCompanyPanel();
|
||||
this.setVisibleLicenseCompanyPanel(false);
|
||||
}
|
||||
|
||||
InputScore.prototype.initVariables = function() {
|
||||
this.inputScorePosY = GAME_SCREEN_SIZE.y - InputScore.INPUT_SCORE_GROUP_OFFSET_Y;
|
||||
|
||||
this.subject = "ITQ 파워포인트";
|
||||
this.recentSubject = this.subject;
|
||||
|
||||
this.licenseCompanyButtonList = [];
|
||||
this.licenseSubjectButtonList = [];
|
||||
}
|
||||
|
||||
InputScore.prototype.makeInputTextSetting = function(width, placeHolder) {
|
||||
@@ -94,4 +102,68 @@ InputScore.prototype.makeInputText = function(x, y, setting) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
InputScore.prototype.onClickSubjectButton = function() {
|
||||
if(!this.licenseCompanyPanel.visible)
|
||||
this.setVisibleLicenseCompanyPanel(true);
|
||||
else
|
||||
this.setVisibleLicenseCompanyPanel(false);
|
||||
}
|
||||
|
||||
InputScore.prototype.makeLicenseCompanyPanel = function() {
|
||||
this.licenseCompanyPanel = this.makePanelSprite(0, 300, 400, 400, 0xffffff);
|
||||
|
||||
var setting = new RoundRectButtonSetting(0, 0, 0, 0);
|
||||
setting.strokeWidthPx = 5;
|
||||
setting.x = 90;
|
||||
setting.width = 160;
|
||||
setting.height = 50;
|
||||
setting.roundAmount = 10;
|
||||
setting.fontStyle.fontSize = 24;
|
||||
setting.fontStyle.fontWeight = "bold";
|
||||
|
||||
for(var i = 0; i < licenseCompanySubjectList.length; i++) {
|
||||
setting.y = this.inputScorePosY - 40 - 60 * i;
|
||||
var licenseCompanyButton = new RoundRectButton(
|
||||
setting,
|
||||
null, licenseCompanySubjectList[i].companyName,
|
||||
(function() { console.log(licenseCompanySubjectList[i].companyName); }).bind(this)
|
||||
);
|
||||
|
||||
this.licenseCompanyButtonList[i] = licenseCompanyButton;
|
||||
}
|
||||
}
|
||||
|
||||
InputScore.prototype.setVisibleLicenseCompanyPanel = function(flag) {
|
||||
this.licenseCompanyPanel.visible = flag;
|
||||
|
||||
if(flag) {
|
||||
for(var i = 0; i < licenseCompanySubjectList.length; i++) {
|
||||
this.licenseCompanyButtonList[i].move(90, this.inputScorePosY - 40 - 60 * i);
|
||||
}
|
||||
} else {
|
||||
for(var i = 0; i < licenseCompanySubjectList.length; i++) {
|
||||
this.licenseCompanyButtonList[i].move(-100, 900);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
InputScore.prototype.makePanelSprite = function(x, y, width, height, color) {
|
||||
var btnTexture = new Phaser.Graphics()
|
||||
.beginFill(color, 0.5)
|
||||
.drawRect(0, 0, width, height)
|
||||
.endFill()
|
||||
.generateTexture();
|
||||
|
||||
return game.add.sprite(x, y, btnTexture);
|
||||
}
|
||||
|
||||
|
||||
|
||||
InputScore.prototype.onClickSendToServerButton = function() {
|
||||
console.log("send data to server");
|
||||
}
|
||||
|
||||
|
||||
|
||||
InputScore.INPUT_SCORE_GROUP_OFFSET_Y = 70;
|
||||
@@ -0,0 +1,61 @@
|
||||
var licenseCompanySubjectList = [
|
||||
{
|
||||
companyName: "ITQ",
|
||||
subjectData: [
|
||||
{
|
||||
time: 40,
|
||||
maxScore: 500,
|
||||
grade: {
|
||||
A: 400,
|
||||
B: 300,
|
||||
C: 200
|
||||
},
|
||||
subjects: [
|
||||
"아래한글",
|
||||
"한셀",
|
||||
"한쇼",
|
||||
"MS워드",
|
||||
"한글엑셀",
|
||||
"한글액세스",
|
||||
"한글파워포인트",
|
||||
"인터넷"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
companyName: "DIAT",
|
||||
subjectData: [
|
||||
{
|
||||
time: 40,
|
||||
maxScore: 200,
|
||||
grade: {
|
||||
고급: 160,
|
||||
중급: 120,
|
||||
초급: 80
|
||||
},
|
||||
subjects: [
|
||||
"프리젠테이션",
|
||||
"스프레드시트",
|
||||
"워드프로세서",
|
||||
"멀티미디어제작"
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
time: 40,
|
||||
maxScore: 100,
|
||||
grade: {
|
||||
고급: 80,
|
||||
중급: 60,
|
||||
초급: 40
|
||||
},
|
||||
subjects: [
|
||||
"인터넷정보검색",
|
||||
"정보통신상식"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
@@ -53,6 +53,9 @@
|
||||
<script src="../../game/lib/screen_bottom_ui.js"></script>
|
||||
|
||||
|
||||
<!-- license company and subject list : data files -->
|
||||
<script src="../../game/license_timer/license_data/company_subject.js"></script>
|
||||
|
||||
<!-- game : source files -->
|
||||
<script src="../../game/license_timer/loading.js"></script>
|
||||
<script src="../../game/license_timer/login.js"></script>
|
||||
@@ -85,35 +88,36 @@
|
||||
if("Notification" in window) {
|
||||
if(Notification) { // prepared browser for using Notification
|
||||
if(Notification.permission === "granted") {
|
||||
console.log("Notification - grated");
|
||||
// console.log("Notification - grated");
|
||||
AddNotifyEventByNotification(timeLeft);
|
||||
return;
|
||||
}
|
||||
|
||||
Notification.requestPermission(function (result) {
|
||||
console.log("result : " + result);
|
||||
// console.log("result : " + result);
|
||||
Notification.permission = result;
|
||||
|
||||
if(result === "granted") {
|
||||
// console.log("Notification - grated : " + result);
|
||||
AddNotifyEventByNotification(timeLeft);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("Notification - not grated : " + result);
|
||||
// console.log("Notification - not grated : " + result);
|
||||
AddNotifyEventByAlert(timeLeft);
|
||||
});
|
||||
} else { // not prepared browser for using Notification
|
||||
console.log("no notification - !Notification");
|
||||
// console.log("no notification - !Notification");
|
||||
AddNotifyEventByAlert(timeLeft);
|
||||
}
|
||||
} else { // not prepared browser for using Notification - IE
|
||||
console.log("no notification - Notification in window");
|
||||
// console.log("no notification - Notification in window");
|
||||
AddNotifyEventByAlert(timeLeft);
|
||||
}
|
||||
}
|
||||
|
||||
function AddNotifyEventByNotification(timeLeft) {
|
||||
console.log("AddNotifyEventByNotification : " + timeLeft);
|
||||
// console.log("AddNotifyEventByNotification : " + timeLeft);
|
||||
timeOutEventID = setTimeout(function() {
|
||||
var options = {
|
||||
icon: "../../../resources/image/icon/banner_chocomae_128x128.png",
|
||||
@@ -130,7 +134,7 @@
|
||||
}
|
||||
|
||||
function AddNotifyEventByAlert(timeLeft) {
|
||||
console.log("AddNotifyEventByAlert : " + timeLeft);
|
||||
// console.log("AddNotifyEventByAlert : " + timeLeft);
|
||||
timeOutEventID = setTimeout(function() {
|
||||
alert("!!! 시험 시간 종료 !!!\n작업을 중단하고 선생님을 불러주세요.");
|
||||
}, timeLeft);
|
||||
@@ -138,17 +142,17 @@
|
||||
|
||||
|
||||
function CancelNotifyTimeOver() {
|
||||
console.log("CancelNotifyTimeOver");
|
||||
// console.log("CancelNotifyTimeOver");
|
||||
clearTimeout(timeOutEventID);
|
||||
}
|
||||
|
||||
function RemoveNotifyEventyByNotification() {
|
||||
console.log("RemoveNotifyEventyByNotification");
|
||||
// console.log("RemoveNotifyEventyByNotification");
|
||||
clearTimeout(timeOutEventID);
|
||||
}
|
||||
|
||||
function RemoveNotifyEventyByAlert() {
|
||||
console.log("RemoveNotifyEventyByAlert");
|
||||
// console.log("RemoveNotifyEventyByAlert");
|
||||
clearTimeout(timeOutEventID);
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user