Пример #1
0
    void Start()
    {
        sh       = SkinHelper.GetInstance();
        skinners = sh.GetSkinners();
        skins    = sh.GetSkins();
        count    = skins.Length;
        Locate();
        Refresh();

        next.onClick.AddListener(() => {
            selected = (selected + 1) % count;
            Refresh();
        });

        prev.onClick.AddListener(() => {
            selected = (selected == 0 ? count : selected) - 1;
            Refresh();
        });

        unlock.onClick.AddListener(() => {
            if (uic.Purchase(skinners[selected].price))
            {
                skinners[selected].unlock = true;
                unlockText.text           = "Unlocked";
                unlock.interactable       = false;
                equipText.text            = "Equip";
                equip.interactable        = true;
                sh.SaveSkinners();
            }
        });

        equip.onClick.AddListener(() => {
            skinners[equipped].equip = false;
            skinners[selected].equip = true;
            equipped           = selected;
            equipText.text     = "Equipped";
            equip.interactable = false;
            sh.SaveSkinners();
        });
    }
Пример #2
0
 void OnDestroy()
 {
     sh.SaveSkinners();
 }