Fix: DB user column -> player
This commit is contained in:
@@ -24,7 +24,7 @@ let sessionStorageManager = new SessionStorageManager();
|
||||
{
|
||||
// if(isDebugMode()) {
|
||||
// sessionStorageManager.playerName = "부현율";
|
||||
// sessionStorageManager.playerUserID = 8;
|
||||
// sessionStorageManager.playerID = 8;
|
||||
// sessionStorageManager.playingAppID = 101;
|
||||
// sessionStorageManager.playingAppName = "space_invaders";
|
||||
// sessionStorageManager.score = 1000;
|
||||
@@ -33,7 +33,7 @@ let sessionStorageManager = new SessionStorageManager();
|
||||
|
||||
console.log("maestroID : " + sessionStorageManager.maestroID);
|
||||
console.log("playerName : " + sessionStorageManager.playerName);
|
||||
console.log("playerUserID : " + sessionStorageManager.playerUserID);
|
||||
console.log("playerID : " + sessionStorageManager.playerID);
|
||||
console.log("playingAppID : " + sessionStorageManager.playingAppID);
|
||||
console.log("playingAppName : " + sessionStorageManager.playingAppName);
|
||||
console.log("playingAppKoreanName : " + sessionStorageManager.playingAppKoreanName);
|
||||
|
||||
@@ -6,7 +6,7 @@ class DBConnectManager {
|
||||
this.phpPath = this.getPHPPath(this.directoryName);
|
||||
|
||||
this.maestroID = 0;
|
||||
this.playerUserID = 0;
|
||||
this.playerID = 0;
|
||||
this.appName = "";
|
||||
this.dateAndTime = null;
|
||||
}
|
||||
@@ -15,8 +15,8 @@ class DBConnectManager {
|
||||
this.maestroID = maestroID;
|
||||
}
|
||||
|
||||
setPlayerID(userID) {
|
||||
this.playerUserID = userID;
|
||||
setPlayerID(playerID) {
|
||||
this.playerID = playerID;
|
||||
}
|
||||
|
||||
setAppName(appName) {
|
||||
@@ -47,21 +47,21 @@ class DBConnectManager {
|
||||
return "../";
|
||||
}
|
||||
|
||||
requestCheckUserLogin(maestroName, userName, enterCode, onSucceededListener, onFailedListener) {
|
||||
requestCheckPlayerLogin(maestroName, playerName, enterCode, onSucceededListener, onFailedListener) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", this.phpPath + "server/user/login.php", true);
|
||||
xhr.open("POST", this.phpPath + "server/player/login.php", true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
xhr.onreadystatechange = function() {
|
||||
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||
let replyJSON = JSON.parse(xhr.responseText);
|
||||
|
||||
if(replyJSON != null && replyJSON["UserID"] != null)
|
||||
if(replyJSON != null && replyJSON["PlayerID"] != null)
|
||||
onSucceededListener(replyJSON);
|
||||
else
|
||||
onFailedListener(replyJSON);
|
||||
}
|
||||
};
|
||||
xhr.send("maestro_name=" + maestroName + "&name=" + userName + "&enter_code=" + enterCode);
|
||||
xhr.send("maestro_name=" + maestroName + "&name=" + playerName + "&enter_code=" + enterCode);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -182,7 +182,7 @@ class DBConnectManager {
|
||||
};
|
||||
let params = "MaestroID=" + sessionStorageManager.maestroID
|
||||
+ "&AppID=" + sessionStorageManager.playingAppID
|
||||
+ "&UserID=" + sessionStorageManager.playerUserID
|
||||
+ "&PlayerID=" + sessionStorageManager.playerID
|
||||
+ "&Date=" + date;
|
||||
xhr.send(params);
|
||||
}
|
||||
@@ -321,7 +321,7 @@ class DBConnectManager {
|
||||
for(let i = 0; i < count; i++) {
|
||||
let record = new RankingRecord(
|
||||
i + 1,
|
||||
replyJSON[i]["UserID"],
|
||||
replyJSON[i]["PlayerID"],
|
||||
replyJSON[i]["Name"],
|
||||
replyJSON[i]["HighScore"]
|
||||
);
|
||||
@@ -342,7 +342,7 @@ class DBConnectManager {
|
||||
if(xhr.readyState == 4 && xhr.status == 200) {
|
||||
let replyJSON = JSON.parse(xhr.responseText);
|
||||
|
||||
if(replyJSON != null && replyJSON["UserID"] != null)
|
||||
if(replyJSON != null && replyJSON["PlayerID"] != null)
|
||||
onSucceededListener(replyJSON);
|
||||
else
|
||||
onFailedListener(replyJSON);
|
||||
@@ -369,19 +369,19 @@ class DBConnectManager {
|
||||
xhr.send("AppID=" + appID);
|
||||
}
|
||||
|
||||
updateTodayBestRecord(maestroID, userID, appID, record) {
|
||||
updateTodayBestRecord(maestroID, playerID, appID, record) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", this.phpPath + "server/record/update_best_record.php", true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
xhr.send(
|
||||
"MaestroID=" + maestroID
|
||||
+ "&UserID=" + userID
|
||||
+ "&PlayerID=" + playerID
|
||||
+ "&AppID=" + appID
|
||||
+ "&BestRecord=" + record
|
||||
);
|
||||
}
|
||||
|
||||
requestTodayBestRecord(maestroID, userID, appID, onSucceededListener, onFailedListener) {
|
||||
requestTodayBestRecord(maestroID, playerID, appID, onSucceededListener, onFailedListener) {
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", this.phpPath + "server/record/request_best_record.php", true);
|
||||
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
@@ -397,7 +397,7 @@ class DBConnectManager {
|
||||
};
|
||||
xhr.send(
|
||||
"MaestroID=" + maestroID
|
||||
+ "&UserID=" + userID
|
||||
+ "&PlayerID=" + playerID
|
||||
+ "&AppID=" + appID
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
class RankingRecord {
|
||||
|
||||
constructor(rank, userID, userName, bestRecord) {
|
||||
constructor(rank, playerID, playerName, bestRecord) {
|
||||
this.rank = rank;
|
||||
this.userID = userID;
|
||||
this.userName = userName;
|
||||
this.playerID = playerID;
|
||||
this.playerName = playerName;
|
||||
this.bestRecord = bestRecord;
|
||||
}
|
||||
}
|
||||
@@ -36,12 +36,12 @@ class RankingRecordManager {
|
||||
return this.rankingRecords[index].rank;
|
||||
}
|
||||
|
||||
getUserIDAt(index) {
|
||||
return this.rankingRecords[index].userID;
|
||||
getPlayerIDAt(index) {
|
||||
return this.rankingRecords[index].playerID;
|
||||
}
|
||||
|
||||
getUserNameAt(index) {
|
||||
return this.rankingRecords[index].userName;
|
||||
getPlayerNameAt(index) {
|
||||
return this.rankingRecords[index].playerName;
|
||||
}
|
||||
|
||||
getBestRecordAt(index) {
|
||||
|
||||
@@ -11,7 +11,7 @@ class SessionStorageManager {
|
||||
return sessionStorage.removeItem(key);
|
||||
}
|
||||
|
||||
// maestro user ID
|
||||
// maestro ID
|
||||
set maestroID(value) {
|
||||
sessionStorage.setItem("maestroID", value);
|
||||
}
|
||||
@@ -27,12 +27,12 @@ class SessionStorageManager {
|
||||
return sessionStorage.getItem("playerName");
|
||||
}
|
||||
|
||||
// player user ID
|
||||
set playerUserID(value) {
|
||||
sessionStorage.setItem("playerUserID", value);
|
||||
// player player ID
|
||||
set playerID(value) {
|
||||
sessionStorage.setItem("playerID", value);
|
||||
}
|
||||
get playerUserID() {
|
||||
return sessionStorage.getItem("playerUserID");
|
||||
get playerID() {
|
||||
return sessionStorage.getItem("playerID");
|
||||
}
|
||||
|
||||
// playing app id
|
||||
|
||||
@@ -90,7 +90,7 @@ class Login {
|
||||
let enterCode = self.inputTextEnterCode.canvasInput._value;
|
||||
|
||||
let dbConnectManager = new DBConnectManager();
|
||||
dbConnectManager.requestCheckUserLogin(
|
||||
dbConnectManager.requestCheckPlayerLogin(
|
||||
maestroName,
|
||||
sessionStorageManager.playerName,
|
||||
enterCode,
|
||||
@@ -101,10 +101,13 @@ class Login {
|
||||
|
||||
loginSucceeded(jsonData) {
|
||||
sessionStorageManager.maestroID = jsonData['MaestroID'];
|
||||
sessionStorageManager.playerUserID = jsonData['UserID'];
|
||||
sessionStorageManager.playerID = jsonData['PlayerID'];
|
||||
|
||||
sessionStorageManager.playingAppName = "menu";
|
||||
location.href = '../../web/client/menu_app.html';
|
||||
|
||||
// console.log("===== after login =====");
|
||||
// console.log(sessionStorageManager.playerID);
|
||||
}
|
||||
|
||||
loginFailed(jsonData) {
|
||||
|
||||
@@ -37,12 +37,12 @@ class RankingBoard {
|
||||
}
|
||||
|
||||
getMyRank(rankingRecordManager) {
|
||||
let playerUserID = Number(sessionStorageManager.playerUserID);
|
||||
let playerID = Number(sessionStorageManager.playerID);
|
||||
|
||||
for(let i = 0; i < rankingRecordManager.count; i++) {
|
||||
let data = rankingRecordManager.getAt(i);
|
||||
let userID = Number(data["userID"]);
|
||||
if(userID === playerUserID)
|
||||
let playerIDNo = Number(data["playerID"]);
|
||||
if(playerIDNo === playerID)
|
||||
return i + 1;
|
||||
}
|
||||
|
||||
@@ -109,8 +109,8 @@ class RankingBoard {
|
||||
.setTextBounds(0, 0, 40, 40)
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
|
||||
// user name
|
||||
game.add.text(this.getPosX(type) + 60, this.getPosY(index), data.userName, style)
|
||||
// player name
|
||||
game.add.text(this.getPosX(type) + 60, this.getPosY(index), data.playerName, style)
|
||||
.setTextBounds(0, 0, 60, 60)
|
||||
.setShadow(3, 3, 'rgba(0, 0, 0, 0.5)', 2);
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ class Result {
|
||||
uploadRecord() {
|
||||
this.dbConnectManager.updateTodayBestRecord(
|
||||
sessionStorageManager.maestroID,
|
||||
sessionStorageManager.playerUserID,
|
||||
sessionStorageManager.playerID,
|
||||
sessionStorageManager.playingAppID,
|
||||
sessionStorageManager.record
|
||||
);
|
||||
|
||||
@@ -73,7 +73,7 @@ class Start {
|
||||
|
||||
this.dbConnectManager.requestTodayBestRecord(
|
||||
sessionStorageManager.maestroID,
|
||||
sessionStorageManager.playerUserID,
|
||||
sessionStorageManager.playerID,
|
||||
sessionStorageManager.playingAppID,
|
||||
replyJSON => {
|
||||
sessionStorageManager.bestRecord = Number(replyJSON["BestRecord"]);
|
||||
|
||||
Reference in New Issue
Block a user