57 lines
2.0 KiB
Lua
57 lines
2.0 KiB
Lua
------------------------------------------------
|
||
--作者: yangqf
|
||
--日期: 2019-05-06
|
||
--文件: PlayerShiHaiSystem.lua
|
||
--模块: PlayerShiHaiSystem
|
||
--描述: 玩家识海系统
|
||
------------------------------------------------
|
||
|
||
local RedPointItemCondition = CS.Thousandto.Code.Logic.RedPointItemCondition
|
||
local RedPointCustomCondition = CS.Thousandto.Code.Logic.RedPointCustomCondition
|
||
|
||
local PlayerShiHaiSystem = {
|
||
--当前等级
|
||
CurCfgID = 0,
|
||
}
|
||
|
||
function PlayerShiHaiSystem:ResShiHaiData(msg)
|
||
self.CurCfgID = msg.cfgId
|
||
self:RefreshRedPointData()
|
||
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_REFRESH_PLAYER_SHIHAI)
|
||
end
|
||
|
||
function PlayerShiHaiSystem:RefreshRedPointData()
|
||
local _curCfg = DataConfig.DataPlayerShiHai[self.CurCfgID]
|
||
if _curCfg == nil then
|
||
return
|
||
end
|
||
--清除掉所有条件
|
||
GameCenter.RedPointSystem:CleraFuncCondition(FunctionStartIdCode.PlayerJingJie)
|
||
--如果需求的万妖卷等级为0,表示满级
|
||
if _curCfg.NeedCopyLevel ~= 0 then
|
||
local _conditions = List:New()
|
||
--物品条件
|
||
if string.len(_curCfg.NeedItem) > 0 then
|
||
local _curItem = Utils.SplitStrByTableS(_curCfg.NeedItem)
|
||
for i = 1, #_curItem do
|
||
_conditions:Add(RedPointItemCondition(_curItem[i][1], _curItem[i][2]))
|
||
end
|
||
end
|
||
local _towerData = GameCenter.CopyMapSystem:FindCopyDataByType(CopyMapTypeEnum.TowerCopy)
|
||
if _towerData ~= nil then
|
||
_conditions:Add(RedPointCustomCondition(_curCfg.NeedCopyLevel < _towerData.CurLevel))
|
||
end
|
||
--调用lua专用条件接口
|
||
GameCenter.RedPointSystem:LuaAddFuncCondition(FunctionStartIdCode.PlayerJingJie, 0, _conditions)
|
||
end
|
||
end
|
||
|
||
function PlayerShiHaiSystem:ReqShiHaiData()
|
||
GameCenter.Network.Send("MSG_ShiHai.ReqShiHaiData", {})
|
||
end
|
||
|
||
function PlayerShiHaiSystem:ReqLevelUP()
|
||
GameCenter.Network.Send("MSG_ShiHai.ReqUpLevel", {})
|
||
end
|
||
|
||
return PlayerShiHaiSystem |