Commit 55c1d2cf16735c7cfbadf79f34fa41fa2d80c265
1 parent
ee999bde
删除无用
Showing
1 changed file
with
0 additions
and
52 deletions
 
Show diff stats
src/models/Equip.lua deleted
| @@ -1,52 +0,0 @@ | @@ -1,52 +0,0 @@ | ||
| 1 | -local Equip = class("Equip", require("shared.ModelBase")) | ||
| 2 | - | ||
| 3 | -Equip.schema = { | ||
| 4 | - type = {"number"}, -- 类型 | ||
| 5 | - level = {"number"}, -- 等级 | ||
| 6 | - count = {"number", 0}, -- 数量 | ||
| 7 | - refer = {"number", 0}, -- 已装备英雄数 | ||
| 8 | -} | ||
| 9 | - | ||
| 10 | -function Equip:ctor( properties ) | ||
| 11 | - Equip.super.ctor(self, properties) | ||
| 12 | -end | ||
| 13 | - | ||
| 14 | -function Equip:notifyUpdateProperty(field, newValue, oldValue) | ||
| 15 | - local datas = { | ||
| 16 | - key = field, | ||
| 17 | - newValue = newValue, | ||
| 18 | - oldValue = oldValue, | ||
| 19 | - } | ||
| 20 | - self:notifyUpdateProperties(datas) | ||
| 21 | -end | ||
| 22 | - | ||
| 23 | -function Equip:notifyUpdateProperties(params) | ||
| 24 | - local updateData = { | ||
| 25 | - type = self:getProperty("type"), | ||
| 26 | - level = self:getProperty("level"), | ||
| 27 | - datas = params | ||
| 28 | - } | ||
| 29 | - SendPacket(actionCodes.Role_updateEquip, MsgPack.pack(updateData)) | ||
| 30 | -end | ||
| 31 | - | ||
| 32 | -function Equip:updateProperty(params) | ||
| 33 | - if not params.field or (not params.delta and not params.value) then | ||
| 34 | - return | ||
| 35 | - end | ||
| 36 | - if params.delta then | ||
| 37 | - self:incrProperty(params.field, params.delta) | ||
| 38 | - elseif params.value then | ||
| 39 | - self:setProperty(params.field, params.value) | ||
| 40 | - end | ||
| 41 | - self:notifyUpdateProperties(self:data()) | ||
| 42 | -end | ||
| 43 | - | ||
| 44 | -function Equip:data() | ||
| 45 | - return { | ||
| 46 | - type = self:getProperty("type"), | ||
| 47 | - level = self:getProperty("level"), | ||
| 48 | - count = self:getProperty("count"), | ||
| 49 | - } | ||
| 50 | -end | ||
| 51 | - | ||
| 52 | -return Equip | ||
| 53 | \ No newline at end of file | 0 | \ No newline at end of file |