miduo_client/Assets/ManagedResources/~Lua/Modules/EightDay/ZeroPointOneMissionPanel.lua

86 lines
2.6 KiB
Lua

require("Base/BasePanel")
local ZeroPointOneMissionPanel = Inherit(BasePanel)
local this = ZeroPointOneMissionPanel
local taskConfig = ConfigManager.GetConfig(ConfigName.EveryDayGiftTask)
--初始化组件(用于子类重写)
function ZeroPointOneMissionPanel:InitComponent()
this.spLoader = SpriteLoader.New()
this.btn_close = Util.GetGameObject(this.gameObject, "panel/btn_close")
this.rewardPre = Util.GetGameObject(this.gameObject, "panel/missionPre")
this.info2 = Util.GetGameObject(this.gameObject, "panel/info2")
this.info2:SetActive(false)
local v = Util.GetGameObject(this.gameObject, "grid"):GetComponent("RectTransform").rect
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView,
Util.GetGameObject(this.gameObject, "grid").transform,
this.rewardPre, nil, Vector2.New(v.width, v.height), 1, 1, Vector2.New(0, -5))
this.ScrollView.moveTween.MomentumAmount = 1
this.ScrollView.moveTween.Strength = 1
end
--绑定事件(用于子类重写)
function ZeroPointOneMissionPanel:BindEvent()
Util.AddClick(this.btn_close, function()
this:ClosePanel()
end)
end
--添加事件监听(用于子类重写)
function ZeroPointOneMissionPanel:AddListener()
end
--移除事件监听(用于子类重写)
function ZeroPointOneMissionPanel:RemoveListener()
end
function ZeroPointOneMissionPanel:Refresh()
end
function ZeroPointOneMissionPanel:OnSortingOrderChange()
end
--界面打开时调用(用于子类重写)
function ZeroPointOneMissionPanel:OnOpen(...)
end
-- 打开,重新打开时回调
function ZeroPointOneMissionPanel:OnShow()
local curAllData = TaskManager.GetTypeTaskList(17)
this.ScrollView:SetData(curAllData, function(index, go)
this:SingleDataShow(go, curAllData[index])
end)
end
function ZeroPointOneMissionPanel:SingleDataShow(item, data)
local info = Util.GetGameObject(item, "info"):GetComponent("Text")
local valueTxt = Util.GetGameObject(item, "value"):GetComponent("Text")
LogError("data..missionId===========================" .. data.missionId)
local value = taskConfig[data.missionId].TaskValue[2][1]
info.text = string.format(taskConfig[data.missionId].Desc, value)
valueTxt.text = data.progress .. "/" .. value
if data.progress >= value then
valueTxt.color = UIColor.GREEN
else
valueTxt.color = UIColor.RED
end
end
--界面关闭时调用(用于子类重写)
function ZeroPointOneMissionPanel:OnClose()
end
--界面销毁时调用(用于子类重写)
function ZeroPointOneMissionPanel:OnDestroy()
this.spLoader:Destroy()
end
return ZeroPointOneMissionPanel