Exemplo n.º 1
0
    protected override void Awake()
    {
        base.Awake();
        actualIndex              = startingIndex;
        cellIndex                = startingIndex;
        this.onLerpComplete      = new OnLerpCompleteEvent();
        this.onRelease           = new OnReleaseEvent();
        this.scrollRect          = GetComponent <ScrollRect>();
        this.canvasGroup         = GetComponent <CanvasGroup>();
        this.content             = scrollRect.content;
        this.cellSize            = content.GetComponent <GridLayoutGroup>().cellSize;
        content.anchoredPosition = new Vector2(-cellSize.x * cellIndex, content.anchoredPosition.y);
        int count = LayoutElementCount();

        SetContentSize(count);

        pieCharts        = new List <PieChart>();
        filePaths        = new List <String>();
        sleepDatas       = new List <List <SleepData> >();
        sleepHeaderDatas = new List <SleepHeaderData>();

        if (startingIndex < count)
        {
            MoveToIndex(startingIndex);
        }
    }
Exemplo n.º 2
0
    protected override void Awake()
    {
        base.Awake();
        actualIndex              = startingIndex;
        cellIndex                = startingIndex;
        this.onLerpComplete      = new OnLerpCompleteEvent();
        this.onRelease           = new OnReleaseEvent();
        this.scrollRect          = GetComponent <ScrollRect>();
        this.canvasGroup         = GetComponent <CanvasGroup>();
        this.content             = scrollRect.content;
        this.cellSize            = content.GetComponent <GridLayoutGroup>().cellSize;
        content.anchoredPosition = new Vector2(-cellSize.x * cellIndex, content.anchoredPosition.y);
        int count = LayoutElementCount();

        //Debug.Log(""+count);
        //int count = 8;

        SetContentSize(count);

        if (startingIndex < count)
        {
            MoveToIndex(startingIndex);
        }

        soundManager = GameObject.Find("SoundManager").GetComponent <SoundManager>();
    }
Exemplo n.º 3
0
        private void _Apportion(ClientToServerOpCode code, byte[] args)
        {
            switch (code)
            {
            case ClientToServerOpCode.Ping:
                OnPingEvent?.Invoke();
                break;

            case ClientToServerOpCode.CallMethod:
            {
                var pkg = args.ToPackageData <PackageCallMethod>(_Serializer);

                OnCallMethodEvent?.Invoke(pkg.EntityId, pkg.MethodId, pkg.ReturnId, pkg.MethodParams);
            }

            break;

            case ClientToServerOpCode.Release:
            {
                var pkg = args.ToPackageData <PackageRelease>(_Serializer);

                OnReleaseEvent?.Invoke(pkg.EntityId);
            }

            break;

            default:
                throw new ArgumentOutOfRangeException(nameof(code), code, null);
            }
        }
Exemplo n.º 4
0
 public void OnPointerUp(PointerEventData eventData)
 {
     if (imageSwap != null)
     {
         image.sprite = imageOrig;
     }
     OnReleaseEvent?.Invoke();
     OnChangeEvent?.Invoke(false);
 }
Exemplo n.º 5
0
    private void OnRelease(InputAction.CallbackContext callbackContext)
    {
        if (IsInputNotValidState())
        {
            return;
        }

        isPress = false;
        OnReleaseEvent?.Invoke();

#if DEBUGGING
        Debug.Log("Release");
#endif
    }
Exemplo n.º 6
0
        public void Update()
        {
            var touching = BaseInput.IsTouching();

            if (touching && !WasTouching)
            {
                StartCoroutine(StartTap());
            }

            if (!touching && Tapping)
            {
                Tapping = false;
                OnReleaseEvent.Invoke();
            }
            WasTouching = touching;
        }
Exemplo n.º 7
0
        protected override void Awake()
        {
            base.Awake();
            actualIndex         = startingIndex;
            cellIndex           = startingIndex;
            this.onLerpComplete = new OnLerpCompleteEvent();
            this.onRelease      = new OnReleaseEvent();
            this.scrollRect     = GetComponent <ScrollRect>();
            this.content        = scrollRect.content;

            //this.cellSize = new Vector2(content.sizeDelta.x * content.localScale.x,content.sizeDelta.y * content.localScale.y);
            //content.anchoredPosition = new Vector2(-elementInScroll.rect.width * cellIndex, content.anchoredPosition.y);
            //int count = LayoutElementCount();
            //SetContentSize(count);

            //if(startingIndex < count) {
            //	MoveToIndex(startingIndex);
            //}
        }
