Ejemplo n.º 1
0
    public void Show(int side, uint id, string text, float delay = 5f)
    {
        for (int i = 0; i < 2; ++i)
        {
            NGUITools.SetActive(dialogs[i].gameObject, i == side);
        }

        uint          shapeID    = 0;
        string        icon       = "";
        string        name       = "";
        RoleBaseData2 baseConfig = GameSystem.Instance.RoleBaseConfigData2.GetConfigData(id);

        if (baseConfig != null)
        {
            shapeID = (uint)baseConfig.shape;
            icon    = baseConfig.icon_bust;
            name    = baseConfig.name;
        }
        else
        {
            NPCConfig npcConfig = GameSystem.Instance.NPCConfigData.GetConfigData(id);
            shapeID    = npcConfig.shape;
            baseConfig = GameSystem.Instance.RoleBaseConfigData2.GetConfigData(shapeID);
            icon       = baseConfig.icon_bust;
            name       = npcConfig.name;
        }

        string portAtlas = "Atlas/icon/iconBust";

        if (shapeID >= 1000 && shapeID < 1500)
        {
            portAtlas = portAtlas;
        }
        else if (shapeID < 1800)
        {
            portAtlas += "_1";
        }
        else if (shapeID < 2000)
        {
            portAtlas += "_2";
        }
        else
        {
            Debug.Log("cannot getPortrait by id=" + shapeID);
        }

        icons[side].atlas      = ResourceLoadManager.Instance.GetAtlas(portAtlas);
        icons[side].spriteName = icon;
        icons[side].MakePixelPerfect();
        names[side].text = name;
        texts[side].text = text.Replace("%self%", MainPlayer.Instance.Name);

        NGUITools.SetActive(gameObject, true);

        StopAllCoroutines();
        if (delay > 0f)
        {
            StartCoroutine(AutoNext(delay));
        }
    }
Ejemplo n.º 2
0
 public void Initialize(NPCConfig config, HitEntity target)
 {
     this.config        = config;
     this.target        = target;
     navMeshAgent.speed = config.MoveSpeed;
     SetUpHealth(config.Health);
 }
