切換
舊版
前往
大廳
主題

RM MV學習筆記(24) 呼叫一個新的道具視窗,並只顯示某些物品

路漫行 | 2018-04-24 09:41:22 | 巴幣 2 | 人氣 280


呼叫一個新的道具視窗,並只顯示某些物品,主要用在使用道具時候,按下使用後跳出一個小視窗,內只有可用的道具。


在上篇中,我們用的是內定的Window_Itemlist與Window_Category,現在我們要來建立自己的itemlist,不依靠Window_Category來顯示道具。


目前展示用的是我自寫的調合介面名稱叫做IR_Scene_Synthesis
在new window時候,新增下兩行:

IR_Scene_Synthesis.prototype.createItemWindow = function() {
var x = 0;
var y = 120;
var w = 400 ;
var h = Graphics.boxHeight - y;
this._itemWindow = new Window_SysItemList(x, y, w, h);
this._itemWindow.setHandler('ok',     this.onItemOk.bind(this));
this._itemWindow.setHandler('cancel', this.popScene.bind(this));
this._itemWindow.activate();   //啟動itemWindow,不然不會動
this._itemWindow.setCategory('item');  //字串可自行設定
this.addWindow(this._itemWindow);
};

字串內的文字可配合上一篇的道具過濾使用

而原本的
this._categoryWindow.setItemWindow(this._itemWindow);
這一行則可以刪掉

這樣配合上一篇的道具顯示過濾,就可以new一個專門顯示某些道具的小視窗了。


------

有了這個以後,就可以做得更像鍊金術士了...

比如說調合放入A類型材料+B類型材料

可以過濾出所有的A類型材料再計算品質屬性什麼的...

不過...呃,難道我要重寫整個調合系統不成....|||||


送禮物贊助創作者 !
0
留言

創作回應

更多創作