public ActionResult Create(String playerID, String achievementName, int number)
        {
            PlayerAchievement playerAchievement = null;

            if (ModelState.IsValid)
            {
                playerAchievement = new PlayerAchievement(number, playerID, achievementName);

                PlayerAchievement storedAchievement = _repository.GetPlayerAchievement(playerAchievement.PlayerID, playerAchievement.AchievementName);
                //if this achievement already exist, plus this number with existing achievement number
                if (storedAchievement != null)
                {
                    playerAchievement.Number = number + storedAchievement.Number;
                    Edit(playerAchievement);
                    return(RedirectToAction("Index", "PlayerAchievements", new { id = playerAchievement.PlayerID }));
                }
                else
                {
                    _repository.InsertPlayerAchievement(playerAchievement);
                    return(RedirectToAction("Index", "PlayerAchievements", new { id = playerAchievement.PlayerID }));
                }
            }
            var errors = ModelState
                         .Where(x => x.Value.Errors.Count > 0)
                         .Select(x => new { x.Key, x.Value.Errors })
                         .ToArray();

            ViewBag.AchievementName = new SelectList(_achievementRepository.GetAchievements(), "Name", "Name", playerAchievement.AchievementName);
            return(View(playerAchievement));
        }
Ejemplo n.º 2
0
    public void SetAchievementButton(PlayerAchievement data)
    {
        playerAchievement = data;

        if (achievementButton != null)
        {
            if (data.IsUnlocked)
            {
                if (data.IsRewarded)
                {
                    achievementButton.interactable = false;
                }
                else
                {
                    achievementButton.interactable = true;
                }
            }
            else
            {
                achievementButton.interactable = false;
            }
        }

        if (achievementText != null)
        {
            if (data.IsRewarded)
            {
                achievementText.text = "Complete";
            }
            else
            {
                achievementText.text = "Reward";
            }
        }
    }
Ejemplo n.º 3
0
        /// <summary>
        /// Increase the score based on a task the player has accomplished
        /// </summary>
        /// <param name="achievement">The task accomplished by the user for which he should be rewarded score points</param>
        public void Increase(PlayerAchievement achievement)
        {
            switch (achievement)
            {
            case PlayerAchievement.DefeatSmartEnemy:
                _score += 50;
                break;

            case PlayerAchievement.DefeatDumbEnemy:
                _score += 20;
                break;

            case PlayerAchievement.CollectLetter:
                _score += 10;
                break;

            case PlayerAchievement.CollectPowerUp:
                _score += 20;
                break;

            case PlayerAchievement.DefeatBossPart:
                _score += 100;
                break;

            case PlayerAchievement.DefeatBoss:
                _score += 500;
                break;

            default:
                break;
            }
        }
Ejemplo n.º 4
0
        public virtual void SetUp()
        {
            _autoMocker = new RhinoAutoMocker <PlayerAchievementRetriever>();
            _autoMocker.PartialMockTheClassUnderTest();

            _expectedAchievement = new FakeAchievement();
            _autoMocker.Get <IAchievementRetriever>().Expect(mock => mock.GetAchievement(_achievementId)).Return(_expectedAchievement);

            _expectedPlayer = new Player
            {
                Name = "some player name",
                Id   = 51
            };
            _playerAchievement = new PlayerAchievement
            {
                AchievementId   = _achievementId,
                DateCreated     = DateTime.UtcNow.AddDays(-15),
                LastUpdatedDate = DateTime.UtcNow,
                PlayerId        = _expectedPlayer.Id
            };
            var playerAchievementsQueryable = new List <PlayerAchievement>
            {
                //--achievement with non-matching id
                new PlayerAchievement(),
                new PlayerAchievement
                {
                    AchievementId = _achievementId
                },
                _playerAchievement
            }.AsQueryable();

            _autoMocker.Get <IDataContext>().Expect(mock => mock.GetQueryable <PlayerAchievement>()).Return(playerAchievementsQueryable);
        }