Ejemplo n.º 3
0
    public AttrData GetTourNPCAttrData(uint NPCID, uint id)
    {
        uint      position;
        NPCConfig npcConfig = GetConfigData(NPCID);

        if (npcConfig != null)
        {
            position = npcConfig.position;
        }
        else
        {
            position = (uint)(GameSystem.Instance.RoleBaseConfigData2.GetConfigData(NPCID).position);
        }
        uint     level    = MainPlayer.Instance.Level;
        AttrData attr     = new AttrData();
        AttrData npcattr  = TourNpcs.Find(x => x.position == position && x.level == level).attrs;
        TourData tourData = GameSystem.Instance.TourConfig.GetTourData(level, id);
        uint     basic    = (uint)(Random.Range((int)tourData.baseAttrLower, (int)tourData.baseAttrUpper + 1));
        float    hedging  = Random.Range(tourData.hedgingAttrLower, tourData.hedgingAttrUpper);

        attr.attrs["shoot_near"]              = npcattr.attrs["shoot_near"] + basic;
        attr.attrs["shoot_middle"]            = npcattr.attrs["shoot_middle"] + basic;
        attr.attrs["shoot_far"]               = npcattr.attrs["shoot_far"] + basic;
        attr.attrs["dunk_near"]               = npcattr.attrs["dunk_near"] + basic;
        attr.attrs["dunk_middle"]             = npcattr.attrs["dunk_middle"] + basic;
        attr.attrs["layup_near"]              = npcattr.attrs["layup_near"] + basic;
        attr.attrs["layup_middle"]            = npcattr.attrs["layup_middle"] + basic;
        attr.attrs["anti_disturb"]            = (uint)(npcattr.attrs["anti_disturb"] * hedging);
        attr.attrs["pass"]                    = (uint)(npcattr.attrs["pass"] * hedging);
        attr.attrs["control"]                 = (uint)(npcattr.attrs["control"] * hedging);;
        attr.attrs["block"]                   = (uint)(npcattr.attrs["block"] * hedging);
        attr.attrs["anti_block"]              = (uint)(npcattr.attrs["anti_block"] * hedging);
        attr.attrs["steal"]                   = (uint)(npcattr.attrs["steal"] * hedging);
        attr.attrs["disturb"]                 = (uint)(npcattr.attrs["disturb"] * hedging);
        attr.attrs["rebound"]                 = (uint)(npcattr.attrs["rebound"] * hedging);
        attr.attrs["speed"]                   = npcattr.attrs["speed"] + basic;
        attr.attrs["strength"]                = (uint)(npcattr.attrs["strength"] * hedging);
        attr.attrs["interception"]            = (uint)(npcattr.attrs["interception"] * hedging);
        attr.attrs["ph"]                      = npcattr.attrs["ph"] + basic;
        attr.attrs["rebound_height"]          = npcattr.attrs["rebound_height"];
        attr.attrs["cross_speed"]             = npcattr.attrs["cross_speed"];
        attr.attrs["shoot_far_dist"]          = npcattr.attrs["shoot_far_dist"];
        attr.attrs["bodythrowcatch_distance"] = npcattr.attrs["bodythrowcatch_distance"];
        attr.attrs["bodythrowcatch_prob"]     = npcattr.attrs["bodythrowcatch_prob"];

        Debug.Log("================================================NPC:" + NPCID);
        Debug.Log("shoot_near:" + attr.attrs["shoot_near"]);
        Debug.Log("shoot_middle:" + attr.attrs["shoot_middle"]);
        Debug.Log("anti_disturb:" + attr.attrs["anti_disturb"]);
        Debug.Log("steal:" + attr.attrs["steal"]);
        Debug.Log("rebound:" + attr.attrs["rebound"]);
        Debug.Log("disturb:" + attr.attrs["disturb"]);
        Debug.Log("strength:" + attr.attrs["strength"]);
        //return TourNpcs.Find(x => x.position == NPCDatas[NPCID].position && x.level == MainPlayer.Instance.Level).attrs;
        return(attr);
    }
