public void SetToCodeView(string selectedCardUri = null, VoosEngine.BehaviorLogItem?error = null) { usingCardView = false; cardLibrary.Close(); cardTab.Close(); codeTab.Open(selectedCardUri, error); UpdateButtons(); OnSwitchToCodeView?.Invoke(); }
internal void Close() { cardLibrary.Close(); panelLibrary.Close(); gameObject.SetActive(false); }
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); } }; }