cancel() private method

private cancel ( GameObject gameObject ) : LTDescr,
gameObject GameObject
return LTDescr,
コード例 #1
0
 private static void DoExpTweenEnd()
 {
     if ((_expTweenRect != null) && (_expLTD != null))
     {
         _expTweenRect.sizeDelta = new Vector2(_expTo * 327.6f, _expTweenRect.sizeDelta.y);
         _expLTD.cancel();
         _expLTD       = null;
         _expTweenRect = null;
     }
     if (_continueBtn != null)
     {
         _continueBtn.CustomSetActive(true);
         _continueBtn = null;
     }
     if (_lvUpGrade > 1)
     {
         CUIEvent event3 = new CUIEvent {
             m_eventID = enUIEventID.Settle_OpenLvlUp
         };
         event3.m_eventParams.tag  = ((int)_lvUpGrade) - 1;
         event3.m_eventParams.tag2 = (int)_lvUpGrade;
         CUIEvent uiEvent = event3;
         Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(uiEvent);
     }
     _lvUpGrade = 0;
 }
コード例 #2
0
    IEnumerator timeBasedTesting()
    {
        yield return(new WaitForEndOfFrame());

        yield return(new WaitForEndOfFrame());

        lt1.cancel();
        LeanTween.cancel(cube2);

        yield return(new WaitForEndOfFrame());

        LeanTest.debug("CANCEL TWEEN LTDESCR", LeanTween.isTweening(cube1) == false);
        LeanTest.debug("CANCEL TWEEN LEANTWEEN", LeanTween.isTweening(cube2) == false);
    }
コード例 #3
0
 public static void DoCoinTweenEnd()
 {
     if ((_coinLTD != null) && (_coinTweenText != null))
     {
         _coinTweenText.text = string.Format("+{0}", _coinTo.ToString("N0"));
         if (Singleton <BattleStatistic> .GetInstance().multiDetail != null)
         {
             CUICommonSystem.AppendMultipleText(_coinTweenText, CUseable.GetMultiple(ref Singleton <BattleStatistic> .GetInstance().multiDetail, 0, -1));
         }
         _coinLTD.cancel();
         _coinLTD       = null;
         _coinTweenText = null;
     }
     if (_continueBtn != null)
     {
         _continueBtn.CustomSetActive(true);
         _continueBtn = null;
     }
 }
コード例 #4
0
ファイル: TestingAllCS.cs プロジェクト: cjIrisZ/mdp
    void cycleThroughExamples()
    {
        if (exampleIter == 0)
        {
            int iter = (int)timingType + 1;
            if (iter > (int)TimingType.Length)
            {
                iter = 0;
            }
            timingType       = (TimingType)iter;
            useEstimatedTime = timingType == TimingType.IgnoreTimeScale;
            Time.timeScale   = useEstimatedTime ? 0 : 1f;           // pause the Time Scale to show the effectiveness of the useEstimatedTime feature (this is very usefull with Pause Screens)
            if (timingType == TimingType.HalfTimeScale)
            {
                Time.timeScale = 0.5f;
            }

            if (timingType == TimingType.VariableTimeScale)
            {
                descrTimeScaleChange = LeanTween.value(gameObject, 0.01f, 10.0f, 3f).setOnUpdate((float val) => {
                    //Debug.Log("timeScale val:"+val);
                    Time.timeScale = val;
                }).setEase(LeanTweenType.easeInQuad).setUseEstimatedTime(true).setRepeat(-1);
            }
            else
            {
                Debug.Log("cancel variable time");
                if (descrTimeScaleChange != null)
                {
                    descrTimeScaleChange.cancel();
                }
            }
        }
        gameObject.BroadcastMessage(exampleFunctions[exampleIter]);

        // Debug.Log("cycleThroughExamples time:"+Time.time + " useEstimatedTime:"+useEstimatedTime);
        float delayTime = 1.1f;

        LeanTween.delayedCall(gameObject, delayTime, cycleThroughExamples).setUseEstimatedTime(useEstimatedTime);

        exampleIter = exampleIter + 1 >= exampleFunctions.Length ? 0 : exampleIter + 1;
    }
