Example #1
0
    private void StartSelectionForContainerObj(GameObject containerObj, BehaviorSystem.SavedCardPack existingPack = null)
    {
        CardContainer container = containerObj.GetComponentInChildren <CardContainer>();

        if (container.GetCard().GetModel().IsBuiltin())
        {
            containerObj.SetActive(false);
        }
        else
        {
            bool startSelected = existingPack != null && existingPack.uris.Contains(container.GetCard().GetModel().GetUri());
            container.StartSelectionMode(
                (selected) =>
            {
                if (selection == null)
                {
                    return;
                }
                if (selected)
                {
                    selection.selectedCards.Add(container.GetCard().GetModel().GetUri());
                }
                else
                {
                    selection.selectedCards.Remove(container.GetCard().GetModel().GetUri());
                }
            }, startSelected);
        }
    }
 public void Open(IEnumerable <string> pack, Util.Maybe <ulong> workshopId)
 {
     Open(workshopId);
     this.pack = pack;
     if (!workshopId.IsEmpty())
     {
         BehaviorSystem.SavedCardPack existingPack = behaviorSystem.GetCardPack(workshopId.Get());
         nameField.text = existingPack.workshopName;
         descField.text = existingPack.workshopDesc;
     }
 }
Example #3
0
 void StartSelection(System.Action <IEnumerable <string> > selectionFinishedCallback, Util.Maybe <ulong> workshopId)
 {
     BehaviorSystem.SavedCardPack pack = null;
     if (!workshopId.IsEmpty())
     {
         pack = behaviorSystem.GetCardPack(workshopId.Get());
     }
     this.selection = new Selection(selectionFinishedCallback);
     cardLibraryUI.selectionModePrompt.SetActive(true);
     foreach (GameObject containerObj in cardContainerObjects)
     {
         StartSelectionForContainerObj(containerObj, pack);
     }
 }