66 lines
1.8 KiB
Lua
66 lines
1.8 KiB
Lua
|
|
------------------------------------------------
|
|
--作者: _SqL_
|
|
--日期: 2019-08-13
|
|
--文件: GuardianFactionSystem.lua
|
|
--模块: GuardianFactionSystem
|
|
--描述: 宗派守护系统
|
|
------------------------------------------------
|
|
|
|
local GuardianFactionSystem = {
|
|
-- 城主血量
|
|
CityOwnerBlood = 1,
|
|
-- 左护法血量
|
|
LeftBlood = 1,
|
|
-- 右护法血量
|
|
RigthBlood = 1,
|
|
-- 怪物总波数
|
|
MaxValue = 0,
|
|
-- 怪物已耍次数
|
|
Progress = 0,
|
|
-- 我的排名
|
|
MyRank = 0,
|
|
-- 我的伤害
|
|
MyHarm = 0,
|
|
-- 伤害排名list
|
|
HarmRank = List:New(),
|
|
}
|
|
|
|
function GuardianFactionSystem:Initialize()
|
|
end
|
|
|
|
function GuardianFactionSystem:UnInitialize()
|
|
self.HarmRank:Clear()
|
|
end
|
|
|
|
-- 刷新伤害排行榜
|
|
function GuardianFactionSystem:RefreshHarmRank(rank)
|
|
self.HarmRank:Clear()
|
|
self.HarmRank = List:New(rank)
|
|
table.sort(self.HarmRank, function(a, b)
|
|
return a.top < b.top
|
|
end)
|
|
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_GUARDIANFACTION_REFRESH)
|
|
end
|
|
|
|
-- Server -> Client 服务器同步数据
|
|
function GuardianFactionSystem:GS2U_ResGuardianData(msg)
|
|
if msg then
|
|
self.Progress = msg.progress
|
|
self.MaxValue = msg.general
|
|
if msg.bloods then
|
|
for i = 1, #msg.bloods do
|
|
if msg.bloods[i].modelId == 1 then
|
|
self.CityOwnerBlood = msg.bloods[i].blood
|
|
elseif msg.bloods[i].modelId == 2 then
|
|
self.LeftBlood = msg.bloods[i].blood
|
|
elseif msg.bloods[i].modelId == 2 then
|
|
self.RigthBlood = msg.bloods[i].blood
|
|
end
|
|
end
|
|
end
|
|
GameCenter.PushFixEvent(LogicLuaEventDefine.EID_EVENT_GUARDIANFACTION_REFRESH)
|
|
end
|
|
end
|
|
|
|
return GuardianFactionSystem |