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 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]);
    }
예제 #3
0
    public void playTweenAnimation()
    {
        TweenGroupConfig tweenGroupConfig = Globals.Instance.MDataTableManager.GetConfig <TweenGroupConfig>();

        TweenGroupConfig.TweenGroupObject tweenGpObj;
        tweenGroupConfig.GetItemElement(TweenGroupID, out tweenGpObj);
        mTweenGroupObject = tweenGpObj;
        for (int i = 0; i < tweenGpObj.TweenCellInfoList.Count; i++)
        {
            TweenGroupConfig.TweenCellInfo cellInfo = tweenGpObj.TweenCellInfoList[i];
            if (cellInfo.TweenName == "TweenPosition")
            {
                GameObject tweenObj;
                if (cellInfo.TweenGameObject != "")
                {
                    tweenObj = GameObject.Find(cellInfo.TweenGameObject);
                }
                else
                {
                    tweenObj = gameObject;
                }
                if (tweenObj == null)
                {
                    continue;
                }

                if (cellInfo.TweenValueType == (int)TweenValueType.VECTOR3)
                {
                    Vector3 toPosition = StrParser.ParseVec3(cellInfo.TweenValueTo);
                    toPosition += gameObject.transform.localPosition;
                    TweenPosition tweenPosition = TweenPosition.Begin(tweenObj, cellInfo.TweenDuration, toPosition);
                    if (cellInfo.StartTime > 0)
                    {
                        tweenPosition.delay = cellInfo.StartTime;
                    }
                    EventDelegate.Add(tweenPosition.onFinished, onCellTweenFinished);
                    mTweenCellCount++;
                }
            }
            else if (cellInfo.TweenName == "TweenAlpha")
            {
                GameObject tweenObj;
                if (cellInfo.TweenGameObject != "")
                {
                    tweenObj = GameObject.Find(cellInfo.TweenGameObject);
                }
                else
                {
                    tweenObj = gameObject;
                }
                if (cellInfo.TweenValueType == (int)TweenValueType.FLOAT)
                {
                    float      toValue    = StrParser.ParseFloat(cellInfo.TweenValueTo, 0);
                    TweenAlpha tweenAlpha = TweenAlpha.Begin(tweenObj, cellInfo.TweenDuration, toValue);
                    tweenAlpha.from = StrParser.ParseFloat(cellInfo.TweenValueFrom, 0);
                    if (cellInfo.StartTime > 0)
                    {
                        tweenAlpha.delay = cellInfo.StartTime;
                    }
                    EventDelegate.Add(tweenAlpha.onFinished, onCellTweenFinished);
                    mTweenCellCount++;
                }
            }
            else if (cellInfo.TweenName == "Shake")
            {
                GameObject tweenObj;
                if (cellInfo.TweenGameObject != "")
                {
                    tweenObj = GameObject.Find(cellInfo.TweenGameObject);
                }
                else
                {
                    tweenObj = gameObject;
                }

                iTween.ShakePosition(tweenObj, new Vector3(20, 20, 0), 1, delegate(){
                    onCellTweenFinished();
                });

                mTweenCellCount++;
            }
        }
    }