コード例 #1
0
ファイル: NewDeckUI.cs プロジェクト: joshuaburton2/Kingsbane
    /// <summary>
    ///
    /// Selects the class data and refreshes UI based on a given class
    ///
    /// </summary>
    public void SelectClassData(Classes.ClassList selectedClass)
    {
        //Load in the selected class
        selectedClassData = Classes.GetClassData(selectedClass);

        RefreshClassData();
    }
コード例 #2
0
ファイル: DeckListUI.cs プロジェクト: joshuaburton2/Kingsbane
    /// <summary>
    ///
    /// Initialises the editing of a deck
    ///
    /// </summary>
    public void EditDeck(int deckId, Classes.ClassList selectedDeckClass, DeckListObject _activeDeckObject)
    {
        //Sets the properties of the deck currently being edited
        DeckEditId       = deckId;
        activeDeckObject = _activeDeckObject;

        activeDeckObject.deckDetailsArea.SetActive(true);

        //Locks the deck scrolling
        deckScrollArea.vertical = false;

        //Hides all deck objects in the deck list except the one being edited
        for (int deckIndex = 0; deckIndex < deckListObjects.Count; deckIndex++)
        {
            if (deckListObjects[deckIndex].GetComponent <DeckListObject>().deckData.Id != deckId)
            {
                deckListObjects[deckIndex].SetActive(false);
            }
        }

        //Filters the card library to only show cards which are available to the selected decks class
        libraryUI.ApplyClassPlayableFilter(selectedDeckClass);

        lootButton.interactable    = true;
        upgradeButton.interactable = true;
    }
コード例 #3
0
    public GenerateCardFilter(Classes.ClassList playerClass, int numToGenerate = 1)
    {
        //Ensures the card at least has a playable class
        if (playerClass == Classes.ClassList.Default)
        {
            throw new Exception("Card Filter requires a class");
        }
        ClassPlayable = playerClass;

        //Ensures there is at least one card generated
        if (numToGenerate < 1)
        {
            throw new Exception("Filter requires at least one card to generate");
        }
        NumToGenerate = numToGenerate;

        Name = "";
        IncludeUncollectables = false;
        IsUnique  = false;
        CardType  = CardTypes.Default;
        Resource  = CardResources.Neutral;
        Class     = Classes.ClassList.Default;
        Tag       = Tags.Default;
        SetFilter = new List <Sets>()
        {
            Sets.Standard
        };

        Enchantment      = null;
        DurabilityChange = null;
    }
コード例 #4
0
    /// <summary>
    ///
    /// Gets a hero of a particular tier level and class
    ///
    /// </summary>
    public UnitData GetHero(Classes.ClassList neededClass, TierLevel heroTierLevel, TierLevel abilityTierLevel)
    {
        if (neededClass != Classes.ClassList.Default)
        {
            var heroTier = new HeroTier()
            {
                HeroClass = neededClass, TierLevel = heroTierLevel
            };
            var abilityTier = new HeroTier()
            {
                HeroClass = neededClass, TierLevel = abilityTierLevel
            };

            HeroLookup.TryGetValue(heroTier, out var heroData);
            HeroAbilityLookup.TryGetValue(abilityTier, out var abilityData);

            //Removes the default ability on the hero card and replaces it with the required ability
            heroData.Abilities.Clear();
            heroData.Abilities.Add(abilityData);

            return(heroData);
        }
        else
        {
            throw new Exception("Cannot get hero from Default class");
        }
    }
コード例 #5
0
    /// <summary>
    ///
    /// Obtain a particular classes colour
    ///
    /// </summary>
    public Color GetClassColour(Classes.ClassList neededClass)
    {
        var classColour = new Color();

        classColour = classColours.FirstOrDefault(x => x.Class == neededClass).classColour;
        if (classColour == null)
        {
            classColour = new Color();
        }
        return(classColour);
    }
コード例 #6
0
    /// <summary>
    ///
    /// Initialise the class list object
    ///
    /// </summary>
    public void InitClassListObject(Classes.ClassList _thisClass, NewDeckUI _newDeckUI)
    {
        //Requires new deck UI in order to reference back for the click event
        newDeckUI = _newDeckUI;
        thisClass = _thisClass;

        //If the class is not playable adds a clarifier to the text
        var isPlayableText = Classes.GetClassData(_thisClass).IsPlayable ? "" : @" <color=""white"">(!)</color=""white"">";

        nameText.text          = thisClass.ToString().ToUpper() + isPlayableText;
        objectBackground.color = GameManager.instance.colourManager.GetClassColour(_thisClass);
        classIcon.sprite       = GameManager.instance.iconManager.GetIcon(_thisClass);
    }
コード例 #7
0
    /// <summary>
    ///
    /// Gets a list of player deck templates for a particular class
    ///
    /// </summary>
    public List <DeckData> GetPlayerDeckTemplates(Classes.ClassList neededClass)
    {
        //Gets the relevant class object
        var classData = Classes.ClassDataList.FirstOrDefault(x => x.ThisClass == neededClass);
        //Filters out any NPC decks
        var deckSaveTemplates = classData.DeckTemplates.Where(x => x.IsNPCDeck == false).OrderBy(x => x.Name).ToList();

        //Moves the Empty Deck Template to the beginning of the template list and orders everything else in alphabetical
        var emptyDeckTemplate = deckSaveTemplates.Single(x => x.Name == "Empty Deck");

        deckSaveTemplates.Remove(emptyDeckTemplate);
        deckSaveTemplates.Insert(0, emptyDeckTemplate);

        return(ConvertDeckSave(deckSaveTemplates, true));
    }
