Beispiel #1
0
    private Menu Initialize()
    {
        InitializeCamera();
        InitializeTransition();
        DataController dataController = InitializeDataController();
        BackendProxy   backendProxy   = InitializeBackendProxy(dataController);

        WorldSave[] worldSaves = dataController.GetWorldSaves();
        Action      publishAndShowLeaderboard = () => {
            int totalHighScore = dataController.GetWorldSaves().Aggregate(0, (acc, worldSave) => acc + worldSave.highScore);
            backendProxy.PublishScore(totalHighScore)
            .Then(() => backendProxy.ShowLeaderboard())
            .Catch(exception => { });
        };

        InitializeUI(worldSaves,
                     () => Application.Quit(),
                     publishAndShowLeaderboard
                     );
        InitializeSoundCentralPool();
        this.MenuProcess();

        SoundData playVulkanoid = new SoundData(GetInstanceID(), SRResources.Audio.Music.Volkanoid2MenuTheme, true);

        Messenger.Publish(new PlayMusicMessage(playVulkanoid));
        return(this);
    }
Beispiel #2
0
 public void Handle(PublishScoreMessage message)
 {
     if (!_playerPrefsManager.UserAuthenticated)
     {
         Messenger.Publish(new ShowAlertMessage("Without authentication you can't \n access the leaderboard"));
         return;
     }
     if (!_playerPrefsManager.ScorePublished)
     {
         _menuCanvas.DisableLoading(true);
         _menuCanvas.DisableButtons();
         int score = _playerPrefsManager.GetScore();
         _backendProxy.PublishScore(score, _postingDelegate);
         return;
     }
     _backendProxy.ShowLeaderboard();
     return;
 }