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
+84 -12
View File
@@ -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;