public void btn_LoginClick()
    {
        RawMessage message = new RawMessage();

        message.putUTF8String("username", input_username.text);
        message.putUTF8String("password", input_password.text);

        Assets.Scripts.Engine.Network.sslStream.WriteSingleMessage(message);
        RawMessage msg = Assets.Scripts.Engine.Network.sslStream.ReadSingleMessage();

        if (msg == null)
        {
            Assets.Scripts.Engine.Network.server.Disconnect();
            output_loginResult.text = "Connection is Lost.";
            return;
        }

        if (msg.getBool("response"))
        {
            //Assets.Scripts.Engine.Network.sslStream.Close();  // DUE TO A BUG -kardeslerim- WE CANNOT CLOSE THE STREAM.
            // Cunku close yaparsak, nereden geldigi belirsiz 37 byte, serverda bu client'a ait messageListenera dusuyor.
            // sadece unity'de oluyor, .net'te duzgun calisiyor. Muhtemelen Mono kaynakli bir sorun.

            Assets.Scripts.Engine.Network.server.ListenForMessages();
            output_loginResult.color = Color.green;
        }

        output_loginResult.text = msg.getUTF8String("reason");
        input_username.text     = "";
        input_password.text     = "";
        input_username.selected = true;
        StartCoroutine(hideLoginResult());
    }
		public override void processMessage(RawMessage message)
		{
			bool r = message.getBool("r");
			if(r)
				UserMe.self.setState(User.UserState.QUEUE);

			Runner.Graphics.displayQueueResult(r);
		}	
        public override void processMessage(RawMessage message)
        {
            bool r = message.getBool("r");

            if (r)
            {
                UserMe.self.setState(User.UserState.QUEUE);
            }

            Runner.Graphics.displayQueueResult(r);
        }
        public override void processMessage(RawMessage message, User user)
        {
            if (message.getBool("r"))
            {
                if (user.userState == User.UserState.GAME)
                {
                    OutgoingMessages.Game.GReadyStateResult.sendMessage(user.player.game.players, message.getBool("r"));
                    user.player.readyInQueue = true;

                    bool anyoneDisconnected = false;
                    bool flagAllReady = true;
                    User disconnectedUser = null;
                    foreach (Player p in user.player.game.players)
                        if (p.user.Destroyable)
                        {
                            anyoneDisconnected = true;
                            disconnectedUser = p.user;
                            break;
                        }
                        else if (!p.readyInQueue)
                        {
                            flagAllReady = false;
                            break;
                        }

                    if (anyoneDisconnected)
                        destroyGame(disconnectedUser);
                    else if (flagAllReady)
                        user.player.game.setState(Science_Wars_Server.Game.GameState.LOADING);

                }
            }
            else
            {
                destroyGame(user);
            }
        }
Beispiel #5
0
        public override void processMessage(RawMessage message)
        {
            bool result = message.getBool("r");

            if (result)
            {                
                UserMe.initializeUserMe(message.getInt("ui"),
                                        message.getUTF8String("un"),
                                        message.getInt("psp"),
                                        message.getInt("csp"),
                                        message.getInt("bsp"),
                                        message.getBoolArray("usn"));
            }
            else
                ;//TODO login fail. handle it
            
        }
Beispiel #6
0
        public override void processMessage(RawMessage message)
        {
            bool result = message.getBool("r");

            if (result)
            {
                UserMe.initializeUserMe(message.getInt("ui"),
                                        message.getUTF8String("un"),
                                        message.getInt("psp"),
                                        message.getInt("csp"),
                                        message.getInt("bsp"),
                                        message.getBoolArray("usn"));
            }
            else
            {
                ;//TODO login fail. handle it
            }
        }
Beispiel #7
0
        public override void processMessage(RawMessage message, User user)
        {
            if (message.getBool("r"))
            {
                if (user.userState == User.UserState.GAME)
                {
                    OutgoingMessages.Game.GReadyStateResult.sendMessage(user.player.game.players, message.getBool("r"));
                    user.player.readyInQueue = true;

                    bool anyoneDisconnected = false;
                    bool flagAllReady       = true;
                    User disconnectedUser   = null;
                    foreach (Player p in user.player.game.players)
                    {
                        if (p.user.Destroyable)
                        {
                            anyoneDisconnected = true;
                            disconnectedUser   = p.user;
                            break;
                        }
                        else if (!p.readyInQueue)
                        {
                            flagAllReady = false;
                            break;
                        }
                    }

                    if (anyoneDisconnected)
                    {
                        destroyGame(disconnectedUser);
                    }
                    else if (flagAllReady)
                    {
                        user.player.game.setState(Science_Wars_Server.Game.GameState.LOADING);
                    }
                }
            }
            else
            {
                destroyGame(user);
            }
        }
 public override void processMessage(RawMessage message)
 {
     bool r = message.getBool("r");
     // TODO ayar cek pic
 }
		public override void processMessage(RawMessage message)
		{
			bool r = message.getBool("r");
			// TODO ayar cek pic
		}	
 public override void processMessage(RawMessage message)
 {
     bool result = message.getBool("r");
     Runner.Graphics.displayReadyStates(result);
 }
Beispiel #11
0
 public override void processMessage(RawMessage message)
 {
     bool result = message.getBool("r");
 }
		public override void processMessage(RawMessage message)
		{
			bool result = message.getBool("r");

		}
Beispiel #13
0
        public override void processMessage(RawMessage message)
        {
            bool result = message.getBool("r");

            Runner.Graphics.displayReadyStates(result);
        }