コード例 #1
0
        private void CheckProtectionOfPlayerAchivement()
        {
            Achivement achivement = new Achivement
            {
                Name     = achivementName[1],
                PlayerId = player.Id
            };

            if (!CheckIfAchivementExist(achivement))
            {
                IList <ProtectionOfPlayer> listAllProtection = protectionOfPlayerRepository.GetAllLevel3EntryOfPlayer(player.Id);
                if (listAllProtection != null)
                {
                    bool helmet = false;
                    bool vest   = false;
                    bool bag    = false;
                    foreach (ProtectionOfPlayer item in listAllProtection)
                    {
                        if (item.TypeProtection == ItemType.Bag.ToString())
                        {
                            bag = true;
                        }
                        else if (item.TypeProtection == ItemType.Helmet.ToString())
                        {
                            helmet = true;
                        }
                        else if (item.TypeProtection == ItemType.Vest.ToString())
                        {
                            vest = true;
                        }
                    }
                    if (helmet && bag && vest)
                    {
                        achivementRepository.AddAchivement(achivement);
                        TriggerFeedBackAchivement(achivement);
                    }
                }
            }
        }
コード例 #2
0
        private void OnEnable()
        {
            Player player = achivementController.GetPlayer();

            if (player != null)
            {
                long playerId    = Convert.ToInt64(player.Id);
                int  killsPlayer = Convert.ToInt32(playerKillrepository.GetCountFromMurderer(playerId));
                int  killsAi     = Convert.ToInt32(aiKillRepository.GetAiKillCountFromMurderer(playerId));
                int  killTotal   = killsAi + killsPlayer;

                playerKills.text = killsPlayer.ToString();
                aiKills.text     = killsAi.ToString();
                totalKills.text  = killTotal.ToString();

                int victory    = Convert.ToInt32(achivementController.GetGameWonFromPlayer());
                int defeat     = Convert.ToInt32(achivementController.GetGamePlayedFromPlayer()) - victory;
                int totalGames = Convert.ToInt32(achivementController.GetGamePlayedFromPlayer());

                numberVictory.text = victory.ToString();
                numberDefeat.text  = defeat.ToString();
                totalGame.text     = totalGames.ToString();

                float killDeathRatio   = defeat != 0 ? (float)killTotal / defeat : killTotal;
                float killDeathAverage = totalGames != 0 ? (float)killTotal / totalGames : killTotal;

                killDeathsRatio.text   = killDeathRatio.ToString();
                killDeathsAverage.text = killDeathAverage.ToString();

                int level3Helmet = protectionOfPlayerRepository.GetAllLevel3HelmetOfPlayer(playerId).Count;
                int level3Vest   = protectionOfPlayerRepository.GetAllLevel3VestOfPlayer(playerId).Count;
                int level3Bag    = protectionOfPlayerRepository.GetAllLevel3BagOfPlayer(playerId).Count;

                militaryHelmet.text = level3Helmet.ToString();
                militaryVest.text   = level3Vest.ToString();
                rucksac.text        = level3Bag.ToString();

                int level2Helmet = protectionOfPlayerRepository.GetAllLevel2HelmetOfPlayer(playerId).Count;
                int level2Vest   = protectionOfPlayerRepository.GetAllLevel2VestOfPlayer(playerId).Count;
                int level2Bag    = protectionOfPlayerRepository.GetAllLevel2BagOfPlayer(playerId).Count;

                poliveHelmet.text = level2Helmet.ToString();
                swatVest.text     = level2Vest.ToString();
                schoolBag.text    = level2Bag.ToString();

                int level1Helmet = protectionOfPlayerRepository.GetAllLevel1HelmetOfPlayer(playerId).Count;
                int level1Vest   = protectionOfPlayerRepository.GetAllLevel1VestOfPlayer(playerId).Count;
                int level1Bag    = protectionOfPlayerRepository.GetAllLevel1BagOfPlayer(playerId).Count;

                motoHelmet.text = level1Helmet.ToString();
                poliveVest.text = level1Vest.ToString();
                pouchBag.text   = level1Bag.ToString();

                int allLevel3 = protectionOfPlayerRepository.GetAllLevel3EntryOfPlayer(playerId).Count;
                int allLevel2 = protectionOfPlayerRepository.GetAllLevel2EntryOfPlayer(playerId).Count;
                int allLevel1 = protectionOfPlayerRepository.GetAllLevel1EntryOfPlayer(playerId).Count;

                totalLevel3.text = allLevel3.ToString();
                totalLevel2.text = allLevel2.ToString();
                totalLevel1.text = allLevel1.ToString();
            }
        }