Esempio n. 1
0
    void OnRotate(EventContext context)
    {
        GTween.Kill(_ball);

        RotationGesture gesture = (RotationGesture)context.sender;

        _ball.Rotate(Vector3.forward, -gesture.delta, Space.World);
    }
Esempio n. 2
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="pageIndex"></param>
    public void TurnTo(int pageIndex)
    {
        if (pageIndex < 0 || pageIndex > _pageCount - 1)
        {
            throw new Exception("Page index out of bounds: " + pageIndex);
        }

        GTween.Kill(this, true);

        if (_coverStatus == CoverStatus.ShowingFront)
        {
            _coverTurningOp = CoverTurningOp.HideFront;
            _draggingCorner = Corner.BR;
        }
        else if (_coverStatus == CoverStatus.ShowingBack)
        {
            _coverTurningOp = CoverTurningOp.HideBack;
            _draggingCorner = Corner.BL;
        }

        int tt1 = _currentPage;

        if (_currentPage % 2 == 0)
        {
            tt1--;
        }
        int tt2 = pageIndex;

        if (pageIndex % 2 == 0)
        {
            tt2--;
        }
        if (tt1 == tt2)
        {
            _currentPage   = pageIndex;
            _turningTarget = -1;
        }
        else
        {
            _turningTarget = pageIndex;
            if (_turningTarget < _currentPage)
            {
                _draggingCorner = Corner.BL;
            }
            else
            {
                _draggingCorner = Corner.BR;
            }
        }

        if (_draggingCorner == Corner.INVALID)
        {
            return;
        }

        StartTween();
    }
Esempio n. 3
0
    void OnPinch(EventContext context)
    {
        GTween.Kill(_ball);

        PinchGesture gesture  = (PinchGesture)context.sender;
        float        newValue = Mathf.Clamp(_ball.localScale.x + gesture.delta, 0.3f, 2);

        _ball.localScale = new Vector3(newValue, newValue, newValue);
    }
Esempio n. 4
0
 private void RefreshDataSelect()
 {
     _controlShop.ResetSelectItem();
     GTween.Kill(this);
     GTween.DelayedCall(0.02f).SetTarget(this).OnComplete(() =>
     {
         SetSelectItem(m_indextItemSeleted);
     });
 }
Esempio n. 5
0
 public void Cancel()
 {
     _owner = null;
     if (this.parent != null)
     {
         GTween.Kill(this);
         EmitManager.inst.view.RemoveChild(this);
     }
     EmitManager.inst.ReturnComponent(this);
 }
Esempio n. 6
0
 //打断动画进程 add by tianjinpeng 2018/03/14 10:33:03
 void killtweener(GTweener tweener)
 {
     if (tweener != null)
     {
         GTween.Kill(tweener);
         tweener = null;
     }
     else
     {
     }
 }
Esempio n. 7
0
    /// <summary>
    /// 缩放事件
    /// </summary>
    /// <param name="context"></param>
    void OnPinch(EventContext context)
    {
        //停止当前变化
        GTween.Kill(_ball);

        PinchGesture gesture = (PinchGesture)context.sender;
        //球的X轴缩放系数+ 手指改变量 限制在0.3-2之间, 改变球的XYZ缩放系数
        float newValue = Mathf.Clamp(_ball.localScale.x + gesture.delta, 0.3f, 2);

        _ball.localScale = new Vector3(newValue, newValue, newValue);
    }
Esempio n. 8
0
        public void Add(string iconurl, string nametext, string datacount)
        {
            CanToZero();
            float toy = 300f - ((tipsDatas.Count + 1) * 100f);

            newtipsData(iconurl, nametext, datacount);
            if (tweener != null)
            {
                GTween.Kill(tweener);
            }
            tweener = gList.TweenMoveY(toy, 0.3f);
        }
Esempio n. 9
0
 public void Show(bool withAnim = true)
 {
     ui.visible = true;
     if (choicebubbletweener != null)
     {
         GTween.Kill(choicebubbletweener);
     }
     choicebubbletweener = ui.TweenFade(1, 0.2f).OnComplete(() =>
     {
         choicebubbletweener = null;
     });
 }
