Fix: restructing sessionManager (incompleted)

This commit is contained in:
2018-09-14 11:58:50 +09:00
parent 1a2d9e6800
commit 72e7c1a28f
6 changed files with 157 additions and 45 deletions
+3 -3
View File
@@ -79,9 +79,9 @@ function GameAppButton(x, y, type, iconName, buttonText, appInfo) {
GameAppButton.prototype.clickEvent = function() {
sessionStorageManager.playingAppID = this.appInfo.AppID;
sessionStorageManager.playingAppName = this.appInfo.AppName;
sessionStorageManager.playingAppKoreanName = this.appInfo.KoreanName;
sessionStorageManager.getPlayingAppID() = this.appInfo.AppID;
sessionStorageManager.getPlayingAppName() = this.appInfo.AppName;
sessionStorageManager.getPlayingAppKoreanName() = this.appInfo.KoreanName;
location.href = '../../web/client/start.html';
}
+3 -3
View File
@@ -98,9 +98,9 @@ function TypingAppButton(type, x, y, iconName, buttonText, appInfo) {
}
TypingAppButton.prototype.clickEvent = function() {
sessionStorageManager.playingAppID = this.appInfo.AppID;
sessionStorageManager.playingAppName = this.appInfo.AppName;
sessionStorageManager.playingAppKoreanName = this.appInfo.KoreanName;
sessionStorageManager.setPlayingAppID(this.appInfo.AppID);
sessionStorageManager.setPlayingAppName(this.appInfo.AppName);
sessionStorageManager.setPlayingAppKoreanName(this.appInfo.KoreanName);
location.href = '../../web/client/start.html';
}
+113 -1
View File
@@ -1,3 +1,114 @@
function SessionStorageManager() {
}
SessionStorageManager.prototype.clear = function() {
sessionStorage.clear();
}
SessionStorageManager.prototype.removeItem = function(key) {
return sessionStorage.removeItem(key);
}
// maestro ID
SessionStorageManager.prototype.setMaestroID = function(value) {
sessionStorage.setItem("maestroID", value);
}
SessionStorageManager.prototype.getMaestroID = function() {
return sessionStorage.getItem("maestroID");
}
// maestro account type
SessionStorageManager.prototype.setMaestroAccountType = function(value) {
sessionStorage.setItem("maestroAccountType", value);
}
SessionStorageManager.prototype.getMaestroAccountType = function() {
return sessionStorage.getItem("maestroAccountType");
}
// player name
SessionStorageManager.prototype.setPlayerName = function(value) {
sessionStorage.setItem("playerName", value);
}
SessionStorageManager.prototype.getPlayerName = function() {
return sessionStorage.getItem("playerName");
}
// player player ID
SessionStorageManager.prototype.setPlayerID = function(value) {
sessionStorage.setItem("playerID", value);
}
SessionStorageManager.prototype.getPlayerID = function() {
return sessionStorage.getItem("playerID");
}
// player account type
SessionStorageManager.prototype.setPlayerAccountType = function(value) {
sessionStorage.setItem("playerAccountType", value);
}
SessionStorageManager.prototype.getPlayerAccountType = function() {
return sessionStorage.getItem("playerAccountType");
}
// playing app id
SessionStorageManager.prototype.setPlayingAppID = function(value) {
sessionStorage.setItem("playingAppID", value);
}
SessionStorageManager.prototype.getPlayingAppID = function() {
return sessionStorage.getItem("playingAppID");
}
// playing app name
SessionStorageManager.prototype.setPlayingAppName = function(value) {
sessionStorage.setItem("playingAppName", value);
}
SessionStorageManager.prototype.getPlayingAppName = function() {
return sessionStorage.getItem("playingAppName");
}
// playing app korean name
SessionStorageManager.prototype.setPlayingAppKoreanName = function(value) {
sessionStorage.setItem("playingAppKoreanName", value);
}
SessionStorageManager.prototype.getPlayingAppKoreanName = function() {
return sessionStorage.getItem("playingAppKoreanName");
}
// record
SessionStorageManager.prototype.setRecord = function(value) {
sessionStorage.setItem("record", value);
}
SessionStorageManager.prototype.getRecord = function() {
return sessionStorage.getItem("record");
}
// best record
SessionStorageManager.prototype.setBestRecord = function(value) {
sessionStorage.setItem("bestRecord", value);
}
SessionStorageManager.prototype.getBestRecord = function() {
return sessionStorage.getItem("bestRecord");
}
// best record
SessionStorageManager.prototype.setIsNewBestRecord = function(value) {
sessionStorage.setItem("isNewBestRecord", value);
}
SessionStorageManager.prototype.getIsNewBestRecord = function() {
return sessionStorage.getItem("isNewBestRecord");
}
SessionStorageManager.prototype.resetPlayingAppData = function() {
this.removeItem(playingAppID);
this.removeItem(playingAppName);
this.removeItem(playingAppKoreanName);
this.removeItem(record);
this.removeItem(bestRecord);
}
/*
class SessionStorageManager {
constructor() {
@@ -108,4 +219,5 @@ class SessionStorageManager {
}
}
}
*/