Пример #1
0
 public void UpdateData(TaskDialogConfig.TaskDialogObject talkObject)
 {
     //TaskDialogConfig taskDialogConfig = Globals.Instance.MDataTableManager.GetConfig<TaskDialogConfig>();
     //Dictionary<int, string> mTaskDialogDic;
     //taskDialogConfig.GeTTaskDialogDic(out mTaskDialogDic);
     //
     //string strsrc = mTaskDialogDic[talkObject.DialogID];
     //CreateText(strsrc, mLeaveTime, true, true);
 }
Пример #2
0
 public void UpdateData(TaskDialogConfig.TaskDialogObject talkObject)
 {
     time = mLeaveTime;
 }
    private void SetText(TaskDialogConfig.TaskDialogObject talkInfo)
    {
        HelpUtil.HideListInfo(textureBackgroundScene.transform, true);
        if (mModelScene != null)
        {
            GameObject.DestroyObject(mModelScene);
        }

        if (mDialogSoundSource != null)
        {
            mDialogSoundSource.Stop();
        }

        Globals.Instance.MSceneManager.mTaskCameramControl.transform.localPosition    = new Vector3(0, 0, 0);
        Globals.Instance.MSceneManager.mTaskCameramControl.transform.localEulerAngles = Vector3.zero;


        NGUITools.SetActive(TaskDialogGameObject, true);
        NGUITools.SetActive(FinishedTipSprite.gameObject, false);
        NGUITools.SetActive(SkipBtn.gameObject, false);
        NGUITools.SetActive(npcIcon.transform.parent.gameObject, false);

        UIWidget uiWidget = textureBackgroundScene.GetComponentInChildren <UIWidget>();
        UIPanel  uiPanel  = textureBackgroundScene.GetComponent <UIPanel>();

        uiWidget.alpha = 1f;
        uiPanel.alpha  = 1f;

        string atlasPath = "UIAtlas/" + talkInfo.talkBgPicture;

        textureBackgroundScene.mainTexture = Resources.Load(atlasPath, typeof(Texture2D)) as Texture2D;
        Globals.Instance.MSoundManager.PlaySceneSound(talkInfo.talkBgPicture);


        mMustPlayEffect = false;
//     effectIDHead 淡入淡出效果 没用到
//		if (talkList[curIndex].effectIDHead > 0 && mHeadEffected == false)
//		{
//			mMustPlayEffect = true;
//			NGUITools.SetActive(TaskDialogGameObject,false);
//
//			if (talkInfo.talkTpye == (int)TALKTYE.TALK1)
//			{
//				if (talkInfo.girlID1 == 0 && talkInfo.girlID2 < 0 )
//				{
//					NGUITools.SetActive(mCharacterCustomizeOne.gameObject,true);
//					NGUITools.SetActive(mCharacterCustomizeNPC.gameObject,false);
//					mCharacterCustomizeCurrent = mCharacterCustomizeOne;
//					mCharacterCustomizeOne.setAnimationOneState(true);
//					mCharacterCustomizeOne.changeCharacterAnimationController(talkInfo.girlAnimation1);
//					mCharacterCustomizeOne.transform.position = Avatar_Position_One[0];
//					mCharacterCustomizeOne.transform.localEulerAngles = Avatar_ROTATION_One[0];
//				}
//				else if (talkInfo.girlID2 != 0 && talkInfo.girlID1 < 0)
//				{
//					if(talkInfo.girlID2 == 9999)
//					{
//						NGUITools.SetActive(mCharacterCustomizeOne.gameObject,false);
//						NGUITools.SetActive(mCharacterCustomizeNPC.gameObject,false);
//
//						npcIcon.mainTexture = Resources.Load("UIAtlas/" + talkInfo.girlAnimation2,typeof(Texture2D)) as Texture2D;
//						NGUITools.SetActive(npcIcon.transform.parent.gameObject , true);
//					}
//					else
//					{
//						NGUITools.SetActive(mCharacterCustomizeOne.gameObject,false);
//						NGUITools.SetActive(mCharacterCustomizeNPC.gameObject,true);
//						mCharacterCustomizeCurrent = mCharacterCustomizeNPC;
//						NPCConfig npcConfig = Globals.Instance.MDataTableManager.GetConfig<NPCConfig>();
//						NPCConfig.NPCObject npcObject ;
//						npcConfig.GetNPCObject(talkInfo.girlID2,out npcObject);
//						mCharacterCustomizeNPC.ResetCharacter();
//						mCharacterCustomizeNPC.generateCharacterFromConfig(npcObject.NPCGender,"D0101",npcObject.NpcAppearance,npcObject.NpcEquips);
//						mCharacterCustomizeNPC.setAnimationOneState(true);
//						mCharacterCustomizeNPC.changeCharacterAnimationController(talkInfo.girlAnimation2);
//						if (npcObject.NPCGender == (int)PlayerGender.GENDER_DOG)
//						{
//							mCharacterCustomizeNPC.transform.position = Avatar_Position_One[2];
//							mCharacterCustomizeNPC.transform.localEulerAngles = Avatar_ROTATION_One[2];
//						}
//						else
//						{
//							mCharacterCustomizeNPC.transform.position = Avatar_Position_One[1];
//							mCharacterCustomizeNPC.transform.localEulerAngles = Avatar_ROTATION_One[1];
//						}
//					}
//				}
//			}
//
//			///设置 SpriteScenePreground效果的////
//			TweenGroupConfig tweenGroupConfig = Globals.Instance.MDataTableManager.GetConfig<TweenGroupConfig>();
//			if (tweenGroupConfig.IsPregroundGroup("SpriteScenePreground",talkList[curIndex].effectIDHead))
//			{
//				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].effectIDHead);
//			tweenGroup.playTweenAnimation();
//			tweenGroup.TweenFinishedEvents += OnHeadTweenGroupFinishendEvent;
//			return;
//		}

        if (talkList[curIndex].effectIDTail > 0)
        {
            mMustPlayEffect = true;
        }

        ///无女孩模型的对话//
        if (talkInfo.talkTpye == (int)TALKTYE.TALK3)
        {
            TalkTimes = 0;
            string text = getTaskTalkContent(talkInfo.talkContent);
            string icon = "";
            int    type = talkInfo.talkTpye;
            mSpeaker.text = getSpeakerName(talkInfo.talkCaptionName);
            SetText(text, icon, type, talkInfo.talkMusic);
//			NGUITools.SetActive(mCharacterCustomizeOne.gameObject,false);
            SetActive(mCharacterCustomizeOne, false);
//			NGUITools.SetActive(mCharacterCustomizeNPC.gameObject,false);
            SetActive(mCharacterCustomizeNPC, false);
        }
        ///一个女孩模型的对话//
        else if (talkInfo.talkTpye == (int)TALKTYE.TALK1)
        {
            if (talkInfo.girlID1 >= 0 && talkInfo.girlID2 < 0)
            {
                if (talkInfo.girlID1 == 9999)
                {
//					NGUITools.SetActive(mCharacterCustomizeOne.gameObject,false);
                    SetActive(mCharacterCustomizeOne, false);
//					NGUITools.SetActive(mCharacterCustomizeNPC.gameObject,false);
                    SetActive(mCharacterCustomizeNPC, false);
                    npcIcon.mainTexture = Resources.Load("UIAtlas/" + talkInfo.girlAnimation1, typeof(Texture2D)) as Texture2D;
                    NGUITools.SetActive(npcIcon.transform.parent.gameObject, true);
                }
                else
                {
                    TalkTimes++;
                    mCharacterCustomizeOne.transform.localPosition = new Vector3(-0.05f, -0.3f, -5.0f);
//					NGUITools.SetActive(mCharacterCustomizeOne.gameObject,true);
//					NGUITools.SetActive(mCharacterCustomizeNPC.gameObject,false);
                    SetActive(mCharacterCustomizeOne, true);
                    SetActive(mCharacterCustomizeNPC, false);
                    mCharacterCustomizeCurrent = mCharacterCustomizeOne;
                    mCharacterCustomizeOne.setAnimationOneState(true);
//					if(TalkTimes>=2)
//					{
//						PlayerData playerData =  Globals.Instance.MGameDataManager.MActorData;
//						mCharacterCustomizeOne.ResetCharacter();
//						mCharacterCustomizeOne.generageCharacterFormPlayerData(playerData);
//					}
                    mCharacterCustomizeOne.changeCharacterAnimationController(talkInfo.girlAnimation1);
                    mCharacterCustomizeOne.transform.position         = Avatar_Position_One[0];
                    mCharacterCustomizeOne.transform.localEulerAngles = Avatar_ROTATION_One[0];
                }
            }
            if (talkInfo.girlID1 < 0 && talkInfo.girlID2 > 0)
            {
                TalkTimes = 0;
                if (talkInfo.girlID2 == 9999)
                {
//					NGUITools.SetActive(mCharacterCustomizeOne.gameObject,false);
//					NGUITools.SetActive(mCharacterCustomizeNPC.gameObject,false);
                    SetActive(mCharacterCustomizeOne, false);
                    SetActive(mCharacterCustomizeNPC, false);
                    npcIcon.mainTexture = Resources.Load("UIAtlas/" + talkInfo.girlAnimation2, typeof(Texture2D)) as Texture2D;
                    NGUITools.SetActive(npcIcon.transform.parent.gameObject, true);
                }
                else
                {
                    mCharacterCustomizeOne.transform.localPosition = new Vector3(2.0f, -0.3f, -5.0f);
//					NGUITools.SetActive(mCharacterCustomizeNPC.gameObject,true);
                    SetActive(mCharacterCustomizeNPC, true);
                    mCharacterCustomizeCurrent = mCharacterCustomizeNPC;
                    NPCConfig           npcConfig = Globals.Instance.MDataTableManager.GetConfig <NPCConfig>();
                    NPCConfig.NPCObject npcObject;
                    npcConfig.GetNPCObject(talkInfo.girlID2, out npcObject);
                    mCharacterCustomizeNPC.ResetCharacter();
                    mCharacterCustomizeNPC.generateCharacterFromConfig(npcObject.NPCGender, "D0101", npcObject.NpcAppearance, npcObject.NpcEquips);
                    mCharacterCustomizeNPC.setAnimationOneState(true);
                    mCharacterCustomizeNPC.changeCharacterAnimationController(talkInfo.girlAnimation2);
                    if (npcObject.NPCGender == (int)PlayerGender.GENDER_DOG)
                    {
                        mCharacterCustomizeNPC.transform.position         = Avatar_Position_One[2];
                        mCharacterCustomizeNPC.transform.localEulerAngles = Avatar_ROTATION_One[2];
                    }
                    else
                    {
                        mCharacterCustomizeNPC.transform.position         = Avatar_Position_One[1];
                        mCharacterCustomizeNPC.transform.localEulerAngles = Avatar_ROTATION_One[1];
                    }
                }
            }
            if (talkInfo.girlID1 < 0)
            {
//				NGUITools.SetActive(mCharacterCustomizeOne.gameObject,false);
                SetActive(mCharacterCustomizeOne, false);
            }
            if (talkInfo.girlID2 < 0)
            {
//				NGUITools.SetActive(mCharacterCustomizeNPC.gameObject,false);
                SetActive(mCharacterCustomizeNPC, false);
            }

            string text = getTaskTalkContent(talkInfo.talkContent);
            string icon = "";
            int    type = talkInfo.talkTpye;
            mSpeaker.text = getSpeakerName(talkInfo.talkCaptionName);
            SetText(text, icon, type, talkInfo.talkMusic);
            string meStr = Globals.Instance.MDataTableManager.GetWordText(4001);
            if (talkInfo.talkCaptionName != meStr && talkInfo.talkCaptionName != "")
            {
                characterCustomizeSpeakState(true);
            }
            else
            {
                characterCustomizeSpeakState(false);
            }
        }
        ///CG对话//
        else if (talkInfo.talkTpye == (int)TALKTYE.TALK4)
        {
            NGUITools.SetActive(TaskDialogGameObject, false);
            mCharacterCustomizeOne.ResetCharacter();

            if (talkList[curIndex].effectIDTail > 0)
            {
                mMustPlayEffect = false;
            }
        }
        ///特写对话//
        else if (talkInfo.talkTpye == (int)TALKTYE.TALK5)
        {
            NGUITools.SetActive(TaskDialogGameObject, false);
//			NGUITools.SetActive(mMaskLayer.gameObject,false);

            uiWidget.alpha = 0.0f;
            uiPanel.alpha  = 0.0f;

            if (talkInfo.talkModlePrefab != "")
            {
                Object aModelSceneObj = Resources.Load("Scene/Prefabs/" + talkInfo.talkModlePrefab, typeof(Object)) as Object;
                mModelScene = GameObject.Instantiate(aModelSceneObj, Vector3.one, Quaternion.identity) as GameObject;
            }

            if (talkInfo.girlID1 > 0)
            {
//				NGUITools.SetActive(mCharacterCustomizeOne.gameObject,false);
                SetActive(mCharacterCustomizeOne, false);
                if (talkInfo.girlID1 == 9999)
                {
                }
                else
                {
//					NGUITools.SetActive(mCharacterCustomizeNPC.gameObject,true);
                    SetActive(mCharacterCustomizeNPC, true);
                    mCharacterCustomizeCurrent = mCharacterCustomizeNPC;
                    NPCConfig           npcConfig = Globals.Instance.MDataTableManager.GetConfig <NPCConfig>();
                    NPCConfig.NPCObject npcObject;
                    npcConfig.GetNPCObject(talkInfo.girlID1, out npcObject);
                    mCharacterCustomizeNPC.generateCharacterFromConfig(npcObject.NPCGender, "D0101", npcObject.NpcAppearance, npcObject.NpcEquips);
                    mCharacterCustomizeNPC.setAnimationOneState(true);
                    mCharacterCustomizeNPC.changeCharacterAnimationController(talkInfo.girlAnimation1);
                }
            }
            else if (talkInfo.girlID1 == 0)
            {
//				NGUITools.SetActive(mCharacterCustomizeOne.gameObject,true);
//				NGUITools.SetActive(mCharacterCustomizeNPC.gameObject,false);
                SetActive(mCharacterCustomizeOne, true);
                SetActive(mCharacterCustomizeNPC, false);
                mCharacterCustomizeCurrent = mCharacterCustomizeOne;
                mCharacterCustomizeOne.setAnimationOneState(true);
                mCharacterCustomizeOne.changeCharacterAnimationController(talkInfo.girlAnimation1);
            }


            mTaskCameraAnimation = Globals.Instance.MSceneManager.mTaskCamera.gameObject.GetComponent <Animation>();
            mTaskCameraAnimation.Play(getTaskTalkContent(talkInfo.talkContent));
            mTaskCameraAnimationName = getTaskTalkContent(talkInfo.talkContent);
            mTaskCameraPlaying       = true;
            NGUITools.SetActive(SkipBtn.gameObject, true);
        }

        if (talkInfo.MoodBG1 != null && !talkInfo.MoodBG1.Equals(""))
        {
            if (middleMoodsDic.ContainsKey(talkInfo.MoodBG1))
            {
                middleMoodsDic[talkInfo.MoodBG1].SetActive(true);
            }
            else
            {
                GameObject moodObj  = Resources.Load("Prefabs/" + talkInfo.MoodBG1, typeof(GameObject)) as GameObject;
                GameObject moodObj2 = GameObject.Instantiate(moodObj, Vector3.one, Quaternion.identity) as GameObject;
                moodObj2.transform.SetParent(textureBackgroundScene.transform, false);
                //			Globals.Instance.MSceneManager.SetMoodPosion(moodObj2.transform,GameEnumManager.MoodBGType.middle);
                middleMoodsDic.Add(talkInfo.MoodBG1, moodObj2);
            }
        }
    }