createCategoryWindow 要进入itemWindow 是什么原理应该先搞清楚。 也就是在createCategoryWindow 上点击一下进入的 this._categoryWindow.setHandler('ok', this.onCategoryOk.bind(this)); 也就是这一条 当按下OK就执行this.onCategoryOk 所以我们找一下onCategoryOk 找到的是 Scene_Item.prototype.onCategoryOk = function() { this._itemWindow.activate(); this._itemWindow.selectLast(); }; 也就是itemWindow变成可操作 但是这样还看不到itemWindow显示的变化。 所以,我们再来看看itemWindow是怎么样的 this._itemWindow = new Window_ItemList(0, wy, Graphics.boxWidth, wh); itemWindow是Window_ItemList的新建 我们就去Window_ItemList看看是怎么写的 我们看到,这里是设定,类型的,也就是你选择道具,装备,重要道具,那个类型 Window_ItemList.prototype.setCategory = function(category) { if (this._category !== category) { this._category = category; this.refresh(); this.resetScroll(); } }; //然后我们还看到,这里是判断这个道具是哪个类型的 Window_ItemList.prototype.includes = function(item) { switch (this._category) { //类型选择是道具 case 'item': //判断ITEM是道具,道具类型是1 return DataManager.isItem(item) && item.itypeId === 1; //类型选择是武器 case 'weapon': //判断ITEM是武器 return DataManager.isWeapon(item); //类型选择是防具 case 'armor': //判断ITEM是防具 return DataManager.isArmor(item); //类型选择是重要道具 case 'keyItem': //判断ITEM是道具,道具类型是2 return DataManager.isItem(item) && item.itypeId === 2; //没有选择时 default: return false; } }; |
站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作
GMT+8, 2024-5-20 18:56
Powered by Discuz! X3.1
© 2001-2013 Comsenz Inc.