Activity.lua 1.67 KB
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