【连购礼包】提交

dev_chengFeng
ZhangBiao 2021-12-02 17:13:33 +08:00
parent bc69e64b81
commit 4d1799a124
5 changed files with 171 additions and 68 deletions

View File

@ -98,6 +98,11 @@ TRUMPGACHASELECTITEMREQUEST_SELECTIDS_FIELD = protobuf.FieldDescriptor();
GETTRUMPSELECTITEMREQUEST = protobuf.Descriptor();
GETTRUMPSELECTITEMRESPONSE = protobuf.Descriptor();
GETTRUMPSELECTITEMRESPONSE_SELECTIDS_FIELD = protobuf.FieldDescriptor();
BUYGOODSTOITEMREQUEST = protobuf.Descriptor();
BUYGOODSTOITEMREQUEST_GOODID_FIELD = protobuf.FieldDescriptor();
BUYGOODSTOITEMREQUEST_GOODSNUM_FIELD = protobuf.FieldDescriptor();
BUYGOODSTOITEMRESPONSE = protobuf.Descriptor();
BUYGOODSTOITEMRESPONSE_DROP_FIELD = protobuf.FieldDescriptor();
COMMITSHEJIACTIVITYITEMREQUEST_ITEMID_FIELD.name = "itemId"
COMMITSHEJIACTIVITYITEMREQUEST_ITEMID_FIELD.full_name = ".rpc.protocols.CommitShejiActivityItemRequest.itemId"
@ -939,7 +944,54 @@ GETTRUMPSELECTITEMRESPONSE.enum_types = {}
GETTRUMPSELECTITEMRESPONSE.fields = {GETTRUMPSELECTITEMRESPONSE_SELECTIDS_FIELD}
GETTRUMPSELECTITEMRESPONSE.is_extendable = false
GETTRUMPSELECTITEMRESPONSE.extensions = {}
BUYGOODSTOITEMREQUEST_GOODID_FIELD.name = "goodId"
BUYGOODSTOITEMREQUEST_GOODID_FIELD.full_name = ".rpc.protocols.BuyGoodsToItemRequest.goodId"
BUYGOODSTOITEMREQUEST_GOODID_FIELD.number = 1
BUYGOODSTOITEMREQUEST_GOODID_FIELD.index = 0
BUYGOODSTOITEMREQUEST_GOODID_FIELD.label = 1
BUYGOODSTOITEMREQUEST_GOODID_FIELD.has_default_value = false
BUYGOODSTOITEMREQUEST_GOODID_FIELD.default_value = 0
BUYGOODSTOITEMREQUEST_GOODID_FIELD.type = 5
BUYGOODSTOITEMREQUEST_GOODID_FIELD.cpp_type = 1
BUYGOODSTOITEMREQUEST_GOODSNUM_FIELD.name = "goodsNum"
BUYGOODSTOITEMREQUEST_GOODSNUM_FIELD.full_name = ".rpc.protocols.BuyGoodsToItemRequest.goodsNum"
BUYGOODSTOITEMREQUEST_GOODSNUM_FIELD.number = 2
BUYGOODSTOITEMREQUEST_GOODSNUM_FIELD.index = 1
BUYGOODSTOITEMREQUEST_GOODSNUM_FIELD.label = 1
BUYGOODSTOITEMREQUEST_GOODSNUM_FIELD.has_default_value = false
BUYGOODSTOITEMREQUEST_GOODSNUM_FIELD.default_value = 0
BUYGOODSTOITEMREQUEST_GOODSNUM_FIELD.type = 5
BUYGOODSTOITEMREQUEST_GOODSNUM_FIELD.cpp_type = 1
BUYGOODSTOITEMREQUEST.name = "BuyGoodsToItemRequest"
BUYGOODSTOITEMREQUEST.full_name = ".rpc.protocols.BuyGoodsToItemRequest"
BUYGOODSTOITEMREQUEST.nested_types = {}
BUYGOODSTOITEMREQUEST.enum_types = {}
BUYGOODSTOITEMREQUEST.fields = {BUYGOODSTOITEMREQUEST_GOODID_FIELD, BUYGOODSTOITEMREQUEST_GOODSNUM_FIELD}
BUYGOODSTOITEMREQUEST.is_extendable = false
BUYGOODSTOITEMREQUEST.extensions = {}
BUYGOODSTOITEMRESPONSE_DROP_FIELD.name = "drop"
BUYGOODSTOITEMRESPONSE_DROP_FIELD.full_name = ".rpc.protocols.BuyGoodsToItemResponse.drop"
BUYGOODSTOITEMRESPONSE_DROP_FIELD.number = 1
BUYGOODSTOITEMRESPONSE_DROP_FIELD.index = 0
BUYGOODSTOITEMRESPONSE_DROP_FIELD.label = 1
BUYGOODSTOITEMRESPONSE_DROP_FIELD.has_default_value = false
BUYGOODSTOITEMRESPONSE_DROP_FIELD.default_value = nil
BUYGOODSTOITEMRESPONSE_DROP_FIELD.message_type = CommonProto_pb.DROP
BUYGOODSTOITEMRESPONSE_DROP_FIELD.type = 11
BUYGOODSTOITEMRESPONSE_DROP_FIELD.cpp_type = 10
BUYGOODSTOITEMRESPONSE.name = "BuyGoodsToItemResponse"
BUYGOODSTOITEMRESPONSE.full_name = ".rpc.protocols.BuyGoodsToItemResponse"
BUYGOODSTOITEMRESPONSE.nested_types = {}
BUYGOODSTOITEMRESPONSE.enum_types = {}
BUYGOODSTOITEMRESPONSE.fields = {BUYGOODSTOITEMRESPONSE_DROP_FIELD}
BUYGOODSTOITEMRESPONSE.is_extendable = false
BUYGOODSTOITEMRESPONSE.extensions = {}
BuyGoodsToItemRequest = protobuf.Message(BUYGOODSTOITEMREQUEST)
BuyGoodsToItemResponse = protobuf.Message(BUYGOODSTOITEMRESPONSE)
CommitShejiActivityItemRequest = protobuf.Message(COMMITSHEJIACTIVITYITEMREQUEST)
CommitShejiActivityItemResponse = protobuf.Message(COMMITSHEJIACTIVITYITEMRESPONSE)
FuXingStoreBuyRequest = protobuf.Message(FUXINGSTOREBUYREQUEST)

