【惊喜礼盒】提交
parent
54bc0f2caa
commit
87f3fa8f64
File diff suppressed because it is too large
Load Diff
|
|
@ -1,5 +1,7 @@
|
|||
require("Base/BasePanel")
|
||||
local SurpriseBox = Inherit(BasePanel)
|
||||
local rechargeConfig = ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
|
||||
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||||
|
||||
function SurpriseBox:InitComponent()
|
||||
self.spLoader = SpriteLoader.New()
|
||||
|
|
@ -9,7 +11,7 @@ function SurpriseBox:InitComponent()
|
|||
self.itemPre = Util.GetGameObject(self.gameObject, "ItemPre")
|
||||
self.viewList = {}
|
||||
for i = 1, 4 do
|
||||
self.viewList[i] = Util.GetGameObject(self.gameObject, "panel/view/Grid/Item("..i..")")
|
||||
self.viewList[i] = Util.GetGameObject(self.gameObject, "panel/view/Grid/Item ("..i..")")
|
||||
end
|
||||
|
||||
local rootHight = self.scrollItem.transform.rect.height
|
||||
|
|
@ -21,6 +23,8 @@ function SurpriseBox:InitComponent()
|
|||
|
||||
self.itemList = {}
|
||||
self.lightList = {}
|
||||
self.jiantouList = {}
|
||||
self.itemViewList = {}
|
||||
end
|
||||
|
||||
--绑定事件(用于子类重写)
|
||||
|
|
@ -54,7 +58,7 @@ function SurpriseBox:Refresh()
|
|||
PlayerPrefs.SetInt(PlayerManager.uid.."SurpriseBoxPatFaceDay"..self.actData.value,1)
|
||||
SurpriseBox:CheckCurBox()
|
||||
SurpriseBox:SetItemList()
|
||||
-- self.scrollView:SetIndex(self.curBoxIndex)
|
||||
self.scrollView:SetIndex(self.curBoxIndex-1 > 0 and self.curBoxIndex-1 or 1)
|
||||
SurpriseBox:SetViewList()
|
||||
end
|
||||
|
||||
|
|
@ -63,6 +67,7 @@ function SurpriseBox:CheckCurBox()
|
|||
for i = 1, #self.actData.rewards do
|
||||
if self.actData.rewards[i].progress ~= 8 then
|
||||
self.curBoxIndex = self.actData.rewards[i].otherData.BuyDay
|
||||
self.PackData = self.actData.rewards[i]
|
||||
return
|
||||
end
|
||||
end
|
||||
|
|
@ -89,24 +94,28 @@ function SurpriseBox:ShowSingleData(item,data,index)
|
|||
local tipText = Util.GetGameObject(item,"Tip/Text"):GetComponent("Text")
|
||||
local price = Util.GetGameObject(item,"getBtn/Price")
|
||||
local priceText = Util.GetGameObject(item,"getBtn/Text"):GetComponent("Text")
|
||||
local jiantou = Util.GetGameObject(item,"jiantou")
|
||||
local finished = Util.GetGameObject(item,"finished")
|
||||
|
||||
img:SetActive(false)
|
||||
img:SetActive(data.otherData.Warning ~= nil)
|
||||
box.sprite = self.spLoader:LoadSprite("q_qiankun_xiangzi_01")--有色宝箱
|
||||
tip:SetActive(false)
|
||||
tipText.text = string.format("第%s天开启",NumToSimplenessFont[data.otherData.BuyDay])
|
||||
tipText.text = string.format("第%s天可购买",NumToSimplenessFont[data.otherData.BuyDay])
|
||||
price:SetActive(true)
|
||||
priceText.text = string.format("%s元",data.otherData.Price)
|
||||
lock:SetActive(false)
|
||||
light1:SetActive(false)
|
||||
light2:SetActive(false)
|
||||
light:SetActive(self.curBoxIndex == data.otherData.BuyDay)
|
||||
jiantou:SetActive(self.curBoxIndex == data.otherData.BuyDay)
|
||||
self.lightList[item] = light
|
||||
self.jiantouList[item] = jiantou
|
||||
finished:SetActive(false)
|
||||
|
||||
if data.progress == 1 then--完成所有条件,可购买
|
||||
elseif data.progress == 2 then--可见了,解锁了,未到购买时间
|
||||
elseif data.progress == 3 then--可见了,解锁了,到达购买时间,前置礼包未购买
|
||||
elseif data.progress == 4 then--可见了,解锁了,到达购买时间,前置礼包购买了,未激活月卡特权
|
||||
img:SetActive(true)
|
||||
elseif data.progress == 6 then--可见了,未解锁,可预览
|
||||
box.sprite = self.spLoader:LoadSprite("j_jingxilihe_baoxiang2")--灰色宝箱
|
||||
tip:SetActive(true)
|
||||
|
|
@ -117,6 +126,7 @@ function SurpriseBox:ShowSingleData(item,data,index)
|
|||
lock:SetActive(false)
|
||||
elseif data.progress == 8 then--买完了
|
||||
box.sprite = self.spLoader:LoadSprite("j_jingxilihe_baoxiang2")--灰色宝箱
|
||||
finished:SetActive(true)
|
||||
end
|
||||
|
||||
Util.AddOnceClick(getBtn,function ()
|
||||
|
|
@ -145,13 +155,37 @@ function SurpriseBox:ShowSingleData(item,data,index)
|
|||
for key, value in pairs(self.lightList) do
|
||||
value:SetActive(false)
|
||||
end
|
||||
for key, value in pairs(self.jiantouList) do
|
||||
value:SetActive(false)
|
||||
end
|
||||
light:SetActive(true)
|
||||
jiantou:SetActive(true)
|
||||
self.curBoxIndex = data.otherData.BuyDay
|
||||
self.PackData = data
|
||||
SurpriseBox:SetViewList()
|
||||
end)
|
||||
end
|
||||
|
||||
function SurpriseBox:SetViewList()
|
||||
-- body
|
||||
for i = 1, 4 do
|
||||
self.viewList[i]:SetActive(false)
|
||||
end
|
||||
local reward = self.PackData.otherData.Reward
|
||||
for i = 1, #reward do
|
||||
self.viewList[i]:SetActive(true)
|
||||
local icon = Util.GetGameObject(self.viewList[i],"icon"):GetComponent("Image")
|
||||
local name = Util.GetGameObject(self.viewList[i],"Text"):GetComponent("Text")
|
||||
if not self.itemViewList[i] then
|
||||
self.itemViewList[i] = SubUIManager.Open(SubUIConfig.ItemView,self.viewList[i].transform)
|
||||
end
|
||||
self.itemViewList[i]:OnOpen(false, reward[i], 0,false,false,false,self.sortingOrder)
|
||||
icon.sprite = SetIcon(self.spLoader,reward[i][1])
|
||||
name.text = string.format("%s×%s",itemConfig[reward[i][1]].Name,reward[i][2])
|
||||
|
||||
Util.AddOnceClick(icon.gameObject,function ()
|
||||
self.itemViewList[i]:OnBtnCkickEvent(reward[i][1])
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function SurpriseBox:OnClose()
|
||||
|
|
@ -163,6 +197,8 @@ function SurpriseBox:OnDestroy()
|
|||
self.viewList = {}
|
||||
self.itemList = {}
|
||||
self.lightList = {}
|
||||
self.jiantouList = {}
|
||||
self.itemViewList = {}
|
||||
end
|
||||
|
||||
return SurpriseBox
|
||||
Loading…
Reference in New Issue