源战役客户端
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 

84 wiersze
2.2 KiB

InstructionView = InstructionView or BaseClass(BaseView)
function InstructionView:__init()
self.base_file = "common"
self.layout_file = "instructionView"
self.layer_name = "Top"
self.use_background = true
self.click_bg_toClose = true
self.is_set_zdepth = true
self:AddPreLoadList("common",{"instructionItem"})
self.item_list = {}
self.load_callback = function()
self:LoadSuccess()
self:AddEvents()
self:SetData()
end
self.close_callback = function ()
self:Clear()
end
end
function InstructionView:Clear()
for i,item in ipairs(self.item_list) do
item:DeleteMe()
end
self.item_list = {}
end
function InstructionView:LoadSuccess()
self.nodes = {
"ScrollView/Viewport/Content","Window/windowCloseBtn:obj","Window:raw:obj", "Window/windowTitleText:tmp",
}
self:GetChildren(self.nodes)
local function call_bace( )
if self.Window_obj then
self.Window_obj:SetActive(true)
end
end
lua_resM:setOutsideRawImage(self, self.Window_raw, GameResPath.GetViewBigBg("tips_comm_bg6"), false, call_bace)
end
function InstructionView:AddEvents( )
local function call_back( target )
if target == self.windowCloseBtn_obj then
self:Close()
end
end
AddClickEvent(self.windowCloseBtn_obj,call_back,false)
end
function InstructionView:Open(index,extra_info)
self.index = index
self.extra_info = extra_info
BaseView.Open(self)
end
function InstructionView:SetData()
local cfg = false
if self.extra_info then
cfg = self.extra_info
else
cfg = DeepCopy(Config.ConfigInstruction[self.index])
end
if cfg then
cfg.ViewTitle = ChuanWenManager:getInstance():FormatColorTag(cfg.ViewTitle)
for k,v in pairs(cfg.info_list) do
v.itemTitle = ChuanWenManager:getInstance():FormatColorTag(v.itemTitle)
v.content = ChuanWenManager:getInstance():FormatColorTag(v.content)
end
self.windowTitleText_tmp.text = cfg.ViewTitle or "功能说明"
local height = 10
if cfg.info_list then
local item = nil
for i,vo in ipairs(cfg.info_list) do
item = InstructionItem.New(self.Content)
table.insert(self.item_list,item)
item:SetData(vo)
item:SetAnchoredPosition(0,-height)
height = height + item:GetHeight()
end
end
self.Content.sizeDelta = Vector2(774,height)
self.Content.localPosition = Vector3.zero
end
end