Esempio n. 1
0
    void PressBuyBtn(PointerEventData data)
    {
        int price = CostumeDataManager.Instance.GetCostumeCost(m_CurrentPressedItemRank);

        if (GameMaster.Instance.Gold < price)
        {
            return;
        }

        List <ShopButtons> arrRandom = new List <ShopButtons>();

        for (ShopButtons t = ShopButtons.COSTUME1; t < ShopButtons.END; t++)
        {
            if (!GetUI <ShopButton>((int)t).IsBuy)
            {
                arrRandom.Add(t);
            }
        }

        if (arrRandom.Count == 0)
        {
            return;
        }

        int randomCount = Random.Range(0, arrRandom.Count);

        GameMaster.Instance.Gold -= price;
        GetUI <ShopButton>((int)arrRandom[randomCount]).IsBuy = true;
        CostumeDataManager.Instance.SaveBuyItem(GetUI <ShopButton>((int)arrRandom[randomCount]).ItemInfo.ItemID, true);
    }
 void Start()
 {
     shop = FindObjectOfType <ShopButtons>();
     if (PlayerPrefs.GetInt("boughtTurboStart") == 1)
     {
         stay.SetActive(true);
     }
 }
Esempio n. 3
0
 void Start()
 {
     shop = GameObject.FindObjectOfType <ShopButtons>();
     if (PlayerPrefs.GetInt("boughtLife") == 1)
     {
         stay.SetActive(true);
     }
 }
Esempio n. 4
0
    public void ResetToMinValue(ShopButtons shop)
    {
        damageUpgradeCost = 50;
        healthUpgradeCost = 50;
        speedUpgradeCost  = 50;

        shop.LoadShop();
    }
Esempio n. 5
0
    public static void SaveShop(ShopButtons shop)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/shop.fun";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        ShopData data = new ShopData(shop);

        formatter.Serialize(stream, data);
        stream.Close();
    }
Esempio n. 6
0
    protected void Start()
    {
        BindUI <Button>(typeof(Buttons));
        BindUI <ShopButton>(typeof(ShopButtons));

        for (ShopButtons t = ShopButtons.COSTUME1; t < ShopButtons.END; t++)
        {
            GameObject btn = GetUI <ShopButton>((int)t).gameObject;
            AddUIEvent(
                btn,
                (PointerEventData data) =>
            {
                ShopButton shopbtn = btn.GetComponentInChildren <ShopButton>();

                if (shopbtn == null)
                {
                    return;
                }

                if (shopbtn.IsBuy == false)
                {
                    return;
                }

                ItemInfo info = shopbtn.ItemInfo;

                if (info != null)
                {
                    if (CharacterManager.Instance.m_CurrentWearCostume == info.ItemID)
                    {
                        return;
                    }

                    CharacterManager.Instance.SetCostumeMyCharacter(info.ItemID);
                }
            },
                E_UIEVENT.DOWN);
        }

        AddUIEvent(GetButton((int)Buttons.OK).gameObject, PressOKButton, E_UIEVENT.CLICK);

        AddUIEvent(GetButton((int)Buttons.NORMAL).gameObject, PressNormalTabButton, E_UIEVENT.DOWN);
        AddUIEvent(GetButton((int)Buttons.UNIQUE).gameObject, PressUniqueTabButton, E_UIEVENT.DOWN);
        AddUIEvent(GetButton((int)Buttons.LEGEND).gameObject, PressLegendTabButton, E_UIEVENT.DOWN);

        m_BuyButton = GetButton((int)Buttons.BUY);
        AddUIEvent(m_BuyButton.gameObject, PressBuyBtn, E_UIEVENT.DOWN);

        m_BuyBtnText = Common.FindChild <TMPro.TextMeshProUGUI>(m_BuyButton.gameObject);

        PressNormalTabButton(null);
    }
Esempio n. 7
0
 // Use this for initialization
 void Start()
 {
     shop = GameObject.FindObjectOfType <ShopButtons>();
     if (PlayerPrefs.GetInt("boughtPlane1xx") == 1)
     {
         StayButton1.SetActive(true);
     }
     if (PlayerPrefs.GetInt("boughtPlane2xx") == 1)
     {
         StayButton2.SetActive(true);
     }
     if (PlayerPrefs.GetInt("boughtPlane3xx") == 1)
     {
         StayButton3.SetActive(true);
     }
 }
Esempio n. 8
0
    void PressLegendTabButton(PointerEventData data)
    {
        GetButton((int)(Buttons.UNIQUE)).image.color = Color.white;
        GetButton((int)(Buttons.LEGEND)).image.color = Color.grey;
        GetButton((int)(Buttons.NORMAL)).image.color = Color.white;

        ShopButton shopButton;

        for (ShopButtons t = ShopButtons.COSTUME1; t < ShopButtons.END; t++)
        {
            shopButton = GetUI <ShopButton>((int)t);

            shopButton.ItemInfo = CostumeDataManager.Instance.GetItemInfo(m_ListLegendCostume[(int)t]);
            shopButton.IsBuy    = CostumeDataManager.Instance.GetBuyItem(m_ListLegendCostume[(int)t]);
        }

        m_CurrentPressedItemRank = E_ITEMRANK.LEGEND;
        m_BuyBtnText.text        = $"Buy {CostumeDataManager.Instance.GetCostumeCost(m_CurrentPressedItemRank)}";
    }
Esempio n. 9
0
 public ShopData(ShopButtons shop)
 {
     damageUpgradeCost = shop.damageUpgradeCost;
     healthUpgradeCost = shop.healthUpgradeCost;
     speedUpgradeCost  = shop.speedUpgradeCost;
 }
 private void Awake()
 {
     _shopButtons = GetComponentInChildren <ShopButtons>();
     _shopTexts   = GetComponentInChildren <ShopTexts>();
 }
Esempio n. 11
0
 // Start is called before the first frame update
 void Start()
 {
     UIListener = FindObjectOfType <HoverUIListener>();
     helper     = FindObjectOfType <Helper>();
     shopbutton = FindObjectOfType <ShopButtons>();
 }
 void Start()
 {
     shop = GameObject.FindObjectOfType <ShopButtons>();
 }