Exemple #1
0
        public AccountsModule(
            MikiApp app,
            Config config,
            IDiscordClient discordClient,
            AccountService accountsService,
            AchievementService achievementService,
            AchievementEvents achievementEvents,
            TransactionEvents transactionEvents)
        {
            this.app = app;
            this.achievementService = achievementService;
            this.discordClient      = discordClient;
            if (!string.IsNullOrWhiteSpace(config.ImageApiUrl))
            {
                client = new HttpClient(config.ImageApiUrl);
            }
            else
            {
                Log.Warning("Image API can not be loaded in AccountsModule");
            }

            discordClient.Events.MessageCreate.SubscribeTask(OnMessageCreateAsync);

            accountsService.OnLocalLevelUp          += OnUserLevelUpAsync;
            accountsService.OnLocalLevelUp          += OnLevelUpAchievementsAsync;
            transactionEvents.OnTransactionComplete += CheckCurrencyAchievementUnlocksAsync;

            achievementEvents.OnAchievementUnlocked
            .SubscribeTask(SendAchievementNotificationAsync);
            achievementEvents.OnAchievementUnlocked
            .SubscribeTask(CheckAchievementUnlocksAsync);
        }
        private AchievementService CreateAchieveService()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new AchievementService(userId);

            return(service);
        }
Exemple #3
0
        private static AutoUpdateManager GetAutoUpdateManager()
        {
            // build up AutoUpdateManager - use DI instead?
            SteamCommunityManager steamCommunityManager =
                new SteamCommunityManager(new WebClientWrapper(), new SteamProfileXmlParser(), new GameXmlParser(),
                                          new AchievementXmlParser());
            AchievementService achievementService =
                new AchievementService(
                    new AchievementManager(new SteamRepository()), steamCommunityManager);
            UserService userService = new UserService(new AchievementManager(new SteamRepository()));

            // verify the log path
            DirectoryInfo logDirectory = new DirectoryInfo("logs");

            if (!logDirectory.Exists)
            {
                logDirectory.Create();
            }

            IAutoUpdateLogger autoUpdateLogger = new AutoUpdateLogger(logDirectory.FullName);

            // only keeps logs for the past 10 days
            autoUpdateLogger.Delete(DateTime.Now.AddDays(-10));
            // the default writer saves output to a file, this will display it in the console as well
            autoUpdateLogger.Attach(Console.Out);

            AutoUpdateManager autoUpdateManager =
                new AutoUpdateManager(achievementService, userService, new FacebookPublisher(),
                                      autoUpdateLogger);

            return(autoUpdateManager);
        }
Exemple #4
0
        public TwitchBot(string _channelName)
        {
            //Init Client
            twitchClient = new TwitchClient();
            twitchPubSub = new TwitchPubSub();

            //Init Database
            this.db = new AppDbContextFactory().Create();

            //Init access
            accessService = new AccessService();

            //Init Twitch API
            api = new TwitchAPI();
            api.Settings.ClientId    = accessService.GetTwitchClientID();
            api.Settings.AccessToken = accessService.GetTwitchAccessToken();

            //Init services
            this.achievementService = new AchievementService(db);
            this.settingsService    = new SettingsService(db);
            this.pokemonService     = new PokemonService(db);

            userService = new UserService(db, api);

            chatOutputService = new ChatOutputService(twitchClient, _channelName);
            bossService       = new BossService(userService, pokemonService, chatOutputService, settingsService);
            userfightService  = new UserfightService(userService, chatOutputService);


            chatService            = new ChatInputService(userService, chatOutputService, bossService, userfightService, achievementService);
            destinationChannelName = _channelName;

            Connect();
        }