Ejemplo n.º 4
0
    List <SkillInstance> _GetSkillList(SkillType type, RoleInfo roleInfo)
    {
        List <SkillInstance> skill_list = new List <SkillInstance>();

        foreach (SkillAttr skill in GameSystem.Instance.SkillConfig.basic_skills)
        {
            if (skill.type == type)
            {
                SkillInstance inst = new SkillInstance();
                inst.skill = skill;
                inst.level = 1;
                skill_list.Add(inst);
            }
        }

        if (roleInfo != null)
        {
            foreach (SkillSlotProto skillSlot in roleInfo.skill_slot_info)
            {
                if (skillSlot.skill_uuid == 0)
                {
                    continue;
                }

                uint skillID    = skillSlot.skill_id;
                uint skillLevel = 1;

                Goods goods = MainPlayer.Instance.GetGoods(GoodsCategory.GC_SKILL, skillSlot.skill_uuid);
                if (goods != null)
                {
                    skillLevel = goods.GetLevel();
                }

                SkillAttr attr = GameSystem.Instance.SkillConfig.GetSkill(skillID);
                if (attr.type == type)
                {
                    SkillInstance inst = new SkillInstance();
                    inst.skill = attr;
                    inst.level = skillLevel;
                    skill_list.Add(inst);
                }
            }
        }

        if (!m_player.m_bIsNPC)
        {
            RoleBaseData2 data = GameSystem.Instance.RoleBaseConfigData2.GetConfigData(m_player.m_roleInfo.id);
            MergeSkillList(type, skill_list, data.training_skill_all);
        }
        else
        {
            NPCConfig config = GameSystem.Instance.NPCConfigData.GetConfigData(m_player.m_id);
            MergeSkillList(type, skill_list, config.skills);
        }
        return(skill_list);
    }
    void Start()
    {
        int           shapeID = 0;
        RoleBaseData2 data    = GameSystem.Instance.RoleBaseConfigData2.GetConfigData(player.m_roleInfo.id);
        LuaComponent  iconLua = icon.transform.GetComponent <LuaComponent>();

        if (data != null)
        {
            //icon.spriteName = data.icon;
            //shapeID = data.shape;
        }
        else
        {
            NPCConfig npc = GameSystem.Instance.NPCConfigData.GetConfigData(player.m_roleInfo.id);
            //icon.spriteName = npc.icon;
            //shapeID = (int)npc.shape;
            iconLua.table.Set("npc", true);
        }
        iconLua.table.Set("id", player.m_roleInfo.id);
        iconLua.table.Set("showPosition", false);

        //if (1000 <= shapeID && shapeID < 1500)
        //    icon.atlas = ResourceLoadManager.Instance.GetAtlas("Atlas/icon/iconPortrait");
        //else if (1500 <= shapeID && shapeID < 1800)
        //    icon.atlas = ResourceLoadManager.Instance.GetAtlas("Atlas/icon/iconPortrait_1");
        //else if (1800 <= shapeID && shapeID < 2000)
        //    icon.atlas = ResourceLoadManager.Instance.GetAtlas("Atlas/icon/iconPortrait_2");
        //else
        //    icon.atlas = ResourceLoadManager.Instance.GetAtlas("Atlas/icon/iconPortrait_3");
        background.spriteName = bgPrefix + matchAchievement.level;
        name.text             = player.m_name;
        title.text            = matchAchievement.title;
        intro.text            = string.Format(matchAchievement.intro, player.mStatistics.GetStatValue(matchAchievement.type));

        if (matchAchievement.level == 3)
        {
            NGUITools.SetActive(glow, true);
            NGUITools.SetActive(tail.gameObject, true);
            tail.enabled = true;
            if (!moveUp.enabled)
            {
                slideIn.enabled = true;
            }
        }
        else
        {
            NGUITools.SetActive(glow, false);
            NGUITools.SetActive(tail.gameObject, false);
            tail.enabled     = false;
            slideIn.enabled  = false;
            fadeAway.enabled = true;
        }
    }
        public static void RefreshConfig(this NPC self, NPCConfig config)
        {
            if (self._mapUnit != null)
            {
                self.DestroyNPC();
            }

            self._data.SetData(config);

            Room room = self._roomNPCComponent.Entity as Room;

            if (config.RoadSettingId != room.info.RoadSettingId)
            {
                return;
            }

            self.CreateNPC();
        }
 private void OnCreateSlotMachineItem(GameObject item, int index)
 {
     items[index] = item;
     if (index % 2 == 0)
     {
         item.transform.FindChild("Name").GetComponent <UILabel>().text = match.mainRole.m_name;
         RoleBaseData2 data = GameSystem.Instance.RoleBaseConfigData2.GetConfigData(match.mainRole.m_roleInfo.id);
         item.transform.FindChild("Icon").GetComponent <UISprite>().spriteName = data.icon;
         string position = ((PositionType)data.position).ToString();
         item.transform.FindChild("Position").GetComponent <UISprite>().spriteName = position;
     }
     else
     {
         item.transform.FindChild("Name").GetComponent <UILabel>().text = match.npc.m_name;
         NPCConfig config = GameSystem.Instance.NPCConfigData.GetConfigData(match.npc.m_roleInfo.id);
         item.transform.FindChild("Icon").GetComponent <UISprite>().spriteName = config.icon;
         string position = ((PositionType)config.position).ToString();
         item.transform.FindChild("Position").GetComponent <UISprite>().spriteName = position;
     }
 }
