/// <summary> /// Create our two controls for showing the cards in our deck and that are available to be added /// </summary> public override void Initialise() { base.Initialise(); DeckCardListControl = new CardGridControl(Deck.Cards, deckColumns, new Vector2(Size.X * ratio, Size.Y), new Vector2(Size.X * (0.5f - 0.5f * ratio), 0)); // Add all the cards in our deck that are of our type DeckCardListControl.IncludePredicate = new Predicate <CardData>(x => x.Type == CardType); DeckCardListControl.OnRightClicked += RemoveFromDeck; // Do this here because we need to add the IncludePredicate before we initialise the control. AddChild(DeckCardListControl, true, true); List <CardData> availableCards = CentralCardRegistry.ConvertToDataList(PlayerDataRegistry.Instance.PlayerData.CardDataAssets); RegistryCardListControl = new CardGridControl(availableCards, registryColumns, new Vector2(Size.X * (1 - ratio), Size.Y), new Vector2(-ratio * 0.5f * Size.X, 0)); // Find all cards of our type that are also not in our deck already RegistryCardListControl.IncludePredicate = new Predicate <CardData>(x => x.Type == CardType); RegistryCardListControl.OnLeftClicked += AddToDeck; // Do this here because we need to add the IncludePredicate before we initialise the control. AddChild(RegistryCardListControl, true, true); }
/// <summary> /// Creates a list and loads the card data assets we have inputted. /// </summary> /// <param name="cards">The initial card data assets to add to this deck</param> public void Create(List <string> cards) { Create(); Cards.AddRange(CentralCardRegistry.ConvertToDataList(cards)); }