593 lines
24 KiB
Lua
593 lines
24 KiB
Lua
require("Base/BasePanel")
|
||
GMTurnTablePanel = Inherit(BasePanel)
|
||
local this = GMTurnTablePanel
|
||
|
||
---背景盘图片切换资源名
|
||
local BgName={ "x_xytb_quan_01","x_xytb_quan_03","x_xytb_quan_11","x_xytb_quan_33" }
|
||
---奖盒进度圆圈资源名
|
||
local RewardName={"x_xytb_dian","x_xytb_dian_02"}
|
||
local turnsInfo={
|
||
[1]={name="超级GM转盘",id=10701,settingId=3},
|
||
[2]={name="神级GM转盘",id=10702,settingId=4},
|
||
[3]={name="无上GM转盘",id=10703,settingId=5},
|
||
}
|
||
---转盘旋转类型
|
||
local TableTurnType={
|
||
Normal=1,--默认旋转
|
||
Expedite=2,--加快旋转
|
||
}
|
||
|
||
local curTurnPos=1 --当前位置
|
||
this.thread=nil --协程
|
||
|
||
this.refreshTimer=nil
|
||
this.upView = nil
|
||
local priId=0
|
||
local maxTimesCount = 0
|
||
local isPlayVideo = false
|
||
local leftTime=0
|
||
local curTreasureType=0
|
||
function GMTurnTablePanel:New(gameObject)
|
||
local b = {}
|
||
b.gameObject = gameObject
|
||
b.transform = gameObject.transform
|
||
setmetatable(b, { __index = GMTurnTablePanel })
|
||
return b
|
||
end
|
||
---初始化组件(用于子类重写)
|
||
function GMTurnTablePanel:InitComponent(gameObject)
|
||
this.spLoader = SpriteLoader.New()
|
||
--LuckyTurnTableManager.GetLuckyTurnRequest()
|
||
|
||
this.luckyTurnPanel=Util.GetGameObject(self.gameObject,"Panel")
|
||
this.upView = SubUIManager.Open(SubUIConfig.UpView, this.luckyTurnPanel.transform, { showType = UpViewOpenType.ShowLeft })
|
||
this.mask=Util.GetGameObject(this.luckyTurnPanel,"Mask")
|
||
this.helpBtn=Util.GetGameObject(this.luckyTurnPanel,"HelpBtn")
|
||
this.helpPosition=this.helpBtn:GetComponent("RectTransform").localPosition
|
||
this.backBtn=Util.GetGameObject(this.luckyTurnPanel,"BackBtn")
|
||
--this.activityCountDownText = Util.GetGameObject(this.luckyTurnPanel, "CountDownTimeText"):GetComponent("Text")--活动倒计时
|
||
local top=Util.GetGameObject(this.luckyTurnPanel, "Top")
|
||
this.gmBtns={}
|
||
for i = 1, 3 do
|
||
this.gmBtns[i]={}
|
||
this.gmBtns[i].btn=Util.GetGameObject(this.luckyTurnPanel, "Top/btn"..i)
|
||
this.gmBtns[i].selectImg=Util.GetGameObject(this.luckyTurnPanel, "Top/btn"..i.."/SelectBG")
|
||
this.gmBtns[i].selectImg:SetActive(false)
|
||
this.gmBtns[i].nameTxt=Util.GetGameObject(this.luckyTurnPanel, "Top/btn"..i.."/Text"):GetComponent("Text")
|
||
this.gmBtns[i].nameTxt.text=turnsInfo[i].name
|
||
this.gmBtns[i].red=Util.GetGameObject(this.luckyTurnPanel, "Top/btn"..i.."/redPoint")
|
||
end
|
||
this.bg1=Util.GetGameObject(this.luckyTurnPanel, "Content/TurnTableImage/BG/BG1"):GetComponent("Image")
|
||
this.bg2=Util.GetGameObject(this.luckyTurnPanel, "Content/TurnTableImage/BG/BG2"):GetComponent("Image")
|
||
---跑马灯位置(物品位置)
|
||
this.itemList={}
|
||
this.itemQuality = {}
|
||
for i = 1,8 do
|
||
this.itemList[i]=Util.GetGameObject(this.luckyTurnPanel, "Content/TurnTableImage/ItemList/Item"..i)
|
||
this.itemQuality[i]= Util.GetGameObject(this.itemList[i], "quality"):GetComponent("Image")
|
||
end
|
||
|
||
this.itemEffectIcon={}--跑马灯亮灯
|
||
this.itemViewList={}--跑马灯itemviewList
|
||
local tab={{14,0},{3,0},{12001,0},{5,0},{4,0},{21,0},{60068,0},{60071,0}}---防白片临时数据
|
||
for i = 1, 8 do
|
||
this.itemEffectIcon[i]=Util.GetGameObject(this.itemList[i], "Image")
|
||
this.itemViewList[i]=SubUIManager.Open(SubUIConfig.ItemView, this.itemList[i].transform)
|
||
this.itemViewList[i]:OnOpen(false, {tab[1][1],tab[1][2]},1)
|
||
end
|
||
--记录
|
||
this.recordTextList={}
|
||
for i = 1,6 do
|
||
this.recordTextList[i]=Util.GetGameObject(this.luckyTurnPanel, "Content/TreasureRecord/RecordTextList/Text"..i):GetComponent("Text")
|
||
end
|
||
|
||
--拥有道具数量
|
||
this.propBtn=Util.GetGameObject(this.luckyTurnPanel,"Content/Prop")
|
||
this.propImage= Util.GetGameObject(this.luckyTurnPanel, "Content/Prop/PropImage"):GetComponent("Image")--道具
|
||
this.propText=Util.GetGameObject(this.luckyTurnPanel, "Content/Prop/PropText"):GetComponent("Text")
|
||
|
||
this.bottom=Util.GetGameObject(this.luckyTurnPanel,"Bottom")
|
||
this.treasureOnceBtn=Util.GetGameObject(this.bottom,"TreasureOnceBtn")
|
||
this.treasureOnceText=Util.GetGameObject(this.treasureOnceBtn,"Text"):GetComponent("Text")--探宝次数
|
||
this.treasureOnceIcon=Util.GetGameObject(this.treasureOnceBtn,"Icon"):GetComponent("Image")--消耗道具图标
|
||
this.treasureOnceNum=Util.GetGameObject(this.treasureOnceBtn,"Num"):GetComponent("Text")--消耗道具数量
|
||
this.treasureMultipleBtn=Util.GetGameObject(this.bottom,"TreasureMultipleBtn")
|
||
this.treasureMultipleText=Util.GetGameObject(this.treasureMultipleBtn,"Text"):GetComponent("Text")
|
||
this.treasureMultipleIcon=Util.GetGameObject(this.treasureMultipleBtn,"Icon"):GetComponent("Image")
|
||
this.treasureMultipleNum=Util.GetGameObject(this.treasureMultipleBtn,"Num"):GetComponent("Text")
|
||
this.treasureMultipleRed=Util.GetGameObject(this.treasureMultipleBtn,"red")
|
||
this.refreshBtn=Util.GetGameObject(this.bottom,"RefreshBtn")
|
||
this.freeDetail=Util.GetGameObject(this.refreshBtn,"FreeDetail")
|
||
this.detail=Util.GetGameObject(this.refreshBtn,"Detail")
|
||
this.costItemImage=Util.GetGameObject(this.detail,"CostItemImage"):GetComponent("Image")
|
||
this.costItemNumText=Util.GetGameObject(this.detail,"CostItemNumText"):GetComponent("Text")
|
||
this.freeRefreshTime=Util.GetGameObject(this.luckyTurnPanel,"FreeRefreshTime/Text"):GetComponent("Text")
|
||
this.leftTimeTxt=Util.GetGameObject(this.luckyTurnPanel,"leftTimeTxt/Text1"):GetComponent("Text")
|
||
this.infoTxt=Util.GetGameObject(this.luckyTurnPanel,"Content/Text"):GetComponent("Text")
|
||
this.progressTxt=Util.GetGameObject(this.luckyTurnPanel,"Content/progress"):GetComponent("Text")
|
||
-- 奖励预览
|
||
this.btnPreview = Util.GetGameObject(self.gameObject, "Panel/btnPreview")
|
||
this.maxTimes = Util.GetGameObject(self.gameObject, "Panel/maxTimes"):GetComponent("Text")
|
||
|
||
this.itemRewardList = {}
|
||
end
|
||
|
||
---绑定事件(用于子类重写)
|
||
function GMTurnTablePanel:BindEvent()
|
||
--帮助按钮
|
||
Util.AddClick(this.helpBtn,function()
|
||
--Log("==YSP==点击帮助按钮")
|
||
UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.LuckyTurn,this.helpPosition.x,this.helpPosition.y)
|
||
end)
|
||
--返回按钮
|
||
Util.AddClick(this.backBtn,function()
|
||
self:ClosePanel()
|
||
end)
|
||
|
||
for i = 1, 3 do
|
||
Util.AddClick(this.gmBtns[i].btn, function()
|
||
--Log("==YSP==点击幸运探宝按钮")
|
||
if LuckyTurnTableManager.curTreasureType==this.gmBtns[i].id then
|
||
return
|
||
end
|
||
this.ClearDefault()
|
||
this.gmBtns[i].selectImg:SetActive(true)
|
||
this.gmBtns[i].nameTxt.color=Color.New(1,0.95,0.85,1)
|
||
this.SwitchTreasureType(turnsInfo[i].id)
|
||
end)
|
||
end
|
||
--幸运值奖励预览遮罩按钮
|
||
-- Util.AddClick(this.rewardPanelMaskBtn, function()
|
||
-- this.rewardPanelMaskBtn.gameObject:SetActive(false)
|
||
-- this.rewardPanel.gameObject:SetActive(false)
|
||
-- end)
|
||
|
||
Util.AddClick(this.btnPreview, function()
|
||
UIManager.OpenPanel(UIName.RewardPreviewPopup, LuckyTurnTableManager.curTreasureType == TreasureType.Lucky and PRE_REWARD_POOL_TYPE.LUCK_FIND or PRE_REWARD_POOL_TYPE.UPPER_LUCK_FIND)
|
||
end)
|
||
end
|
||
|
||
---添加事件监听(用于子类重写)
|
||
function GMTurnTablePanel:AddListener()
|
||
Game.GlobalEvent:AddEvent(GameEvent.Activity.OnLuckyTableWorldMessage, this.ShowRecordMessage)
|
||
Game.GlobalEvent:AddEvent(GameEvent.Activity.OnLuckyTableZeroRefresh, this.OnShowPanelData)
|
||
end
|
||
|
||
---移除事件监听(用于子类重写)
|
||
function GMTurnTablePanel:RemoveListener()
|
||
Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnLuckyTableWorldMessage, this.ShowRecordMessage)
|
||
Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnLuckyTableZeroRefresh, this.OnShowPanelData)
|
||
end
|
||
|
||
---界面打开时调用(用于子类重写)
|
||
function GMTurnTablePanel:OnOpen(_TreasureType)
|
||
LuckyTurnTableManager.curTreasureType=TreasureType.Lucky
|
||
end
|
||
|
||
---界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
||
function GMTurnTablePanel:OnShow()
|
||
self.gameObject:SetActive(true)
|
||
this.ClearDefault()
|
||
this.upView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.LuckyTreasure })
|
||
this.gmBtns[1].selectImg:SetActive(true)
|
||
this.gmBtns[1].nameTxt.color=Color.New(1,0.95,0.85,1)
|
||
this.LuckyTurnOnShow(LuckyTurnTableManager.curTreasureType)
|
||
--显示免费刷新状态
|
||
this.RefreshBtnCountDown()
|
||
end
|
||
function this.OnShowPanelData()
|
||
this.LuckyTurnOnShow(curTreasureType)
|
||
end
|
||
local sortingOrder = 0
|
||
---重设层级
|
||
function GMTurnTablePanel:OnSortingOrderChange(sort)
|
||
sortingOrder =sort
|
||
for i, v in pairs(this.itemViewList) do
|
||
v:SetEffectLayer(sortingOrder)
|
||
end
|
||
end
|
||
|
||
---界面关闭时调用(用于子类重写)
|
||
function GMTurnTablePanel:OnClose()
|
||
--Log("==YSP== 关闭幸运转盘")
|
||
curTreasureType=TreasureType.Lucky
|
||
LuckyTurnTableManager.curTreasureType=TreasureType.Lucky
|
||
RedpotManager.CheckRedPointStatus(RedPointType.LuckyTurn)
|
||
-- this.rewardPanel.gameObject:SetActive(false)
|
||
if this.thread then
|
||
coroutine.stop(this.thread)
|
||
this.thread=nil
|
||
end
|
||
if this.turnEffect then
|
||
this.turnEffect:Stop()
|
||
this.turnEffect=nil
|
||
end
|
||
if this.refreshTimer then
|
||
this.refreshTimer:Stop()
|
||
this.refreshTimer=nil
|
||
end
|
||
if this.timer then
|
||
this.timer:Stop()
|
||
this.timer = nil
|
||
end
|
||
if LuckyTurnTableManager._CountDownTimer then
|
||
LuckyTurnTableManager._CountDownTimer:Stop()
|
||
LuckyTurnTableManager._CountDownTimer=nil
|
||
end
|
||
self.gameObject:SetActive(false)
|
||
LuckyTurnTableManager.ClearSaveData()
|
||
end
|
||
|
||
---界面销毁时调用(用于子类重写)
|
||
function GMTurnTablePanel:OnDestroy()
|
||
this.spLoader:Destroy()
|
||
this.itemViewList=nil
|
||
this.itemRewardList = {}
|
||
-- this.rewardItemView=nil
|
||
SubUIManager.Close(this.upView)
|
||
end
|
||
|
||
---打开面板
|
||
function this.LuckyTurnOnShow(treasureType)
|
||
if not this.turnEffect then
|
||
this.turnEffect=Timer.New(nil,1,-1,true)
|
||
end
|
||
if not this.refreshTimer then
|
||
this.refreshTimer=Timer.New(nil,1,-1,true)
|
||
end
|
||
--初始化幸运探宝
|
||
this.SwitchTreasureType(treasureType)
|
||
this.SetTableTurnEffect(TableTurnType.Normal)
|
||
end
|
||
|
||
|
||
---切换探宝类型
|
||
function this.SwitchTreasureType(treasureType)
|
||
LogError("treasureType=="..treasureType)
|
||
curTreasureType=treasureType
|
||
local miss=ActivityGiftManager.GetActivityInfo(treasureType,treasureType)
|
||
priId=ConfigManager.GetConfigData(ConfigName.GlobalActivity,treasureType).Privilege
|
||
LogError("pridi--"..priId)
|
||
LuckyTurnTableManager.curTreasureType=treasureType
|
||
this.bg1.sprite=this.spLoader:LoadSprite(BgName[1])
|
||
this.bg2.sprite=this.spLoader:LoadSprite(BgName[2])
|
||
this.RrFreshInfo()
|
||
local rewardConfig=ConfigManager.GetConfigDataByDoubleKey(ConfigName.DialRewardConfig,"ActivityId",treasureType,"Rank",1)
|
||
local aaa="保底"..rewardConfig.MaxGoalCount.."次中超级大奖"
|
||
this.infoTxt.text= aaa
|
||
this.progressTxt.text=miss.progress.."/"..rewardConfig.MaxGoalCount
|
||
--请求跑马灯物品数据
|
||
NetManager.GetLuckyWheelRequest(treasureType,function(msg)
|
||
LuckyTurnTableManager.luckyData=msg.dialInfo[1].rewardInfo
|
||
this.SetItemViewShow(msg.dialInfo[1].rewardInfo,function()
|
||
this.SetItemViewGray(msg.dialInfo[1].rewardInfo)
|
||
end)
|
||
end)
|
||
--立即刷新一次转盘记录
|
||
if (LuckyTurnTableManager.isCanGetWorldMessage) then
|
||
LuckyTurnTableManager.TimeUpdate()
|
||
end
|
||
--启动定时刷新转盘记录
|
||
LuckyTurnTableManager.StartLuckyTurnRecordDataUpdate()
|
||
--设置需要材料显示
|
||
this.SetPropShow(60,treasureType)
|
||
--探宝按钮显示
|
||
this.SetTreasureBtnShow(treasureType)
|
||
--探宝泉预览
|
||
Util.AddOnceClick(this.propBtn,function()
|
||
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,60)
|
||
end)
|
||
--探宝1次按钮
|
||
Util.AddOnceClick(this.treasureOnceBtn, function()
|
||
local oneData,moreData,icon=LuckyTurnTableManager.GetTreasureBtnInfo(this.spLoader, treasureType)
|
||
LogError("lefttime=="..leftTime.." onedata[1]=="..oneData[1].." max=="..maxTimesCount)
|
||
if LuckyTurnTableManager.GetTreasureTicketNum(treasureType)-oneData[2]>=0
|
||
and leftTime >= oneData[1] then
|
||
LuckyTurnTableManager.GetLuckyTurnRankRequest(treasureType,false,priId,function()
|
||
PrivilegeManager.SetPrivilegeUsedTimesById(priId,oneData[1])
|
||
|
||
this.SetTableTurnEffect(TableTurnType.Expedite,treasureType,1)
|
||
local miss=ActivityGiftManager.GetActivityInfo(treasureType,treasureType)
|
||
this.progressTxt.text=miss.progress.."/"..rewardConfig.MaxGoalCount
|
||
this.RrFreshInfo()
|
||
isPlayVideo = true
|
||
this.SetTreasureBtnShow(treasureType)
|
||
end)
|
||
else
|
||
--PopupTipPanel.ShowTip("幸运探宝券不足!")
|
||
if leftTime < oneData[1] then
|
||
PopupTipPanel.ShowTip(Language[11158])
|
||
return
|
||
else
|
||
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,16,nil)
|
||
end
|
||
end
|
||
end)
|
||
--探宝10次按钮
|
||
Util.AddOnceClick(this.treasureMultipleBtn, function()
|
||
local oneData,moreData,icon=LuckyTurnTableManager.GetTreasureBtnInfo(this.spLoader, treasureType)
|
||
if LuckyTurnTableManager.GetTreasureTicketNum(treasureType)-moreData[2]>=0
|
||
and leftTime >= moreData[1] then
|
||
LuckyTurnTableManager.GetLuckyTurnRankRequest(treasureType,true,priId,function()
|
||
this.SetTableTurnEffect(TableTurnType.Expedite,treasureType,1)
|
||
PrivilegeManager.SetPrivilegeUsedTimesById(priId,moreData[1])
|
||
local miss=ActivityGiftManager.GetActivityInfo(treasureType,treasureType)
|
||
this.progressTxt.text=miss.progress.."/"..rewardConfig.MaxGoalCount
|
||
LogError("moredata[1]==="..moreData[1])
|
||
this.RrFreshInfo()
|
||
isPlayVideo = true
|
||
this.SetTreasureBtnShow(treasureType)
|
||
end)
|
||
else
|
||
--PopupTipPanel.ShowTip("幸运探宝券不足!")
|
||
if leftTime < moreData[1] then
|
||
PopupTipPanel.ShowTip(Language[11158])
|
||
return
|
||
else
|
||
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,16,nil)
|
||
end
|
||
end
|
||
end)
|
||
|
||
RedpotManager.CheckRedPointStatus(RedPointType.LuckyTurn)
|
||
|
||
|
||
this.mask.transform:SetAsLastSibling();
|
||
this.ShowRecordMessage(LuckyTurnTableManager.curTreasureType)
|
||
end
|
||
|
||
---重置默认
|
||
function this.ClearDefault()
|
||
for i = 1, 3 do
|
||
this.gmBtns[i].selectImg:SetActive(false)
|
||
this.gmBtns[i].nameTxt.color=Color.New(0.71,0.64,0.51,1)
|
||
end
|
||
|
||
end
|
||
|
||
---设置转盘滚动 1旋转类型 2探宝类型 3服务器给的探宝后位置
|
||
function this.SetTableTurnEffect(turnType,treasureType,pos)
|
||
if turnType==TableTurnType.Normal then --默认旋转
|
||
this.TurnEffectReset(0.5)
|
||
this.turnEffect:Start()
|
||
elseif turnType==TableTurnType.Expedite then --抽奖旋转 至指定位置
|
||
this.DelayMaskWithBool(true)
|
||
LuckyTurnTableManager.isCanGetWorldMessage=false
|
||
this.TurnEffectReset(0.05)
|
||
this.turnEffect:Start()
|
||
this.thread=coroutine.start(function()
|
||
--coroutine.wait(1)--2
|
||
--this.TurnEffectReset(0.2)
|
||
--coroutine.wait(0.4)--0.8
|
||
this.TurnEffectReset(0,true,pos,function()--当效果播放完毕后 从管理器取得数据
|
||
|
||
local timer=Timer.New(function()
|
||
this.DelayMaskWithBool(false)
|
||
--if treasureType==TreasureType.Lucky then
|
||
isPlayVideo = false
|
||
UIManager.OpenPanel(UIName.RewardItemPopup,LuckyTurnTableManager.luckyTempData.drop,1,function()
|
||
this.SetTableTurnEffect(TableTurnType.Normal)--恢复转盘旋转
|
||
LuckyTurnTableManager.isCanGetWorldMessage=true
|
||
end)--打开奖励弹窗
|
||
this.SetItemViewGray(LuckyTurnTableManager.luckyData)--刷新物品是否置灰
|
||
end,0.5,1,true)
|
||
timer:Start()
|
||
end)
|
||
end)
|
||
end
|
||
end
|
||
|
||
---转盘滚动特效重设 1移动速度,值越小越快 2是否停止 3停止位置
|
||
function this.TurnEffectReset(turnSpeed,isStop,pos,func)
|
||
this.turnEffect:Reset(function()
|
||
if curTurnPos==1 then
|
||
this.itemEffectIcon[8]:SetActive(false)
|
||
else
|
||
this.itemEffectIcon[curTurnPos-1]:SetActive(false)
|
||
end
|
||
if curTurnPos>=9 then
|
||
curTurnPos=1
|
||
end
|
||
--if isStop then
|
||
-- if pos==curTurnPos then--如果停到对应位置
|
||
this.turnEffect:Stop()--暂停跑马灯
|
||
if func then--回调
|
||
func()
|
||
end
|
||
--end
|
||
--end
|
||
if isPlayVideo then
|
||
SoundManager.PlaySound(SoundConfig.UI_Xingyunzhuanpan)
|
||
end
|
||
this.itemEffectIcon[curTurnPos]:SetActive(true)
|
||
curTurnPos=curTurnPos+1
|
||
end,turnSpeed,-1,true)
|
||
end
|
||
|
||
local quaImage = {
|
||
[0] = "x_xytb_jiaobiao_zh",
|
||
[1] = "x_xytb_jiaobiao_zh",
|
||
}
|
||
|
||
---设置跑马灯物品显示 func确保先生成itemview 再置灰
|
||
function this.SetItemViewShow(data,func)
|
||
if data==nil then
|
||
return
|
||
end
|
||
for i = 1, #this.itemViewList do
|
||
if data[i] then
|
||
local tab={LuckyTurnTableManager.dialRewardConfig[data[i].luckId].Reward[1],LuckyTurnTableManager.dialRewardConfig[data[i].luckId].Reward[2]}
|
||
this.itemViewList[i]:OnOpen(false, {tab[1],tab[2]},1, false, false, false, sortingOrder)
|
||
local qua= LuckyTurnTableManager.dialRewardConfig[data[i].luckId].Rare
|
||
this.itemQuality[i].sprite = this.spLoader:LoadSprite(quaImage[qua])
|
||
this.itemQuality[i]:SetNativeSize()
|
||
if qua > 0 then
|
||
this.itemQuality[i].gameObject:SetActive(true)
|
||
this.itemQuality[i].transform:SetAsLastSibling()
|
||
else
|
||
this.itemQuality[i].gameObject:SetActive(false)
|
||
end
|
||
end
|
||
end
|
||
if func then
|
||
func()
|
||
end
|
||
end
|
||
---设置跑马灯物品置灰
|
||
function this.SetItemViewGray(data)
|
||
local isNoGray=true
|
||
for i = 1, #data do
|
||
--LogError("data[i].luckId=="..data[i].luckId)
|
||
if LuckyTurnTableManager.dialRewardConfig[data[i].luckId].LimitNum~=0 then
|
||
--LogError("data[i].luckTimes=="..data[i].luckTimes)
|
||
local isGray = data[i].luckTimes >= LuckyTurnTableManager.dialRewardConfig[data[i].luckId].LimitNum
|
||
Util.SetGray(this.itemViewList[i].gameObject, isGray)
|
||
this.itemViewList[i]:SetEffectShow(not isGray)
|
||
end
|
||
if LuckyTurnTableManager.dialRewardConfig[data[i].luckId].LimitNum==0 then
|
||
Util.SetGray(this.itemViewList[i].gameObject,false)
|
||
this.itemViewList[i]:SetEffectShow(true)
|
||
end
|
||
end
|
||
end
|
||
|
||
---跑马灯记录
|
||
function this.ShowRecordMessage(type)
|
||
if LuckyTurnTableManager.isCanGetWorldMessage then
|
||
local messageList = {}
|
||
messageList = LuckyTurnTableManager.GetShowDataByType(type)
|
||
for i = 1, 6 do
|
||
if messageList[i] then
|
||
local messageSingleList = string.split(messageList[i],"|")
|
||
this.recordTextList[i].text = string.format(GetLanguageStrById(messageSingleList[1]),string.sub(messageSingleList[2], 2),string.sub(messageSingleList[3], 2),GetLanguageStrById(string.sub(messageSingleList[4], 2)))
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
|
||
---设置道具拥有显示 1道具id 2探宝类型
|
||
function this.SetPropShow(itemId,treasureType)
|
||
this.propImage.sprite=SetIcon(this.spLoader, itemId)
|
||
this.propText.text=LuckyTurnTableManager.GetTreasureTicketNum(treasureType)
|
||
end
|
||
|
||
---探宝按钮显示
|
||
function this.SetTreasureBtnShow(treasureType)
|
||
local oneData,moreData,icon=LuckyTurnTableManager.GetTreasureBtnInfo(this.spLoader, treasureType)
|
||
this.treasureOnceText.text=Language[11163]..oneData[1]..Language[10048]
|
||
this.treasureOnceNum.text=PrintWanNum2(oneData[2])
|
||
this.treasureOnceIcon.sprite=icon
|
||
this.treasureMultipleText.text=Language[11163]..moreData[1]..Language[10048]
|
||
this.treasureMultipleNum.text=PrintWanNum2(moreData[2])
|
||
this.treasureMultipleIcon.sprite=icon
|
||
this.treasureMultipleRed.gameObject:SetActive(false)
|
||
end
|
||
|
||
--------------------------------免费刷新--------------------------------
|
||
---打开、切换活动界面,刷新倒计时
|
||
function this.RefreshBtnCountDown()
|
||
if this.refreshTimer then
|
||
this.refreshTimer:Stop()
|
||
end
|
||
local time=CalculateSecondsNowTo_N_OClock(24) --BagManager.GetNextRefreshTime(62)-GetTimeStamp()
|
||
this.freeRefreshTime.text=TimeToHMS(time)--立即刷新一次
|
||
this.refreshTimer:Reset(function()
|
||
this.freeRefreshTime.text="转盘还有"..TimeToHMS(time).."刷新"
|
||
if time<0 then
|
||
time=0
|
||
this.refreshTimer:Stop()
|
||
this.freeRefreshTime.text=" "
|
||
this.SetRefreshBtnShowState(true)
|
||
NetManager.GetRefreshCountDownRequest({62})
|
||
end
|
||
time=time-1
|
||
end,1,-1,true)
|
||
this.refreshTimer:Start()
|
||
|
||
end
|
||
|
||
---控制刷新按钮的显示状态 1是否免费
|
||
function this.SetRefreshBtnShowState(isFree)
|
||
if isFree then
|
||
--Log("免费刷新")
|
||
this.freeDetail:SetActive(true)
|
||
this.detail:SetActive(false)
|
||
else
|
||
--Log("不免费刷新")
|
||
this.freeDetail:SetActive(false)
|
||
this.detail:SetActive(true)
|
||
if LuckyTurnTableManager.curTreasureType==TreasureType.Lucky then
|
||
this.costItemImage.sprite=SetIcon(this.spLoader, LuckyTurnTableManager.dialRewardSettingConfig[1].Cost[1][1])
|
||
this.costItemNumText.text=LuckyTurnTableManager.dialRewardSettingConfig[1].Cost[2][4]..Language[11164]
|
||
end
|
||
if LuckyTurnTableManager.curTreasureType==TreasureType.Advanced then
|
||
this.costItemImage.sprite=SetIcon(this.spLoader, LuckyTurnTableManager.dialRewardSettingConfig[2].Cost[1][1])
|
||
this.costItemNumText.text=LuckyTurnTableManager.dialRewardSettingConfig[2].Cost[2][4]..Language[11164]
|
||
end
|
||
end
|
||
end
|
||
|
||
---播放刷新动画
|
||
function this.PlayItemListAnim()
|
||
this.DelayMaskWithTime(1.5)
|
||
for i = 1, 8 do
|
||
this.itemList[i]:GetComponent("PlayFlyAnim"):PlayAnim(true)
|
||
end
|
||
end
|
||
-----------------------------------------------------------------------
|
||
|
||
---本地检查红点 幸运高级按钮
|
||
function this.CheckRedPoint()
|
||
|
||
end
|
||
|
||
|
||
|
||
|
||
---刷新幸运值
|
||
function this.RefreshLuckyValue()
|
||
if LuckyTurnTableManager.curTreasureType==TreasureType.Lucky then
|
||
LuckyTurnTableManager.SetLuckyValue()
|
||
local data=LuckyTurnTableManager.GetLuckyValue()
|
||
|
||
elseif LuckyTurnTableManager.curTreasureType==TreasureType.Advanced then
|
||
LuckyTurnTableManager.SetLuckyValue()
|
||
local data=LuckyTurnTableManager.GetLuckyValue()
|
||
|
||
end
|
||
end
|
||
|
||
---刷新信息
|
||
function this.RrFreshInfo()
|
||
this.RefreshLuckyValue()
|
||
this.CheckRedPoint()
|
||
local usedTime=PrivilegeManager.GetPrivilegeUsedTimesById(priId)
|
||
LogError("usedtime=="..usedTime)
|
||
maxTimesCount=ActivityGiftManager.GetTurnTableMaxTime()
|
||
leftTime=maxTimesCount - usedTime
|
||
this.leftTimeTxt.text=leftTime.."次"
|
||
--this.SetRewardBox()
|
||
-- this.RewardBgProgress()
|
||
RedpotManager.CheckRedPointStatus(RedPointType.LuckyTurn)
|
||
end
|
||
|
||
---延时遮罩 1按时间
|
||
function this.DelayMaskWithTime(delayTime)
|
||
this.mask.gameObject:SetActive(true)
|
||
local closeMask=Timer.New(function()
|
||
this.mask.gameObject:SetActive(false)
|
||
end,delayTime,1,true)
|
||
closeMask:Start()
|
||
end
|
||
---延时遮罩 1按bool
|
||
function this.DelayMaskWithBool(b)
|
||
if b then
|
||
this.mask.gameObject:SetActive(true)
|
||
else
|
||
this.mask.gameObject:SetActive(false)
|
||
end
|
||
end
|
||
|
||
|
||
return GMTurnTablePanel |