Add: typing examination DB
This commit is contained in:
@@ -234,9 +234,7 @@ var TypingExamination = {
|
||||
screenBottomUI.printRightText(sessionStorageManager.getPlayerName());
|
||||
|
||||
|
||||
// var url = "./../../game/typing/literature_list/korean_national_anthem.txt";
|
||||
var url = "./../../game/typing/literature_list/korean_cold_noodle.txt";
|
||||
this.loadExaminationContent(url);
|
||||
this.loadExaminationContent();
|
||||
// this.countDown();
|
||||
},
|
||||
|
||||
@@ -334,20 +332,31 @@ var TypingExamination = {
|
||||
},
|
||||
|
||||
|
||||
loadExaminationContent: function(url) {
|
||||
game.load.onLoadComplete.add(this.literatureLoadComplete, this);
|
||||
loadExaminationContent: function() {
|
||||
var path = "./../../../resources/file/typing_exam/";
|
||||
|
||||
game.load.text("literature", url);
|
||||
// get the writing data from session storage
|
||||
// get the writing data from DB
|
||||
|
||||
var filename = "korean_heoseng.txt";
|
||||
var writer = "system";
|
||||
var writerID = "";
|
||||
var directory = writer + writerID + "/";
|
||||
var url = path + directory + filename;
|
||||
|
||||
game.load.onLoadComplete.add(this.completeLoadingWriting, this);
|
||||
|
||||
game.load.text("writing", url);
|
||||
|
||||
game.load.start();
|
||||
},
|
||||
|
||||
literatureLoadComplete: function() {
|
||||
completeLoadingWriting: function() {
|
||||
game.load.onFileComplete.remove(this.loadExaminationContent, this);
|
||||
game.load.onLoadComplete.remove(this.literatureLoadComplete, this);
|
||||
game.load.onLoadComplete.remove(this.completeLoadingWriting, this);
|
||||
|
||||
var literature = game.cache.getText("literature");
|
||||
var examinationContent = literature.split("\n");
|
||||
var writing = game.cache.getText("writing");
|
||||
var examinationContent = writing.split("\n");
|
||||
|
||||
for(var i = 0; i < examinationContent.length; i++) {
|
||||
examinationContent[i] = examinationContent[i].replace(/\r/g, "");
|
||||
|
||||
@@ -115,3 +115,68 @@ CREATE TABLE maestro_log (
|
||||
MaestroID INT UNSIGNED NOT NULL,
|
||||
Remark CHAR(100) NOT NULL
|
||||
);
|
||||
|
||||
|
||||
-- Typing Examination
|
||||
|
||||
CREATE TABLE ads_client (
|
||||
AdsClientID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
ClientName CHAR(50) NOT NULL
|
||||
);
|
||||
INSERT INTO `ads_client` (`AdsClientID`, `ClientName`) VALUES
|
||||
(1, 'Chocomae');
|
||||
|
||||
|
||||
CREATE TABLE writing (
|
||||
WritingID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
Name CHAR(50) NOT NULL,
|
||||
Filename CHAR(50) NOT NULL,
|
||||
Writer CHAR(50) NOT NULL,
|
||||
WriterID INT UNSIGNED,
|
||||
UpdateDate DATETIME NOT NULL,
|
||||
LetterCount INT UNSIGNED NOT NULL
|
||||
);
|
||||
INSERT INTO `writing` (`WritingID`, `Name`, `Filename`, `Writer`, `WriterID`, `UpdateDate`, `LetterCount`) VALUES
|
||||
(1, '봄 - 윤동주', 'korean_spring.txt', 'System', , '2019-07-04 00:00:00', 93),
|
||||
(2, '애국가', 'korean_national_anthem.txt', 'System', , '2019-07-04 00:00:00', 208),
|
||||
(3, '냉면 - 김남천', 'korean_cold_noodle.txt', 'System', , '2019-07-04 00:00:00', 2101),
|
||||
(4, '허생전 - 박지원', 'korean_heoseng.txt', 'System', , '2019-07-04 00:00:00', 8839);
|
||||
|
||||
CREATE TABLE typing_exam_record (
|
||||
TypingExamRecordID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
MaestroID INT UNSIGNED NOT NULL,
|
||||
PlayerID INT UNSIGNED NOT NULL,
|
||||
WritingID INT UNSIGNED NOT NULL,
|
||||
Record FLOAT NOT NULL,
|
||||
RecordDateTime DATETIME NOT NULL,
|
||||
|
||||
FOREIGN KEY (MaestroID) REFERENCES maestro(MaestroID),
|
||||
FOREIGN KEY (PlayerID) REFERENCES player(PlayerID),
|
||||
FOREIGN KEY (WritingID) REFERENCES writing(WritingID)
|
||||
);
|
||||
|
||||
CREATE TABLE typing_exam_highest_record (
|
||||
TypingExamHighestRecordID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
MaestroID INT UNSIGNED NOT NULL,
|
||||
PlayerID INT UNSIGNED NOT NULL,
|
||||
WritingID INT UNSIGNED NOT NULL,
|
||||
HighestRecord FLOAT NOT NULL,
|
||||
RecordDateTime DATETIME NOT NULL,
|
||||
|
||||
FOREIGN KEY (MaestroID) REFERENCES maestro(MaestroID),
|
||||
FOREIGN KEY (PlayerID) REFERENCES player(PlayerID),
|
||||
FOREIGN KEY (WritingID) REFERENCES writing(WritingID)
|
||||
);
|
||||
|
||||
CREATE TABLE typing_exam_ads (
|
||||
TypingExamAdsID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
|
||||
AdsClientID INT UNSIGNED NOT NULL,
|
||||
WritingID INT UNSIGNED NOT NULL,
|
||||
FromDateTime DATETIME NOT NULL,
|
||||
ToDateTime DATETIME NOT NULL,
|
||||
Status INT UNSIGNED NOT NULL,
|
||||
Cost FLOAT NOT NULL,
|
||||
|
||||
FOREIGN KEY (AdsClientID) REFERENCES ads_client(AdsClientID),
|
||||
FOREIGN KEY (WritingID) REFERENCES writing(WritingID)
|
||||
);
|
||||
Reference in New Issue
Block a user