超凡入圣修改提交
parent
4635361d8b
commit
10c86e509a
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fd52b845f4615b2418f482acbcb2d5c6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 080a82247ec249c46bf538b93290054e
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -453,4 +453,5 @@ SubUIConfig = {
|
|||
[25] = { name = "FuXingGaoZhaoPanel", assetName = "FuXingGaoZhaoPanel", script = "Modules/FuXingGaoZhao/FuXingGaoZhaoPanel" },
|
||||
[26] = { name = "NiuQiChongTianPanel", assetName = "NiuQiChongTianPanel", script = "Modules/NiuQiChongTian/NiuQiChongTianPanel" },
|
||||
[27] = {name = "TimeLimitUpHero",assetName = "TimeLimitUpHero",script = "Modules/DynamicActivity/TimeLimitUpHero"}, --限时英雄up界面
|
||||
[29] = {name = "UpStarPre",assetName = "UpStarPre",script = "Modules/DynamicActivity/UpStarPre"}, --限时英雄up界面
|
||||
}
|
|
@ -139,7 +139,7 @@ function this.InitActivityServerData(msg, isUpdate)
|
|||
this.CheckMoneyProgress(v)
|
||||
this.mission[v.activityId] = v
|
||||
|
||||
-- LogYellow("刷新活动数据activityId:" .. v.activityId .. " value:" .. v.value)
|
||||
LogYellow("刷新活动数据activityId:" .. v.activityId .. " value:" .. v.value)
|
||||
for n, m in ipairs(v.mission) do
|
||||
-- LogGreen(" 刷新活动数据missionId:" .. m.missionId .. " state:" .. m.state .. " progress:" .. m.progress)
|
||||
if (v.activityId == ActivityTypeDef.OnlineGift) then
|
||||
|
|
|
@ -125,10 +125,48 @@ local TypeUpdateFunc = {
|
|||
this.InitTaskData(curData,TaskTypeDef.DynamicActTask,ConfigName.ThemeActivityTaskConfig)
|
||||
end,
|
||||
[ActivityTypeDef.ChaoFanRuSheng] = function ()--主题活动任务
|
||||
-- singleTypeData = {}
|
||||
-- Log("InitData activityId:"..tostring(data.activityId).." value:"..tostring(data.value).." startTime:"..tostring(data.startTime).." endTime:"..tostring(data.endTime).." mission:"..tostring(#data.mission))
|
||||
-- singleTypeData.activityId = data.activityId
|
||||
-- singleTypeData.value = data.value
|
||||
-- singleTypeData.startTime = data.startTime
|
||||
-- singleTypeData.endTime = data.endTime
|
||||
-- singleTypeData.rewards = {}
|
||||
-- if data.mission and #data.mission > 0 then
|
||||
-- for i = 1, #data.mission do
|
||||
-- local reward = {}
|
||||
-- reward.missionId = data.mission[i].missionId or 0
|
||||
-- reward.progress = data.mission[i].progress or 0
|
||||
-- reward.state = data.mission[i].state or 0
|
||||
-- reward.otherData = {}
|
||||
-- table.insert(singleTypeData.rewards,reward)
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
local curData = dataList[ActivityTypeDef.ChaoFanRuSheng]
|
||||
this.InitMissionDdataUpStar(curData)
|
||||
end,
|
||||
}
|
||||
|
||||
function this.InitMissionDdataUpStar(curData)
|
||||
local actRewardConfigs = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId", curData.activityId)
|
||||
for i = 1, #curData.rewards do
|
||||
for j = 1, #actRewardConfigs do
|
||||
if curData.rewards[i].missionId == actRewardConfigs[j].Id then
|
||||
curData.rewards[i].state = curData.rewards[i].state
|
||||
curData.rewards[i].targetId = actRewardConfigs[j].Values[1][1]
|
||||
curData.rewards[i].targetStar = actRewardConfigs[j].Values[1][2]
|
||||
curData.rewards[i].targetNum = actRewardConfigs[j].Values[2][1]
|
||||
curData.rewards[i].giftId = actRewardConfigs[j].Values[3][1]
|
||||
curData.rewards[i].giftConfig = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig,curData.rewards[i].giftId)
|
||||
curData.rewards[i].giftShows = curData.rewards[i].giftConfig.RewardShow
|
||||
curData.rewards[i].giftData = OperatingManager.GetGiftGoodsInfo(curData.rewards[i].giftConfig.Type,curData.rewards[i].giftId)
|
||||
curData.rewards[i].FreeShows = actRewardConfigs[j].Reward
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function this.InitTaskData(curData,taskType,configName)
|
||||
local allListData = ConfigManager.GetAllConfigsDataByKey(configName, "ActivityId", curData.activityId)
|
||||
local allMissionData = TaskManager.GetTypeTaskList(taskType)
|
||||
|
|
|
@ -40,9 +40,9 @@ function this.SetBasicValues(giftGoodsList)
|
|||
if giftGoodsInfo.goodsId and giftGoodsInfo.goodsId ~= 0 then
|
||||
local rechargeConfigLocal = ConfigManager.TryGetConfigData(ConfigName.RechargeCommodityConfig, giftGoodsInfo.goodsId)
|
||||
if rechargeConfigLocal then
|
||||
-- LogBlue("------充值活动-----------礼包类型:".. rechargeConfigLocal.Type .." 礼包ID:".. giftGoodsInfo.goodsId .." 已购:"
|
||||
-- ..giftGoodsInfo.buyTimes.." 开始:"..giftGoodsInfo.startTime.." 结束:"
|
||||
-- ..giftGoodsInfo.endTime .. " 可购(没卵用):" .. giftGoodsInfo.dynamicBuyTimes)
|
||||
LogBlue("------充值活动-----------礼包类型:".. rechargeConfigLocal.Type .." 礼包ID:".. giftGoodsInfo.goodsId .." 已购:"
|
||||
..giftGoodsInfo.buyTimes.." 开始:"..giftGoodsInfo.startTime.." 结束:"
|
||||
..giftGoodsInfo.endTime .. " 可购(没卵用):" .. giftGoodsInfo.dynamicBuyTimes)
|
||||
if giftGoodsInfo.endTime == 0 and giftGoodsInfo.startTime == 0 and (rechargeConfigLocal.ShowType == 25 or rechargeConfigLocal.ShowType == 26 or rechargeConfigLocal.ShowType == 8) then
|
||||
else
|
||||
if giftGoodsInfoList[rechargeConfigLocal.Type] then
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9f6680e5797aa3a4da004c60b970a6d3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,383 @@
|
|||
UpStarPre = {}
|
||||
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||||
local parent
|
||||
function UpStarPre:New(gameObject)
|
||||
local b = {}
|
||||
b.gameObject = gameObject
|
||||
b.transform = gameObject.transform
|
||||
setmetatable(b, { __index = UpStarPre })
|
||||
return b
|
||||
end
|
||||
|
||||
--初始化组件(用于子类重写)
|
||||
function UpStarPre:InitComponent()
|
||||
self.spLoader = SpriteLoader.New()
|
||||
self.middleLayout = Util.GetGameObject(self.gameObject, "bg/middleLayout")
|
||||
|
||||
|
||||
self.btnBuy = Util.GetGameObject(self.middleLayout, "btnBuy")
|
||||
self.icon = Util.GetGameObject(self.btnBuy, "icon"):GetComponent("Image")
|
||||
self.price = Util.GetGameObject(self.btnBuy, "price"):GetComponent("Text")
|
||||
self.buyInfo = Util.GetGameObject(self.middleLayout, "buyInfo"):GetComponent("Text")
|
||||
self.redPoint = Util.GetGameObject(self.btnBuy, "redPoint")
|
||||
|
||||
self.grid1 = Util.GetGameObject(self.middleLayout, "grid1")
|
||||
self.grid2 = Util.GetGameObject(self.middleLayout, "scroller2/grid2")
|
||||
self.grid3 = Util.GetGameObject(self.middleLayout, "scroller3/grid3")
|
||||
|
||||
self.UI_Effect_MianBan_LiBao_button_01 = Util.GetGameObject(self.gameObject, "UI_Effect_MianBan_LiBao_button_01")
|
||||
self.isCanBuy = 0
|
||||
self.itemList = {}
|
||||
|
||||
self.tipRoot = Util.GetGameObject(self.upLayout,"type3")
|
||||
self.tip1 = Util.GetGameObject(self.tipRoot,"tip1")
|
||||
self.tip1_en = Util.GetGameObject(self.tipRoot,"tip1_en")
|
||||
self.tip2 = Util.GetGameObject(self.tipRoot,"tip2")
|
||||
self.tip2_en = Util.GetGameObject(self.tipRoot,"tip2_en")
|
||||
self.tip3 = Util.GetGameObject(self.tipRoot,"tip3")
|
||||
self.tip3_en = Util.GetGameObject(self.tipRoot,"tip3_en")
|
||||
self.tip4 = Util.GetGameObject(self.tipRoot,"tip4")
|
||||
self.tip4_en = Util.GetGameObject(self.tipRoot,"tip4_en")
|
||||
self.tip5 = Util.GetGameObject(self.tipRoot,"tip5")
|
||||
self.tip5Text = Util.GetGameObject(self.tip5,"Text"):GetComponent("Text")
|
||||
end
|
||||
|
||||
--绑定事件(用于子类重写)
|
||||
function UpStarPre:BindEvent()
|
||||
Util.AddOnceClick(self.btnBuy, function()
|
||||
if self.isCanBuy == 1 then -- 0 可购买 1购买条件不足 2已购买
|
||||
PopupTipPanel.ShowTip(Language[11701])
|
||||
elseif self.isCanBuy == 2 then
|
||||
PopupTipPanel.ShowTip(Language[10515])
|
||||
else
|
||||
--道具商品
|
||||
if self.data.DataType == DataType.Shop then
|
||||
self:BuyAction(self.data.data.costId, self.data.data.finalNum, self.data.buyType, self.data.data.shopData.id)--特权商城
|
||||
CheckRedPointStatus(RedPointType.GrowthPackage)
|
||||
else
|
||||
--直购商品
|
||||
PayManager.Pay(self.data.data.shopData.goodsId, function(id)
|
||||
FirstRechargeManager.RefreshAccumRechargeValue(self.data.data.shopData.goodsId)
|
||||
CheckRedPointStatus(RedPointType.DailyGift)
|
||||
CheckRedPointStatus(RedPointType.WeekGiftPage)
|
||||
CheckRedPointStatus(RedPointType.MonthGiftPage)
|
||||
CheckRedPointStatus(RedPointType.GrowthPackage)
|
||||
self.parent:RefreshData(nil,false,false)
|
||||
end)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
--购买点击事件
|
||||
function UpStarPre:BuyAction(costId, costNum, shopType, itemId)
|
||||
local haveNum = BagManager.GetItemCountById(costId)
|
||||
local costName = ConfigManager.GetConfigData(ConfigName.ItemConfig, costId).Name
|
||||
--Log("需要消耗的道具ID" .. costId)
|
||||
if haveNum < costNum then
|
||||
NotEnoughPopup:Show(costId)
|
||||
else
|
||||
local func = function(shopType, itemId)
|
||||
ShopManager.RequestBuyShopItem(shopType, itemId, 1, function()
|
||||
self.parent:RefreshData(nil,false,false)
|
||||
CheckRedPointStatus(RedPointType.DailyGift)
|
||||
CheckRedPointStatus(RedPointType.GrowthPackage)
|
||||
if shopType==20 and (itemId==1107 or itemId==1110 or itemId==1111 or itemId==1108 )then
|
||||
PlayerPrefs.SetString(PlayerManager.uid..PlayerManager.serverInfo.server_id.."supermeMan",666)
|
||||
end
|
||||
end)
|
||||
end
|
||||
local isPopUp = RedPointManager.PlayerPrefsGetStr(PlayerManager.uid .. shopType)
|
||||
local currentTime = os.date("%Y%m%d", PlayerManager.serverTime)
|
||||
if (isPopUp ~= currentTime and costNum ~= 0) then
|
||||
local str = string.format(Language[11360], costNum, costName)
|
||||
MsgPanel.ShowTwo(str, function()
|
||||
end, function(isShow)
|
||||
if (isShow) then
|
||||
local currentTime = os.date("%Y%m%d", PlayerManager.serverTime)
|
||||
RedPointManager.PlayerPrefsSetStr(PlayerManager.uid .. shopType, currentTime)
|
||||
end
|
||||
func(shopType, itemId)
|
||||
end,
|
||||
Language[10731],
|
||||
Language[10732],
|
||||
nil,
|
||||
true)
|
||||
else
|
||||
func(shopType, itemId)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--添加事件监听(用于子类重写)
|
||||
function UpStarPre:AddListener()
|
||||
end
|
||||
|
||||
--移除事件监听(用于子类重写)
|
||||
function UpStarPre:RemoveListener()
|
||||
|
||||
end
|
||||
function UpStarPre:OnOpen()
|
||||
end
|
||||
function UpStarPre:SetData(data,_parent,_rechargeNum,sortingOrder)
|
||||
rechargeNum = _rechargeNum
|
||||
self.data = data
|
||||
self.parent = _parent
|
||||
Util.SetParticleSortLayer(self.UI_Effect_MianBan_LiBao_button_01, sortingOrder + 1 or 1)
|
||||
|
||||
self:SetTag()
|
||||
self:SetTipTag()
|
||||
|
||||
--设置礼包内容
|
||||
if not self.itemList then
|
||||
self.itemList = {}
|
||||
end
|
||||
for i = 1, #self.itemList do
|
||||
self.itemList[i].gameObject:SetActive(false)
|
||||
end
|
||||
for i = 1, #self.data.data.shows do
|
||||
if not self.itemList[i] then
|
||||
self.itemList[i] = SubUIManager.Open(SubUIConfig.ItemView,self.grid.transform)
|
||||
self.itemList[i].gameObject:SetActive(false)
|
||||
end
|
||||
self.itemList[i]:OnOpen(false, {self.data.data.shows[i][1],self.data.data.shows[i][2],self.data.data.shows[i][3]}, 0.9,false,false,false,sortingOrder)
|
||||
self.itemList[i].gameObject:SetActive(true)
|
||||
end
|
||||
|
||||
--设置按钮
|
||||
self:SetBtn(self.data)
|
||||
--设置礼包标题
|
||||
self:SetContent1()
|
||||
--设置特效
|
||||
self:Effect()
|
||||
end
|
||||
|
||||
--设置礼包名称(红色标签)
|
||||
function UpStarPre:SetTag()
|
||||
if self.data.data.tagName and self.data.data.tagName ~= "" and not (self.data.DataType == DataType.Shop and self.data.buyType == SHOP_TYPE.VIP_GIFT) then
|
||||
self.tagIma.gameObject:SetActive(true)
|
||||
self.tagText.text = self.data.data.tagName
|
||||
else
|
||||
self.tagIma.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
--设置礼包限购标签
|
||||
function UpStarPre:SetTipTag()
|
||||
if self.data.data.tipImageText and self.data.data.tipImageText ~= "" then
|
||||
self.tipImage.gameObject:SetActive(true)
|
||||
self.tipText.text = self.data.data.tipImageText
|
||||
else
|
||||
self.tipImage.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
|
||||
function UpStarPre:Effect()
|
||||
local isshow = false
|
||||
if self.data.DataType == DynamicActivityManager.selectIndex2.dataType then
|
||||
for i = 1 , #DynamicActivityManager.selectIndex2.goodsId do
|
||||
if (self.data.data.shopData.id or self.data.data.shopData.goodsId) == DynamicActivityManager.selectIndex2.goodsId[i] then
|
||||
isshow = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if self.isCanBuy == 2 then
|
||||
isshow = false
|
||||
end
|
||||
self.UI_Effect_MianBan_LiBao_button_01.gameObject:SetActive(isshow)
|
||||
end
|
||||
|
||||
function UpStarPre:SetContent1()
|
||||
self.upLayout.gameObject:SetActive(true)
|
||||
self.grid:GetComponent("RectTransform").anchoredPosition = offSetX[0].scroll
|
||||
self.type1.gameObject:SetActive(false)
|
||||
self.type2.gameObject:SetActive(false)
|
||||
self.tipRoot:SetActive(false)
|
||||
self.tip1:SetActive(false)
|
||||
self.tip2:SetActive(false)
|
||||
self.tip3:SetActive(false)
|
||||
self.tip4:SetActive(false)
|
||||
self.tip5:SetActive(false)
|
||||
self.tip1_en:SetActive(false)
|
||||
self.tip2_en:SetActive(false)
|
||||
self.tip3_en:SetActive(false)
|
||||
self.tip4_en:SetActive(false)
|
||||
|
||||
if self.data.DataType == DataType.Direct and self.data.buyType == DirectBuyType.DAILY_GIFT then--每日礼包
|
||||
self:SetType2()
|
||||
elseif self.data.DataType == DataType.Direct and (self.data.buyType == DirectBuyType.WEEK_GIFT or self.data.buyType == DirectBuyType.MONTH_GIFT or self.data.buyType == DirectBuyType.XIANSHISHANGSHI or self.data.buyType == DirectBuyType.ZHENQIBAOGE) then--周月礼包
|
||||
self.grid:GetComponent("RectTransform").anchoredPosition = offSetX[1].scroll
|
||||
self.upLayout.gameObject:SetActive(false)
|
||||
elseif self.data.DataType == DataType.Shop and self.data.buyType == SHOP_TYPE.VIP_GIFT then--特权
|
||||
local str = "("..rechargeNum.."/"..self.data.data.shopItemData.BuyRule[2]..Language[11698]
|
||||
self:SetType1(Language[11377],self.data.data.shopItemData.BuyRule[2],str)
|
||||
elseif (self.data.DataType == DataType.Direct and self.data.buyType == DirectBuyType.FINDTREASURE_GIFT) or--寻宝特权
|
||||
(self.data.DataType == DataType.Shop and self.data.buyType == SHOP_TYPE.FINDTREASURE_GIFT) then
|
||||
self.tipRoot:SetActive(true)
|
||||
self:SetTip()
|
||||
end
|
||||
ForceRebuildLayout(self.upLayout.transform)
|
||||
end
|
||||
|
||||
function UpStarPre:SetType1(type1Text1,num,type1Text3)
|
||||
self.type1.gameObject:SetActive(true)
|
||||
--CreatNumberPrefab(tostring(num),self.numList)
|
||||
self.moneyNum:SetNum(num)
|
||||
self.type1Text1.text = Language[11377]
|
||||
self.type1Text3.text = type1Text3
|
||||
end
|
||||
|
||||
function UpStarPre:SetType2()
|
||||
self.type2.gameObject:SetActive(true)
|
||||
self.type2Text1.text = self.data.data.shows[1][2]
|
||||
self.type2Text2.text=self.data.data.shopItemData.Rebate
|
||||
if GetCurLanguage() == 0 then
|
||||
self.type2Text1.gameObject:GetComponent("RectTransform").anchoredPosition = offSetX[0].txt1
|
||||
self.type2Icon1.gameObject:GetComponent("RectTransform").anchoredPosition = offSetX[0].icon1
|
||||
self.type2Text2.gameObject:GetComponent("RectTransform").anchoredPosition = offSetX[0].txt
|
||||
self.type2Icon2.gameObject:GetComponent("RectTransform").anchoredPosition = offSetX[0].icon
|
||||
self.type2Ima.gameObject:GetComponent("RectTransform").anchoredPosition = offSetX[0].ima
|
||||
elseif GetCurLanguage() == 1 then
|
||||
self.type2Text1.gameObject:GetComponent("RectTransform").anchoredPosition = offSetX[1].txt1
|
||||
self.type2Icon1.gameObject:GetComponent("RectTransform").anchoredPosition = offSetX[1].icon1
|
||||
self.type2Text2.gameObject:GetComponent("RectTransform").anchoredPosition = offSetX[1].txt
|
||||
self.type2Icon2.gameObject:GetComponent("RectTransform").anchoredPosition = offSetX[1].icon
|
||||
self.type2Ima.gameObject:GetComponent("RectTransform").anchoredPosition = offSetX[1].ima
|
||||
else
|
||||
self.type2Text1.gameObject:GetComponent("RectTransform").anchoredPosition = offSetX[2].txt1
|
||||
self.type2Icon1.gameObject:GetComponent("RectTransform").anchoredPosition = offSetX[2].icon1
|
||||
self.type2Text2.gameObject:GetComponent("RectTransform").anchoredPosition = offSetX[2].txt
|
||||
self.type2Icon2.gameObject:GetComponent("RectTransform").anchoredPosition = offSetX[2].icon
|
||||
self.type2Ima.gameObject:GetComponent("RectTransform").anchoredPosition = offSetX[2].ima
|
||||
end
|
||||
end
|
||||
|
||||
function UpStarPre:SetTip()
|
||||
if self.data.data.shopData.id and self.data.data.shopData.id == 20091 then
|
||||
if GetCurLanguage() ~= 0 then
|
||||
self.tip1_en:SetActive(true)
|
||||
else
|
||||
self.tip1:SetActive(true)
|
||||
end
|
||||
elseif self.data.data.shopData.id and self.data.data.shopData.id == 20092 then
|
||||
if GetCurLanguage() ~= 0 then
|
||||
self.tip2_en:SetActive(true)
|
||||
else
|
||||
self.tip2:SetActive(true)
|
||||
end
|
||||
elseif self.data.data.shopData.goodsId and self.data.data.shopData.goodsId == 4002 then
|
||||
if GetCurLanguage() ~= 0 then
|
||||
self.tip3_en:SetActive(true)
|
||||
else
|
||||
self.tip3:SetActive(true)
|
||||
end
|
||||
elseif self.data.data.shopData.goodsId and self.data.data.shopData.goodsId == 4001 then
|
||||
if GetCurLanguage() ~= 0 then
|
||||
self.tip4_en:SetActive(true)
|
||||
else
|
||||
self.tip4:SetActive(true)
|
||||
end
|
||||
elseif self.data.data.shopData.goodsId and self.data.data.shopData.goodsId == 4003 then
|
||||
self.tip5:SetActive(true)
|
||||
self.tip5Text.text = Language[12258]
|
||||
elseif self.data.data.shopData.goodsId and self.data.data.shopData.goodsId == 7105 then
|
||||
self.tip5:SetActive(true)
|
||||
self.tip5Text.text = Language[12259]
|
||||
end
|
||||
end
|
||||
|
||||
function UpStarPre:SetIsCanBuy()
|
||||
local isCanBuy = 0
|
||||
self.btnBuy:GetComponent("Image").sprite = self.spLoader:LoadSprite("s_slbz_1anniuhuangse")
|
||||
--如果是成长礼包 有一个1的状态 并且按钮图片有变化
|
||||
if self.data.DataType == DataType.Shop and self.data.buyType == SHOP_TYPE.VIP_GIFT then
|
||||
isCanBuy = (rechargeNum >= self.data.data.shopItemData.BuyRule[2] and 0 or 1)
|
||||
--LogGreen("isCanBuy:"..isCanBuy)
|
||||
if isCanBuy == 0 then
|
||||
self.btnBuy:GetComponent("Image").sprite = self.spLoader:LoadSprite("s_slbz_1anniuongse")
|
||||
else
|
||||
self.btnBuy:GetComponent("Image").sprite = self.spLoader:LoadSprite("s_slbz_1anniuhuangse")
|
||||
end
|
||||
end
|
||||
if isCanBuy == 0 then
|
||||
isCanBuy = (self.data.data.limitNum - self.data.data.boughtNum > 0) and 0 or 2
|
||||
end
|
||||
return isCanBuy
|
||||
end
|
||||
|
||||
function UpStarPre:SetIcon()
|
||||
if self.isCanBuy == 2 then
|
||||
self.icon.gameObject:SetActive(false)
|
||||
self.price.text = Language[10514]
|
||||
else
|
||||
if self.data.DataType == DataType.Shop then
|
||||
self.icon.gameObject:SetActive(true)
|
||||
self.icon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemConfig[self.data.data.shopItemData.Cost[1][1]].ResourceID))
|
||||
else
|
||||
self.icon.gameObject:SetActive(false)
|
||||
end
|
||||
self.price.text = self.data.data.price
|
||||
end
|
||||
end
|
||||
|
||||
function UpStarPre:SetBtn(_itemdata)
|
||||
self.btnBuy.gameObject:SetActive(true)
|
||||
self.isCanBuy = self:SetIsCanBuy()
|
||||
self.btnBuy:GetComponent("Button").interactable = (self.isCanBuy == 0 or self.isCanBuy == 1)
|
||||
--设置icon
|
||||
self:SetIcon()
|
||||
|
||||
--设置按钮提示 -- 已经购买不显示(特权礼包需要显示时间)
|
||||
self.buyInfo.text = self.isCanBuy == 2 and "" or _itemdata.data.buyInfo
|
||||
if self.isCanBuy == 2 then
|
||||
if self.data.DataType == DataType.Direct and self.data.buyType == DirectBuyType.FINDTREASURE_GIFT then
|
||||
if self.time then
|
||||
self.time:Stop()
|
||||
self.time = nil
|
||||
end
|
||||
local fresh = _itemdata.data.endTime - GetTimeStamp()
|
||||
if fresh <= 0 then
|
||||
-- self.parent:RefreshData()
|
||||
return
|
||||
end
|
||||
self.buyInfo.text = Language[10469]..self.parent:SpecialTime(fresh)
|
||||
self.time = Timer.New(function()
|
||||
fresh = fresh - 1
|
||||
if fresh <= 0 then
|
||||
self.parent:RefreshData()
|
||||
return
|
||||
end
|
||||
self.buyInfo.text = Language[10469]..self.parent:SpecialTime(fresh)
|
||||
end,1,-1,true)
|
||||
self.time:Start()
|
||||
end
|
||||
end
|
||||
--设置红点
|
||||
if _itemdata.data.finalNum == 0 and self.isCanBuy == 0 then
|
||||
self.redPoint.gameObject:SetActive(true)
|
||||
else
|
||||
self.redPoint.gameObject:SetActive(false)
|
||||
end
|
||||
Util.SetGray(self.btnBuy, (self.isCanBuy == 2))
|
||||
ForceRebuildLayout(self.btnBuy.transform)
|
||||
end
|
||||
|
||||
function UpStarPre:OnClose()
|
||||
if self.time then
|
||||
self.time:Stop()
|
||||
self.time = nil
|
||||
end
|
||||
DynamicActivityManager.SetSelectIndex(0,{})
|
||||
for k,v in pairs(self.itemList) do
|
||||
SubUIManager.Close(v)
|
||||
end
|
||||
self.itemList = {}
|
||||
|
||||
|
||||
if self.moneyNum then
|
||||
SubUIManager.Close(self.moneyNum)
|
||||
self.moneyNum = nil
|
||||
end
|
||||
end
|
||||
return UpStarPre
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: b96bb51d3d28d0542bde0dbff0bb436f
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -310,6 +310,7 @@ function this:SetData(dataList, updateFunc, noTop, noAnim)
|
|||
self.dataCount = #dataList
|
||||
self.isPlayAnim = not noAnim
|
||||
|
||||
--计算grid偏移长度和偏移item个数
|
||||
if self.dragType == 1 then
|
||||
self.itemDis = self.itemHeight * math.ceil(self.dataCount / self.fixedCount) + self.spacing.y - self.rectTransform.sizeDelta.y
|
||||
self.maxOffset = math.max(math.ceil(self.dataCount / self.fixedCount) - self.itemCount, 0)
|
||||
|
|
Loading…
Reference in New Issue