Ejemplo n.º 5
0
    public void CreateAchievementPanels()
    {
        if (achievementPanelPrefab == null || achievementPanelContent == null)
        {
            return;
        }

        for (int i = 0; i < Game.current.achievementManager.playerAchievements.Count; i++)
        {
            GameObject achivementPanelClone = Instantiate(achievementPanelPrefab) as GameObject;
            achivementPanelClone.transform.SetParent(achievementPanelContent, false);

            PlayerAchievement playerAchievement = Game.current.achievementManager.playerAchievements [i];
            if (playerAchievement == null)
            {
                return;
            }

            AchievementPanel achievementButton = achivementPanelClone.GetComponent <AchievementPanel> ();
            if (achievementButton != null)
            {
                achievementButton.SetAchievementPanel(playerAchievement);
            }
        }
    }
        // View player's career by ID
        public ActionResult Index(String id)
        {
            List <PlayerAchievement> playerAchievements = null;
            PlayerAchievement        playerAchievement;

            playerAchievements = _repository.GetPlayerAchievementsByPlayerID(id)
                                 .Where(achievement => achievement.PlayerID.Equals(id)).ToList();

            if (playerAchievements.Count() == 0)
            {
                playerAchievement          = new PlayerAchievement();
                playerAchievement.PlayerID = id;
                playerAchievement.Player   = _playerRepository.GetPlayerByID(id);
                playerAchievements.Add(playerAchievement);
                return(View(playerAchievements));
            }
            else
            {
                foreach (var achievement in playerAchievements)
                {
                    achievement.Achievement = _achievementRepository.GetAchievementByName(achievement.AchievementName);
                    achievement.Player      = _playerRepository.GetPlayerByID(achievement.PlayerID);
                }
                return(View(playerAchievements));
            }
        }
        private void CreateOrUpdateAchievement(Player player, IAchievement achievement, PlayerAchievement currentPlayerAchievement,
                                               AchievementAwarded achievementAwarded)
        {
            if (currentPlayerAchievement == null)
            {
                var playerAchievement = new PlayerAchievement
                {
                    DateCreated      = DateTime.UtcNow,
                    LastUpdatedDate  = DateTime.UtcNow,
                    Player           = player,
                    PlayerId         = player.Id,
                    AchievementId    = achievement.Id,
                    AchievementLevel = achievementAwarded.LevelAwarded.Value,
                    RelatedEntities  = achievementAwarded.RelatedEntities
                };

                DataContext.Save(playerAchievement, new AnonymousApplicationUser());


                NotifyPlayer(player, achievement, achievementAwarded.LevelAwarded);
            }
            else
            {
                currentPlayerAchievement.RelatedEntities = achievementAwarded.RelatedEntities;

                if ((int)achievementAwarded.LevelAwarded.Value > (int)currentPlayerAchievement.AchievementLevel)
                {
                    currentPlayerAchievement.AchievementLevel = achievementAwarded.LevelAwarded.Value;
                    currentPlayerAchievement.LastUpdatedDate  = DateTime.UtcNow;

                    NotifyPlayer(player, achievement, achievementAwarded.LevelAwarded);
                }
            }
        }
