コード例 #1
0
        public void ReloadAllPlayers()
        {
            _playerDrawables.Clear();

            foreach (var playerDataKeyVal in GameData.GetPlayers())
            {
                var playerId       = playerDataKeyVal.Key;
                var playerData     = playerDataKeyVal.Value;
                var playerDrawable = new PlayerDrawable(playerData.Color);
                _playerDrawables.Add(playerId, playerDrawable);

                var playerAnimator = new PlayerAnimator(playerDrawable);
                _playerAnimators.Add(playerDrawable, playerAnimator);

                var concretePlace = (ConcretePlace)playerData.Place.GetPlaceId();
                _playerConcretePlaces[playerId] = concretePlace;
            }

            var distinctConcretePlaces = _playerConcretePlaces.Values.Distinct().ToList();

            foreach (var concretePlace in distinctConcretePlaces)
            {
                var playerIds       = _playerConcretePlaces.Where(x => x.Value == concretePlace).Select(x => x.Key).ToList();
                var playerDrawables = _playerDrawables.Where(x => playerIds.Contains(x.Key)).Select(x => x.Value).ToList();
                var playerAnimators = _playerAnimators.Where(x => playerDrawables.Contains(x.Key)).Select(x => x.Value).ToList();

                var leftCornerPoint = PlacesPositions.GetPlayerPosition(concretePlace);
                PlayerPositionSetterHelper.SetPlayersPositions(playerAnimators, leftCornerPoint);
            }

            _debugInfoDrawable.UpdateCurrentPlayerId(GameData.GetCurrentPlayerId());

            _view.AddDrawables(_playerDrawables.Values);
        }
コード例 #2
0
        /// <summary>
        /// Makes a new instance of <see cref="MusicPlayer"/> class.
        /// </summary>
        public MusicPlayer(DiscordServer server, Youtube youtube)
        {
            _server  = server;
            _audio   = server.AudioModule;
            _youtube = youtube;

            ReproductionQueue = new ConcurrentQueue <SongReproductionState>();

            Drawer = new PlayerDrawable(this, server.DiscordClient)
            {
                Avatar = server.Configuration["player:avatar"]
            };
        }
コード例 #3
0
 public PlayerAnimator(PlayerDrawable playerDrawable)
 {
     _playerDrawable       = playerDrawable;
     _frameCallbackInvoker = new SafeInvoker <Float2D>(FrameCallback);
     _endCallback          = new SafeInvoker(EndCallback);
 }