ページ 11

【解決済】addWindowしてもコマンドウインドウが表示されない

Posted: 2017年9月27日(水) 17:00
by よしだとものり
itembook2のSceneのcreateを改造して
commadWidowを表示するようにaddWindowしてみましたが
出ませんでした。
何か間違っているのでしょうか?

コード: 全て選択

   Scene_ItemBook2.prototype.create = function() {
        Scene_MenuBase.prototype.create.call(this);
			var gw=0;
			this._goldWindow = new Window_Gold();
			
			//this._goldWindow.move(Graphics.boxWidth - this._goldWindow.width, 0, this._goldWindow.width, this._goldWindow.height);
			gw = this._goldWindow.width;
			this.addWindow(this._goldWindow);

		var cy=this._goldWindow.height;
    	this._commandWindow = new Window_BZ_Command(0,cy);
    	this._commandWindow.y = 0;
    	this._commandWindow.setHandler('gup',    this.gup.bind(this));
    	this._commandWindow.setHandler('gdown',   this.gdown.bind(this));
    	this._commandWindow.setHandler('uplist', this.uplist.bind(this));
    	this._commandWindow.setHandler('mylist',   this.mylist.bind(this));
    	this._commandWindow.setHandler('exec1', this.exec1.bind(this));
    	this.addWindow(this._commandWindow);


        this._indexWindow = new Window_ItemBook2Index(0, 0);
        this._indexWindow.setHandler('cancel', this.popScene.bind(this));
        var wy = this._indexWindow.height;
        var ww = Graphics.boxWidth;
        var wh = Graphics.boxHeight - wy;
        //this._statusWindow = new Window_ItemBook2Status(0, wy, ww, wh);
			this._indexWindow.move(0,this._goldWindow.height*2,
			this._indexWindow.width,this._indexWindow.height);
        this.addWindow(this._indexWindow);
        //this.addWindow(this._statusWindow);
        //this._indexWindow.setStatusWindow(this._statusWindow);




    };

Re: addWindowしてもコマンドウインドウが表示されない

Posted: 2017年9月27日(水) 17:04
by しぐれん
以下のパターンが考えられます。
window.show()を呼び出していないので非表示になっている。
他のウィンドウよりも下になって隠れている。
window.close()がどこかで呼ばれており、window.open()を呼び出す必要がある。

Re: addWindowしてもコマンドウインドウが表示されない

Posted: 2017年9月27日(水) 17:31
by よしだとものり
いつも、ありがとうございます。
showは出してないので、試してみます。

Re: addWindowしてもコマンドウインドウが表示されない

Posted: 2017年9月27日(水) 18:13
by よしだとものり
showだけでは出ませんでした。
どちらも原因だと思いますが
retrun 800と変数から定数に変えると表示されました。

code]

Window_BZ_Command.prototype.windowWidth = function() {
return 800;
};[

[/code]

Re: 【解決済】addWindowしてもコマンドウインドウが表示されない

Posted: 2017年9月27日(水) 19:05
by しぐれん
それなら画面サイズの問題ですので、ブレークポイントを張って数値を監視してみてください。
F11やスタックトレースを見て、呼び出し元を探していけば何とかなるかと。
それと、move以外だとinitializeでサイズを設定しているパターンがあります。