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]);
    }
Ejemplo n.º 3
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);
        }
    }