Beispiel #1
0
        protected override void OnConfirm()
        {
            if (SelectionType == EntitySelectionType.Single || SelectionType == EntitySelectionType.First)
            {
                Selection?.Invoke(Targets[CurSelection]);
            }
            else if (SelectionType == EntitySelectionType.All)
            {
                Selection?.Invoke(Targets);
            }

            EndSelection();
        }
Beispiel #2
0
        protected override void OnConfirm()
        {
            if (SelectionType == EntitySelectionType.Single || SelectionType == EntitySelectionType.First)
            {
                Selection?.Invoke(Targets[CurSelection]);
            }
            else if (SelectionType == EntitySelectionType.All)
            {
                Selection?.Invoke(Targets);
            }

            SoundManager.Instance.PlaySound(SoundManager.Sound.MenuSelect);

            EndSelection();
        }
Beispiel #3
0
 private void FireOnSelection(Campaign campaign, Mod mod)
 {
     if (OnSelection != null)
     {
         OnSelection.Invoke(this, new CampaignEventArgs(campaign, mod));
     }
 }
    public void SetSpell(int spellID)
    {
        if (!usedSpells.ContainsKey(spellID))
        {
            GameObject    spellPrefab = SpellManager.instance.createSpell(transform, spellID);
            SpellBehavior spell       = spellPrefab.GetComponent <SpellBehavior>();
            spellRack.Add(spell);
            usedSpells[spellID]  = spell;
            spellStatus[spellID] = true;
        }
        else
        {
            if (!spellStatus[spellID])
            {
                spellRack.Add(usedSpells[spellID]);
                spellStatus[spellID] = true;
            }
        }

        if (!hasSpell)
        {
            hasSpell = true;
            selected = spellRack[0];
            OnSelection?.Invoke(selected);
        }
    }
        private void BtnSfoglia_MouseUp(object sender, MouseButtonEventArgs e)
        {
            switch (SelectorType)
            {
            case SelectorType.File:
                DialogUtils.File(x => {
                    if (!string.IsNullOrEmpty(x))
                    {
                        txtFilePath.Text = x;
                        OnSelection?.Invoke(x);
                    }
                });
                break;

            case SelectorType.Folder:
                DialogUtils.Folder(x => {
                    if (!string.IsNullOrEmpty(x))
                    {
                        txtFilePath.Text = x;
                        OnSelection?.Invoke(x);
                    }
                });
                break;

            default:
                break;
            }
        }
Beispiel #6
0
 /// <summary>
 /// Method called when the device has recognized a tap event
 /// </summary>
 /// <param name="args"></param>
 private void OnTap(TappedEventArgs args)
 {
     if (!gameObject.activeInHierarchy)
     {
         return;
     }
     OnSelection?.Invoke(this);
 }
 /// <summary>
 /// Invokes selection of specified dropdown data.
 /// </summary>
 public void SelectData(DropdownData data)
 {
     if (IsSelectionMenu)
     {
         Selection = data;
     }
     OnSelection?.Invoke(data);
 }
Beispiel #8
0
 public void Select()
 {
     if (IsSelected)
     {
         throw new Selectable.AlreadySelectedException();
     }
     IsSelected = true;
     OnSelection?.Invoke();
 }
 public void SelectSpell(int index)
 {
     if (spellRack.Count > 0)
     {
         Debug.Log("scrolled");
         int realIndex = (index + spellRack.Count) % spellRack.Count;
         selected = spellRack[realIndex];
         OnSelection?.Invoke(selected);
     }
 }
Beispiel #10
0
        private void Select(int selected)
        {
            int i = 0;

            foreach (var btn in Btns)
            {
                btn.Outlined = (i++) == selected;
            }
            OnSelection?.Invoke(selected);
        }
Beispiel #11
0
        private async void btnSelectWithoutFirst_Click(object sender, EventArgs e)
        {
            ToggleButtons();
            lblStatus.Text = "Fetching...";
            var selectionResult = await IsolationManager.FetchMembersWithoutFirst();

            OnSelection?.Invoke(selectionResult);
            lblStatus.Text = "Fetching Done";
            ToggleButtons();
        }
        private void OnSelectionChange(DisplayCase _previousDisplay, DisplayCase _currentDisplay)
        {
            onSelection?.Invoke(this);

            startPosition        = transform.position;
            endPosition          = new Vector3(staggerDisplayOffset.x * (displayCaseSelector.GetCurrentIndex() * -1), startPosition.y, startPosition.z);
            totalAccumulatedTime = 0;

            isRunning = true;
            onDisplayChange?.Invoke(_previousDisplay, _currentDisplay);
        }
Beispiel #13
0
 private void OnTap(TappedEventArgs args)
 {
     if (!gameObject.activeInHierarchy)
     {
         return;
     }
     if (!m_isHandDetected)
     {
         args.sourcePose.TryGetPosition(out m_handPosition);
     }
     OnSelection?.Invoke(this);
 }
