コード例 #1
0
        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);
            }
        }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
        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);
                }
            }
        }