File diff suppressed because one or more lines are too long

View File

@ -118,6 +118,7 @@ function ContinuePackagePanel:ShowSingleHero(go,data,index)
local obj = Util.GetGameObject(btnGet, "Obj")
local icon = Util.GetGameObject(obj, "icon"):GetComponent("Image")
local cost = Util.GetGameObject(obj, "cost"):GetComponent("Text")
local canBuyTime = Util.GetGameObject(go, "times"):GetComponent("Text")
if not self.itemViewList[go] then
self.itemViewList[go] = {}
@ -134,17 +135,20 @@ function ContinuePackagePanel:ShowSingleHero(go,data,index)
self.itemViewList[go][i].gameObject:SetActive(true)
end
LogBlue("Id:"..tostring(data.missionId).." state:"..tostring(data.state).." progress:"..tostring(data.progress))
-- LogBlue("Id:"..tostring(data.missionId).." state:"..tostring(data.state).." progress:"..tostring(data.progress))
Util.SetGray(btnGet,false)
buyDayImg:SetActive(false)
btnText.gameObject:SetActive(false)
obj:SetActive(false)
canBuyTime.text = string.format( "剩余:%s次",data.progress)
btnImg.sprite = self.spLoader:LoadSprite("s_slbz_anniu")
if data.otherData.GoodType == 1 then--直购
btnText.gameObject:SetActive(true)
btnText.text = string.format("%s 元",data.otherData.Price)
if data.state == 8 then
btnImg.sprite = self.spLoader:LoadSprite("s_slbz_1anniuhuise")
btnText.text = Language[10514]
canBuyTime.text = ""
elseif data.state == 3 then
Util.SetGray(btnGet,true)
elseif data.state == 2 then
@ -161,6 +165,7 @@ function ContinuePackagePanel:ShowSingleHero(go,data,index)
btnText.gameObject:SetActive(true)
btnImg.sprite = self.spLoader:LoadSprite("s_slbz_1anniuhuise")
btnText.text = Language[10514]
canBuyTime.text = ""
elseif data.state == 3 then
Util.SetGray(btnGet,true)
elseif data.state == 2 then
@ -170,15 +175,22 @@ function ContinuePackagePanel:ShowSingleHero(go,data,index)
end
end
-- LogYellow("GoodId:"..tostring(data.otherData.GoodId).." state:"..tostring(data.state))
Util.AddOnceClick(btnGet,function ()
if data.state == 1 then
-- PayManager.Pay(data.otherData.GoodId, function(id)
-- FirstRechargeManager.RefreshAccumRechargeValue(data.otherData.GoodId)
-- OperatingManager.SetHadBuyGoodsId({data.otherData.GoodId})
-- OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, data.otherData.GoodId)
-- self:Refresh(false,false)
-- end)
if data.otherData.GoodType == 1 then--直购
PayManager.Pay(data.otherData.GoodId, function(id)
FirstRechargeManager.RefreshAccumRechargeValue(data.otherData.GoodId)
OperatingManager.SetHadBuyGoodsId({data.otherData.GoodId})
OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, data.otherData.GoodId)
self:Refresh(false,false)
end)
elseif data.otherData.GoodType == 2 then--商品
NetManager.ContinueBuyItemRequest(data.otherData.GoodId,function (drop)
UIManager.OpenPanel(UIName.RewardItemPopup,drop,1,function()
self:Refresh(false,false)
end)
end)
end
PopupTipPanel.ShowTip("购买")
elseif data.state == 3 then
PopupTipPanel.ShowTip("请先购买上一礼包,即可解锁此礼包")

