Begin() static public method

Start the tweening operation.
static public Begin ( GameObject go, float duration, Quaternion rot ) : TweenRotation,
go GameObject
duration float
rot Quaternion
return TweenRotation,
Beispiel #1
0
    public void Switch(bool to2D, System.Action callback)
    {
        if (bIsChanging || !viewSwitcher.CanChange || to2D == CurrentIs2D)
        {
            return;
        }
        bIsChanging = true;
        viewSwitcher.ChangeProjection = true;

        Vector3 vec = to2D ? tsf2DPos.position : tsf3DPos.position;

        vec.y = to2D ? f2DPos_Y : f3DPos_Y;
        UITweener tween = TweenPosition.Begin(gameObject, viewSwitcher.ProjectionChangeTime - 0.25f, vec, true);

        tween.animationCurve = to2D ? curveTo2D : curveTo3D;
        tween.SetOnFinished(() =>
        {
            bIsTweenRotation = true;
            Vector3 vec2     = to2D ? tsf2DPos.position : tsf3DPos.position;
            vec.y            = to2D ? f2DPos_Y : f3DPos_Y;
            TweenPosition.Begin(gameObject, 0.3f, vec, true);
            TweenRotation.Begin(gameObject, 0.3f, to2D ? tsf2DPos.rotation : tsf3DPos.rotation, true).SetOnFinished(() =>
            {
                bIsTweenRotation = bIsChanging = false;
                if (callback != null)
                {
                    callback();
                }
            });
        });
    }
Beispiel #2
0
    public override void shooting(Vector3 position)
    {
        GameObject gOb, bullet;
        Vector3    deltaRotHand, deltaRotBody;

        if (position.x > transform.position.x)
        {
            gOb = HandLeft;

            deltaRotHand    = gOb.transform.eulerAngles;
            deltaRotHand.z += 25;

            deltaRotBody    = Body.transform.localEulerAngles;
            deltaRotBody.z += 15;

            bullet = GunLeft.transform.GetChild(1).gameObject;
        }
        else
        {
            gOb = HandRight;

            deltaRotHand    = gOb.transform.eulerAngles;
            deltaRotHand.z -= 25;

            deltaRotBody    = Body.transform.localEulerAngles;
            deltaRotBody.z -= 15;

            bullet = GunRight.transform.GetChild(1).gameObject;
        }

        TweenRotation twRHand = TweenRotation.Begin(gOb, 0.05f, Quaternion.Euler(deltaRotHand));

        //twRHand.worldSpace = true;
        twRHand.method = UITweener.Method.EaseIn;
        twRHand.style  = UITweener.Style.PingPong;
        twRHand.onLoop = () =>
        {
            twRHand.style = UITweener.Style.Once;
        };

        TweenRotation twRBody = TweenRotation.Begin(Body, 0.05f, Quaternion.Euler(deltaRotBody));

        twRBody.quaternionLerp = true;
        twRBody.method         = UITweener.Method.EaseIn;
        twRBody.style          = UITweener.Style.PingPong;
        twRBody.onLoop         = () =>
        {
            twRBody.style = UITweener.Style.Once;
        };

        if (!bullet.activeSelf)
        {
            bullet.SetActive(true);
        }
        StartCoroutine(delay(0.1f, () => { if (bullet.activeSelf)
                                           {
                                               bullet.SetActive(false);
                                           }
                             }));
    }
