Ejemplo n.º 1
0
 public override bool Start(GameObject sub, AnimParams parms)
 {
     if (sub == null)
     {
         return(false);
     }
     if (sub.renderer == null)
     {
         return(false);
     }
     if (sub.renderer.material == null)
     {
         return(false);
     }
     this.pingPong        = parms.pingPong;
     this.restartOnRepeat = parms.restartOnRepeat;
     this.repeatDelay     = parms.repeatDelay;
     if (parms.mode == EZAnimation.ANIM_MODE.FromTo)
     {
         this.Start(sub.renderer.material, parms.mode, parms.color, parms.color2, EZAnimation.GetInterpolator(parms.easing), parms.duration, parms.delay, null, new EZAnimation.CompletionDelegate(parms.transition.OnAnimEnd));
     }
     else
     {
         this.Start(sub.renderer.material, parms.mode, sub.renderer.material.color, parms.color, EZAnimation.GetInterpolator(parms.easing), parms.duration, parms.delay, null, new EZAnimation.CompletionDelegate(parms.transition.OnAnimEnd));
     }
     return(true);
 }
Ejemplo n.º 2
0
    IEnumerator DoCoroutineAffector()
    {
        _mGameObjectList[0].SetActiveRecursively(true);
        yield return(new WaitForSeconds(0.3f));

        _mGameObjectList[1].SetActiveRecursively(true);
        yield return(new WaitForSeconds(0.3f));

        _mGameObjectList[2].SetActiveRecursively(true);
        _mGameObjectList[3].SetActiveRecursively(true);
        yield return(new WaitForSeconds(0.3f));

        foreach (GameObject go in _mGameObjectList)
        {
            AnimatePosition.Do(go, EZAnimation.ANIM_MODE.To, _mDestPosition,
                               EZAnimation.GetInterpolator(EZAnimation.EASING_TYPE.Linear), 1.0f, 0,
                               EZAnimationStart, EZAnimationEnd);

            AnimateScale.Do(go, EZAnimation.ANIM_MODE.To, _mScale,
                            EZAnimation.GetInterpolator(EZAnimation.EASING_TYPE.Linear), 1.0f, 0,
                            EZAnimationStart, EZAnimationEnd);
        }
    }
 public override bool Start(GameObject sub, AnimParams parms)
 {
     if (sub == null)
     {
         return(false);
     }
     this.sprite = (SpriteRoot)sub.GetComponent(typeof(SpriteRoot));
     if (this.sprite == null)
     {
         return(false);
     }
     this.pingPong        = parms.pingPong;
     this.restartOnRepeat = parms.restartOnRepeat;
     this.repeatDelay     = parms.repeatDelay;
     if (parms.mode == EZAnimation.ANIM_MODE.FromTo)
     {
         this.Start(this.sprite, parms.mode, parms.color, parms.color2, EZAnimation.GetInterpolator(parms.easing), parms.duration, parms.delay, null, new EZAnimation.CompletionDelegate(parms.transition.OnAnimEnd));
     }
     else
     {
         this.Start(this.sprite, parms.mode, this.sprite.color, parms.color, EZAnimation.GetInterpolator(parms.easing), parms.duration, parms.delay, null, new EZAnimation.CompletionDelegate(parms.transition.OnAnimEnd));
     }
     return(true);
 }
 public override bool Start(GameObject sub, AnimParams parms)
 {
     if (sub == null)
     {
         return(false);
     }
     this.subject = (AudioSource)sub.GetComponent(typeof(AudioSource));
     if (this.subject == null)
     {
         return(false);
     }
     this.pingPong        = parms.pingPong;
     this.restartOnRepeat = parms.restartOnRepeat;
     this.repeatDelay     = parms.repeatDelay;
     if (parms.mode == EZAnimation.ANIM_MODE.FromTo)
     {
         this.Start(this.subject, parms.mode, parms.floatVal, parms.floatVal2, EZAnimation.GetInterpolator(parms.easing), parms.duration, parms.delay, null, new EZAnimation.CompletionDelegate(parms.transition.OnAnimEnd));
     }
     else
     {
         this.Start(this.subject, parms.mode, this.subject.pitch, parms.floatVal, EZAnimation.GetInterpolator(parms.easing), parms.duration, parms.delay, null, new EZAnimation.CompletionDelegate(parms.transition.OnAnimEnd));
     }
     return(true);
 }
