【解決】コンフィグに新しい項目を+したい
●やりたい事: コンフィグで数値を変えると、読み込むWindow画像が変るシステムを作ってみたい。 その前段階として、コンフィグ画面で変数を変更出来る項目を作る。 ●やってみた事: rmmz_windowsで以下の部分を変更してみました。 Window_Options.prototype.addVolumeOptions = function() { this.addCommand(TextManager.bgmVolume, "bgmVolume"); this.addCommand(TextManager.bgsVolume, "bgsVolume")...
forum.tkool.jp
の続きと成っています。
簡単に説明すると、此方の動画の様な機能を自分でオプションに追加してみたいと思っています。
やってみた事:
上記動画のプラグインを覗いてみても、スキンを変更してウインドウを再描写している方法が分からなかった。
知りたい事:
オプションウインドウの再描画方法。
出来ている事:
DarkPlasmaさんにスキンを変更する項目の作り方を教えて頂いたので、項目自体は完成済みです。
JavaScript:
const WCNS = "WCN";
ConfigManager.WCN = 0;
//此処のスキン変更は、メニュー画面に戻ってスキンが変更されているか確認の為に入れています//
Window_Base.prototype.loadWindowskin = function() {
if (ConfigManager.WCN === 0) {
this.windowskin = ImageManager.loadSystem("Window");
}
if (ConfigManager.WCN === 1) {
this.windowskin = ImageManager.loadSystem("Window2");
}
if (ConfigManager.WCN === 2) {
this.windowskin = ImageManager.loadSystem("Window3");
}
if (ConfigManager.WCN === 3) {
this.windowskin = ImageManager.loadSystem("Window4");
}
if (ConfigManager.WCN === 4) {
this.windowskin = ImageManager.loadSystem("Window5");
}
};
function WCN(sceneOptions) {
const MC = sceneOptions.maxCommands;
sceneOptions.maxCommands = function () {
return MC.call(this) + 1;
};
}
WCN(Scene_Options.prototype);
function WOWCN(windowOptions) {
const MCL = windowOptions.makeCommandList;
windowOptions.makeCommandList = function () {
MCL.call(this);
this.addChangeGraphicOption();
};
windowOptions.addChangeGraphicOption = function () {
this.addCommand("画像の変更", WCNS);
};
const ST = windowOptions.statusText;
windowOptions.statusText = function (index) {
const symbol = this.commandSymbol(index);
if (this.SymbolSame(symbol)) {
return this.NST(this.getConfigValue(symbol));
}
return ST.call(this, index);
};
windowOptions.SymbolSame = function (symbol) {
return symbol === WCNS;
};
windowOptions.NST = function (value) {
if (ConfigManager.WCN === 0) {
return `${value} : デフォルト` ;
}
if (ConfigManager.WCN === 1) {
return `${value} : ウディタ` ;
}
if (ConfigManager.WCN === 2) {
return `${value} : FF` ;
}
if (ConfigManager.WCN === 3) {
return `${value} : DQ` ;
}
if (ConfigManager.WCN === 4) {
return `${value} : オリジナル` ;
}
};
windowOptions.maxValue = function (symbol) {
return 4;
};
windowOptions.addValue = function (symbol, amount) {
this.changeValue(symbol,(this.getConfigValue(symbol) + amount + this.maxValue() + 1) % (this.maxValue(symbol) + 1));
};
const _processOk = windowOptions.processOk;
windowOptions.processOk = function () {
const symbol = this.currentSymbol();
if (this.SymbolSame(symbol)) {
this.addValue(symbol, 1);
} else {
_processOk.call(this);
}
};
const cursorRight = windowOptions.cursorRight;
windowOptions.cursorRight = function () {
const symbol = this.currentSymbol();
if (this.SymbolSame(symbol)) {
this.addValue(symbol, 1);
} else {
cursorRight.call(this);
}
};
const cursorLeft = windowOptions.cursorLeft;
windowOptions.cursorLeft = function () {
const symbol = this.currentSymbol();
if (this.SymbolSame(symbol)) {
this.addValue(symbol, 1 * -1) ;
} else {
cursorLeft.call(this);
}
};
}
WOWCN(Window_Options.prototype);
})();