Beispiel #3
0
    void addMoneyEffect(UITexture texture, UILabel label, int money)
    {
        UILabel getLabel = texture.transform.Find("getLabel").GetComponent <UILabel>();

        NGUITools.SetActive(getLabel.gameObject, true);
        TweenScale tweenScale = TweenScale.Begin(getLabel.gameObject, 0.8f, Vector3.one);

        tweenScale.from = new Vector3(1.5f, 1.5f, 1.5f);
        tweenScale.to   = Vector3.one;
        EventDelegate.Add(tweenScale.onFinished, delegate {
            Globals.Instance.MGUIManager.ShowSimpleCenterTips(6006);
            TweenRotation tween1 = TweenRotation.Begin(texture.gameObject, 0.5f, Quaternion.Euler(new Vector3(0f, 90f, 0f)));
            tween1.from          = new Vector3(0f, 0f, 0f);
            tween1.to            = new Vector3(0f, 90f, 0f);
            tween1.duration      = 0.5f;
            tween1.ResetToBeginning();
            tween1.PlayForward();
            tween1.onFinished.Clear();
            EventDelegate.Add(tween1.onFinished, delegate() {
                texture.mainTexture = null;
                NGUITools.SetActive(getLabel.gameObject, false);
                UISprite sprite = texture.transform.Find("Sprite").GetComponent <UISprite>();
                NGUITools.SetActive(sprite.gameObject, true);
                label.text      = Globals.Instance.MDataTableManager.GetWordText(6007) + money.ToString();
                tween1.from     = new Vector3(0f, 90f, 0f);
                tween1.to       = new Vector3(0f, 0f, 0f);
                tween1.duration = 0.5f;
                tween1.ResetToBeginning();
                tween1.PlayForward();
                tween1.onFinished.Clear();
            }, true);
        }, true);
    }
Beispiel #4
0
        public void ShowBtnPanel()//展开按钮
        {
            if (!MyBtnEneble)
            {
                return;
            }
            //send event to joystick of TownUI
            UIEventManager.Instance.TriggerUIEvent(UIEventType.MainBtnOpenEvent, null);
            //DesLabel.enabled = true;
            Show = true;
//            if (m_addSystemFunc != UIType.Empty)
//            {
//                foreach (var item in m_buttonList)
//                {
//                    AddSysFuntionButton(item);
//                }
//            }
            //Debug.Log("showpanel");
            SoundManager.Instance.PlaySoundEffect("Sound_Button_Default");
            SysButtonPanel_BottomRight.ShowPanelBtn();
            SysButtonPanel_TopRight.ShowPanelBtn();
            SysButtonPanel_TopLeft.ShowPanelBtn();

            TweenRotation.Begin(m_rotationObj, 0.1f, Quaternion.Euler(new Vector3(0, 0, 120)), OpenRotateStep1);
        }
Beispiel #5
0
    void Hide()
    {
        TweenRotation tween = TweenRotation.Begin(gameObject, 0.5f, Quaternion.Euler(90f, 0f, 0f));

        tween.delay = 3.0f;
        EventDelegate.Add(tween.onFinished, Destroy, true);
    }
Beispiel #6
0
        public void NextPage()
        {
            const float speed = 0.2f;

            var hide = Pages[0].activeSelf ? Pages[0] : Pages[1];
            var show = Pages[0].activeSelf ? Pages[1] : Pages[0];

            Unselect();

            foreach (var card in hide.GetComponentsInChildren <CharacterCard>())
            {
                TweenRotation.Begin(card.gameObject, speed, Quaternion.Euler(0, 90, 0));
                card.Button.Pressed = false;
            }

            TaskScheduler.CreateTask(() =>
            {
                hide.SetActive(false);
                show.SetActive(true);

                foreach (var card in hide.GetComponentsInChildren <CharacterCard>(true))
                {
                    card.transform.localRotation = Quaternion.Euler(0, 0, 0);
                }

                foreach (var card in show.GetComponentsInChildren <CharacterCard>(true))
                {
                    card.transform.localRotation = Quaternion.Euler(0, 90, 0);
                    TweenRotation.Begin(card.gameObject, speed, Quaternion.Euler(0, 0, 0));
                }
            }, speed);

            Get <AudioPlayer>().PlaySwap();
        }
Beispiel #7
0
    private void DropStar(GameObject star, float endAngle)
    {
        starAmount++;
        star.GetComponent <UITexture>().color = Color.cyan;
        TweenPosition.Begin(star, 1, star.transform.localPosition + new Vector3(0, 0, 10));
        TweenRotation.Begin(star, 1, Quaternion.AngleAxis(endAngle, -star.transform.forward));
        TweenScale.Begin(star, 1, new Vector3(0.015f, 0.015f, 0.015f));
        switch (starAmount)
        {
        case 1:
            StartCoroutine(playSoundAfterSeconds(1, reward1));
            break;

        case 2:
            StartCoroutine(playSoundAfterSeconds(1, reward2));
            break;

        case 3:
            StartCoroutine(playSoundAfterSeconds(1, reward3));
            break;

        default:
            break;
        }
    }
