Пример #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);
     }
 }