Ejemplo n.º 8
0
    private void OnCreateSlotMachineItem(GameObject item, int index)
    {
        items[index] = item;
        Player player = match.players[index];

        item.transform.FindChild("Name").GetComponent <UILabel>().text = player.m_name;
        int icon;

        if (index == 0)
        {
            RoleBaseData2 data = GameSystem.Instance.RoleBaseConfigData2.GetConfigData(player.m_roleInfo.id);
            item.transform.FindChild("Icon").GetComponent <UISprite>().spriteName = data.icon;
            string position = ((PositionType)data.position).ToString();
            item.transform.FindChild("Position").GetComponent <UISprite>().spriteName = position;
            icon = data.shape;
        }
        else
        {
            NPCConfig config = GameSystem.Instance.NPCConfigData.GetConfigData(player.m_roleInfo.id);
            item.transform.FindChild("Icon").GetComponent <UISprite>().spriteName = config.icon;
            string position = ((PositionType)config.position).ToString();
            item.transform.FindChild("Position").GetComponent <UISprite>().spriteName = position;
            icon = (int)config.shape;
        }
        UIAtlas atlas = null;

        if (1000 <= icon && icon <= 1499)
        {
            atlas = ResourceLoadManager.Instance.GetAtlas("Atlas/icon/iconPortrait");
        }
        else if (1500 <= icon && icon <= 1799)
        {
            atlas = ResourceLoadManager.Instance.GetAtlas("Atlas/icon/iconPortrait_1");
        }
        else if (1800 <= icon && icon <= 1999)
        {
            atlas = ResourceLoadManager.Instance.GetAtlas("Atlas/icon/iconPortrait_2");
        }
        item.transform.FindChild("Icon").GetComponent <UISprite>().atlas = atlas;
    }
Ejemplo n.º 9
0
    public void ReadNPCData()
    {
        string text = ResourceLoadManager.Instance.GetConfigText(name1);

        if (text == null)
        {
            Debug.LogError("LoadConfig failed: " + name1);
            return;
        }
        NPCDatas.Clear();

        //读取以及处理XML文本的类
        XmlDocument xmlDoc = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_NPC, text);
        //解析xml的过程
        XmlNodeList nodelist = xmlDoc.SelectSingleNode("Data").ChildNodes;

        foreach (XmlElement xe in nodelist)
        {
            XmlNode comment = xe.SelectSingleNode(GlobalConst.CONFIG_SWITCH_COLUMN);
            if (comment != null && comment.InnerText == GlobalConst.CONFIG_SWITCH)
            {
                continue;
            }
            NPCConfig data     = new NPCConfig();
            AttrData  attrData = new AttrData();
            foreach (XmlElement xel in xe)
            {
                uint value;
                if (xel.Name == "NPC_ID")
                {
                    uint.TryParse(xel.InnerText, out value);
                    data.npc_id = value;
                }

                else if (xel.Name == "name")
                {
                    data.name = xel.InnerText;
                }

                else if (xel.Name == "icon")
                {
                    data.icon = xel.InnerText;
                }

                else if (xel.Name == "level")
                {
                    uint.TryParse(xel.InnerText, out value);
                    data.level = value;
                }

                else if (xel.Name == "quality")
                {
                    uint.TryParse(xel.InnerText, out value);
                    data.quality = value;
                }

                else if (xel.Name == "position")
                {
                    uint.TryParse(xel.InnerText, out value);
                    data.position = value;
                }

                else if (xel.Name == "talent")
                {
                    uint.TryParse(xel.InnerText, out value);
                    data.talent = value;
                }

                else if (xel.Name == "shape")
                {
                    uint.TryParse(xel.InnerText, out value);
                    data.shape = value;
                }

                else if (xel.Name == "AIID")
                {
                    uint.TryParse(xel.InnerText, out value);
                    data.aiid = value;
                }

                else if (xel.Name == "skill")
                {
                    if (!string.IsNullOrEmpty(xel.InnerText))
                    {
                        string[] tokens = xel.InnerText.Split('&');
                        foreach (string token in tokens)
                        {
                            uint skillID;
                            if (uint.TryParse(token, out skillID))
                            {
                                data.skills.Add(skillID);
                            }
                        }
                    }
                }

                else
                {
                    ReadAttrData(xel, ref attrData);
                }
            }
            if (!NPCDatas.ContainsKey(data.npc_id))
            {
                NPCDatas.Add(data.npc_id, data);
                attrs.Add(data.npc_id, attrData);
            }
        }
    }
Ejemplo n.º 10
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);
            }
        }
    }
Ejemplo n.º 11
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;
    }
    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);
            }
        }
    }
Ejemplo n.º 13
0
 public GameActor CreateNpc(NPCConfig npcCfg, int actorId)
 {
     return(null);
 }