public void ReadCreatureFromAsset()
    {
        CreatureGraphicImage.sprite = cardAsset.ImageCarte;

        AttackText.text = cardAsset.Attaque.ToString();
        HealthText.text = cardAsset.VieMaximum.ToString();

        if (PreviewManager != null)
        {
            PreviewManager.cardAsset = cardAsset;
            PreviewManager.ReadCardFromAsset();
        }

        if (cardAsset.DernierSouffle == true)
        {
            CreatureDSImage.gameObject.GetComponent <Image> ().enabled = true;
        }
        else
        {
            CreatureDSImage.gameObject.GetComponent <Image> ().enabled = false;
        }

        if (cardAsset.Tension == true)
        {
            CreatureTensionImage.gameObject.GetComponent <Image> ().enabled = true;
        }
        else
        {
            CreatureTensionImage.gameObject.GetComponent <Image> ().enabled = false;
        }
    }
Exemplo n.º 2
0
    public void ReadCardFromAsset()
    {
        HeroNameText.text       = heroAsset.name;
        HeroNameText.color      = heroAsset.Country.CardColor;
        CardBodyImage.color     = heroAsset.Country.CardColor;
        CountryText.text        = heroAsset.Country.name;
        CardGraphicImage.sprite = heroAsset.CardImage;
        HealthBar.HealthColor   = heroAsset.Country.HealthColor;
        HealthBar.TotalHealth   = heroAsset.MaxHealth;
        SkillList.TotalItems    = heroAsset.SkillsName.Length;
        for (int i = 0; i < SkillList.TotalItems; i++)
        {
            SkillList.ListItems [i].GetComponentInChildren <Text> ().text   = heroAsset.SkillsName [i];
            SkillList.ListItems [i].GetComponentInChildren <Image> ().color = heroAsset.Country.CardColor;
        }
        SkillDescList.TotalItems = heroAsset.SkillsDesc.Length;
        for (int i = 0; i < SkillList.TotalItems; i++)
        {
            SkillDescList.ListItems [i].GetComponent <Text> ().text = heroAsset.SkillsDesc [i];
        }

        if (PreviewManager != null)
        {
            PreviewManager.heroAsset = heroAsset;
            PreviewManager.ReadCardFromAsset();
        }
    }
Exemplo n.º 3
0
    public void LoadFromNetworkPlayer(NetworkPlayer np)
    {
        this.np            = np;
        nickname           = np.nickname;
        nicknameField.text = nickname;

        avatarAsset         = np.avatar;
        avatarSprite.sprite = avatarAsset.AvatarImage;

        if (!np.cardsPlayed.Any() || np.cardsPlayed.Count < 2)
        {
            Debug.LogError("ERROR:  Loading PlayedItem.cs from Player who didn't play any cards.");
        }
        else
        {
            card1Asset = np.cardsPlayed[0].ca;
            card2Asset = np.cardsPlayed[1].ca;

            OneCardManager card1Manager = card1.GetComponent <OneCardManager>();
            card1Manager.cardAsset = card1Asset;
            card1Manager.ReadCardFromAsset();
            OneCardManager card2Manager = card2.GetComponent <OneCardManager>();
            card2Manager.cardAsset = card2Asset;
            card2Manager.ReadCardFromAsset();
        }
    }
