Example #1
0
 public override void Uninitialize()
 {
     //Main.Instance.eventFrameEnter -= _onUpdate;
     GameApp.eventUpdate -= _onUpdate;
     //m_net_client_gamesrv.Unregister( Msg_gc_Heartbeat.MyMessageId );
     if (m_net_client_gamesrv != null)
     {
         m_net_client_gamesrv.Disconnect();
         m_net_client_gamesrv.Uninitialize();
         m_net_client_gamesrv = null;
     }
 }
Example #2
0
        /// <summary>
        /// 初始化函数
        /// </summary>
        /// <returns></returns>
        public override bool Initialize()
        {
            // 网络库初始化
            m_net_client_gamesrv = new NetClientStream();
            m_net_client_gamesrv.Initialize((Int32)NetStreamName.GameSrv);

            // 初始化状态机
            List <State <NetWorkStateType, NetProvider_Default> > states = new List <State <NetWorkStateType, NetProvider_Default> >();

            foreach (NetWorkStateType t in Enum.GetValues(typeof(NetWorkStateType)))
            {
                states.Add(NetworkState.Instantiate(t, this, m_fsm));
            }
            m_fsm.Initialize(this, states);
            m_fsm.ChangeStateTo(NetWorkStateType.Idle);
            //Main.Instance.eventFrameEnter += _onUpdate;
            GameApp.eventUpdate += _onUpdate;
            return(true);
        }