Ejemplo n.º 5
0
 // Performs the default cancel drag animation.
 public void DoDefaultCancelDrag()
 {
     AnimatePosition.Do(host.gameObject, EZAnimation.ANIM_MODE.To, dragOriginOffset, EZAnimation.GetInterpolator(host.CancelDragEasing), host.CancelDragDuration, 0, null, FinishCancelDrag);
 }
Ejemplo n.º 6
0
    public override void OnInput(ref POINTER_INFO ptr)
    {
        if (this.deleted)
        {
            return;
        }
        if (!this.m_controlIsEnabled || base.IsHidden())
        {
            base.OnInput(ref ptr);
            return;
        }
        if (this.inputDelegate != null)
        {
            this.inputDelegate(ref ptr);
        }
        if (!this.m_controlIsEnabled || base.IsHidden())
        {
            base.OnInput(ref ptr);
            return;
        }
        switch (ptr.evt)
        {
        case POINTER_INFO.INPUT_EVENT.PRESS:
        case POINTER_INFO.INPUT_EVENT.DRAG:
            if (!this.IsListButton)
            {
                this.SetControlState(UIButton.CONTROL_STATE.ACTIVE);
            }
            if (this.AvtiveColorText != string.Empty && this.BaseString != string.Empty && this.AvtiveColorText != base.ColorText)
            {
                base.ColorText = this.AvtiveColorText;
                this.Text      = this.BaseString;
            }
            if (ptr.evt == POINTER_INFO.INPUT_EVENT.PRESS)
            {
                if (this.mouseDownDelegate != null)
                {
                    this.mouseDownDelegate(this);
                }
                if (this.bEffectAni && !this.bStartAni)
                {
                    Vector3 one = Vector3.one;
                    if (0f > base.transform.localScale.x)
                    {
                        one.x *= -1f;
                    }
                    if (0f > base.transform.localScale.y)
                    {
                        one.y *= -1f;
                    }
                    if (0f > base.transform.localScale.z)
                    {
                        one.z *= -1f;
                    }
                    AnimateScale.Do(base.gameObject, EZAnimation.ANIM_MODE.FromTo, this.width, this.height, base.transform.localScale, new Vector3(0.85f * one.x, 0.85f * one.y, 0.85f * one.z), EZAnimation.GetInterpolator(EZAnimation.EASING_TYPE.BackOut), 0.2f, 0f, new EZAnimation.CompletionDelegate(base.EffectAniStartDelegate), new EZAnimation.CompletionDelegate(base.EffectAniCompletionDelegate));
                }
            }
            break;

        case POINTER_INFO.INPUT_EVENT.DOUBLE_PRESS:
            if (!this.IsListButton)
            {
                this.SetControlState(UIButton.CONTROL_STATE.ACTIVE);
            }
            if (this.doubleClickDelegate != null)
            {
                this.doubleClickDelegate(this);
            }
            break;

        case POINTER_INFO.INPUT_EVENT.RIGHT_PRESS:
            if (!this.IsListButton)
            {
                this.SetControlState(UIButton.CONTROL_STATE.ACTIVE);
            }
            if (this.rightMouseDelegate != null)
            {
                this.rightMouseDelegate(this);
            }
            break;

        case POINTER_INFO.INPUT_EVENT.RELEASE:
        case POINTER_INFO.INPUT_EVENT.TAP:
        case POINTER_INFO.INPUT_EVENT.LONG_TAP:
            if (!this.IsListButton)
            {
                this.SetControlState(UIButton.CONTROL_STATE.NORMAL);
            }
            break;

        case POINTER_INFO.INPUT_EVENT.RIGHT_RELEASE:
        case POINTER_INFO.INPUT_EVENT.RIGHT_TAP:
            if (ptr.type != POINTER_INFO.POINTER_TYPE.TOUCHPAD && ptr.hitInfo.collider == base.collider)
            {
                if (!this.IsListButton)
                {
                    this.SetControlState(UIButton.CONTROL_STATE.OVER);
                }
            }
            else if (!this.IsListButton)
            {
                this.SetControlState(UIButton.CONTROL_STATE.NORMAL);
            }
            break;

        case POINTER_INFO.INPUT_EVENT.MOVE:
            if (this.m_ctrlState != UIButton.CONTROL_STATE.OVER)
            {
                if (!this.IsListButton)
                {
                    this.SetControlState(UIButton.CONTROL_STATE.OVER);
                }
                if (this.OverColorText != string.Empty && this.OverColorText != base.ColorText)
                {
                    this.NormalColorText = base.ColorText;
                    base.ColorText       = this.OverColorText;
                    this.Text            = this.BaseString;
                }
                if (this.soundOnOver != null)
                {
                    this.soundOnOver.PlayOneShot(this.soundOnOver.clip);
                }
                if (this.mouseOverDelegate != null)
                {
                    this.mouseOverDelegate(this);
                }
            }
            break;

        case POINTER_INFO.INPUT_EVENT.MOVE_OFF:
        case POINTER_INFO.INPUT_EVENT.RELEASE_OFF:
            if (this.m_ctrlState != UIButton.CONTROL_STATE.NORMAL && this.mouseOutDelegate != null)
            {
                this.mouseOutDelegate(this);
            }
            if (!this.IsListButton)
            {
                this.SetControlState(UIButton.CONTROL_STATE.NORMAL);
            }
            if (this.NormalColorText != string.Empty && this.BaseString != string.Empty && this.NormalColorText != base.ColorText)
            {
                base.ColorText = this.NormalColorText;
                this.Text      = this.BaseString;
            }
            break;
        }
        base.OnInput(ref ptr);
        if (this.repeat)
        {
            if (this.m_ctrlState == UIButton.CONTROL_STATE.ACTIVE)
            {
                goto IL_4A2;
            }
        }
        else if (ptr.evt == this.whenToInvoke)
        {
            goto IL_4A2;
        }
        return;

IL_4A2:
        if (ptr.evt == this.whenToInvoke && this.soundOnClick != null)
        {
            this.soundOnClick.PlayOneShot(this.soundOnClick.clip);
        }
        if (this.scriptWithMethodToInvoke != null)
        {
            this.scriptWithMethodToInvoke.Invoke(this.methodToInvoke, this.delay);
        }
        if (this.changeDelegate != null)
        {
            this.changeDelegate(this);
            if (this.bUseDefaultSound)
            {
                MsgHandler.Handle("ButtonSound", new object[0]);
            }
        }
    }
Ejemplo n.º 7
0
    public void CancelDrag()
    {
        if (this == null || !this.isDragging)
        {
            return;
        }
        EZDragDropParams eZDragDropParams = new EZDragDropParams(EZDragDropEvent.Cancelled, this.host, default(POINTER_INFO));

        if (this.dropTarget != null)
        {
            this.dropTarget.SendMessage("OnEZDragDrop", eZDragDropParams, SendMessageOptions.DontRequireReceiver);
        }
        if (this.dragDropDelegate != null)
        {
            this.dragDropDelegate(eZDragDropParams);
        }
        this.dropTarget  = null;
        this.dropHandled = false;
        this.isDragging  = false;
        AnimatePosition.Do(this.host.gameObject, EZAnimation.ANIM_MODE.To, this.dragOriginOffset, EZAnimation.GetInterpolator(this.host.CancelDragEasing), this.host.CancelDragDuration, 0f, null, new EZAnimation.CompletionDelegate(this.FinishCancelDrag));
        if (UIManager.Exists())
        {
            NrTSingleton <UIManager> .Instance.Detarget(this.host);
        }
    }