Exemplo n.º 4
0
    public void ReadCardFromAsset()
    {
        if (CardAsset.CharacterAsset != null)
        {
            CardBodyImage.color      = CardAsset.CharacterAsset.ClassCardTint;
            CardFaceFrameImage.color = CardAsset.CharacterAsset.ClassCardTint;
            CardTopRibbonImage.color = CardAsset.CharacterAsset.ClassRibbonsTint;
            CardLowRibbonImage.color = CardAsset.CharacterAsset.ClassRibbonsTint;
        }
        else
        {
            CardFaceFrameImage.color = Color.white;
        }

        NameText.text           = CardAsset.name;
        ManaCostText.text       = CardAsset.ManaCost.ToString();
        DescriptionText.text    = CardAsset.Description;
        CardGraphicImage.sprite = CardAsset.CardImage;

        if (CardAsset.TypeOfCard == TypesOfCards.Creature)
        {
            AttackText.text = CardAsset.Attack.ToString();
            HealthText.text = CardAsset.MaxHealth.ToString();
        }

        if (PreviewManager != null)
        {
            PreviewManager.CardAsset = CardAsset;
            PreviewManager.ReadCardFromAsset();
        }

        RarityStoneImage.color = RarityColors.Instance.ColorsDictionary[CardAsset.Rarity];
    }
Exemplo n.º 5
0
    public void ShowCraftingScreen(CardAsset cardToShow)
    {
        currentCard = cardToShow;

        // select type of card to show on this screen - creature or spell
        GameObject cardObject;

        if (currentCard.TypeOfCard == TypesOfCards.Creature)
        {
            cardObject = CreatureCard;
            CreatureCard.SetActive(true);
            SpellCard.SetActive(false);
        }
        else
        {
            cardObject = SpellCard;
            CreatureCard.SetActive(false);
            SpellCard.SetActive(true);
        }
        // change the look of the card to the card that we selected
        OneCardManager manager = cardObject.GetComponent <OneCardManager>();

        manager.cardAsset = cardToShow;
        manager.ReadCardFromAsset();

        // change the text on buttons
        CraftText.text      = "Craft this card for " + TradingCosts[cardToShow.Rarity].CraftCost.ToString() + " dust";
        DisenchantText.text = "Disenchant to get " + TradingCosts[cardToShow.Rarity].DisenchantOutcome.ToString() + " dust";

        ShopManager.Instance.DustHUD.SetActive(true);
        // make sure that correct amount of cards is shown
        UpdateQuantityOfCurrentCard();
        // show the content of this screen
        Content.SetActive(true);
    }
