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

返信する
東 蒼汰
記事: 5
登録日時: 2024年12月24日(火) 22:05

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

投稿記事 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軸の動かし方を御教え頂けませんか。
添付ファイル
bandicam 2025-01-01 10-52-43-082.jpg
最後に編集したユーザー 東 蒼汰 [ 2025年1月12日(日) 15:01 ], 累計 1 回
youtu
記事: 14
登録日時: 2023年7月20日(木) 16:25

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

投稿記事 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);
};
返信する

“MZ:質問”に戻る