Example #1
0
    public virtual void OnTouchBegan(Touch touch, Vector2 pos)
    {
        if (GUICollider.disableAllCollider && !this.avoidDisableAllCollider)
        {
            return;
        }
        if (!this.activeCollider)
        {
            return;
        }
        this.isTouching = true;
        if (this.SendMoveToParent && base.transform.parent != null)
        {
            GUICollider component = base.transform.parent.GetComponent <GUICollider>();
            if (component != null)
            {
                component.SendMoveFromChild = true;
                component.OnTouchBegan(touch, pos);
            }
        }
        if (this.sendMoveFromChild)
        {
            this.sendMoveFromChild = false;
            return;
        }
        this.isTouchBegan_ = true;
        this.beganPostion  = pos;
        this.firstPos      = base.gameObject.transform.localPosition;
        switch (this.touchBehavior)
        {
        case GUICollider.TouchBehavior.ToLarge:
            this.vTmp3.x = this.changeSize * 1.1f;
            this.vTmp3.y = this.changeSize * 1.1f;
            base.KickTween(LocalTween.TWEEN_TYPE.LOCAL_SCALE, this.vTmp3, 0.16f, new Action <int>(this.TouchBehaviourScaleEnd), 0);
            this.toLargeSeq  = 0;
            this.toLargeSeq2 = 0;
            break;

        case GUICollider.TouchBehavior.ToSmall:
            this.vTmp3.x = this.changeSizeSmall * this.originalScale.x;
            this.vTmp3.y = this.changeSizeSmall * this.originalScale.y;
            base.KickTween(LocalTween.TWEEN_TYPE.LOCAL_SCALE, this.vTmp3, 0.1f, new Action <int>(this.SmallScaleEnd), 0);
            this.toSmallSeq = 0;
            break;

        case GUICollider.TouchBehavior.MoveUp:
            base.gameObject.transform.position = new Vector3(this.firstPos.x, this.firstPos.y + this.changeMove, this.firstPos.z - 50f);
            break;

        case GUICollider.TouchBehavior.ChangeColor:
            if (this._UISprite != null)
            {
                this._UISprite.color = this.changeColor;
            }
            else
            {
                MeshRenderer component2 = base.gameObject.GetComponent <MeshRenderer>();
                if (component2 != null)
                {
                    component2.material.color = this.changeColor;
                }
            }
            break;

        case GUICollider.TouchBehavior.BoundAnime:
            this.boundAnime.wrapMode = WrapMode.Loop;
            this.boundAnime.Play(GUICollider.boundAnimeClip.name);
            break;
        }
        if (this.callBackState == GUICollider.CallBackState.OnTouchBegan)
        {
            this.PlaySE();
        }
        if (this.onTouchBegan != null)
        {
            this.onTouchBegan(touch, pos);
        }
        if (this.callBackState == GUICollider.CallBackState.OnTouchBegan && this.CallBackClass != null && this.MethodToInvoke != null && this.MethodToInvoke != string.Empty)
        {
            this.CallBackClass.SendMessage(this.MethodToInvoke, this, SendMessageOptions.DontRequireReceiver);
        }
    }