コード例 #1
0
    public void Init(GameRunner gr)
    {
        Debug.Log("inside init");
        gameRunner = gr;
        foreach (Transform child in savedReadingsContainer.transform)
        {
            Destroy(child.gameObject); // macabre
        }
        if (gr.DEBUG_EnableReadingGeneration)
        {
            DEBUG_generateReadingsButton.gameObject.SetActive(true);
        }
        else
        {
            DEBUG_generateReadingsButton.gameObject.SetActive(false);
        }
        SaveData data = SaveUtils.LoadSaveData();

        savedReadings = data.savedReadings;
        confirmDeleteReadingUI.gameObject.SetActive(false);
        List <SavedReading> favoriteReadings = new List <SavedReading>();
        List <SavedReading> regularReadings  = new List <SavedReading>(); // little old bullshit readings, f**k em

        foreach (SavedReading reading in data.savedReadings)
        {
            if (reading.isFavorite)
            {
                favoriteReadings.Add(reading);
            }
            else
            {
                regularReadings.Add(reading);
            }
        }
        foreach (SavedReading reading in favoriteReadings.Concat(regularReadings))
        {
            SavedReadingCard card = Instantiate(savedReadingPrefab, savedReadingsContainer).GetComponent <SavedReadingCard>();
            card.Init(reading, this, favoriteReadings.Count < 20);
        }
    }