Esempio n. 1
0
        private Player GetPlayer(int playerId, int modeId, int boxId, int levelId)
        {
            Player player = new Player();
            player.Id = playerId;

            BitmapSource[] bitmapSources = ImageDecoder.BitmapFrames(AppSettings.DataDirectoryPath +
                @"/Challenges/mode_" + modeId + @"/box_" + boxId + @"/level_" + levelId + @"/960x540.tif");

            //Затычки на цвет и рисунки
            if (playerId == 0)
            {
                player.PlayerColor = BitmapProcessor.GetPlayerColor(bitmapSources[0]);
                player.SourceBitmap = bitmapSources[0];
            }
            if (playerId == 1)
            {
                player.PlayerColor = BitmapProcessor.GetPlayerColor(bitmapSources[1]);
                player.SourceBitmap = bitmapSources[1];
            }
            if (playerId == 2)
            {
                player.PlayerColor = BitmapProcessor.GetPlayerColor(bitmapSources[2]);
                player.SourceBitmap = bitmapSources[2];
            }
            if (playerId == 3)
            {
                player.PlayerColor = BitmapProcessor.GetPlayerColor(bitmapSources[3]);
                player.SourceBitmap = bitmapSources[3];
            }

            return player;
        }
Esempio n. 2
0
        //inject to "out" + void
        public Player[] UpdatePlayersResults(Player[] players, double rateCoeff)
        {
            foreach (var player in players)
            {
                player.Score = rateCoeff * _bitmapProcessor.GetSimilarityValue(player.SourceBitmap, player.ResultBitmap);
            }

            return players;
        }