private void OnCGTweenGroupFinishendEvent(GameObject gameObj, bool isAutoJump)
    {
        TweenGroup tweenGroup = textureBackgroundScene.GetComponent <TweenGroup>();

        tweenGroup.TweenFinishedEvents -= OnCGTweenGroupFinishendEvent;
        mMustPlayEffect = false;
        SetText(talkList[curIndex]);
    }
예제 #2
0
    public static void SafeSetActive(this TweenGroup tweenGroup, bool active)
    {
        if (tweenGroup == null || tweenGroup.gameObject == null)
        {
            return;
        }

        tweenGroup.gameObject.SetActive(active);
    }
예제 #3
0
 /// <summary>
 /// This function should perform all necessary cleanup. It is expected that the [this.tween]
 /// reference will be NULL after this function completes.
 /// </summary>
 protected void cleanup()
 {
     if (group != null)
     {
         group.Stop();
         group.Release();
         group = null;
     }
 }
    public void Update()
    {
        if (mTaskCameraPlaying)
        {
            if (mTaskCameraAnimation != null && !mTaskCameraAnimation.IsPlaying(mTaskCameraAnimationName))
            {
                if (talkList[curIndex].effectIDTail > 0)
                {
                    ///设置 SpriteScenePreground效果的////
                    TweenGroupConfig tweenGroupConfig = Globals.Instance.MDataTableManager.GetConfig <TweenGroupConfig>();
                    if (tweenGroupConfig.IsPregroundGroup("SpriteScenePreground", talkList[curIndex].effectIDTail))
                    {
                        GameObject priorGameObj = Globals.Instance.MSceneManager.mTaskCamera.transform.Find("SpriteScenePreground").gameObject;
                        if (priorGameObj != null)
                        {
                            NGUITools.SetActive(priorGameObj, true);
                        }
                    }

                    TweenGroup tweenGroup = textureBackgroundScene.GetComponent <TweenGroup>();
                    if (tweenGroup == null)
                    {
                        tweenGroup = textureBackgroundScene.gameObject.AddComponent <TweenGroup>();
                    }
                    tweenGroup.setTweenGroupID(talkList[curIndex].effectIDTail);
                    tweenGroup.playTweenAnimation();
                    tweenGroup.TweenFinishedEvents += OnTweenGroupFinishendEvent;
                }
                else
                {
                    PressedButton(null);
                }

                mTaskCameraPlaying = false;
            }
        }

//		if (mSpeakering )
//		{
//
//			mSpeakerTime -= Time.deltaTime;
//			if (mSpeakerTime < 0.0f)
//			{
//				Animator animator = mCharacterCustomizeCurrent.getCharacterAnimator();
//				if (animator.layerCount > 2)
//				{
//					animator.SetInteger("index",0);
//				}
//				mSpeakering = false;
//			}
//		}
        return;
    }
    private void OnTweenGroupFinishendEvent(GameObject gameObj, bool isAutoJump)
    {
        TweenGroup tweenGroup = textureBackgroundScene.GetComponent <TweenGroup>();

        tweenGroup.TweenFinishedEvents -= OnTweenGroupFinishendEvent;

        mMustPlayEffect = false;
        if (isAutoJump)
        {
            PressedButton(null);
        }
    }
예제 #6
0
 void DrawTargetButtons(TweenInfo twInfo, TweenGroup twGroup)
 {
     if (GUILayout.Button(twGroup == TweenGroup.Running ? "Pause" : "Play", HOGUIStyle.BtTinyStyle, GUILayout.Width(45)))
     {
         if (twGroup == TweenGroup.Running)
         {
             twInfo.tween.Pause();
         }
         else
         {
             twInfo.tween.Play();
         }
     }
     if (GUILayout.Button("Kill", HOGUIStyle.BtTinyStyle, GUILayout.Width(32)))
     {
         twInfo.tween.Kill();
     }
 }
예제 #7
0
        // ===================================================================================
        // METHODS ---------------------------------------------------------------------------

        void DrawTarget(TweenInfo twInfo, object twTarget, TweenGroup twGroup, bool isSequenced)
        {
            GUILayout.BeginHorizontal();
            if (isSequenced)
            {
                GUILayout.Space(9);
            }
            if (GUILayout.Button(twTarget.ToString(), HOGUIStyle.BtLabelStyle))
            {
                SelectTargetGameObject(twTarget);
            }
            if (!isSequenced && twGroup != TweenGroup.Disabled)
            {
                DrawTargetButtons(twInfo, twGroup);
            }
            GUILayout.EndHorizontal();
            if (!isSequenced && twGroup != TweenGroup.Disabled)
            {
                DrawInfo(twInfo);
            }
        }