Esempio n. 10
0
 public void Hide(bool withAnim = true)
 {
     if (choicebubbletweener != null)
     {
         GTween.Kill(choicebubbletweener);
     }
     choicebubbletweener = ui.TweenFade(0, 0.2f).OnComplete(() =>
     {
         ui.visible          = false;
         choicebubbletweener = null;
     });
 }
Esempio n. 11
0
 public void Movesize(GObject parent, GObject gameObject, Vector2 sd, Vector2 pos, float time)
 {
     parent.position = sd;
     parent.visible  = true;
     GTween.Kill(dosettw);
     GTween.Kill(movesizepar);
     dosettw     = parent.TweenResize(gameObject.size, time);
     movesizepar = parent.TweenMove(pos, time).OnComplete(() =>
     {
         gameObject.visible = true;
         parent.visible     = false;
     });
 }
Esempio n. 12
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="cover"></param>
    /// <param name="turnEffect"></param>
    public void ShowCover(CoverType cover, bool turnEffect)
    {
        GTween.Kill(this, true);

        if (_frontCover == null)
        {
            return;
        }

        if (turnEffect)
        {
            if (cover == CoverType.Front)
            {
                if (_coverStatus == CoverStatus.ShowingFront)
                {
                    return;
                }

                _coverTurningOp = CoverTurningOp.ShowFront;
                _draggingCorner = Corner.BL;
                _currentPage    = 0;
            }
            else
            {
                if (_coverStatus == CoverStatus.ShowingBack)
                {
                    return;
                }

                _coverTurningOp = CoverTurningOp.ShowBack;
                _draggingCorner = Corner.BR;
                _currentPage    = _pageCount - 1;
            }

            StartTween();
        }
        else
        {
            if (cover == CoverType.Front)
            {
                _currentPage = 0;
                _coverStatus = CoverStatus.ShowingFront;
            }
            else
            {
                _currentPage = _pageCount - 1;
                _coverStatus = CoverStatus.ShowingBack;
            }
            RenderPages();
        }
    }
Esempio n. 13
0
 public void Hide(bool withAnim = true)
 {
     if (withAnim)
     {
         if (gTweener_progressBar_fode != null)
         {
             GTween.Kill(gTweener_progressBar_fode);
         }
         gTweener_progressBar_fode = bosshpcomponent.TweenFade(0f, 0.7f).OnComplete(() =>
         {
             bosshpcomponent.visible   = false;
             gTweener_progressBar_fode = null;
         });
     }
     else
     {
         bosshpcomponent.visible = false;
     }
 }
    public void PlayEffect(float delay)
    {
        this.visible   = false;
        this.touchable = false;
        // this.x = this.parent.width;
        // _trans.Play(1, delay, onComplete);
        float xTo   = this.x;
        float xFrom = this.x + this.width + 200;

        this.x = xFrom;
        GTween.Kill(this);
        this.TweenMoveX(xTo, 0.4f).SetDelay(delay).SetEase(EaseType.QuadOut)
        .OnStart(() => {
            this.visible = true;
        })
        .OnComplete(() => {
            this.touchable = true;
        });
    }
 public void DownLine(int limit)
 {
     if (_lineIndex + limit < _textField.lines.Count)
     {
         var       line0 = _textField.lines[_lineIndex];
         var       line1 = _textField.lines[_lineIndex + limit];
         var       y0    = line0.y + line0.height;
         var       y1    = line1.y + line1.height;
         Container c     = _containerDownline;
         c.clipRect = new Rect(0, y0, c.width, y1 - y0);
         // c.y = _rectRaw.y - y0;
         GTween.Kill(this);
         GTween.To(c.y, _rectRaw.y - y0, 0.05f).SetTarget(this).SetEase(EaseType.Linear).OnUpdate(
             (GTweener tweener) => {
             c.y = tweener.value.x;
         }
             );
         _lineIndex++;
     }
 }
Esempio n. 16
0
    /// <summary>
    ///
    /// </summary>
    public void TurnPrevious()
    {
        GTween.Kill(this, true);

        if (isCoverShowing(CoverType.Back))
        {
            TurnTo(_pageCount - 1);
        }
        else if (_currentPage == 0)
        {
            ShowCover(CoverType.Front, true);
        }
        else if (_currentPage % 2 == 0)
        {
            TurnTo(_currentPage - 2);
        }
        else
        {
            TurnTo(_currentPage - 1);
        }
    }
