private int GetPassSkill(int skillId, Iplayer player) { HeroConfigInfo heroInfo = null; int id = (int)player.ObjTypeID; if (skillId == 0) { heroInfo = ConfigReader.GetHeroInfo(id); PassiveTemp = heroInfo.HeroSkillTypeP; if (SkillLevel3 <= player.Level) { return(PassiveTemp + 2); } else if (SkillLevel2 <= player.Level) { return(PassiveTemp + 1); } else if (player.Level < SkillLevel2) { return(PassiveTemp); } } heroInfo = ConfigReader.GetHeroInfo(skillId); return(heroInfo.HeroSkillTypeP); }
//初始化技能升级列表 private void InitSkillDic(Dictionary <SkillType, int> skillDic) { int id = (int)ObjTypeID; HeroConfigInfo heroInfo = ConfigReader.GetHeroInfo(id); skillDic.Add(SkillType.SKILL_TYPE1, heroInfo.HeroSkillType1); skillDic.Add(SkillType.SKILL_TYPE2, heroInfo.HeroSkillType2); skillDic.Add(SkillType.SKILL_TYPE3, heroInfo.HeroSkillType3); skillDic.Add(SkillType.SKILL_TYPE4, heroInfo.HeroSkillType4); skillDic.Add(SkillType.SKILL_TYPEABSORB1, 0); skillDic.Add(SkillType.SKILL_TYPEABSORB2, 0); }
public void InitSkillDic() { int id = (int)ObjTypeID; HeroConfigInfo heroInfo = ConfigReader.GetHeroInfo(id); skillDic.Add(SkillTypeEnum.SKILL_TYPE1, heroInfo.HeroSkillType1); skillDic.Add(SkillTypeEnum.SKILL_TYPE2, heroInfo.HeroSkillType2); skillDic.Add(SkillTypeEnum.SKILL_TYPE3, heroInfo.HeroSkillType3); skillDic.Add(SkillTypeEnum.SKILL_TYPE4, heroInfo.HeroSkillType4); skillDic.Add(SkillTypeEnum.SKILL_TYPEABSORB1, 0); skillDic.Add(SkillTypeEnum.SKILL_TYPEABSORB2, 0); }
/// <summary> /// 刷新显示部分 /// </summary> public override void OnShowItemInUserInterface() { for (int ct = 0; ct < ButtonUis.Count; ct++) { DbClickBotton click = ButtonUis[ct]; UISprite sprite = click.transform.Find("Item/icon").GetComponent <UISprite>(); UILabel price = click.transform.Find("Price/Label").GetComponent <UILabel>(); if (ct >= ItemsInUserInterface.Count) { //click.gameObject.SetActive(false); //click.GetComponent<BoxCollider>().enabled = false; DisableGameObjectSprites(click.gameObject); SetSelectSpriteVisiable(ct, false); continue; } int item = ItemsInUserInterface[ct]; if (!ConfigReader.ItemXmlInfoDict.ContainsKey(item)) { //click.gameObject.SetActive(false); //click.GetComponent<BoxCollider>().enabled = false; DisableGameObjectSprites(click.gameObject); SetSelectSpriteVisiable(ct, false); continue; } click.GetComponent <BoxCollider>().enabled = true; click.gameObject.SetActive(true); price.text = ConfigReader.ItemXmlInfoDict[item].n32CPCost.ToString(); sprite.gameObject.SetActive(true); sprite.spriteName = ConfigReader.ItemXmlInfoDict[item].sIcon; if (UIShop.isRecommendEquip && PlayerManager.Instance.LocalAccount.ObjType == ObPlayerOrPlayer.PlayerType) { Transform parentKind = click.gameObject.transform.Find("Recommend"); HeroConfigInfo info = ConfigReader.GetHeroInfo(PlayerManager.Instance.LocalPlayer.NpcGUIDType); //策划说,初级推荐装备,中级,高级都小于6个 int index = (info.HeroPreEquip.Count == 0) ? 0 : (info.HeroPreEquip.Count / 6 + 1) * 6; int index2 = (info.HeroMidEquip.Count == 0) ? 0 : (info.HeroMidEquip.Count / 6 + 1) * 6; if (info.HeroPreEquip.Contains(item) && ct < (info.HeroPreEquip.Count / 6 + 1) * 6) { parentKind.Find("Early").gameObject.SetActive(true); } else if (info.HeroMidEquip.Contains(item) && ct < (info.HeroMidEquip.Count / 6 + 1) * 6 + index) { parentKind.Find("Medium").gameObject.SetActive(true); } else if (info.HeroLatEquip.Contains(item) && ct < (info.HeroLatEquip.Count / 6 + 1) * 6 + index + index2) { parentKind.Find("Later").gameObject.SetActive(true); } } } }
public override void SetCommonProperty(Ientity entity, int id) { base.SetCommonProperty(entity, id); HeroConfigInfo info = ConfigReader.GetHeroInfo(id); entity.ColliderRadius = info.HeroCollideRadious / 100; Iplayer mpl = (Iplayer)entity; if (mpl.GameUserNick == "" || mpl.GameUserNick == null) { mpl.GameUserNick = RandomNameData.Instance.GetRandName(); } }
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 void OnLocalPlayerInit(int sObjID) { //更新技能图片 HeroConfigInfo heroInfo = ConfigReader.GetHeroInfo((int)sObjID); if (ConfigReader.GetSkillManagerCfg(heroInfo.HeroSkillType2) != null) { buttonSprite[0].spriteName = ConfigReader.GetSkillManagerCfg(heroInfo.HeroSkillType2).skillIcon;//技能1 } if (ConfigReader.GetSkillManagerCfg(heroInfo.HeroSkillType3) != null) { buttonSprite[1].spriteName = ConfigReader.GetSkillManagerCfg(heroInfo.HeroSkillType3).skillIcon;//技能2 } }
public void UpdateExp() { HeroConfigInfo info = ConfigReader.GetHeroInfo(PlayerManager.Instance.LocalPlayer.NpcGUIDType); if (PlayerManager.Instance.LocalPlayer.Level >= CommonDefine.MAX_LEVEL) { sliderExp.fillAmount = 1.0f; labelExp.text = ""; return; } int exp = (int)PlayerManager.Instance.LocalPlayer.Exp; float expMax = info.HeroBaseExp + (PlayerManager.Instance.LocalPlayer.Level - 1) * info.HeroExpGrowth; sliderExp.fillAmount = PlayerManager.Instance.LocalPlayer.Exp / expMax; labelExp.text = exp.ToString() + "/" + Convert.ToInt32(expMax).ToString(); }
protected override float GetXueTiaoHeight() { HeroConfigInfo info = null; if ((SceneGuideTaskManager.Instance().IsNewsGuide() != SceneGuideTaskManager.SceneGuideType.NoGuide) && (xueTiaoOwner.entityType == EntityType.Soldier || xueTiaoOwner.entityType == EntityType.AltarSoldier)) { NpcConfigInfo nInfo = ConfigReader.GetNpcInfo(xueTiaoOwner.NpcGUIDType); ShowGuideXueTiaoInfo(); return(nInfo.NpcXueTiaoHeight); } else { info = ConfigReader.GetHeroInfo(xueTiaoOwner.NpcGUIDType); } return(info.HeroXueTiaoHeight); }
public List <int> GetHeroRecommendEquip() { if (PlayerManager.Instance.LocalAccount.ObjType == ObPlayerOrPlayer.PlayerObType) { return(null); } List <int> items = new List <int>(); Iselfplayer player = PlayerManager.Instance.LocalPlayer; HeroConfigInfo info = ConfigReader.GetHeroInfo(player.NpcGUIDType); for (int i = 0; i < 3; i++) { switch (i) { case 0: items.AddRange(info.HeroPreEquip); break; case 1: items.AddRange(info.HeroMidEquip); break; case 2: items.AddRange(info.HeroLatEquip); break; } int count = items.Count / 6; int tempCount = items.Count; if (items.Count % 6 != 0) { count += 1; } for (int j = 0; j < (count * 6 - tempCount); j++) { items.Add(0); } } return(items); }
List <AudioRand> SetAudioDate(UInt64 heroID) { if (!EntityManager.AllEntitys.ContainsKey(heroID)) { return(null); } Ientity sEntity = EntityManager.AllEntitys[heroID]; HeroConfigInfo info = ConfigReader.GetHeroInfo((int)sEntity.ObjTypeID); string[] val = info.HeroScript1.Split(','); string[] val1 = info.HeroScript1Rate.Split(','); List <AudioRand> randa = new List <AudioRand>(); for (int i = 0; i < val.Length; i++) { AudioRand temp = new AudioRand(); temp.AudioName = val[i]; temp.RandNum = Convert.ToSingle(val1[i]) % 90000; randa.Add(temp); } return(randa); }
private void OnLocalPlayerInit() { int id = (int)PlayerManager.Instance.LocalPlayer.ObjTypeID; HeroConfigInfo heroInfo = ConfigReader.GetHeroInfo(id); if (ConfigReader.GetSkillManagerCfg(heroInfo.HeroSkillType1) != null) { SetSkillBtnPic(ShortCutBarBtn.BTN_SKILL_1, ConfigReader.GetSkillManagerCfg(heroInfo.HeroSkillType1).skillIcon); } if (ConfigReader.GetSkillManagerCfg(heroInfo.HeroSkillType2) != null) { SetSkillBtnPic(ShortCutBarBtn.BTN_SKILL_2, ConfigReader.GetSkillManagerCfg(heroInfo.HeroSkillType2).skillIcon); } if (ConfigReader.GetSkillManagerCfg(heroInfo.HeroSkillType3) != null) { SetSkillBtnPic(ShortCutBarBtn.BTN_SKILL_3, ConfigReader.GetSkillManagerCfg(heroInfo.HeroSkillType3).skillIcon); } if (ConfigReader.GetSkillManagerCfg(heroInfo.HeroSkillType4) != null) { SetSkillBtnPic(ShortCutBarBtn.BTN_SKILL_4, ConfigReader.GetSkillManagerCfg(heroInfo.HeroSkillType4).skillIcon); } SetSkillBtnPic(ShortCutBarBtn.BTN_SKILL_5, ""); SetSkillBtnPic(ShortCutBarBtn.BTN_SKILL_6, ""); }
public ReadHeroConfig(string xmlFilePath) { //TextAsset xmlfile = Resources.Load(xmlFilePath) as TextAsset; ResourceUnit 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("herocfg ").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; HeroConfigInfo HeroSelectInfo = new HeroConfigInfo(); HeroSelectInfo.HeroName = Convert.ToString(typeName); foreach (XmlElement xEle in infoNodeList[i].ChildNodes) { #region 搜索 switch (xEle.Name) { case "szNOStr": HeroSelectInfo.HeroNum = Convert.ToInt32(xEle.InnerText); break; case "eMagicCate": HeroSelectInfo.HeroMgicCate = Convert.ToInt32(xEle.InnerText); break; case "XuetiaoHeight": HeroSelectInfo.HeroXueTiaoHeight = Convert.ToInt32(xEle.InnerText); break; case "n32AttackDist": HeroSelectInfo.HeroAtkDis = Convert.ToSingle(xEle.InnerText); break; case "n32BaseExp": HeroSelectInfo.HeroBaseExp = Convert.ToSingle(xEle.InnerText); break; case "n32BasePhyAttPower": HeroSelectInfo.HeroPhyAtt = Convert.ToSingle(xEle.InnerText); break; case "n32BaseMagAttPower": HeroSelectInfo.HeroMagAtt = Convert.ToSingle(xEle.InnerText); break; case "n32BasePhyDef": HeroSelectInfo.HeroPhyDef = Convert.ToSingle(xEle.InnerText); break; case "n32BaseMagDef": HeroSelectInfo.HeroMagDef = Convert.ToSingle(xEle.InnerText); break; case "n32BaseMoveSpeed": HeroSelectInfo.HeroMoveSpeed = Convert.ToSingle(xEle.InnerText); break; case "n32BaseMoveSpeedScaling": HeroSelectInfo.n32BaseMoveSpeedScaling = Convert.ToSingle(xEle.InnerText); break; case "n32BaseAttackCD": HeroSelectInfo.HeorBaseAtkCd = Convert.ToSingle(xEle.InnerText); break; case "n32BaseMaxHP": HeroSelectInfo.HeroMaxHp = Convert.ToSingle(xEle.InnerText); break; case "n32BaseMaxMP": HeroSelectInfo.HeroMaxMp = Convert.ToSingle(xEle.InnerText); break; case "n32BaseHPRecover": HeroSelectInfo.HeroHpRecover = Convert.ToSingle(xEle.InnerText); break; case "n32BaseMPRecover": HeroSelectInfo.HeroMpRecover = Convert.ToSingle(xEle.InnerText); break; case "n32BaseReliveTime": HeroSelectInfo.HeroRelieveTime = Convert.ToSingle(xEle.InnerText); break; case "n32ExpGrowth": HeroSelectInfo.HeroExpGrowth = Convert.ToSingle(xEle.InnerText); break; case "n32PhyAttGrowth": HeroSelectInfo.HeroPhyAttGrowth = Convert.ToSingle(xEle.InnerText); break; case "n32MagAttGrowth": HeroSelectInfo.HeroMagAttGrowth = Convert.ToSingle(xEle.InnerText); break; case "n32PhyDefGrowth": HeroSelectInfo.HeroPhyDefGrowth = Convert.ToSingle(xEle.InnerText); break; case "n32MagDefGrowth": HeroSelectInfo.HeroMagDefGrowth = Convert.ToSingle(xEle.InnerText); break; case "n32AttackCDGrowth": HeroSelectInfo.HeroAtkCdGrowth = Convert.ToSingle(xEle.InnerText); break; case "32MaxHPGrowth": HeroSelectInfo.HeroMaxHpGrowth = Convert.ToSingle(xEle.InnerText); break; case "32MaxMPGrowth": HeroSelectInfo.HeroMaxMpGrowth = Convert.ToSingle(xEle.InnerText); break; case "n32HPRecoverGrowth": HeroSelectInfo.HeroHpRecoverGrowth = Convert.ToSingle(xEle.InnerText); break; case "n32MPRecoverGrowth": HeroSelectInfo.HeroHpRecoverGrowth = Convert.ToSingle(xEle.InnerText); break; case "n32ReliveGrowth": HeroSelectInfo.HeroHpRecoverGrowth = Convert.ToSingle(xEle.InnerText); break; case "n32CPRecover": HeroSelectInfo.HeroCpRecover = Convert.ToSingle(xEle.InnerText); break; case "n32CollideRadious": HeroSelectInfo.HeroCollideRadious = Convert.ToSingle(xEle.InnerText); break; case "un32DeathSould": HeroSelectInfo.HeroDeathSould = Convert.ToString(xEle.InnerText); break; case "un32WalkSound": HeroSelectInfo.un32WalkSound = xEle.InnerText; break; case "un32Script1": HeroSelectInfo.HeroScript1 = Convert.ToString(xEle.InnerText); break; case "n32Script1Rate": HeroSelectInfo.HeroScript1Rate = Convert.ToString(xEle.InnerText); break; case "un32SkillType1": HeroSelectInfo.HeroSkillType1 = Convert.ToInt32(xEle.InnerText); break; case "un32SkillType2": HeroSelectInfo.HeroSkillType2 = Convert.ToInt32(xEle.InnerText); break; case "un32SkillType3": HeroSelectInfo.HeroSkillType3 = Convert.ToInt32(xEle.InnerText); break; case "un32SkillType4": HeroSelectInfo.HeroSkillType4 = Convert.ToInt32(xEle.InnerText); break; case "un32SkillType5": HeroSelectInfo.HeroSkillType5 = Convert.ToInt32(xEle.InnerText); break; case "un32SkillType6": HeroSelectInfo.HeroSkillType6 = Convert.ToInt32(xEle.InnerText); break; case "n32LockRadious": HeroSelectInfo.n32LockRadious = Convert.ToSingle(xEle.InnerText); break; case "n32RandomAttack": HeroSelectInfo.n32RandomAttack = GameDefine.GameMethod.ResolveToStrList(xEle.InnerText); break; case "un32PreItem": { string str = Convert.ToString(xEle.InnerText); if (str.CompareTo("0") != 0) { HeroSelectInfo.HeroPreEquip = GameMethod.ResolveToIntList(str, ','); } } break; case "un32MidItem": { string str = Convert.ToString(xEle.InnerText); if (str.CompareTo("0") != 0) { HeroSelectInfo.HeroMidEquip = GameMethod.ResolveToIntList(str, ','); } } break; case "un32ProItem": { string str = Convert.ToString(xEle.InnerText); if (str.CompareTo("0") != 0) { HeroSelectInfo.HeroLatEquip = GameMethod.ResolveToIntList(str, ','); } } break; case "HeroKind": { string str = Convert.ToString(xEle.InnerText); List <int> list = GameMethod.ResolveToIntList(str, ','); for (int j = 0; j < list.Count; j++) { HeroSelectInfo.heroKind.Add((HeroType)list.ElementAt(j)); } } break; case "un32SkillTypeP": HeroSelectInfo.HeroSkillTypeP = Convert.ToInt32(xEle.InnerText); break; } #endregion } ConfigReader.heroXmlInfoDict.Add(HeroSelectInfo.HeroNum, HeroSelectInfo); } }
public void SetAudioPlay(UInt64 heroID, AudioPlayType audiotype = AudioPlayType.KillAudio) { if (!EntityManager.AllEntitys.ContainsKey(heroID)) { return; } Ientity sEntity = EntityManager.AllEntitys[heroID]; if (sEntity.GetDistanceToPos(PlayerManager.Instance.LocalPlayer.realObject.transform.position) > 30) { return; } HeroConfigInfo info = ConfigReader.GetHeroInfo((int)sEntity.ObjTypeID); if (info != null) { switch (audiotype) { case AudioPlayType.KillAudio: case AudioPlayType.TwentySconde: { System.Random rand = new System.Random(); int randomdata = rand.Next(2); if (randomdata == 1) { string path = "Audio/HeroSelect/"; string adio_name = ""; int audio_num = rand.Next(100); List <AudioRand> reand = SetAudioDate(heroID); if (reand.Count < randomdata + 1) { return; } if (audio_num > reand[randomdata].RandNum) { adio_name = reand[1].AudioName; } else { adio_name = reand[0].AudioName; } //int int_hero1 = int.Parse(info.HeroScript1Rate.Substring(0, info.HeroScript1Rate.IndexOf(","))); //if (audio_num < (int_hero1 % 90000)) adio_name = info.HeroScript1.Substring(0, info.HeroScript1.IndexOf(",")); //else adio_name = info.HeroScript1.Substring(info.HeroScript1.IndexOf(",") + 1, info.HeroScript1.Length - info.HeroScript1.IndexOf(",") - 1); //AudioClip clip = Resources.Load(path + adio_name) as AudioClip; //AudioManager.Instance.PlayGameKillAudio(clip); ResourceUnit clipUnit = ResourcesManager.Instance.loadImmediate(path + adio_name, ResourceType.ASSET); AudioClip clip = clipUnit.Asset as AudioClip; AudioManager.Instance.PlayGameKillAudio(clip); } } break; case AudioPlayType.FuhuoAudio: { if (info.HeroScript1 != null) { string path = "Audio/HeroSelect/"; string adio_name = info.HeroScript1.Substring(info.HeroScript1.IndexOf(",") + 1, info.HeroScript1.Length - info.HeroScript1.IndexOf(",") - 1); ResourceUnit clipUnit = ResourcesManager.Instance.loadImmediate(path + adio_name, ResourceType.ASSET); AudioClip clip = clipUnit.Asset as AudioClip; AudioManager.Instance.PlayHeroLinesAudio(heroID, clip); } //AudioClip clip = Resources.Load(path + adio_name) as AudioClip; //AudioManager.Instance.PlayHeroLinesAudio(heroID, clip); } break; } } }
public uint getSkill2(int objTypeId) { HeroConfigInfo hero = ConfigReader.GetHeroInfo(objTypeId); return(ConfigReader.GetSkillManagerCfg(hero.HeroSkillType2).EventID); }
float GetXueTiaoHeight(UInt64 guidType) { HeroConfigInfo info = ConfigReader.GetHeroInfo((int)ObjTypeID); return(info.HeroXueTiaoHeight); }