- /*: 
-  * Renews.js 
-  * @plugindesc 多周目游戏 
-  * @author 魏玉龙 
-  * @since 2018.10.01 
-  * @version 0.1 
-  *  
-  * @param clearCountVariable 
-  * @desc 通关次数同步变量值。大于0时,相应变量值同步通关次数。等于0则无变量同步次数。 
-  * @default 0 
-  *  
-  * @param inheritVariables 
-  * @desc 需要被继承的变量ID 多个变量时用‘,’间隔 
-  * @default 0 
-  *  
-  * @param inheritSwitches 
-  * @desc 需要被继承的开关ID 多个开关时用‘,’间隔 
-  * @default 0 
-  *  
-  * @help 
-  * 此插件提供以下插件命令: 
-  *  
-  * 通关标记 [string] 
-  *   对接下来的通关存档做标记 
-  *  
-  */ 
-   
- (function () { 
-   var parameters = PluginManager.parameters('Renews'); 
-   var clearCountVariable = Number(parameters['clearCountVariable']) || 0; 
-   var inheritVariables = parameters['inheritVariables'].split(','); 
-   var inheritSwitches = parameters['inheritSwitches'].split(','); 
-   
-   var DataManager_makeSavefileInfo = DataManager.makeSavefileInfo; 
-   DataManager.makeSavefileInfo = function () { 
-     var info = DataManager_makeSavefileInfo.call(this); 
-     info.gameClear = $gameTemp.isGameClear(); 
-     info.clearSign = $gameTemp.clearSign(); 
-     return info; 
-   }; 
-   
-   DataManager.startRenewGame = function (savefileId) { 
-     var json = JsonEx.parse(StorageManager.load(savefileId)); 
-     if (this.isThisGameFile(savefileId)) { 
-       this.createGameObjects(); 
-       this.extractRenewContents(json); 
-       $gamePlayer.reserveTransfer($dataSystem.startMapId, 
-         $dataSystem.startX, $dataSystem.startY); 
-       $gameParty.setupStartingMembers(); 
-       $gameVariables.setValue(clearCountVariable, $gameSystem.gameClearCount()); 
-       return true; 
-     } else { 
-       return false; 
-     } 
-   } 
-   
-   DataManager.extractRenewContents = function (contents) { 
-     $gameSystem = contents.system; 
-     $gameActors = contents.actors; 
-     $gameParty = contents.party; 
-     inheritVariables.forEach(function (value) { 
-       var variableId = Number(value) || 0; 
-       if (value > 0) { 
-         $gameVariables.setValue(variableId, contents.variables.value(variableId)); 
-       } 
-     }); 
-     inheritSwitches.forEach(function (value) { 
-       var variableId = Number(value) || 0; 
-       if (value > 0) { 
-         $gameSwitches.setValue(variableId, contents.Switches.value(variableId)); 
-       } 
-     }); 
-   } 
-   
-   var Game_Temp_prototype_initialize = Game_Temp.prototype.initialize; 
-   Game_Temp.prototype.initialize = function () { 
-     Game_Temp_prototype_initialize.call(this); 
-     this._gameClear = false; 
-     this._clearSign = ''; 
-   }; 
-   
-   Game_Temp.prototype.isGameClear = function () { 
-     return this._gameClear; 
-   }; 
-   
-   Game_Temp.prototype.clearSign = function () { 
-     return this._clearSign; 
-   }; 
-   
-   Game_Temp.prototype.setGameClear = function (sign) { 
-     this._gameClear = true; 
-     this._clearSign = sign; 
-     $gameSystem._gameClearCount += 1; 
-   }; 
-   
-   var Game_System_prototype_initialize = Game_System.prototype.initialize; 
-   Game_System.prototype.initialize = function () { 
-     Game_System_prototype_initialize.call(this); 
-     this._gameClearCount = 0; 
-   }; 
-   
-   Game_System.prototype.gameClearCount = function () { 
-     return this._gameClearCount; 
-   } 
-   
-   Window_SavefileList.prototype.drawGameTitle = function (info, x, y, width) { 
-     if (info.title) { 
-       var title = info.title; 
-       if (info.gameClear && info.clearSign) { 
-         title += ' ' + info.clearSign; 
-       } 
-       this.drawText(title, x, y, width); 
-     } 
-   }; 
-   
-   function Window_RenewGame() { 
-     this.initialize.apply(this, arguments); 
-   } 
-   
-   Window_RenewGame.prototype = Object.create(Window_Command.prototype); 
-   Window_RenewGame.prototype.constructor = Window_RenewGame; 
-   
-   Window_RenewGame.prototype.initialize = function () { 
-     Window_Command.prototype.initialize.call(this, 0, 0); 
-     this.updatePlacement(); 
-   }; 
-   
-   Window_RenewGame.prototype.windowWidth = function () { 
-     return 200; 
-   }; 
-   
-   Window_RenewGame.prototype.windowHeight = function () { 
-     return this.fittingHeight(2); 
-   }; 
-   
-   Window_RenewGame.prototype.updatePlacement = function () { 
-     this.x = (Graphics.boxWidth - this.width) / 2; 
-     this.y = (Graphics.boxHeight - this.height) / 2; 
-   }; 
-   
-   Window_RenewGame.prototype.makeCommandList = function () { 
-     this.addCommand('重新开始', 'renew'); 
-     this.addCommand('取消', 'cancel'); 
-   }; 
-   
-   var Scene_Load_prototype_create = Scene_Load.prototype.create; 
-   Scene_Load.prototype.create = function () { 
-     Scene_Load_prototype_create.call(this); 
-     this.createRenewWindow(); 
-   } 
-   
-   Scene_Load.prototype.createRenewWindow = function () { 
-     this._renewWindow = new Window_RenewGame(); 
-     this._renewWindow.setHandler('renew', this.startRenewGame.bind(this)); 
-     this._renewWindow.setHandler('cancel', this.cancelRenewGame.bind(this)); 
-     this._renewWindow.deactivate(); 
-     this._renewWindow.hide(); 
-     this.addWindow(this._renewWindow); 
-   } 
-   
-   Scene_Load.prototype.isRenewGame = function () { 
-     var info = DataManager.loadSavefileInfo(this.savefileId()); 
-     return info.gameClear; 
-   } 
-   
-   Scene_Load.prototype.startRenewGame = function () { 
-     this.onStartRenewGame(); 
-   } 
-   
-   Scene_Load.prototype.cancelRenewGame = function () { 
-     this._renewWindow.deactivate(); 
-     this._renewWindow.hide(); 
-     this.activateListWindow(); 
-   } 
-   
-   Scene_Load.prototype.onSavefileOk = function () { 
-     Scene_File.prototype.onSavefileOk.call(this); 
-     if (DataManager.isThisGameFile(this.savefileId())) { 
-       if (this.isRenewGame()) { 
-         this._renewWindow.show(); 
-         this._renewWindow.activate(); 
-       } else { 
-         DataManager.loadGame(this.savefileId()) 
-         this.onLoadSuccess(); 
-       } 
-     } else { 
-       this.onLoadFailure(); 
-     } 
-   } 
-   
-   Scene_Load.prototype.onStartRenewGame = function () { 
-     DataManager.startRenewGame(this.savefileId()); 
-     SoundManager.playLoad(); 
-     this.fadeOutAll(); 
-     SceneManager.goto(Scene_Map); 
-     this._loadSuccess = true; 
-   } 
-   
-   var Scene_Gameover_prototype_gotoTitle = Scene_Gameover.prototype.gotoTitle; 
-   Scene_Gameover.prototype.gotoTitle = function () { 
-     if ($gameTemp.isGameClear()) { 
-       SceneManager.push(Scene_Save); 
-     } else { 
-       Scene_Gameover_prototype_gotoTitle.call(this); 
-     } 
-   } 
-   
-   var Scene_Save_prototype_popScene = Scene_Save.prototype.popScene; 
-   Scene_Save.prototype.popScene = function () { 
-     Scene_Save_prototype_popScene.call(this); 
-     if ($gameTemp.isGameClear()) { 
-       SceneManager.goto(Scene_Title); 
-     } 
-   } 
-   
-   var Scene_Save_prototype_helpWindowText = Scene_Save.prototype.helpWindowText; 
-   Scene_Save.prototype.helpWindowText = function () { 
-     if ($gameTemp.isGameClear()) { 
-       return '将通关文档存储在哪个文件?'; 
-     } else { 
-       return Scene_Save_prototype_helpWindowText.call(this); 
-     } 
-   }; 
-   
-   var Game_Interpreter_prototype_pluginCommand = Game_Interpreter.prototype.pluginCommand; 
-   Game_Interpreter.prototype.pluginCommand = function (command, args) { 
-     Game_Interpreter_prototype_pluginCommand.call(this, command, args); 
-     if (command === "通关标记") { 
-       var sign = args[1] || '⚝'; 
-       $gameTemp.setGameClear(sign); 
-     } 
-   }; 
-   
- })();