Beispiel #8
0
 private void StopLook()
 {
     StopCoroutine("Look");
     camRotation = TweenRotation.Begin(gameObject, rotateSpeed, cruiseParameter.tarRot);
     camRotation.onFinished.Clear();
     camRotation.onFinished.Add(new EventDelegate(cruiseParameter.gotoCall));
 }
Beispiel #9
0
 public void Init()
 {
     TweenLocalPosition.Begin(mountain, 1.0f, targetPos.localPosition);
     TweenRotation.Begin(mountain, 1.0f, targetPos.localRotation);
     TweenScale.Begin(mountain, 1.0f, targetPos.localScale);
     TweenGroupAlpha.Begin(buttons, 1.0f, 1);
 }
Beispiel #10
0
 private void OnClickMenu(PointerEventData eventData)
 {
     if (eventData.button == PointerEventData.InputButton.Left)
     {
         Vector3 pos = new Vector3(442f, -341f, 0);
         Debug.Log("打开菜单");
         if (menu != null)
         {
             float z = 0;
             if (IsRot)
             {
                 IsRot = false;
                 z     = 15f;
                 pos   = new Vector3(-183.7f, -341f, 0);
             }
             else
             {
                 IsRot = true;
             }
             TweenRotation.Begin(menu.gameObject, 0.2f, new Quaternion(0, 0, z, 0));
         }
         if (mIconA != null)
         {
             TweenPosition.Begin(mIconA.gameObject, 0.5f, pos);
         }
     }
 }
Beispiel #11
0
        public void TurnCard()
        {
            if (Id == 0)
            {
                return;
            }

            GetComponent <SpringPosition>().onFinished = () => { };

            TweenRotation rightTweenR = TweenRotation.Begin(gameObject, 0.2f, new Quaternion(0, -90, 0, 0));

            //TweenRotation rightTweenR = GetComponent<TweenRotation>();
            //rightTweenR.from = new Vector3(0, 0, 0);
            //rightTweenR.to = new Vector3(0, -90, 0);
            //rightTweenR.duration = 0.2f;
            if (_changeFEvent == null)
            {
                _changeFEvent = new EventDelegate(Onfinish);
            }
            rightTweenR.AddOnFinished(_changeFEvent);
            //rightTweenR.ResetToBeginning();
            //rightTweenR.PlayForward();

            //rightTweenR.AddOnFinished(new EventDelegate(() => {transform.GetComponentInParent<UIGrid>().Reposition(); }));
        }
Beispiel #12
0
    void onTimeGameStart()
    {
        tweenRota    = TweenRotation.Begin(ArrowAnimator.gameObject, ManagerTime.Instance.TimeOfGame, Quaternion.identity);
        tweenRota.to = new Vector3(0, 0, -90);

        isTimeGameStart = true;
    }
