Add: input_score
This commit is contained in:
@@ -0,0 +1,94 @@
|
||||
function InputScore(chart) {
|
||||
this.chart = chart;
|
||||
|
||||
this.initVariables();
|
||||
|
||||
Phaser.Device.whenReady(function () {
|
||||
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);
|
||||
|
||||
|
||||
var subjectTextSetting = this.makeInputTextSetting(300, "과목 입력");
|
||||
this.subjectText = this.makeInputText(20, inputScorePosY + 10, subjectTextSetting);
|
||||
this.subjectText.setText(this.subject);
|
||||
|
||||
|
||||
var setting = new RoundRectButtonSetting(0, 0, 0, 0);
|
||||
setting.fontStyle.boundsAlignH = "left"; // left, center. right
|
||||
setting.fontStyle.boundsAlignV = "middle"; // top, middle, bottom
|
||||
setting.strokeWidthPx = 5;
|
||||
|
||||
|
||||
var titleTextStyle = { font: "36px Arial", fill: "#fff", align: "center"};
|
||||
this.titleText = game.add.text(350, inputScorePosY + 40, "과목", titleTextStyle);
|
||||
this.titleText.anchor.set(0, 0.5);
|
||||
|
||||
|
||||
// subject input text
|
||||
// var inputTextSetting = this.makeInputTextSetting(200, "점수 입력");
|
||||
var recordTextSetting = this.makeInputTextSetting(150, "점수 입력");
|
||||
this.recordText = this.makeInputText(game.world.centerX - 50, inputScorePosY + 10, recordTextSetting);
|
||||
// this.subjectText.setText(this.subject);
|
||||
|
||||
this.titleText = game.add.text(640, inputScorePosY + 40, "점", titleTextStyle);
|
||||
this.titleText.anchor.set(0, 0.5);
|
||||
|
||||
|
||||
var passwordTextSetting = this.makeInputTextSetting(150, "비밀번호");
|
||||
passwordTextSetting.type = PhaserInput.InputType.password;
|
||||
this.passwordText = this.makeInputText(GAME_SCREEN_SIZE.x - 330, inputScorePosY + 10, passwordTextSetting);
|
||||
|
||||
|
||||
// set timer buttons
|
||||
setting.x = GAME_SCREEN_SIZE.x - 80;
|
||||
setting.y = 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)
|
||||
);
|
||||
}
|
||||
|
||||
InputScore.prototype.initVariables = function() {
|
||||
this.subject = "ITQ 파워포인트";
|
||||
this.recentSubject = this.subject;
|
||||
}
|
||||
|
||||
InputScore.prototype.makeInputTextSetting = function(width, placeHolder) {
|
||||
return {
|
||||
font: "32px Arial",
|
||||
fill: "#000000",
|
||||
fillAlpha: 1,
|
||||
fontWeight: "bold",
|
||||
forceCase: "", // PhaserInput.ForceCase.upper,
|
||||
width: width,
|
||||
max: 100,
|
||||
padding: 8,
|
||||
borderWidth: 1,
|
||||
borderColor: "#aaa",
|
||||
borderRadius: 6,
|
||||
placeHolder: placeHolder,
|
||||
textAlign: "center",
|
||||
zoom: true
|
||||
}
|
||||
}
|
||||
|
||||
InputScore.prototype.makeInputText = function(x, y, setting) {
|
||||
var inputText = game.add.inputField(x, y, setting);
|
||||
inputText.setText('');
|
||||
inputText.blockInput = false;
|
||||
|
||||
return inputText;
|
||||
}
|
||||
|
||||
|
||||
InputScore.INPUT_SCORE_GROUP_OFFSET_Y = 70;
|
||||
Reference in New Issue
Block a user