예제 #8
0
        protected void configureTween()
        {
            if (this.group == null)
            {
                this.group = (TweenGroup)
                             new TweenGroup()
                             .OnStarted((x) => { onStarted(); })
                             .OnStopped((x) => { onStopped(); })
                             .OnPaused((x) => { onPaused(); })
                             .OnResumed((x) => { onResumed(); })
                             .OnLoopCompleted((x) => { onLoopCompleted(); })
                             .OnCompleted((x) => { onCompleted(); });
            }

            group
            .ClearTweens()
            .SetMode(this.groupMode)
            .SetDelay(this.startDelay)
            .SetLoopType(this.loopType)
            .SetLoopCount(this.loopCount);

            for (int i = 0; i < tweens.Count; i++)
            {
                var tween = tweens[i];
                if (tween != null)
                {
                    tween.AutoRun = false;
                    var baseTween = tween.BaseTween;

                    if (baseTween == null)
                    {
                        Debug.LogError("Base tween not set", tween);
                    }
                    else
                    {
                        group.AppendTween(baseTween);
                    }
                }
            }
        }
예제 #9
0
    private void InitCameraTween()
    {
        float duration = 0.5f;

        mMoveCamTweenPos = Tween <Vector3> .Obtain()
                           .SetDuration(duration)
                           .OnExecute(pos =>
        {
            MoveCamTs.position = pos;
        });

        mMoveCamTweenRot = Tween <Vector3> .Obtain()
                           .SetDuration(duration)
                           .OnExecute(forward =>
        {
            MoveCamTs.forward = forward;
        });

        mCameraTween = new TweenGroup();
        mCameraTween.SetMode(TweenGroupMode.Concurrent);
        mCameraTween.AppendTween(mMoveCamTweenPos, mMoveCamTweenRot);
    }
예제 #10
0
    private void OnTweenGroupFinishedEvent(GameObject tweenGameObj, bool isAutoJump)
    {
        TweenGroup tweenGroup = tweenGameObj.GetComponent <TweenGroup>();

        tweenGroup.TweenFinishedEvents -= OnTweenGroupFinishedEvent;
        mShowNum--;
        Debug.Log("OnTweenGroupFinishedEvent mShowNum is :" + mShowNum);
        if (mShowNum == 0 && mShowBookNum == 0)
        {
            Debug.Log("OnTweenGroupFinishedEvent   mShowNum == 0 mCurTime is :" + mCurTime);
            if (DropFinishedEvents != null)
            {
                DropFinishedEvents(gameObject);
                DropFinishedEvents = null;
                GUISingleDrop guiSingleDrop = Globals.Instance.MGUIManager.GetGUIWindow <GUISingleDrop>();
                if (guiSingleDrop != null)
                {
                    guiSingleDrop.Close();
                }
            }
            Globals.Instance.MTeachManager.NewGUISingleDropFinishedEvent();
        }
        GameObject.DestroyObject(tweenGameObj);
    }
