Beispiel #1
0
 private static void UserForm_PlayerChanged(object?sender, PlayerChangedEventArgs e)
 {
     Settings.conInterface.WriteModuleTextColored("PlayerChange", Color.DarkKhaki, $"{e.Name}: {e.Action}");
     if (e.isImposter)
     {
         Settings.conInterface.WriteModuleTextColored("Imposter", Color.Red, $"{e.Name}");
     }
 }
Beispiel #2
0
 private void onCurrentPlayerChanged(Player i_CurrentPlayer, bool i_HasAvailableMoves)
 {
     if (m_CurrentPlayerChangedDelegate != null)
     {
         PlayerChangedEventArgs playerChangedArgs = new PlayerChangedEventArgs(i_CurrentPlayer, i_HasAvailableMoves);
         m_CurrentPlayerChangedDelegate.Invoke(this, playerChangedArgs);
     }
 }
Beispiel #3
0
 public static string getName(this EventArgs ev)
 {
     return(ev switch
     {
         GameStateEventArgs _ => "state",
         PlayerChangedEventArgs _ => "player",
         LobbyEventArgs _ => "lobby",
         AmongUsData _ => "refresh",
         EndPlayerStatsEventArgs _ => "endplayerstats",
         _ => "null"
     });
        private void UserForm_PlayerChanged(object sender, PlayerChangedEventArgs e)
        {
            if (e.Action == PlayerAction.Died)
            {
                DeadMessages.Enqueue($"{PlayerColorToColorOBJ(e.Color).ToTextColor()}{e.Name}{NormalTextColor.ToTextColor()}: {e.Action}");
            }
            else
            {
                AmongUsCapture.Settings.conInterface.WriteModuleTextColored("PlayerChange", Color.DarkKhaki, $"{PlayerColorToColorOBJ(e.Color).ToTextColor()}{e.Name}{NormalTextColor.ToTextColor()}: {e.Action}");
            }

            //Program.conInterface.WriteModuleTextColored("GameMemReader", Color.Green, e.Name + ": " + e.Action);
        }
Beispiel #5
0
        private void UserForm_PlayerChanged(object sender, PlayerChangedEventArgs e)
        {
            if (e.Action == PlayerAction.Died)
            {
                if (context.Players.Any(x => x.Name == e.Name))
                {
                    DeadMessages.Enqueue(context.Players.First(x => x.Name == e.Name));
                }
            }
            else
            {
                if (e.Action != PlayerAction.Joined && context.Players.Any(x => String.Equals(x.Name, e.Name, StringComparison.CurrentCultureIgnoreCase)))
                {
                    var player = context.Players.First(x => String.Equals(x.Name, e.Name, StringComparison.CurrentCultureIgnoreCase));
                    Dispatcher.Invoke((Action)(() =>
                    {
                        switch (e.Action)
                        {
                        case PlayerAction.ChangedColor:
                            player.Color = e.Color;
                            break;

                        case PlayerAction.Disconnected:
                        case PlayerAction.Left:
                            context.Players.Remove(player);
                            break;

                        case PlayerAction.Exiled:
                        case PlayerAction.Died:
                            player.Alive = false;
                            break;
                        }
                    }));
                }
                else
                {
                    if (e.Action == PlayerAction.Joined)
                    {
                        Dispatcher.Invoke((Action)(() => { context.Players.Add(new Player(e.Name, e.Color, !e.IsDead, 0, 0)); }));
                    }
                }
            }

            AmongUsCapture.Settings.conInterface.WriteModuleTextColored("GameMemReader", Color.Green, e.Name + ": " + e.Action);
        }
Beispiel #6
0
        public void PlayerChanged(object sender, PlayerChangedEventArgs e)
        {
            m_CurrentPlayerName = e.CurrentPlayer.PlayerName;
            if (PlayerTurn != null)
            {
                if (PlayerTurn.Visible)
                {
                    Animation.Animate(PlayerTurn, Animation.Effect.Roll, 150, 360);
                }

                if (e.HasMoves)
                {
                    PlayerTurn.Text = m_CurrentPlayerName + "'s turn!";
                }
                else
                {
                    PlayerTurn.Text = m_CurrentPlayerName + "              no moves switch turn!";
                }

                Animation.Animate(PlayerTurn, Animation.Effect.Roll, 150, 360);
            }
        }
Beispiel #7
0
    private void NetworkManager_PlayerChanged(object sender, PlayerChangedEventArgs e)
    {
        Debug.Log("Got playerchange event");

        if (!isServer)
        {
            return;
        }

        if (e.RegisteredChange == PlayerChangedEventArgs.Change.Connected)
        {
            if (e.CurrentNumberOfPlayers == 2)
            {
                //RpcDistributeField("####################             ##### ########       ####### #      ######");
                var fieldDef = @"
####    ##     ######
    ####   ##   ##
                     
                     
                     
####                 
                ####
#### ########    
####     ##    ######
    ####    ##   ##
                     
                     
                     
####                 
                ####
############     
";
                RpcDistributeField(fieldDef);

                GameStarted?.Invoke(this, new EventArgs());
            }
        }
    }
Beispiel #8
0
        private async Task PlayersHandlerOnPlayerChanged(object sender, PlayerChangedEventArgs args)
        {
            var player = _playerManager.GetPlayer(args.PlayerId);

            _logger.LogInformation($"PlayerChanged {args.Type} {args.PlayerId}: '{player?.Name}'");
            switch (args.Type)
            {
            case PlayerChangeType.Connected:
                var entity = await _world.ConnectPlayer(player);

                var worldInfo = _world.Info;
                _playersHandler.GetChannel(args.ConnectionId).Start(new { world = worldInfo, player = entity });
                break;

            case PlayerChangeType.Disconnected:
                await _world.DisconnectPlayer(player);

                _playersHandler.GetChannel(args.ConnectionId).Stop();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Beispiel #9
0
 private void CurrentPlayerChanged(object sender, PlayerChangedEventArgs e)
 {
     this.cameraTarget = e.NewPlayer;
 }
Beispiel #10
0
 private static void UserForm_PlayerChanged(object?sender, PlayerChangedEventArgs e)
 {
     Logger.Debug("PlayerChange: {e}", e);
 }
Beispiel #11
0
 private void PlayerChangedHandler(object sender, PlayerChangedEventArgs e)
 {
 }