Exemplo n.º 8
0
        public void Update()
        {
            var touching = BaseInput.IsTouching(true);

            if (touching)
            {
                var touch0Position = BaseInput.GetTouchPosition(0).y;
                var touch1Position = BaseInput.GetTouchPosition(1).y;
                var position       = (touch0Position + touch1Position) * 0.5f;

                if (!Panning)
                {
                    if (!WasTouching)
                    {
                        LastPosition = position;
                    }

                    var delta = Mathf.Abs(position - LastPosition);

                    if (!Rotating && delta >= Threshold)
                    {
                        LastPosition = position;
                        Panning      = true;
                    }
                }
                if (Panning)
                {
                    var delta = position - LastPosition;
                    OnDragEvent.Invoke(Vector3.up * (delta * Ratio));

                    LastPosition = position;
                }
            }

            if (!touching && Panning)
            {
                Panning = false;
                OnReleaseEvent.Invoke();
            }

            WasTouching = touching;
        }
Exemplo n.º 9
0
        public void Update()
        {
            var touching = BaseInput.IsTouching(true);

            if (touching)
            {
                var touch0Position = BaseInput.GetTouchPosition(0);
                var touch1Position = BaseInput.GetTouchPosition(1);
                var angle          = CalculateAngle(touch0Position, touch1Position);

                if (!Rotating)
                {
                    if (!WasTouching)
                    {
                        LastAngle = angle;
                    }

                    var delta = angle - LastAngle;
                    if (!Panning && Mathf.Abs(delta) >= Threshold)
                    {
                        LastAngle = angle;
                        Rotating  = true;
                    }
                }
                if (Rotating)
                {
                    var delta = angle - LastAngle;
                    OnRotationEvent.Invoke(delta);

                    LastAngle = angle;
                }
            }

            if (!touching && Rotating)
            {
                Rotating = false;
                OnReleaseEvent.Invoke();
            }

            WasTouching = touching;
        }
Exemplo n.º 10
0
    protected override void Awake()
    {
        base.Awake();
        actualIndex              = startingIndex;
        cellIndex                = startingIndex;
        onLerpComplete           = new OnLerpCompleteEvent();
        onRelease                = new OnReleaseEvent();
        scrollRect               = GetComponent <ScrollRect>();
        canvasGroup              = GetComponent <CanvasGroup>();
        content                  = scrollRect.content;
        cellSize                 = content.GetComponent <GridLayoutGroup>().cellSize;
        content.anchoredPosition = new Vector2(-cellSize.x * cellIndex, content.anchoredPosition.y);
        int count = LayoutElementCount();

        SetContentSize(count);

        if (startingIndex < count)
        {
            MoveToIndex(startingIndex);
        }
    }
Exemplo n.º 11
0
    public void reCalculateEverything()
    {
        actualIndex              = startingIndex;
        cellIndex                = startingIndex;
        this.onLerpComplete      = new OnLerpCompleteEvent();
        this.onRelease           = new OnReleaseEvent();
        this.scrollRect          = GetComponent <ScrollRect>();
        this.canvasGroup         = GetComponent <CanvasGroup>();
        this.content             = scrollRect.content;
        this.cellSize            = content.GetComponent <GridLayoutGroup>().cellSize;
        content.anchoredPosition = new Vector2(-cellSize.x * cellIndex, content.anchoredPosition.y);
        //int count = LayoutElementCount();

        //int count = 8;

        SetContentSize(numberOfPages);

        if (startingIndex < numberOfPages)
        {
            MoveToIndex(startingIndex);
        }
    }
        /// <summary>
        /// release all selected object and put them back to their original structure
        /// </summary>
        public void Release()
        {
            Node[] selectedArray = SelectedNodes.ToArray();
            for (int i = 0; i < selectedArray.Length; i++)
            {
                /*if (selectedArray[i].OnReleaseEvent != null)
                 * {
                 *  SelectedNodes[i].OnReleaseEvent.Invoke();
                 * }*/
                if (OnReleaseEvent != null)
                {
                    OnReleaseEvent.Invoke(selectedArray[i]);
                }

                if (selectedArray [i].Childs.Count > 0)
                {
                    foreach (var child in selectedArray[i].Childs)
                    {
                        child.GameObject.transform.SetParent(selectedArray [i].GameObject.transform);
                    }
                }

                if (selectedArray [i].Parent == null)
                {
                    selectedArray [i].GameObject.transform.SetParent(this.transform);
                }
                else
                {
                    selectedArray [i].GameObject.transform.SetParent(selectedArray [i].Parent.GameObject.transform);
                }

                if (SnapParts)
                {
                    Snap(selectedArray [i]);
                }
            }
        }
Exemplo n.º 13
0
 public static void OnRelease(MouseClickEventArgs e)
 {
     OnReleaseEvent?.Invoke(e);
 }