コード例 #5
0
ファイル: moveWithScale.cs プロジェクト: Ganielle/DKnights
 private void stopLeanTween()
 {
     leantweenLT.cancel(this.gameObject);
 }
コード例 #6
0
    IEnumerator timeBasedTesting()
    {
        yield return(new WaitForEndOfFrame());

        yield return(new WaitForEndOfFrame());

        Time.timeScale = 0.25f;
        float tweenTime         = 0.2f;
        float start             = Time.realtimeSinceStartup;
        bool  onUpdateWasCalled = false;

        LeanTween.moveX(cube1, -5f, tweenTime).setOnUpdate((float val) => {
            onUpdateWasCalled = true;
        }).setOnComplete(() => {
            float end  = Time.realtimeSinceStartup;
            float diff = end - start;
            LeanTest.expect(Mathf.Abs(tweenTime * (1f / Time.timeScale) - diff) < 0.05f, "SCALED TIMING DIFFERENCE", "expected to complete in roughly 0.8f but completed in " + diff);
            LeanTest.expect(Mathf.Approximately(cube1.transform.position.x, -5f), "SCALED ENDING POSITION", "expected to end at -5f, but it ended at " + cube1.transform.position.x);
            LeanTest.expect(onUpdateWasCalled, "ON UPDATE FIRED");
        });

        yield return(new WaitForSeconds(1.0f));

        Time.timeScale = 1f;

        // Groups of tweens testing
        groupTweens    = new LTDescr[1200];
        groupGOs       = new GameObject[groupTweens.Length];
        groupTweensCnt = 0;
        int descriptionMatchCount = 0;

        for (int i = 0; i < groupTweens.Length; i++)
        {
            GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
            Destroy(cube.GetComponent(typeof(BoxCollider)) as Component);
            cube.transform.position = new Vector3(0, 0, i * 3);
            cube.name      = "c" + i;
            groupGOs[i]    = cube;
            groupTweens[i] = LeanTween.move(cube, transform.position + Vector3.one * 3f, 0.6f).setOnComplete(groupTweenFinished);

            if (LeanTween.description(groupTweens[i].id).trans == groupTweens[i].trans)
            {
                descriptionMatchCount++;
            }
        }
        LeanTween.delayedCall(gameObject, 0.82f, groupTweensFinished);

        LeanTest.expect(descriptionMatchCount == groupTweens.Length, "GROUP IDS MATCH");
        LeanTest.expect(LeanTween.maxSearch <= groupTweens.Length + 5, "MAX SEARCH OPTIMIZED", "maxSearch:" + LeanTween.maxSearch);
        LeanTest.expect(LeanTween.isTweening() == true, "SOMETHING IS TWEENING");

        // resume item before calling pause should continue item along it's way
        float previousXlt4 = cube4.transform.position.x;

        lt4 = LeanTween.moveX(cube4, 5.0f, 1.1f).setOnComplete(() => {
            LeanTest.expect(cube4 != null && previousXlt4 != cube4.transform.position.x, "RESUME OUT OF ORDER", "cube4:" + cube4 + " previousXlt4:" + previousXlt4 + " cube4.transform.position.x:" + (cube4 != null ? cube4.transform.position.x : 0));
        });
        lt4.resume();

        yield return(new WaitForSeconds(0.1f));

        int countBeforeCancel = LeanTween.tweensRunning;

        lt1.cancel();
        LeanTest.expect(countBeforeCancel == LeanTween.tweensRunning, "CANCEL AFTER RESET SHOULD FAIL", "expected " + countBeforeCancel + " but got " + LeanTween.tweensRunning);
        LeanTween.cancel(cube2);

        int tweenCount = 0;

        for (int i = 0; i < groupTweens.Length; i++)
        {
            if (LeanTween.isTweening(groupGOs[i]))
            {
                tweenCount++;
            }
            if (i % 3 == 0)
            {
                LeanTween.pause(groupGOs[i]);
            }
            else if (i % 3 == 1)
            {
                groupTweens[i].pause();
            }
            else
            {
                LeanTween.pause(groupTweens[i].id);
            }
        }
        LeanTest.expect(tweenCount == groupTweens.Length, "GROUP ISTWEENING", "expected " + groupTweens.Length + " tweens but got " + tweenCount);

        yield return(new WaitForEndOfFrame());

        tweenCount = 0;
        for (int i = 0; i < groupTweens.Length; i++)
        {
            if (i % 3 == 0)
            {
                LeanTween.resume(groupGOs[i]);
            }
            else if (i % 3 == 1)
            {
                groupTweens[i].resume();
            }
            else
            {
                LeanTween.resume(groupTweens[i].id);
            }

            if (i % 2 == 0 ? LeanTween.isTweening(groupTweens[i].id) : LeanTween.isTweening(groupGOs[i]))
            {
                tweenCount++;
            }
        }
        LeanTest.expect(tweenCount == groupTweens.Length, "GROUP RESUME");

        LeanTest.expect(LeanTween.isTweening(cube1) == false, "CANCEL TWEEN LTDESCR");
        LeanTest.expect(LeanTween.isTweening(cube2) == false, "CANCEL TWEEN LEANTWEEN");



        int ltCount = 0;

        GameObject[] allGos = FindObjectsOfType(typeof(GameObject)) as GameObject[];
        foreach (GameObject go in allGos)
        {
            if (go.name == "~LeanTween")
            {
                ltCount++;
            }
        }
        LeanTest.expect(ltCount == 1, "RESET CORRECTLY CLEANS UP");
    }