View File

@ -6217,4 +6217,22 @@ function NetManager.SendGetTailsmanSoulData(fun)
end)
end
--连购礼包
function NetManager.ContinueBuyItemRequest(_goodId,fun)
local data = ActivityProto_pb.BuyGoodsToItemRequest()
data.goodId = _goodId
data.goodsNum = 1
local msg = data:SerializeToString()
Network:SendMessageWithCallBack(MessageTypeProto_pb.BuyGoodsToItemRequest, MessageTypeProto_pb.BuyGoodsToItemResponse, msg, function(buffer)
local data = buffer:DataByte()
local msg = ActivityProto_pb.BuyGoodsToItemResponse()
msg:ParseFromString(data)
if fun then
fun(msg.drop)
end
end)
end
return this

View File

@ -321,7 +321,6 @@ local TypeUpdateFunc = {
if curData.rewards[i].missionId == configData[j].Id then
local tempData = {}
tempData.missionId = configData[j].Id
tempData.progress = curData.rewards[i].progress
tempData.state = curData.rewards[i].state
tempData.otherData = {}
tempData.otherData.GoodId = configData[j].GoodId
@ -332,10 +331,12 @@ local TypeUpdateFunc = {
tempData.otherData.Name = rechargeConfig[configData[j].GoodId].Name
tempData.otherData.Reward = rechargeConfig[configData[j].GoodId].RewardShow
tempData.otherData.Price = rechargeConfig[configData[j].GoodId].Price
tempData.progress = OperatingManager.GetLeftBuyTime(5,configData[j].GoodId)
elseif configData[j].GoodType == 2 then
tempData.otherData.Name = goodsConfig[configData[j].GoodId].GoodsName
tempData.otherData.Reward = goodsConfig[configData[j].GoodId].Goods
tempData.otherData.Price = goodsConfig[configData[j].GoodId].Price
tempData.progress = goodsConfig[configData[j].GoodId].Limit - curData.rewards[i].progress
end
if not tempDataList[configData[j].Type] then
tempDataList[configData[j].Type] = {}
@ -345,7 +346,17 @@ local TypeUpdateFunc = {
end
end
curData.rewards = tempDataList
for i = #curData.rewards, 1,-1 do
if curData.rewards[i].progress == 5 then
table.remove(curData.rewards,i)
end
end
for index, value in ipairs(curData.rewards) do
for i = #value, 1,-1 do
if value[i].state == 5 then
table.remove(value,i)
end
end
table.sort(value,function (a,b)
return a.missionId < b.missionId
end)