Beispiel #14
0
        private void Selections_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (Selections == null)
            {
                ResultPanel.Children.Clear();
            }

            var hasChanged = CheckItemsHasChanged(e);

            if (hasChanged)
            {
                OnSelection?.Invoke(Selections);
            }
        }
 private void AutoList_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (autoList.SelectedIndex <= -1)
     {
         CloseAutoSuggestionBox();
     }
     else
     {
         CloseAutoSuggestionBox();
         //Those are used for searching only so clear the text
         OnSelection.Invoke(this, autoList.SelectedItem.ToString());
         autoTextBox.Text       = null; //autoList.SelectedItem.ToString();
         autoList.SelectedIndex = -1;
     }
 }
 private void Initialize()
 {
     if (spellPrefabs.Length > 0)
     {
         foreach (GameObject go in spellPrefabs)
         {
             GameObject    prefab = Instantiate(go, transform);
             SpellBehavior spell  = prefab.GetComponent <SpellBehavior>();
             spellRack.Add(spell);
             usedSpells[spell.spellStats.spellID]  = spell;
             spellStatus[spell.spellStats.spellID] = true;
         }
         hasSpell = true;
         selected = spellRack[0];
         OnSelection?.Invoke(selected);
     }
 }
Beispiel #17
0
    public void Setup(Transform[] selectables)
    {
        this.selectables = selectables;

        Vector2 startPosition = transform.position;

        for (int i = 0; i < selectables.Length; i++)
        {
            Vector2 position = startPosition + Vector2.right * spacing * i;
            selectables[i].position = position;
            selectables[i].SetParent(transform);
        }

        transform.position = Vector2.right * (selectables.Length - 1) / 2;

        OnSelection?.Invoke();
        isSelection = true;
    }
        public UICutawayPanel(int cut)
        {
            BgAnim = 0;
            var ui = Content.Get().CustomUI;

            Background = ui.Get("cut_bg.png").Get(GameFacade.GraphicsDevice);

            DownButton                = new UIStencilButton(ui.Get("cut_stencil_down.png").Get(GameFacade.GraphicsDevice));
            DownButton.Position       = new Vector2(12, 64);
            DownButton.Selected       = (cut == 0);
            DownButton.OnButtonClick += (b) => { OnSelection?.Invoke(0); };
            Add(DownButton);
            CutButton                = new UIStencilButton(ui.Get("cut_stencil_away.png").Get(GameFacade.GraphicsDevice));
            CutButton.Position       = new Vector2(8, 128);
            CutButton.Selected       = (cut == 1);
            CutButton.OnButtonClick += (b) => { OnSelection?.Invoke(1); };
            Add(CutButton);
            UpButton = new UIStencilButton(ui.Get("cut_stencil_up.png").Get(GameFacade.GraphicsDevice));
            UpButton.OnButtonClick += (b) => { OnSelection?.Invoke(2); };
            UpButton.Selected       = (cut == 2);
            UpButton.Position       = new Vector2(24, 196);
            Add(UpButton);
            RoofButton = new UIStencilButton(ui.Get("cut_stencil_roof.png").Get(GameFacade.GraphicsDevice));
            RoofButton.OnButtonClick += (b) => { OnSelection?.Invoke(3); };
            RoofButton.Selected       = (cut == 3);
            RoofButton.Position       = new Vector2(54, 254);
            Add(RoofButton);

            Opacity = 0f;
            GameFacade.Screens.Tween.To(this, 0.3f, new Dictionary <string, float>()
            {
                { "Opacity", 1f }, { "BgAnim", 1f }
            }, TweenQuad.EaseOut);
            foreach (var child in Children)
            {
                ((UIStencilButton)child).Alpha = 0f;
                ((UIStencilButton)child).InflateHitbox(25, 5);
                GameFacade.Screens.Tween.To(child, 0.3f, new Dictionary <string, float>()
                {
                    { "Alpha", 1f }
                }, TweenQuad.EaseOut);
            }
        }
 public void RemoveSpell(int id)
 {
     if (hasSpell)
     {
         if (spellStatus.ContainsKey(id) && spellStatus[id])
         {
             spellRack.Remove(usedSpells[id]);
             spellStatus[id] = false;
             if (selected.spellStats.spellID == id)
             {
                 selected = null;
             }
         }
         if (spellRack.Count < 1)
         {
             hasSpell = false;
             selected = null;
         }
         OnSelection?.Invoke(selected);
     }
 }
 public override void Select(IEnumerable <Tag> tags)
 => OnSelection?.Invoke(this, tags);
Beispiel #21
0
 public void OnMouseLeftDownAction()
 {
     OnSelection?.Invoke(this);
 }