Пример #1
0
        public void Handle(NetConnection sender, SNMessageData messageData)
        {
            if (!(sender.Tag is PlayerClient))
            {
                return;
            }

            var client = (PlayerClient)sender.Tag;
            var selectCharacterMessageData = (SelectCharacterMessageData)messageData;

            if (!IsAccountCharacter(client.PersistentId, selectCharacterMessageData.CharacterId, out Character character))
            {
                return;
            }

            var characterSelectedMessageData = new CharacterSelectedMessageData();

            characterSelectedMessageData.Character = character;
            outgoingMessageService.Send(characterSelectedMessageData, sender);

            var player = new Player(client, character);

            playerRepository.Add(player);
            sender.Tag = player;

            // Send already connected players positions
            entitiesProcessor.NewPlayerConnected(player);
        }
Пример #2
0
        public void Handle(NetConnection sender, SNMessageData messageData)
        {
            if (!(sender.Tag is Player))
            {
                return;
            }

            entitiesProcessor.NewPlayerConnected((Player)sender.Tag);
        }