【公会红包】====红包刷新逻辑修改

dev_chengFeng
wangzhenxing 2021-06-01 16:59:27 +08:00
parent c4c0cb5a69
commit 5bcfe86999
9 changed files with 71 additions and 46 deletions

View File

@ -260,12 +260,16 @@ function this.ChatDataAdapter(channel, data)
-- newChat.messageType = 8 -- 公会红包的类型
-- newChat.speed = this.horseRunSpeed
-- newChat.multiple = 1
if PlayerManager.uid~=tonumber(msgs[2]) then
LogError("处理聊天数据")
GuildRedPacketManager.isCheck = true
MyGuildManager.PackageNum=MyGuildManager.PackageNum+1
--CheckRedPointStatus(RedPointType.Guild_RedPacket)
--CheckRedPointStatus(RedPointType.Guid_GetPackage)
--CheckRedPointStatus(RedPointType.Guild_RedPacket)
CheckRedPointStatus(RedPointType.Guid_GetPackage)
end
LogError("聊天推过来的红包num"..MyGuildManager.PackageNum)
end
end
end

View File

@ -536,7 +536,6 @@ end
--界面销毁时调用(用于子类重写)
function GuildMainCityPanel:OnDestroy()
this.spLoader:Destroy()
LogError("11111111111111111")
SubUIManager.Close(this.ChatTipView)
SubUIManager.Close(this.UpView)
SubUIManager.Close(this.BtView)
@ -550,10 +549,8 @@ function GuildMainCityPanel:OnDestroy()
end
end
end
-- 清除红点
ClearRedPointObject(RedPointType.Guild_RedPacket, this.btnRedPacketRedPoint)
LogError("22222222222222222222")
-- this.playerHead = nil
if this.LiveGO then

View File

@ -177,6 +177,7 @@ function MyGuildManager.ReuqsetRedPackage(func)
NetManager.GetAllRedPacketResponse(function(msg)
local num=0
local SpecialConfig=ConfigManager.GetConfigData(ConfigName.SpecialConfig,115)
LogError("--------------------")
for i = 1, #msg.info do
local config=ConfigManager.GetConfigData(ConfigName.GuildRedPackConfig,msg.info[i].redType)
if config and msg.info[i].isGet==0 and (config.Num-msg.info[i].getCount)>0 then
@ -185,10 +186,12 @@ function MyGuildManager.ReuqsetRedPackage(func)
end
end
end
LogError("*************************")
this.PackageNum=num
CheckRedPointStatus(RedPointType.Guid_GetPackage)
CheckRedPointStatus(RedPointType.Guid_SendPackage)
CheckRedPointStatus(RedPointType.Guild_RedPacket)
--CheckRedPointStatus(RedPointType.Guild_RedPacket)
LogError("///////////////////")
if func then
func(msg)
end

View File

@ -17,16 +17,17 @@ function this.CheckGuildRedPacketRedPoint()
-- return false
-- end
local list=MyGuildManager.GetMyGuidRedPackage()
if list then
-- LogRed("检测发红包红点")
LogError("检测发红包红点111")
if list and LengthOfTable(list)>0 then
LogError("检测发红包红点")
for key, value in pairs(list) do
if value and value.num and value.num>0 then
-- LogError("444444444444")
LogError("444444444444")
return true
end
end
end
-- LogError("5555555555")
LogError("5555555555")
return false
end
function this.CheckIsCanGetPackage()
@ -46,14 +47,36 @@ function this.CheckIsCanGetPackage()
-- return false
-- end)
if MyGuildManager.PackageNum>0 then
Game.GlobalEvent:DispatchEvent(GameEvent.Chat.OnRedPackageNumChanged)
LogError("现在红包得数量:"..MyGuildManager.GetRedPackageNum())
if MyGuildManager.GetRedPackageNum()>0 then
--Game.GlobalEvent:DispatchEvent(GameEvent.Chat.OnRedPackageNumChanged,true)
local aaa=Util.GetGameObject(UIManager.uiNode,"GuildMainCityPanel/ChatTipView/Image")
local bbb=Util.GetGameObject(UIManager.uiNode,"MainPanel/ChatTipView/Image")
if aaa then
LogError("显示红包")
aaa.gameObject:SetActive(true)
end
if bbb then
LogError("显示红包")
bbb.gameObject:SetActive(true)
end
return true
else
Game.GlobalEvent:DispatchEvent(GameEvent.Chat.OnRedPackageNumChanged)
-- Game.GlobalEvent:DispatchEvent(GameEvent.Chat.OnRedPackageNumChanged,false)
local aaa=Util.GetGameObject(UIManager.uiNode,"GuildMainCityPanel/ChatTipView/Image")
local bbb=Util.GetGameObject(UIManager.uiNode,"MainPanel/ChatTipView/Image")
if aaa then
LogError("不显示红包")
aaa.gameObject:SetActive(false)
end
if bbb then
LogError("bu显示红包")
bbb.gameObject:SetActive(false)
end
return false
end
return false
end

View File

@ -101,8 +101,8 @@ function RedPacketPanel:OnShow()
BindRedPointObject(RedPointType.Guid_SendPackage, redPointList[2])
BindRedPointObject(RedPointType.Guid_GetPackage, redPointList[3])
end
CheckRedPointStatus(RedPointType.Guid_SendPackage)
CheckRedPointStatus(RedPointType.Guid_GetPackage)
--CheckRedPointStatus(RedPointType.Guid_SendPackage)
--CheckRedPointStatus(RedPointType.Guid_GetPackage)
end

View File

