天宫秘宝额外奖励界面

dev_chengFeng
ZhangBiao 2020-08-24 20:37:41 +08:00
parent 1ad1aaa2d4
commit d02a997cb0
3 changed files with 62 additions and 44 deletions

View File

@ -20277,7 +20277,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -0.00001323921}
m_AnchoredPosition: {x: 0, y: -0.000030405978}
m_SizeDelta: {x: -894.3, y: -817.3}
m_Pivot: {x: 0, y: 1}
--- !u!114 &7488345345668227506
@ -22974,8 +22974,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -30.88, y: -359.5}
m_SizeDelta: {x: 547.84, y: 77.3}
m_AnchoredPosition: {x: 4.8, y: -359.5}
m_SizeDelta: {x: 619.2, y: 77.3}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1221536551871023808
CanvasRenderer:
@ -23018,7 +23018,7 @@ MonoBehaviour:
m_HorizontalOverflow: 0
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: "<color=#60A22C>\u89E3\u9501\u9AD8\u9636\u6218\u4EE4\uFF0C\u6FC0\u6D3B\u8FDB\u9636</color><color=#95523B>\u4E13\u5C5E\u5956\u52B1+\u76F4\u534715\u7EA7</color><color=#60A22C>\u89E3\u9501\u7ACB\u83B7\u9650\u5B9A\u79F0\u53F7+\u9650\u5B9A\u6C14\u6CE1</color>"
m_Text: "<color=#60A22C>\u89E3\u9501\u9AD8\u9636\u6218\u4EE4\uFF0C\u6FC0\u6D3B\u8FDB\u9636</color><color=#95523B>\u4E13\u5C5E\u5956\u52B1+\u76F4\u534715\u7EA7</color>"
--- !u!114 &5087427704777140632
MonoBehaviour:
m_ObjectHideFlags: 0
@ -25252,7 +25252,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -4.3, y: -169}
m_AnchoredPosition: {x: -4.299988, y: -169}
m_SizeDelta: {x: 494.6, y: 77.3}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6559398893788723828

View File

