一套结构体可以转换成多种语言 *.proto为扩展名
序列化与反序列化
需要下载一个库,Protobuf-net
begingame中的文件引用了common中的的结构体
运行tool 下的protogen.exe 输入*proto文件 输出.cs文件 停止
第一行包体
第二行引用的命名空间
运行这个就生成了
如果报错可以用下面的方式处理引用
接受服务端发过来的消息
粘包和分包
发送的消息放入放入队列中
网络掉线
public class NetworkManager : Singleton<NetworkManager>
{
public enum ServerType
{
GateServer = 0,
BalanceServer,
LoginServer
}
private TcpClient m_Client = null;
private TcpClient m_Connecting = null;
private string m_IP = "127.0.0.1";
private Int32 m_Port = 40001;
private Int32 m_n32ConnectTimes = 0;//连接时间
private ServerType serverType = ServerType.BalanceServer;//默认平衡服务器
private float m_CanConnectTime = 0f;//可能连接时间
private float m_RecvOverTime = 0f;
private float mRecvOverDelayTime = 2f;
private Int32 m_ConnectOverCount = 0;
private float m_ConnectOverTime = 0f;
private Int32 m_RecvOverCount = 0;
public bool canReconnect = false;
public byte[] m_RecvBuffer = new byte[2 * 1024 * 1024];
public Int32 m_RecvPos = 0;
IAsyncResult mRecvResult;
IAsyncResult mConnectResult;
//发送数据stream
public System.IO.MemoryStream mSendStream = new System.IO.MemoryStream();
//接收数据stream
public List<int> mReceiveMsgIDs = new List<int>();
public List<System.IO.MemoryStream> mReceiveStreams = new List<System.IO.MemoryStream>();
public List<System.IO.MemoryStream> mReceiveStreamsPool = new List<System.IO.MemoryStream>();//接受数据的流池
//构造函数初始化
public NetworkManager()
{
for (int i=0;i<50;++i)
{
mReceiveStreamsPool.Add(new System.IO.MemoryStream());//对象池要用多少内容
}
//序列化消息,将protobuff转换为C#文件
//预先创建消息RuntimeTypeModel运行时类型模型
//A
ProtoBuf.Serializer.PrepareSerializer<GSToGC.AbsorbBegin>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.AbsorbRes>();
//B
ProtoBuf.Serializer.PrepareSerializer<GSToGC.BroadcastBuildingDestory>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.BuffEffect>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.BroadcastBattleHeroInfo>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.BattleStateChange>();
//C
ProtoBuf.Serializer.PrepareSerializer<GSToGC.CurCP>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.CurDeadTimes>();
//D
ProtoBuf.Serializer.PrepareSerializer<GSToGC.DestroyEmitEffect>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.DisappearInfo>();
//E
ProtoBuf.Serializer.PrepareSerializer<GSToGC.EmitSkill>();
//F
ProtoBuf.Serializer.PrepareSerializer<GSToGC.FreeState>();
//G
ProtoBuf.Serializer.PrepareSerializer<GSToGC.GOAppear>();
//H
ProtoBuf.Serializer.PrepareSerializer<GSToGC.HitTar>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.HeroKills>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.HPChange>();
//L
ProtoBuf.Serializer.PrepareSerializer<GSToGC.LastingSkillState>();
//M
ProtoBuf.Serializer.PrepareSerializer<GSToGC.MpChange>();
//N
ProtoBuf.Serializer.PrepareSerializer<GSToGC.NotifyOBAppear>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.NotifySkillModelEmitTurn>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.NotifyPassitiveSkillLoad>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.NotifyPassitiveSkillUnLoad>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.NotifyPassitiveSkillRelease>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.NotifySkillModelStartForceMoveTeleport>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.NotifySkillModelStartForceMoveStop>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.NotifySkillModelStartForceMove>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.NotifyBornObj>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.NotifySummonLifeTime>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.NotifySkillModelLeading>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.NotifyAltarBSIco>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.NotifySkillInfo>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.NotifyOtherItemInfo>();
//P
ProtoBuf.Serializer.PrepareSerializer<GSToGC.PrepareSkillState>();
//S
ProtoBuf.Serializer.PrepareSerializer<GSToGC.SummonEffect>();
//R
ProtoBuf.Serializer.PrepareSerializer<GSToGC.RangeEffectEnd>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.RebornSuccess>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.RebornTimes>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.ReleasingSkillState>();
ProtoBuf.Serializer.PrepareSerializer<GSToGC.RunningState>();
//U
ProtoBuf.Serializer.PrepareSerializer<GSToGC.UsingSkillState>();
}
//析构,释放内存的,要给他关掉
~NetworkManager()
{
//接收stream
foreach (System.IO.MemoryStream one in mReceiveStreams)
{
one.Close();
}
foreach (System.IO.MemoryStream one in mReceiveStreamsPool)
{
one.Close();
}
//发送stream
if (mSendStream != null)
{
mSendStream.Close();
}
if (m_Client != null)
{
m_Client.Client.Shutdown(SocketShutdown.Both);
m_Client.GetStream().Close();
m_Client.Close();
m_Client = null;
}
}
//初始化IP,端口号,服务类型:登陆哪个服务器
public void Init(string ip, Int32 port, ServerType type)
{
Debugger.Log("set network ip:" + ip + " port:" + port + " type:" + type);
m_IP = ip;
m_Port = port;
serverType = type;
m_n32ConnectTimes = 0;
canReconnect = true;
m_RecvPos = 0;
#if UNITY_EDITOR
mRecvOverDelayTime = 20000f;//时间延迟最长多长时间
#endif
}
public void UnInit()
{
canReconnect = false;
}
public void Connect()
{
if (!canReconnect) return;
if (m_CanConnectTime > Time.time) return;
if (m_Client != null)
throw new Exception("fuck, The socket is connecting, cannot connect again!");
if (m_Connecting != null)
throw new Exception("fuck, The socket is connecting, cannot connect again!");
Debugger.Log("IClientSession Connect");
IPAddress ipAddress = IPAddress.Parse(m_IP);
try
{
m_Connecting = new TcpClient();
mConnectResult = m_Connecting.BeginConnect(m_IP, m_Port, null, null);
m_ConnectOverCount = 0;
m_ConnectOverTime = Time.time + 2;
}
catch (Exception exc)
{
Debugger.LogError(exc.ToString());
m_Client = m_Connecting;
m_Connecting = null;
mConnectResult = null;
OnConnectError(m_Client, null);
}
}
public void Close()
{
if (m_Client != null)
{
OnClosed(m_Client, null);
}
}
public void Update(float fDeltaTime)
{
if(m_Client != null)
{
DealWithMsg();//处理接受的信息
if (mRecvResult != null)
{
if (m_RecvOverCount > 200 && Time.time > m_RecvOverTime)
{
Debugger.LogError("recv data over 200, so close network.");
Close();
return;
}
++m_RecvOverCount;
if (mRecvResult.IsCompleted)
{
try
{
Int32 n32BytesRead = m_Client.GetStream().EndRead(mRecvResult);
m_RecvPos += n32BytesRead;
if (n32BytesRead == 0)
{
Debugger.LogError("can't recv data now, so close network 2.");
Close();
return;
}
}
catch (Exception exc)
{
Debugger.LogError(exc.ToString());
Close();
return;
}
OnDataReceived(null, null);//接受数据
if (m_Client != null)
{
try
{
mRecvResult = m_Client.GetStream().BeginRead(m_RecvBuffer, m_RecvPos, m_RecvBuffer.Length - m_RecvPos, null, null);
m_RecvOverTime = Time.time + mRecvOverDelayTime;
m_RecvOverCount = 0;
}
catch (Exception exc)
{
Debugger.LogError(exc.ToString());
Close();
return;
}
}
}
}
if (m_Client != null && m_Client.Connected == false)
{
Debugger.LogError("client is close by system, so close it now.");
Close();
return;
}
}
else if (m_Connecting != null)
{
if (m_ConnectOverCount > 200 && Time.time > m_ConnectOverTime)
{
Debugger.LogError("can't connect, so close network.");
m_Client = m_Connecting;
m_Connecting = null;
mConnectResult = null;
OnConnectError(m_Client, null);
return;
}
++m_ConnectOverCount;
if (mConnectResult.IsCompleted)
{
m_Client = m_Connecting;
m_Connecting = null;
mConnectResult = null;
if (m_Client.Connected)
{
try
{
m_Client.NoDelay = true;
//发送时间延迟
m_Client.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 5000);
////接受时间延迟
m_Client.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 5000);
m_Client.Client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true);
mRecvResult = m_Client.GetStream().BeginRead(m_RecvBuffer, 0, m_RecvBuffer.Length, null, null);
m_RecvOverTime = Time.time + mRecvOverDelayTime;
m_RecvOverCount = 0;
OnConnected(m_Client, null);//连接服务器
}
catch (Exception exc)
{
Debugger.LogError(exc.ToString());
Close();
return;
}
}
else
{
OnConnectError(m_Client, null);
}
}
}
else
{
Connect();
}
}
public void SendMsg(ProtoBuf.IExtensible pMsg, Int32 n32MsgID)
{
if (m_Client != null)
{
//清除stream
mSendStream.SetLength(0);
mSendStream.Position = 0;
//序列到stream
ProtoBuf.Serializer.Serialize(mSendStream, pMsg);
CMsg pcMsg = new CMsg((int)mSendStream.Length);
pcMsg.SetProtocalID(n32MsgID);
//把流增加到消息里面,然后把消息发送出去
pcMsg.Add(mSendStream.ToArray(), 0, (int)mSendStream.Length);//放入到队列中
//ms.Close();
#if UNITY_EDITOR
#else
try
{
#endif
#if LOG_FILE && UNITY_EDITOR
if (n32MsgID != 8192 && n32MsgID != 16385)
{
string msgName = "";
if (Enum.IsDefined(typeof(GCToBS.MsgNum), n32MsgID))
{
msgName = ((GCToBS.MsgNum)n32MsgID).ToString();
}
else if (Enum.IsDefined(typeof(GCToCS.MsgNum), n32MsgID))
{
msgName = ((GCToCS.MsgNum)n32MsgID).ToString();
}
else if (Enum.IsDefined(typeof(GCToLS.MsgID), n32MsgID))
{
msgName = ((GCToLS.MsgID)n32MsgID).ToString();
}
else if (Enum.IsDefined(typeof(GCToSS.MsgNum), n32MsgID))
{
msgName = ((GCToSS.MsgNum)n32MsgID).ToString();
}
using (System.IO.StreamWriter sw = new System.IO.StreamWriter(@"E:\Log.txt", true))
{
sw.WriteLine(Time.time + " 发送消息:\t" + n32MsgID + "\t" + msgName);
}
}
#endif
m_Client.GetStream().Write(pcMsg.GetMsgBuffer(), 0, (int)pcMsg.GetMsgSize());//写入流里面以便发出去
#if UNITY_EDITOR
#else
}
catch (Exception exc)
{
Debugger.LogError(exc.ToString());
Close();
}
#endif
}
}
public void OnConnected(object sender, EventArgs e)
{
switch (serverType)
{
case ServerType.BalanceServer:
{
CGLCtrl_GameLogin.Instance.BsOneClinetLogin();
}
break;
case ServerType.GateServer:
{
++m_n32ConnectTimes;
if (m_n32ConnectTimes > 1)
{
CGLCtrl_GameLogin.Instance.EmsgTocsAskReconnect();
}
else
{
CGLCtrl_GameLogin.Instance.GameLogin();
}
EventCenter.Broadcast(EGameEvent.eGameEvent_ConnectServerSuccess);
}
break;
case ServerType.LoginServer:
{
CGLCtrl_GameLogin.Instance.EmsgToLs_AskLogin();
}
break;
}
}
//网络错误
public void OnConnectError(object sender, ErrorEventArgs e)
{
Debug.Log("OnConnectError begin");
try
{
//m_Client.Client.Shutdown(SocketShutdown.Both);
m_Client.GetStream().Close();
m_Client.Close();
m_Client = null;
}
catch (Exception exc)
{
Debugger.Log(exc.ToString());
}
mRecvResult = null;
m_Client = null;
m_RecvPos = 0;
m_RecvOverCount = 0;
m_ConnectOverCount = 0;
//通知连接失败的界面
EventCenter.Broadcast(EGameEvent.eGameEvent_ConnectServerFail);
Debugger.Log("OnConnectError end");
}
//关闭请求
public void OnClosed(object sender, EventArgs e)
{
//通知连接失败的界面
EventCenter.Broadcast(EGameEvent.eGameEvent_ConnectServerFail);
try
{
m_Client.Client.Shutdown(SocketShutdown.Both);
m_Client.GetStream().Close();
m_Client.Close();
m_Client = null;
}
catch (Exception exc)
{
Debugger.Log(exc.ToString());
}
mRecvResult = null;
m_Client = null;
m_RecvPos = 0;
m_RecvOverCount = 0;
m_ConnectOverCount = 0;
mReceiveStreams.Clear();
mReceiveMsgIDs.Clear();
}
//处理接受到的消息
public void DealWithMsg()
{
//判断流的数量,数量大于0,取出来,同时把他移除掉
while (mReceiveMsgIDs.Count>0 && mReceiveStreams.Count>0)
{
int type = mReceiveMsgIDs[0];
System.IO.MemoryStream iostream = mReceiveStreams[0];
mReceiveMsgIDs.RemoveAt(0);
mReceiveStreams.RemoveAt(0);
#if UNITY_EDITOR
#else
try
{
#endif
#if LOG_FILE && UNITY_EDITOR
if (type != 1)
{
//有个ID类型的转换,转换哪个消息
string msgName = "";
if (Enum.IsDefined(typeof(BSToGC.MsgID), type))
{
msgName = ((BSToGC.MsgID)type).ToString();
}
else if (Enum.IsDefined(typeof(LSToGC.MsgID), type))
{
msgName = ((LSToGC.MsgID)type).ToString();
}
else if (Enum.IsDefined(typeof(GSToGC.MsgID), type))
{
msgName = ((GSToGC.MsgID)type).ToString();
}
using (System.IO.StreamWriter sw = new System.IO.StreamWriter(@"E:\Log.txt", true))
{
sw.WriteLine(Time.time + " 收到消息:\t" + type + "\t" + msgName);
}
}
#endif
CGLCtrl_GameLogin.Instance.HandleNetMsg(iostream, type);//处理网络消息
if (mReceiveStreamsPool.Count<100)
{
mReceiveStreamsPool.Add(iostream);//对象池中添加
}
else
{
iostream = null;
}
#if UNITY_EDITOR
#else
}
catch (Exception ecp)
{
Debugger.LogError("Handle Error msgid: " + type);
}
#endif
}
}
public void OnDataReceived(object sender, DataEventArgs e)
{
int m_CurPos = 0;
while (m_RecvPos - m_CurPos >= 8)
{
int len = BitConverter.ToInt32(m_RecvBuffer, m_CurPos);
int type = BitConverter.ToInt32(m_RecvBuffer, m_CurPos + 4);
if (len > m_RecvBuffer.Length)
{
Debugger.LogError("can't pause message" + "type=" + type + "len=" + len);
break;
}
if (len > m_RecvPos - m_CurPos)
{
break;//wait net recv more buffer to parse.
}
//获取stream
System.IO.MemoryStream tempStream = null;
if (mReceiveStreamsPool.Count>0)
{
tempStream = mReceiveStreamsPool[0];
tempStream.SetLength(0);
tempStream.Position = 0;
mReceiveStreamsPool.RemoveAt(0);
}
else
{
tempStream = new System.IO.MemoryStream();
}
//往stream填充网络数据
tempStream.Write(m_RecvBuffer, m_CurPos + 8, len - 8);
tempStream.Position = 0;
m_CurPos += len;
mReceiveMsgIDs.Add(type);
mReceiveStreams.Add(tempStream);
}
if (m_CurPos > 0)
{
m_RecvPos = m_RecvPos - m_CurPos;
if (m_RecvPos < 0)
{
Debug.LogError("m_RecvPos < 0");
}
if (m_RecvPos > 0)
{
Buffer.BlockCopy(m_RecvBuffer, m_CurPos, m_RecvBuffer, 0, m_RecvPos);//把Buffer拷贝一下
}
}
}
}
所有的状态都监听
广播
public enum EMessageType
{
EMT_None = -1,
EMT_Reconnect, //断网重连提示
EMT_ReEnter, //断线重登录提示
EMT_Disconnect, //连接异常退出
EMT_KickOut, //被踢下线
EMT_BuyGoodsSuccess,
EMT_PlaseWaitForGameFuture,
EMT_SureToWash,
}
public class MessageWindow : BaseWindow
{
public MessageWindow()
{
mScenesType = EScenesType.EST_None;
mResName = GameConstDefine.GameConnectMsg;
mResident = false;
}
public Callback<bool> m_Callback = null;
////////////////////////////继承接口/////////////////////////
//类对象初始化
public override void Init()
{
EventCenter.AddListener<EMessageType>(EGameEvent.eGameEvent_ShowMessage, ShowMessage);
EventCenter.AddListener<EMessageType, string, Callback<bool>>(EGameEvent.eGameEvent_ShowLogicMessage, ShowMessage);
}
//类对象释放
public override void Realse()
{
EventCenter.RemoveListener<EMessageType>(EGameEvent.eGameEvent_ShowMessage, ShowMessage);
EventCenter.RemoveListener<EMessageType, string, Callback<bool>>(EGameEvent.eGameEvent_ShowLogicMessage, ShowMessage);
}
//窗口控件初始化
protected override void InitWidget()
{
mCaption = mRoot.FindChild("Status/Tip1").GetComponent<UILabel>();
mMessage = mRoot.FindChild("Status/Tip2").GetComponent<UILabel>();
mSubmitBt = mRoot.FindChild("Status/Button").GetComponent<UIButton>();
mTimeLabel = mRoot.FindChild("Status/Button/Time").GetComponent<UILabel>();
m_CloseBtn = mRoot.FindChild("CloseBtn").GetComponent<UIButton>();
EventDelegate.Add(mSubmitBt.onClick, OnButtonPressed);
EventDelegate.Add(m_CloseBtn.onClick, onClickCloseBtn);
}
public void onClickCloseBtn()
{
if (m_Callback != null)
{
m_Callback(false);
}
Hide();
}
//删除Login外其他控件,例如
public static void DestroyOtherUI()
{
}
//窗口控件释放
protected override void RealseWidget()
{
}
//游戏事件注册
protected override void OnAddListener()
{
EventCenter.AddListener(EGameEvent.eGameEvent_ConnectServerSuccess, Hide);
EventCenter.AddListener(EGameEvent.eGameEvent_ReConnectSuccess, Hide);
EventCenter.AddListener(EGameEvent.eGameEvent_ReConnectFail, Hide);
EventCenter.AddListener(EGameEvent.eGameEvent_BatttleFinished, BatttleFinished);
}
//游戏事件注消
protected override void OnRemoveListener()
{
EventCenter.RemoveListener(EGameEvent.eGameEvent_ConnectServerSuccess, Hide);
EventCenter.RemoveListener(EGameEvent.eGameEvent_ReConnectSuccess, Hide);
EventCenter.RemoveListener(EGameEvent.eGameEvent_ReConnectFail, Hide);
EventCenter.RemoveListener(EGameEvent.eGameEvent_BatttleFinished, BatttleFinished);
}
//显示
public override void OnEnable()
{
}
//隐藏
public override void OnDisable()
{
mStatus = EMessageType.EMT_None;
}
public override void Update(float deltaTime)
{
if (mStatus == EMessageType.EMT_Reconnect)
{
int timeThrought = (int)(Time.time - mTimeCount);
if (timeThrought > 0)
{
int limit = mConnectCount - timeThrought;
mTimeLabel.text = "00:" + limit.ToString();
}
if (timeThrought >= mConnectCount)
{
Hide();
ShowMessage(EMessageType.EMT_Disconnect);
}
}
}
public void ShowMessage(EMessageType st, string str, Callback<bool> callback)
{
if (mVisible)
return;
m_Callback = callback;
mStatus = st;
Show();
switch (mStatus)
{
case EMessageType.EMT_SureToWash:
mMessage.text = str;
mSubmitBt.isEnabled = true;
mTimeLabel.text = "确认";
mCaption.gameObject.SetActive(false);
m_CloseBtn.gameObject.SetActive(true);
break;
}
}
public void ShowMessage(EMessageType st)
{
if (mVisible)
return;
mStatus = st;
mBatttleFinished = false;
Show();
m_CloseBtn.gameObject.SetActive(false);
switch (mStatus)
{
case EMessageType.EMT_Reconnect:
mCaption.text = ConfigReader.GetMsgInfo(40041).content;
mMessage.text = ConfigReader.GetMsgInfo(40042).content;
mConnectCount = 30;
mTimeCount = Time.time;
mTimeLabel.text = "00:" + mConnectCount.ToString();
mSubmitBt.isEnabled = false;
break;
case EMessageType.EMT_ReEnter:
mCaption.text = ConfigReader.GetMsgInfo(40041).content;
mMessage.text = ConfigReader.GetMsgInfo(40044).content;
mTimeLabel.text = ConfigReader.GetMsgInfo(40045).content;
mSubmitBt.isEnabled = true;
break;
case EMessageType.EMT_Disconnect:
mCaption.text = ConfigReader.GetMsgInfo(40041).content;
mMessage.text = ConfigReader.GetMsgInfo(40043).content;
mTimeLabel.text = ConfigReader.GetMsgInfo(40046).content;
mSubmitBt.isEnabled = true;
break;
case EMessageType.EMT_KickOut:
mCaption.text = ConfigReader.GetMsgInfo(40041).content;
mMessage.text = ConfigReader.GetMsgInfo(40047).content;
mTimeLabel.text = ConfigReader.GetMsgInfo(40046).content;
mSubmitBt.isEnabled = true;
break;
case EMessageType.EMT_BuyGoodsSuccess:
mMessage.text = ConfigReader.GetMsgInfo(10031).content;
mSubmitBt.isEnabled = true;
mTimeLabel.text = "确认";
mCaption.gameObject.SetActive(false);
break;
case EMessageType.EMT_PlaseWaitForGameFuture:
mMessage.text = "敬请期待";
mSubmitBt.isEnabled = true;
mTimeLabel.text = "确认";
mCaption.gameObject.SetActive(false);
break;
}
}
private void OnButtonPressed()
{
switch (this.mStatus)
{
case EMessageType.EMT_Reconnect:
break;
case EMessageType.EMT_ReEnter:
{
if (mBatttleFinished)
{
CGLCtrl_GameLogin.Instance.EmsgToss_AskReEnterRoom();
}
else
{
CGLCtrl_GameLogin.Instance.EmsgTocs_AskReConnetToBattle();
}
}
break;
case EMessageType.EMT_Disconnect:
case EMessageType.EMT_KickOut:
LoginCtrl.Instance.SdkLogOff();
Hide();
//Application.Quit();
break;
case EMessageType.EMT_BuyGoodsSuccess:
case EMessageType.EMT_PlaseWaitForGameFuture:
Hide();
break;
case EMessageType.EMT_SureToWash:
{
m_Callback(true);
Hide();
}
break;
}
}
public void BatttleFinished()
{
mBatttleFinished = true;
}
private EMessageType mStatus = EMessageType.EMT_None;
private UILabel mCaption;
private UILabel mMessage;
private UIButton mSubmitBt;
private UILabel mTimeLabel;
private int mConnectCount = 30;
private float mTimeCount;
private UIButton m_CloseBtn;
private bool mBatttleFinished;
}