Esempio n. 1
0
 public bool OnMenuRequest()
 {
     if (cardLibrary.IsOpen() && cardLibrary.OnMenuRequest())
     {
         return(true);
     }
     else if (panelLibrary.IsOpen())
     {
         panelLibrary.Close();
         return(true);
     }
     else if (usingCardView)
     {
         return(cardTab.OnMenuRequest());
     }
     else
     {
         if (codeTab.IsOpen())
         {
             if (!codeTab.OnMenuRequest())
             {
                 SetToCardView();
             }
             return(true);
         }
         return(false);
     }
 }
 internal void Close()
 {
     cardLibrary.Close();
     panelLibrary.Close();
     gameObject.SetActive(false);
 }
Esempio n. 3
0
    public override void Setup(SidebarManager _sidebarManager)
    {
        base.Setup(_sidebarManager);
        Util.FindIfNotSet(this, ref editMain);
        Util.FindIfNotSet(this, ref voosEngine);
        // Util.FindIfNotSet(this, ref offStageWorldController);
        cardTab.Setup();
        codeTab.Setup();

        /*     closeButton.onClick.AddListener(() =>
         *  {
         *    RequestClose();
         *  }); */

        logicSidebarUI.codeButton.onClick.AddListener(() => SetToCodeView());
        logicSidebarUI.cardButton.onClick.AddListener(() => SetToCardView());

        canvasScaler = GetComponentInParent <CanvasScaler>();

        libraryHelper = Instantiate(libraryPrefab, null);
        cardLibrary   = libraryHelper.cardLibrary;
        panelLibrary  = libraryHelper.panelLibrary;
        // focusCardParent = libraryHelper.focusRect;
        cardLibrary.Setup();
        // cardLibrary.onClose = OnLibraryClose;

        logicSidebarUI.libraryButton.onClick.AddListener(() =>
        {
            if (cardLibrary.IsOpen())
            {
                cardLibrary.Close();
            }
            else
            {
                cardTab.GetManager().CloseCardDetail();
                panelLibrary.Close();
                cardLibrary.Open();
                cardLibrary.SetAddCardToSlotListener(null);
            }
        });
        cardLibrary.onCodeRequest += (uri) =>
        {
            SetToCodeView(uri);
        };

        cardDragLayer = Instantiate(cardDragLayerPrefab).GetComponentInChildren <CardDragLayer>();
        cardDragLayer.Setup(cardLibrary, cardTab.GetManager());

        cardTab.GetManager().onCardLibraryRequest += (category, container, slot) =>
        {
            panelLibrary.Close();
            cardTab.GetManager().CloseCardDetail();
            cardLibrary.Open(category);
            cardLibrary.SetAddCardToSlotListener((card) =>
            {
                cardTab.GetManager().AcceptClickedLibraryCard(card, container, slot);
            }, (card) =>
            {
                return(slot.SupportsCard(card));
            });
        };

        cardTab.GetManager().onCardLibraryCancelRequest += () =>
        {
            cardLibrary.SetAddCardToSlotListener(null);
        };

        cardTab.GetManager().onPanelLibraryRequest += () =>
        {
            cardLibrary.Close();
            panelLibrary.Open();
        };

        cardTab.GetManager().onCodeRequest += (uri) =>
        {
            SetToCodeView(uri);
        };

        cardTab.onActorChanged += (actor) =>
        {
            SetCurrActor(actor);
            logicSidebarUI.label.text = actor?.GetDisplayName();
        };

        panelLibrary.onRequestAddPanel += (panel, dragOn) =>
        {
            if (cardTab.IsOpen())
            {
                cardTab.GetManager().AddPanel(panel, dragOn);
            }
        };
    }