Exemplo n.º 6
0
    GameObject CreateACardAtPosition(CardAsset c, Vector3 position, Vector3 eulerAngles)
    {
        GameObject card;

        if (c.MaxHealth > 0)
        {
            card = GameObject.Instantiate(GlobalSettings.Instance.CreatureCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
        }
        else
        {
            if (c.Targets == TargetingOptions.NoTarget)
            {
                card = GameObject.Instantiate(GlobalSettings.Instance.NoTargetSpellCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
            }
            else
            {
                card = GameObject.Instantiate(GlobalSettings.Instance.TargetedSpellCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
                // передает список допустимых целей скрипту, отвечающему за проверку корректности цели
                DragSpellOnTarget dragSpell = card.GetComponentInChildren <DragSpellOnTarget>();
                dragSpell.Targets = c.Targets;
            }
        }

        OneCardManager manager = card.GetComponent <OneCardManager>();

        manager.cardAsset = c;
        manager.ReadCardFromAsset();

        return(card);
    }
Exemplo n.º 7
0
    public void ReadCardFromAsset()
    {
        if (cardAsset.characterAsset != null)
        {
            CardBodyImage.color         = cardAsset.characterAsset.ClassCardTint;
            CardFaceFrameImage.color    = cardAsset.characterAsset.ClassCardTint;
            CardTopRibbonImage.color    = cardAsset.characterAsset.ClassRibbonsTint;
            CardBottomRibbonImage.color = cardAsset.characterAsset.ClassRibbonsTint;
        }
        else
        {
            /* CardBodyImage.color = GlobalSettings.Instance.CardBodyStandartColor;
             * CardFaceFrameImage.color = Color.white;
             * CardTopRibbonImage.color = GlobalSettings.Instance.CardRibbonsStandartColor;
             * CardBottomRibbonImage.color = GlobalSettings.Instance.CardRibbonsStandartColor;*/
        }

        NameText.text           = cardAsset.name;
        ManaCostText.text       = cardAsset.ManaCost.ToString();
        DescriptionText.text    = cardAsset.Description;
        CardGraphicImage.sprite = cardAsset.CardImage;

        if (cardAsset.MaxHealth != 0)
        {
            AttackText.text = cardAsset.Attack.ToString();
            HealthText.text = cardAsset.MaxHealth.ToString();
        }

        if (PreviewManager != null)
        {
            PreviewManager.cardAsset = cardAsset;
            PreviewManager.ReadCardFromAsset();
        }
    }
Exemplo n.º 8
0
    private GameObject CardFromPack(RarityOptions rarity)
    {
        List <CardAsset> CardsOfThisRarity = CardCollection.Instance.GetCardsWithRarity(rarity);
        CardAsset        a = CardsOfThisRarity[Random.Range(0, CardsOfThisRarity.Count)];

        CardCollection.Instance.QuantityOfEachCard[a]++;

        GameObject card;

        if (a.TypeOfCard == TypesOfCards.Creature)
        {
            card = Instantiate(CreatureCardFromPackPrefab) as GameObject;
        }
        else
        {
            card = Instantiate(SpellCardFromPackPrefab) as GameObject;
        }

        card.transform.rotation = Quaternion.Euler(0f, 180f, 0f);
        OneCardManager manager = card.GetComponent <OneCardManager>();

        manager.CardAsset = a;
        manager.ReadCardFromAsset();
        return(card);
    }
Exemplo n.º 9
0
    // CARD DRAW METHODS

    // creates a card and returns a new card as a GameObject
    GameObject CreateACardAtPosition(Cards c, Vector3 position, Vector3 eulerAngles)
    {
        // Instantiate a card depending on its type
        GameObject card;

        /*if (c.MaxHealth > 0)  //We don't have creature cards now
         * {
         *  // this card is a creature card
         *  card = GameObject.Instantiate(GlobalSettings.Instance.CreatureCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
         * }
         * else
         * {*/
        // this is a spell: checking for targeted or non-targeted spell
        if (c.targets == TargetingOptions.NoTarget)
        {
            card = GameObject.Instantiate(GlobalSettings.Instance.NoTargetSpellCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
        }
        else
        {
            card = GameObject.Instantiate(GlobalSettings.Instance.TargetedSpellCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;
            // pass targeting options to DraggingActions
            DragSpellOnTarget dragSpell = card.GetComponentInChildren <DragSpellOnTarget>();
            dragSpell.Targets = c.targets;
        }

        //}

        // apply the look of the card based on the info from CardAsset
        OneCardManager manager = card.GetComponent <OneCardManager>();

        manager.cardAsset = c;
        manager.ReadCardFromAsset();

        return(card);
    }
Exemplo n.º 10
0
    public void ReadSoldierFromClientAsset(string cardName)
    {
        if (cardName == "Lancer")
        {
            NameText.text = "Lancer";

            ManaText.text = "4";

            AttackText.text           = "4";
            HealthText.text           = "4";
            RangeText.text            = "2";
            MovementText.text         = "";
            SoldierInPlayImage.sprite = Lancer;
        }



        // Change the card graphic sprite
        SoldierInPlayImage.sprite = cardAsset.CardSprite;

        if (PreviewManager != null)
        {
            PreviewManager.cardAsset = cardAsset;
            PreviewManager.ReadCardFromAsset();
        }
    }
Exemplo n.º 11
0
    public OneCardManager CreateCard(Point p, GameObject cardPrefab, GameObject initPosition, CardAsset cardAsset, float delay)
    {
        //card = Instantiate(cardPrefab);

        //keep it bewtween 2 and 1

        OneCardManager card = Instantiate(cardPrefab, initPosition.transform.position, Quaternion.Euler(0, 180, UnityEngine.Random.Range(-1, 1))).GetComponent <OneCardManager>();

        RotateFieldCard(card);
        AllCards.Add(card);

        card.transform.SetParent(FieldCardParent.transform, false);
        card.cardAsset = cardAsset;
        card.ReadCardFromAsset();
        card.point = p;

        EmptyCardSlots.Remove(AllSlots[p.Y, p.X]); // cannot put it here sadly
        card.transform.position = initPosition.transform.position;
        //Debug.Log("R_"+card.transform.rotation);
        //card.transform.Rotate(new Vector3(1, 2, -1));

        Vector3 v = new Vector3(AllSlots[p.Y, p.X].transform.position.x + UnityEngine.Random.Range(-0.05f, 0.05f), AllSlots[p.Y, p.X].transform.position.y + UnityEngine.Random.Range(-0.05f, 0.05f), AllSlots[p.Y, p.X].transform.position.z);

        if (card.cardAsset.Type == CardType.Player)
        {
            v.y = 0.35f;
        }
        card.transform.DOMove(v, delay); //AllSlots[p.Y, p.X].transform.position
        return(card);
    }
Exemplo n.º 12
0
    private void loadCardFromEvent(GameObject card, CardLogic cl)
    {
        OneCardManager cardManager = card.GetComponent <OneCardManager>();

        cardManager.cardAsset = cl.ca;
        cardManager.ReadCardFromAsset();
    }
Exemplo n.º 13
0
    public void ShowCraftingScreen(CardAsset cardToShow)
    {
        currentCard = cardToShow;
        GameObject cardObject;

        if (currentCard.TypeOfCard == TypesOfCards.Creature)
        {
            cardObject = CreatureCard;
            CreatureCard.SetActive(true);
            SpellCard.SetActive(false);
        }
        else
        {
            cardObject = SpellCard;
            CreatureCard.SetActive(false);
            SpellCard.SetActive(true);
        }
        OneCardManager manager = cardObject.GetComponent <OneCardManager>();

        manager.CardAsset = cardToShow;
        manager.ReadCardFromAsset();

        CraftText.text      = "Craft this card for " + TradingCosts[cardToShow.Rarity].CraftCost + " dust";
        DisenchantText.text = "Disenchant to get " + TradingCosts[cardToShow.Rarity].DisenchantOutcome + " dust";

        ShopManager.Instance.DustHUD.SetActive(true);
        UpdateQuantityOfCurrentCard();
        Content.SetActive(true);
    }
 public void PreviewACard(CardLogic cardLogic)
 {
     previewCreatureCardManager.gameObject.SetActive(false);
     previewCreatureCardManager.cardAsset = cardLogic.cardAsset;
     previewCreatureCardManager.ReadCardFromAsset();
     previewCreatureCardManager.summonButton.GetComponent <ClickOnSummonButton>().cardToBeSummoned = cardLogic;
     previewCreatureCardManager.gameObject.SetActive(true);
 }
Exemplo n.º 15
0
    public void ReadCardFromAsset()
    {
        // 2) add card name
        NameLabel.text = LocalizationManager.Localize(Const.cardsin + cardAsset.name);
        // 3) add mana cost
        if (DescriptionLabel != null)
        {
            if (cardAsset.type == CardType.blessing || cardAsset.type == CardType.wrath)
            {
                DescriptionLabel.text = LocalizationManager.Localize(Const.cardsin + cardAsset.type.ToString());
            }
            else
            {
                DescriptionLabel.text = LocalizationManager.Localize(Const.carddescr + cardAsset.name);
            }
        }

        if (CrewLabel != null)
        {
            ShowResolve();
        }

        if (DeadlinessLabel != null)
        {
            DeadlinessLabel.text = GameLogic.GetDeadliness(cardAsset).ToString();
        }

        if (DifficultyLabel != null)
        {
            DifficultyLabel.text = GameLogic.GetCurrentDifficulty(cardAsset).ToString();
        }

        if (UseTypeImage != null)
        {
            string usetTypePath = "tools/" + cardAsset.useType.ToString();
            UseTypeImage.sprite = Resources.Load <Sprite>(usetTypePath);
        }

        if (CardFaceGlowImage != null)
        {
            CardFaceGlowImage.gameObject.SetActive(m_highlighted);
        }

        string frontpath = "cards/" + cardAsset.name;

        CardImage.sprite = Resources.Load <Sprite>(frontpath);


        SetVisibility();

        if (PreviewManager != null)
        {
            // this is a card and not a preview
            // Preview GameObject will have OneCardManager as well, but PreviewManager should be null there
            PreviewManager.cardAsset = cardAsset;
            PreviewManager.ReadCardFromAsset();
        }
    }
Exemplo n.º 16
0
    // method to create a new card and add it to the table
    public void AddSpellCardAtIndex(Cards ca, int UniqueID, int index, CardLogic cl, Player p, ICharacter target)
    {
        GameObject card;

        // create a new creature from prefab
        if (target == null)
        {
            card = GameObject.Instantiate(GlobalSettings.Instance.NoTargetSpellCardPrefab, slots.Children[index].transform.position, Quaternion.identity) as GameObject;
            card.GetComponent <Draggable>().enabled = false;// just can't move when drag should somehow set "Candrag" in DraggingAction to false;
        }
        else
        {
            card = GameObject.Instantiate(GlobalSettings.Instance.TargetedSpellCardPrefab, slots.Children[index].transform.position, Quaternion.identity) as GameObject;
            card.GetComponent <Draggable>().enabled = false;// just can't move when drag should somehow set "Candrag" in DraggingAction to false;
        }



        // apply the look from CardAsset
        OneCardManager manager = card.GetComponent <OneCardManager>();

        manager.cardAsset = ca;
        manager.ReadCardFromAsset();

        // add tag according to owner
        foreach (Transform t in card.GetComponentsInChildren <Transform>())
        {
            t.tag = owner.ToString() + "Card";
        }

        // parent a new creature gameObject to table slots
        card.transform.SetParent(slots.transform);

        // add a new creature to the list
        CardsOnTable.Insert(index, card);

        // let this Card know about its position
        WhereIsTheCardOrCreature w = card.GetComponent <WhereIsTheCardOrCreature>();

        w.Slot        = index;
        w.VisualState = VisualStates.LowTable;

        // add our unique ID to this Card
        IDHolder id = card.AddComponent <IDHolder>();

        id.UniqueID = UniqueID;

        // after a new creature is added update placing of all the other creatures
        ShiftSlotsGameObjectAccordingToNumberOfCards();
        PlaceCardsOnNewSlots();

        p.commandsWaitinglist.Add(new TriggerEffectCommand(cl, target, p, p.table));

        // end command execution
        Command.CommandExecutionComplete();
    }
Exemplo n.º 17
0
 public void ApplyLookFromAsset()
 {
     if (HealthText != null)
     {
         HealthText.text = heroAsset.MaxHealth.ToString();
     }
     PortraitImage.sprite     = heroAsset.CardImage;
     PreviewManager.heroAsset = heroAsset;
     PreviewManager.ReadCardFromAsset();
 }
    private void loadAdventurerCardsFromAsset(CardAsset ca)
    {
        OneCardManager smallManager = smallCard.GetComponent <OneCardManager>();
        OneCardManager largeManager = largeCard.GetComponent <OneCardManager>();

        smallManager.cardAsset = ca;
        largeManager.cardAsset = ca;
        smallManager.ReadCardFromAsset();
        largeManager.ReadCardFromAsset();
    }
Exemplo n.º 19
0
    private void ShowCards(bool showingCardsPlayerDoesNotOwn = false, int pageIndex         = 0, bool includeAllRarities = true, bool includeAllCharacters = true,
                           RarityOptions rarity = RarityOptions.Basic, CharacterAsset asset = null, string keyword       = "", int manaCost = -1, bool includeTokenCards = false)
    {
        // saving the information about the cards that we are showing to players on this page
        _showingCardsPlayerDoesNotOwn = showingCardsPlayerDoesNotOwn;
        _pageIndex            = pageIndex;
        _includeAllRarities   = includeAllRarities;
        _includeAllCharacters = includeAllCharacters;
        _rarity            = rarity;
        _asset             = asset;
        _keyword           = keyword;
        _manaCost          = manaCost;
        _includeTokenCards = includeTokenCards;

        List <CardAsset> CardsOnThisPage = PageSelection(showingCardsPlayerDoesNotOwn, pageIndex, includeAllRarities, includeAllCharacters, rarity,
                                                         asset, keyword, manaCost, includeTokenCards);

        // clear created cards list
        ClearCreatedCards();

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

        // Debug.Log(CardsOnThisPage.Count);

        for (int i = 0; i < CardsOnThisPage.Count; i++)
        {
            GameObject newMenuCard;

            if (CardsOnThisPage[i].TypeOfCard == TypesOfCards.Creature)
            {
                // it is a creature card
                newMenuCard = Instantiate(CreatureMenuPrefab, Slots[i].position, Quaternion.identity) as GameObject;
            }
            else
            {
                // it is a spell card
                newMenuCard = Instantiate(SpellMenuPrefab, Slots[i].position, Quaternion.identity) as GameObject;
            }

            newMenuCard.transform.SetParent(this.transform);

            CreatedCards.Add(newMenuCard);

            OneCardManager manager = newMenuCard.GetComponent <OneCardManager>();
            manager.cardAsset = CardsOnThisPage[i];
            manager.ReadCardFromAsset();

            AddCardToDeck addCardComponent = newMenuCard.GetComponent <AddCardToDeck>();
            addCardComponent.SetCardAsset(CardsOnThisPage[i]);
            addCardComponent.UpdateQuantity();
        }
    }
Exemplo n.º 20
0
    //assign all visual aspects of the attached card to the actual card and its preview
    public void ReadFromCardAsset()
    {
        creatureImage.sprite = card.CardImage;
        AttackText.text      = card.Attack.ToString();

        if (PreviewManager != null)
        {
            PreviewManager.card = card;
            PreviewManager.ReadCardFromAsset();
        }
    }
Exemplo n.º 21
0
    public void ReadCardFromAsset()
    {
        // universal actions for any Card
        // 1) apply tint
        if (cardAsset.characterAsset != null)
        {
            CardBodyImage.color      = cardAsset.characterAsset.ClassCardTint;
            CardFaceFrameImage.color = cardAsset.characterAsset.ClassCardTint;
            CardTopRibbonImage.color = cardAsset.characterAsset.ClassRibbonsTint;
            CardLowRibbonImage.color = cardAsset.characterAsset.ClassRibbonsTint;
        }
        else
        {
            //CardBodyImage.color = GlobalSettings.Instance.CardBodyStandardColor;
            CardFaceFrameImage.color = Color.white;
            //CardTopRibbonImage.color = GlobalSettings.Instance.CardRibbonsStandardColor;
            //CardLowRibbonImage.color = GlobalSettings.Instance.CardRibbonsStandardColor;
        }
        // 2) add card name
        NameText.text = cardAsset.name;
        // 3) add mana cost
        ManaCostText.text = cardAsset.ManaCost.ToString();
        // 4) add description
        DescriptionText.text = cardAsset.Description;
        // 5) Change the card graphic sprite
        CardGraphicImage.sprite = cardAsset.CardImage;

        if (cardAsset.MaxHealth != 0)
        {
            // this is a creature
            AttackText.text = cardAsset.Attack.ToString();
            HealthText.text = cardAsset.MaxHealth.ToString();
        }
        else
        {
            if (gameObject.transform.Find("Health") != null && gameObject.transform.Find("Attack") != null)
            {
                Health = gameObject.transform.Find("Health").gameObject;
                Attack = gameObject.transform.Find("Attack").gameObject;
                Health.SetActive(false);
                Attack.SetActive(false);
            }
        }

        if (PreviewManager != null)
        {
            // this is a card and not a preview
            // Preview GameObject will have OneCardManager as well, but PreviewManager should be null there
            PreviewManager.cardAsset = cardAsset;
            PreviewManager.ReadCardFromAsset();
        }
    }
Exemplo n.º 22
0
    public void showDetail()
    {
        print("showDetail");
        GameObject canvas     = GameObject.Find("DeckCanvas");
        GameObject CardDetail = canvas.transform.Find("CardDetail").gameObject;

        CardDetail.SetActive(true);
        OneCardManager ocm = CardDetail.transform.Find("Card").GetComponent <OneCardManager>();

        print(current.Description);
        ocm.cardAsset = current;
        ocm.ReadCardFromAsset();
    }
Exemplo n.º 23
0
    public void ReadCreatureFromAsset()
    {
        // Change the card graphic sprite
        CreatureGraphicImage.sprite = cardAsset.cardImage;

        /*AttackText.text = cardAsset.Attack.ToString();
         * HealthText.text = cardAsset.MaxHealth.ToString();*///we don't have creature card for now

        if (PreviewManager != null)
        {
            PreviewManager.cardAsset = cardAsset;
            PreviewManager.ReadCardFromAsset();
        }
    }
Exemplo n.º 24
0
    public void ReadCreatureFromAsset()
    {
        // Change the card graphic sprite
        CreatureGraphicImage.sprite = cardAsset.CardImage;

        AttackText.text = cardAsset.Attack.ToString();
        HealthText.text = cardAsset.MaxHealth.ToString();

        if (PreviewManager != null)
        {
            PreviewManager.cardAsset = cardAsset;
            PreviewManager.ReadCardFromAsset();
        }
    }
Exemplo n.º 25
0
    public void ReadCreatureFromAsset()
    {
        // Zmień grafikę stworzenia
        CreatureGraphicImage.sprite = cardAsset.CardImage;

        AttackText.text = cardAsset.Attack.ToString();
        HealthText.text = cardAsset.MaxHealth.ToString();

        if (PreviewManager != null)
        {
            PreviewManager.cardAsset = cardAsset;
            PreviewManager.ReadCardFromAsset();
        }
    }
Exemplo n.º 26
0
    public void ReadCardFromAsset()
    {
        // universal actions for any Card
        // 1) apply tint
        if (cardAsset.CharacterAsset != null)
        {
            CardBodyImage.color      = cardAsset.CharacterAsset.ClassCardTint;
            CardFaceFrameImage.color = cardAsset.CharacterAsset.ClassCardTint;
            CardTopRibbonImage.color = cardAsset.CharacterAsset.ClassRibbonsTint;
            CardLowRibbonImage.color = cardAsset.CharacterAsset.ClassRibbonsTint;
        }
        else
        {
            //CardBodyImage.color = GlobalSettings.Instance.CardBodyStandardColor;
            CardFaceFrameImage.color = Color.white;
            //CardTopRibbonImage.color = GlobalSettings.Instance.CardRibbonsStandardColor;
            //CardLowRibbonImage.color = GlobalSettings.Instance.CardRibbonsStandardColor;
        }
        // 2) add card name
        NameText.text = cardAsset.name;
        // 3) add mana cost
        ManaCostText.text = cardAsset.ManaCost.ToString();
        // 4) add description
        DescriptionText.text = cardAsset.Description;
        // 5) Change the card graphic sprite
        CardGraphicImage.sprite = cardAsset.CardImage;

        if (cardAsset.TypeOfCard == TypesOfCards.Creature)
        {
            // this is a creature
            AttackText.text = cardAsset.Attack.ToString();
            HealthText.text = cardAsset.MaxHealth.ToString();
        }

        if (PreviewManager != null)
        {
            // this is a card and not a preview
            // Preview GameObject will have OneCardManager as well, but PreviewManager should be null there
            PreviewManager.cardAsset = cardAsset;
            PreviewManager.ReadCardFromAsset();
        }

        if (RarityStoneImage == null)
        {
            Debug.Log("RarityStoneImage is null on object:" + gameObject.name);
        }

        // NEW apply rarity color to a card
        RarityStoneImage.color = RarityColors.Instance.ColorsDictionary[cardAsset.Rarity];
    }
Exemplo n.º 27
0
    // CARD DRAW METHODS

    // creates a card and returns a new card as a GameObject
    GameObject CreateACardAtPosition(CardAsset c, Vector3 position, Vector3 eulerAngles)
    {
        // Instantiate a card depending on its type
        GameObject card;

        card = GameObject.Instantiate(GlobalSettings.Instance.ItemCardPrefab, position, Quaternion.Euler(eulerAngles)) as GameObject;

        // apply the look of the card based on the info from CardAsset
        OneCardManager manager = card.GetComponent <OneCardManager>();

        manager.cardAsset = c;
        manager.ReadCardFromAsset();

        return(card);
    }
Exemplo n.º 28
0
    public void ReadCropFromAsset()
    {
        // Change the card graphic sprite
        CropInPlayImage.sprite = cardAsset.CardSprite;

        NameText.text     = cardAsset.name.ToString();
        HealthText.text   = cardAsset.CropHealth.ToString();
        CropSizeText.text = cardAsset.CropSize.ToString();

        if (PreviewManager != null)
        {
            PreviewManager.cardAsset = cardAsset;
            PreviewManager.ReadCardFromAsset();
        }
    }
Exemplo n.º 29
0
    private void ShowCards(int pageIndex = 0, bool includeAllCards = true, CardTypeAsset asset = null)
    {
        //saving infomation about the cards that we are showing to the players on this page
        _pageIndex       = pageIndex;
        _includeAllCards = includeAllCards;
        _asset           = asset;

        List <CardAsset> CardsOnThisPage = PageSelection(pageIndex, includeAllCards, asset);

        //clear created cards list
        ClearCreatedCards();

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

        for (int i = 0; i < CardsOnThisPage.Count; i++)
        {
            GameObject newMenuCard;
            if (CardsOnThisPage [i].TypeOfCard == TypesOfCards.Soldier)
            {
                //it is a soldier
                newMenuCard = Instantiate(soldierMenuPrefab, Slots [i].position, Quaternion.identity) as GameObject;
            }
            else if (CardsOnThisPage [i].TypeOfCard == TypesOfCards.Spell)
            {
                //it is a spell
                newMenuCard = Instantiate(spellMenuPrefab, Slots [i].position, Quaternion.identity) as GameObject;
            }
            else
            {
                //it is a crop
                newMenuCard = Instantiate(cropMenuPrefab, Slots [i].position, Quaternion.identity) as GameObject;
            }
            newMenuCard.transform.SetParent(this.transform);

            createdCards.Add(newMenuCard);

            OneCardManager manager = newMenuCard.GetComponent <OneCardManager> ();
            manager.cardAsset = CardsOnThisPage [i];
            manager.ReadCardFromAsset();

            AddCardToDeck addCardComponent = newMenuCard.GetComponent <AddCardToDeck> ();
            addCardComponent.SetCardAsset(CardsOnThisPage [i]);
            addCardComponent.UpdateQuantity();
        }
    }
Exemplo n.º 30
0
    public void ReadCreatureFromAsset()
    {
        // Change the card graphic sprite
        CreatureGraphicImage.sprite = cardAsset.CardImage;

        AttackText.text = cardAsset.Attack.ToString();
        HealthText.text = cardAsset.MaxHealth.ToString();

        if (PreviewManager != null)
        {
            PreviewManager.cardAsset = cardAsset;
            PreviewManager.ReadCardFromAsset();
        }

        // TODO: this info should be taken not from the asset, but from the CardLogic object.
        Taunt = cardAsset.Taunt;
    }