2021-12-02 15:18:56 +08:00
|
|
|
|
|
|
|
|
|
local IncarnationLottery = {}
|
|
|
|
|
local sortingOrder = 0
|
|
|
|
|
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|
|
|
|
local artConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
|
|
|
|
|
local lotterySetting=ConfigManager.GetConfig(ConfigName.LotterySetting)
|
|
|
|
|
local privilegeConfig=ConfigManager.GetConfig(ConfigName.PrivilegeTypeConfig)
|
|
|
|
|
local lotterySpecialConfig = ConfigManager.GetConfig(ConfigName.LotterySpecialConfig)
|
|
|
|
|
local wishSoulData
|
|
|
|
|
function IncarnationLottery:New(gameObject)
|
|
|
|
|
local b = {}
|
|
|
|
|
b.gameObject = gameObject
|
|
|
|
|
b.transform = gameObject.transform
|
|
|
|
|
setmetatable(b, { __index = IncarnationLottery })
|
|
|
|
|
return b
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
|
function IncarnationLottery:InitComponent()
|
|
|
|
|
self.spLoader = SpriteLoader.New()
|
|
|
|
|
self.btnHelp= Util.GetGameObject(self.gameObject,"help")
|
|
|
|
|
self.helpPosition=self.btnHelp:GetComponent("RectTransform").localPosition
|
|
|
|
|
|
|
|
|
|
self.limit = Util.GetGameObject(self.gameObject,"limitdi/limit"):GetComponent("Text")
|
|
|
|
|
|
|
|
|
|
--rightUp
|
|
|
|
|
self.rightUp = Util.GetGameObject(self.gameObject,"rightUp")
|
|
|
|
|
self.btnReward = Util.GetGameObject(self.rightUp,"reward")
|
|
|
|
|
self.btnStore = Util.GetGameObject(self.rightUp,"store")
|
|
|
|
|
self.btnGift = Util.GetGameObject(self.rightUp,"gift")
|
2021-12-03 13:21:15 +08:00
|
|
|
|
self.btnGiftEffect = Util.GetGameObject(self.btnGift,"Fx_Circle 1")
|
2021-12-02 15:18:56 +08:00
|
|
|
|
self.btns = {}
|
|
|
|
|
for i = 1 , 2 do
|
|
|
|
|
self.btns[i] = {}
|
|
|
|
|
self.btns[i].btn = Util.GetGameObject(self.rightUp,"btn"..i)
|
|
|
|
|
self.btns[i].red = Util.GetGameObject(self.btns[i].btn.gameObject,"redPoint")
|
|
|
|
|
self.btns[i].info = Util.GetGameObject(self.btns[i].btn.gameObject,"layout/Text"):GetComponent("Text")
|
|
|
|
|
self.btns[i].icon = Util.GetGameObject(self.btns[i].btn.gameObject,"layout/icon"):GetComponent("Image")
|
|
|
|
|
self.btns[i].num = Util.GetGameObject(self.btns[i].btn.gameObject,"layout/num"):GetComponent("Text")
|
2021-12-06 15:53:01 +08:00
|
|
|
|
self.btns[i].reward = Util.GetGameObject(self.btns[i].btn.gameObject,"reward"):GetComponent("Text")
|
2021-12-02 15:18:56 +08:00
|
|
|
|
end
|
|
|
|
|
--center
|
|
|
|
|
self.center = Util.GetGameObject(self.gameObject,"center/TurnTable/itemlist")
|
|
|
|
|
self.icons = {}
|
2021-12-03 18:03:36 +08:00
|
|
|
|
for i = 1 , 10 do
|
2021-12-02 15:18:56 +08:00
|
|
|
|
self.icons[i] = {}
|
|
|
|
|
self.icons[i].go = Util.GetGameObject(self.center,"item"..i)
|
|
|
|
|
self.icons[i].pre = Util.GetGameObject(self.icons[i].go,"pre")
|
|
|
|
|
self.icons[i].kuang = Util.GetGameObject(self.icons[i].pre,"itemPos")
|
|
|
|
|
self.icons[i].icon = Util.GetGameObject(self.icons[i].pre,"icon"):GetComponent("Image")
|
|
|
|
|
self.icons[i].num = Util.GetGameObject(self.icons[i].pre,"numDi/Text"):GetComponent("Text")
|
2021-12-06 15:53:01 +08:00
|
|
|
|
|
2021-12-02 15:18:56 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
self.updateTimes = Util.GetGameObject(self.gameObject,"updateTimes")
|
|
|
|
|
--self.updateTimesTip = Util.GetGameObject(self.updateTimes,"Text"):GetComponent("Text")
|
|
|
|
|
self.updateTimesTip1 = Util.GetGameObject(self.updateTimes,"Text1"):GetComponent("Text")
|
|
|
|
|
self.mask = Util.GetGameObject(self.gameObject,"mask")
|
|
|
|
|
|
|
|
|
|
self._last = 0
|
|
|
|
|
self._cyclesNum = 10
|
|
|
|
|
self.reward = {}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
function IncarnationLottery:BindEvent()
|
2021-12-03 13:21:15 +08:00
|
|
|
|
Util.AddOnceClick(self.btnHelp, function()
|
|
|
|
|
UIManager.OpenPanel(UIName.HelpPopup,self.actConfig.HelpId,self.helpPosition.x,self.helpPosition.y)
|
2021-12-02 15:18:56 +08:00
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
Util.AddOnceClick(self.btnReward, function()
|
|
|
|
|
UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.RecrutDetail,self.actConfig.HelpId,self.actType,PRE_REWARD_POOL_TYPE.Incarnation,PRE_REWARD_POOL_TYPE.Incarnation)
|
|
|
|
|
end)
|
|
|
|
|
|
2021-12-03 13:21:15 +08:00
|
|
|
|
Util.AddOnceClick(self.btnStore, function()
|
2021-12-02 15:18:56 +08:00
|
|
|
|
JumpManager.GoJump(40049)
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
Util.AddOnceClick(self.btnGift,function ()
|
2021-12-03 13:21:15 +08:00
|
|
|
|
JumpManager.GoJump(40050,nil,self.actId)
|
2021-12-02 15:18:56 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
function IncarnationLottery:AddListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
function IncarnationLottery:RemoveListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
|
function IncarnationLottery:OnOpen(_activityConfig,_index,parent)
|
|
|
|
|
self.actConfig = _activityConfig
|
|
|
|
|
self.pageIndex = _index
|
|
|
|
|
self.parent = parent
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function IncarnationLottery:OnSortingOrderChange(_sortingOrder)
|
|
|
|
|
sortingOrder = _sortingOrder or 0
|
2021-12-03 13:21:15 +08:00
|
|
|
|
Util.SetParticleSortLayer(self.btnGiftEffect, sortingOrder+1)
|
2021-12-02 15:18:56 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 打开,重新打开时回调
|
|
|
|
|
function IncarnationLottery:OnShow(_sortingOrder)
|
|
|
|
|
self.gameObject:SetActive(true)
|
|
|
|
|
sortingOrder = _sortingOrder
|
2021-12-03 13:21:15 +08:00
|
|
|
|
Util.SetParticleSortLayer(self.btnGiftEffect, sortingOrder+1)
|
2021-12-02 15:18:56 +08:00
|
|
|
|
self.actId = self.actConfig.ActId
|
|
|
|
|
self.actType = self.actConfig.ActiveType > 0 and self.actConfig.ActiveType or self.actConfig.FunType
|
|
|
|
|
if self.actConfig.IfBack == 1 then
|
|
|
|
|
if self.actConfig.ActiveType > 0 then
|
|
|
|
|
local id = ActivityGiftManager.IsActivityTypeOpen(self.actConfig.ActiveType)
|
|
|
|
|
if id and id > 0 then
|
|
|
|
|
self.actId = id
|
|
|
|
|
local config = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.ActivityGroups,"PageType",self.actConfig.PageType,"ActiveType",self.actConfig.ActiveType,"ActId",id)
|
|
|
|
|
if config then
|
|
|
|
|
self.actConfig = config
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local array = ConfigManager.GetAllConfigsDataByKey(ConfigName.LotterySetting,"ActivityId",self.actId)
|
|
|
|
|
self.singleRecruit = array[1]
|
|
|
|
|
self.tenRecruit = array[2]
|
|
|
|
|
self.freeTimesId=self.singleRecruit.FreeTimes
|
|
|
|
|
self.maxtimesId=self.singleRecruit.MaxTimes
|
|
|
|
|
self:contentShow()
|
|
|
|
|
self:refreshMagicNum()
|
|
|
|
|
self:refreshBtnShow()--刷新按钮显示
|
|
|
|
|
self.center.transform.localRotation = Quaternion.Euler(Vector3.zero)
|
|
|
|
|
self._last = self.center.transform.localRotation.z
|
|
|
|
|
self:DelayMaskWithBool(false)
|
|
|
|
|
self:TurnTable(1)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--五个魂印头像
|
|
|
|
|
function IncarnationLottery:contentShow()
|
|
|
|
|
self.reward = {}
|
|
|
|
|
self.rewardWeight = {}
|
|
|
|
|
local data = RecruitManager.GetRewardPreviewData(PRE_REWARD_POOL_TYPE.Incarnation)
|
|
|
|
|
for i = 1 , #self.icons do
|
|
|
|
|
local str1 = data[i].Reward[1].."#"..data[i].Reward[2]
|
2021-12-03 18:03:36 +08:00
|
|
|
|
self.icons[i].kuang:GetComponent("Image").sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(itemConfig[data[i].Reward[1]].Quantity))
|
2021-12-02 15:18:56 +08:00
|
|
|
|
self.icons[i].icon.sprite = self.spLoader:LoadSprite(GetSpriteNameByItemId(data[i].Reward[1]))
|
|
|
|
|
self.icons[i].num.text = data[i].Reward[2]
|
|
|
|
|
self.reward[str1] = i
|
|
|
|
|
self.rewardWeight[str1] = data[i].WeightShow
|
2021-12-06 09:58:04 +08:00
|
|
|
|
Util.AddOnceClick(self.icons[i].kuang,function()
|
2022-01-12 15:38:31 +08:00
|
|
|
|
if itemConfig[data[i].Reward[1]].ItemType == ItemType.SelfBox then
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardBoxPanel,nil,data[i].Reward[1])
|
|
|
|
|
else
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,data[i].Reward[1])
|
|
|
|
|
end
|
2021-12-06 09:58:04 +08:00
|
|
|
|
end)
|
2021-12-02 15:18:56 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function IncarnationLottery:refreshMagicNum()
|
2021-12-03 13:21:15 +08:00
|
|
|
|
-- self.actData = ActivityGiftManager.GetActivityTypeInfo(self.actType)
|
|
|
|
|
self.actData = CommonActPageManager.GetData(self.actType)
|
|
|
|
|
CommonActPageManager.ShowIcon(self.btnGift,self.actData.activityId)
|
2021-12-02 15:18:56 +08:00
|
|
|
|
|
|
|
|
|
--local d = ConfigManager.GetAllConfigsDataByKey(ConfigName.LotterySpecialConfig,"Type",self.singleRecruit.MergePool)
|
|
|
|
|
--self.updateTimesTip.text = string.format("<color=#cbb981>召唤<color=#%s>%s</color>次必得红色碎片</color>","ff850c",d[1].Count - self.actData.value)
|
|
|
|
|
local endTime = ActivityGiftManager.GetTaskEndTime(self.actType) - PlayerManager.serverTime
|
|
|
|
|
self.updateTimesTip1.text = string.format("<color=#cbb981>活动剩余时间:%s</color>",self:TimeToDHMS(endTime))
|
|
|
|
|
local timeDown=CalculateSecondsNowTo_N_OClock(0)
|
|
|
|
|
self.timer = Timer.New(function()
|
|
|
|
|
if endTime < 1 then
|
|
|
|
|
self.timer:Stop()
|
|
|
|
|
self.timer = nil
|
|
|
|
|
self:OnShow(sortingOrder)
|
|
|
|
|
return
|
|
|
|
|
else
|
|
|
|
|
self.updateTimesTip1.text = string.format("<color=#cbb981>活动剩余时间:%s</color>",self:TimeToDHMS(endTime))
|
|
|
|
|
end
|
|
|
|
|
endTime = endTime - 1
|
|
|
|
|
timeDown = timeDown - 1
|
|
|
|
|
end, 1, -1, true)
|
|
|
|
|
self.timer:Start()
|
|
|
|
|
end
|
|
|
|
|
|
2021-12-06 15:53:01 +08:00
|
|
|
|
function IncarnationLottery:GetSendStr(reId)
|
|
|
|
|
local str = ""
|
|
|
|
|
if lotterySetting[reId] and lotterySetting[reId].TenTimesMustGetItem and #lotterySetting[reId].TenTimesMustGetItem > 0 then
|
|
|
|
|
for k,v in ipairs(lotterySetting[reId].TenTimesMustGetItem) do
|
|
|
|
|
if str == "" then
|
|
|
|
|
str = str.."赠送"
|
|
|
|
|
else
|
|
|
|
|
str = str.."和"
|
|
|
|
|
end
|
|
|
|
|
str = str..v[2].."个"..itemConfig[v[1]].Name
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return str
|
|
|
|
|
end
|
|
|
|
|
|
2021-12-02 15:18:56 +08:00
|
|
|
|
function IncarnationLottery:refreshBtnShow()
|
|
|
|
|
local curTimes = PrivilegeManager.GetPrivilegeUsedTimes(self.maxtimesId)
|
|
|
|
|
self.limit.text ="今日召唤上限:"..curTimes.."/"..privilegeConfig[self.maxtimesId].Condition[1][2]
|
|
|
|
|
local freeTime = 0
|
|
|
|
|
if self.freeTimesId and self.freeTimesId > 0 then
|
|
|
|
|
freeTime = PrivilegeManager.GetPrivilegeRemainValue(self.freeTimesId)
|
|
|
|
|
RecruitManager.freeUseTimeList[self.freeTimesId]=freeTime
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--按钮赋值
|
|
|
|
|
for n, m in ipairs(self.btns) do
|
|
|
|
|
--存在免费次数 并且 免费>=1 并且是1按钮
|
|
|
|
|
local isFree = freeTime >= 1 and n == 1
|
|
|
|
|
m.red.gameObject:SetActive(isFree)
|
|
|
|
|
m.icon.gameObject:SetActive(not isFree)
|
|
|
|
|
m.num.gameObject:SetActive(not isFree)
|
|
|
|
|
local itemId=0
|
|
|
|
|
local itemNum=0
|
|
|
|
|
local type = 0
|
|
|
|
|
if n == 1 then
|
|
|
|
|
type = self.singleRecruit.Id
|
2021-12-06 10:26:43 +08:00
|
|
|
|
--m.info.text = "1次"
|
2021-12-02 15:18:56 +08:00
|
|
|
|
else
|
|
|
|
|
type = self.tenRecruit.Id
|
2021-12-06 10:26:43 +08:00
|
|
|
|
--m.info.text = "10次"
|
2021-12-02 15:18:56 +08:00
|
|
|
|
end
|
|
|
|
|
local d = {}
|
|
|
|
|
if (isFree) then
|
|
|
|
|
m.info.text="免费抽取"
|
|
|
|
|
else
|
|
|
|
|
local d = RecruitManager.GetExpendData(type)
|
|
|
|
|
itemId=d[1]
|
|
|
|
|
itemNum=d[2]
|
|
|
|
|
m.icon.sprite = self.spLoader:LoadSprite(artConfig[itemConfig[itemId].ResourceID].Name)
|
|
|
|
|
m.num.text= tostring(itemNum)
|
|
|
|
|
end
|
2021-12-06 15:53:01 +08:00
|
|
|
|
m.reward.text = self:GetSendStr(n == 1 and self.singleRecruit.Id or self.tenRecruit.Id)
|
2021-12-02 15:18:56 +08:00
|
|
|
|
Util.AddOnceClick(m.btn,function()
|
|
|
|
|
if not isFree then
|
|
|
|
|
if BagManager.GetItemCountById(itemId) < itemNum then
|
|
|
|
|
PopupTipPanel.ShowTip(itemConfig[itemId].Name.."数量不足!")
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local recrutId = n == 1 and self.singleRecruit.Id or self.tenRecruit.Id
|
|
|
|
|
local recrutNum = n == 1 and 1 or 10
|
|
|
|
|
local uiName = n == 1 and UIName.QianKunBoxBuyOnePanel or UIName.QianKunBoxBuyTenPanel
|
|
|
|
|
self:Recruit(recrutNum,recrutId,uiName)
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function IncarnationLottery:Recruit(recrutType,recrutId,uiName)
|
|
|
|
|
if PrivilegeManager.GetPrivilegeUsedTimes(self.maxtimesId)+recrutType>privilegeConfig[self.maxtimesId].Condition[1][2] then
|
|
|
|
|
PopupTipPanel.ShowTip("无法超出每日召唤次数上限!")
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
RecruitManager.RecruitRequest(recrutId, function(msg)
|
|
|
|
|
PrivilegeManager.RefreshPrivilegeUsedTimes(self.maxtimesId,recrutType)--记录抽卡次数
|
|
|
|
|
--先转转盘
|
|
|
|
|
local index = 1
|
|
|
|
|
local rotate = self.center.transform.localRotation
|
|
|
|
|
|
|
|
|
|
local bestIndex = 0
|
2021-12-06 15:43:05 +08:00
|
|
|
|
if recrutId == self.tenRecruit.Id then
|
2021-12-02 15:18:56 +08:00
|
|
|
|
local weight = nil
|
|
|
|
|
for i = 1,#msg.drop.itemlist do
|
|
|
|
|
local str = msg.drop.itemlist[i].itemId.."#"..msg.drop.itemlist[i].itemNum
|
2021-12-06 15:43:05 +08:00
|
|
|
|
if self.rewardWeight[str] then
|
|
|
|
|
if not weight then
|
2021-12-02 15:18:56 +08:00
|
|
|
|
weight = self.rewardWeight[str]
|
|
|
|
|
bestIndex = self.reward[str]
|
2021-12-06 15:43:05 +08:00
|
|
|
|
else
|
2021-12-06 17:26:03 +08:00
|
|
|
|
if weight > self.rewardWeight[str] then
|
2021-12-06 15:43:05 +08:00
|
|
|
|
weight = self.rewardWeight[str]
|
|
|
|
|
bestIndex = self.reward[str]
|
|
|
|
|
end
|
2021-12-02 15:18:56 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
local drop = {}
|
|
|
|
|
drop = msg.drop.itemlist[1]
|
2021-12-06 15:43:05 +08:00
|
|
|
|
local str2 = drop.itemId.."#"..drop.itemNum
|
2021-12-02 15:18:56 +08:00
|
|
|
|
bestIndex = self.reward[drop.itemId.."#"..drop.itemNum]
|
|
|
|
|
end
|
|
|
|
|
self:TurnTable(2,bestIndex,function()
|
|
|
|
|
UIManager.OpenPanel(uiName, msg.drop,recrutId,{RecruitType.QianKunBoxTen,RecruitType.QianKunBoxTen})
|
|
|
|
|
end)
|
|
|
|
|
--UIManager.OpenPanel(uiName, msg.drop,recrutId,{RecruitType.QianKunBoxTen,RecruitType.QianKunBoxTen})
|
|
|
|
|
end,self.freeTimesId)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function IncarnationLottery:TurnTable(turnType,pos,fun)
|
|
|
|
|
if turnType == 1 then --默认旋转
|
|
|
|
|
self._cyclesNum = 43200 --一直循环
|
2021-12-03 18:03:36 +08:00
|
|
|
|
self:TurnEffectReset(60)
|
2021-12-02 15:18:56 +08:00
|
|
|
|
elseif turnType == 2 then --抽奖旋转 至指定位置
|
|
|
|
|
self:DelayMaskWithBool(true)
|
|
|
|
|
self._cyclesNum = 3
|
2021-12-03 18:03:36 +08:00
|
|
|
|
self:TurnEffectReset(2,true,pos,function()--当效果播放完毕后 从管理器取得数据
|
2021-12-02 15:18:56 +08:00
|
|
|
|
self:DelayMaskWithBool(false)
|
|
|
|
|
if fun then
|
|
|
|
|
fun()
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function IncarnationLottery:DelayMaskWithBool(isShow)
|
|
|
|
|
self.mask.gameObject:SetActive(isShow)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---转盘滚动特效重设 1移动速度,值越小越快 2是否停止 3停止位置
|
|
|
|
|
function IncarnationLottery:TurnEffectReset(turnSpeed,isStop,pos,func)
|
|
|
|
|
local s = function()
|
|
|
|
|
if isStop then
|
2021-12-07 14:41:09 +08:00
|
|
|
|
SoundManager.PlaySound(SoundConfig.Audio_fangcunzhuanpan_0)
|
2021-12-02 15:18:56 +08:00
|
|
|
|
self._last = self.center.transform.localRotation.z
|
2021-12-03 18:03:36 +08:00
|
|
|
|
local a = self._cyclesNum * -360 - (10 - pos + 1) * 36;
|
|
|
|
|
self.tween:Kill()
|
|
|
|
|
self.tween = self.center.transform:DORotate(Vector3.New(0, 0, a - self._last), turnSpeed):SetEase(Ease.OutQuad):OnComplete(function()
|
|
|
|
|
Timer.New(function()
|
2021-12-02 15:18:56 +08:00
|
|
|
|
if func then--回调
|
|
|
|
|
func()
|
2021-12-03 18:03:36 +08:00
|
|
|
|
end
|
|
|
|
|
self.tween:Kill()
|
|
|
|
|
end,0.75):Start()
|
2021-12-02 15:18:56 +08:00
|
|
|
|
end)
|
2021-12-03 18:03:36 +08:00
|
|
|
|
Timer.New(function()
|
|
|
|
|
self._last = self.center.transform.localRotation.z
|
|
|
|
|
self.center.transform:DOPunchRotation(Vector3.New(0, 0, self._last - 10),2,2,0)--:SetEase(Ease.OutQuad):SetLoops(2,0)
|
|
|
|
|
end,turnSpeed - 0.07):Start()
|
2021-12-02 15:18:56 +08:00
|
|
|
|
else
|
|
|
|
|
self.tween = self.center.transform:DORotate(Vector3.New(0, 0, self._last - 360), turnSpeed,1):SetLoops(-1,0):SetEase(Ease.Linear):OnComplete(function()
|
2021-12-03 18:03:36 +08:00
|
|
|
|
end)
|
2021-12-02 15:18:56 +08:00
|
|
|
|
end
|
2021-12-03 18:03:36 +08:00
|
|
|
|
end
|
2021-12-02 15:18:56 +08:00
|
|
|
|
s()
|
2021-12-03 18:03:36 +08:00
|
|
|
|
end
|
2021-12-02 15:18:56 +08:00
|
|
|
|
|
|
|
|
|
--- 将一段时间转换为天时分秒
|
|
|
|
|
function IncarnationLottery:TimeToDHMS(second)
|
|
|
|
|
local day = math.floor(second / (24 * 3600))
|
|
|
|
|
local minute = math.floor(second / 60) % 60
|
|
|
|
|
local sec = math.floor(second % 60)
|
|
|
|
|
local hour = math.floor(math.floor(second - day * 24 * 3600 - sec - minute * 60) / 3600)
|
|
|
|
|
if day <= 0 and hour <= 0 then
|
|
|
|
|
return string.format("%s分%s秒",minute, sec)
|
|
|
|
|
else
|
|
|
|
|
return string.format("%s天%s小时",day, hour)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
|
|
|
function IncarnationLottery:OnClose()
|
|
|
|
|
self.gameObject:SetActive(false)
|
|
|
|
|
if self.timer then
|
|
|
|
|
self.timer:Stop()
|
|
|
|
|
self.timer = nil
|
|
|
|
|
end
|
|
|
|
|
if self.shopView then
|
|
|
|
|
SubUIManager.Close(self.shopView)
|
|
|
|
|
end
|
|
|
|
|
self.shopView = nil
|
|
|
|
|
end
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
|
function IncarnationLottery:OnDestroy()
|
|
|
|
|
self.btns = {}
|
|
|
|
|
if self.shopView then
|
|
|
|
|
SubUIManager.Close(self.shopView)
|
|
|
|
|
end
|
|
|
|
|
self.shopView = nil
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return IncarnationLottery
|