@ -24,8 +24,7 @@ function this:InitComponent(gameObject)
this.box1 = Util.GetGameObject(this.Content, "scroll/box")
this.box2 = Util.GetGameObject(this.Content, "scroll2/box")
this.tip = Util.GetGameObject(this.Content, "Text"):GetComponent("Text")
this.taskList1 = {}
this.taskList2 = {}
this.taskList = {}
end
--绑定事件(用于子类重写)
@ -84,27 +83,32 @@ function this:showRewardTianGong()
local direct = {}
local indirect ={}
local curScore = TreasureOfHeavenManger.GetScore()--当前分数
for i = 1, #rewardData do
if rewardStateData[i].state == 1 then--已达成但不能领取的
-- body
local reward = rewardData[i]
local k1 = reward.TreasureReward[1][1]
local v1 = reward.TreasureReward[1][2]
local k2 = reward.TreasureReward[2][1]
local v2 = reward.TreasureReward[2][2]
if not direct[k1] then
direct[k1] = 0
LogRed("state:"..rewardStateData[rewardData[i].Id].state)
if curScore >= rewardData[i].Integral then
if rewardStateData[i].state == 1 or rewardStateData[i].state == 0 then--已达成但不能领取的
-- body
LogRed("执行这里了么")
local reward = rewardData[i]
local k1 = reward.TreasureReward[1][1]
local v1 = reward.TreasureReward[1][2]
local k2 = reward.TreasureReward[2][1]
local v2 = reward.TreasureReward[2][2]
if not direct[k1] then
direct[k1] = 0
end
direct[k1] = direct[k1] + v1
if not direct[k2] then
direct[k2] = 0
end
direct[k2] = direct[k2] + v2
end
direct[k1] = direct[k1] + v1
if not direct[k2] then
direct[k2] = 0
end
direct[k2] = direct[k2] + v2
elseif rewardStateData[i].state == 0 then--未达成且不能领取的
else
-- elseif rewardStateData[i].state == 0 then--未达成且不能领取的
local reward = rewardData[i]
local k1 = reward.TreasureReward[1][1]
local v1 = reward.TreasureReward[1][2]
@ -121,25 +125,39 @@ function this:showRewardTianGong()
end
indirect[k2] = indirect[k2] + v2
end
end
if #this.taskList == 0 then
for key, value in pairs(direct) do
for i = 1,#this.taskList do
this.taskList[i].gameObject:SetActive(false)
end
local index = 1
for key, value in pairs(direct) do
if not this.taskList[index] then
local item = SubUIManager.Open(SubUIConfig.ItemView, this.box1.transform)
item:OnOpen(false,{key, value},0.9)
table.insert(this.taskList,{key, value})
this.taskList[index] = item
end
if LengthOfTable(direct) > 0 then
Util.GetGameObject(this.Content, "empty").gameObject:SetActive(false)
else
Util.GetGameObject(this.Content, "empty").gameObject:SetActive(true)
end
for key, value in pairs(indirect) do
this.taskList[index].gameObject:SetActive(true)
this.taskList[index].gameObject.transform:SetParent(this.box1.transform)
this.taskList[index].gameObject:GetComponent("RectTransform").localPosition = Vector3.zero
this.taskList[index]:OnOpen(false,{key, value},0.95)
index = index + 1
end
if LengthOfTable(direct) > 0 then
Util.GetGameObject(this.Content, "empty").gameObject:SetActive(false)
else
Util.GetGameObject(this.Content, "empty").gameObject:SetActive(true)
end
for key, value in pairs(indirect) do
if not this.taskList[index] then
local item = SubUIManager.Open(SubUIConfig.ItemView, this.box2.transform)
item:OnOpen(false,{key, value},0.9)
table.insert(this.taskList,{key, value})
this.taskList[index] = item
end
this.taskList[index].gameObject:SetActive(true)
this.taskList[index].gameObject.transform:SetParent(this.box2.transform)
this.taskList[index].gameObject:GetComponent("RectTransform").localPosition = Vector3.zero
this.taskList[index]:OnOpen(false,{key, value},0.95)
index = index + 1
end
end
@ -175,13 +193,13 @@ function this:showRewardQinglong()
local index = 1
for key, value in pairs(direct) do
if not this.taskLtaskListist1[index] then
if not this.taskList[index] then
local item = SubUIManager.Open(SubUIConfig.ItemView, this.box1.transform)
this.taskList[index] = item
end
this.taskList[index].gameObject:SetActive(true)
this.taskList[index].gameObject.transform:SetParent(this.box1.transform)
this.taskList[index].gameObject:GetComponent("RectTransForm").localPosition = Vector3.zero
this.taskList[index].gameObject:GetComponent("RectTransform").localPosition = Vector3.zero
this.taskList[index]:OnOpen(false,{key, value},0.95)
index = index + 1
end
@ -197,7 +215,7 @@ function this:showRewardQinglong()
end
this.taskList[index].gameObject:SetActive(true)
this.taskList[index].gameObject.transform:SetParent(this.box2.transform)
this.taskList[index].gameObject:GetComponent("RectTransForm").localPosition = Vector3.zero
this.taskList[index].gameObject:GetComponent("RectTransform").localPosition = Vector3.zero
this.taskList[index]:OnOpen(false,{key, value},0.95)
index = index + 1
end

View File

@ -100,7 +100,7 @@ function TreasureOfHeavenPanel:topBar()
if treasureState == 0 then
Util.AddOnceClick(this.buyBtn,function()
UIManager.OpenPanel(UIName.HeavenUnlockExtraRewardPanel,1)
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.HeavenUnlockExtraRewardPanel,1)
end)
end
@ -231,7 +231,7 @@ function TreasureOfHeavenPanel:OnBtnDealClicked(rewardItem,rewardSingleData)
TreasureOfHeavenPanel:refresh()--刷新界面
end)
elseif rewardStateData[rewardSingleData.Id].state == 1 and treasureState == 0 then----任务已领取+礼包未购买(弹出购买界面)
UIManager.OpenPanel(UIName.HeavenUnlockExtraRewardPanel,1)
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.HeavenUnlockExtraRewardPanel,1)
end
else--分数未达到要求
PopupTipPanel.ShowTip(Language[11989])