Пример #1
0
 void initAlerts()
 {
     AlertPanel        = GameObject.Find("AlertPanel");
     alertTitle        = GameObject.Find("AlertTitle").GetComponent <Text>();
     alertBody         = GameObject.Find("AlertBody").GetComponent <Text>();
     alertButtonOK     = GameObject.Find("AlertButtonOK");
     alertButtonCancel = GameObject.Find("AlertButtonCancel");
     AlertPanel.SetActive(false);
 }
Пример #2
0
 public void UnlockSlot(int index)
 {
     if (index == 0)
     {
         if (IngameManager.Instance.Data.Money < 100)
         {
             AlertPanel.SetActive(true);
         }
         else
         {
             IngameManager.Instance.Data.Money -= 100;
             Units[1].Data.Unlocked             = true;
             Units[1].Activate();
             AddonSlotPurchased[index].SetActive(true);
         }
     }
     else if (index == 1)
     {
         if (IngameManager.Instance.Data.Money < 100)
         {
             AlertPanel.SetActive(true);
         }
         else
         {
             IngameManager.Instance.Data.Money -= 100;
             Units[2].Data.Unlocked             = true;
             Units[2].Activate();
             AddonSlotPurchased[index].SetActive(true);
         }
     }
     else if (index == 2)
     {
         if (IngameManager.Instance.Data.Money < 100)
         {
             AlertPanel.SetActive(true);
         }
         else
         {
             IngameManager.Instance.Data.Money -= 100;
             Units[4].Data.Unlocked             = true;
             Units[4].Activate();
             AddonSlotPurchased[index].SetActive(true);
         }
     }
 }
Пример #3
0
        public SongPurchaseState TryPurchase(SongData data)
        {
            if (IngameManager.Instance.Data.Money < data.Cost)
            {
                AlertPanel.SetActive(true);
                return(SongPurchaseState.Failed);
            }
            else
            {
                IngameManager.Instance.Data.Money -= data.Cost;
                data.Index = IngameManager.Instance.Data.CurrentSongIndex;
                IngameManager.Instance.Data.Songs.Add(IngameManager.Instance.Data.CurrentSongIndex++, data);
                data.SetAsEarned();

                SongPicker.Instance.LoadCard(IngameManager.Instance.Data.Songs[data.Index]);
                IngameManager.Instance.SongList.LoadCard(IngameManager.Instance.Data.Songs[data.Index]);
                return(SongPurchaseState.Succeed);
            }
        }