Ejemplo n.º 1
0
    public void ButtonPressed(StoreButton buttonThatWasPressed)
    {
        if (buttonThatWasPressed.moth.state == Moth.StoreButtonState.Buy)
        {
            if (Manager.singleton.pollenBanked > buttonThatWasPressed.pollenCost)
            {
                Manager.singleton.pollenBanked  -= buttonThatWasPressed.pollenCost;
                buttonThatWasPressed.moth.state  = Moth.StoreButtonState.Equip;
                pBTxt.GetComponent <Text>().text = "Pollen:    " + Manager.singleton.pollenBanked;
            }
        }
        else if (buttonThatWasPressed.moth.state == Moth.StoreButtonState.Equip)
        {
            foreach (StoreButton button in storeButtons)
            {
                if (button.moth.state == Moth.StoreButtonState.CurrentlyEquipped)
                {
                    button.moth.state = Moth.StoreButtonState.Equip;
                }
            }

            buttonThatWasPressed.moth.state = Moth.StoreButtonState.CurrentlyEquipped;
        }

        foreach (StoreButton button in storeButtons)
        {
            button.Refresh();
        }
    }
Ejemplo n.º 2
0
    public void ButtonStoreMatSelect(StoreButton sb)
    {
        if (!GameDataManger.manager.unlockData.matUnlocks[sb.index])
        {
            return;
        }
        GameDataManger.manager.settings.currentMat = sb.index;
        int count = matButtons.Count;

        for (int i = 0; i < count; i++)
        {
            if (i == sb.index)
            {
                matButtons[i].image.color = highLighted;
            }
            else
            {
                matButtons[i].image.color = nonhighLighted;
            }
        }
        if (spActivated)
        {
            SetupModelHolder();
        }
    }
 void Update()
 {
     selectedStoreBtn = StoreButton.GetSelectedStoreBtn();
     if (selectedStoreBtn != null)
     {
         indexButton = selectedStoreBtn.GetIndexButton();
         buyButton   = selectedStoreBtn.GetBuyButton();
         soldText    = selectedStoreBtn.GetSoldText();
     }
 }
Ejemplo n.º 4
0
 private void AddButtons()
 {
     for (int i = 0; i < shopItemList.Count; i++)
     {
         ShopItem   shopItem  = shopItemList[i];
         GameObject newButton = buttonObjectPool.GetObject();
         newButton.transform.SetParent(contentPanel, false);
         StoreButton storeButton = newButton.GetComponent <StoreButton>();
         storeButton.Setup(shopItem, this);
     }
 }
Ejemplo n.º 5
0
    void Start()
    {
        helicopter = GameObject.FindWithTag("Player");

        RestartButton.SetActive(false);
        StoreButton.SetActive(false);
        AdButton.SetActive(false);

        text       = GetComponent <Text>();
        text.color = new Color(0, 0, 0, 0);
    }
Ejemplo n.º 6
0
 public void SetDisable()
 {
     helicopter = GameObject.FindWithTag("Player");
     if (helicopter != null)
     {
         RestartButton.SetActive(false);
         StoreButton.SetActive(false);
         AdButton.SetActive(false);
         text.color = new Color(0, 0, 0, 0);
     }
 }
Ejemplo n.º 7
0
 //Shows the buy menu to the user to allow them to purchase a part
 private void ShowBuyMenu(StoreButton storeButton)
 {
     if (validUserLevel(storeButton))
     {
         ShowBuyMenu(storeButton.part.ID);
     }
     else
     {
         ;//The user cannot purchase the part
     }
 }
        public StoreFormButton ToStoreButton()
        {
            var button = StoreButton.GetCopy();

            button.Order       = Order;
            button.ControlType = ComponentType.ToString();
            // prepare new collection as target for copy operation
            button.NavigationParameterMapping = new List <StoreNavigationParameter>();
            StoreButton.NavigationParameterMapping.CopyListTo(button.NavigationParameterMapping);

            return(button);
        }
Ejemplo n.º 9
0
    void Update()
    {
        helicopter = GameObject.FindWithTag("Player");

        if (helicopter != null)
        {
            coins = PlayerPrefs.GetInt("TotalCoins");
            RestartButton.SetActive(false);
            StoreButton.SetActive(false);
            AdButton.SetActive(false);
            text.color = new Color(0, 0, 0, 0);
        }
        else if (helicopter == null)
        {
            text.color = new Color(0, 0, 0, 1);
            text.text  = "Game Over\nYour Score:\n" + coins + " Coins";
            RestartButton.SetActive(true);
            StoreButton.SetActive(true);
            AdButton.SetActive(true);
        }
    }
Ejemplo n.º 10
0
    private void EnableBuyButton()
    {
        var storeButtons = FindObjectsOfType <StoreButton>();

        for (int i = 0; i < storeButtons.Length; i++)
        {
            if (storeButtons[i] == this)
            {
                selectedStoreBtn = storeButtons[i];
                int index = GetIndexButton();
                int nr    = PlayerPrefsController.GetBoughtDefenderPrefs(index);
                if (nr == 0)
                {
                    soldText.SetActive(false);
                    buyButton.SetActive(true);
                }
                else if (nr == 1)
                {
                    soldText.SetActive(true);
                    buyButton.SetActive(false);
                }
            }
        }
    }