@ -46,11 +46,12 @@ end
function RedPacketPopup:RemoveListener()
end
local func=nil
function RedPacketPopup:OnOpen(...)
local args={...}
this.redId=args[1]
this.id=args[2]
func=args[3]
end
function RedPacketPopup:OnShow()
@ -58,7 +59,9 @@ function RedPacketPopup:OnShow()
end
function RedPacketPopup:OnClose()
if func then
func()
end
end
function RedPacketPopup:OnDestroy()
@ -72,13 +75,13 @@ end
--初始化面板
function this.InitView(redId,id)
LogError("ffffff")
local config=ConfigManager.GetConfigData(ConfigName.GuildRedPackConfig,id)
local index=id
if index>3 then
index=4
end
this.title.sprite = this.spLoader:LoadSprite(RedPacketName[index])
LogError("BaseType=="..config.BaseType)
if config.BaseType==1 then
this.titleTip.text=GetLanguageStrById(config.SendWord)
elseif config.BaseType==2 then
@ -106,7 +109,6 @@ function this.InitView(redId,id)
table.sort(data,function(a,b)
return a.count>b.count
end)
this.scrollView:SetData(data,function(index,root)
this.SetShow(root,data[index],index)
end)

View File

@ -63,11 +63,6 @@ function this:InitGetView()
local dataLength=0
isAuto=false
NetManager.GetAllRedPacketResponse(function(msg)
-- logWarnTrance(#msg.info)
-- for index, value in ipairs(msg.info) do
-- Log(tostring(value))
-- end
local data={}
for i,v in ipairs(msg.info) do
table.insert(data,v)
@ -78,7 +73,7 @@ function this:InitGetView()
this.noInfo:SetActive(dataLength==0)
this.scrollView:SetData(data,function(index,root)
this:SetView(root,data[index])
end)
end,true,true)
--this.scrollView:SetIndex(1)
if isAuto then
local SpecialConfig=ConfigManager.GetConfigData(ConfigName.SpecialConfig,115)
@ -93,12 +88,16 @@ function this:InitGetView()
local count=msg.count
if success==1 then--红包抢成功
local itemName=GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.ItemConfig,itemId).Name)
UIManager.OpenPanel(UIName.RedPacketPopup,value.redId,value.redType)
UIManager.OpenPanel(UIName.RedPacketPopup,value.redId,value.redType,function ()
this.InitGetView()
MyGuildManager.ReuqsetRedPackage()
end)
--红包类型大于3的是福利红包
if value.redType>3 then
PlayerManager.SettDailyRedPackageTime(PlayerManager.dailyRedPack+1)
end
MyGuildManager.ReuqsetRedPackage()
PopupTipPanel.ShowTip(string.format(Language[11046],itemName,count))
else--抢红包失败
LogError(Language[11047])
@ -151,7 +150,6 @@ function this:SetView(root,data)
numOrRecordText.text=Language[11043]
getBtnImage.sprite=this.spLoader:LoadSprite(BtnStateImage[2]) --Language[10101]
else
LogError("redid"..redId)
numOrRecordText.text=Language[10580]..(config.Num-data.getCount).."/"..config.Num
getBtnImage.sprite=this.spLoader:LoadSprite(BtnStateImage[1]) --Language[11044]
end
@ -172,26 +170,25 @@ function this:SetView(root,data)
local count=msg.count
if success==1 then--红包抢成功
local itemName=GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.ItemConfig,itemId).Name)
UIManager.OpenPanel(UIName.RedPacketPopup,redId,data.redType)
UIManager.OpenPanel(UIName.RedPacketPopup,redId,data.redType,function()
this:InitGetView()
MyGuildManager.ReuqsetRedPackage()
end)
if data.redType>3 then
PlayerManager.SettDailyRedPackageTime(PlayerManager.dailyRedPack+1)
end
PopupTipPanel.ShowTip(string.format(Language[11046],itemName,count))
MyGuildManager.ReuqsetRedPackage(function()
CheckRedPointStatus(RedPointType.Guid_GetPackage)
CheckRedPointStatus(RedPointType.Guild_RedPacket)
end)
else--抢红包失败
PopupTipPanel.ShowTip(Language[11047])
end
this:InitGetView()
end)
end)
Util.AddOnceClick(numOrRecordBtn,function()--查看记录
NetManager.GetRedPackageDetailRequest(redId,function(msg)
UIManager.OpenPanel(UIName.RedPacketPopup,redId,data.redType)
this:InitGetView()
--this:InitGetView()
end)
end)
end

View File

@ -260,9 +260,10 @@ function this.RechargeSuccessFunc(id)
OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, id)
local redpack=ConfigManager.GetConfigData(ConfigName.GuildRedPackConfig,curIndex)
this.SetInfo(curIndex)
MyGuildManager.ReuqsetRedPackage()
--PopupTipPanel.ShowTip(string.format( Language[11051],GetLanguageStrById(redpack.Name)))
ChatManager.RequestSendRedPacket(curIndex)
MyGuildManager.ReuqsetRedPackage()
-- CheckRedPointStatus(RedPointType.Guid_GetPackage)
end

View File

@ -116,10 +116,8 @@ function this:ShowItemInfo(go,data)
PopupTipPanel.ShowTip("成功发送福利红包!")
this:InitView()
--刷新发送福利红包按钮红点
CheckRedPointStatus(RedPointType.Guid_GetPackage)
MyGuildManager.ReuqsetRedPackage(function()
CheckRedPointStatus(RedPointType.Guid_GetPackage)
end)
--CheckRedPointStatus(RedPointType.Guid_GetPackage)
MyGuildManager.ReuqsetRedPackage()
--发送公会信息
local redpack=ConfigManager.GetConfigData(ConfigName.GuildRedPackConfig,data.config.Id)