Exemple #5
0
        public DatadogRoutine(
            AccountService accounts,
            AchievementService achievements,
            IAsyncEventingExecutor <IDiscordMessage> commandPipeline,
            Config config,
            IDiscordClient discordClient)
        {
            if (string.IsNullOrWhiteSpace(config.DatadogHost))
            {
                Log.Warning("Metrics are not being collected");
                return;
            }

            DogStatsd.Configure(new StatsdConfig
            {
                StatsdServerName = config.DatadogHost,
                StatsdPort       = 8125,
                Prefix           = "miki"
            });

            CreateAchievementsMetrics(achievements);
            CreateAccountMetrics(accounts);
            CreateEventSystemMetrics(commandPipeline);
            CreateDiscordMetrics(discordClient);
            Log.Message("Datadog set up!");
        }
        public async Task GetAchievementById_ShouldReturnAchievement_WhenAchievementExists()
        {
            // Arange
            var Id = Guid.NewGuid();
            var CancellationToken = new CancellationToken();
            var AchievementResult = new Achievement()
            {
                Id = Id,
            };

            AchievementRepoMock.Setup(x => x.GetById(Id, CancellationToken))
            .ReturnsAsync(AchievementResult).Verifiable();
            UnitOfWorkMock.Setup(m => m.AchievementRepository).Returns(AchievementRepoMock.Object);

            AchievementService _AchievementService = new AchievementService(UnitOfWorkMock.Object, MapperMock.Object);

            // Act

            var Achievement = await _AchievementService.GetAchievementById(Id, CancellationToken);

            // Assert

            Assert.IsNotNull(Achievement);
            AchievementRepoMock.Verify();
            Assert.AreEqual(AchievementResult.Id, Achievement.Id);
        }
Exemple #7
0
 public UsersControllerTests()
 {
     _fakeContext          = new FakeCoursesContext();
     _achievementValidator = new AchievementValidator(_fakeContext);
     _achievementService   = new AchievementService(_fakeContext, _achievementValidator);
     _usersController      = new UsersController(_fakeContext, _achievementService);
 }
Exemple #8
0
        public List <string> GetOptions(Player player)
        {
            var activeGame      = _gameStore.ListGames().FirstOrDefault(a => a.GameName == player.ActiveGameSave.GameName);
            var achievementList = AchievementService.HasPlayerDoneAchievements(activeGame, player);

            var achievementButtonText = $"{Messages.Achievements} ({achievementList.Count(a => a.hasAchieved)}/{achievementList.Count})";

            var list = new List <string>
            {
                "Return to Game",
                Messages.SaveGame,
                Messages.LoadGame,
                achievementButtonText,
                "Main Menu",
            };

            var testFeatures = _configService.GetConfigOrDefault("TestFeatures", "false", true);

            if (bool.TryParse(testFeatures, out var enableTestFeatures) && enableTestFeatures)
            {
                list.Add(Messages.ShowData);
                list.Add(Messages.RefreshGames);
            }

            return(list);
        }
        public ActionResult Index()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new AchievementService(userId);
            var model   = service.GetAchievements();

            return(View(model));
        }
