【家园】摘星阁提交

dev_chengFeng
ZhangBiao 2022-01-06 17:53:53 +08:00
parent 456501e15a
commit 956826c46a
3 changed files with 85 additions and 65 deletions

View File

@ -211,7 +211,7 @@ function this.GetBaoKuData()
data.reward = RewardAllConfig[v.progress].Reward
data.configId = RewardAllConfig[v.progress].Id
end
-- --LogGreen("Id:"..v.missionId.." rewardId:"..v.progress.." ")
LogGreen("Id:"..v.missionId.." rewardId:"..v.progress.." ")
table.insert(finalCardDatas,data)
end
end
@ -230,7 +230,7 @@ function this.GetBaoKuData()
local data = {}
data.rewardId = v.missionId-1000
data.progress = v.progress
-- LogYellow("rewardId:"..data.rewardId.." data.progress:"..data.progress)
LogYellow("rewardId:"..data.rewardId.." data.progress:"..data.progress)
data.configId = RewardAllConfig[data.rewardId].Id
table.insert(allData,data)
end
@ -285,10 +285,10 @@ function this.GetLeftRewardData()
data[RewardConfig[i].Id].limit = RewardConfig[i].InitializeNum
end
-- LogYellow("#finalCardDatas:"..#finalCardDatas.." actData.selectId:"..actData.selectId)
LogYellow("#finalCardDatas:"..#finalCardDatas.." actData.selectId:"..actData.selectId)
for i = 1, #finalCardDatas do
if finalCardDatas[i].rewardId and finalCardDatas[i].rewardId ~= 0 and finalCardDatas[i].rewardId ~= actData.selectId then
-- LogYellow("i:"..i.." rewardId:"..tostring(finalCardDatas[i].rewardId) .." progress"..tonumber(data[finalCardDatas[i].rewardId].progress))
LogYellow("i:"..i.." rewardId:"..tostring(finalCardDatas[i].rewardId) .." progress"..tonumber(data[finalCardDatas[i].rewardId].progress))
data[finalCardDatas[i].rewardId].progress = data[finalCardDatas[i].rewardId].progress - 1
end
end

View File

@ -137,29 +137,32 @@ function this:SetSingleData(index,item,data)
end
local aData = this.GetDataByRewardId(data.Id)
-- LogRed(aData.rewardId..""..tostring(aData.progress))
if aData.progress >= data.InitializeNum then
t3 = false
-- 如果是当前层选中的特殊奖励
if aData.progress == data.InitializeNum and ActData.selectId == data.Id then--and ActData.curLevel > data.InitializeNum
t3 = true
end
num.text = "<color=red>"..(data.InitializeNum-aData.progress).."/"..data.InitializeNum.."</color>"
else
t3 = true
num.text = (data.InitializeNum - aData.progress).."/"..data.InitializeNum
end
-- if aData.progress >= data.InitializeNum then
-- t3 = false
-- -- 如果是当前层选中的特殊奖励
-- if aData.progress == data.InitializeNum and ActData.selectId == data.Id then--and ActData.curLevel > data.InitializeNum
-- t3 = true
-- end
-- num.text = "<color=red>"..(data.InitializeNum-aData.progress).."/"..data.InitializeNum.."</color>"
-- else
-- t3 = true
-- num.text = (data.InitializeNum - aData.progress).."/"..data.InitializeNum
-- end
select:SetActive(t1 and t2 and t3)
-- select:SetActive(t1 and t2 and t3)
end
-- 获取数量
function this.GetDataByRewardId(rId)
LogPink("rId:"..tostring(rId))
for k, v in ipairs(ActData.allData) do
LogGreen("v.rewardId:"..tostring(v.rewardId))
if v.rewardId == rId then
return v
end
end
LogError("rId:"..tostring(rId))
end

View File

@ -22,6 +22,7 @@ function this:InitComponent(gameObject)
this.titleText=Util.GetGameObject(gameObject,"TitleText"):GetComponent("Text")
this.titleText.text="摘星阁"
this.Btn1 = Util.GetGameObject(gameObject,"Btn1")
this.Btn1Text = Util.GetGameObject(gameObject,"Btn1/Text"):GetComponent("Text")
this.Btn2 = Util.GetGameObject(gameObject,"Btn2")
this.costCondition = Util.GetGameObject(gameObject,"Cost/Condition"):GetComponent("Text")
this.costIcon = Util.GetGameObject(gameObject,"Cost/Icon"):GetComponent("Image")
@ -108,60 +109,76 @@ end
function this:SetData()
-- LogPink(HomeLandManager.EquipData[HomeLandManager.curEquip].Id)
local curIndex = HomeLandManager.curEquip
local data = EquipStrengthen[HomeLandManager.EquipData[curIndex].Id].Rate--当前装备加成
local proData = EquipRankUp[HomeLandManager.levelProId].Rate--当前装备突破加成
local nextData = EquipStrengthen[HomeLandManager.EquipData[curIndex].Id + 1].Rate--下一装备加成
local nextProData = EquipRankUp[HomeLandManager.levelProId + 1].Rate--下一装备突破加成
local num1 = data + proData[curIndex]
-- LogYellow(tostring(data).." @ "..tostring(proData[curIndex]))
local num2 = 0
if not HomeLandManager.GetCurIndexBtnsShow() then--如果都到达了等级上限
num2 = data + nextProData[curIndex]
-- LogYellow(tostring(data).." $ "..tostring(nextProData[curIndex]))
else
num2 = nextData + proData[curIndex]
-- LogYellow(tostring(nextData).." # "..tostring(proData[curIndex]))
end
this.Desc.text = string.format("神将佩戴的%s%s属性增加%s",TEXT[curIndex][1],TEXT[curIndex][3],num1).."%"..string.format("<color=#00FF00>%s",num2).."%</color>"
--设置消耗
local limit = EquipStrengthen[HomeLandManager.EquipData[curIndex].Id].Limit
local cost = EquipStrengthen[HomeLandManager.EquipData[curIndex].Id].Cost
this.costIcon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(cost[1][1]))
if HomeLandManager.BuildData[limit[1]].level >= limit[2] then
this.costCondition.text = ""
this.costIcon.gameObject:SetActive(true)
this.costNum.gameObject:SetActive(true)
local color2 = BagManager.GetTotalItemNum(cost[1][1]) >= cost[1][2] and "#FFEED6" or "red"
this.costNum.text = string.format("<color=%s>%s</color>",color2,cost[1][2])
else
this.costIcon.gameObject:SetActive(false)
this.costNum.gameObject:SetActive(false)
this.costCondition.text = string.format("<color=red>%s需要到达%s级</color>",HomeLand[limit[1]].Name,limit[2])
end
local data = EquipStrengthen[HomeLandManager.EquipData[curIndex].Id].Rate--当前装备加成
local proData = EquipRankUp[HomeLandManager.levelProId].Rate--当前装备突破加成
--按钮和tips显示
local bool = HomeLandManager.GetCurIndexBtnsShow()
-- LogBlue("bool:"..tostring(bool))
this.Btn1:SetActive(bool)
this.Btn2:SetActive(not bool)
--不同显示
this.Cost:SetActive(bool)
this.Tips:SetActive(not bool)
this.costCondition.gameObject:SetActive(true)
this.Tips:GetComponent("Text").text = string.format("全部加持到达%s级后方可进行突破",EquipStrengthen[HomeLandManager.EquipData[curIndex].Id].Level)
if not bool and HomeLandManager.GetAllCanUpgrade() then
this.Cost:SetActive(true)
if cost then--如果有下一级
local nextData = EquipStrengthen[HomeLandManager.EquipData[curIndex].Id + 1].Rate--下一装备加成
local nextProData = EquipRankUp[HomeLandManager.levelProId + 1].Rate--下一装备突破加成
local num1 = data + proData[curIndex]
-- LogYellow(tostring(data).." @ "..tostring(proData[curIndex]))
local num2 = 0
if not HomeLandManager.GetCurIndexBtnsShow() then--如果都到达了等级上限
num2 = data + nextProData[curIndex]
-- LogYellow(tostring(data).." $ "..tostring(nextProData[curIndex]))
else
num2 = nextData + proData[curIndex]
-- LogYellow(tostring(nextData).." # "..tostring(proData[curIndex]))
end
this.Desc.text = string.format("神将佩戴的%s%s属性增加%s",TEXT[curIndex][1],TEXT[curIndex][3],num1).."%"..string.format("<color=#00FF00>%s",num2).."%</color>"
this.Btn1Text.text = "强 化"
Util.SetGray(this.Btn1,false)
this.Btn1:GetComponent("Button").enabled = true
this.costIcon.sprite = this.spLoader:LoadSprite(GetSpriteNameByItemId(cost[1][1]))
if HomeLandManager.BuildData[limit[1]].level >= limit[2] then
this.costCondition.text = ""
this.costIcon.gameObject:SetActive(true)
this.costNum.gameObject:SetActive(true)
local color2 = BagManager.GetTotalItemNum(cost[1][1]) >= cost[1][2] and "#FFEED6" or "red"
this.costNum.text = string.format("<color=%s>%s</color>",color2,cost[1][2])
else
this.costIcon.gameObject:SetActive(false)
this.costNum.gameObject:SetActive(false)
this.costCondition.text = string.format("<color=red>%s需要到达%s级</color>",HomeLand[limit[1]].Name,limit[2])
end
--按钮和tips显示
local bool = HomeLandManager.GetCurIndexBtnsShow()
local bool2 =
-- LogBlue("bool:"..tostring(bool))
this.Btn1:SetActive(bool)
this.Btn2:SetActive(not bool)
--不同显示
this.Cost:SetActive(bool)
this.Tips:SetActive(not bool)
this.costCondition.gameObject:SetActive(true)
this.Tips:GetComponent("Text").text = string.format("全部加持到达%s级后方可进行突破",EquipStrengthen[HomeLandManager.EquipData[curIndex].Id].Level)
if not bool and HomeLandManager.GetAllCanUpgrade() then
this.Cost:SetActive(true)
this.Tips:SetActive(false)
this.costIcon.gameObject:SetActive(true)
this.costNum.gameObject:SetActive(true)
this.costCondition.gameObject:SetActive(false)
--突破的消耗和升级不同
local cost = EquipRankUp[HomeLandManager.levelProId].Cost
local color2 = BagManager.GetTotalItemNum(cost[1]) >= cost[2] and "#FFEED6" or "red"
this.costNum.text = string.format("<color=%s>%s</color>",color2,cost[2])
end
else
this.Btn1:SetActive(true)
this.Btn2:SetActive(false)
this.Btn1Text.text = "已达上限"
Util.SetGray(this.Btn1,true)
this.Btn1:GetComponent("Button").enabled = false
local num1 = data + proData[curIndex]
this.Desc.text = string.format("神将佩戴的%s%s属性增加%s",TEXT[curIndex][1],TEXT[curIndex][3],num1).."%"
this.Cost:SetActive(false)
this.Tips:SetActive(false)
this.costIcon.gameObject:SetActive(true)
this.costNum.gameObject:SetActive(true)
this.costCondition.gameObject:SetActive(false)
--突破的消耗和升级不同
local cost = EquipRankUp[HomeLandManager.levelProId].Cost
local color2 = BagManager.GetTotalItemNum(cost[1]) >= cost[2] and "#FFEED6" or "red"
this.costNum.text = string.format("<color=%s>%s</color>",color2,cost[2])
end
end