public void InitHead() { HeroSelectConfigInfo info = ConfigReader.GetHeroSelectInfo(PlayerManager.Instance.LocalPlayer.NpcGUIDType); string head = info.HeroSelectHead.ToString(); spriteHead.spriteName = head; }
public void OnUpdateHeadPt() { HeroSelectConfigInfo info = ConfigReader.GetHeroSelectInfo(Player.NpcGUIDType); if (info != null) { PlayerIcon.spriteName = info.HeroSelectHead.ToString(); } }
private void UpdateLockHead(Ientity entity) { bool mCanAbsorb = false; if (entity == null)//如果实体销毁为空了 { CurrLockEntity = null; mLockRoot.localPosition = new Vector3(5000, 0, 0); //显示的头像位置重新设定 ShowLockEffect(false); //隐藏锁定特效 EventCenter.Broadcast <string>((Int32)GameEventEnum.GameEvent_ResetLockHead, null); } else { string head = ""; CurrLockEntity = entity; spriteLockBg2.gameObject.SetActive(false); if (entity.entityType == EntityType.Player)//如果锁定的敌方英雄 { HeroSelectConfigInfo info = ConfigReader.GetHeroSelectInfo(entity.NpcGUIDType); head = info.HeroSelectHead.ToString(); } else //野怪,士兵,箭塔士兵 { NpcConfigInfo info = ConfigReader.GetNpcInfo(entity.NpcGUIDType); head = info.HeadPhoto.ToString(); if (entity.entityType == EntityType.Monster || entity.entityType == EntityType.Soldier || entity.entityType == EntityType.AltarSoldier && !PlayerManager.Instance.IsLocalSameType(entity)) { if (entity.BloodBar != null) { entity.BloodBar.IsBloodBarCpVib(true);//显示血条,cp() } Iselfplayer player = PlayerManager.Instance.LocalPlayer; //此目标与玩家吸收的野怪类型都不同,那么就允许吸收 if (player != null && player.AbsorbMonsterType[0] != entity.NpcGUIDType && player.AbsorbMonsterType[1] != entity.NpcGUIDType) { //目标是小野怪或者大野怪或者践踏士兵 并且和玩家不是一个阵营的, if (entity.NPCCateChild == ENPCCateChild.eNPCChild_SmallMonster || entity.NPCCateChild == ENPCCateChild.eNPCChild_HugeMonster || entity.entityType == EntityType.AltarSoldier && !PlayerManager.Instance.IsLocalSameType(entity)) { spriteLockBg2.gameObject.SetActive(true); //显示锁定头像 mCanAbsorb = true; //设置可以吸收 } } } } spriteLockHp.fillAmount = entity.Hp / entity.HpMax; //锁定头像的HP(左) spriteLockMp.fillAmount = entity.Mp / entity.MpMax; //锁定头像的MP(左) EventCenter.Broadcast <string>((Int32)GameEventEnum.GameEvent_ResetLockHead, head); spriteLock.spriteName = head; //锁定的头像(左) mLockRoot.localPosition = mLockPos; //根节点的本地位置 ShowLockEffect(true); //显示锁定特效 EventCenter.Broadcast <GameObject>((mCanAbsorb) ? (Int32)GameEventEnum.GameEvent_GuideLockTargetCanAbsorb : (Int32)GameEventEnum.GameEvent_GuideLockTargetCanNotAbsorb, spriteLockBg2.gameObject); } }
private void UpdateLockHead(Ientity entity) { bool mCanAbsorb = false; if (entity == null) { CurrLockEntity = null; mLockRoot.localPosition = new Vector3(5000, 0, 0); ShowLockEffect(false); EventCenter.Broadcast <string>(EGameEvent.eGameEvent_ResetLockHead, null); } else { string head = ""; CurrLockEntity = entity; spriteLockBg2.gameObject.SetActive(false); if (entity.entityType == EntityType.Player) { HeroSelectConfigInfo info = ConfigReader.GetHeroSelectInfo(entity.NpcGUIDType); head = info.HeroSelectHead.ToString(); } else { NpcConfigInfo info = ConfigReader.GetNpcInfo(entity.NpcGUIDType); head = info.HeadPhoto.ToString(); if (entity.entityType == EntityType.Monster || entity.entityType == EntityType.Soldier || entity.entityType == EntityType.AltarSoldier && !PlayerManager.Instance.IsLocalSameType(entity)) { if (entity.XueTiao != null) { entity.XueTiao.IsXueTiaoCpVib(true); } Iselfplayer player = PlayerManager.Instance.LocalPlayer; if (player != null && player.AbsorbMonsterType[0] != entity.NpcGUIDType && player.AbsorbMonsterType[1] != entity.NpcGUIDType) { if (entity.NPCCateChild == ENPCCateChild.eNPCChild_SmallMonster || entity.NPCCateChild == ENPCCateChild.eNPCChild_HugeMonster || entity.entityType == EntityType.AltarSoldier && !PlayerManager.Instance.IsLocalSameType(entity)) { spriteLockBg2.gameObject.SetActive(true); mCanAbsorb = true; } } } } spriteLockHp.fillAmount = entity.Hp / entity.HpMax; spriteLockMp.fillAmount = entity.Mp / entity.MpMax; EventCenter.Broadcast <string>(EGameEvent.eGameEvent_ResetLockHead, head); spriteLock.spriteName = head; mLockRoot.localPosition = mLockPos; ShowLockEffect(true); EventCenter.Broadcast <GameObject>((mCanAbsorb) ? EGameEvent.eGameEvent_GuideLockTargetCanAbsorb : EGameEvent.eGameEvent_GuideLockTargetCanNotAbsorb, spriteLockBg2.gameObject); } }
public void SetShowLabel(UInt64 headIcon, string name, int level, int kill, int deathtimes, int asstime, int totalcp, int lasthit) { HeroSelectConfigInfo info = ConfigReader.GetHeroSelectInfo((Int32)headIcon); HeadIcon.spriteName = info.HeroSelectHead.ToString(); HeadNameLabel.text = name; HeroLevelLabel.text = level.ToString(); HeroKillsLabel.text = kill.ToString(); HeroDeadTimesLabel.text = deathtimes.ToString(); HeroAssLabel.text = asstime.ToString(); HeroTotalLabel.text = totalcp.ToString(); HeroLastHitLabel.text = lasthit.ToString(); }
private void PlayLocalSelectSound(int heroId) { HeroSelectConfigInfo info = ConfigReader.GetHeroSelectInfo(heroId); string path = "Audio/HeroSelect/"; path = path + info.HeroSelectSound; //AudioClip clip = (AudioClip) Resources.Load(path) as AudioClip; ResourceItem clipUnit = ResourcesManager.Instance.loadImmediate(path, ResourceType.ASSET); AudioClip clip = clipUnit.Asset as AudioClip; AudioSource source = AudioManager.Instance.PlayEffectAudio(clip); }
public void OpenInfo(Iplayer pl) { Player = pl; HeroSelectConfigInfo heroinfo = ConfigReader.GetHeroSelectInfo(Player.NpcGUIDType); TweenPosition.Begin(teamPress.gameObject, 0.2f, new Vector3(orignalPos.x, orignalPos.y, orignalPos.z)); ShowSprite.spriteName = heroinfo.HeroSelectHead.ToString(); teamPress.gameObject.SetActive(true); if (uit != null) { EventDelegate.Remove(uit.onFinished, Finished); } }
public void SetShowLabel(UInt64 headIcon, string name, int level, int kill, int times, int campId) { tran.gameObject.SetActive(true); if (!EntityManager.AllEntitys.ContainsKey(headIcon)) { return; } IEntity sEntity = EntityManager.AllEntitys[headIcon]; int id = (int)sEntity.ObjTypeID; HeroSelectConfigInfo info = ConfigReader.GetHeroSelectInfo(id); HeadIcon.spriteName = info.HeroSelectHead.ToString(); HeadNameLabel.text = name; HeroLevelLabel.text = level.ToString(); HeroKillsLabel.text = kill.ToString(); HeroDeadTimesLabel.text = times.ToString(); }
void SortByBuyed() { for (int i = 0; i < heroInfoList.Count; i++) { for (int j = 0; j < heroInfoList.Count - 1 - i; j++) { HeroSelectConfigInfo infoA = heroInfoList[j]; HeroSelectConfigInfo infoB = heroInfoList[j + 1]; if (!GameUserModel.Instance.CanChooseHeroList.Contains(infoA.HeroSelectNum) && GameUserModel.Instance.CanChooseHeroList.Contains(infoB.HeroSelectNum)) { HeroSelectConfigInfo temp = heroInfoList[j]; heroInfoList[j] = heroInfoList[j + 1]; heroInfoList[j + 1] = temp; } } } }
private void Init() { heroSelectDic = new Dictionary <Iplayer, int>(); heroSureSelectDic = new Dictionary <Iplayer, int>(); heroInfoList = new List <HeroSelectConfigInfo>(); //英雄信息列表 for (int i = 0; i < ConfigReader.HeroSelectXmlInfoDict.Count; i++) { #region 获得所有英雄信息 HeroSelectConfigInfo item = ConfigReader.HeroSelectXmlInfoDict.ElementAt(i).Value; if (item.IsGuideHero == 1) { continue; } heroInfoList.Add(item); #endregion } SortByBuyed(); }
void SetShowInfo() { Iplayer player = PlayerManager.Instance.LocalPlayer; if (player == null) { return; } foreach (var item in ScoreCtrl.Instance.GetSettlementList()) { if (item.mObjGUID == player.GameObjGUID) { int id = (int)player.ObjTypeID; HeroSelectConfigInfo info = ConfigReader.GetHeroSelectInfo(id); mHeadIcon.spriteName = info.HeroSelectHead.ToString(); mGold.text = ScoreCtrl.Instance.mGotGole.ToString(); mNickName.text = GameUserModel.Instance.GameUserNick; SetLv(); } } }
public void UpdateSureSelect() { //刷新左右两边队伍是否已经选择 for (int i = 0; i < mHeroCount; i++) { mLabelDic[i].gameObject.SetActive(false);//禁用所有的已选定的图像, } foreach (var item in PlayerManager.Instance.AccountDic.Values) { if (HeroCtrl.Instance.heroSureSelectDic.ContainsKey(item)) { mLabelDic[(int)item.GameUserSeat - 1].gameObject.SetActive(true); //显示 已选定 if (!mSpriteSelectDic[(int)item.GameUserSeat - 1].gameObject.activeInHierarchy) { mSpriteSelectDic[(int)item.GameUserSeat - 1].gameObject.SetActive(true); } } } if (HeroCtrl.Instance.heroSureSelectDic.ContainsKey(PlayerManager.Instance.LocalAccount)) { //更新英雄头像和名称,皮肤选择里面 int id = HeroCtrl.Instance.heroSureSelectDic[PlayerManager.Instance.LocalAccount]; //获取确定的英雄的配置文件 HeroSelectConfigInfo config = new HeroSelectConfigInfo(); // HeroSelectXmlInfoDict 英雄选择表 if (ConfigReader.HeroSelectXmlInfoDict.TryGetValue(id, out config)) { mSkinsHeroName.text = config.HeroSelectNameCh; //皮肤名称 mSkinsHeroIcon.spriteName = config.HeroSelectHead.ToString(); //头像名称 } //按钮控制 if (!mBtnSure.enabled) { return; } EnabledSurePress(false);//禁用按钮 } }
void SetLevelDeadKill(BattleInfo item, int i) { BattleInfoList [i].PlayerLevelLabel.text = item.PlayerLevel.ToString(); BattleInfoList [i].PlayerNameLabel.text = item.PlayerName; if (!EntityManager.AllEntitys.ContainsKey(item.PlayerIcon)) { return; } IEntity sEntity = EntityManager.AllEntitys[item.PlayerIcon]; int id = (int)sEntity.ObjTypeID; BattleInfoList [i].PlayerDeathLabel.text = item.PlayerDeath.ToString(); HeroSelectConfigInfo info = ConfigReader.GetHeroSelectInfo(id); BattleInfoList [i].PlayerKillsLabel.text = item.PlayerKills.ToString(); if (info != null) { BattleInfoList [i].PlayerIcon.spriteName = info.HeroSelectHead.ToString(); } }
public void AddInitPlayer(UInt64 sGUID, string name, int kills, int death, int Assist, int level, int lastHit, EntityCampTypeEnum type, int heroid) { HeroBattleInfo HeroBattle = null; Dictionary <UInt64, HeroBattleInfo> heroBattleDic = GetCamp(type); int id = heroid; HeroSelectConfigInfo info = ConfigReader.GetHeroSelectInfo(id); if (info == null) { Debug.LogError("HeroSeletCfg not Find heroId"); return; } if (!heroBattleDic.TryGetValue(sGUID, out HeroBattle)) { HeroBattle = new HeroBattleInfo(); HeroBattle.SGUID = sGUID; HeroBattle.HeroName = name; HeroBattle.Level = level; HeroBattle.Kills = kills; HeroBattle.Deaths = death; HeroBattle.Assist = Assist; HeroBattle.HeadIcon = info.HeroSelectHead; HeroBattle.LastHit = lastHit; HeroBattle.campType = type; SetDic(sGUID, HeroBattle); return; } HeroBattle.SGUID = sGUID; HeroBattle.HeroName = name; HeroBattle.Level = level; HeroBattle.Kills = kills; HeroBattle.Deaths = death; HeroBattle.Assist = Assist; HeroBattle.HeadIcon = info.HeroSelectHead; HeroBattle.LastHit = lastHit; HeroBattle.campType = type; SetDic(sGUID, HeroBattle); }
public ReadSelectHeroConfig(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("herochoose ").ChildNodes; for (int i = 0; i < infoNodeList.Count; i++) //XmlNode xNode in infoNodeList) { if ((infoNodeList[i] as XmlElement).GetAttributeNode("number") == null) { continue; } string typeName = (infoNodeList[i] as XmlElement).GetAttributeNode("number").InnerText; HeroSelectConfigInfo HeroSelectInfo = new HeroSelectConfigInfo(); HeroSelectInfo.HeroSelectNum = Convert.ToInt32(typeName); foreach (XmlElement xEle in infoNodeList[i].ChildNodes) { #region 搜索 switch (xEle.Name) { case "name_ID": HeroSelectInfo.HeroSelectName = Convert.ToString(xEle.InnerText); break; case "name_ch": HeroSelectInfo.HeroSelectNameCh = Convert.ToString(xEle.InnerText); break; case "pic_thumb": HeroSelectInfo.HeroSelectThumb = Convert.ToString(xEle.InnerText); break; case "un8costtype": HeroSelectInfo.HeroSelectCostType = Convert.ToInt32(xEle.InnerText); break; case "n32cost": HeroSelectInfo.HeroSelectCost = Convert.ToSingle(xEle.InnerText); break; case "hero_des": HeroSelectInfo.HeroSelectDes = Convert.ToString(xEle.InnerText); break; case "hero_des2": HeroSelectInfo.HeroSelectDes2 = Convert.ToString(xEle.InnerText); break; case "buy_des": HeroSelectInfo.HeroSelectDesSkill = Convert.ToString(xEle.InnerText); break; case "pic_icon": HeroSelectInfo.HeroSelectHead = Convert.ToInt32(xEle.InnerText); break; case "sound_select": HeroSelectInfo.HeroSelectSound = Convert.ToString(xEle.InnerText); break; case "skill_icon1": HeroSelectInfo.HeroSelectSkill1 = Convert.ToString(xEle.InnerText); break; case "skill_icon2": HeroSelectInfo.HeroSelectSkill2 = Convert.ToString(xEle.InnerText); break; case "newsguidehero": HeroSelectInfo.IsGuideHero = Convert.ToInt32(xEle.InnerText); break; case "hero_desPassitive": HeroSelectInfo.HeroPassDes = Convert.ToString(xEle.InnerText); break; case "skill_iconPassitive": HeroSelectInfo.HeroSkillPass = Convert.ToString(xEle.InnerText); break; case "bac_des": HeroSelectInfo.HeroSelectBuyDes = Convert.ToString(xEle.InnerText);; break; } #endregion } ConfigReader.heroSelectXmlInfoDict.Add(HeroSelectInfo.HeroSelectNum, HeroSelectInfo); } }
public void AddPlayer(UInt64 sGUID, int temp, BattleDataType type, int index = 0, int goodsID = 0) { HeroBattleInfo HeroBattle = null; Dictionary <UInt64, HeroBattleInfo> heroBattleDic = GetCamp(sGUID); if (heroBattleDic == null) { return; } if (!heroBattleDic.TryGetValue(sGUID, out HeroBattle)) { HeroBattle = new HeroBattleInfo(); SetDic(sGUID, HeroBattle); } if (!EntityManager.AllEntitys.ContainsKey(sGUID)) { return; } IEntity sEntity = EntityManager.AllEntitys[sGUID]; switch (type) { case BattleDataType.Cp: HeroBattle.Cp = temp; break; case BattleDataType.LastHit: HeroBattle.LastHit = temp; break; case BattleDataType.HeadIcon: int id = (int)sEntity.ObjTypeID; HeroSelectConfigInfo info = ConfigReader.GetHeroSelectInfo(id); HeroBattle.HeadIcon = info.HeroSelectHead; break; case BattleDataType.NickName: HeroBattle.HeroName = temp.ToString(); break; case BattleDataType.Level: HeroBattle.Level = temp; break; case BattleDataType.Kills: HeroBattle.Kills = temp; break; case BattleDataType.Deaths: HeroBattle.Deaths = temp; break; case BattleDataType.Assist: HeroBattle.Assist = temp; break; case BattleDataType.Goods: //if (goodsID != 0) HeroBattle.AddGoodItem(index, goodsID); //else // HeroBattle.DelGoodsItem(index); break; } heroBattleDic[sGUID] = HeroBattle; }