private void tryCacehAllObject(int objTypeId) { string ModelName = EntityManager.Instance.CacheGetModeName(objTypeId); string path = GameDefine.GameConstDefine.LoadMonsterModels; HeroConfigInfo hcfg = ConfigReader.GetHeroInfo(objTypeId); int skill1 = 0, skill2 = 0, skill3 = 0, skill4 = 0; if (hcfg != null) { skill1 = hcfg.HeroSkillType1; skill2 = hcfg.HeroSkillType2; skill3 = hcfg.HeroSkillType3; //1's prower skill skill4 = hcfg.HeroSkillType4; } //所有技能(GetPrepareSkill, 也可能是物品skill) string resourcePath; GameObject obj; if (skill1 != 0) { //SkillConfigInfo info = ConfigReader.GetSkillInfo(skill1); SkillManagerConfig info = ConfigReader.GetSkillManagerCfg(skill1); SkillConfigInfo skillInfo = ConfigReader.GetSkillInfo((uint)skill1); resourcePath = GameConstDefine.LoadGameBuffEffectPath + info.EventID; SkillAreaConfig skillConfig = ConfigReader.GetSkillAreaConfig((uint)skill1); //判断路径是否有效 if (skillConfig != null && skillConfig.effect != "0") { resourcePath = GameConstDefine.LoadGameSkillEffectPath + "release/" + skillConfig.effect; obj = GameObjectPool.Instance.GetGO(resourcePath); //return null; } string buffPath = EffectManager.Instance.GetBuffEffectPath((uint)skill1); //eventid可能等于0 string flyPath = EffectManager.Instance.getFlyEffectPath(info.EventID); //131010 obj = GameObjectPool.Instance.GetGO(flyPath); //string templateName = ResourceCommon.getResourceName(resourcePath); } //创建GameObject string resPath = ModelName; //GameObject realObject = GameObjectPool.Instance.GetGO(resPath); //以下资源根据客户端cfg获得,所以也是存在和服务器返回有出入的可能性 //所有状态 }
public override void OnLoadComplete() { Ientity enOwner; EntityManager.AllEntitys.TryGetValue(enOwnerKey, out enOwner); if (obj != null && enOwner != null) { SkillConfigInfo skillinfo = ConfigReader.GetSkillInfo(skillID); Transform point = enOwner.RealEntity.objAttackPoint; if (point != null) { if (skillinfo.SkillType == (int)ISkill.ESkillType.eST_FixDistanceArea) { Vector3 temp = fixPosition; temp.y = point.transform.position.y; fixPosition = temp; GetTransform().position = fixPosition; } else { GetTransform().position = point.transform.position; } Ientity enTarget; EntityManager.AllEntitys.TryGetValue(enTargetKey, out enTarget); //Debug.LogError("fly effect init pos:" + root.transform.position.x + ":" + root.transform.position.y + ":" + root.transform.position.z); if (mType == IEffect.ESkillEffectType.eET_FlyEffect && enTarget != null) { Quaternion rt = Quaternion.LookRotation(enTarget.RealEntity.transform.position - GetTransform().position); GetTransform().rotation = rt; } else { if (dir == Vector3.zero) { dir = Vector3.one; } Quaternion rt = Quaternion.LookRotation(dir); GetTransform().rotation = rt; } } } }
private void OnSkillConfigInfoChangeNty(short state, SkillConfigInfoChangeNty down = null) { if (state != 0) { StateManager.Instance.StateShow(state, 0); return; } if (down != null && down.infos.get_Count() > 0) { for (int i = 0; i < down.infos.get_Count(); i++) { if (i > 1) { break; } SkillConfigInfo skillConfigInfo = down.infos.get_Item(i); if (this.skillNotchDic.ContainsKey(1)) { this.skillNotchDic.set_Item(1, skillConfigInfo.notch1); } else { this.skillNotchDic.Add(1, skillConfigInfo.notch1); } if (this.skillNotchDic.ContainsKey(2)) { this.skillNotchDic.set_Item(2, skillConfigInfo.notch2); } else { this.skillNotchDic.Add(2, skillConfigInfo.notch2); } if (this.skillNotchDic.ContainsKey(3)) { this.skillNotchDic.set_Item(3, skillConfigInfo.notch3); } else { this.skillNotchDic.Add(3, skillConfigInfo.notch3); } } EventDispatcher.Broadcast(EventNames.OnSkillConfigInfoChangeNty); } }
private void OnSkillConfigInfoLoginPush(short state, SkillConfigInfoLoginPush down = null) { if (state != 0) { StateManager.Instance.StateShow(state, 0); return; } if (down != null) { this.skillNotchDic.Clear(); for (int i = 0; i < down.infos.get_Count(); i++) { if (i > 1) { break; } SkillConfigInfo skillConfigInfo = down.infos.get_Item(i); this.skillNotchDic.Add(1, skillConfigInfo.notch1); this.skillNotchDic.Add(2, skillConfigInfo.notch2); this.skillNotchDic.Add(3, skillConfigInfo.notch3); } } }
//public static ReadSkillConfig inst = new ReadSkillConfig("Config/SkillCfg"); public ReadSkillConfig(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 ").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); SkillConfigInfo skillinfo = new SkillConfigInfo(); skillinfo.SkillID = Convert.ToUInt32(typeName); //SkillConfigInfo.NpcId = Convert.ToInt32(typeName); foreach (XmlElement xEle in infoNodeList[i].ChildNodes) { #region 搜索 switch (xEle.Name) { case "szName": { skillinfo.SkillName = Convert.ToString(xEle.InnerText); } break; case "n32PrepareTime": { skillinfo.PrepareTime = Convert.ToInt32(xEle.InnerText); } break; case "n32ReleaseDistance": { skillinfo.Range = Convert.ToSingle(xEle.InnerText) / 100.0f; } break; case "attackEffect": { skillinfo.AttackEffect = Convert.ToString(xEle.InnerText); } break; case "woundEffect": { skillinfo.WoundEffect = Convert.ToString(xEle.InnerText); } break; case "bIfNormal": { skillinfo.IsNormalSkill = Convert.ToInt32(xEle.InnerText); } break; case "SkillType": skillinfo.SkillType = Convert.ToInt32(xEle.InnerText); break; case "FlySpeed": skillinfo.FlySpeed = Convert.ToInt32(xEle.InnerText) / 100.0f; ; break; case "AEffectTime": skillinfo.AEffectTime = Convert.ToInt32(xEle.InnerText); break; case "WEffectTime": skillinfo.WEffectTime = Convert.ToInt32(xEle.InnerText); break; case "n32ProjectileNum": skillinfo.ProjectNum = Convert.ToInt32(xEle.InnerText); break; case "n32RangePar1": skillinfo.RangeParam1 = Convert.ToInt32(xEle.InnerText); break; case "NreRangePar2": skillinfo.RangeParam2 = Convert.ToInt32(xEle.InnerText); break; case "n32CoolDown": skillinfo.CdTime = Convert.ToSingle(xEle.InnerText); break; case "eLifeTime": skillinfo.LifeTime = Convert.ToInt32(xEle.InnerText) / 1000.0f; break; case "eReleaseWay": skillinfo.SkillLockTarget = Convert.ToInt32(xEle.InnerText); break; case "buffIcon": skillinfo.iconName = Convert.ToString(xEle.InnerText); break; case "FlySound": { skillinfo.flySound = Convert.ToString(xEle.InnerText); } break; case "HitSound": { skillinfo.hitSound = Convert.ToString(xEle.InnerText); } break; case "n32UseMP": { skillinfo.MpCost = Convert.ToInt32(xEle.InnerText); } break; case "bIsConsumeSkill": { skillinfo.IsAbsorbSkill = Convert.ToInt32(xEle.InnerText); } break; case "eSummonEffect": { skillinfo.absorbRes = Convert.ToString(xEle.InnerText); } break; } #endregion } //Debug.LogError("add skill" + skillinfo.SkillID); ConfigReader.skillXmlInfoDict.Add(skillinfo.SkillID, skillinfo); } }