61 lines
1.4 KiB
Lua
61 lines
1.4 KiB
Lua
|
|
------------------------------------------------
|
|
--作者: dhq
|
|
--日期: 2019-05-5
|
|
--文件: SpouseData.lua
|
|
--模块: SpouseData
|
|
--描述: 配偶的数据
|
|
------------------------------------------------
|
|
local SpouseData =
|
|
{
|
|
--角色ID
|
|
PlayerID = 0,
|
|
Name = nil,
|
|
--职业
|
|
Career = nil,
|
|
--境界等级
|
|
StateLv = 0,
|
|
Intimacy = 0,
|
|
--外观数据
|
|
VisInfo = nil,
|
|
}
|
|
|
|
function SpouseData:New()
|
|
local _m = Utils.DeepCopy(self)
|
|
_m:RefeshData(nil)
|
|
return _m
|
|
end
|
|
|
|
function SpouseData:RefeshData(mateInfo)
|
|
if mateInfo ~= nil then
|
|
self.Name = mateInfo.name
|
|
--职业
|
|
self.Career = mateInfo.career
|
|
--境界等级
|
|
self.StateLv = mateInfo.stateLv
|
|
--外观数据
|
|
self.VisInfo = PlayerVisualInfo:New()
|
|
self.VisInfo:ParseByLua(mateInfo.facade, self.StateLv)
|
|
end
|
|
end
|
|
|
|
--离婚之后放空数据
|
|
function SpouseData:ClearData()
|
|
self.PlayerID = nil
|
|
self.Name = nil
|
|
self.Career = nil
|
|
self.StateLv = 0
|
|
self.VisInfo = nil
|
|
end
|
|
|
|
function SpouseData:GetIntimacy()
|
|
if self.PlayerId ~= nil and self.PlayerId > 0 then
|
|
local _friendData = GameCenter.FriendSystem:GetFriendInfo(FriendType.Friend, self.PlayerId)
|
|
if _friendData ~= nil then
|
|
self.Intimacy = _friendData.intimacy
|
|
end
|
|
end
|
|
return self.Intimacy
|
|
end
|
|
|
|
return SpouseData |