예제 #11
0
파일: TweenEngine.cs 프로젝트: sttz/Animate
 // Register a new tween group
 public void RegisterGroup(TweenGroup tweenGroup)
 {
     tweenGroup.Retain();
     _groups.Add(tweenGroup);
 }
    private void PressedButton(GameObject obj)
    {
        // tzz added
        // the talk list will be null if used in Teach scene
        // check TeachFirstEnterGame.cs for detail

        if (mTypewriterEffect == null)
        {
            return;
        }

        if (mTypewriterEffect.IsTypewriterIng())
        {
            mTypewriterEffect.FinishTypewriter();
            return;
        }

        if (mMustPlayEffect)
        {
            if (FinishedTipSprite.gameObject.active)
            {
                if (talkList[curIndex].effectIDTail > 0)
                {
                    ///设置 SpriteScenePreground效果的////
                    TweenGroupConfig tweenGroupConfig = Globals.Instance.MDataTableManager.GetConfig <TweenGroupConfig>();
                    if (tweenGroupConfig.IsPregroundGroup("SpriteScenePreground", talkList[curIndex].effectIDTail))
                    {
                        GameObject priorGameObj = Globals.Instance.MSceneManager.mTaskCamera.transform.Find("SpriteScenePreground").gameObject;
                        if (priorGameObj != null)
                        {
                            NGUITools.SetActive(priorGameObj, true);
                        }
                    }

                    TweenGroup tweenGroup = textureBackgroundScene.GetComponent <TweenGroup>();
                    if (tweenGroup == null)
                    {
                        tweenGroup = textureBackgroundScene.gameObject.AddComponent <TweenGroup>();
                    }
                    tweenGroup.setTweenGroupID(talkList[curIndex].effectIDTail);
                    tweenGroup.playTweenAnimation();
                    tweenGroup.TweenFinishedEvents += OnTweenGroupFinishendEvent;

                    NGUITools.SetActive(TaskDialogGameObject, false);
                }
            }
            return;
        }

        if (talkList == null || talkList.Count == 0 || curIndex >= talkList.Count || mAniPlayIng /*|| CurTask == null*/)
        {
            if (mForTZZDelegate != null)
            {
                mForTZZDelegate();
            }
            return;
        }
        //对话结束
        if (curIndex == talkList.Count - 1)
        {
            if (CurTask == null)
            {
//				DestroyThisGUI();
                if (mTalkCallBackDelegate != null)
                {
                    mTalkCallBackDelegate();
                    mTalkCallBackDelegate = null;
                }
                return;
            }
            int nCurTaskID = CurTask.Task_ID;

            if (!mClentTask)
            {
                if (!ProcessorTaskBefoeFinished(nCurTaskID))
                {
                    SendTaskMessage();
                }
            }

//			DestroyThisGUI();
            if (mTalkCallBackDelegate != null)
            {
                mTalkCallBackDelegate();
                mTalkCallBackDelegate = null;
            }

            if (GameStatusManager.Instance.MGameState == GameState.GAME_STATE_COPY)
            {
                GameStatusManager.Instance.MCurrentGameStatus.Resume();
            }

            //TalkAniOut();
            return;
        }
        else
        {
            if (talkList[curIndex].talkTpye == (int)TALKTYE.TALK4)
            {
                NGUITools.SetActive(TaskDialogGameObject, false);
                if (talkList[curIndex].effectIDTail > 0)
                {
                    ///设置 SpriteScenePreground效果的////
                    TweenGroupConfig tweenGroupConfig = Globals.Instance.MDataTableManager.GetConfig <TweenGroupConfig>();
                    if (tweenGroupConfig.IsPregroundGroup("SpriteScenePreground", talkList[curIndex].effectIDTail))
                    {
                        GameObject priorGameObj = Globals.Instance.MSceneManager.mTaskCamera.transform.Find("SpriteScenePreground").gameObject;
                        if (priorGameObj != null)
                        {
                            NGUITools.SetActive(priorGameObj, true);
                        }
                    }

                    TweenGroup tweenGroup = textureBackgroundScene.GetComponent <TweenGroup>();
                    if (tweenGroup == null)
                    {
                        tweenGroup = textureBackgroundScene.gameObject.AddComponent <TweenGroup>();
                    }
                    tweenGroup.setTweenGroupID(talkList[curIndex].effectIDTail);
                    tweenGroup.playTweenAnimation();
                    tweenGroup.TweenFinishedEvents += OnCGTweenGroupFinishendEvent;
                    mMustPlayEffect = true;
                    curIndex++;
                    return;
                }
            }

            curIndex++;
        }

        SetText(talkList[curIndex]);
    }
    public void OnEnable()
    {
        if( spriteTemplate == null )
            return;

        var radius = Camera.main.orthographicSize * 0.95f;
        var duration = 0.5f;

        TweenEasingCallback easingFunc = TweenEasingFunctions.EaseOutSine;

        for( int i = 0; i < SPRITE_COUNT; i++ )
        {

            var angle = Random.Range( 0.0f, Mathf.PI * 2f );
            var endPosition = new Vector3
            (
                Mathf.Cos( angle ) * radius,
                Mathf.Sin( angle ) * radius
            );

            var sprite = (GameObject)GameObject.Instantiate( spriteTemplate );
            sprite.hideFlags = HideFlags.HideInHierarchy;

            var animateOpacity = sprite.renderer
                .TweenAlpha()
                .SetDuration( duration )
                .SetEasing( easingFunc )
                .SetStartValue( 0f )
                .SetEndValue( 0.8f );

            var animateScale = sprite.transform
                .TweenScale()
                .SetDuration( duration )
                .SetEasing( easingFunc )
                .SetStartValue( Vector3.one * 0.25f )
                .SetEndValue( Vector3.one );

            var animatePosition = sprite.transform
                .TweenPosition()
                .SetDuration( duration )
                .SetEasing( easingFunc )
                .SetStartValue( Vector3.zero )
                .SetEndValue( endPosition );

            var concurrentGroup = new TweenGroup()
                .SetMode( TweenGroupMode.Concurrent )
                .AppendTween( animateOpacity, animateScale, animatePosition );

            var sequentialGroup = new TweenGroup()
                .SetMode( TweenGroupMode.Sequential )
                .AppendDelay( 255f / i )
                .AppendTween( concurrentGroup )
                .SetLoopType( TweenLoopType.Loop );

            tweens.Add( sequentialGroup );

            sequentialGroup.Play();

        }

        // There are three animations per sprite plus two tween groups
        DebugMessages.Add( (SPRITE_COUNT * 5) + " tweens created..." );

        if( pivot != null )
        {

            var animatePivot = pivot.transform
                .TweenRotation()
                .SetDuration( 10 )
                .SetStartValue( new Vector3( 0, -45, 0 ) )
                .SetEndValue( new Vector3( 0, 45, 0 ) )
                .SetLoopType( TweenLoopType.Pingpong );

            tweens.Add( animatePivot );

            animatePivot.Play();

        }
    }
