void Start()
 {
     gameStarter = GetComponent <GameStarter>();
     gameRunner  = GetComponent <GameRunner>();
     gameEnder   = GetComponent <GameEnder>();
     ColorSchemesManager.setColorScheme(DataAndSettingsManager.getColorSchemeID());
     gameEnder.loadAds();
     onInitialize();
 }
    ///<summary>Populates the list of color schemes with `ColorSchemePickerListItem`s.</summary>
    private void setupList()
    {
        int selectedID = DataAndSettingsManager.getColorSchemeID();

        for (int i = 0; i < ColorSchemesManager.getNumColorSchemes(); i++)
        {
            // instantiate a list item in the scroll view for each color scheme
            ColorSchemePickerListItem item     = Instantiate(this.listItemPrefab, new Vector2(0f, -120f * i - 60f), Quaternion.identity) as ColorSchemePickerListItem;
            RectTransform             itemRect = item.gameObject.GetComponent <RectTransform>();
            itemRect.SetParent(this.listContentRect.transform, false);
            item.setup(i, (i == selectedID));
        }
    }
 public void selectAction()
 {
     if (this.isLocked)
     {
         return;
     }
     if (OnSelectColorScheme != null)
     {
         OnSelectColorScheme(); // deselect all list items
     }
     this.setSelected(true);
     ColorSchemesManager.setColorScheme(this.colorSchemeID);
     DataAndSettingsManager.setColorSchemeID(this.colorSchemeID);
     FindObjectOfType <AudioManager>().playButtonSound();
 }
    /* * * * Public methods * * * */

    public void setup(int colorSchemeID, bool selected)
    {
        this.colorSchemeID = colorSchemeID;
        this.setSelected(selected);
        ColorScheme cs = ColorSchemesManager.getColorSchemeWithID(colorSchemeID);

        this.setColors(cs);
        this.colorSchemeName = cs.getName();
        this.nameLabel.text  = this.colorSchemeName;
        this.packName        = cs.getPackName();
        this.isLocked        = (colorSchemeID > 1 && DataAndSettingsManager.getNumBoughtForStoreItem(this.packName) == 0);
        if (this.isLocked)
        {
            this.nameLabel.text += " (Locked)";
        }
    }
    /* * * * Helper methods * * * */

    private void updateColorSchemeLabel()
    {
        int id = DataAndSettingsManager.getColorSchemeID();

        this.colorSchemeLabel.text = ColorSchemesManager.getColorSchemeWithID(id).getName();
    }