2021-04-20 16:43:16 +08:00
|
|
|
ExpertPre = {}
|
|
|
|
|
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|
|
|
|
function ExpertPre:New(gameObject)
|
|
|
|
|
local b = {}
|
|
|
|
|
b.gameObject = gameObject
|
|
|
|
|
b.transform = gameObject.transform
|
|
|
|
|
setmetatable(b, { __index = ExpertPre })
|
|
|
|
|
return b
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local BtnState = {
|
|
|
|
|
[0] = {Img = "s_slbz_1anniuongse", isRed = true, isGray = false, Text = Language[11948],},
|
|
|
|
|
[1] = {Img = "s_slbz_1anniuhuangse", isRed = false, isGray = false, Text = Language[10556]},
|
|
|
|
|
[2] = {Img = "s_slbz_1anniuongse", isRed = false, isGray = true, Text = Language[11948]},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
|
function ExpertPre:InitComponent()
|
|
|
|
|
self.title = Util.GetGameObject(self.gameObject,"Content/title"):GetComponent("Text")
|
|
|
|
|
self.info = Util.GetGameObject(self.gameObject,"Content/info"):GetComponent("Text")
|
|
|
|
|
self.grid = Util.GetGameObject(self.gameObject,"Content/scrollView")
|
|
|
|
|
self.btnGet = Util.GetGameObject(self.gameObject,"Content/button")
|
|
|
|
|
self.redPoint = Util.GetGameObject(self.btnGet,"redPoint")
|
|
|
|
|
self.btnText = Util.GetGameObject(self.btnGet,"Text"):GetComponent("Text")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
function ExpertPre:BindEvent()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
function ExpertPre:AddListener()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
function ExpertPre:RemoveListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
function ExpertPre:OnOpen()
|
|
|
|
|
end
|
|
|
|
|
|
2021-04-20 17:41:48 +08:00
|
|
|
function ExpertPre:SetData(_data,_parent,_sortingOrder,_activityId,_value,_configData)
|
2021-04-20 16:43:16 +08:00
|
|
|
self.data = _data
|
|
|
|
|
self.parent = _parent
|
|
|
|
|
self.sortingOrder = _sortingOrder
|
|
|
|
|
self.activityId = _activityId
|
2021-04-20 17:41:48 +08:00
|
|
|
self.actConfig = _configData
|
|
|
|
|
self.value = _value
|
2021-04-20 16:43:16 +08:00
|
|
|
self:Refresh()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function ExpertPre:Refresh()
|
|
|
|
|
-- LogPink("self.data.missionId.:"..tostring(self.data.missionId).." self.data.progress:"..tostring(self.data.progress).." self.data.state:"..tostring(self.data.state))
|
|
|
|
|
local sConFigData = ConfigManager.GetConfigData(ConfigName.ActivityRewardConfig,self.data.missionId)
|
|
|
|
|
self.title.text = GetLanguageStrById(sConFigData.ContentsShow)
|
|
|
|
|
--设置内容
|
|
|
|
|
if not self.itemList then
|
|
|
|
|
self.itemList = {}
|
|
|
|
|
end
|
|
|
|
|
for i = 1, #sConFigData.Reward do
|
|
|
|
|
if not self.itemList[i] then
|
|
|
|
|
self.itemList[i] = SubUIManager.Open(SubUIConfig.ItemView,self.grid.transform)
|
|
|
|
|
end
|
|
|
|
|
self.itemList[i]:OnOpen(false, sConFigData.Reward[i], 0.9,false,false,false,self.sortingOrder)
|
|
|
|
|
end
|
|
|
|
|
self:SetButton(sConFigData)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function ExpertPre:SetButton(sConFigData)
|
|
|
|
|
|
2021-04-20 17:41:48 +08:00
|
|
|
local value = sConFigData.Values[2][1]
|
|
|
|
|
if self.actConfig.ActiveType == ActivityTypeDef.AccumulativeRechargeExper then--日限时累充
|
|
|
|
|
value = sConFigData.Values[1][1]
|
|
|
|
|
end
|
|
|
|
|
|
2021-04-20 16:43:16 +08:00
|
|
|
local state = 0
|
|
|
|
|
if self.data.state == 0 then
|
2021-04-20 17:41:48 +08:00
|
|
|
if self.actConfig.ActiveType == ActivityTypeDef.UpStarExper or self.actConfig.ActiveType == ActivityTypeDef.Talisman
|
|
|
|
|
or self.actConfig.ActiveType == ActivityTypeDef.SoulPrint or self.actConfig.ActiveType == ActivityTypeDef.EquipExper
|
|
|
|
|
or self.actConfig.ActiveType == ActivityTypeDef.FindTreasureExper or self.actConfig.ActiveType == ActivityTypeDef.ExpeditionExper then--进阶因为每个都不一样 特殊判断
|
|
|
|
|
if self.data.progress < value then
|
|
|
|
|
state = 10
|
|
|
|
|
else
|
|
|
|
|
state = 0
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if self.value < value then
|
|
|
|
|
state = 10
|
|
|
|
|
else
|
|
|
|
|
state = 0
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
elseif self.data.state == 1 then
|
|
|
|
|
state = 20
|
2021-04-20 16:43:16 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local btnData = BtnState[state]
|
|
|
|
|
self.btnGet:GetComponent("Image").sprite = Util.LoadSprite(btnData.Img)
|
|
|
|
|
Util.SetGray(self.btnGet,btnData.isGray)
|
|
|
|
|
self.redPoint:SetActive(btnData.isRed)
|
|
|
|
|
self.btnText.text = btnData.Text
|
2021-04-20 17:41:48 +08:00
|
|
|
|
|
|
|
|
if self.actConfig.ActiveType == ActivityTypeDef.UpStarExper or self.actConfig.ActiveType == ActivityTypeDef.Talisman
|
|
|
|
|
or self.actConfig.ActiveType == ActivityTypeDef.SoulPrint or self.actConfig.ActiveType == ActivityTypeDef.EquipExper
|
|
|
|
|
or self.actConfig.ActiveType == ActivityTypeDef.FindTreasureExper or self.actConfig.ActiveType == ActivityTypeDef.ExpeditionExper then--进阶因为每个都不一样 特殊判断
|
|
|
|
|
self.info.text =string.format("%s/%s",self.data.progress,value)
|
|
|
|
|
else
|
|
|
|
|
self.info.text =string.format("%s/%s",self.value,value)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
2021-04-20 16:43:16 +08:00
|
|
|
Util.AddOnceClick(self.btnGet, function()
|
|
|
|
|
if state == 0 then
|
|
|
|
|
NetManager.GetActivityRewardRequest(self.data.missionId, self.activityId, function(drop)
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemPopup,drop,1,function()
|
|
|
|
|
CheckRedPointStatus(RedPointType.Expert_FastExplore)
|
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|
elseif state == 1 then
|
|
|
|
|
JumpManager.GoJump(sConFigData.Jump[1])
|
|
|
|
|
elseif state == 2 then
|
|
|
|
|
PopupTipPanel.ShowTip(Language[10101])
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function ExpertPre:OnClose()
|
|
|
|
|
self.gridList = {}
|
|
|
|
|
for k,v in pairs(self.itemList) do
|
|
|
|
|
SubUIManager.Close(v)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return ExpertPre
|