Blame view

src/models/Activity.lua 1.67 KB
e51ff6d2   zhouhaihai   冒险~
1
  local Activity = class("Activity", require("shared.ModelBase"))
be83d162   zhouahaihai   登陆成功。 增加数据结构修正功能
2
3
  
  
e51ff6d2   zhouhaihai   冒险~
4
  Activity.ActivityType = {
9a1c54b2   zhouhaihai   活动
5
  	DoubleDrop = 1,  -- 双倍掉落
e51ff6d2   zhouhaihai   冒险~
6
  }
be83d162   zhouahaihai   登陆成功。 增加数据结构修正功能
7
  
9a1c54b2   zhouhaihai   活动
8
  
e51ff6d2   zhouhaihai   冒险~
9
10
11
12
13
14
15
16
17
18
19
  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)
  
9a1c54b2   zhouhaihai   活动
20
  	self._isOpen = {}
e51ff6d2   zhouhaihai   冒险~
21
  end
be83d162   zhouahaihai   登陆成功。 增加数据结构修正功能
22
23
  
  
e51ff6d2   zhouhaihai   冒险~
24
  Activity.schema = {
9a1c54b2   zhouhaihai   活动
25
  	ctime 	= {"table", {}}, -- 最近检查某项活动的开始时间  {id = time}
e51ff6d2   zhouhaihai   冒险~
26
27
  	_1		= {"table", {}},
  }
be83d162   zhouahaihai   登陆成功。 增加数据结构修正功能
28
  
e51ff6d2   zhouhaihai   冒险~
29
30
31
32
  function Activity:data()
  	return {
  		_1 = self:getProperty("_1"),
  	}
be83d162   zhouahaihai   登陆成功。 增加数据结构修正功能
33
34
  end
  
e51ff6d2   zhouhaihai   冒险~
35
  
9a1c54b2   zhouhaihai   活动
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
  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
  
e51ff6d2   zhouhaihai   冒险~
80
81
  
  return Activity