void Update()
    {
        Vector3 worldToLocal = myUIScreen.transform.worldToLocalMatrix * transform.position;

        distanceFromCenter = worldToLocal.x;
        if (Mathf.Abs(distanceFromCenter) < distanceBetweenItems)
        {
            if (currentState == ItemState.NotSelected)
            {
                currentState = ItemState.Selected;
                OnItemSelect?.Invoke();
            }
        }
        else
        {
            if (currentState == ItemState.Selected)
            {
                currentState     = ItemState.NotSelected;
                stateWhenPressed = currentState;
                OnItemDeselect?.Invoke();
            }
        }

        if (isPressed)
        {
            pressedTimer += Time.deltaTime;
            if (pressedTimer >= pressedTime)
            {
                ItemSelectPivotRelease();
            }
        }
    }
Exemplo n.º 2
0
 public virtual void Select(int i)
 {
     if (!Map)
     {
         return;
     }
     SelectedGroupIndex = i;
     OnItemSelect?.Invoke(Map.Groups[i]);
 }
Exemplo n.º 3
0
        void HandleDeleteGroup(int index)
        {
            if (Map.Groups.Count > 0)
            {
                int selectIndex = Mathf.Max(0, index - 1);
                Select(selectIndex);
                if (Map.defaultGroup == index)
                {
                    SetAsDefault(selectIndex);
                }
                return;
            }

            OnItemSelect?.Invoke(null);
        }
        private async Task ItemSelected(TModel item)
        {
            // Reset term
            Term = string.Empty;

            // Change state
            _listVisible = false;

            // Add to selected items
            Selected ??= new List <TModel>();
            if (!Multiselect)
            {
                Selected.Clear();
            }
            Selected.Add(item);

            // Invoke events
            await SelectedChanged.InvokeAsync(Selected);

            await OnItemSelect.InvokeAsync(item);
        }
Exemplo n.º 5
0
        public override void ProcessControls()
        {
            if (!Focused)
            {
                return;
            }
            if (Heists.Count == 0)
            {
                return;
            }
            if (JustOpened)
            {
                JustOpened = false;
                return;
            }

            if (Game.IsControlJustPressed(0, Control.PhoneSelect))
            {
                PlaySoundFrontend(-1, "SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET", true);
                OnItemSelect?.Invoke(Heists[Index]);
            }

            if (Game.IsControlJustPressed(0, Control.FrontendUp) || Game.IsControlJustPressed(0, Control.MoveUpOnly))
            {
                Index = (1000 - (1000 % Heists.Count) + Index - 1) % Heists.Count;
                PlaySoundFrontend(-1, "NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET", true);

                if (Heists.Count <= MaxItemsPerView)
                {
                    return;
                }

                if (Index < _minItem)
                {
                    _minItem--;
                    _maxItem--;
                }

                if (Index == Heists.Count - 1)
                {
                    _minItem = Heists.Count - MaxItemsPerView;
                    _maxItem = Heists.Count;
                }
            }

            else if (Game.IsControlJustPressed(0, Control.FrontendDown) || Game.IsControlJustPressed(0, Control.MoveDownOnly))
            {
                Index = (1000 - (1000 % Heists.Count) + Index + 1) % Heists.Count;
                PlaySoundFrontend(-1, "NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET", true);

                if (Heists.Count <= MaxItemsPerView)
                {
                    return;
                }

                if (Index >= _maxItem)
                {
                    _maxItem++;
                    _minItem++;
                }

                if (Index == 0)
                {
                    _minItem = 0;
                    _maxItem = MaxItemsPerView;
                }
            }
        }
Exemplo n.º 6
0
        public override void ProcessControls()
        {
            if (!Focused || Heists.Count == 0)
            {
                return;
            }
            if (JustOpened)
            {
                JustOpened = false;
                return;
            }

            if (Common.IsDisabledControlJustPressed(0, GameControl.CellphoneSelect))
            {
                NativeFunction.CallByName <uint>("PLAY_SOUND_FRONTEND", -1, "SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET", 1);
                OnItemSelect?.Invoke(Heists[Index]);
            }

            if (Common.IsDisabledControlJustPressed(0, GameControl.FrontendUp) || Common.IsDisabledControlJustPressed(0, GameControl.MoveUpOnly))
            {
                Index = (1000 - (1000 % Heists.Count) + Index - 1) % Heists.Count;
                NativeFunction.CallByName <uint>("PLAY_SOUND_FRONTEND", -1, "NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET", 1);

                if (Heists.Count <= MaxItemsPerView)
                {
                    return;
                }

                if (Index < _minItem)
                {
                    _minItem--;
                    _maxItem--;
                }

                if (Index == Heists.Count - 1)
                {
                    _minItem = Heists.Count - MaxItemsPerView;
                    _maxItem = Heists.Count;
                }
            }

            else if (Common.IsDisabledControlJustPressed(0, GameControl.FrontendDown) || Common.IsDisabledControlJustPressed(0, GameControl.MoveDownOnly))
            {
                Index = (1000 - (1000 % Heists.Count) + Index + 1) % Heists.Count;
                NativeFunction.CallByName <uint>("PLAY_SOUND_FRONTEND", -1, "NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET", 1);

                if (Heists.Count <= MaxItemsPerView)
                {
                    return;
                }

                if (Index >= _maxItem)
                {
                    _maxItem++;
                    _minItem++;
                }

                if (Index == 0)
                {
                    _minItem = 0;
                    _maxItem = MaxItemsPerView;
                }
            }
        }
Exemplo n.º 7
0
 protected virtual void ItemSelectedEvent(string name, int index)
 {
     OnItemSelect.Invoke(name, index);
 }
Exemplo n.º 8
0
 public override void ItemSelected(UICollectionView collectionView, NSIndexPath indexPath)
 {
     OnItemSelect?.Invoke(collectionView, _fullImageUrlsList);
 }
Exemplo n.º 9
0
 /// <summary>
 /// The OnItemSelectEvent.
 /// </summary>
 /// <param name="sender">The sender<see cref="object"/>.</param>
 /// <param name="args">The args<see cref="XFItemClickEventArgs"/>.</param>
 internal void OnItemSelectEvent(object sender, XFItemClickEventArgs args)
 {
     OnItemSelect?.Invoke(sender, args);
 }