Example #1
0
        //Player hit the goal
        public void RunFinished(TimeSpan time, Demo demo)
        {
            currentDemo  = demo;
            LastRunWasPb = PlayerSave.current.SaveIfPersonalBest(time.Ticks, MapManager.CurrentMap);

            GameMenu.SingletonInstance.CloseAllWindows();
            EndLevelWindow window = (EndLevelWindow)GameMenu.SingletonInstance.AddWindow(Window.END_LEVEL);

            window.Initialize(currentDemo);

            if (!demo.RunVaild)
            {
                print("Invalid run!");
                return;
            }
            if (PlayerSave.current == null)
            {
                print("Invalid save!");
                return;
            }
            if (!PlayerSave.current.IsLoggedIn)
            {
                print("Account not logged in!");
                return;
            }

            Leaderboard.SendEntry(PlayerSave.current.Name, time.Ticks, SceneManager.GetActiveScene().name, PlayerSave.current.Token, currentDemo);
        }
Example #2
0
        //Player hit the goal
        public void RunFinished(long[] time, Demo demo)
        {
            currentDemo = demo;

            GameMenu.SingletonInstance.CloseAllWindows();
            EndLevelWindow window = (EndLevelWindow)GameMenu.SingletonInstance.AddWindow(Window.END_LEVEL);

            window.Initialize(currentDemo, PlayerSave.current.SaveTimeIfPersonalBest(time, MapManager.CurrentMap));

            if (!demo.RunValid)
            {
                print("Invalid run!");
                return;
            }
            if (PlayerSave.current == null)
            {
                print("Invalid save!");
                return;
            }
            if (!PlayerSave.current.IsLoggedIn)
            {
                print("Account not logged in!");
                return;
            }

            StartCoroutine(UnityUtils.RunWhenDone(Leaderboard.SendEntry(PlayerSave.current, MapManager.CurrentMap.id, time.Last(), currentDemo), entryRequest =>
            {
                int rank;
                if (entryRequest.Error)
                {
                    GameMenu.SingletonInstance.ShowError(entryRequest.ErrorText);
                }
                else if (int.TryParse(entryRequest.StringResult, out rank) && rank > 0)
                {
                    window.NewOnlineRank(rank);
                }
            }));
        }