宝物 commit

dev_chengFeng
jiaoyangna 2020-08-25 16:23:41 +08:00
parent bfc45c822e
commit 87cc8867c7
6 changed files with 46 additions and 33 deletions

View File

@ -1340,46 +1340,39 @@ function this.TimeFormat()
end
--轮转活动,乾坤宝盒
local dynamicAct = not not ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.FindFairy)
local dynamicAct = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FindFairy)
if dynamicAct then
local info = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.FindFairy)
local tempTime = info.endTime - PlayerManager.serverTime
if ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FindFairy) then
if tempTime>= 86400 then
this.DynamicActivityTime.text = TimeToDH(tempTime)
else
this.DynamicActivityTime.text = TimeToHMS(tempTime)
end
end
end
--青龙秘宝
local QingLong = not not ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.TreasureOfSomeBody)
local QingLong = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.TreasureOfSomeBody)
if QingLong then
local info = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.TreasureOfSomeBody)
local tempTime = info.endTime - PlayerManager.serverTime
if ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.TreasureOfSomeBody) then
if tempTime>= 86400 then
this.treasureOfSlText.text = TimeToDH(tempTime)
else
this.treasureOfSlText.text = TimeToHMS(tempTime)
end
end
end
--云梦祈福
local YunMeng = not not ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.Pray)
local YunMeng = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.Pray)
if YunMeng then
local info = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.Pray)
local tempTime = info.endTime - PlayerManager.serverTime
if ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.Pray) then
if tempTime>= 86400 then
this.paryGiftTime.text = TimeToDH(tempTime)
else
this.paryGiftTime.text = TimeToHMS(tempTime)
end
end
end
end
--为限时折扣写的
function this:GetInfoList()

View File

@ -115,7 +115,7 @@ function this.TabAdapter(tab, index, status)
Util.GetGameObject(tab,"Image"):GetComponent("Image").sprite = Util.LoadSprite(_TabData[index][status])
tabLab:GetComponent("Text").text = _TabData[index].name
tabLab:GetComponent("Text").color = _TabFontColor[status]
if _TabData[index].type ~= -1 and not ActivityGiftManager.GetActivityOpenStatus(_TabData[index].type) then
if _TabData[index].type ~= -1 and not ActivityGiftManager.IsActivityTypeOpen(_TabData[index].type) then
tab.gameObject:SetActive(false)
end
@ -123,7 +123,7 @@ end
--切换视图
function this.SwitchView(_index)
if _index == 2 or _index == 3 then
if not ActivityGiftManager.GetActivityOpenStatus(ActivityTypeDef.TreasureOfSomeBody) then
if not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.TreasureOfSomeBody) then
PopupTipPanel.ShowTip("未在活动时间范围内")
return
end

View File

@ -99,6 +99,7 @@ end
function this.GetTimeStartToEnd()
local info= ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.TreasureOfSomeBody)
if info then
LogGreen("info.startTime:"..info.startTime.." info.endTime:"..info.endTime)
local startTime= this.GetTimeShow(info.startTime)
local endtime= this.GetTimeShow(info.endTime)
return startTime,endtime,info.endTime

View File

@ -41,9 +41,9 @@ function this.SetBasicValues(giftGoodsList)
local rechargeConfig = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, giftGoodsInfo.goodsId)
-- LogGreen("------充值活动-----------礼包类型:".. rechargeConfig.Type .." 礼包ID".. giftGoodsInfo.goodsId .." 已购:"
-- ..giftGoodsInfo.buyTimes.." 开始:"..giftGoodsInfo.startTime.." 结束:"
-- ..giftGoodsInfo.endTime .. " 可购(没卵用)" .. giftGoodsInfo.dynamicBuyTimes)
LogGreen("------充值活动-----------礼包类型:".. rechargeConfig.Type .." 礼包ID".. giftGoodsInfo.goodsId .." 已购:"
..giftGoodsInfo.buyTimes.." 开始:"..giftGoodsInfo.startTime.." 结束:"
..giftGoodsInfo.endTime .. " 可购(没卵用)" .. giftGoodsInfo.dynamicBuyTimes)
if giftGoodsInfoList[rechargeConfig.Type] then

View File

@ -50,12 +50,13 @@ function this.InitSingleTreasureData(_singleData)
single.refineConfig = this.GetCurrTreasureLvConfig(2, currJewel.RankupPool, _singleData.rebuildLevel)
allTreasures[_singleData.id] = single
end
--获取玩家可以穿戴的宝物
function this.GetTreasureDataByPos(_pos, _idDyn, PropertyName)
local equips = {}
for i, v in pairs(allTreasures) do
if v.equipType == _pos - 4 then
if (v.upHeroDid == "" or v.upHeroDid == _idDyn) and v.race == PropertyName then
if (v.upHeroDid == "" or v.upHeroDid ~= _idDyn) and v.race == PropertyName then
table.insert(equips, v)
end
end

View File

