private void Update()
 {
     Debug.Log(EventSystem.current.currentSelectedGameObject);
     if ((transform.gameObject.activeSelf) && EventSystem.current.currentSelectedGameObject != null)
     {
         Vector3 newPosition = scrollRect.GetSnapToPositionToBringChildIntoView(EventSystem.current.currentSelectedGameObject.GetComponent <RectTransform>());
         scrollRect.content.localPosition = Vector3.Lerp(scrollRect.content.localPosition, newPosition, Time.deltaTime * 2.0f);
     }
 }
예제 #2
0
 private void Update()
 {
     if (selectedTransform)
     {
         scrollRect.content.localPosition = scrollRect.GetSnapToPositionToBringChildIntoView(selectedTransform);
     }
     else
     {
         scrollRect.content.localPosition = Vector3.zero;
     }
 }
예제 #3
0
 public void ReactToItemHover(ItemPane itemPane)
 {
     if (selectSound != null)
     {
         SoundManager.UISound(selectSound);
     }
     scrollView.content.localPosition = new Vector2(
         scrollView.content.localPosition.x,
         scrollView.GetSnapToPositionToBringChildIntoView(itemPane.GetComponent <RectTransform>()).y
         );
     ShowItemInfo(itemPane.storedItem);
 }
예제 #4
0
    public void Select(RectTransform target)
    {
        if (this.target)
        {
            this.target.localScale = scale;
        }

        this.target            = target;
        this.target.localScale = scale * selectScale;

        targetPos = scrollRect.GetSnapToPositionToBringChildIntoView(target);
    }
예제 #5
0
    protected override void Start()
    {
        base.Start();
        back.onClick.AddListener(MainUi.ShowMain);

        CurrentPageState
        .Where(state => state == PageState.Open)
        .Select(state => RxExtensions.FromAsync(CreateViews))
        .Switch()
        .CombineWithPrevious((previous, next) => (previous, next))
        .Select(combination => OnChangeLevelViews(combination.previous, combination.next))
        .Select(icon => RxExtensions.FromAsync(async token =>
        {
            if (icon != default)
            {
                await scrollRect
                .GetSnapToPositionToBringChildIntoView(icon.RectTransform, 0.6f)
                .ToUniTask(cancellationToken: token);
            }
        }))
        .Switch()
        .Subscribe()
        .AddTo(this);
    }
예제 #6
0
 public void ReactToItemHover(ItemPane itemPane)
 {
     audioSource.PlayOneShot(audioSource.clip);
     scrollView.content.localPosition = scrollView.GetSnapToPositionToBringChildIntoView(itemPane.GetComponent <RectTransform>());
     ShowItemInfo(itemPane.inventoryItem);
 }
예제 #7
0
 public void SnapTo(RectTransform target)
 {
     scrollView.content.localPosition = scrollView.GetSnapToPositionToBringChildIntoView(target);
 }
 public virtual void OnSelect(BaseEventData eventData)
 {
     scrollParent.content.localPosition = scrollParent.GetSnapToPositionToBringChildIntoView(transform);
 }