コード例 #7
0
    IEnumerator timeBasedTesting()
    {
        yield return(new WaitForEndOfFrame());

        yield return(new WaitForEndOfFrame());

        // Groups of tweens testing
        groupTweens    = new LTDescr[300];
        groupGOs       = new GameObject[groupTweens.Length];
        groupTweensCnt = 0;
        int descriptionMatchCount = 0;

        for (int i = 0; i < groupTweens.Length; i++)
        {
            GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cube);
            Destroy(cube.GetComponent(typeof(BoxCollider)) as Component);
            cube.transform.position = new Vector3(0, 0, i * 3);
            cube.name      = "c" + i;
            groupGOs[i]    = cube;
            groupTweens[i] = LeanTween.move(cube, transform.position + Vector3.one * 3f, 0.6f).setOnComplete(groupTweenFinished);

            if (LeanTween.description(groupTweens[i].id).trans == groupTweens[i].trans)
            {
                descriptionMatchCount++;
            }
        }
        LeanTween.delayedCall(0.82f, groupTweensFinished);

        LeanTest.debug("GROUP IDS MATCH", descriptionMatchCount == groupTweens.Length);
        LeanTest.debug("MAX SEARCH OPTIMIZED", LeanTween.maxSearch <= groupTweens.Length + 5, "maxSearch:" + LeanTween.maxSearch);
        LeanTest.debug("SOMETHING IS TWEENING", LeanTween.isTweening() == true);

        // resume item before calling pause should continue item along it's way
        float previousXLT3 = cube3.transform.position.x;

        lt3 = LeanTween.moveX(cube3, 5.0f, 1.1f);
        lt3.resume();

        yield return(new WaitForEndOfFrame());

        yield return(new WaitForEndOfFrame());

        lt1.cancel();
        LeanTween.cancel(cube2);

        int tweenCount = 0;

        for (int i = 0; i < groupTweens.Length; i++)
        {
            if (LeanTween.isTweening(groupGOs[i]))
            {
                tweenCount++;
            }
            if (i % 3 == 0)
            {
                LeanTween.pause(groupGOs[i]);
            }
            else if (i % 3 == 1)
            {
                groupTweens[i].pause();
            }
            else
            {
                LeanTween.pause(groupTweens[i].id);
            }
        }
        LeanTest.debug("GROUP ISTWEENING", tweenCount == groupTweens.Length, "expected " + groupTweens.Length + " tweens but got " + tweenCount);

        LeanTest.debug("RESUME OUT OF ORDER", previousXLT3 != cube3.transform.position.x, "previousXLT3:" + previousXLT3 + " cube3.transform.position.x:" + cube3.transform.position.x);

        yield return(new WaitForEndOfFrame());

        tweenCount = 0;
        for (int i = 0; i < groupTweens.Length; i++)
        {
            if (i % 3 == 0)
            {
                LeanTween.resume(groupGOs[i]);
            }
            else if (i % 3 == 1)
            {
                groupTweens[i].resume();
            }
            else
            {
                LeanTween.resume(groupTweens[i].id);
            }

            if (i % 2 == 0 ? LeanTween.isTweening(groupTweens[i].id) : LeanTween.isTweening(groupGOs[i]))
            {
                tweenCount++;
            }
        }
        LeanTest.debug("GROUP RESUME", tweenCount == groupTweens.Length);

        LeanTest.debug("CANCEL TWEEN LTDESCR", LeanTween.isTweening(cube1) == false);
        LeanTest.debug("CANCEL TWEEN LEANTWEEN", LeanTween.isTweening(cube2) == false);

        Time.timeScale = 0.25f;
        float start = Time.realtimeSinceStartup;

        LeanTween.moveX(cube1, -5f, 0.2f).setOnComplete(() => {
            float end  = Time.realtimeSinceStartup;
            float diff = end - start;
            LeanTest.debug("SCALED TIMING diff:" + diff, Mathf.Abs(0.8f - diff) < 0.05f, "expected to complete in 0.8f but completed in " + diff);
            LeanTest.debug("SCALED ENDING POSITION", Mathf.Approximately(cube1.transform.position.x, -5f), "expected to end at -5f, but it ended at " + cube1.transform.position.x);
        });
    }
