Example #1
0
            private static void Postfix(MenuState __instance, ref MenuState.State state)
            {
                if (state == MenuState.State.LaunchPage)
                {
                    DeleteButton.CreateDeleteButton();
                    FavoriteButton.CreateFavoriteButton();
                    AddPlaylistButton.CreatePlaylistButton();
                    DifficultyDisplay.Show();
                }
                else
                {
                    DifficultyDisplay.Hide();
                }
                if (state == MenuState.State.SongPage)
                {
                    ScoreDisplayList.Show();
                    RandomSongButton.CreateRandomSongButton();
                    SongSearchButton.CreateSearchButton();
                    SelectPlaylistButton.CreatePlaylistButton();
                    PlaylistEndlessButton.CreatePlaylistButton();
                    RefreshButton.CreateRefreshButton();
                    PlaylistEndlessManager.ResetIndex();
                }
                else
                {
                    ScoreDisplayList.Hide();
                    PlaylistEndlessButton.HidePlaylistButton();
                }

                if (state == MenuState.State.MainPage)
                {
                    //PlaylistManager.DownloadMissingSongs();
                }
            }
Example #2
0
            private static void Postfix(MenuState __instance, ref MenuState.State state)
            {
                if (state == MenuState.State.LaunchPage)
                {
                    DeleteButton.CreateDeleteButton();
                    FavoriteButtonButton.CreateFavoriteButtonButton();
                    DifficultyDisplay.Show();
                }
                else
                {
                    DifficultyDisplay.Hide();
                }
                if (state == MenuState.State.SongPage)
                {
                    ScoreDisplayList.Show();
                }
                else
                {
                    ScoreDisplayList.Hide();
                }

                if (state == MenuState.State.SongPage)
                {
                    RandomSong.CreateRandomSongButton();
                }
            }
Example #3
0
    public static void LoadHistory(string leaderboardID)
    {
        if (historyLoaded)
        {
            return;
        }
        if (leaderboardID == "")
        {
            return;
        }
        historyLoaded = true;
        scores        = null;
        LocalPlayHistory localhistory;

        if (!File.Exists(historySavePath + leaderboardID))
        {
            scores = new List <AudicaScore>();
            MelonLogger.Msg("No history found, creating new history");
            return;
        }

        FileStream fs = new FileStream(historySavePath + leaderboardID, FileMode.Open);

        try
        {
            BinaryFormatter formatter = new BinaryFormatter();
            localhistory = (LocalPlayHistory)formatter.Deserialize(fs);
            if (localhistory.leaderboardID == leaderboardID)
            {
                scores = localhistory.scores;
            }
            else
            {
                scores = new List <AudicaScore>();
                MelonLogger.Msg("Wrong user, creating new history instead");
                return;
            }
        }
        catch (SerializationException e)
        {
            Console.WriteLine("Failed to deserialize. Reason: " + e.Message);
            throw;
        }
        finally
        {
            fs.Close();
        }
        MelonLogger.Msg($"Loaded {scores.Count.ToString()} scores");
        audicaScore = lastAudicaScore = CalculateTotalRating();
        ScoreDisplayList.UpdateTextFromList();
    }