猫史档案馆


【教程】背包框架

用户:145a145a查看:6 回复:3 评论:6 创建时间:2022-08-07T11:33:07


此代码只有核心函数及算法,没有右键展示等功能

Object.assign(Box3Entity.prototype,{items:[],pos(b){for(let a of this.items)if(a.slice(0,a.search(/ /))==b)return this.items.indexOf(a)},have(b=""){for(let a of this.items)if(a.slice(0,a.search(/ /))==b)return a.slice(a.search(/×/)+2)},add(a="",b=0){this.have(a)?this.have(a)>0||b> -1?this.items[this.pos(a)]=`${a} \xd7 ${parseInt(this.have(a))+b}`:this.items.splice(this.pos(a),this.pos(a)+1):this.items.unshift(a+` \xd7 ${b}`)},async textDialog(a,b){return dialog=await this.player.dialog({type:"text",title:a,content:b,hasArrow:!0})},async selectDialog(a,b,c){return dialog=await this.player.dialog({type:"select",title:a,content:b,options:c})}})


回复

上一页1 页 / 共 1下一页
蓝矮爱乐蓝矮爱乐

手动格式化后

Object.assign(Box3Entity.prototype,{
    items:[],
    pos(b){
        for(let a of this.items)
            if(a.slice(0,a.search(/ /))==b)return this.items.indexOf(a)
    },
    have(b=""){
        for(let a of this.items)
            if(a.slice(0,a.search(/ /))==b)return a.slice(a.search(/×/)+2)},
    a喵(a="",b=0){
        this.have(a)?
            this.have(a)>0||b> -1?
                this.items[this.pos(a)]=`${a} \xd7 ${parseInt(this.have(a))+b}`
            :
                this.items.splice(this.pos(a),this.pos(a)+1)
        :
            this.items.unshift(a+` \xd7 ${b}`)},
    async textDialog(a,b){
        return dialog=await this.player.dialog({
            type:"text",
            title:a,
            content:b,
            hasArrow:!0
        })
    },
    async selectDialog(a,b,c){
        return dialog=await this.player.dialog({
            type:"select",
            title:a,
            content:b,
            options:c
        })
    }
})

点赞0


评论


取个名字太难了1取个名字太难了1

历遍………………………………………………………………………………………………………………………………………………………………………………

点赞0


评论


DDguanDDguan

不是大哥,你开源一个东西,还是个需要《修改》的东西,你**给他加密,我们怎么修改啊,脑子动一动好不好,开源就大大方方,加密有个 p 用,要加密就别发布,没人要一个看也看不懂的代码

点赞2


评论