PGRData/Script/matrix/xentity/xtheatre/adventure/node/XANode.lua

111 lines
2.6 KiB
Lua
Raw Normal View History

local XANode = XClass(nil, "XANode")
function XANode:Ctor()
self.NodeType = XTheatreConfigs.NodeType.None
self.SlotId = nil
-- 原始数据,用于保存服务器下发的初始事件数据
self.RawData = nil
-- -- TheatreNode
-- self.NodeConfig = nil
end
--[[
//
public int SlotId;
//1234
public int RewardType;
//
public int PowerId;
//TheatreStage表ID
public int TheatreStageId;
//12/boss34
public int SlotType;
//IDID/boss的关卡ID
public int ConfigId;
//
public int Selected;
//ID
public List<int> StageIds = new List<int>();
//ID
public List<int> PassedStageIds = new List<int>();
//
public List<XTheatreNodeShopItem> ShopItems = new List<XTheatreNodeShopItem>();
//ID
public int CurStepId;
]]
function XANode:InitWithServerData(data)
self.RawData = data
self.SlotId = data.SlotId
self.NodeType = data.SlotType
-- self.NodeConfig = XTheatreConfigs.GetTheatreNode(data.SlotId)
end
function XANode:GetIsSelected()
return self.RawData.Selected == 1
end
-- 获取是否已经禁用
function XANode:GetIsDisable()
local isHasNodeSelected = XDataCenter.TheatreManager.GetCurrentAdventureManager():GetCurrentChapter():GetIsHasNodeSelected()
return isHasNodeSelected and not self:GetIsSelected()
end
-- 获取节点类型
function XANode:GetNodeType()
return self.NodeType
end
function XANode:Trigger(callback)
if self:GetIsSelected() then
if callback then callback() end
return
end
-- 触发节点
local currentChapter = XDataCenter.TheatreManager.GetCurrentAdventureManager():GetCurrentChapter()
currentChapter:RequestTriggerNode(self.SlotId, function()
-- 设置已被选择
self.RawData.Selected = 1
if callback then callback() end
end)
end
function XANode:GetNodeTypeIcon()
return XTheatreConfigs.GetNodeTypeIcon(self.NodeType)
end
function XANode:GetNodeTypeDesc()
return XTheatreConfigs.GetNodeTypeDesc(self.NodeType)
end
function XANode:GetNodeTypeName()
return XTheatreConfigs.GetNodeTypeName(self.NodeType)
end
function XANode:GetShowDatas()
return {}
end
function XANode:GetIsBattle()
return false
end
function XANode:GetBgAsset()
end
function XANode:GetIsTriggerWithDirect()
return false
end
return XANode