既存のウィンドウクラスには影響を与えず、 作成されたウィンドウオブジェクトのフォントサイズだけを変更したい。
// Scene_Equipをプロトタイプ継承したScene_Hoge function Scene_Hoge() { this.initialize.apply(this, arguments); } Scene_Hoge.prototype = Object.create(Scene_Equip.prototype); Scene_Hoge.prototype.constructor = Scene_Hoge; Scene_Hoge.prototype.initialize = function () { Scene_Equip.prototype.initialize.call(this); }; Scene_Hoge.prototype.initialize = function() { Scene_Equip.prototype.initialize.call(this); } Scene_Hoge.prototype.create = function() { Scene_Equip.prototype.initialize.call(this); } Scene_Hoge.prototype.createCommandWindow = function() { Scene_Equip.prototype.createCommandWindow.call(this); // Scene_EquipのcreateCommandWindowにより、this._commandWindowが利用可能となる // this._commandWindowは、Window_EquipCommand this.removeChild(this._commandWindow); this._commandWindow.contents.clear(); this._commandWindow.standardFontSize = function() { return 16; // 通常はフォントサイズ28 } this._commandWindow.refresh(); this._commandWindow.update(); this._commandWindow.updateCursor(); this.addWindow(this._commandWindow); } Scene_Hoge.prototype.createSlotWindow = function () { Scene_Equip.prototype.createSlotWindow.call(this); // Scene_EquipのcreateSlotWindow により、this._slotWindowが利用可能となる // this._slotWindowは、Window_EquipSlot this.removeChild(this._slotWindow); this._slotWindow.contents.clear(); this._slotWindow.contents.fontSize = 16; this._slotWindow.refresh(); this._slotWindow.update(); this._slotWindow.updateCursor(); this.addWindow(this._slotWindow); }
Window_Commandのプロトタイプ継承するか、Window_Selectableを直で継承するかによって、 フォントサイズの指定が異なっている様子だった。
- Window_EquipCommand -> Window_HorzCommand -> Window_Command
- Window_EquipSlot -> Window_Selectable
理由については後日ソースコードを参照し、記述する予定。