Example #1
0
    void Update()
    {
        MSG.MSGEvent e = null;
        PlayerPrefs.SetString("m_MSG_LogLevel", m_MSG_LogLevel.ToString());

        m_discon_uid_list.Clear();
        foreach (var v in m_mapMSGClient)
        {
            nNWM.nDummy.NetEventPlugin plugin = v.Value;
            MSG.MSGClient client = plugin.m_MSGClient;
            if (client == null)
            {
                continue;
            }

            while (client.PopEvent(out e))
            {
                switch (e.EventType)
                {
                case MSG.MSGEventType.Connected:
                    plugin.NetLog("[Net] On Connect : " + plugin.db_id(), true);                            //nNWM.nUtil.jDumper.NamedDump(e));
                    plugin.OnConnect();
                    break;

                case MSG.MSGEventType.Disconnected:
                    plugin.NetLog("[Net] On Disconnect", true);                           // + nNWM.nUtil.jDumper.NamedDump(e),true);
                    plugin.OnDisconnect();
                    plugin.m_MSGClient = null;
                    //m_discon_uid_list.Add(plugin.db_id());
                    break;

                case MSG.MSGEventType.RecvMessage:
                    onRecvFromUG(plugin, e);
                    break;

                default:
                    plugin.NetError("[Net] Unkown MSGEventType : " + e.EventType.ToString() + " : " + nNWM.nUtil.jDumper.NamedDump(e));
                    break;
                }
            }
            if (e != null)
            {
                client.InsertEventToRecyclingPool(e);
            }
        }        //foreach (var v in m_mapMSGClient)

//      foreach(var uid in m_discon_uid_list)
//      {
//          m_mapMSGClient.Remove(uid);
//      }
    }    //void FixedUpdate ()