bool DoesCardMatchSearch(Card card, string searchString) { ICardModel model = card.GetModel(); if (!model.IsValid()) { return(false); } if (searchString.IsNullOrEmpty()) { return(true); } string stringForSearch = model.GetTitle().ToLower() + " " + model.GetDescription().ToLower(); return(stringForSearch.Contains(searchString.ToLower())); }
public void Populate(ICardModel unassignedCard) { if (unassignedCard == null || !unassignedCard.IsValid()) { return; } cardContainer = null; card.Populate(unassignedCard, true); if (unassignedCard.IsBuiltin()) { codeText.SetText("Duplicate and edit JavaScript"); trashButton.gameObject.SetActive(false); previewButton.gameObject.SetActive(true); } else { codeText.SetText("Edit JavaScript"); previewButton.gameObject.SetActive(false); string behaviorUri = unassignedCard.GetUnassignedBehaviorItem().behaviorUri; VoosActor user = voosEngine.FindOneActorUsing(behaviorUri); string fromActorLib = actorLib.FindOneActorUsingBehavior(behaviorUri); if (user != null) { trashText.SetText($"Cannot delete - used by actor '{user.GetDisplayName()}'"); trashButton.interactable = false; } else if (fromActorLib != null) { trashText.SetText($"Cannot delete - used by creation library actor '{fromActorLib}'"); trashButton.interactable = false; } else { trashText.SetText($"Remove card"); trashButton.interactable = true; } trashButton.gameObject.SetActive(true); } noPropertiesObject.SetActive(!card.HasAnyProps()); UpdateAddToSlotButton(); }
public virtual void Populate(ICardModel card, bool withDetail = false) { if (card == null || !card.IsValid()) { return; } // Debug this.name = $"Card '{card.GetTitle()}'"; this.card = card; this.assignment = null; cardUI.nameField.text = card.GetTitle(); cardUI.descriptionField.text = card.GetDescription(); if (withDetail) { props.SetupPreview(card.GetUnassignedBehaviorItem()); } customFlag.SetActive(!card.IsBuiltin()); ReloadCardImage(); }
public override void Populate(ICardModel card, bool withDetail = true) { if (card == null || !card.IsValid()) { return; } base.Populate(card, withDetail); nameInput.text = card.GetTitle(); descriptionInput.text = card.GetDescription(); categoryDropdown.ClearOptions(); categoryOptions = new List <TMPro.TMP_Dropdown.OptionData>(); bool needsCustomCategory = true; foreach (string category in behaviorSystem.GetCategories()) { if (category == BehaviorCards.CUSTOM_CATEGORY) { needsCustomCategory = false; } categoryOptions.Add(new TMPro.TMP_Dropdown.OptionData(category)); } if (needsCustomCategory) { categoryOptions.Add(new TMPro.TMP_Dropdown.OptionData(BehaviorCards.CUSTOM_CATEGORY)); } categoryDropdown.AddOptions(categoryOptions); // Hack: for now, assume that custom cards only have one category string cardCategory = new List <string>(card.GetCategories())[0]; categoryDropdown.value = categoryOptions.FindIndex((option) => option.text == cardCategory); bool canEdit = !card.GetUnassignedBehaviorItem().IsBehaviorReadOnly(); nameInput.interactable = canEdit; descriptionInput.interactable = canEdit; categoryDropdown.interactable = canEdit; editIconButton.gameObject.SetActive(canEdit); }
public bool IsCardValid() { return(card != null && card.IsValid()); }