Exemple #10
0
 private ValueTask UnlockLewdAchievementAsync(IContext e, AchievementService service)
 {
     if (MikiRandom.Next(100) == 50)
     {
         var lewdAchievement = service.GetAchievementOrDefault(AchievementIds.LewdId);
         return(new ValueTask(service.UnlockAsync(e, lewdAchievement, e.GetAuthor().Id)));
     }
     return(default);
Exemple #11
0
 public BattleController(DataContext dataContext, GamingService gamingService, BattleMapper battleMapper, IOptions <GameSettings> gameSettingsOptions, LevelManager levelManager, AchievementService achievementService, NotificationManager notificationManager, AccountManager accountManager, BattleManager battleManager)
 {
     _dataContext         = dataContext;
     _gamingService       = gamingService;
     _battleMapper        = battleMapper;
     _levelManager        = levelManager;
     _achievementService  = achievementService;
     _notificationManager = notificationManager;
     _accountManager      = accountManager;
     _battleManager       = battleManager;
     _gameSettingsOptions = gameSettingsOptions.Value;
 }
        private static Publisher CreatePublisher()
        {
            var settings           = Settings.Default;
            var logger             = new AutoUpdateLogger(_logDirectory.FullName);
            var achievementManager = new AchievementManager(new SteamRepository());
            var communityManager   = new SteamCommunityManager(new WebClientWrapper(), new SteamProfileXmlParser(), new GameXmlParser(), new AchievementXmlParser());
            var achievementService = new AchievementService(achievementManager, communityManager);
            var facebookClient     = new FacebookClientService(settings.FacebookAppId, settings.FacebookAppSecret, settings.FacebookCanvasUrl);
            var autoUpdateManager  = new AutoUpdateManager(achievementService, new UserService(achievementManager), facebookClient, logger);

            return(new Publisher(autoUpdateManager));
        }
Exemple #13
0
        /// <summary>
        /// Determines whether the target object satisfiy the specification.
        /// </summary>
        /// <param name="target">The target object to be validated.</param>
        /// <returns><c>true</c> if this instance is satisfied by the specified target; otherwise, <c>false</c>.</returns>
        public override bool IsSatisfiedBy(Achievement target)
        {
            var achievementService           = new AchievementService();
            var otherAchievementWithSameName = achievementService.GetAchievementByName(target.Name);

            if (otherAchievementWithSameName != null && otherAchievementWithSameName != target)
            {
                NotSatisfiedReason = "There is another Achievement with the name '{0}'. Achievements should have unique name.".With(target.Name);
                return(false);
            }

            return(true);
        }
        public ExecutionResult HandleMessage(string message, Player player)
        {
            if (message == Messages.Return)
            {
                return(MessageHandlerHelpers.ReturnToMainMenu(player));
            }

            var games = _gameStore.ListGames();

            List <string> optionsToSend = new List <string>();

            optionsToSend.Add(Messages.Return);

            var gameAchievementList = games.Select(a => (AchievementService.HasPlayerDoneAchievements(a, player), a.GameName)).ToList();

            gameAchievementList.ForEach(a =>
            {
                optionsToSend.Add($"{a.GameName} ({a.Item1.Count(b => b.hasAchieved)}/{a.Item1.Count()})");
            });

            var selectedGame = games.FirstOrDefault(a => message.StartsWith(a.GameName));

            if (selectedGame != null)
            {
                var achievmentListString = AchievementService.HasPlayerDoneAchievements(selectedGame, player).OrderBy(a => a.hasAchieved).Select(a => $"{(a.hasAchieved ? "UNLOCKED! " : "")}{a.achievement.Name} - {a.achievement.Description}").ToList();
                var responseMessage      = string.Join("\n\n", achievmentListString);
                var result = ExecutionResultHelper.SingleMessage(responseMessage, optionsToSend);
                result.MessagesToShow.Insert(0, new MessageResult
                {
                    Message = "Achievements for game: " + selectedGame.GameName
                });
                return(result);
            }

            else
            {
                player.PlayerFlag = PlayerFlag.ACHIEVEMENTS.ToString();
                var messageToSend = $"You have completed a total of: {gameAchievementList.Sum(a => a.Item1.Count(b => b.hasAchieved))} out of {gameAchievementList.Sum(a => a.Item1.Count())}";

                return(new ExecutionResult
                {
                    MessagesToShow = new List <MessageResult> {
                        new MessageResult {
                            Message = messageToSend
                        }
                    },
                    OptionsToShow = optionsToSend
                });
            }
        }
Exemple #15
0
        public ActionResult UpdateDevelopersAchievements()
        {
            var devService = new DeveloperService();
            var devs       = devService.GetAllDevelopers().ToList();

            var achievementService = new AchievementService();

            foreach (var dev in devs)
            {
                achievementService.UpdateDeveloperAchievements(dev);
            }

            return(View(devs));
        }
        public void UpdateDeveloperAchievements_NoAchievementsForDeveloper_EmptyList()
        {
            DependencyService.Register <IUnitOfWork>(new MemoryUnitOfWork());
            DependencyService.Register <IAchievementRepository>(new MemoryAchievementRepository());

            var target  = new AchievementService();
            var account = new Developer()
            {
                Username = "******", FullName = "test", Email = "*****@*****.**"
            };

            account.AccountsAtIssuers.Add(new DeveloperAccountAtIssuer(0, "DeveloperWithoutAchievements"));
            target.UpdateDeveloperAchievements(account);
            Assert.AreEqual(0, account.Achievements.Count);
        }
        public void SetUp()
        {
            _fileService               = new Mock <IFileService>();
            _achievementRepository     = new Mock <IAchievementRepository>();
            _userRepository            = new Mock <IUserRepository>();
            _userAchievementRepository = new Mock <IUserAchievementRepository>();
            _unitOfWork = new Mock <IUnitOfWork>();

            var myProfile     = new AutoMapperProfile();
            var configuration = new MapperConfiguration(cfg => cfg.AddProfile(myProfile));

            _mapper = new Mapper(configuration);

            _achievementService = new AchievementService(_userRepository.Object, _userAchievementRepository.Object, _achievementRepository.Object, _fileService.Object,
                                                         _mapper, _unitOfWork.Object);
        }
Exemple #18
0
        private void CreateAchievementsMetrics(AchievementService service)
        {
            if (service == null)
            {
                return;
            }

            service.OnAchievementUnlocked.Subscribe(res =>
            {
                var(_, achievement) = res;
                DogStatsd.Increment(
                    "achievements.gained", tags: new[]
                {
                    $"achievement:{achievement.ResourceName}"
                });
            });
        }
        public override void Execute()
        {
            if (ContentUpdated.EndsWith(BibaContentConstants.ACHIEVEMENT_SETTINGS_FILE))
            {
                AchievementService.ReloadContent();
            }

            if (ContentUpdated.EndsWith(BibaContentConstants.LOCALIZATION_SETTINGS_FILE))
            {
                LocalizationService.ReloadContent();
            }

            if (ContentUpdated.EndsWith(BibaContentConstants.SPECIAL_SCENE_SETTINGS_FILE))
            {
                SpecialSceneService.ReloadContent();
            }
        }
        private async void SaveGame()
        {
            ContentDialogResult result = await _dialogService.ShowContentDialogAsync(new ConfirmDialogViewModel("End Game", "Are you sure you want to quit the game and log the stats?"));

            if (result == ContentDialogResult.Secondary)
            {
                return;
            }

            CalculateScores();

            AchievementService achievementService = new AchievementService(game);

            achievementService.CheckForPersonalScores();
            achievementService.CheckForEverScores();

            try
            {
                _gameRepo.AddGame(game);

                int multiScore = colours.SingleOrDefault(c => c.name == "Multi")?.score ?? 0;

                foreach (Player player in game.players)
                {
                    _playerGameRepo.AddPlayerGame(player, game,
                                                  colours.SingleOrDefault(c => c.name == "Red").score,
                                                  colours.SingleOrDefault(c => c.name == "White").score,
                                                  colours.SingleOrDefault(c => c.name == "Blue").score,
                                                  colours.SingleOrDefault(c => c.name == "Yellow").score,
                                                  colours.SingleOrDefault(c => c.name == "Green").score,
                                                  multiScore);
                }

                achievementService.CheckForFirsts();
                achievementService.CheckForMileStones();

                achievementService.AddAchievements();

                ((App)Application.Current).rootFrame.Navigate(typeof(StandingsView), game);
            }
            catch (SQLiteException)
            {
                await _dialogService.ShowContentDialogAsync(new MessageDialogViewModel("Error", "Something went wrong, please try again"));
            }
        }
        public ActionResult Index(string username)
        {
            var service = new DeveloperService();
            var dev     = service.GetDeveloperByUsername(username);

            if (dev == null)
            {
                return(View("SiteHome", (object)username));
            }

            var achievementService = new AchievementService();

            achievementService.UpdateDeveloperAchievements(dev);

            var viewModel = new DeveloperHomeViewModel(dev);

            return(View("DeveloperHome", viewModel));
        }
        public void UpdateDeveloperAchievements_ThereAreAchievementsForDeveloper_AchievementsFromProviders()
        {
            DependencyService.Register <IUnitOfWork>(new MemoryUnitOfWork());
            DependencyService.Register <IAchievementRepository>(new MemoryAchievementRepository());

            var target  = new AchievementService();
            var account = new Developer()
            {
                Username = "******", FullName = "test", Email = "*****@*****.**"
            };

            account.AccountsAtIssuers.Add(new DeveloperAccountAtIssuer(0, "DeveloperWithAchievements"));
            target.UpdateDeveloperAchievements(account);
            Assert.AreEqual(2, account.Achievements.Count);

            Assert.AreEqual("Achievement One", account.Achievements [1].Name);
            Assert.AreEqual("Achievement Two", account.Achievements [0].Name);
        }
        public async Task DeleteAchievement_ShouldReturnVoid_WhenAchievementExists()
        {
            // Arange
            var Id = Guid.NewGuid();
            var CancellationToken = new CancellationToken();

            AchievementRepoMock
            .Setup(x => x.Delete(It.IsAny <Guid>(), CancellationToken))
            .Returns(() => throw  new ArgumentNullException()).Verifiable();
            UnitOfWorkMock.Setup(m => m.AchievementRepository).Returns(AchievementRepoMock.Object);

            AchievementService _AchievementService = new AchievementService(UnitOfWorkMock.Object, MapperMock.Object);

            // Act

            // Assert

            AchievementRepoMock.Verify();

            Assert.ThrowsException <ArgumentNullException>(async() => await _AchievementService.DeleteAchievement(It.IsAny <Guid>(), CancellationToken));
        }
        private async void SaveGame()
        {
            if (!CheckForEndOfGame())
            {
                ContentDialogResult result = await _dialogService.ShowContentDialogAsync(new ConfirmDialogViewModel("End Game", "You are about to quit an unfinished game. Are you sure you want to quit the game and log the stats?"));

                if (result == ContentDialogResult.Secondary)
                {
                    return;
                }
            }

            CalculateScores();

            AchievementService achievementService = new AchievementService(game);

            achievementService.CheckForPersonalScores();
            achievementService.CheckForEverScores();

            try
            {
                _gameRepo.AddGame(game);

                foreach (Player player in game.players)
                {
                    _playerGameRepo.AddPlayerGame(player, game.id);
                }

                achievementService.CheckForFirsts();
                achievementService.CheckForMileStones();

                achievementService.AddAchievements();

                ((App)Application.Current).rootFrame.Navigate(typeof(StandingsView), game);
            }
            catch (SQLiteException)
            {
                await _dialogService.ShowContentDialogAsync(new MessageDialogViewModel("Error", "Something went wrong, please try again"));
            }
        }
        public ExecutionResult MainMenuMessage(List <DrawGame> games, Player player)
        {
            var filteredList = games.Where(a => a.Metadata?.Category != Messages.MiniGames).ToList();

            if (filteredList == null)
            {
                filteredList = new List <DrawGame>();
            }
            List <string> options = new List <string>();

            options = filteredList.Select(a => a.GameName).ToList();
            options.Add(Messages.MiniGames);
            options.Add(Messages.ContactUs);
            options.Add(Messages.LoadGame);
            options.Add($"{Messages.Achievements} - ({AchievementService.CountAchievementsCompletedForGames(games, player)}/{AchievementService.CountTotalAchievements(games)})");
            var execResult = new ExecutionResult();
            var messages   = new List <MessageResult>();

            messages.Add(new MessageResult
            {
                Message = "All characters in this game are 18+! All characters are random, and not based on any pre-existing characters. These games feature adult content, including mild fetishes."
            });
            messages.Add(new MessageResult
            {
                Message = "Games Available:"
            });
            messages.AddRange(filteredList.Select(a => new MessageResult {
                Message = a.GameName + " - " + a.Metadata?.Description
            }));
            messages.Add(
                new MessageResult
            {
                Message = "Enter a game to play!"
            });
            execResult.OptionsToShow  = options;
            execResult.MessagesToShow = messages;
            return(execResult);
        }
        public void InitializeTest()
        {
            Stubs.Initialize();
            Stubs.AchievementRepository.Add(new Achievement()
            {
                Id = 1L
            });
            Stubs.AchievementRepository.Add(new Achievement()
            {
                Id = 2L
            });
            Stubs.AchievementRepository.Add(new Achievement()
            {
                Id = 3L
            });
            Stubs.AchievementRepository.Add(new Achievement()
            {
                Id = 4L
            });
            Stubs.UnitOfWork.Commit();

            m_target = new AchievementService();
        }
        public async Task GetAllAchievements_ShouldReturnCollectionOfAchievement_WhenAchievementExists()
        {
            // Arange
            var CancellationToken = new CancellationToken();
            IEnumerable <Achievement> AchievementsResult = new List <Achievement> {
                new Achievement(), new Achievement(), new Achievement()
            };

            AchievementRepoMock.Setup(x => x.GetAll(CancellationToken))
            .ReturnsAsync(AchievementsResult).Verifiable();
            UnitOfWorkMock.Setup(m => m.AchievementRepository).Returns(AchievementRepoMock.Object);

            AchievementService _AchievementService = new AchievementService(UnitOfWorkMock.Object, MapperMock.Object);

            // Act

            var Achievements = await _AchievementService.GetAllAchievements(CancellationToken);

            // Assert

            Assert.IsNotNull(Achievements);
            AchievementRepoMock.Verify();
            Assert.AreEqual(AchievementsResult, Achievements);
        }
Exemple #28
0
 public ShopController(ShopItemManager shopItemManager, DataContext dataContext, AchievementService achievementService)
 {
     _shopItemManager    = shopItemManager;
     _dataContext        = dataContext;
     _achievementService = achievementService;
 }
        public void UpdateNewUserAchievements()
        {
            Mock <IAchievementManager>    achievementManagerMock = new Mock <IAchievementManager>();
            Mock <ISteamCommunityManager> communityManagerMock   = new Mock <ISteamCommunityManager>();

            // expect
            User user = new User {
                FacebookUserId = 1234, SteamUserId = "user1"
            };

            Data.User dataUser = new Data.User {
                FacebookUserId = 1234, SteamUserId = "user1"
            };
            achievementManagerMock.Setup(rep => rep.GetUser(user.FacebookUserId))
            .Returns(dataUser).Verifiable();

            AchievementXmlParser   achievementXmlParser = new AchievementXmlParser();
            List <UserAchievement> userAchievements     =
                achievementXmlParser.ParseClosed(File.ReadAllText("cssAchievements.xml")).ToList();

            userAchievements.ForEach(
                userAchievement =>
                userAchievement.Game =
                    new Game
            {
                Id       = 240,
                ImageUrl =
                    "http://media.steampowered.com/steamcommunity/public/images/apps/10/af890f848dd606ac2fd4415de3c3f5e7a66fcb9f.jpg",
                Name           = "Counter-Strike: Source",
                PlayedRecently = true,
                StatsUrl       =
                    String.Format("http://steamcommunity.com/id/{0}/games/?xml=1", user.SteamUserId),
                StoreUrl = "http://store.steampowered.com/app/10"
            });

            communityManagerMock.Setup(rep => rep.GetAchievements(user.SteamUserId))
            .Returns(new List <UserAchievement>()).Verifiable();

            achievementManagerMock.Setup(rep => rep.GetUser(user.SteamUserId))
            .Returns(dataUser).Verifiable();
            achievementManagerMock.Setup(rep => rep.UpdateAchievements(It.IsAny <IEnumerable <Data.UserAchievement> >()))
            .Returns(5).Verifiable();

            ICollection <Game> games = new GameXmlParser().Parse(File.ReadAllText("games.xml"));

            communityManagerMock.Setup(rep => rep.GetGames(user.SteamUserId))
            .Returns(games).Verifiable();

            Achievement[] dataAchievements = new[] { new Achievement {
                                                         Description = "x", GameId = 1, Id = 1,
                                                     } };
            achievementManagerMock.Setup(
                rep => rep.GetUnpublishedAchievements(user.SteamUserId, DateTime.UtcNow.Date.AddDays(-2)))
            .Returns(dataAchievements).Verifiable();
            achievementManagerMock.Setup(
                rep =>
                rep.UpdateHidden(user.SteamUserId, It.IsAny <IEnumerable <int> >()))
            .Verifiable();

            // execute
            IAchievementService service =
                new AchievementService(achievementManagerMock.Object, communityManagerMock.Object);

            service.UpdateNewUserAchievements(user);

            // verify
            achievementManagerMock.Verify();
            communityManagerMock.Verify();
        }
    void OnGUI()
    {
        if (Time.time % 2 < 1) {
            success = callBack.GetResult ();
        }

        // For Setting Up ResponseBox.
        GUI.TextArea (new Rect (10, 5, 1100, 175), success);

        //======================================= Achievement Service======================================

        if (GUI.Button (new Rect (50, 200, 200, 30), "Create Achievement")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService(); // Initializing Achievement Service.
            achievementService.CreateAchievement (cons.achievementName, cons.description, callBack);
        }

        //==================================== Achievement Service=========================================

        if (GUI.Button (new Rect (260, 200, 200, 30), "Earn Achievement")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService (); // Initializing Achievement Service.
            achievementService.EarnAchievement (cons.userName, cons.achievementName, cons.gameName, cons.description, callBack);
        }

        //==================================== Achievement Service========================================

        if (GUI.Button (new Rect (470, 200, 200, 30), "GetAll Achievements ForUser")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService (); // Initializing Achievement Service.
            achievementService.GetAllAchievementsForUser(cons.userName, callBack);
        }

        //===================================== Achievement Service=======================================

        if (GUI.Button (new Rect (680, 200, 200, 30), "GetAll Achievements ForUserInGame")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService (); // Initializing Achievement Service.
            achievementService.GetAllAchievementsForUserInGame (cons.userName, cons.gameName, callBack);
        }

        //====================================== Achievement Service======================================

        if (GUI.Button (new Rect (890, 200, 200, 30), "GetAll Achievements")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService (); // Initializing Achievement Service.
            achievementService.GetAllAchievements (callBack);
        }

        //====================================== Achievement Service======================================

        if (GUI.Button (new Rect (50, 250, 200, 30), "Get Achievement ByName")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService (); // Initializing Achievement Service.
            achievementService.GetAchievementByName (cons.achievementName, callBack);
        }

        //======================================= Achievement Service=====================================

        if (GUI.Button (new Rect (260, 250, 200, 30), "GetUsers Achievement")) {
            App42Log.SetDebug(true);
            achievementService = sp.BuildAchievementService (); // Initializing Achievement Service.
            achievementService.GetUsersAchievement(cons.achievementName, cons.gameName, callBack);
        }
    }
Exemple #31
0
 public List <Achievement> GetMyAchievements()
 {
     return(AchievementService.GetMyAchievements());
 }