コード例 #1
0
    public void ShowFriendsList(sg.GS2C_Task_Invite_List_Res res)
    {
        mTaskInviteList = res;
        this.SetVisible(true);
        NGUITools.SetActive(MissionView, false);
        NGUITools.SetActive(FriendsView, true);

        taskID = res.taskId;
        UILabel MissionName = FriendsView.transform.Find("MissionName").gameObject.transform.Find("MissionNameLabel").GetComponent <UILabel>();
        Task    tk          = Globals.Instance.MDataTableManager.GetConfig <Task>();

        Task.TaskObject element = null;
        bool            hasData = tk.GetTaskObject(res.taskId, out element);

        if (!hasData)
        {
            return;
        }
        MissionName.text = element.Name;
        HelpUtil.DelListInfo(FriendGrid.transform);

        foreach (sg.GS2C_Task_Invite_List_Res.canInviteFriend friend in res.friendLis)
        {
            GameObject obj = GameObject.Instantiate(FriendItem) as GameObject;
            obj.transform.parent        = FriendGrid.transform;
            obj.transform.localScale    = Vector3.one;
            obj.transform.localPosition = new Vector3(0, 0, -5);

            if (friend.friendType == (int)JobManager.InviteType.Pet)
            {
                obj.name = "AA" + friend.friendType;
            }
            else if (friend.friendType == (int)JobManager.InviteType.NPC)
            {
                obj.name = "BB" + friend.friendType;
            }
            else if (friend.friendType == (int)JobManager.InviteType.FRIEND)
            {
                obj.name = "CC" + friend.friendType;
            }
            else if (friend.friendType == (int)JobManager.InviteType.NEARBY)
            {
                obj.name = "DD" + friend.friendType;
            }

            GameObject AllLabel        = obj.transform.Find("AllLabel").gameObject;
            GameObject Details         = obj.transform.Find("Tween").transform.Find("GameObject").transform.Find("Details").gameObject;
            UITexture  FriendIcon      = AllLabel.transform.Find("FriendIcon").GetComponent <UITexture>();
            UILabel    NameLabel       = AllLabel.transform.Find("NameLabel").GetComponent <UILabel>();
            UIButton   AddFriendButton = AllLabel.transform.Find("AddFriendButton").GetComponent <UIButton>();
            UIButton   CheckButton     = AllLabel.transform.Find("CheckButton").GetComponent <UIButton>();
            UISprite   mFriendSign     = AllLabel.transform.Find("Friendsign").GetComponent <UISprite>();
            UILabel    FriendshipLabel = AllLabel.transform.Find("FriendshipLabel").GetComponent <UILabel>();

            UIEventListener.Get(AddFriendButton.gameObject).onClick += OnClickAddFriendButton;
            UIEventListener.Get(CheckButton.gameObject).onClick     += OnClickCheckButton;

            UILabel ActingLabel = Details.transform.Find("ActingLabel").GetComponent <UILabel>();
            UILabel FansLabel   = Details.transform.Find("FansLabel").GetComponent <UILabel>();
            if (friend.friendType == (int)JobManager.InviteType.Pet)
            {
                PetInfoMation PetInfo = Globals.Instance.MGameDataManager.MActorData.PetInfo;
                ActingLabel.text = (PetInfo.baseActing + PetInfo.incActing).ToString();
                FansLabel.text   = "0";
                NameLabel.text   = PetInfo.petName;
                NGUITools.SetActive(AddFriendButton.gameObject, false);
                NGUITools.SetActive(mFriendSign.gameObject, false);
                FriendshipLabel.text   = "10";
                AddFriendButton.Data   = friend;
                CheckButton.Data       = friend;
                FriendIcon.mainTexture = Resources.Load("Icon/AvatarIcon/Npc12001", typeof(Texture2D)) as Texture2D;
            }
            else
            {
                ActingLabel.text = friend.actSkill.ToString();
                FansLabel.text   = friend.fans.ToString();
                NameLabel.text   = friend.friendName;
                if (friend.friendType == (int)JobManager.InviteType.NEARBY)
                {
                    NGUITools.SetActive(AddFriendButton.gameObject, true);
                    NGUITools.SetActive(mFriendSign.gameObject, false);
                    FriendshipLabel.text = "5";
                }
                else
                {
                    NGUITools.SetActive(AddFriendButton.gameObject, false);
                    NGUITools.SetActive(mFriendSign.gameObject, true);
                    FriendshipLabel.text = "10";
                }
                AddFriendButton.Data = friend;
                CheckButton.Data     = friend;
                if (friend.friendIcon != "")
                {
                    FriendIcon.mainTexture = Resources.Load("Icon/AvatarIcon/" + friend.friendIcon, typeof(Texture2D)) as Texture2D;
                }
            }

            UIButton NextButton = obj.transform.Find("Tween").transform.Find("GameObject").transform.Find("NextButton").GetComponent <UIButton>();
            NextButton.Data = friend;
            UIEventListener.Get(NextButton.gameObject).onClick += OnClickNextButton;
            NGUITools.SetActive(obj.transform.Find("Tween").gameObject, false);

            UISprite cost  = NextButton.gameObject.transform.Find("Sprite").GetComponent <UISprite>();
            UILabel  label = NextButton.gameObject.transform.Find("Label").GetComponent <UILabel>();
            if (friend.friendType != (int)JobManager.InviteType.FRIEND && friend.friendType != (int)JobManager.InviteType.NEARBY)
            {
                NPCConfig           Config = Globals.Instance.MDataTableManager.GetConfig <NPCConfig>();
                NPCConfig.NPCObject NpcObj = null;
                bool isHas = Config.GetNPCObject((int)friend.friendId, out NpcObj);
                if (!isHas)
                {
                    NGUITools.SetActive(cost.gameObject, false);
                    label.transform.localPosition = Vector3.zero;
                    continue;
                }

                if (NpcObj.Cost_Money != -1)
                {
                    cost.spriteName = "IconJinqian";
                }
                else if (NpcObj.Cost_Ingot != -1)
                {
                    cost.spriteName = "IconZuanshi";
                }
                else
                {
                    NGUITools.SetActive(cost.gameObject, false);
                    label.transform.localPosition = Vector3.zero;
                }
            }
        }
        FriendGrid.repositionNow = true;
    }