예제 #14
0
    private void  playDropAnimationOne()
    {
        if (dropItemList.Count <= 0)
        {
            return;
        }

        DropItem dropItem = dropItemList[0];

        dropItemList.RemoveAt(0);
        if (dropItem.type == GUISingleDrop.ItemType.ITEM_ICON)
        {
            GameObject bodyPartObj = GameObject.Instantiate(DropItemIconPrefab) as GameObject;
            bodyPartObj.name = "DropItemPrefab";
            UILabel   dropText    = bodyPartObj.transform.Find("UILableGot").GetComponent <UILabel>();
            UILabel   dropNumText = bodyPartObj.transform.Find("UILableGotNum").GetComponent <UILabel>();
            UITexture dropTexture = bodyPartObj.transform.Find("Texture").GetComponent <UITexture>();
            UITexture backgrond   = bodyPartObj.transform.Find("SpriteBG").GetComponent <UITexture>();
            int       dorpItem    = (int)dropItem.obj;

            bool IsHas = mItemConfig.GetItemElement(dorpItem, out mElement);
            if (!IsHas)
            {
                return;
            }

            dropText.text    = GetPrName(TextItemName.ITEM) + " " + Globals.Instance.MDataTableManager.GetWordText(mElement.NameID);
            dropNumText.text = GUIFontColor.DarkBlue + " + " + dropItem.num.ToString();
            string texturePath = "Icon/ItemIcon/" + mElement.Icon;
            dropTexture.mainTexture             = Resources.Load(texturePath, typeof(Texture2D)) as Texture2D;
            bodyPartObj.transform.parent        = gameObject.transform;
            bodyPartObj.transform.localPosition = new Vector3(0, -600f, -3f);
            bodyPartObj.transform.localScale    = Vector3.one;
            TweenGroup tweenGroup = bodyPartObj.GetComponent <TweenGroup>();
            tweenGroup.playTweenAnimation();
            tweenGroup.TweenFinishedEvents += OnTweenGroupFinishedEvent;
            backgrond.material.color        = StrParser.ParseColor(dropItem.BGSpriteColor);
        }
        else if (dropItem.type == GUISingleDrop.ItemType.MONEY_ICON)
        {
            GameObject bodyPartObj = GameObject.Instantiate(DropItemCommonIconPrefab) as GameObject;
            bodyPartObj.name = "DropItemPrefab";
            UILabel   dropText      = bodyPartObj.transform.Find("UILableContent").GetComponent <UILabel>();
            UILabel   dropCountText = bodyPartObj.transform.Find("UILableCount").GetComponent <UILabel>();
            UISprite  dropTexture   = bodyPartObj.transform.Find("Texture").GetComponent <UISprite>();
            UITexture backgrond     = bodyPartObj.transform.Find("SpriteBG").GetComponent <UITexture>();
            dropText.text = (string)dropItem.obj;
            if (-1 != dropItem.CharacterSize)
            {
                dropText.transform.localScale = new Vector3(dropItem.CharacterSize, dropItem.CharacterSize, dropText.transform.localScale.z);
            }
            if (-1 != dropItem.MaxLeft)
            {
                dropText.transform.localPosition = new Vector3(dropText.transform.localPosition.x + dropItem.MaxLeft, dropText.transform.localPosition.y, dropText.transform.localPosition.z);
            }
            dropTexture.spriteName              = dropItem.spritename;
            dropCountText.text                  = GUIFontColor.DarkBlue + " + " + dropItem.num.ToString();
            bodyPartObj.transform.parent        = gameObject.transform;
            bodyPartObj.transform.localPosition = new Vector3(0, -600f, -3f);
            bodyPartObj.transform.localScale    = Vector3.one;
            TweenGroup tweenGroup = bodyPartObj.GetComponent <TweenGroup>();
            tweenGroup.playTweenAnimation();
            tweenGroup.TweenFinishedEvents += OnTweenGroupFinishedEvent;
            backgrond.material.color        = StrParser.ParseColor(dropItem.BGSpriteColor);
        }
        else if (dropItem.type == GUISingleDrop.ItemType.SELF_TEXTURE)
        {
            GameObject bodyPartObj = GameObject.Instantiate(DropItemIconPrefab) as GameObject;
            bodyPartObj.name = "DropItemPrefab";
            UILabel   dropText    = bodyPartObj.transform.Find("UILableGot").GetComponent <UILabel>();
            UILabel   dropNumText = bodyPartObj.transform.Find("UILableGotNum").GetComponent <UILabel>();
            UITexture dropTexture = bodyPartObj.transform.Find("Texture").GetComponent <UITexture>();
            UITexture backgrond   = bodyPartObj.transform.Find("SpriteBG").GetComponent <UITexture>();
            dropText.text = (string)dropItem.obj;

            dropNumText.text = GUIFontColor.DarkBlue + " + " + dropItem.num.ToString();

            dropTexture.mainTexture             = Resources.Load(dropItem.spritename, typeof(Texture2D)) as Texture2D;
            bodyPartObj.transform.parent        = gameObject.transform;
            bodyPartObj.transform.localPosition = new Vector3(0, -600f, -3f);
            bodyPartObj.transform.localScale    = Vector3.one;
            TweenGroup tweenGroup = bodyPartObj.GetComponent <TweenGroup>();
            tweenGroup.playTweenAnimation();
            tweenGroup.TweenFinishedEvents += OnTweenGroupFinishedEvent;
            backgrond.material.color        = StrParser.ParseColor(dropItem.BGSpriteColor);
        }
        else
        {
            GameObject bodyPartObj = GameObject.Instantiate(DropItemPrefab) as GameObject;
            bodyPartObj.name = "DropItemPrefab";
            UILabel   dropText  = bodyPartObj.transform.Find("UILable").GetComponent <UILabel>();
            UITexture backgrond = bodyPartObj.transform.Find("SpriteBG").GetComponent <UITexture>();
            dropText.text = (string)dropItem.obj;
            bodyPartObj.transform.parent        = gameObject.transform;
            bodyPartObj.transform.localPosition = new Vector3(0, -600f, -3f);
            bodyPartObj.transform.localScale    = Vector3.one;
            TweenGroup tweenGroup = bodyPartObj.GetComponent <TweenGroup>();
            tweenGroup.playTweenAnimation();
            tweenGroup.TweenFinishedEvents += OnTweenGroupFinishedEvent;
            backgrond.material.color        = StrParser.ParseColor(dropItem.BGSpriteColor);
        }
    }