Ejemplo n.º 8
0
        public ActionResult DeleteConfirmed(string id)
        {
            PlayerAchievement playerAchievement = db.PlayerAchievements.Find(id);

            db.PlayerAchievements.Remove(playerAchievement);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult Create(String id)
        {
            PlayerAchievement playerArchivement = new PlayerAchievement();

            playerArchivement.PlayerID = id;
            ViewBag.AchievementName    = new SelectList(_achievementRepository.GetAchievements(), "Name", "Name");

            return(View(playerArchivement));
        }
Ejemplo n.º 10
0
    public void AddAchievementToPlayerAchievement(Achievement achievementToAdd)
    {
        PlayerAchievement existingAchievementInPlayerAchievement = playerAchievements.SingleOrDefault(pa => pa.Achievement.Id == achievementToAdd.Id);

        if (existingAchievementInPlayerAchievement == null)
        {
            playerAchievements.Add(new PlayerAchievement(achievementToAdd, false, false));
        }
    }
        public ActionResult Delete(String playerID, String achievementName)
        {
            PlayerAchievement playerAchievement = _repository.GetPlayerAchievementByAchievementName(playerID, achievementName);

            if (playerAchievement == null)
            {
                return(RedirectToAction("Index"));
            }
            return(View(playerAchievement));
        }
 public ActionResult Edit([Bind(Include = "PlayerID,AchievementName,Number")] PlayerAchievement playerAchievement)
 {
     if (ModelState.IsValid)
     {
         _repository.EditPlayerAchievement(playerAchievement);
         return(RedirectToAction("Index", "PlayerAchievements", new { id = playerAchievement.PlayerID }));
     }
     ViewBag.AchievementName = new SelectList(_achievementRepository.GetAchievements(), "Name", "ImageLink", playerAchievement.AchievementName);
     return(View(playerAchievement));
 }
 public DofusProtocol.Types.Achievement GetAchievement(PlayerAchievement player)
 {
     return(new DofusProtocol.Types.Achievement((ushort)this.Id,
                                                from entry in this.m_objectives
                                                where player.ContainsCriterion(entry.Criterion)
                                                select entry.GetAchievementObjective(player),
                                                from entry in this.m_objectives
                                                where !player.ContainsCriterion(entry.Criterion)
                                                select entry.GetAchievementStartedObjective(player)));
 }
Ejemplo n.º 14
0
 public ActionResult Edit([Bind(Include = "playerId,achievementName,number")] PlayerAchievement playerAchievement)
 {
     if (ModelState.IsValid)
     {
         db.Entry(playerAchievement).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.achievementName = new SelectList(db.Achievements, "name", "imageLink", playerAchievement.achievementName);
     return(View(playerAchievement));
 }
Ejemplo n.º 15
0
 public DofusProtocol.Types.AchievementObjective GetAchievementObjective(PlayerAchievement player)
 {
     if (this.m_criterion == null)
     {
         return(new DofusProtocol.Types.AchievementObjective((ushort)this.Id, 0));
     }
     else
     {
         return(this.m_criterion.GetAchievementObjective(this, player));
     }
 }
        public ActionResult Delete(String playerID, String achievementName)
        {
            if (playerID == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PlayerAchievement playerAchievement = _repository.GetPlayerAchievement(playerID, achievementName);

            if (playerAchievement == null)
            {
                return(HttpNotFound());
            }
            return(View(playerAchievement));
        }
Ejemplo n.º 17
0
        // GET: PlayerAchievements/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PlayerAchievement playerAchievement = db.PlayerAchievements.Find(id);

            if (playerAchievement == null)
            {
                return(HttpNotFound());
            }
            return(View(playerAchievement));
        }
        public void Create(string playerId, int achievementId)
        {
            using (var ctx = new SuperCubeContext())
            {
                var itemToAdd = new PlayerAchievement
                {
                    PlayerId      = playerId,
                    AchievementId = achievementId
                };

                ctx.PlayerAchievements.Add(itemToAdd);

                ctx.SaveChanges();
            }
        }
Ejemplo n.º 19
0
        // GET: PlayerAchievements/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PlayerAchievement playerAchievement = db.PlayerAchievements.Find(id);

            if (playerAchievement == null)
            {
                return(HttpNotFound());
            }
            ViewBag.achievementName = new SelectList(db.Achievements, "name", "imageLink", playerAchievement.achievementName);
            return(View(playerAchievement));
        }
        public ActionResult Edit(String playerID, String achievementName)
        {
            if (playerID == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PlayerAchievement playerAchievement = _repository.GetPlayerAchievement(playerID, achievementName);

            if (playerAchievement == null)
            {
                return(HttpNotFound());
            }
            ViewBag.AchievementName = new SelectList(_repository.GetPlayerAchievementsByPlayerID(playerID), "Name", "ImageLink", playerAchievement.AchievementName);
            return(View(playerAchievement));
        }
 public void Set(PlayerAchievement other)
 {
     if (other != null)
     {
         m_ApiVersion  = AchievementsInterface.PlayerachievementApiLatest;
         AchievementId = other.AchievementId;
         Progress      = other.Progress;
         UnlockTime    = other.UnlockTime;
         StatInfo      = other.StatInfo;
         DisplayName   = other.DisplayName;
         Description   = other.Description;
         IconURL       = other.IconURL;
         FlavorText    = other.FlavorText;
     }
 }
Ejemplo n.º 22
0
        public virtual ActionResult Details(AchievementId achievementId, ApplicationUser currentUser)
        {
            if (currentUser != null && currentUser.CurrentGamingGroupId > 0)
            {
                return(DetailsForCurrentUser(achievementId, currentUser));
            }

            var playerAchievement = new PlayerAchievement
            {
                AchievementId = achievementId,
                PlayerId      = 0
            };
            var model = _mapperFactory.GetMapper <PlayerAchievement, PlayerAchievementViewModel>().Map(playerAchievement);

            return(View(MVC.Achievement.Views.Details, model));
        }
Ejemplo n.º 23
0
        public static void Save(Action done)
        {
            const string section = "PTestAchievements.Save";

            Console.WriteLine(section);

            var achievement = new PlayerAchievement {
                { "achievement", "Super Mega Achievement #1" },
                { "achievementkey", "secretkey" },
                { "playerid", rnd.ToString() },
                { "playername", "a random name " + rnd },
                { "fields", new Hashtable {
                      { "rnd", rnd }
                  } }
            };

            Playtomic.Achievements.Save(achievement, r => {
                AssertTrue(section + "#1", "Request succeeded", r.success);
                AssertEquals(section + "#1", "No errorcode", r.errorcode, 0);

                // second save gets rejected
                Playtomic.Achievements.Save(achievement, r2 => {
                    AssertFalse(section + "#2", "Request failed", r2.success);
                    AssertEquals(section + "#2", "Already had achievement errorcode", r2.errorcode, 505);

                    // third save overwrites the first
                    achievement.overwrite = true;

                    Playtomic.Achievements.Save(achievement, r3 => {
                        AssertTrue(section + "#3", "Request succeeded", r3.success);
                        AssertEquals(section + "#3", "Already had achievement errorcode", r3.errorcode, 506);

                        // fourth saves with allow duplicates
                        achievement.allowduplicates = true;
                        achievement.Remove("overwrite");

                        Playtomic.Achievements.Save(achievement, r4 => {
                            AssertTrue(section + "#4", "Request succeeded", r4.success);
                            AssertEquals(section + "#4", "Already had achievement errorcode", r4.errorcode, 506);
                            done();
                        });
                    });
                });
            });
        }
Ejemplo n.º 24
0
    // Update is called once per frame
    void Update()
    {
        if (IsGameOver)
        {
            WaitForButtonAndGoBackToMenu();
            return; // nothing to do
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            FinishGame(true);
        }

        DestroyDecayedPortals();

        int newDays = Mathf.FloorToInt((Time.time - startTime) / GameConstants.SecondsPerDay);

        if (newDays > days)
        {
            days = newDays;

            Scoreboard.DisplayDays(days);

            if (days >= GameConstants.DaysPerGame)
            {
                FinishGame(false);
            }
            else
            {
                SoundManager.GetInstance().DayUpSound.Play();
            }
        }

        if (PlayerAchievement.IsAPChanged)
        {
            Scoreboard.DisplayLevelAndAP(PlayerAchievement.Level, PlayerAchievement.AP);

            if (PlayerAchievement.IsLevelChanged)
            {
                SoundManager.GetInstance().LevelUpSound.Play();
            }

            PlayerAchievement.ResetAPChanged();
        }
    }
        public ActionResult Edit(PlayerAchievement playerAchievement)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    _repository.EditPlayerAchievement(playerAchievement);
                    return(RedirectToAction("Index"));
                }
                catch (Exception ex)
                {
                    //error msg for failed edit in XML file
                    ModelState.AddModelError("", "Error editing record. " + ex.Message);
                }
            }

            return(View(playerAchievement));
        }
