Example #1
0
 public void SetCardSet(ShopCard card)
 {
     SuitID           = card.SuitId;
     Title.text       = LocalizationManager.GetLocalizedValue("suitcards") + LocalizationManager.GetValue(card.SuitNameRu, card.SuitName);
     SuitImage.sprite = Resources.Load <Sprite> (card.SuitName);
     SetCard(card);
 }
Example #2
0
 public void BuyCard(ShopCard item)
 {
     if (resources.GetValue(EResources.GOLD) >= item.price)
     {
         resources.AddResources(EResources.GOLD, -item.price);
         library.AddCard(item.card.Clone(), memoriesPile);
     }
 }
Example #3
0
 public void SetCard(ShopCard card)
 {
     CardInfo         = card;
     NameText.text    = LocalizationManager.GetValue(card.NameRu, card.Name);
     PriceText.text   = card.Cost.ToString();
     ItemID           = card.Id;
     ImgSource.sprite = Resources.Load <Sprite>(string.Format("{0} ({1})", CardInfo.SuitName, CardInfo.Position));
 }
 public ShopCardViewModel(ShopCard card)
 {
     Id            = card.Id;
     Name          = card.Name;
     Location      = card.Location;
     EquipmentType = card.EquipmentType.ToString();
     Act           = card.Act;
     IsEquipped    = card.IsEquipped;
     IsExhausted   = card.IsExhausted;
 }
Example #5
0
    void AddButton(ShopCard data, int i, int price, ShopManager manager)
    {
        GameObject btn    = Instantiate(buttonPrefab);
        ShopButton script = btn.GetComponent <ShopButton>();

        script.Manager         = manager;
        script.Data            = data;
        btn.transform.position = new Vector3(i * (cardWidth + padding), 0f, 0f);
        btn.transform.SetParent(buttonsParent, false);
    }
Example #6
0
    void AddCard(ShopCard data, int i)
    {
        GameObject card   = Instantiate(cardPrefab);
        CardUI     script = card.GetComponent <CardUI>();

        card.GetComponent <CardDragHandler>().enabled = false;
        // card.GetComponent<CardClickHandler>().enabled = false; ?
        script.Data             = data.card;
        card.transform.position = new Vector3(i * (cardWidth + padding), 0f, 0f);
        card.transform.SetParent(cardsParent, false);
    }
    public void LoadContent()
    {
        int i = 0;

        foreach (ShopElement se in elements)
        {
            ShopCard newElementCard = Instantiate(shopCard, cardsParent);
            newElementCard.shopCategoryManager = this;
            newElementCard.LoadElement(elements[i]);
            ++i;
        }
    }
Example #8
0
    // Use this for initialization
    void Start()
    {
        Active     = this;
        _towerList = new List <TowerPrototype>();
        _towerList.Add(PrototypeDatabase.Active.Cannon[0]);
        _towerList.Add(PrototypeDatabase.Active.Poison[0]);
        _towerList.Add(PrototypeDatabase.Active.Lightning[0]);
        _towerList.Add(PrototypeDatabase.Active.Flame[0]);
        _towerList.Add(PrototypeDatabase.Active.Frost[0]);
        //_towerList.Add(PrototypeDatabase.Active.Pyro[0]);

        _towerList.Add(PrototypeDatabase.Active.Generator[0]);
        _towerList.Add(PrototypeDatabase.Active.Transfer[0]);
        _towerList.Add(PrototypeDatabase.Active.Wall);

        /*
         *
         *  -1, t - cannon
         *  -2, y - lightning
         *  -3, u - frost
         *  -4, i - holy
         *  -5, o - demon
         *  -6, g - poison
         *  -7, h - weaken
         *  -8, j - generator
         *  -9, k - transfer
         *  -0, l - wall
         */

        _column1 = transform.GetChild(0).gameObject;
        _column2 = transform.GetChild(1).gameObject;

        for (int z = 0; z < 12; z++)
        {
            GameObject currentColumn = (z % 2) == 0 ? _column1 : _column2;
            if (z < _towerList.Count)
            {
                AddButton(currentColumn, _towerList[z], z);
            }
            else
            {
                AddSpacer(currentColumn);// AddButton(currentColumn, null);
            }
        }

        for (int z = 0; z < ShopCard.Active._towerList.Count; z++)
        {
            KeyManager.Active._list.Add(new Hotkey(KeyCode.Alpha1 + z, source => ShopCard.Active.Button_Pressed(ShopCard.Active._towerList[source]), z));
        }
    }
Example #9
0
    public void CreateShop(ShopManager manager)
    {
        for (int i = 0; i < manager.shopCards.Length; i++)
        {
            ShopCard data  = manager.shopCards[i];
            int      price = manager.shopCards[i].price;
            AddCard(data, i);
            AddButton(data, i, price, manager);
        }

        int width = (cardWidth + padding) * manager.shopCards.Length - padding;

        cardsParent.sizeDelta   = new Vector2(width, cardHeight);
        buttonsParent.sizeDelta = new Vector2(width, buttonHeight);
    }
Example #10
0
    public void GetCards()
    {
        //work out what bosses have been beaten by comparing the boss order from the global manager with the current boss level
        int           currentLevel = manager.CurrentBoss;
        List <Bosses> BossOrder    = manager.BossOrder;
        List <Bosses> BeatenBosses = BossOrder.GetRange(0, currentLevel);

        List <Card> PossibleCards = new List <Card>();

        //add all the possible cards to the shoppable cards
        foreach (Bosses boss in BeatenBosses)
        {
            switch (boss)
            {
            case Bosses.Vinnie:
                PossibleCards.AddRange(manager.VinnieCards);
                break;

            case Bosses.Rex:
                PossibleCards.AddRange(manager.RexCards);
                break;

            case Bosses.BlockNess:
                PossibleCards.AddRange(manager.BlockNessCards);
                break;
            }
        }

        PossibleCards.AddRange(manager.GlobalHand);

        //shuffle the cards
        for (int i = 0; i < PossibleCards.Count; i++)
        {
            int  rnd  = Random.Range(0, PossibleCards.Count);
            Card temp = PossibleCards[rnd];
            PossibleCards[rnd] = PossibleCards[i];
            PossibleCards[i]   = temp;
        }

        //display some of the cards
        foreach (Card card in PossibleCards.GetRange(0, 5))
        {
            ShopCard newCard = Instantiate(shopCardPrefab, CardHolder.transform);
            newCard.SetCard(card);
        }
    }
 public void Remove(ShopCard cardIn)
 {
     shopCards.DeleteOne(card => card.Id == cardIn.Id);
 }
 public void Update(string id, ShopCard cardIn)
 {
     shopCards.ReplaceOne(card => card.Id == id, cardIn);
 }
 public ShopCard Create(ShopCard card)
 {
     shopCards.InsertOne(card);
     return(card);
 }
Example #14
0
 public void Buy(ShopCard item)
 {
     gameManager.BuyCard(item);
 }
Example #15
0
 internal YShopCard(ShopCard card)
 {
     ShopCard = card;
 }
Example #16
0
 public void SetCard(ShopCard card)
 {
     Cards[card.Position - 1].SetCard(card);
 }