miduo_client/Assets/ManagedResources/~Lua/Modules/Battle/Test/View/AllSetView.lua

50 lines
1.2 KiB
Lua

-- 全局设置界面
AllSetView = {}
-- 初始化角色设置界面
function AllSetView:Init(root)
self.gameObject = root
self.passivity = Util.GetGameObject(root, "passivity/input"):GetComponent("InputField")
self.btnComfirm = Util.GetGameObject(root, "Root/confirm")
self.btnCancel = Util.GetGameObject(root, "Root/cancel")
self.content = Util.GetGameObject(root, "Root/cancel"):GetComponent("Text")
--
Util.AddOnceClick(self.btnComfirm, function()
self:ApplyData()
end)
--
Util.AddOnceClick(self.btnCancel, function()
self:Close()
end)
end
function AllSetView:Show(camp, data, func)
self.gameObject:SetActive(true)
self.camp = camp
self.data = data or {}
self.func = func
self.passivity.text = data.passivity
end
-- 应用数据
function AllSetView:ApplyData()
self.data.passivity = self.passivity.text
-- 应用数据
if self.func then
if self.func(self.camp, self.data) then
PopupTipPanel.ShowTip(Language[10212])
return
end
end
PopupTipPanel.ShowTip(Language[10213])
end
-- 关闭界面
function AllSetView:Close()
self.gameObject:SetActive(false)
end