Files
JJBB/Assets/Project/Script/GameLogic/NetWork/PacketHandler/GC_NOTICEHandler.cs
2024-08-23 15:49:34 +08:00

92 lines
3.1 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//This code create by CodeEngine
using System;
using Module.Log;
using Google.ProtocolBuffers;
using System.Collections;
using System.Collections.Generic;
namespace SPacket.SocketInstance
{
public class GC_NOTICEHandler : Ipacket
{
// 当在使用特殊礼包2时需要等它的显示效果结束后再公布结果
public List<PacketDistributed> tempBlockMsg = new List<PacketDistributed>(); // 暂时阻塞的消息
private bool hasDel = false;
private bool isReleaseing = false;
public uint Execute(PacketDistributed ipacket)
{
GC_NOTICE packet = (GC_NOTICE)ipacket;
if (null == packet) return (uint)PACKET_EXE.PACKET_EXE_ERROR;
if(packet.HasShowmessagebox && packet.Showmessagebox == 1)
{
MessageBoxLogic.OpenOKBox(GCGame.Table.StrDictionary.GetServerDictionaryFormatString(packet.Notice), "", delegate() {
UIManager.CloseUI(UIInfo.MessageBox);
});
return (uint)PACKET_EXE.PACKET_EXE_ERROR;
}
if (packet.HasNotice)
{
if(isReleaseing == false)
{
// 如果特殊礼包2正在显示
if (GiftBagRandomPanelCtr.Instance != null)
{
if (hasDel == false)
{
GiftBagRandomPanelCtr.Instance.OnDisableEvent += ReleaseBlockMsg;
hasDel = true;
}
if (GiftBagRandomPanelCtr.Instance.gameObject.activeInHierarchy == true)
{
tempBlockMsg.Add(ipacket);
return (uint)PACKET_EXE.PACKET_EXE_CONTINUE;
}
}
}
bool IsFilterRepeat = false;
if(packet.HasFilterRepeat)
{
IsFilterRepeat = packet.FilterRepeat == 1? true:false;
}
if (packet.Notice.StartsWith("#{999999}"))
{
string[] noticeSplit = packet.Notice.Split('*');
if(noticeSplit.Length != 3)
return (uint)PACKET_EXE.PACKET_EXE_CONTINUE;
int type1 = int.Parse(noticeSplit[1]);
int type2 = int.Parse(noticeSplit[2]);
PlayerData.NoticeLack(type1, type2);
}
else
{
GUIData.AddNotifyData(packet.Notice, IsFilterRepeat);
if (packet.Notice == "#{2129}")
{
UIManager.CloseUI(UIInfo.RankRoot);
}
}
}
return (uint)PACKET_EXE.PACKET_EXE_CONTINUE;
}
// 释放被阻塞的信息
public void ReleaseBlockMsg()
{
isReleaseing = true;
foreach (PacketDistributed p in tempBlockMsg)
{
Execute(p);
}
tempBlockMsg.Clear();
isReleaseing = false;
}
}
}