예제 #1
0
 public void OnConnected()
 {
     NetCore.Init();
     NetSender.Init();
     NetReceiver.Init();
     // TODO: do handshake rpc
 }
예제 #2
0
    private Thread _sendHeartBeatThread;  // send and receive heartbeat msg thread


    //constructor, init NetCore,NetSender,NetReceiver, add receiver handler, start check network thread
    public NetWorkClient()
    {
        var forInit = Loom.Current;//to initialize Loom in mainThread

        TheUserLoginState = UserLoginState.NullState;
        TheUserMatchState = UserMatchState.NullState;
        MultiGameState    = GameState.Game_NullState;

        AllPlayers = new List <MultiPlayerInfo>();

        // Debug.Log("init netclient");
        NetCore.Init();
        NetCore.SocketDisconnectHandler += Reconnect;
        NetSender.Init();
        NetReceiver.Init();

        SetupNetReceiverHandler();

        StartConnect();

        //mChen
        //_checkNetworkThread = new Thread(CheckHeartBeat) { IsBackground = true };
        ////防止后台现成。相反需要后台线程就设为false
        //_checkNetworkThread.Start();
        //while (_checkNetworkThread.IsAlive == false)
        //{
        //}
    }
예제 #3
0
    // Use this for initialization
    void Start()
    {
        NetCore.Init();
        NetReceiver.Init();
        NetSender.Init();
        var goTestWin = GameObject.Find("TestWin");     // 打开测试界面

        goTestWin.AddComponent <TestWin>();
    }
예제 #4
0
        private void InitMain()
        {
            Debug.Log("开始初始化网络");

            NetCore.Init();
            NetSender.Init();
            NetReceiver.Init();

            NetCore.enabled = true;
        }
예제 #5
0
    override public void Init()
    {
        NetSender.Init();
        NetReceiver.Init();
        NetCore.Init();

        NetCore.enabled = true;

        Connect();
    }
예제 #6
0
 void Awake()
 {
     if (!bInit)
     {
         bInit = true;
         NetCore.Init();
         NetSender.Init();
         NetReceiver.Init();
         DontDestroyOnLoad(gameObject);
     }
 }