예제 #15
0
 void DrawTargetButtons(TweenInfo twInfo, TweenGroup twGroup)
 {
     if (GUILayout.Button(twGroup == TweenGroup.Running ? "Pause" : "Play", HOGUIStyle.BtTinyStyle, GUILayout.Width(45))) {
         if (twGroup == TweenGroup.Running) {
             twInfo.tween.Pause();
         } else {
             twInfo.tween.Play();
         }
     }
     if (GUILayout.Button("Kill", HOGUIStyle.BtTinyStyle, GUILayout.Width(32))) {
         twInfo.tween.Kill();
     }
 }
예제 #16
0
        // ===================================================================================
        // METHODS ---------------------------------------------------------------------------

        void DrawTarget(TweenInfo twInfo, object twTarget, TweenGroup twGroup, bool isSequenced)
        {
            GUILayout.BeginHorizontal();
            if (isSequenced) GUILayout.Space(9);
            if (GUILayout.Button(twTarget.ToString(), HOGUIStyle.BtLabelStyle)) {
                SelectTargetGameObject(twTarget);
            }
            if (!isSequenced && twGroup != TweenGroup.Disabled) {
                DrawTargetButtons(twInfo, twGroup);
            }
            GUILayout.EndHorizontal();
            if (!isSequenced && twGroup != TweenGroup.Disabled) {
                DrawInfo(twInfo);
            }
        }