parent
cea14746f8
commit
aeecd125e0
File diff suppressed because it is too large
Load Diff
|
@ -113,6 +113,13 @@ function this.CheckRedPointLingLong()
|
|||
if BagManager.GetItemCountById(costId) > 0 then
|
||||
return true
|
||||
end
|
||||
local actconfigs = ActivityGiftManager.GetActivityInfoByType(self.actId)
|
||||
for i = 1,#actconfigs.mission do
|
||||
local config = ConfigManager.GetConfigData(ConfigName.ActivityRewardConfig,actconfigs.mission[i].missionId)
|
||||
if actconfigs.mission[i].progress >= config.Values[1][1] and actconfigs.mission[i].state == 0 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ local a,b,c,d
|
|||
local configs
|
||||
local isClose = false
|
||||
local drop = nil
|
||||
local skip = 0
|
||||
local actconfigs
|
||||
---初始化组件(用于子类重写)
|
||||
function LingLongBaoJingPanel:InitComponent(gameObject)
|
||||
self.spLoader = SpriteLoader.New()
|
||||
|
@ -81,24 +83,39 @@ function LingLongBaoJingPanel:InitComponent(gameObject)
|
|||
self.helpBtn = Util.GetGameObject(self.luckyTurnPanel,"button/helpBtn")
|
||||
self.helpPosition = Util.GetGameObject(self.luckyTurnPanel,"BG/helpPos"):GetComponent("RectTransform").localPosition
|
||||
|
||||
-- self.slider = Util.GetGameObject(self.luckyTurnPanel,"Slider")
|
||||
-- self.luckyValueNum = Util.GetGameObject(self.slider, "LuckyValue/LuckyValueNum"):GetComponent("Text")--幸运值
|
||||
-- self.luckySlider = Util.GetGameObject(self.slider, "LuckySlider"):GetComponent("Slider")
|
||||
self.slider = Util.GetGameObject(self.luckyTurnPanel,"Slider")
|
||||
self.luckyValueNum = Util.GetGameObject(self.slider, "LuckyValue/LuckyValueNum"):GetComponent("Text")--幸运值
|
||||
self.luckySlider = Util.GetGameObject(self.slider, "LuckySlider"):GetComponent("Slider")
|
||||
|
||||
-- self.rewardBoxList={}--奖励盒
|
||||
-- self.rewardBox=Util.GetGameObject(self.slider,"RewardBox")
|
||||
-- for i=1,5 do
|
||||
-- if not self.rewardBoxList[i] then
|
||||
-- self.rewardBoxList[i] = {}
|
||||
-- end
|
||||
-- self.rewardBoxList[i].go=Util.GetGameObject(self.rewardBox,"Item"..i)
|
||||
-- self.rewardBoxList[i].icon =Util.GetGameObject(self.rewardBoxList[i].go,"icon"):GetComponent("Image")--幸运值
|
||||
-- self.rewardBoxList[i].value =Util.GetGameObject(self.rewardBoxList[i].go,"Value"):GetComponent("Text")--幸运值
|
||||
-- self.rewardBoxList[i].redPoint=Util.GetGameObject(self.rewardBoxList[i].go,"redPoint")
|
||||
-- self.rewardBoxList[i].Num=Util.GetGameObject(self.rewardBoxList[i].go,"Num/Text"):GetComponent("Text")--幸运值
|
||||
-- end
|
||||
-- self.itemRewardList = {}
|
||||
self.rewardBoxList={}--奖励盒
|
||||
self.rewardBox=Util.GetGameObject(self.slider,"RewardBox")
|
||||
self.itemRewardList = {}
|
||||
local bg1 = Util.GetGameObject(self.slider, "BG")
|
||||
for i=1,5 do
|
||||
if not self.itemRewardList[i] then
|
||||
self.itemRewardList[i] = SubUIManager.Open(SubUIConfig.ItemView,bg1.transform)
|
||||
end
|
||||
self.itemRewardList[i].gameObject:SetActive(false)
|
||||
|
||||
if not self.rewardBoxList[i] then
|
||||
self.rewardBoxList[i] = {}
|
||||
end
|
||||
self.rewardBoxList[i].go=Util.GetGameObject(self.rewardBox,"Item"..i)
|
||||
self.rewardBoxList[i].icon =Util.GetGameObject(self.rewardBoxList[i].go,"BG"):GetComponent("Image")--幸运值
|
||||
self.rewardBoxList[i].value =Util.GetGameObject(self.rewardBoxList[i].go,"Value"):GetComponent("Text")--幸运值
|
||||
self.rewardBoxList[i].redPoint=Util.GetGameObject(self.rewardBoxList[i].go,"redPoint")
|
||||
self.rewardBoxList[i].Num=Util.GetGameObject(self.rewardBoxList[i].go,"Num/Text"):GetComponent("Text")--幸运值
|
||||
end
|
||||
|
||||
|
||||
self.skip = Util.GetGameObject(self.gameObject,"button/skip")
|
||||
self.check = Util.GetGameObject(self.skip,"Go")
|
||||
|
||||
if not PlayerPrefs.HasKey("Linglongbaojing_SkipAnim"..PlayerManager.uid) then
|
||||
PlayerPrefs.SetInt("Linglongbaojing_SkipAnim"..PlayerManager.uid,0)
|
||||
end
|
||||
skip = PlayerPrefs.GetInt("Linglongbaojing_SkipAnim"..PlayerManager.uid)
|
||||
self.check.gameObject:SetActive(skip ~= 0)
|
||||
local config = ConfigManager.GetConfigData(ConfigName.SpecialConfig,117)
|
||||
local strs = string.split(config.Value,"|")
|
||||
self.costId = tonumber(strs[1])
|
||||
|
@ -121,6 +138,12 @@ function LingLongBaoJingPanel:BindEvent()
|
|||
UIManager.OpenPanel(UIName.RewardPreviewPopup,PRE_REWARD_POOL_TYPE.LINGLONG)
|
||||
end)
|
||||
|
||||
Util.AddClick(self.skip, function()
|
||||
skip = skip == 0 and 1 or 0
|
||||
PlayerPrefs.SetInt("Linglongbaojing_SkipAnim"..PlayerManager.uid,skip)
|
||||
self.check.gameObject:SetActive(skip ~= 0)
|
||||
end)
|
||||
|
||||
Util.AddClick(self.propBtn, function()
|
||||
if not self.enough then
|
||||
PopupTipPanel.ShowTip("道具不足")
|
||||
|
@ -145,6 +168,7 @@ function LingLongBaoJingPanel:BindEvent()
|
|||
end
|
||||
LingLongBaoJingManager.SetDataListState(nil,2)
|
||||
end
|
||||
|
||||
local x = function(isGetBigReward)
|
||||
local tempData = {}
|
||||
for i = 1,#idList do
|
||||
|
@ -184,6 +208,10 @@ function LingLongBaoJingPanel:BindEvent()
|
|||
end
|
||||
end
|
||||
curTurnPos = 1
|
||||
if skip == 1 then
|
||||
x(idList[2] and idList[2] > 0)
|
||||
return
|
||||
end
|
||||
self:SetTableTurnEffect(TableTurnType.Expedite,2,data[idList[1]].address,function()
|
||||
if idList[2] and idList[2] > 0 then
|
||||
--PopupTipPanel.ShowTip("播放一些开门的特效")
|
||||
|
@ -224,12 +252,12 @@ end
|
|||
|
||||
---添加事件监听(用于子类重写)
|
||||
function LingLongBaoJingPanel:AddListener()
|
||||
|
||||
Game.GlobalEvent:AddEvent(GameEvent.Activity.OnActivityProgressStateChange,self.RefreshProgress1)
|
||||
end
|
||||
|
||||
---移除事件监听(用于子类重写)
|
||||
function LingLongBaoJingPanel:RemoveListener()
|
||||
|
||||
Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnActivityProgressStateChange,self.RefreshProgress1)
|
||||
end
|
||||
|
||||
--界面打开时调用(用于子类重写)
|
||||
|
@ -269,7 +297,7 @@ function LingLongBaoJingPanel:OnShow(_sortingOrder)
|
|||
self:RefreshTreasureType()
|
||||
self:DelayMaskWithTime(0.5)
|
||||
self:SetPropShow()
|
||||
--self:CreatBox()
|
||||
self:CreatBox()
|
||||
self:SetTime()
|
||||
self:SetLayer()
|
||||
self.fx_linglongbaojing_chuxian.gameObject:SetActive(true)
|
||||
|
@ -492,43 +520,79 @@ function LingLongBaoJingPanel:SetPropShow()
|
|||
self.propText.text = string.format("<color=#%s>×%s</color>",color,singleCount)
|
||||
end
|
||||
|
||||
-- function LingLongBaoJingPanel:CreatBox()
|
||||
-- self:RefreshLuckyValue()
|
||||
-- end
|
||||
function LingLongBaoJingPanel:CreatBox()
|
||||
self:RefreshLuckyValue()
|
||||
end
|
||||
|
||||
-- ---刷新幸运值
|
||||
-- function LingLongBaoJingPanel:RefreshLuckyValue()
|
||||
-- configs = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId",self.actId)
|
||||
-- local list = {}
|
||||
-- for k,v in ipairs(configs) do
|
||||
-- table.insert(list,v.Values[1][1])
|
||||
-- end
|
||||
-- table.sort(list,function(a,b) return a < b end)
|
||||
-- local pos = self:CalutePos1(self.rewardBox,list)
|
||||
-- for i = 1,5 do
|
||||
-- local v3 = self.rewardBoxList[i].go:GetComponent("RectTransform").anchoredPosition3D
|
||||
-- v3.x = pos[i]
|
||||
-- self.rewardBoxList[i].go:GetComponent("RectTransform").anchoredPosition3D = v3
|
||||
-- self.rewardBoxList[i].value.text = configs[i].Values[1][1]
|
||||
-- self.rewardBoxList[i].redPoint.gameObject:SetActive(false)
|
||||
-- if i < 5 then
|
||||
-- self.rewardBoxList[i].Num.text = configs[i].Reward[1][2]
|
||||
-- self.rewardBoxList[i].icon.sprite = self.spLoader:LoadSprite(GetSpriteNameByItemId(configs[i].Reward[1][1]))
|
||||
-- end
|
||||
-- end
|
||||
-- self.luckySlider.minValue = 0
|
||||
-- self.luckySlider.maxValue = configs[#configs].Values[1][1]
|
||||
-- end
|
||||
---刷新幸运值
|
||||
function LingLongBaoJingPanel:RefreshLuckyValue()
|
||||
configs = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId",self.actId)
|
||||
local list = {}
|
||||
for k,v in ipairs(configs) do
|
||||
table.insert(list,v.Values[1][1])
|
||||
end
|
||||
table.sort(list,function(a,b) return a < b end)
|
||||
local pos = self:CalutePos1(self.rewardBox,list)
|
||||
for i = 1,5 do
|
||||
local v3 = self.rewardBoxList[i].go:GetComponent("RectTransform").anchoredPosition3D
|
||||
v3.x = pos[i]
|
||||
self.rewardBoxList[i].go:GetComponent("RectTransform").anchoredPosition3D = v3
|
||||
self.rewardBoxList[i].value.text = configs[i].Values[1][1].."次"
|
||||
self.rewardBoxList[i].redPoint.gameObject:SetActive(false)
|
||||
if i < 5 then
|
||||
self.rewardBoxList[i].Num.text = configs[i].Reward[1][2]
|
||||
self.rewardBoxList[i].icon.sprite = self.spLoader:LoadSprite(GetSpriteNameByItemId(configs[i].Reward[1][1]))
|
||||
end
|
||||
self.itemRewardList[i]:OnOpen(false, {configs[i].Reward[1][1],configs[i].Reward[1][2]},1, false, false, false, sortingOrder)
|
||||
Util.AddOnceClick(self.rewardBoxList[i].icon.gameObject,function()
|
||||
local mission = ActivityGiftManager.GetActivityInfo(self.actId,configs[i].Id)
|
||||
if mission.progress >= configs[i].Values[1][1] and mission.state == 0 then
|
||||
NetManager.GetActivityRewardRequest(configs[i].Id,self.actId,function(drop)
|
||||
UIManager.OpenPanel(UIName.RewardItemPopup,drop)
|
||||
self:RefreshProgress(i)
|
||||
end)
|
||||
else
|
||||
self.itemRewardList[i]:OnBtnCkickEvent(configs[i].Reward[1][1])
|
||||
end
|
||||
end)
|
||||
end
|
||||
self.luckySlider.minValue = 0
|
||||
self.luckySlider.maxValue = configs[#configs].Values[1][1]
|
||||
self:RefreshProgress()
|
||||
end
|
||||
|
||||
-- function LingLongBaoJingPanel:CalutePos1(parent,list)
|
||||
-- local pos = {}
|
||||
-- local wi = parent.transform.rect.width
|
||||
-- for i = 1,#list do
|
||||
-- local pos1 = wi *(list[i]/list[#list])
|
||||
-- table.insert(pos,pos1)
|
||||
-- end
|
||||
-- return pos
|
||||
-- end
|
||||
function LingLongBaoJingPanel:CalutePos1(parent,list)
|
||||
local pos = {}
|
||||
local wi = parent.transform.rect.width
|
||||
for i = 1,#list do
|
||||
local pos1 = wi * (list[i]/list[#list])
|
||||
table.insert(pos,pos1)
|
||||
end
|
||||
return pos
|
||||
end
|
||||
|
||||
function LingLongBaoJingPanel.RefreshProgress1()
|
||||
self:RefreshProgress()
|
||||
end
|
||||
|
||||
function LingLongBaoJingPanel:RefreshProgress(index)
|
||||
CheckRedPointStatus(RedPointType.linglongBaojing)
|
||||
actconfigs = ActivityGiftManager.GetActivityInfoByType(self.actId)
|
||||
self.luckySlider.value = actconfigs.mission[1].progress
|
||||
self.luckyValueNum.text = actconfigs.mission[1].progress.."/"..configs[#configs].Values[1][1]
|
||||
if index and index > 0 then
|
||||
self.rewardBoxList[index].redPoint.gameObject:SetActive(false)
|
||||
else
|
||||
for i = 1,#self.rewardBoxList do
|
||||
local mission = ActivityGiftManager.GetActivityInfo(self.actId,configs[i].Id)
|
||||
if mission.progress >= configs[i].Values[1][1] and mission.state == 0 then
|
||||
self.rewardBoxList[i].redPoint.gameObject:SetActive(true)
|
||||
else
|
||||
self.rewardBoxList[i].redPoint.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
---延时遮罩 1按时间
|
||||
function LingLongBaoJingPanel:DelayMaskWithTime(delayTime)
|
||||
|
|
Loading…
Reference in New Issue