Ejemplo n.º 11
0
 public void MarketClick(StoreButton item, bool buy)
 {
     if (buy)
     {
         int cap = getCapacityUse();
         if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
         {
             if (Singleton.data.plyr.credits >= Singleton.data.prices[item.id] * 10 && (Singleton.data.plyr.capmax - cap) >= 10)
             {
                 Singleton.data.plyr.credits        -= Singleton.data.prices[item.id] * 10;
                 Singleton.data.plyr.goods[item.id] += 10;
             }
         }
         else if (Singleton.data.plyr.credits >= Singleton.data.prices[item.id] && cap < Singleton.data.plyr.capmax)
         {
             Singleton.data.plyr.credits -= Singleton.data.prices[item.id];
             Singleton.data.plyr.goods[item.id]++;
         }
     }
     else
     {
         if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
         {
             if (Singleton.data.plyr.goods[item.id] >= 10)
             {
                 Singleton.data.plyr.credits        += Mathf.Round(Singleton.data.prices[item.id] * 10 * .8F);
                 Singleton.data.plyr.goods[item.id] -= 10;
             }
         }
         else if (Singleton.data.plyr.goods[item.id] >= 1)
         {
             Singleton.data.plyr.credits += Mathf.Round(Singleton.data.prices[item.id] * .8F);
             Singleton.data.plyr.goods[item.id]--;
         }
     }
 }
Ejemplo n.º 12
0
 private void Start()
 {
     storeButton = GetComponent <StoreButton>();
     storeButton.UpdateButton(inUseItems.ReturnItem(thisItem));
 }
Ejemplo n.º 13
0
    void InitializeStoreButtons()
    {
        modelButtons.Add(storeModelButtonPrime.GetComponent <StoreButton>());
        int modelButtonCount = 6;

        if (GameDataManger.manager.unlockData.modelUnlocks[6])
        {
            modelButtonCount = 7;
        }
        for (int i = 1; i < modelButtonCount; i++)
        {
            GameObject  sbg = Instantiate(storeModelButtonPrime, modelButtonParent);
            StoreButton sb  = sbg.GetComponent <StoreButton>();
            modelButtons.Add(sb);
            sb.index = i;
            //Debug.Log (GameDataManger.manager.unlockData.modelUnlocks.Length);
            bool unlocked = GameDataManger.manager.unlockData.modelUnlocks[i];
            sb.GetComponent <Button>().interactable = unlocked;
            if (unlocked)
            {
                switch (i)
                {
                case 1:
                    sb.title.text       = "Banana";
                    sb.description.text = "Now you know how big things really are!";
                    break;

                case 2:
                    sb.title.text       = "Eggplant";
                    sb.description.text = "Not quite as meaty as a taco.";
                    break;

                case 3:
                    sb.title.text       = "Guac";
                    sb.description.text = "The tastiest green goo imaginable.";
                    break;

                case 4:
                    sb.title.text       = "Money";
                    sb.description.text = "Papers and papers and 'papes'...";
                    break;

                case 5:
                    sb.title.text       = "Void";
                    sb.description.text = "I guess you deserve this...";
                    break;

                case 6:
                    sb.title.text       = "Dachie!";
                    sb.description.text = "Mah Bois!!";
                    break;
                }
            }
            else
            {
                sb.title.text       = "???";
                sb.description.text = "???";
            }
        }
        matButtons.Add(storeMatButtonPrime.GetComponent <StoreButton>());
        for (int i = 1; i < 6; i++)
        {
            GameObject  sbg = Instantiate(storeMatButtonPrime, matButtonParent);
            StoreButton sb  = sbg.GetComponent <StoreButton>();
            matButtons.Add(sb);
            sb.index = i;
            //Debug.Log (GameDataManger.manager.unlockData.matUnlocks.Length);
            bool unlocked = GameDataManger.manager.unlockData.matUnlocks[i];
            sb.GetComponent <Button>().interactable = unlocked;
            if (unlocked)
            {
                switch (i)
                {
                case 1:
                    sb.title.text       = "Bronze";
                    sb.description.text = "You beat the game. Not bad.";
                    break;

                case 2:
                    sb.title.text       = "Silver";
                    sb.description.text = "You overcame the odds. Well done!";
                    break;

                case 3:
                    sb.title.text       = "Gold";
                    sb.description.text = "You've worked hard. Now, reap the rewards.";
                    break;

                case 4:
                    sb.title.text       = "Supporter";
                    sb.description.text = "You know a good deal when you see it.";
                    break;

                case 5:
                    sb.title.text       = "Void";
                    sb.description.text = "You did the unthinkable...";
                    break;
                }
            }
            else
            {
                sb.title.text       = "???";
                sb.description.text = "???";
            }
        }
    }
Ejemplo n.º 14
0
 //Hides the specs for the previous part
 public void HidePartSpecs(StoreButton storeButton)
 {
     partDesc.gameObject.SetActive(false);
     HidePartDesc();
 }
Ejemplo n.º 15
0
 //Displays the the part information for the inputted partID
 public void ShowPartSpecs(StoreButton storeButton)
 {
     ShowPartDesc(storeButton.part);
 }
Ejemplo n.º 16
0
 private bool validUserLevel(StoreButton storeButton)
 {
     return(storeButton.Part.LevelToUnlock <= DataManager.Instance.CurrentUser.Level);
 }