static void Main() { App_Update.Init(); App_Event.Init(); App_ClientSocket.InitSocket(EServerType.Type_Login, SIpPort.Create(ip_login, port_login)); // App_ClientSocket.InitSocket(EServerType.Type_Game, SIpPort.Create(ip_game, port_game)); AsynchronousClient clientSocket = App_ClientSocket.ClientSockets[EServerType.Type_Login]; clientSocket.conFinishedCallback = (bool succeed) => { if (succeed) { Log("Type_Login" + "===Connected Succeed"); PacketSend pk = PacketSend.Create(EEvents.Event_LoginHeart); pk.Write((byte)1); pk.Write("meng dong..你好"); App_ClientSocket.Send(pk, EServerType.Type_Login); pk = PacketSend.Create(EEvents.Event_ServerTime); App_ClientSocket.Send(pk, EServerType.Type_Login); } else { Log("Type_Login" + "===Connected Failed!!!"); } }; clientSocket.HandleConnect(); //if (!App_ClientSocket.ClientSockets.ContainsKey(EServerType.Type_Game)) //{ // Log("Error!!!===!App_ClientSocket.ClientSockets.ContainsKey(EServerType.Type_Game)"); // return; //} //clientSocket = App_ClientSocket.ClientSockets[EServerType.Type_Game]; //clientSocket.conFinishedCallback = (bool succeed) => //{ // if (succeed) // { // Log("Type_Game" + "===Connected Succeed"); // PacketSend pk = PacketSend.Create(EEvents.Event_GameHeart); // App_ClientSocket.Send(pk, EServerType.Type_Game); // } // else // { // Log("Type_Game" + "===Connected Failed!!!"); // } //}; //clientSocket.HandleConnect(); Start(); }
/// <summary> /// 每帧执行 1/60s = 20毫秒 /// </summary> public static void UpdateFrame() { App_ClientSocket.Update(); //AsynchronousClient.Update(); }