var ougitou1 = ougitou1 || {};(function(){ ougitou1.TEST = { Test_Window : function(){this.initialize.apply(this, arguments);}, Test_Scene : function(){this.initialize.apply(this, arguments);}, };})();(function($){ ($.prototype = Object.create(Window_Command.prototype)).constructor = $; $.prototype.initialize = function(x, y) { var width = this.windowWidth(); var height = this.windowHeight(); this._dynamicList = []; Window_Command.prototype.initialize.call(this, x, y, width, height); }; $.prototype.windowWidth = function(){ return 300; }; $.prototype.windowHeight = function(){ return 300; }; $.prototype.makeCommandList = function() { this.addMainCommands(); this.combineCommands(); }; $.prototype.addMainCommands = function(){ var enabled = true; this.addCommand('Command 1', 'c1', enabled); }; $.prototype.combineCommands = function(){ this._list = this._list.concat(this._dynamicList); }; $.prototype.addDynamicCommands = function(name, symbol, enabled, ext) { if (enabled === undefined) { enabled = true; } if (ext === undefined) { ext = null; } this._dynamicList.push({ name: name, symbol: symbol, enabled: enabled, ext: ext}); this.refresh(); };})(ougitou1.TEST.Test_Window);(function($){ ($.prototype = Object.create(Scene_MenuBase.prototype)).constructor = $; $.prototype.initialize = function() { Scene_MenuBase.prototype.initialize.call(this); }; $.prototype.create = function() { Scene_MenuBase.prototype.create.call(this); this.createWindow(); }; $.prototype.createWindow = function() { this._testWindow = new ougitou1.TEST.Test_Window(0,0); this._testWindow.setHandler('c1', this.onPressOk.bind(this)); this.addWindow(this._testWindow); }; $.prototype.addDynamicCommands = function(name, symbol, enabled, ext){ this._testWindow.addDynamicCommands(name, symbol, enabled, ext) this._testWindow.setHandler(symbol, this.onPressOk.bind(this)); }; $.prototype.onPressOk = function(){ var index = this._testWindow._index; console.log("You pressed " + this._testWindow._list[index].name) this._testWindow.activate(); }; })(ougitou1.TEST.Test_Scene);