Add: license company subject data

This commit is contained in:
2018-12-11 14:42:41 +09:00
parent f9323f87b8
commit 087079db50
4 changed files with 159 additions and 29 deletions
-7
View File
@@ -3,8 +3,6 @@ var LicenseTimer = {
create: function() { create: function() {
game.stage.backgroundColor = "#4d4d4d"; game.stage.backgroundColor = "#4d4d4d";
this.initVariables();
// keyboard shortcut // keyboard shortcut
this.keyboardShortcut = new KeyboardShortcut(); this.keyboardShortcut = new KeyboardShortcut();
this.keyboardShortcut.addCallback( this.keyboardShortcut.addCallback(
@@ -32,11 +30,6 @@ var LicenseTimer = {
this.inputScore = new InputScore(this.chart); this.inputScore = new InputScore(this.chart);
}, },
initVariables: function() {
},
back: function() { back: function() {
sessionStorageManager.resetPlayingAppData(); sessionStorageManager.resetPlayingAppData();
// location.href = '../../web/client/menu_typing_test.html'; // location.href = '../../web/client/menu_typing_test.html';
+84 -12
View File
@@ -7,63 +7,71 @@ function InputScore(chart) {
game.plugins.add(PhaserInput.Plugin); game.plugins.add(PhaserInput.Plugin);
}); });
var inputScorePosY = GAME_SCREEN_SIZE.y - InputScore.INPUT_SCORE_GROUP_OFFSET_Y;
// bar // bar
var bar = game.add.graphics(); var bar = game.add.graphics();
bar.beginFill(0x303030); //, 0.2); 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 // contents
var setting = new RoundRectButtonSetting(0, 0, 0, 0); var setting = new RoundRectButtonSetting(0, 0, 0, 0);
setting.strokeWidthPx = 5; setting.strokeWidthPx = 5;
setting.x = 60; setting.x = 60;
setting.y = inputScorePosY + 35; setting.y = this.inputScorePosY + 35;
setting.width = 100; setting.width = 100;
setting.height = 50; setting.height = 50;
setting.roundAmount = 10;
setting.fontStyle.fontSize = 24; setting.fontStyle.fontSize = 24;
setting.fontStyle.fontWeight = "bold";
this.subjectButton = new RoundRectButton( this.subjectButton = new RoundRectButton(
setting, setting,
null, "과목", null, "과목",
(function() { console.log("과목 선택"); }).bind(this) (function() { this.onClickSubjectButton(); }).bind(this)
); );
var subjectTextSetting = this.makeInputTextSetting(280, "과목 입력"); 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); this.subjectText.setText(this.subject);
var titleTextStyle = { font: "36px Arial", fill: "#fff", align: "center"}; 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); this.titleText.anchor.set(0, 0.5);
var recordTextSetting = this.makeInputTextSetting(150, "점수 입력"); 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); this.titleText.anchor.set(0, 0.5);
var passwordTextSetting = this.makeInputTextSetting(110, "비밀번호"); var passwordTextSetting = this.makeInputTextSetting(110, "비밀번호");
passwordTextSetting.type = PhaserInput.InputType.password; 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 // set timer buttons
setting.x = GAME_SCREEN_SIZE.x - 60; setting.x = GAME_SCREEN_SIZE.x - 60;
setting.y = inputScorePosY + 35; setting.y = this.inputScorePosY + 35;
setting.width = 100; setting.width = 100;
setting.height = 50; setting.height = 50;
var set60SecButton = new RoundRectButton( var set60SecButton = new RoundRectButton(
setting, setting,
null, "저장", 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() { InputScore.prototype.initVariables = function() {
this.inputScorePosY = GAME_SCREEN_SIZE.y - InputScore.INPUT_SCORE_GROUP_OFFSET_Y;
this.subject = "ITQ 파워포인트"; this.subject = "ITQ 파워포인트";
this.recentSubject = this.subject; this.recentSubject = this.subject;
this.licenseCompanyButtonList = [];
this.licenseSubjectButtonList = [];
} }
InputScore.prototype.makeInputTextSetting = function(width, placeHolder) { 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; 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: [
"인터넷정보검색",
"정보통신상식"
]
}
]
}
];
+14 -10
View File
@@ -53,6 +53,9 @@
<script src="../../game/lib/screen_bottom_ui.js"></script> <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 --> <!-- game : source files -->
<script src="../../game/license_timer/loading.js"></script> <script src="../../game/license_timer/loading.js"></script>
<script src="../../game/license_timer/login.js"></script> <script src="../../game/license_timer/login.js"></script>
@@ -85,35 +88,36 @@
if("Notification" in window) { if("Notification" in window) {
if(Notification) { // prepared browser for using Notification if(Notification) { // prepared browser for using Notification
if(Notification.permission === "granted") { if(Notification.permission === "granted") {
console.log("Notification - grated"); // console.log("Notification - grated");
AddNotifyEventByNotification(timeLeft); AddNotifyEventByNotification(timeLeft);
return; return;
} }
Notification.requestPermission(function (result) { Notification.requestPermission(function (result) {
console.log("result : " + result); // console.log("result : " + result);
Notification.permission = result; Notification.permission = result;
if(result === "granted") { if(result === "granted") {
// console.log("Notification - grated : " + result);
AddNotifyEventByNotification(timeLeft); AddNotifyEventByNotification(timeLeft);
return; return;
} }
console.log("Notification - not grated : " + result); // console.log("Notification - not grated : " + result);
AddNotifyEventByAlert(timeLeft); AddNotifyEventByAlert(timeLeft);
}); });
} else { // not prepared browser for using Notification } else { // not prepared browser for using Notification
console.log("no notification - !Notification"); // console.log("no notification - !Notification");
AddNotifyEventByAlert(timeLeft); AddNotifyEventByAlert(timeLeft);
} }
} else { // not prepared browser for using Notification - IE } else { // not prepared browser for using Notification - IE
console.log("no notification - Notification in window"); // console.log("no notification - Notification in window");
AddNotifyEventByAlert(timeLeft); AddNotifyEventByAlert(timeLeft);
} }
} }
function AddNotifyEventByNotification(timeLeft) { function AddNotifyEventByNotification(timeLeft) {
console.log("AddNotifyEventByNotification : " + timeLeft); // console.log("AddNotifyEventByNotification : " + timeLeft);
timeOutEventID = setTimeout(function() { timeOutEventID = setTimeout(function() {
var options = { var options = {
icon: "../../../resources/image/icon/banner_chocomae_128x128.png", icon: "../../../resources/image/icon/banner_chocomae_128x128.png",
@@ -130,7 +134,7 @@
} }
function AddNotifyEventByAlert(timeLeft) { function AddNotifyEventByAlert(timeLeft) {
console.log("AddNotifyEventByAlert : " + timeLeft); // console.log("AddNotifyEventByAlert : " + timeLeft);
timeOutEventID = setTimeout(function() { timeOutEventID = setTimeout(function() {
alert("!!! 시험 시간 종료 !!!\n작업을 중단하고 선생님을 불러주세요."); alert("!!! 시험 시간 종료 !!!\n작업을 중단하고 선생님을 불러주세요.");
}, timeLeft); }, timeLeft);
@@ -138,17 +142,17 @@
function CancelNotifyTimeOver() { function CancelNotifyTimeOver() {
console.log("CancelNotifyTimeOver"); // console.log("CancelNotifyTimeOver");
clearTimeout(timeOutEventID); clearTimeout(timeOutEventID);
} }
function RemoveNotifyEventyByNotification() { function RemoveNotifyEventyByNotification() {
console.log("RemoveNotifyEventyByNotification"); // console.log("RemoveNotifyEventyByNotification");
clearTimeout(timeOutEventID); clearTimeout(timeOutEventID);
} }
function RemoveNotifyEventyByAlert() { function RemoveNotifyEventyByAlert() {
console.log("RemoveNotifyEventyByAlert"); // console.log("RemoveNotifyEventyByAlert");
clearTimeout(timeOutEventID); clearTimeout(timeOutEventID);
} }
</script> </script>