//1.创建被动特效 public PassitiveEffect CreatePassitiveEffect(Ientity entity, uint typeid, uint projectId) { SkillPassiveConfigInfo skillinfo = ConfigReader.GetSkillPassiveConfig(typeid); //判断资源路径是否有效 if (skillinfo == null || skillinfo.startEffect == "0") { return(null); } string resourcePath = GameConstDefine.LoadGameSkillEffectPath + "release/" + skillinfo.startEffect; //加载特效信息 PassitiveEffect effect = new PassitiveEffect(); effect.entity = entity; effect.skillID = typeid; effect.projectID = projectId; effect.resPath = resourcePath; //创建 effect.Create(); //保存到特效列表 AddEffect(effect.projectID, effect); return(effect); }
//显示技能描述面板 void ShowDes() { if (statePress != DateTime.Now) { if (desObj == null) { //根据英雄获取被动技能信息 Iplayer player = PlayerManager.Instance.LocalPlayer; if (player == null) { return; } int skillId = GetPassSkill(0, player); SkillPassiveConfigInfo skillInfo = ConfigReader.GetSkillPassiveConfig((uint)skillId); if (skillInfo == null) { Debug.LogError("skillPassive is null"); return; } //面板的生成与设置 ResourceItem desObjUnit = ResourcesManager.Instance.loadImmediate(GameDefine.GameConstDefine.SkillDestribe, ResourceType.PREFAB); desObj = GameObject.Instantiate(desObjUnit.Asset) as GameObject; desObj.transform.parent = mPassiveSkill.transform; desObj.transform.localScale = Vector3.one; desObj.transform.localPosition = new Vector3(550, -450, 0); UnityEngine.GameObject.DestroyImmediate(desObj.GetComponent <UIAnchor>()); //技能信息的获取与显示 UILabel skillCd = desObj.transform.Find("Skill_Cooldown").GetComponent <UILabel>(); UILabel skillDes = desObj.transform.Find("Skill_Describe").GetComponent <UILabel>(); UILabel skillLv = desObj.transform.Find("Skill_Level").GetComponent <UILabel>(); UILabel skillName = desObj.transform.Find("Skill_Name").GetComponent <UILabel>(); UILabel skillMpCost = desObj.transform.Find("Skill_HP").GetComponent <UILabel>(); if (skillInfo.isShowCoolTime) { skillCd.text = (skillInfo.coolTime / 1000f).ToString(); } else { skillCd.text = "0"; } skillDes.text = DestribeWithAttribue(skillInfo.info, player); int bet = (int)skillInfo.id % 10; if (bet == 0) { bet = 1; } skillLv.text = bet.ToString(); skillName.text = skillInfo.name; if (skillInfo.Mp != 0) { skillMpCost.text = skillInfo.Mp.ToString(); } skillMpCost.transform.Find("Label").GetComponent <UILabel>().gameObject.SetActive(skillInfo.Mp != 0); } } }
bool ShowPassSkill(int skillId) { SkillPassiveConfigInfo skillInfo = ConfigReader.GetSkillPassiveConfig((uint)skillId); if (skillInfo == null) { Debug.LogError(" ID = " + skillId); return(false); } mPassiveSkill.spriteName = skillInfo.icon; return(true); }
public ReadSkillPassiveConfig(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) { return; } xmlDoc = new XmlDocument(); xmlDoc.LoadXml(xmlfile.text); XmlNodeList infoNodeList = xmlDoc.SelectSingleNode("SkillCfg_passitive ").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); SkillPassiveConfigInfo passiveInfo = new SkillPassiveConfigInfo(); passiveInfo.id = (uint)Convert.ToUInt32(typeName); foreach (XmlElement xEle in infoNodeList[i].ChildNodes) { #region 搜索 switch (xEle.Name) { case "szName": { passiveInfo.name = Convert.ToString(xEle.InnerText); } break; case "SkillIcon": { passiveInfo.icon = Convert.ToString(xEle.InnerText); } break; case "n32ReleaseAction": { passiveInfo.action = Convert.ToString(xEle.InnerText); } break; case "n32ReleaseSound": { passiveInfo.sound = Convert.ToString(xEle.InnerText); } break; case "ReleaseEffect": { passiveInfo.effect = Convert.ToString(xEle.InnerText); } break; case "StartEffect": { passiveInfo.startEffect = Convert.ToString(xEle.InnerText); } break; case "info": passiveInfo.info = Convert.ToString(xEle.InnerText); break; case "n32CoolDown": passiveInfo.coolTime = Convert.ToInt32(xEle.InnerText); break; case "n32UseMP": passiveInfo.Mp = Convert.ToInt32(xEle.InnerText); break; case "bIsShowColdDown": passiveInfo.isShowCoolTime = Convert.ToBoolean(Convert.ToInt32(xEle.InnerText)); break; } #endregion } ConfigReader.skillPassiveInfoDic.Add(passiveInfo.id, passiveInfo); //Debug.LogError("add buff" + buffInfo.BuffID); } }