【十五日登陆】

dev_chengFeng
ZhangBiao 2021-04-01 17:44:44 +08:00
parent e86078ce69
commit 74077e2484
4 changed files with 4580 additions and 4524 deletions

View File

@ -1672,6 +1672,15 @@ function SubString(inputstr,num)
end
return str
end
function FixableString(inputstr,num)
if LengthString(inputstr) > num then
return SubString(inputstr,num-1).."..."
else
return inputstr
end
end
--只有英文截取长度
function SubString2(inputstr,num)
if GetCurLanguage() == 0 then

View File

@ -5,7 +5,9 @@ local sortingOrder = 0
local Data
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local itemList = {}
local canGetList = {}
local ItemViewList = {}
local frontList = {}
local backList = {}
local angle = {
[1] = Quaternion.Euler(Vector3.New(0, 0, 0)),
@ -35,12 +37,25 @@ function FifteenDayGift:BindEvent()
self:ClosePanel()
end)
Util.AddClick(self.btnGet,function ()
LogPink("领取")
-- NetManager.GetActivityRewardRequest(-1,data.activityId,function (drop)
-- UIManager.OpenPanel(UIName.RewardItemPopup, drop, 1,function()
-- FuXingGaoZhao:Refresh()
-- end)
-- end)
if #frontList == 0 then
PopupTipPanel.ShowTip("暂无可领取的奖励~")
return
end
NetManager.GetActivityRewardRequest(-1,Data.activityId,function (drop)
for i = 1, #frontList do
local thread=coroutine.start(function()
frontList[i].transform:DORotate(Vector3.New(0, 90, 0), 0.3)
coroutine.wait(0.3)
frontList[i]:SetActive(false)
backList[i].transform:DORotate(Vector3.New(0, 0, 0), 0.3)
coroutine.wait(0.3)
UIManager.OpenPanel(UIName.RewardItemPopup, drop, 1,function()
FifteenDayGift:Refresh()
end)
end)
end
end)
end)
end
@ -68,6 +83,12 @@ end
function FifteenDayGift:Refresh()
Data = FifteenDayGiftManager.GetData()
if self.timer then
self.timer:Stop()
self.timer = nil
end
frontList = {}
backList = {}
FifteenDayGift:SetReward()
end
@ -86,15 +107,26 @@ function FifteenDayGift:SetSingleReward(sData,go,index)
local num = Util.GetGameObject(go,"num"):GetComponent("Text")
local back = Util.GetGameObject(go,"back")
local curTime = GetTimeStamp()
--弄一个ItemView提供点击方法
if not ItemViewList[index] then
local view = SubUIManager.Open(SubUIConfig.ItemView,icon.transform)
ItemViewList[index] = view
end
ItemViewList[index]:OnOpen(false,sData.Reward,0,false)
ItemViewList[index].gameObject:SetActive(false)
--设置图片初始角度
go:GetComponent("RectTransform").rotation = sData.State == 0 and angle[1] or angle[2]
front:GetComponent("RectTransform").rotation = sData.State == 0 and angle[1] or angle[2]
back:GetComponent("RectTransform").rotation = sData.State == 1 and angle[1] or angle[2]
--判断哪些可领取,插入表
if sData.Progress <= curTime then
table.insert(canGetList,go)
if sData.Progress <= curTime and sData.State == 0 then
table.insert(frontList,front)
table.insert(backList,back)
end
--如果已领取、可领取、不可领取显示第几天;下一领取显示时间
if sData.Progress > curTime and sData.Progress - 86400 <= curTime then
local time = sData.Progress
local time = sData.Progress - GetTimeStamp()
name.text = TimeToFelaxible(time)
if self.timer then
self.timer:Stop()
@ -111,14 +143,14 @@ function FifteenDayGift:SetSingleReward(sData,go,index)
end, 1, -1, true)
self.timer:Start()
else
name.text = itemConfig[sData.Reward[1]].Name
name.text = FixableString(itemConfig[sData.Reward[1]].Name,5)
end
--设置icon 和数量
icon.sprite = SetIcon(sData.Reward[1])
num.text = string.format("X %s",sData.Reward[2])
Util.AddOnceClick(icon.gameObject,function ()
-- body
ItemViewList[index]:OnBtnCkickEvent(sData.Reward[1])
end)
end
@ -137,6 +169,9 @@ function FifteenDayGift:OnDestroy()
self.timer = nil
end
itemList = {}
ItemViewList = {}
frontList = {}
backList = {}
end
return FifteenDayGift

View File

@ -634,6 +634,18 @@ function ItemView:OnBtnCkickEvent(itemSId)
if lanTuData then
UIManager.OpenPanel(UIName.WorkShopArmorOnePanel,3,3, lanTuData[2])
end
elseif (itemDataConFig.ItemType == ItemType.Talisman) or (itemDataConFig.ItemType == ItemType.EquipTreasure) then
--魂宝灵宝
UIManager.OpenPanel(UIName.RewardTalismanSingleShowPopup,2,"",itemDataConFig.Id,0,0)
elseif itemDataConFig.ItemType == ItemType.HunYin then
--魂印
UIManager.OpenPanel(UIName.SoulPrintPopUp,0,nil,itemSId,nil,nil)
elseif itemDataConFig.ItemType == ItemType.LingShou then
--灵兽
UIManager.OpenPanel(UIName.PokemonGetInfoPopup, false,itemDataConFig.Id)
elseif itemDataConFig.ItemType == ItemType.SelfBox then
--道具自选箱
UIManager.OpenPanel(UIName.RewardBoxPanel,nil,itemDataConFig.Id)
else
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, itemDataConFig.Id,nil,self.isRewardItemPop)
end