Esempio n. 17
0
    /// <summary>
    ///
    /// </summary>
    public void TurnNext()
    {
        GTween.Kill(this, true);

        if (isCoverShowing(CoverType.Front))
        {
            TurnTo(0);
        }
        else if (_currentPage == _pageCount - 1)
        {
            ShowCover(CoverType.Back, true);
        }
        else if (_currentPage % 2 == 0)
        {
            TurnTo(_currentPage + 1);
        }
        else
        {
            TurnTo(_currentPage + 2);
        }
    }
Esempio n. 18
0
 void killtweener(GTweener kill, GTweener newfsf, GObject parent, bool onoff)
 {
     if (kill != null)
     {
         GTween.Kill(kill);
         kill = newfsf;
     }
     else
     {
         kill = newfsf;
     }
     newfsf.OnComplete(() =>
     {
         if (onoff)
         {
         }
         else
         {
             parent.visible = false;
         }
     });
 }
    public void MoveCamTo(float _camXAngle_to, float _y_to, float _distance_to, Vector3 _target_to, GTweenCallback _onComplete)
    {
        float   _camXAngle_from = camXAngle;
        float   _camXAngle_a    = _camXAngle_to - _camXAngle_from;
        float   _y_from         = yCam;
        float   _y_a            = _y_to - _y_from;
        float   _distance_from  = distance;
        float   _distance_a     = _distance_to - _distance_from;
        float   _targetHeight   = targetHeight;
        Vector3 _target_from    = targetPos;

        target = null;
        GTween.Kill(this);
        // Debug.Log("_target_from: " + _target_from.ToString());
        // Debug.Log("_target_to: " + _target_to.ToString());
        GTween.To(0.0f, 1.0f, 1.0f).SetTarget(this).SetEase(EaseType.Linear).OnUpdate(
            (GTweener tweener) => {
            float mu = tweener.value.x;
            if (mu >= 1)
            {
                mu = 1;
            }
            float _camXAngle = _camXAngle_from + _camXAngle_a * mu;
            float _y         = _y_from + _y_a * mu;
            float _distance  = _distance_from + _distance_a * mu;
            Vector3 _target  = Vector3.Lerp(_target_from, _target_to, mu);
            ForceSetCam(_camXAngle, _y, _distance, _target, _targetHeight);
        }
            ).OnComplete(() => {
            ForceSetCam(_camXAngle_to, _y_to, _distance_to, _target_to, _targetHeight);
            if (_onComplete != null)
            {
                _onComplete();
            }
        });
    }
Esempio n. 20
0
    void __touchBegin(EventContext context)
    {
        GTween.Kill(this, true);

        _draggingCorner = (Corner)((GObject)context.sender).data;
        if (_draggingCorner == Corner.TL || _draggingCorner == Corner.BL)
        {
            if (_coverStatus == CoverStatus.ShowingBack)
            {
                _coverTurningOp = CoverTurningOp.HideBack;
            }
            else if (_objectNewIndice[0] == -1)
            {
                if (_frontCover != null && _coverStatus != CoverStatus.ShowingFront)
                {
                    _coverTurningOp = CoverTurningOp.ShowFront;
                }
                else
                {
                    _draggingCorner = Corner.INVALID;
                }
            }
            else
            {
                _turningTarget = _objectNewIndice[0] - 2;
                if (_turningTarget < 0)
                {
                    _turningTarget = 0;
                }
            }
        }
        else
        {
            if (_coverStatus == CoverStatus.ShowingFront)
            {
                _coverTurningOp = CoverTurningOp.HideFront;
            }
            else if (_objectNewIndice[1] == -1)
            {
                if (_backCover != null && _coverStatus != CoverStatus.ShowingBack)
                {
                    _coverTurningOp = CoverTurningOp.ShowBack;
                }
                else
                {
                    _draggingCorner = Corner.INVALID;
                }
            }
            else
            {
                _turningTarget = _objectNewIndice[1] + 1;
            }
        }

        if (_draggingCorner != Corner.INVALID)
        {
            _touchDownTime = Time.unscaledTime;
            UpdateDragPosition(context.inputEvent.position);
            RenderPages();
            PlayTurnEffect();

            context.CaptureTouch();
        }
    }