コード例 #1
0
        /// <inheritdoc />
        public override AchievementBadge Evaluate(DiContainer installer, ITimeProvider timeProvider)
        {
            GameObject       newObj = installer.InstantiatePrefab(achievementPrefab);
            AchievementBadge badge  = newObj.GetComponent <AchievementBadge>();

            int chosen = tiers - 1;

            for (int i = 0; i < tiers; ++i)
            {
                if (timeProvider.elapsedTotal.TotalSeconds > tierDurationLimits[i])
                {
                    continue;
                }
                chosen = i;
            }

            badge.achievementText.text   = tierSubTitles[chosen];
            badge.achievementText.color  = Color.white;
            badge.achievementTitle.text  = tierTitles[chosen];
            badge.achievementTitle.color = Color.white;
            badge.badgeImage.sprite      = tierIcons[chosen];
            badge.badgeImage.color       = Color.white;
            badge.badgeRim.color         = Color.white;
            badge.badgeBackground.color  = tierColors[chosen];

            return(badge);
        }
コード例 #2
0
        /// <inheritdoc />
        public override AchievementBadge Evaluate(DiContainer installer, ITimeProvider timeProvider)
        {
            GameObject       newObj = installer.InstantiatePrefab(achievementPrefab);
            AchievementBadge badge  = newObj.GetComponent <AchievementBadge>();

            badge.achievementText.text   = AchievementSubtitle;
            badge.achievementText.color  = Color.white;
            badge.achievementTitle.text  = achievementTitle;
            badge.achievementTitle.color = Color.white;
            badge.badgeImage.sprite      = badgeSprite;
            badge.badgeImage.color       = Color.white;
            badge.badgeRim.color         = Color.white;
            badge.badgeBackground.color  = badgeColor;

            return(badge);
        }
コード例 #3
0
 public void SaveAchievementBadge(AchievementBadge AchievementBadge)
 {
     if (AchievementBadge.Id == 0)
     {
         context.AchievementBadges.Add(AchievementBadge);
     }
     else
     {
         var editMe = context.AchievementBadges.Find(AchievementBadge.Id);
         if (editMe != null)
         {
             // dbEntry.Name = AchievementBadge.Name;
             // dbEntry.Message = AchievementBadge.Message;
             // dbEntry.TimeStamp = AchievementBadge.TimeStamp;
         }
     }
     context.SaveChanges();
 }
コード例 #4
0
        public static string AssignLeadersBadges()
        {
            IAchievementBadgeRepository badgeRepo = new EFAchievementBadgeRepository();

            var winners = GetPlayerMaxStats().ToList();
            var output  = "";

            var round = PvPStatics.AlphaRound;

            foreach (var a in winners)
            {
                var badge = badgeRepo.AchievementBadges.FirstOrDefault(b => b.AchievementType == a.Achivement.AchievementType && b.OwnerMembershipId == a.Player.Player.MembershipId && b.Round == round);

                var nextline = "<b>" + a.Achivement.AchievementType + "</b> for round <b>" + round + "</b> being assigned to <b>" + a.Player.Player.GetFullName() + "</b> of ID " + a.Player.Player.MembershipId + ".  ";

                if (badge == null)
                {
                    badge = new AchievementBadge
                    {
                        OwnerMembershipId = a.Player.Player.MembershipId,
                        Round             = round,
                    };
                    nextline += "No existing badge found.  Making new one.";
                }
                else
                {
                    nextline += "EXISTING BADGE FOUND.  Updating.";
                }

                badge.Amount          = a.Achivement.Amount;
                badge.AchievementType = a.Achivement.AchievementType;

                badgeRepo.SaveAchievementBadge(badge);
                output += nextline + "<br><br>";
            }

            return(output);
        }