コード例 #1
0
 public UploadTime(long time, LeaderboardController leaderboardController)
 {
     Time = time;
     LeaderboardController                  = leaderboardController;
     LeaderboardController.enabled          = true;
     LeaderboardController.AllScoreDataPath =
         TimeDataUtil.GetDBRankPath(CommonData.gameWorld.worldMap);
 }
コード例 #2
0
        public override void Initialize()
        {
            CommonData.mainCamera.mode = CameraController.CameraMode.Gameplay;
            TimeUploaded = false;

            Firebase.Analytics.FirebaseAnalytics.LogEvent(StringConstants.AnalyticsEventTimeUploadStarted,
                                                          StringConstants.AnalyticsParamMapId, CommonData.gameWorld.worldMap.mapId);

            manager.PushState(new WaitForTask(
                                  TimeDataUtil.UploadReplay(Time,
                                                            CommonData.gameWorld.worldMap, CommonData.gameWorld.PreviousReplayData)
                                  .ContinueWith(task => LeaderboardController.AddScore(task.Result)),
                                  StringConstants.UploadTimeTitle, true));
        }
コード例 #3
0
ファイル: Gameplay.cs プロジェクト: yusufbahadir/mechahamster
        // Initialization method.  Called after the state
        // is added to the stack.
        public override void Initialize()
        {
            CommonData.mainGame.SelectAndPlayMusic(CommonData.prefabs.gameMusic, true);
            fixedUpdateTimestamp = 0;
            if (CommonData.vrPointer != null)
            {
                CommonData.vrPointer.SetActive(false);
            }
            Time.timeScale = 1.0f;
            double gravity_y =
                Firebase.RemoteConfig.FirebaseRemoteConfig.GetValue(
                    StringConstants.RemoteConfigPhysicsGravity).DoubleValue;

            Physics.gravity = new Vector3(0, (float)gravity_y, 0);
            CommonData.gameWorld.ResetMap();
            Utilities.HideDuringGameplay.OnGameplayStateChange(true);
            CommonData.mainCamera.mode = CameraController.CameraMode.Gameplay;

            gameplayRecordingEnabled = Firebase.RemoteConfig.FirebaseRemoteConfig.GetValue(
                StringConstants.RemoteConfigGameplayRecordingEnabled).BooleanValue;

            if (gameplayRecordingEnabled)
            {
                gameplayRecorder = new GameplayRecorder(CommonData.gameWorld.worldMap.name, 1);

                // Subscribe player spawn event in order to reset replay data whenever it is triggered.
                CommonData.mainGame.PlayerSpawnedEvent.AddListener(OnPlayerSpawned);
            }
            Screen.sleepTimeout = SleepTimeout.NeverSleep;

            dialogComponent = SpawnUI <Menus.FloatingButtonGUI>(StringConstants.PrefabFloatingButton);
            PositionButton();

            CommonData.gameWorld.MergeMeshes();

            // Retrieve path to the best replay record
            if (gameplayRecordingEnabled)
            {
                TimeDataUtil.GetBestSharedReplayPathAsync(CommonData.gameWorld.worldMap)
                .ContinueWith(task => {
                    bestReplayPath = task.Result;
                });
            }
        }
コード例 #4
0
ファイル: TopTimes.cs プロジェクト: yusufbahadir/mechahamster
        private void InitializeUI()
        {
            if (menuComponent == null)
            {
                menuComponent = SpawnUI <Menus.TopTimesGUI>(StringConstants.PrefabsTopTimes);
            }
            var leaderboardController = LeaderboardController;

            leaderboardController.enabled = true;
            ShowUI();
            menuComponent.RecordNames.text = "";
            menuComponent.RecordTimes.text = "";

            leaderboardController.AllScoreDataPath =
                TimeDataUtil.GetDBRankPath(CommonData.gameWorld.worldMap);
            if (leaderboardController.TopScores.Count > 0)
            {
                DisplayTimes = leaderboardController.TopScores;
            }
            leaderboardController.TopScoresUpdated += UpdateScores;
            leaderboardController.ScoreAdded       += AddScore;
            menuComponent.LevelName.text            = CommonData.gameWorld.worldMap.name;
        }