PGRData/Resources/Scripts/XHome/XDorm/XHomeChar/XHomeCharNode/XHomeCharCheckEventExistNode.lua
2022-12-26 14:06:01 +05:30

26 lines
No EOL
716 B
Lua

local XHomeCharCheckEventExistNode = XLuaBehaviorManager.RegisterNode(XLuaBehaviorNode, "HomeCharCheckEventExist", CsBehaviorNodeType.Condition, true, false)
function XHomeCharCheckEventExistNode:OnAwake()
if self.Fields == nil then
self.Node.Status = CsNodeStatus.ERROR
return
end
if self.Fields["EventId"] == nil then
self.Node.Status = CsNodeStatus.ERROR
return
end
self.EventId = self.Fields["EventId"]
end
function XHomeCharCheckEventExistNode:OnEnter()
local result = self.AgentProxy:CheckEventExist(self.EventId)
if result then
self.Node.Status = CsNodeStatus.SUCCESS
else
self.Node.Status = CsNodeStatus.FAILED
end
end