@ -299,7 +299,7 @@ function this:AllEquipUpBtnOnClick()
for i = 1, 6 do
local curPosEquip = {}
local index = i
if index == 5 or index == 6 and isCanUpEquipTreasure then
if (index == 5 or index == 6) and isCanUpEquipTreasure then
curPosEquip =
EquipTreasureManager.GetTreasureDataByPos(
index,
@ -310,42 +310,58 @@ function this:AllEquipUpBtnOnClick()
--获取到所有未装备的装备
curPosEquip = BagManager.GetEquipDataByEquipPosition(curHeroData.heroConfig.Profession, index)
end
--计算每个位置可装备的装备战力 取战力最大的装备
LogBlue("i:"..index.." #curPosEquip:".. #curPosEquip)
LogBlue("计算每个位置可装备的装备战力")-- 取战力最大的装备
if curPosEquip and #curPosEquip > 0 then
local equiData = {}
local indexMaxPower = 0
if curHeroEquipDatas[index] then
equiData = curHeroEquipDatas[index]
if curHeroEquipDatas[index].idDyn then
--获取到宝物战力
if index == 5 or index == 6 then
indexMaxPower = EquipTreasureManager.CalculateWarForce(curHeroEquipDatas[index].idDyn)
LogBlue("宝物id"..curHeroEquipDatas[index].idDyn.." id:"..curHeroEquipDatas[index].id.." indexMaxPower:"..indexMaxPower)
else
--获取到装备战力
indexMaxPower = EquipManager.CalculateWarForce(curHeroEquipDatas[index].id)
LogBlue("装备id"..curHeroEquipDatas[index].id.." indexMaxPower:"..indexMaxPower)
end
end
LogGreen("循环计算每个装备的战力")
for i = 1, #curPosEquip do
local addPower = 0
local curEquip = curPosEquip[i]
if curEquip then
if curEquip.idDyn then
if index == 5 or index == 6 then
addPower = EquipTreasureManager.CalculateWarForce(curEquip.idDyn)
LogGreen("宝物id"..curEquip.idDyn.." id:"..curEquip.id.." addPower:"..addPower)
else
addPower = EquipManager.CalculateWarForce(curEquip.id)
LogGreen("装备id"..curEquip.id.." addPower:"..addPower)
end
end
if addPower >= indexMaxPower then
if addPower > indexMaxPower then
indexMaxPower = addPower
equiData = curEquip
end
end
if equiData.idDyn and isCanUpEquipTreasure
and ((curHeroEquipDatas[index] and equiData.idDyn ~= curHeroEquipDatas[index].idDyn) or (not curHeroEquipDatas[index])) then
table.insert(allTreasureIds, equiData.idDyn)
if index == 5 or index == 6 then
LogYellow("宝物id"..equiData.idDyn.." id:"..equiData.id)
else
if (not curHeroEquipDatas[index] or tonumber(equiData.id) ~= tonumber(curHeroEquipDatas[index].id)) and (not equiData.idDyn) then
LogYellow("装备id"..equiData.id)
end
if (index == 5 or index == 6) then
if ((curHeroEquipDatas[index] and equiData.idDyn ~= curHeroEquipDatas[index].idDyn)
or (not curHeroEquipDatas[index])) then
table.insert(allTreasureIds, equiData.idDyn)
end
else
if (not curHeroEquipDatas[index] or tonumber(equiData.id) ~= tonumber(curHeroEquipDatas[index].id)) then
table.insert(allEquipIds, tostring(equiData.id))
end
end
--特效
if curHeroEquipDatas[equiData.position] then
if equiData.idDyn then
@ -362,12 +378,15 @@ function this:AllEquipUpBtnOnClick()
end
end
end
LogYellow("装备:"..#allEquipIds)
LogYellow("宝物:"..#allTreasureIds)
LogYellow("isCanUpEquipTreasure:"..tostring(isCanUpEquipTreasure))
if (allEquipIds and #allEquipIds > 0) or (isCanUpEquipTreasure and allTreasureIds and #allTreasureIds > 0) then
--isCanUpEquipTreasure
if allEquipIds and #allEquipIds > 0 then
-- for i = 1, #allEquipIds do
-- LogGreen(curHeroData.dynamicId .. " " .. allEquipIds[i])
-- end
for i = 1, #allEquipIds do
LogGreen("一键装备"..allEquipIds[i])
end
--穿装备协议
NetManager.EquipWearRequest(
curHeroData.dynamicId,
@ -386,11 +405,10 @@ function this:AllEquipUpBtnOnClick()
)
end
--穿戴宝物
LogBlue(tostring(isCanUpEquipTreasure))
if isCanUpEquipTreasure and allTreasureIds and #allTreasureIds > 0 then
--for i = 1, #allEquipIds do
-- Log(curHeroData.dynamicId.. " "..curHeroData.id .." "..curHeroData.lv.." 一键宝物 "..i.." "..allEquipIds[i])
--end
for i = 1, #allTreasureIds do
LogGreen("一键宝物"..allTreasureIds[i])
end
--穿装备协议
NetManager.EquipWearRequest(
curHeroData.dynamicId,