PGRData/Script/matrix/xmodule/xtheatre3/xentity/XTheatre3Character.lua
2024-09-01 22:49:41 +02:00

55 lines
No EOL
1.3 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---@class XTheatre3Character
local XTheatre3Character = XClass(nil, "XTheatre3Character")
function XTheatre3Character:Ctor()
---角色
self.CharacterId = 0
---当前等级
self.Level = 0
---当前经验结算时要加上ExpTemp
self.Exp = 0
---临时经验,结算再通过此字段计算等级和经验
self.ExpTemp = 0
---已达成结局ID, 引自CharacterEnding表Id
self.EndingIds = {}
end
--region DataUpdate
function XTheatre3Character:UpdateEndingIds(data)
self.EndingIds = { }
if XTool.IsTableEmpty(data) then
return
end
for _, endingId in ipairs(data) do
self.EndingIds[endingId] = true
end
end
function XTheatre3Character:SetLevel(level)
self.Level = level
end
function XTheatre3Character:SetExp(exp)
self.Exp = exp
end
function XTheatre3Character:SetExpTemp(expTemp)
self.ExpTemp = expTemp
end
--endregion
--region Checker
function XTheatre3Character:CheckEnding(endingId)
return self.EndingIds[endingId]
end
--endregion
function XTheatre3Character:NotifyTheatre3Character(data)
self.CharacterId = data.CharacterId
self.Level = data.Level
self.Exp = data.Exp
self.ExpTemp = data.ExpTemp
self:UpdateEndingIds(data.EndingIds)
end
return XTheatre3Character