private void OnNameChanged(string deckName) { m_settingValue = true; m_value?.SetName(deckName); m_saveButton.set_interactable(!DeckUtility.DecksAreEqual(m_value?.DeckInfo, m_uneditedValue?.DeckInfo)); m_settingValue = false; }
private void OnSpellChange(SpellData previousSpellData, SpellData spellData, int index) { m_settingValue = true; m_value?.SetSpellAt((spellData != null) ? spellData.definition.get_id() : (-1), index); m_saveButton.set_interactable(!DeckUtility.DecksAreEqual(m_value?.DeckInfo, m_uneditedValue?.DeckInfo)); UpdateInvalidDeck(); m_settingValue = false; }
private void OnCompanionChange(CompanionData previousCompanionData, CompanionData companionData, int index) { m_settingValue = true; m_value?.SetCompanionAt((companionData != null) ? companionData.definition.get_id() : (-1), index); m_saveButton.set_interactable(!DeckUtility.DecksAreEqual(m_value?.DeckInfo, m_uneditedValue?.DeckInfo)); UpdateInvalidDeck(); m_settingValue = false; }
private void OnCancel() { if (!m_inAnimation) { if (!m_selectedSlot.Preconstructed && !DeckUtility.DecksAreEqual(m_previousSlot?.DeckInfo, m_selectedSlot?.DeckInfo)) { OnSave(); } else { OnCancelConfirm(); } } }
private void OnCloneRequest(int titleid, int desc) { PopupInfo info; StateLayer val2 = default(StateLayer); if (DeckUtility.GetRemainingSlotsForWeapon(new DeckInfo(m_selectedSlot.DeckInfo).Weapon) > 0) { StateLayer val = default(StateLayer); if (StateManager.TryGetLayer("PlayerUI", ref val)) { ButtonData[] buttons = new ButtonData[2] { new ButtonData(48064, OnCloneConfirme), new ButtonData(26918, OnCloneCanceld) }; PopupInfoManager.ClearAllMessages(); StateContext chainEnd = val.GetChainEnd(); info = new PopupInfo { title = titleid, message = desc, buttons = buttons, selectedButton = 1, style = PopupStyle.Normal }; PopupInfoManager.Show(chainEnd, info); } } else if (StateManager.TryGetLayer("PlayerUI", ref val2)) { ButtonData[] buttons2 = new ButtonData[1] { new ButtonData(27169, OnCloneCanceld) }; PopupInfoManager.ClearAllMessages(); StateContext chainEnd2 = val2.GetChainEnd(); info = new PopupInfo { title = 4176, message = 52887, buttons = buttons2, selectedButton = 1, style = PopupStyle.Normal }; PopupInfoManager.Show(chainEnd2, info); } }
private void OnCloneConfirme() { if (DeckUtility.GetRemainingSlotsForWeapon(m_weapon) != 0) { m_selectedSlot = m_selectedSlot.Clone(keepPreconstructed: false); RuntimeData.TryGetText(92537, out string value); m_selectedSlot.SetName(value); m_previousSlot = null; m_selectedSlot.DeckInfo.Id = null; m_ui.interactable = true; DeckInfo obj = new DeckInfo(m_selectedSlot.DeckInfo) { Name = RuntimeData.FormattedText(92537), Id = null }; DeckInfo deckInfo = m_selectedSlot.DeckInfo.TrimCopy(); m_ui.OnCloneValidate(m_selectedSlot); m_frame.SendSaveSquadRequest(deckInfo.Id, deckInfo.Name, (Family)deckInfo.God, deckInfo.Weapon, (IReadOnlyList <int>)deckInfo.Companions, (IReadOnlyList <int>)deckInfo.Spells); } }
private IEnumerator HideAllEnumerator() { bool wasOpen = false; if (m_ui != null) { wasOpen = m_ui.IsOpen(); yield return(m_ui.GotoSelectMode()); } if (wasOpen && !m_safeExit && !DeckUtility.DecksAreEqual(m_previousSlot?.DeckInfo, m_selectedSlot?.DeckInfo)) { OnSaveConfirm(); } m_safeExit = false; if (wasOpen) { this.OnCloseComplete?.Invoke(); } RuntimeData.currentKeywordContext = KeywordContext.FightSolo; }
private void SetValueInternal(DeckSlot slot) { if (slot == null) { HideAll(); return; } if (!slot.HasDeckInfo) { HideAll(); return; } UpdateInvalidDeck(); DeckInfo deckInfo = slot.DeckInfo; bool editMode = m_editMode; if (!(m_nameTextField == null)) { m_nameTextField.get_gameObject().SetActive(editMode); m_nameTextField.SetText(deckInfo.Name.Substring(0, Math.Min(deckInfo.Name.Length, 30))); RepeatedField <int> companions = deckInfo.Companions; RepeatedField <int> spells = deckInfo.Spells; int level = deckInfo.GetLevel(PlayerData.instance.weaponInventory); m_spellList.SetValues((IList <int>)spells, level); m_companionList.SetValues((IList <int>)companions, level); if (m_value.Preconstructed) { ItemDragNDropListener.instance.OnDragEndSuccessful += OnRequestValidation; ItemDragNDropListener.instance.OnDragEnd += OnDragFail; } m_deleteButton.set_interactable(!slot.isAvailableEmptyDeckSlot && !slot.Preconstructed); m_cloneButton.set_interactable(!slot.isAvailableEmptyDeckSlot && DeckUtility.GetRemainingSlotsForWeapon(deckInfo.Weapon) > 0); if (m_editMode) { m_uneditedValue = m_value?.Clone(); m_saveButton.set_interactable(false); } } }
private void OnSave() { if (m_inAnimation) { return; } if (!m_selectedSlot.DeckInfo.IsValid() && m_wasValid) { ButtonData[] buttons = new ButtonData[2] { new ButtonData(75192, OnSaveConfirm), new ButtonData(38763) }; StateLayer val = default(StateLayer); if (StateManager.TryGetLayer("PlayerUI", ref val)) { PopupInfoManager.ClearAllMessages(); PopupInfoManager.Show(val.GetChainEnd(), new PopupInfo { title = 56031, message = 57158, buttons = buttons, selectedButton = 1, style = PopupStyle.Error }); } } else if (!DeckUtility.DecksAreEqual(m_previousSlot?.DeckInfo, m_selectedSlot?.DeckInfo)) { OnSaveConfirm(); } else { OnExit(); } }