コード例 #2
0
    private void OnClickNextButton(GameObject obj)
    {
        UIButton btn = obj.transform.GetComponent <UIButton>();

        sg.GS2C_Task_Invite_List_Res.canInviteFriend friend = (sg.GS2C_Task_Invite_List_Res.canInviteFriend)btn.Data;
        StorageFriendInfo friendInfo = new StorageFriendInfo();

        friendInfo.friendId         = friend.friendId;
        friendInfo.friendType       = friend.friendType;
        friendInfo.friendGender     = friend.friendGender;
        friendInfo.friednAppearance = friend.friednAppearance;
        if (friend.friendType == (int)JobManager.InviteType.Pet)
        {
            friendInfo.friendCloth = Globals.Instance.MGameDataManager.MActorData.PetInfo.itemId.ToString();
        }
        else
        {
            friendInfo.friendCloth = friend.friendCloth;
        }
        friendInfo.friendActing = friend.actSkill;
        Globals.Instance.MTaskManager.mTaskDailyData.FriendInfo = friendInfo;

        NPCConfig Config = Globals.Instance.MDataTableManager.GetConfig <NPCConfig>();

        NPCConfig.NPCObject NpcObj = null;
        bool isHas = Config.GetNPCObject((int)friend.friendId, out NpcObj);

        if (!isHas)
        {
            NetSender.Instance.RequestTaskInviteReq(taskID, (int)friend.friendId, friend.friendType);
            return;
        }
        if (friend.friendType != (int)JobManager.InviteType.FRIEND && friend.friendType != (int)JobManager.InviteType.NEARBY)
        {
            if (NpcObj.Cost_Money != -1)
            {
                Globals.Instance.MGUIManager.CreateGUIDialog(delegate(GUIDialog gui){
                    gui.SetTextAnchor(ETextAnchor.MiddleLeft, false);
                    gui.SetDialogType(EDialogType.CommonType, null);
                    string flag = string.Format(Globals.Instance.MDataTableManager.GetWordText(4014), NpcObj.Cost_Money, Globals.Instance.MDataTableManager.GetWordText(4015));
                    gui.SetText(flag);
                }, EDialogStyle.DialogOkCancel, delegate() {
                    NetSender.Instance.RequestTaskInviteReq(taskID, (int)friend.friendId, friend.friendType);
                });
            }
            else if (NpcObj.Cost_Ingot != -1)
            {
                Globals.Instance.MGUIManager.CreateGUIDialog(delegate(GUIDialog gui){
                    gui.SetTextAnchor(ETextAnchor.MiddleLeft, false);
                    gui.SetDialogType(EDialogType.CommonType, null);
                    string flag = string.Format(Globals.Instance.MDataTableManager.GetWordText(4014), NpcObj.Cost_Ingot, Globals.Instance.MDataTableManager.GetWordText(4016));
                    gui.SetText(flag);
                }, EDialogStyle.DialogOkCancel, delegate() {
                    NetSender.Instance.RequestTaskInviteReq(taskID, (int)friend.friendId, friend.friendType);
                });
            }
            else
            {
                NetSender.Instance.RequestTaskInviteReq(taskID, (int)friend.friendId, friend.friendType);
            }
        }
    }
コード例 #3
0
    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);
            }
        }
    }