Activity.lua
1.67 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
local Activity = class("Activity", require("shared.ModelBase"))
Activity.ActivityType = {
DoubleDrop = 1, -- 双倍掉落
}
local function checkActivityType(activityType)
if type(activityType) == "string" then
activityType = Activity.ActivityType[activityType]
end
return activityType
end
function Activity:ctor(properties)
Activity.super.ctor(self, properties)
self._isOpen = {}
end
Activity.schema = {
ctime = {"table", {}}, -- 最近检查某项活动的开始时间 {id = time}
_1 = {"table", {}},
}
function Activity:data()
return {
_1 = self:getProperty("_1"),
}
end
function Activity:updateProperty(params)
local type, default = table.unpack(self.schema[params.field])
if params.delta then
self:incrProperty(params.field, params.delta)
if not params.notNotify then
self.owner:notifyUpdateProperty(params.field, self:getProperty(params.field))
end
return true
end
if params.value then
self:setProperty(params.field, params.value)
if not params.notNotify then
self.owner:notifyUpdateProperty(params.field, self:getProperty(params.field))
end
return true
end
return false
end
function Activity:isOpen(activityType)
activityType = checkActivityType(activityType)
end
-- 跨天刷新 --登录刷新
function Activity:checkActivityStatus(ltime, now, notify)
end
local checkActivityFunc = {}
checkActivityFunc[Activity.ActivityType.DoubleDrop] = function(self, notNotify, activityType, ...)
end
function Activity:checkActivityEnter(notNotify, activityType, ...)
if not activityType then return end
if checkActivityFunc[activityType] then
checkActivityFunc[activityType](self, notNotify, activityType, ...)
end
end
return Activity