【公会红包】====红包刷新逻辑修改
parent
c4c0cb5a69
commit
5bcfe86999
|
@ -260,12 +260,16 @@ function this.ChatDataAdapter(channel, data)
|
||||||
-- newChat.messageType = 8 -- 公会红包的类型
|
-- newChat.messageType = 8 -- 公会红包的类型
|
||||||
-- newChat.speed = this.horseRunSpeed
|
-- newChat.speed = this.horseRunSpeed
|
||||||
-- newChat.multiple = 1
|
-- newChat.multiple = 1
|
||||||
|
if PlayerManager.uid~=tonumber(msgs[2]) then
|
||||||
|
LogError("处理聊天数据")
|
||||||
GuildRedPacketManager.isCheck = true
|
GuildRedPacketManager.isCheck = true
|
||||||
MyGuildManager.PackageNum=MyGuildManager.PackageNum+1
|
MyGuildManager.PackageNum=MyGuildManager.PackageNum+1
|
||||||
--CheckRedPointStatus(RedPointType.Guild_RedPacket)
|
--CheckRedPointStatus(RedPointType.Guild_RedPacket)
|
||||||
--CheckRedPointStatus(RedPointType.Guid_GetPackage)
|
CheckRedPointStatus(RedPointType.Guid_GetPackage)
|
||||||
--CheckRedPointStatus(RedPointType.Guild_RedPacket)
|
end
|
||||||
|
|
||||||
|
LogError("聊天推过来的红包num:"..MyGuildManager.PackageNum)
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -536,7 +536,6 @@ end
|
||||||
--界面销毁时调用(用于子类重写)
|
--界面销毁时调用(用于子类重写)
|
||||||
function GuildMainCityPanel:OnDestroy()
|
function GuildMainCityPanel:OnDestroy()
|
||||||
this.spLoader:Destroy()
|
this.spLoader:Destroy()
|
||||||
LogError("11111111111111111")
|
|
||||||
SubUIManager.Close(this.ChatTipView)
|
SubUIManager.Close(this.ChatTipView)
|
||||||
SubUIManager.Close(this.UpView)
|
SubUIManager.Close(this.UpView)
|
||||||
SubUIManager.Close(this.BtView)
|
SubUIManager.Close(this.BtView)
|
||||||
|
@ -550,10 +549,8 @@ function GuildMainCityPanel:OnDestroy()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 清除红点
|
-- 清除红点
|
||||||
ClearRedPointObject(RedPointType.Guild_RedPacket, this.btnRedPacketRedPoint)
|
ClearRedPointObject(RedPointType.Guild_RedPacket, this.btnRedPacketRedPoint)
|
||||||
LogError("22222222222222222222")
|
|
||||||
-- this.playerHead = nil
|
-- this.playerHead = nil
|
||||||
|
|
||||||
if this.LiveGO then
|
if this.LiveGO then
|
||||||
|
|
|
@ -177,6 +177,7 @@ function MyGuildManager.ReuqsetRedPackage(func)
|
||||||
NetManager.GetAllRedPacketResponse(function(msg)
|
NetManager.GetAllRedPacketResponse(function(msg)
|
||||||
local num=0
|
local num=0
|
||||||
local SpecialConfig=ConfigManager.GetConfigData(ConfigName.SpecialConfig,115)
|
local SpecialConfig=ConfigManager.GetConfigData(ConfigName.SpecialConfig,115)
|
||||||
|
LogError("--------------------")
|
||||||
for i = 1, #msg.info do
|
for i = 1, #msg.info do
|
||||||
local config=ConfigManager.GetConfigData(ConfigName.GuildRedPackConfig,msg.info[i].redType)
|
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
|
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
|
end
|
||||||
end
|
end
|
||||||
|
LogError("*************************")
|
||||||
this.PackageNum=num
|
this.PackageNum=num
|
||||||
CheckRedPointStatus(RedPointType.Guid_GetPackage)
|
CheckRedPointStatus(RedPointType.Guid_GetPackage)
|
||||||
CheckRedPointStatus(RedPointType.Guid_SendPackage)
|
CheckRedPointStatus(RedPointType.Guid_SendPackage)
|
||||||
CheckRedPointStatus(RedPointType.Guild_RedPacket)
|
--CheckRedPointStatus(RedPointType.Guild_RedPacket)
|
||||||
|
LogError("///////////////////")
|
||||||
if func then
|
if func then
|
||||||
func(msg)
|
func(msg)
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,16 +17,17 @@ function this.CheckGuildRedPacketRedPoint()
|
||||||
-- return false
|
-- return false
|
||||||
-- end
|
-- end
|
||||||
local list=MyGuildManager.GetMyGuidRedPackage()
|
local list=MyGuildManager.GetMyGuidRedPackage()
|
||||||
if list then
|
LogError("检测发红包红点111")
|
||||||
-- LogRed("检测发红包红点")
|
if list and LengthOfTable(list)>0 then
|
||||||
|
LogError("检测发红包红点")
|
||||||
for key, value in pairs(list) do
|
for key, value in pairs(list) do
|
||||||
if value and value.num and value.num>0 then
|
if value and value.num and value.num>0 then
|
||||||
-- LogError("444444444444")
|
LogError("444444444444")
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- LogError("5555555555")
|
LogError("5555555555")
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
function this.CheckIsCanGetPackage()
|
function this.CheckIsCanGetPackage()
|
||||||
|
@ -46,14 +47,36 @@ function this.CheckIsCanGetPackage()
|
||||||
|
|
||||||
-- return false
|
-- return false
|
||||||
-- end)
|
-- end)
|
||||||
if MyGuildManager.PackageNum>0 then
|
LogError("现在红包得数量:"..MyGuildManager.GetRedPackageNum())
|
||||||
Game.GlobalEvent:DispatchEvent(GameEvent.Chat.OnRedPackageNumChanged)
|
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
|
return true
|
||||||
else
|
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
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -101,8 +101,8 @@ function RedPacketPanel:OnShow()
|
||||||
BindRedPointObject(RedPointType.Guid_SendPackage, redPointList[2])
|
BindRedPointObject(RedPointType.Guid_SendPackage, redPointList[2])
|
||||||
BindRedPointObject(RedPointType.Guid_GetPackage, redPointList[3])
|
BindRedPointObject(RedPointType.Guid_GetPackage, redPointList[3])
|
||||||
end
|
end
|
||||||
CheckRedPointStatus(RedPointType.Guid_SendPackage)
|
--CheckRedPointStatus(RedPointType.Guid_SendPackage)
|
||||||
CheckRedPointStatus(RedPointType.Guid_GetPackage)
|
--CheckRedPointStatus(RedPointType.Guid_GetPackage)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -46,11 +46,12 @@ end
|
||||||
function RedPacketPopup:RemoveListener()
|
function RedPacketPopup:RemoveListener()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
local func=nil
|
||||||
function RedPacketPopup:OnOpen(...)
|
function RedPacketPopup:OnOpen(...)
|
||||||
local args={...}
|
local args={...}
|
||||||
this.redId=args[1]
|
this.redId=args[1]
|
||||||
this.id=args[2]
|
this.id=args[2]
|
||||||
|
func=args[3]
|
||||||
end
|
end
|
||||||
|
|
||||||
function RedPacketPopup:OnShow()
|
function RedPacketPopup:OnShow()
|
||||||
|
@ -58,7 +59,9 @@ function RedPacketPopup:OnShow()
|
||||||
end
|
end
|
||||||
|
|
||||||
function RedPacketPopup:OnClose()
|
function RedPacketPopup:OnClose()
|
||||||
|
if func then
|
||||||
|
func()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function RedPacketPopup:OnDestroy()
|
function RedPacketPopup:OnDestroy()
|
||||||
|
@ -72,13 +75,13 @@ end
|
||||||
|
|
||||||
--初始化面板
|
--初始化面板
|
||||||
function this.InitView(redId,id)
|
function this.InitView(redId,id)
|
||||||
|
LogError("ffffff")
|
||||||
local config=ConfigManager.GetConfigData(ConfigName.GuildRedPackConfig,id)
|
local config=ConfigManager.GetConfigData(ConfigName.GuildRedPackConfig,id)
|
||||||
local index=id
|
local index=id
|
||||||
if index>3 then
|
if index>3 then
|
||||||
index=4
|
index=4
|
||||||
end
|
end
|
||||||
this.title.sprite = this.spLoader:LoadSprite(RedPacketName[index])
|
this.title.sprite = this.spLoader:LoadSprite(RedPacketName[index])
|
||||||
LogError("BaseType=="..config.BaseType)
|
|
||||||
if config.BaseType==1 then
|
if config.BaseType==1 then
|
||||||
this.titleTip.text=GetLanguageStrById(config.SendWord)
|
this.titleTip.text=GetLanguageStrById(config.SendWord)
|
||||||
elseif config.BaseType==2 then
|
elseif config.BaseType==2 then
|
||||||
|
@ -106,7 +109,6 @@ function this.InitView(redId,id)
|
||||||
table.sort(data,function(a,b)
|
table.sort(data,function(a,b)
|
||||||
return a.count>b.count
|
return a.count>b.count
|
||||||
end)
|
end)
|
||||||
|
|
||||||
this.scrollView:SetData(data,function(index,root)
|
this.scrollView:SetData(data,function(index,root)
|
||||||
this.SetShow(root,data[index],index)
|
this.SetShow(root,data[index],index)
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -63,11 +63,6 @@ function this:InitGetView()
|
||||||
local dataLength=0
|
local dataLength=0
|
||||||
isAuto=false
|
isAuto=false
|
||||||
NetManager.GetAllRedPacketResponse(function(msg)
|
NetManager.GetAllRedPacketResponse(function(msg)
|
||||||
-- logWarnTrance(#msg.info)
|
|
||||||
-- for index, value in ipairs(msg.info) do
|
|
||||||
-- Log(tostring(value))
|
|
||||||
-- end
|
|
||||||
|
|
||||||
local data={}
|
local data={}
|
||||||
for i,v in ipairs(msg.info) do
|
for i,v in ipairs(msg.info) do
|
||||||
table.insert(data,v)
|
table.insert(data,v)
|
||||||
|
@ -78,7 +73,7 @@ function this:InitGetView()
|
||||||
this.noInfo:SetActive(dataLength==0)
|
this.noInfo:SetActive(dataLength==0)
|
||||||
this.scrollView:SetData(data,function(index,root)
|
this.scrollView:SetData(data,function(index,root)
|
||||||
this:SetView(root,data[index])
|
this:SetView(root,data[index])
|
||||||
end)
|
end,true,true)
|
||||||
--this.scrollView:SetIndex(1)
|
--this.scrollView:SetIndex(1)
|
||||||
if isAuto then
|
if isAuto then
|
||||||
local SpecialConfig=ConfigManager.GetConfigData(ConfigName.SpecialConfig,115)
|
local SpecialConfig=ConfigManager.GetConfigData(ConfigName.SpecialConfig,115)
|
||||||
|
@ -93,12 +88,16 @@ function this:InitGetView()
|
||||||
local count=msg.count
|
local count=msg.count
|
||||||
if success==1 then--红包抢成功
|
if success==1 then--红包抢成功
|
||||||
local itemName=GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.ItemConfig,itemId).Name)
|
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的是福利红包
|
--红包类型大于3的是福利红包
|
||||||
if value.redType>3 then
|
if value.redType>3 then
|
||||||
PlayerManager.SettDailyRedPackageTime(PlayerManager.dailyRedPack+1)
|
PlayerManager.SettDailyRedPackageTime(PlayerManager.dailyRedPack+1)
|
||||||
end
|
end
|
||||||
MyGuildManager.ReuqsetRedPackage()
|
|
||||||
PopupTipPanel.ShowTip(string.format(Language[11046],itemName,count))
|
PopupTipPanel.ShowTip(string.format(Language[11046],itemName,count))
|
||||||
else--抢红包失败
|
else--抢红包失败
|
||||||
LogError(Language[11047])
|
LogError(Language[11047])
|
||||||
|
@ -151,7 +150,6 @@ function this:SetView(root,data)
|
||||||
numOrRecordText.text=Language[11043]
|
numOrRecordText.text=Language[11043]
|
||||||
getBtnImage.sprite=this.spLoader:LoadSprite(BtnStateImage[2]) --Language[10101]
|
getBtnImage.sprite=this.spLoader:LoadSprite(BtnStateImage[2]) --Language[10101]
|
||||||
else
|
else
|
||||||
LogError("redid"..redId)
|
|
||||||
numOrRecordText.text=Language[10580]..(config.Num-data.getCount).."/"..config.Num
|
numOrRecordText.text=Language[10580]..(config.Num-data.getCount).."/"..config.Num
|
||||||
getBtnImage.sprite=this.spLoader:LoadSprite(BtnStateImage[1]) --Language[11044]
|
getBtnImage.sprite=this.spLoader:LoadSprite(BtnStateImage[1]) --Language[11044]
|
||||||
end
|
end
|
||||||
|
@ -172,26 +170,25 @@ function this:SetView(root,data)
|
||||||
local count=msg.count
|
local count=msg.count
|
||||||
if success==1 then--红包抢成功
|
if success==1 then--红包抢成功
|
||||||
local itemName=GetLanguageStrById(ConfigManager.GetConfigData(ConfigName.ItemConfig,itemId).Name)
|
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
|
if data.redType>3 then
|
||||||
PlayerManager.SettDailyRedPackageTime(PlayerManager.dailyRedPack+1)
|
PlayerManager.SettDailyRedPackageTime(PlayerManager.dailyRedPack+1)
|
||||||
end
|
end
|
||||||
PopupTipPanel.ShowTip(string.format(Language[11046],itemName,count))
|
PopupTipPanel.ShowTip(string.format(Language[11046],itemName,count))
|
||||||
MyGuildManager.ReuqsetRedPackage(function()
|
|
||||||
CheckRedPointStatus(RedPointType.Guid_GetPackage)
|
|
||||||
CheckRedPointStatus(RedPointType.Guild_RedPacket)
|
|
||||||
end)
|
|
||||||
else--抢红包失败
|
else--抢红包失败
|
||||||
PopupTipPanel.ShowTip(Language[11047])
|
PopupTipPanel.ShowTip(Language[11047])
|
||||||
end
|
end
|
||||||
this:InitGetView()
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
end)
|
end)
|
||||||
Util.AddOnceClick(numOrRecordBtn,function()--查看记录
|
Util.AddOnceClick(numOrRecordBtn,function()--查看记录
|
||||||
NetManager.GetRedPackageDetailRequest(redId,function(msg)
|
NetManager.GetRedPackageDetailRequest(redId,function(msg)
|
||||||
UIManager.OpenPanel(UIName.RedPacketPopup,redId,data.redType)
|
UIManager.OpenPanel(UIName.RedPacketPopup,redId,data.redType)
|
||||||
this:InitGetView()
|
--this:InitGetView()
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
|
@ -260,9 +260,10 @@ function this.RechargeSuccessFunc(id)
|
||||||
OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, id)
|
OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.DirectPurchaseGift, id)
|
||||||
local redpack=ConfigManager.GetConfigData(ConfigName.GuildRedPackConfig,curIndex)
|
local redpack=ConfigManager.GetConfigData(ConfigName.GuildRedPackConfig,curIndex)
|
||||||
this.SetInfo(curIndex)
|
this.SetInfo(curIndex)
|
||||||
|
MyGuildManager.ReuqsetRedPackage()
|
||||||
--PopupTipPanel.ShowTip(string.format( Language[11051],GetLanguageStrById(redpack.Name)))
|
--PopupTipPanel.ShowTip(string.format( Language[11051],GetLanguageStrById(redpack.Name)))
|
||||||
ChatManager.RequestSendRedPacket(curIndex)
|
ChatManager.RequestSendRedPacket(curIndex)
|
||||||
MyGuildManager.ReuqsetRedPackage()
|
|
||||||
-- CheckRedPointStatus(RedPointType.Guid_GetPackage)
|
-- CheckRedPointStatus(RedPointType.Guid_GetPackage)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -116,10 +116,8 @@ function this:ShowItemInfo(go,data)
|
||||||
PopupTipPanel.ShowTip("成功发送福利红包!")
|
PopupTipPanel.ShowTip("成功发送福利红包!")
|
||||||
this:InitView()
|
this:InitView()
|
||||||
--刷新发送福利红包按钮红点
|
--刷新发送福利红包按钮红点
|
||||||
CheckRedPointStatus(RedPointType.Guid_GetPackage)
|
--CheckRedPointStatus(RedPointType.Guid_GetPackage)
|
||||||
MyGuildManager.ReuqsetRedPackage(function()
|
MyGuildManager.ReuqsetRedPackage()
|
||||||
CheckRedPointStatus(RedPointType.Guid_GetPackage)
|
|
||||||
end)
|
|
||||||
|
|
||||||
--发送公会信息
|
--发送公会信息
|
||||||
local redpack=ConfigManager.GetConfigData(ConfigName.GuildRedPackConfig,data.config.Id)
|
local redpack=ConfigManager.GetConfigData(ConfigName.GuildRedPackConfig,data.config.Id)
|
||||||
|
|
Loading…
Reference in New Issue