void OnRequestReceived(NetWork.Session session, BinaryRequestInfo requestInfo) { Console.WriteLine("OnRequestReceived success."); ByteBuffer buffer = new ByteBuffer(requestInfo.Body); if (buffer == null) { Console.WriteLine("----------Error data"); return; } try { //int length = buffer.ReadShort (); int length = 0; C2S_Proto_Type protoType = (C2S_Proto_Type)buffer.ReadShort(); Console.WriteLine("Receive proto size : {0}, name : {1}", length, protoType); switch (protoType) { case C2S_Proto_Type.Proto_Stuff_Login: { Stuff_Login login = ProtoUtil.Deserialize <Stuff_Login>(buffer); if (CheckAuthentication(login)) { Player player = new Player(login.PlayerId); player.SetSession(session); player.OnPlayerLogin(); } } break; case C2S_Proto_Type.Proto_Stuff_Account: { Stuff_Account account = ProtoUtil.Deserialize <Stuff_Account>(buffer); Console.WriteLine(account.UserName + account.PassWord); } break; default: break; } } catch (Exception ex) { Console.WriteLine("Deserialize exception : {0}", ex.Message); } }
// Connect Au server to authentication username and password private bool CheckAuthentication(Stuff_Login login) { return(true); }