Ejemplo n.º 26
0
    public PlayerAward(Dictionary <string, object> data)
    {
        foreach (string x in data.Keys)
        {
            if (x == "date")
            {
                date = TimeUtils.FromUnixTime(data[x]);
                continue;
            }

            if (x == "awarded")
            {
                awarded = new PlayerAchievement((Dictionary <string, object>)data[x]);
                continue;
            }

            this[x] = data[x];
        }
    }
Ejemplo n.º 27
0
	public PlayerAward(Dictionary<string,object> data)
	{
		foreach(string x in data.Keys)
		{			
			if(x == "date") 
			{
				var d = new DateTime(1970, 1, 1, 0, 0, 0);
				date = d.AddSeconds ((double)data[x]);
				continue;
			} 

			if(x == "awarded") {
				awarded = new PlayerAchievement ((Dictionary<string,object>) data[x]);
				continue;
			}

			this[x] = data[x];
		}
	}
Ejemplo n.º 28
0
        public virtual ActionResult DetailsForCurrentUser(AchievementId achievementId, ApplicationUser currentUser)
        {
            var playerId = _playerRetriever.GetPlayerIdForCurrentUser(currentUser.Id, currentUser.CurrentGamingGroupId);

            var playerAchievement = _playerAchievementRetriever.GetPlayerAchievement(playerId, achievementId);

            if (playerAchievement != null)
            {
                return PlayerAchievement(achievementId, playerId);
            }

            playerAchievement = new PlayerAchievement
            {
                AchievementId = achievementId,
                PlayerId = playerId
            };
            var model = _mapperFactory.GetMapper<PlayerAchievement, PlayerAchievementViewModel>().Map(playerAchievement);
            return View(MVC.Achievement.Views.Details, model);
        }