Beispiel #13
0
    void OnClickMsg(GameObject go)
    {
        if (go == goShortMsgFolder)
        {
            m_bShowAll = !m_bShowAll;
            TweenRotation.Begin(goShortMsgFolder, 0.2f, Quaternion.AngleAxis(m_bShowAll ? 0.0f : 90.0f, new Vector3(0.0f, 0.0f, 1.0f))).method = UITweener.Method.EaseOut;
            return;
        }

        MatchMsgBtn msgBtn = m_matchMsgBtns.Find((MatchMsgBtn matchBtn) => { return(matchBtn.btn == go); });

        if (msgBtn == null)
        {
            return;
        }
        if (!msgBtn.valid)
        {
            return;
        }
        if (go == goCustomMsg)
        {
            m_bShowCustomMsg = !m_bShowCustomMsg;
            return;
        }

        foreach (MatchMsgBtn btn in m_matchMsgBtns)
        {
            btn.Reset(msgBtn.msg.cd);
        }
        m_bShowCustomMsg = false;
        GameMsgSender.SendGameShortMsg(m_match.mainRole, msgBtn.msg.id, (uint)msgBtn.msg.recvType);
    }
    public void MoveToPage(int page)
    {
        if (page > TotalPage || page < 1 || islock)
        {
            return;
        }
        islock  = true;
        CurPage = page;
        Quaternion tem_qua;
        float      sita   = 2 * Mathf.Atan2(0.5f * Width, Radis);
        float      degree = 180f * sita / Mathf.PI;

        tem_qua = Quaternion.Euler(0, -(DegreePerPage / 2 + (CurPage - 1) * DegreeClipPerPage), 0);

        FadeInPage(CurPage, true);

        TweenRotation tr = TweenRotation.Begin(gameObject, 0.6f, tem_qua);

        tr.AddOnFinished(() =>
        {
            islock = false;
            FadeInPage(CurPage - 1, false);
            FadeInPage(CurPage + 1, false);
        });
        tr.PlayForward();
    }
Beispiel #15
0
    public void PlayFinalClock(float timerAux)
    {
        ArrowAnimator.SetBool("Frezze", false);
        if (playRed)
        {
            scaleArrow.PlayForward();
            clockAnim.SetBool("Red", true);
            clockAnim.SetBool("Yellow", false);
        }
        else if (playYellow)
        {
            clockAnim.SetBool("Red", false);
            clockAnim.SetBool("Yellow", true);
        }
        else
        {
            clockAnim.SetBool("Red", false);
            clockAnim.SetBool("Yellow", false);
        }

        tweenRota.from = currentStop;

        tweenRota      = TweenRotation.Begin(ArrowAnimator.gameObject, timerAux, Quaternion.identity);
        tweenRota.from = currentStop;
        tweenRota.to   = new Vector3(0, 0, -90);
    }
Beispiel #16
0
    public override void Die(TargetType type)
    {
        float z = type == TargetType.Left ? -15 : 15;

        Blood.SetActive(true);
        Vector3 pos = Blood.transform.localPosition;

        pos.x = 15 * Mathf.Sign(z);
        Blood.transform.localPosition = pos;
        TweenRotation twR = TweenRotation.Begin(Body, 0.05f, Quaternion.Euler(0, 0, z));

        twR.quaternionLerp = true;
        twR.method         = UITweener.Method.EaseIn;
        twR.style          = UITweener.Style.PingPong;
        twR.onLoop         = () =>
        {
            twR.style = UITweener.Style.Once;
        };

        StartCoroutine(delay(1, () => {
            if (gameController.started && gameController.stopped)
            {
                animator.SetTrigger("Die");
                animator.SetBool("Normal", false);
                animator.enabled = true;
            }
        }));
    }
