设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索

如何跳過CategoryWindow選擇視窗,直接在itemWindow繪製道具

查看数: 2365 | 评论数: 1 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2019-2-4 00:58

正文摘要:

本帖最后由 xcv15963 于 2019-2-5 17:53 编辑 Scene_Mixing.prototype.createItemWindow = function() {     this._itemWindow = new Window_ItemList(0, 0, 400, 400);     this._itemWindo ...

回复

yang1zhi 发表于 2019-2-4 16:38:04
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;
    }
};

点评

有了!! 我改了你說的那一行, this._itemWindow.setCategory('item'); 放入之後就有了。 非常感謝您!!  发表于 2019-2-5 17:45
不存在这一行的function是定义函数的。this.currentSymbol()是当前选项的Handled名,也就是addCommand括号里的第2个位置写的  发表于 2019-2-5 01:33
請問function this.currentSymbol(); 那是什麼意思?  发表于 2019-2-4 23:28
這行我就看不懂了 QQ  发表于 2019-2-4 23:27
你先要给this._itemWindow.setCategory(this.currentSymbol());设定_category  发表于 2019-2-4 22:42
拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-20 18:56

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表