ページ 11

【解決済み】ショップの売買ウインドウのX軸をプラグインで変更したい

Posted: 2025年1月01日(水) 11:52
by 東 蒼汰
画像の赤く囲まれているウインドウを、赤い矢印の方向にプラグインで移動出来る様にしたい。


問題点:
このウインドウはX軸が固定されているので、それを動く様にしたいがそれが出来ていない。

やってみた事:
コアスプリクトを弄ってみた。

コード: 全て選択

Scene_Shop.prototype.createCommandWindow = function() {
const rect = this.commandWindowRect();
this._commandWindow = new Window_ShopCommand(rect);
this._commandWindow.setPurchaseOnly(this._purchaseOnly);
this._commandWindow.y = this.mainAreaTop();
this._commandWindow.setHandler("buy", this.commandBuy.bind(this));
this._commandWindow.setHandler("sell", this.commandSell.bind(this));
this._commandWindow.setHandler("cancel", this.popScene.bind(this));
this.addWindow(this._commandWindow);
};

Scene_Shop.prototype.commandWindowRect = function() {
const wx = 0;
const wy = this.mainAreaTop();
const ww = this._goldWindow.x;
const wh = this.calcWindowHeight(1, true);
return new Rectangle(wx, wy, ww, wh);
};
の部分を

コード: 全て選択

Scene_Shop.prototype.createCommandWindow = function() {
const rect = this.commandWindowRect();
this._commandWindow = new Window_ShopCommand(rect);
this._commandWindow.setPurchaseOnly(this._purchaseOnly);
this._commandWindow.y = 0;
this._commandWindow.setHandler("buy", this.commandBuy.bind(this));
this._commandWindow.setHandler("sell", this.commandSell.bind(this));
this._commandWindow.setHandler("cancel", this.popScene.bind(this));
this.addWindow(this._commandWindow);
};

Scene_Shop.prototype.commandWindowRect = function() {
const wx = 0;
const wy = 0;
const ww = this._goldWindow.x;
const wh = this.calcWindowHeight(1, true);
return new Rectangle(wx, wy, ww, wh);
};
に変更したらウインドウの位置が変化しました。
それを踏まえて下記のプラグインを書きました。

コード: 全て選択

Scene_Shop.prototype.createCommandWindow = function() {
const rect = this.commandWindowRect();
this._commandWindow = new Window_ShopCommand(rect);
this._commandWindow.setPurchaseOnly(this._purchaseOnly);
this._commandWindow.y = parameters['Kategoriitiy'];
this._commandWindow.setHandler("buy", this.commandBuy.bind(this));
this._commandWindow.setHandler("sell", this.commandSell.bind(this));
this._commandWindow.setHandler("cancel", this.popScene.bind(this));
this.addWindow(this._commandWindow);
};

Scene_Shop.prototype.commandWindowRect = function() {

const wx = parameters['Kategoriitix'];
const wy = 0;
const ww = parameters['Kategoriyoko'];
const wh = parameters['Kategoritate'];
return new Rectangle(wx, wy, ww, wh);
};
しかしこれでウインドウのY軸以外は変更出来たモノの、Y軸は動きませんでした。
何が問題なのか私には分かりませんので、どなたかウインドウのY軸の動かし方を御教え頂けませんか。

Re: ショップの売買ウインドウのX軸をプラグインで変更したい

Posted: 2025年1月02日(木) 21:05
by youtu
他のプラグインとの競合やパラメータの処理に不備があるのではないでしょうか?
例えば、下記のようなコードでも、y座標は正常に変更されました。

コード: 全て選択

Scene_Shop.prototype.createCommandWindow = function() {
    const rect = this.commandWindowRect();
    this._commandWindow = new Window_ShopCommand(rect);
    this._commandWindow.setPurchaseOnly(this._purchaseOnly);
    this._commandWindow.y = 500  //this.mainAreaTop();
    this._commandWindow.setHandler("buy", this.commandBuy.bind(this));
    this._commandWindow.setHandler("sell", this.commandSell.bind(this));
    this._commandWindow.setHandler("cancel", this.popScene.bind(this));
    this.addWindow(this._commandWindow);
};

Scene_Shop.prototype.commandWindowRect = function() {
    const wx = 0;
    const wy = 0  //this.mainAreaTop();
    const ww = this._goldWindow.x;
    const wh = this.calcWindowHeight(1, true);
    return new Rectangle(wx, wy, ww, wh);
};