コード例 #8
0
    /// <summary>
    ///
    /// Gets an image for a card based on a particular tag
    ///
    /// </summary>
    public Sprite GetCardImage(CardImageTags imageTag, Classes.ClassList requiredClass)
    {
        var image = defaultImage;

        var imageObject = classImageList.FirstOrDefault(x => x.Class == requiredClass).imageList.FirstOrDefault(x => x.imageTag == imageTag);

        if (imageObject == null)
        {
            image = defaultImage;
        }
        else
        {
            image = imageObject.imageSprite;
        }

        return(image);
    }
コード例 #9
0
    /// <summary>
    ///
    /// Applies the filter to filter out cards which are not available to the given class
    ///
    /// </summary>
    /// <param name="classAbailabilityFilter"></param>
    public void ApplyClassPlayableFilter(Classes.ClassList classAbailabilityFilter = Classes.ClassList.Default)
    {
        activeFilter.ClassPlayableFilter = classAbailabilityFilter;

        if (classAbailabilityFilter != Classes.ClassList.Default)
        {
            classplayableDropdown.value        = classplayableDropdown.options.FindIndex(x => x.text == classAbailabilityFilter.ToString());
            classplayableDropdown.interactable = false;
        }
        else
        {
            classplayableDropdown.value        = 0;
            classplayableDropdown.interactable = true;
        }

        InitTabs();
    }
コード例 #10
0
    /// <summary>
    ///
    /// Obtain a particular rarities colour
    ///
    /// </summary>
    public Color GetRarityColour(Rarity neededRarity, Classes.ClassList neededClass)
    {
        var rarityColour = new Color();

        if (neededRarity == Rarity.Hero || neededRarity == Rarity.NPCHero)
        {
            rarityColour = GetClassColour(neededClass);
        }
        else
        {
            rarityColour = rarityColours.FirstOrDefault(x => x.Rarity == neededRarity).rarityColour;
            if (rarityColour == null)
            {
                rarityColour = new Color();
            }
        }

        return(rarityColour);
    }
コード例 #11
0
    /// <summary>
    ///
    /// Initialises the tutor draw UI
    ///
    /// </summary>
    public void InitGenerateCard(CardFunctionUI _cardFunctionUI, Classes.ClassList playerClass)
    {
        CardFunctionUI = _cardFunctionUI;
        PlayerClass    = playerClass;

        ClearEnchantmentFields();
        unitEnchantmentArea.SetActive(false);

        //Sets the list of dropdown fields and input fields
        dropdownFields = new List <TMP_Dropdown>
        {
            classDropdown,
            tagDropdown,
            resourceDropdown,
            typeDropdown,
            positionDropdown,
            modifyCostDropdown,
        };
        inputFields = new List <TMP_InputField>
        {
            nameInput,
            numToGenerateInput,
            createdByInput,
            modifyCostInput,
        };

        //Initialises the dropdowns on the UI
        GeneralUIExtensions.InitDropdownOfType(classDropdown, new List <Classes.ClassList> {
            Classes.ClassList.Default
        }, DEFAULT_DROPDOWN_STRING);
        GeneralUIExtensions.InitDropdownOfType(tagDropdown, new List <Tags> {
            Tags.Default
        }, DEFAULT_DROPDOWN_STRING, true);
        GeneralUIExtensions.InitDropdownOfType(resourceDropdown, new List <CardResources> {
        }, DEFAULT_DROPDOWN_STRING);
        GeneralUIExtensions.InitDropdownOfType(typeDropdown, new List <CardTypes> {
            CardTypes.Default
        }, DEFAULT_DROPDOWN_STRING);
        GeneralUIExtensions.InitDropdownOfType(positionDropdown, new List <DeckPositions>());

        GeneralUIExtensions.InitDropdownOfType(modifyCostDropdown, new List <CardResources> {
        }, MODIFY_COST_DEFAULT_DROPDOWN_STRING);
    }
コード例 #12
0
    /// <summary>
    ///
    /// Functionality for triggering a study effect
    ///
    /// </summary>
    /// <param name="cardClass">The class of the card triggering the study effect. Used to identify which inspiration card to shuffle</param>
    public void TriggerStudy(int studyVal, Classes.ClassList cardClass)
    {
        //Finds the required inspiration card
        var inspirationCardData = GameManager.instance.libraryManager.GenerateGameplayCards(new GenerateCardFilter(cardClass)
        {
            IncludeUncollectables = true,
            Class = cardClass,
            Tag   = Tags.Inspiration,
        }).Single();

        //Shuffles the required number of inspiration cards into the deck. ALso subtracts the Ignorance value from the number of cards shuffled
        for (int i = 0; i < studyVal - Ignorance; i++)
        {
            var inspirationCard = GameManager.instance.libraryManager.CreateCard(inspirationCardData, Player());
            Player().Deck.ShuffleIntoDeck(inspirationCard, "Study");
        }

        //Modifies the players Stagnation each time they activate a Study effect
        ModifyStagnation(STAGNATION_MODIFIER);
    }
コード例 #13
0
 public ClassData(Classes.ClassList neededClass)
 {
     ThisClass = neededClass;
 }