Add: maestro_info

This commit is contained in:
2018-07-19 18:27:11 +09:00
parent 54b8bdb3a2
commit 732c085309
8 changed files with 168 additions and 15 deletions
+47
View File
@@ -0,0 +1,47 @@
class MaestroInfo {
constructor() {
this.maestroID = sessionStorage.getItem("maestroID");
this.maestroName = "";
this.accountType = 0;
this.playerCount = 0;
}
loadMaestroInfo(onSuccess, onFail) {
let self = this;
sendRequestServer( //url, sendParams, onSuccess, onFail, isDebugMode);
"./../server/maestro/maestro_info.php",
"maestro_id=" + this.maestroID,
(jsonData) => {
self.maestroName = jsonData["name"];
self.accountType = jsonData["accountType"];
self.playerCount = jsonData["playerCount"];
onSuccess();
},
(errorMessage, errorCode) => {
onFail(errorMessage, errorCode);
}
);
}
getMaxPlayerCount() {
switch(this.accountType) {
case 1:
return 20;
case 2:
return 50;
case 3:
return 100;
}
}
getRegisteredPlayerCount() {
return this.playerCount;
}
}