Ejemplo n.º 29
0
        public virtual ActionResult DetailsForCurrentUser(AchievementId achievementId, ApplicationUser currentUser)
        {
            var playerId = _playerRetriever.GetPlayerIdForCurrentUser(currentUser.Id, currentUser.CurrentGamingGroupId);

            var playerAchievement = _playerAchievementRetriever.GetPlayerAchievement(playerId, achievementId);

            if (playerAchievement != null)
            {
                return(PlayerAchievement(achievementId, playerId));
            }

            playerAchievement = new PlayerAchievement
            {
                AchievementId = achievementId,
                PlayerId      = playerId
            };
            var model = _mapperFactory.GetMapper <PlayerAchievement, PlayerAchievementViewModel>().Map(playerAchievement);

            return(View(MVC.Achievement.Views.Details, model));
        }
Ejemplo n.º 30
0
    public PlayerAward(Dictionary <string, object> data)
    {
        foreach (string x in data.Keys)
        {
            if (x == "date")
            {
                var d = new DateTime(1970, 1, 1, 0, 0, 0);
                date = d.AddSeconds((double)data[x]);
                continue;
            }

            if (x == "awarded")
            {
                awarded = new PlayerAchievement((Dictionary <string, object>)data[x]);
                continue;
            }

            this[x] = data[x];
        }
    }
Ejemplo n.º 31
0
    public void SetAchievementPanel(PlayerAchievement data)
    {
        if (titleText != null)
        {
            titleText.text = data.Achievement.Name;
        }

        if (descriptionText != null)
        {
            descriptionText.text = data.Achievement.Description;
        }

        if (rewardText != null)
        {
            rewardText.text = data.Achievement.RewardGold.ToString();
        }

        if (achievementButton != null)
        {
            achievementButton.SetAchievementButton(data);
        }
    }
Ejemplo n.º 32
0
        public virtual void BaseSetUp()
        {
            autoMocker = new RhinoAutoMocker<PlayerRetriever>();
            autoMocker.PartialMockTheClassUnderTest();
            const int CHAMPION_ID = 55;

            gameDefinition = new GameDefinition
            {
                Name = "game name",
                ChampionId = CHAMPION_ID
            };

            var playerId = 1;
            var champion = new Champion
            {
                Id = CHAMPION_ID,
                GameDefinition = gameDefinition,
                PlayerId = playerId
            };

            playerGameResultsForFirstPlayer = new List<PlayerGameResult>()
            {
                new PlayerGameResult
                {
                    GameRank = 2,
                    NemeStatsPointsAwarded = 10,
                    PlayedGame = new PlayedGame
                    {
                        DatePlayed = new BasicDateRangeFilter().FromDate
                    }
                },
                new PlayerGameResult
                {
                    GameRank = 1,
                    NemeStatsPointsAwarded = 20,
                    PlayedGame = new PlayedGame
                    {
                        DatePlayed = new BasicDateRangeFilter().ToDate
                    }
                }};

            playerChampionshipsForFirstPlayer = new List<Champion>
            {
                champion
            };
            List<Player> players = new List<Player>()
            {
                new Player(){ GamingGroupId = gamingGroupId, Name = "2", PlayerGameResults = new List<PlayerGameResult>(), ChampionedGames = new List<Champion>()},
                new Player(){ GamingGroupId = gamingGroupId, Name = "3", PlayerGameResults = new List<PlayerGameResult>(), ChampionedGames = new List<Champion>() },
                new Player(){ GamingGroupId = -1, Name = "not in gaming group", PlayerGameResults = new List<PlayerGameResult>(), ChampionedGames = new List<Champion>() },
                new Player()
                {
                    Id = playerId,
                    GamingGroupId = gamingGroupId, 
                    Name = "1", 
                    PlayerGameResults = playerGameResultsForFirstPlayer,
                    ChampionedGames = new List<Champion>
                    {
                        champion
                    }
                },
                new Player()
                {
                    //player that will be last because she's inactive
                    GamingGroupId = gamingGroupId, Name = "0", PlayerGameResults = new List<PlayerGameResult>(), ChampionedGames = new List<Champion>(), Active = false 
                }
            };
            players[3].NemesisId = 1;
            players[3].Nemesis = new Nemesis()
            {
                NemesisPlayerId = 2,
                NemesisPlayer = new Player() { Id = 93995 }
            };
            playerQueryable = players.AsQueryable<Player>();

            autoMocker.Get<IDataContext>().Expect(mock => mock.GetQueryable<Player>())
                .Return(playerQueryable);

            autoMocker.Get<IDataContext>().Expect(mock => mock.GetQueryable<GameDefinition>())
                .Return(
                new List<GameDefinition>
                { gameDefinition }.AsQueryable());

            var playerAchievement =
                new PlayerAchievement
                {
                    DateCreated = DateTime.UtcNow,
                    LastUpdatedDate = DateTime.UtcNow,
                    PlayerId = playerId,
                    AchievementLevel = AchievementLevel.Bronze,
                    AchievementId = AchievementId.BusyBee
                };
            autoMocker.Get<IDataContext>().Expect(mock => mock.GetQueryable<PlayerAchievement>())
                .Return(new List<PlayerAchievement> { playerAchievement }.AsQueryable());
        }
