123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- -- 资源配置
- local baseAdapt = require "base.baseAdapt"
- local root = {}
- -- 获取指定id的资源配置
- function root:get_init_conf()
- return baseAdapt:getConfig("ResInitConfig")
- end
- -- 获取物品配置
- function root:get_item_conf_list()
- return baseAdapt:getConfig("ResItemConfig") or {}
- end
- -- 获取指定id的资源配置
- function root:get_item_conf(id)
- if not id then
- return nil
- end
- return baseAdapt:getOneConfig("ResItemConfig", id)
- end
- -- 获取物品名称
- function root:get_item_name(id)
- local item = self:get_item_conf(id)
- return item and item.name
- end
- -- 获取物品类型
- function root:get_item_type(id)
- local item = self:get_item_conf(id)
- return item and item.type
- end
- -- 判断是否是某个类型的资源id
- function root:is_type(id, resType)
- return self:get_item_type(id) == resType
- end
- -- 获取道具价值
- function root:get_item_price(id)
- local item = self:get_item_conf(id)
- return item and item.price
- end
- return root
|