public void OnConnected() { NetCore.Init(); NetSender.Init(); NetReceiver.Init(); // TODO: do handshake rpc }
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) //{ //} }
// Use this for initialization void Start() { NetCore.Init(); NetReceiver.Init(); NetSender.Init(); var goTestWin = GameObject.Find("TestWin"); // 打开测试界面 goTestWin.AddComponent <TestWin>(); }
private void InitMain() { Debug.Log("开始初始化网络"); NetCore.Init(); NetSender.Init(); NetReceiver.Init(); NetCore.enabled = true; }
override public void Init() { NetSender.Init(); NetReceiver.Init(); NetCore.Init(); NetCore.enabled = true; Connect(); }
void Awake() { if (!bInit) { bInit = true; NetCore.Init(); NetSender.Init(); NetReceiver.Init(); DontDestroyOnLoad(gameObject); } }