Ejemplo n.º 33
0
 public override ushort GetPlayerValue(PlayerAchievement player)
 {
     return((ushort)Math.Min(this.MaxValue, player.Owner.Record.AchievementPoints));
 }
Ejemplo n.º 34
0
 public static PlayerAchievement CreatePlayerAchievement(int id)
 {
     PlayerAchievement playerAchievement = new PlayerAchievement();
     playerAchievement.ID = id;
     return playerAchievement;
 }
Ejemplo n.º 35
0
 public void AddToPlayerAchievement(PlayerAchievement playerAchievement)
 {
     base.AddObject("PlayerAchievement", playerAchievement);
 }
Ejemplo n.º 36
0
	public static void Save(Action done) {

		const string section = "PTestAchievements.Save";
		Debug.Log (section);

		var achievement = new PlayerAchievement {
			{"achievement", "Super Mega Achievement #1"},
			{"achievementkey", "secretkey"},
			{"playerid", rnd.ToString()},
			{"playername", "a random name " + rnd},
			{"fields", new Dictionary<string,object> {
				{"rnd", rnd }
				}}
		};

		Playtomic.Achievements.Save(achievement, r => {
			AssertTrue(section + "#1", "Request succeeded", r.success);
			AssertEquals(section + "#1", "No errorcode", r.errorcode, 0);

			// second save gets rejected
			Playtomic.Achievements.Save(achievement, r2 => {
				AssertFalse(section + "#2", "Request failed", r2.success);
				AssertEquals(section + "#2", "Already had achievement errorcode", r2.errorcode, 505);

				// third save overwrites the first
				achievement.overwrite = true;

				Playtomic.Achievements.Save(achievement, r3 => {
					AssertTrue(section + "#3", "Request succeeded", r3.success);
					AssertEquals(section + "#3", "Already had achievement errorcode", r3.errorcode, 506);

					// fourth saves with allow duplicates
					achievement.allowduplicates = true;
					achievement.Remove("overwrite");

					Playtomic.Achievements.Save(achievement, r4 => {
						AssertTrue(section + "#4", "Request succeeded", r4.success);
						AssertEquals(section + "#4", "Already had achievement errorcode", r4.errorcode, 506);
						done();
					});
				});
			});
		});
	}
Ejemplo n.º 37
0
        public virtual ActionResult Details(AchievementId achievementId, ApplicationUser currentUser)
        {
            if (currentUser != null && currentUser.CurrentGamingGroupId > 0)
            {
                return DetailsForCurrentUser(achievementId, currentUser);
            }

            var playerAchievement = new PlayerAchievement
            {
                AchievementId = achievementId,
                PlayerId = 0
            };
            var model = _mapperFactory.GetMapper<PlayerAchievement, PlayerAchievementViewModel>().Map(playerAchievement);
            return View(MVC.Achievement.Views.Details, model);
        }