Пример #1
0
        //6.创建普通引导特效
        public NormalEffect CreateLeadingEffect(UInt64 owner, UInt32 skillModelID, UInt32 projectid)
        {
            SkillLeadingonfig skillconfig = ConfigReader.GetSkillLeadingConfig(skillModelID);

            //判断路径是否有效
            if (skillconfig == null || skillconfig.effect == "0")
            {
                return(null);
            }

            string       resourcePath = GameConstDefine.LoadGameSkillEffectPath + "release/" + skillconfig.effect;
            NormalEffect effect       = new NormalEffect();

            //加载特效信息
            effect.projectID = projectid;
            effect.NEType    = NormalEffect.NormalEffectType.eNE_Leading;
            effect.resPath   = resourcePath;

            Ientity entity = null;

            EntityManager.AllEntitys.TryGetValue(owner, out entity);

            //创建
            if (entity != null)
            {
                effect.Create();
                if (effect.obj == null)
                {
                    return(null);
                }
                if (null != entity.RealEntity.objPoint)
                {
                    effect.obj.transform.parent        = entity.RealEntity.objPoint.transform;
                    effect.obj.transform.localPosition = new Vector3(0.0f, 0.0f, 0.0f);
                }
            }

            AddEffect(effect.projectID, effect);
            return(effect);
        }
    public ReadSkillLeadingConfig(string xmlFilePath)
    {
        //TextAsset xmlfile = Resources.Load(xmlFilePath) as TextAsset;
        ResourceItem xmlfileUnit = ResourcesManager.Instance.loadImmediate(xmlFilePath, ResourceType.ASSET);
        TextAsset    xmlfile     = xmlfileUnit.Asset as TextAsset;

        if (!xmlfile)
        {
            //Debug.LogError(" error infos: 没有找到指定的xml文件:" + xmlFilePath);
        }

        xmlDoc = new XmlDocument();
        xmlDoc.LoadXml(xmlfile.text);

        XmlNodeList infoNodeList = xmlDoc.SelectSingleNode("SkillCfg_leading ").ChildNodes;

        for (int i = 0; i < infoNodeList.Count; i++)
        {//(XmlNode xNode in infoNodeList)
            if ((infoNodeList[i] as XmlElement).GetAttributeNode("un32ID") == null)
            {
                continue;
            }

            string typeName = (infoNodeList[i] as XmlElement).GetAttributeNode("un32ID").InnerText;
            //Debug.LogError(typeName);
            SkillLeadingonfig skillinfo = new SkillLeadingonfig();
            skillinfo.id = (uint)Convert.ToUInt32(typeName);

            //SkillConfigInfo.NpcId = Convert.ToInt32(typeName);
            foreach (XmlElement xEle in infoNodeList[i].ChildNodes)
            {
                switch (xEle.Name)
                {
                    #region 搜索
                case "szName":
                {
                    skillinfo.name = Convert.ToString(xEle.InnerText);
                }
                break;

                case "eLeadingTime":
                {
                    skillinfo.time = Convert.ToInt32(xEle.InnerText) / 1000.0f;
                }
                break;

                case "eLeadingAction":
                {
                    skillinfo.action = Convert.ToString(xEle.InnerText);
                }
                break;

                case "eLeadingSound":
                {
                    skillinfo.sound = Convert.ToString(xEle.InnerText);
                }
                break;

                case "eLeadingEffect":
                {
                    skillinfo.effect = Convert.ToString(xEle.InnerText);
                }
                break;
                    #endregion
                }
            }
            ConfigReader.skillLeadingInfoDic.Add(skillinfo.id, skillinfo);
        }
    }