Beispiel #17
0
    public void DoubleClick()
    {
        DebugLog.DebugLogInfo("双击-----------------");
        if (BlockManager.Instance.availableBaseCount > 0)
        {
            DebugLog.DebugLogInfo("availableBaseCount--- " + BlockManager.Instance.availableBaseCount);
            BlockManager.Instance.availableBaseCount--;
            TouchableObject tobj = GetComponent <TouchableObject>();
            tobj.SetDraggable(false);
            tobj.SetRotatable(false);
            TweenRotation tween = TweenRotation.Begin(gameObject, 0.5f, targetRotation);
            DebugLog.DebugLogInfo("tween--- " + tween);
            tween.method = UITweener.Method.EaseInOut;
            UITweener tweener = TweenPosition.Begin(gameObject, 0.3f, targetPosition);
            DebugLog.DebugLogInfo("tweener--- " + tweener);
            tweener.method = UITweener.Method.EaseInOut;
            //TweenRotation tween = GetComponent<TweenRotation>();
            tween.from = m_transform.localEulerAngles;

            tween.to = targetAngles;
            float y = tween.from.y;
            if (Mathf.Abs(360 - tween.from.y) < Mathf.Abs(tween.from.y - 0))
            {
                //tween.from = new Vector3(tween.from.x, tween.from.y - 360, tween.from.z);
                tween.to = new Vector3(tween.to.x, tween.to.y + 360, tween.to.z);
            }
            DebugLog.DebugLogInfo("from:" + tween.from + "to:" + tween.to);
            tween.SetOnFinished(BlockManager.Instance.AddScore);
            //BlockManager.Instance.AddScore();
            isFinished = true;//标志该结构已经归位

            this.GetComponent <DraggableObject>().enabled = false;
            this.GetComponent <RotatableObject>().enabled = false;
        }
    }
 public void hideLetter()
 {
     TweenRotation.Begin(gameObject, 0.5f, Quaternion.Euler(new Vector3(1, 1, 180)));
     TweenScale.Begin(gameObject, 0.5f, new Vector3(0, 0, 0));
     Invoke("disableObject", 1f);
     gameObject.GetComponent <AudioSource> ().Play();
 }
    /// <summary>
    /// 부모 패널에서 실질적인 선택이 이뤄지면 들어오는 함수
    /// </summary>
    public void OpeningEvent(uint lowDataId, ushort amount)
    {
        ActiveCollider(false);
        CostGroup.SetActive(false);
        CardOpenEffGo.SetActive(true);

        TweenRotation rot = GetComponentInParent <TweenRotation>();//시작은 로테이션

        rot = TweenRotation.Begin(transform.parent.gameObject, rot.duration, Quaternion.Euler(-rot.from));
        rot.onFinished.Clear();

        TempCoroutine.instance.FrameDelay(rot.delay + (rot.duration * 0.5f), () => {
            Img.spriteName = "reward_pendant_back";
            ItemSlotObj.SetLowDataItemSlot(lowDataId, amount);

            RewardGroup.SetActive(true);
            CostGroup.SetActive(false);
        });

        //EventDelegate.Set(rot.onFinished, delegate () {

        //    ItemSlotObj.SetLowDataItemSlot(lowDataId, amount);

        //    RewardGroup.SetActive(true);
        //    CostGroup.SetActive(false);

        //});

        rot.ResetToBeginning();
        rot.Play(true);
    }
Beispiel #20
0
    void OnPress(bool pressed)
    {
        if (enabled && gameObject.activeSelf && target != null)
        {
            mPressed = pressed;
            if (pressed)
            {
                mMomentum = 0f;
                TweenRotation tr = target.GetComponent <TweenRotation>();
                if (tr != null)
                {
                    tr.enabled = false;
                }

                mLastPos = UICamera.lastHit.point;
                mPlane   = new Plane((UICamera.lastCamera.transform.rotation) * Vector3.back, mLastPos);
            }
            else
            {
                float         targetZ    = target.localEulerAngles.z + mMomentum * 12f;
                int           targetStar = GetIndexByRotationZ(targetZ);
                float         targetRoaZ = GetStarRightRotation(targetStar);
                TweenRotation tr         = TweenRotation.Begin(target.gameObject, Mathf.Abs(mMomentum) / 30 + 0.2f, Quaternion.AngleAxis(targetRoaZ, Vector3.forward));
                tr.method = UITweener.Method.EaseIn;
            }
        }
    }
Beispiel #21
0
    public Task moveTask(int number, Vector2 begin, Vector2 end)
    {
        TaskSet ts = new TaskSet();
        Square  s  = (Square)GameObject.Instantiate(_phototype);
        Square  b  = this.getSquare((int)(begin.x), (int)(begin.y));
        Square  e  = this.getSquare((int)(end.x), (int)(end.y));

        s.transform.SetParent(b.transform.parent);
        s.transform.localScale    = b.transform.localScale;
        s.transform.localPosition = b.transform.localPosition;
        s.show();
        s.number = number;
        b.hide();
        TweenTask tt = new TweenTask(delegate() {
            return(TweenLocalPosition.Begin(s.gameObject, 0.5f, e.transform.localPosition));
        });

        TweenTask t2 = new TweenTask(delegate() {
            return(TweenRotation.Begin(s.gameObject, 0.5f, Quaternion.AngleAxis((begin.x - end.x) * 90.0f, Vector3.up)));
        });

        ts.push(tt);
        ts.push(t2);

        TaskManager.PushBack(ts, delegate {
            GameObject.DestroyObject(s.gameObject);
        });
        return(ts);
    }
