/// <summary> /// /// Click handler for the object /// /// </summary> public void OnPointerClick(PointerEventData eventData) { if (eventData.button == PointerEventData.InputButton.Left) { //For the deck list if its in the library and can be edited if (deckListUI != null) { //If there is a deck currently being edited, refreshes the deck list (which will close the card list panel for this object) if (deckListUI.DeckEditMode) { deckListUI.RefreshDeckList(); } //If not, sets the deck list UI into edit mode and opens the card list panel on this object else { deckListUI.EditDeck(deckId, deckData.DeckClass, this); deckDetailsArea.gameObject.SetActive(true); } } //For the deck list if its in the lobby and cannot be edited else if (lobbyDeckListUI != null) { //If there is a deck currently selected, refreshes the deck list (which will close the card list panel for this object) if (lobbyDeckListUI.DeckSelected) { lobbyDeckListUI.RefreshDeckList(); } //If not, sets the lobby deck list UI into selected mode and opens the card list panel on this object else { if (lobbyDeckListUI.SelectDeck(deckData)) { deckDetailsArea.gameObject.SetActive(true); } } } //For the deck list if its in the campaign lobby and cannot be edited else if (campaignDeckListUI != null) { campaignDeckListUI.SelectDeck(deckData); } else if (campaignManagerUI != null) { } else { throw new Exception("Deck list object not initialised properly. Requires an appropriate parent list."); } } }
/// <summary> /// /// Button click event to create a new deck /// /// </summary> public void CreateNewDeck() { if (campaignId.HasValue) { var newDeck = GameManager.instance.deckManager.CreatePlayerDeck(selectedTemplate, deckNameInput.text, campaignId); loadCampaignUI.LoadCampaignDeck(newDeck); campaignId = null; } else { var deck = GameManager.instance.deckManager.CreatePlayerDeck(selectedTemplate, deckNameInput.text); deckList.RefreshDeckList(deck.Id); } GameManager.instance.uiManager.ClosePanel(gameObject); }
/// <summary> /// /// Initialises the card library when it is first opened /// /// </summary> public void RefreshCardLibrary() { libraryUI.LibraryInitialisation(); deckListUI.RefreshDeckList(null, false); }