be9c9ca6
zhouahaihai
角色评论
|
1
2
3
4
5
|
-- 日常数据
local Daily = class("Daily", require("shared.ModelBase"))
function Daily:ctor(properties)
|
a43410e1
zhengshouren
整理格式,使用tab替代空格
|
6
|
Daily.super.ctor(self, properties)
|
be9c9ca6
zhouahaihai
角色评论
|
7
8
9
|
end
Daily.schema = {
|
87cc3a35
zhengshouren
餐厅建筑升级逻辑
|
10
11
12
|
commentHero = {"string", ""}, -- 单日评论食灵记录 type=1
hangQC = {"number", 0}, -- 挂机快速次数
dinerQC = {"number", 0}, -- 贩卖加速次数
|
09be9059
zhouhaihai
冒险接口
|
13
14
|
advC = {"number", 0}, -- 冒险次数(消耗体力)
advBC = {"number", 0}, -- 冒险次数购买次数(冒险体力购买次数)
|
bab30666
zhouhaihai
增加通用功能等级 字段
|
15
|
advWs = {"table", {}}, -- 冒险队工坊
|
be9c9ca6
zhouahaihai
角色评论
|
16
17
|
}
|
be9c9ca6
zhouahaihai
角色评论
|
18
|
function Daily:updateProperty(params)
|
a43410e1
zhengshouren
整理格式,使用tab替代空格
|
19
20
21
|
local type, default = table.unpack(self.schema[params.field])
if params.delta then
|
4faef572
zhouhaihai
冒险任务,冒险扫荡, 冒险中继
|
22
|
self:incrProperty(params.field, params.delta)
|
a43410e1
zhengshouren
整理格式,使用tab替代空格
|
23
24
25
26
27
28
29
30
31
|
self.owner:notifyUpdateProperty(params.field, self:getProperty(params.field))
return true
end
if params.value then
self:setProperty(params.field, params.value)
self.owner:notifyUpdateProperty(params.field, self:getProperty(params.field))
return true
end
return false
|
be9c9ca6
zhouahaihai
角色评论
|
32
33
34
|
end
function Daily:refreshDailyData(notify)
|
a43410e1
zhengshouren
整理格式,使用tab替代空格
|
35
36
37
38
39
40
41
42
43
|
for field, schema in pairs(self.schema) do
if field ~= "key" then
local typ, def = table.unpack(schema)
self:setProperty(field, def)
end
end
if notify then
self.owner:notifyUpdateProperties(self:data())
end
|
be9c9ca6
zhouahaihai
角色评论
|
44
45
46
|
end
function Daily:data()
|
a43410e1
zhengshouren
整理格式,使用tab替代空格
|
47
|
return {
|
a43410e1
zhengshouren
整理格式,使用tab替代空格
|
48
|
hangQC = self:getProperty("hangQC"),
|
87cc3a35
zhengshouren
餐厅建筑升级逻辑
|
49
|
dinerQC = self:getProperty("dinerQC"),
|
09be9059
zhouhaihai
冒险接口
|
50
51
|
advC = self:getProperty("advC"),
advBC = self:getProperty("advBC"),
|
bab30666
zhouhaihai
增加通用功能等级 字段
|
52
|
advWs = self:getProperty("advWs"),
|
a43410e1
zhengshouren
整理格式,使用tab替代空格
|
53
|
}
|
be9c9ca6
zhouahaihai
角色评论
|
54
55
56
|
end
return Daily
|