Beispiel #22
0
    public void Fire(Vector2 direct, bool isTouch)
    {
        var tween = TweenRotation.Begin(gameObject, 0.3f, Quaternion.identity);

        tween.from = new Vector3(0, 0, 90);
        tween.to   = new Vector3(0, 0, -90);
        tween.SetOnFinished(() => {
            // OnFinishedFire();
            transform.rotation = Quaternion.identity;
        });


        var distance = Vector3.Distance(transform.position, direct) / tileDataProvider.TileSize;

        if (distance > range)
        {
            return;
        }


        if (SwapItemManager.AddItem(ItemData.Torch.Id, direct))
        {
            playerModel.GetBag().UseItem(itemData);
        }
    }
Beispiel #23
0
    void RotateShowCallback()
    {
        TweenRotation tween = TweenRotation.Begin(gameObject, 0.3f, Quaternion.Euler(0f, 0f, 0f));

        tween.delay = 0;
        Destroy(cardBack);
        // cardBack.SetActive(false);
    }
Beispiel #24
0
        void ShowInfoTweenRotation()
        {
            EventDelegate.Remove(UitRot.onFinished, ShowInfoTweenRotation);
            UITweener tween = TweenRotation.Begin(root, SettingEnd.rotation_time_out, Quaternion.Euler(SettingEnd.rotation_end_out));

            tween.delay = SettingEnd.stayTime;
            DoTweenEnd(tween);
        }
Beispiel #25
0
    public void onResumeFreeze()
    {
        tweenRota.from = currentStop;

        tweenRota      = TweenRotation.Begin(ArrowAnimator.gameObject, ManagerTime.Instance.getCurrentTimeOfGame, Quaternion.identity);
        tweenRota.from = currentStop;
        tweenRota.to   = new Vector3(0, 0, -90);
    }
    void ShowLeftGuide()
    {
        Quaternion    quaternion = Quaternion.Euler(targetRot);
        TweenRotation tRotation  = TweenRotation.Begin(guideTexture.gameObject, rollRepeatRate, quaternion);

        tRotation.from  = Vector3.zero;
        tRotation.style = UITweener.Style.Loop;
    }
Beispiel #27
0
 void OnPress(bool isPressed)
 {
     if (enabled)
     {
         TweenRotation.Begin(tweenTarget.gameObject, duration, isPressed ? mRot * Quaternion.Euler(pressed) :
                             (UICamera.IsHighlighted(gameObject) ? mRot * Quaternion.Euler(hover) : mRot)).method = UITweener.Method.EaseInOut;
     }
 }
Beispiel #28
0
 void OnPress(bool isPressed)
 {
     if (enabled)
     {
         if (!mInitDone) Init();
         TweenRotation.Begin(tweenTarget.gameObject, duration, isPressed ? mRot * Quaternion.Euler(pressed) : mRot).method = UITweener.Method.EaseInOut;
     }
 }
Beispiel #29
0
 void OnHover(bool isOver)
 {
     if (enabled)
     {
         TweenRotation.Begin(tweenTarget.gameObject, duration, isOver ? mRot * Quaternion.Euler(hover) : mRot).method = UITweener.Method.EaseInOut;
         mHighlighted = isOver;
     }
 }
        private void ResetSprite()
        {
            float to = -90 * (int)RotateState;
//            Sprite.transform.eulerAngles = new Vector3(0, 0, to);
            TweenRotation tweenRotation = TweenRotation.Begin(Sprite.gameObject, tweenDuration, Quaternion.Euler(0, 0, to));

            tweenRotation.quaternionLerp = true;
            tweenRotation.animationCurve = AnimationCurve.EaseInOut(0, 0, tweenDuration, 1f);
        }