コード例 #8
0
ファイル: Poser.cs プロジェクト: rakjin/gesticulation
    public void StopMotion()
    {
        isPlayingAnimation = false;

        if (descrRootPosition != null)
        {
            descrRootPosition.cancel();
            descrRootPosition = null;
        }

        if (descrRootRotation != null)
        {
            descrRootRotation.cancel();
            descrRootRotation = null;
        }

        if (descrChest != null)
        {
            descrChest.cancel();
            descrChest = null;
        }

        if (descrNeck != null)
        {
            descrNeck.cancel();
            descrNeck = null;
        }

        if (descrHead != null)
        {
            descrHead.cancel();
            descrHead = null;
        }

        if (descrThighL != null)
        {
            descrThighL.cancel();
            descrThighL = null;
        }

        if (descrThighR != null)
        {
            descrThighR.cancel();
            descrThighR = null;
        }

        if (descrShinL != null)
        {
            descrShinL.cancel();
            descrShinL = null;
        }

        if (descrShinR != null)
        {
            descrShinR.cancel();
            descrShinR = null;
        }

        if (descrFootL != null)
        {
            descrFootL.cancel();
            descrFootL = null;
        }

        if (descrFootR != null)
        {
            descrFootR.cancel();
            descrFootR = null;
        }

        if (descrShoulderL != null)
        {
            descrShoulderL.cancel();
            descrShoulderL = null;
        }

        if (descrShoulderR != null)
        {
            descrShoulderR.cancel();
            descrShoulderR = null;
        }

        if (descrUpperArmL != null)
        {
            descrUpperArmL.cancel();
            descrUpperArmL = null;
        }

        if (descrUpperArmR != null)
        {
            descrUpperArmR.cancel();
            descrUpperArmR = null;
        }

        if (descrForearmL != null)
        {
            descrForearmL.cancel();
            descrForearmL = null;
        }

        if (descrForearmR != null)
        {
            descrForearmR.cancel();
            descrForearmR = null;
        }

        if (descrHandL != null)
        {
            descrHandL.cancel();
            descrHandL = null;
        }

        if (descrHandR != null)
        {
            descrHandR.cancel();
            descrHandR = null;
        }
    }