示例#1
0
 public void Serialize(NetDataWriter writer)
 {
     time = (int)(System.DateTime.Now.Ticks / System.TimeSpan.TicksPerMillisecond);
     hash = CentralNetworkManager.GetAppServerRegisterHash(peerInfo.peerType, time);
     peerInfo.Serialize(writer);
     writer.Put(time);
     writer.Put(hash);
 }
 public void StartCentralServer()
 {
     CentralNetworkManager.useWebSocket    = UseWebSocket;
     CentralNetworkManager.webSocketSecure = WebSocketSecure;
     CentralNetworkManager.webSocketCertificateFilePath = WebScoketCertificateFilePath;
     CentralNetworkManager.webSocketCertificatePassword = WebScoketCertificatePassword;
     CentralNetworkManager.StartServer();
 }
 public void Serialize(NetDataWriter writer)
 {
     time = (int)System.DateTimeOffset.Now.ToUnixTimeSeconds();
     hash = CentralNetworkManager.GetAppServerRegisterHash(peerInfo.peerType, time);
     peerInfo.Serialize(writer);
     writer.Put(time);
     writer.Put(hash);
 }
示例#4
0
 public bool ValidateHash()
 {
     if (string.IsNullOrEmpty(hash))
     {
         return(false);
     }
     return(hash.Equals(CentralNetworkManager.GetAppServerRegisterHash(peerInfo.peerType, time)));
 }
 public override void SerializeData(NetDataWriter writer)
 {
     if (peerInfo == null)
         peerInfo = new CentralServerPeerInfo();
     time = (int)(System.DateTime.Now.Ticks / System.TimeSpan.TicksPerMillisecond);
     hash = CentralNetworkManager.GetAppServerRegisterHash(peerInfo.peerType, time);
     peerInfo.Serialize(writer);
     writer.Put(time);
     writer.Put(hash);
 }
示例#6
0
        public ClusterServer(CentralNetworkManager centralNetworkManager) : base(new TcpTransport())
        {
            this.centralNetworkManager = centralNetworkManager;
#if UNITY_STANDALONE && !CLIENT_BUILD
            EnableRequestResponse(MMOMessageTypes.Request, MMOMessageTypes.Response);
            // Generic
            RegisterRequestHandler <RequestAppServerRegisterMessage, ResponseAppServerRegisterMessage>(MMORequestTypes.RequestAppServerRegister, HandleRequestAppServerRegister);
            RegisterRequestHandler <RequestAppServerAddressMessage, ResponseAppServerAddressMessage>(MMORequestTypes.RequestAppServerAddress, HandleRequestAppServerAddress);
            // Map
            RegisterMessageHandler(MMOMessageTypes.Chat, HandleChat);
            RegisterMessageHandler(MMOMessageTypes.UpdateMapUser, HandleUpdateMapUser);
            RegisterMessageHandler(MMOMessageTypes.UpdatePartyMember, HandleUpdatePartyMember);
            RegisterMessageHandler(MMOMessageTypes.UpdateParty, HandleUpdateParty);
            RegisterMessageHandler(MMOMessageTypes.UpdateGuildMember, HandleUpdateGuildMember);
            RegisterMessageHandler(MMOMessageTypes.UpdateGuild, HandleUpdateGuild);
            // Map-spawn
            RegisterRequestHandler <RequestSpawnMapMessage, ResponseSpawnMapMessage>(MMORequestTypes.RequestSpawnMap, HandleRequestSpawnMap);
            RegisterResponseHandler <RequestSpawnMapMessage, ResponseSpawnMapMessage>(MMORequestTypes.RequestSpawnMap, HandleResponseSpawnMap);
#endif
        }
示例#7
0
 public void RequestSelectCharacter(string characterId, ResponseDelegate <ResponseSelectCharacterMessage> callback)
 {
     CentralNetworkManager.RequestSelectCharacter(characterId, (responseHandler, responseCode, response) => OnRequestSelectCharacter(responseHandler, responseCode, response, characterId, callback).Forget());
 }
示例#8
0
 public void RequestDeleteCharacter(string characterId, ResponseDelegate <ResponseDeleteCharacterMessage> callback)
 {
     CentralNetworkManager.RequestDeleteCharacter(characterId, callback);
 }
示例#9
0
 public void StartCentralClient(string address, int port)
 {
     CentralNetworkManager.useWebSocket    = UseWebSocket;
     CentralNetworkManager.webSocketSecure = WebSocketSecure;
     CentralNetworkManager.StartClient(address, port);
 }
示例#10
0
 public void RequestCharacters(ResponseDelegate <ResponseCharactersMessage> callback)
 {
     CentralNetworkManager.RequestCharacters(callback);
 }
示例#11
0
 public void RequestValidateAccessToken(string userId, string accessToken, ResponseDelegate <ResponseValidateAccessTokenMessage> callback)
 {
     CentralNetworkManager.RequestValidateAccessToken(userId, accessToken, (responseHandler, responseCode, response) => OnRequestValidateAccessToken(responseHandler, responseCode, response, callback).Forget());
 }
示例#12
0
 public void RequestUserLogout(ResponseDelegate <INetSerializable> callback)
 {
     CentralNetworkManager.RequestUserLogout((responseHandler, responseCode, response) => OnRequestUserLogout(responseHandler, responseCode, response, callback).Forget());
 }
示例#13
0
 public void RequestUserRegister(string username, string password, string email, ResponseDelegate <ResponseUserRegisterMessage> callback)
 {
     CentralNetworkManager.RequestUserRegister(username, password, email, callback);
 }
示例#14
0
 public void RequestUserLogin(string username, string password, ResponseDelegate <ResponseUserLoginMessage> callback)
 {
     CentralNetworkManager.RequestUserLogin(username, password, (responseHandler, responseCode, response) => OnRequestUserLogin(responseHandler, responseCode, response, callback).Forget());
 }
示例#15
0
 public void StopCentralClient()
 {
     CentralNetworkManager.StopClient();
 }
示例#16
0
 public void RequestCreateCharacter(PlayerCharacterData characterData, ResponseDelegate <ResponseCreateCharacterMessage> callback)
 {
     CentralNetworkManager.RequestCreateCharacter(characterData, callback);
 }
示例#17
0
 public void StartCentralClient()
 {
     CentralNetworkManager.useWebSocket    = UseWebSocket;
     CentralNetworkManager.webSocketSecure = WebSocketSecure;
     CentralNetworkManager.StartClient();
 }