miduo_client/Assets/ManagedResources/~Lua/View/JumpView.lua

88 lines
2.7 KiB
Lua
Raw Normal View History

2020-05-09 13:31:21 +08:00
local JumpConfig=ConfigManager.GetConfig(ConfigName.JumpConfig)
JumpView = {}
function JumpView:New(gameObject)
local b = {}
b.gameObject = gameObject
b.transform = gameObject.transform
setmetatable(b,{ __index = JumpView })
return b
end
--初始化组件(用于子类重写)
function JumpView:InitComponent()
self.info = Util.GetGameObject(self.gameObject, "info"):GetComponent("Text")
self.btnSure = Util.GetGameObject(self.gameObject, "btnSure")
self.btnSureText = Util.GetGameObject(self.gameObject, "btnSure/Text"):GetComponent("Text")
end
--绑定事件(用于子类重写)
function JumpView:BindEvent()
end
--添加事件监听(用于子类重写)
function JumpView:AddListener()
end
--移除事件监听(用于子类重写)
function JumpView:RemoveListener()
end
--界面打开时调用(用于子类重写)
function JumpView:OnOpen(jumpId,isShowBtn)
if(isShowBtn==false) then
isShowBtn=false
else
isShowBtn =true
end
2020-06-23 18:36:24 +08:00
Log(Language[12080]..tostring(isShowBtn))
2020-05-09 13:31:21 +08:00
Log("jumpId == " .. jumpId)
Log("JumpConfig's Id is == " .. JumpConfig[jumpId].Id)
self.jumpSData=JumpConfig[jumpId]
if self.jumpSData then
self.info.text=self.jumpSData.Title
--if self.jumpSData.Type == JumpType.Level then--关卡按钮特殊处理
-- if self.jumpSData.Skipfactor[1] > 0 then
-- Log("self.jumpSData.Skipfactor[1] == " .. self.jumpSData.Skipfactor[1])
--local isPass=FightManager.SetAndGetSingleFightState(self.jumpSData.Skipfactor[1],2)>=SingleFightState.Pass--_setType 1 设置 2 获取
--Log("设置是否扫荡还是前往")
--Log("关卡的通关判定 === " .. tostring(isPass))
--if isPass then
-- self.btnSureText.text = "扫 荡"
--else
2020-06-23 18:36:24 +08:00
self.btnSureText.text = Language[10509]
2020-05-09 13:31:21 +08:00
--end
--end
--end
Util.AddOnceClick(self.btnSure, function()
self:GoToJumpData()
end)
else
2020-06-23 18:36:24 +08:00
Log(Language[12081])
2020-05-09 13:31:21 +08:00
end
-- Log("是否在地图里 === " .. tostring(MapManager.isInMap).. " 是否在关卡里 === " .. FightManager.curIsInFightArea)
if MapManager.isInMap or UIManager.IsOpen(UIName.BattlePanel) or isShowBtn == false then
self.btnSure:SetActive(false)
else
self.btnSure:SetActive(true)
end
end
function JumpView:GoToJumpData()
JumpManager.GoJump(self.jumpSData.Id)
end
--界面关闭时调用(用于子类重写)
function JumpView:OnClose()
end
--界面销毁时调用(用于子类重写)
function JumpView:OnDestroy()
end
2020-06-23 18:36:24 +08:00
return JumpView