43cc5f51
gaofengduan
调整 equip 数据结构
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
local Equip = class("Equip", require("shared.ModelBase"))
Equip.schema = {
type = {"number"}, -- 类型
level = {"number"}, -- 等级
count = {"number", 0}, -- 数量
refer = {"number", 0}, -- 已装备英雄数
}
function Equip:ctor( properties )
Equip.super.ctor(self, properties)
end
function Equip:updateProperty(params)
if not params.field or (not params.delta and not params.value) then
return
end
if params.delta then
self:incrProperty(params.field, params.delta)
elseif params.value then
self:setProperty(params.field, params.value)
end
SendPacket(actionCodes.Role_updateEquip, MsgPack.pack(self:data()))
end
function Equip:data()
return {
type = self:getProperty("type"),
level = self:getProperty("level"),
count = self:getProperty("count"),
}
end
return Equip
|