public void OnSelectHero(int userId, HeroInfo info) { ReadyPlayerSampleInfo readyPlayerSampleInfo = this.TryFindPlayerInfo(userId, "OnSelectHero"); if (readyPlayerSampleInfo != null) { readyPlayerSampleInfo.heroInfo = info; MobaMessageManager.DispatchMsg(ClientC2C.PvpSelectHero, new ParamSelectHero(userId, info)); } else { ClientLogger.Error("OnSelectHero null hero: " + userId); } }
public HeroInfoData GetHeroInfoData(int newUseId) { if (newUseId < 0) { newUseId = -newUseId; } ReadyPlayerSampleInfo readyPlayerSampleInfo = this.TryFindPlayerInfo(newUseId, "GetHeroInfoData"); if (readyPlayerSampleInfo == null || readyPlayerSampleInfo.heroInfo == null) { return(null); } return(readyPlayerSampleInfo.heroInfo.Hero); }
public void OnSelectHeroOk(int newUid, bool ok) { ReadyPlayerSampleInfo readyPlayerSampleInfo = this.TryFindPlayerInfo(newUid, "OnSelectHeroOk"); if (readyPlayerSampleInfo != null) { readyPlayerSampleInfo.horeSelected = ok; if (!ok) { readyPlayerSampleInfo.heroInfo = null; } MobaMessageManager.DispatchMsg(ClientC2C.PvpSelectHeroOk, new ParamSelectHero(newUid, readyPlayerSampleInfo.heroInfo)); } }
public ReadyPlayerSampleInfo TryFindPlayerInfo(int playerId, string reason = null) { ReadyPlayerSampleInfo readyPlayerSampleInfo = this._roomInfo.PvpPlayers.FirstOrDefault((ReadyPlayerSampleInfo x) => x.newUid == playerId); if (readyPlayerSampleInfo == null && reason != null) { ClientLogger.Error(string.Concat(new object[] { "cannot found player: ", playerId, " for ", reason, " stack:\n", new StackTraceUtility().ToString() })); } return(readyPlayerSampleInfo); }
private void RefreshUI_summonerSkill() { ReadyPlayerSampleInfo memInfo = this.MemInfo; this.sp_summonerSkill.gameObject.SetActive(false); if (!string.IsNullOrEmpty(memInfo.selfDefSkillId)) { SysSummonersSkillVo dataById = BaseDataMgr.instance.GetDataById <SysSummonersSkillVo>(memInfo.selfDefSkillId); if (dataById != null) { SysSkillMainVo skillMainData = BaseDataMgr.instance.GetSkillMainData(dataById.skill_id); if (skillMainData != null) { this.sp_summonerSkill.mainTexture = ResourceManager.Load <Texture>(skillMainData.skill_icon, true, true, null, 0, false); this.sp_summonerSkill.gameObject.SetActive(true); } } } }
private void RefreshUI_heroIcon() { ReadyPlayerSampleInfo memInfo = this.MemInfo; SysHeroMainVo heroMainData = BaseDataMgr.instance.GetHeroMainData(memInfo.GetHeroId()); if (heroMainData == null) { ClientLogger.Error("找不到heroMain表信息,heroID=" + memInfo.GetHeroId()); return; } string text = string.Empty; if (memInfo.heroSkinId != "0" && memInfo.heroSkinId != string.Empty) { Dictionary <string, object> dicByType = BaseDataMgr.instance.GetDicByType <SysHeroSkinVo>(); if (dicByType != null && dicByType.ContainsKey(memInfo.heroSkinId)) { SysHeroSkinVo sysHeroSkinVo = dicByType[memInfo.heroSkinId] as SysHeroSkinVo; if (sysHeroSkinVo != null) { text = sysHeroSkinVo.avatar_icon; } else { ClientLogger.Error("找不到SysHeroSkinVo表信息,skinID=" + memInfo.heroSkinId); } } else { ClientLogger.Error("找不到SysHeroSkinVo表信息2,skinID=" + memInfo.heroSkinId); } } else { text = heroMainData.avatar_icon; } if (!string.IsNullOrEmpty(text)) { this.sp_heroIcon.mainTexture = ResourceManager.Load <Texture>(text, true, true, null, 0, false); } }
private void ShowAbsent(ReadyPlayerSampleInfo data, NewHeroItem.CardType cardType = NewHeroItem.CardType.Lock, bool isSelf = false) { this._showAbsent = false; if (data != null && (cardType == NewHeroItem.CardType.HeroCardLeft || (cardType == NewHeroItem.CardType.HeroCardRight && !this._hideEnemy))) { this._showAbsent = !data.IsReadySelectHero; if (isSelf) { this._showAbsent = false; } } Transform transform = base.transform.Find("IsPresent"); if (transform) { transform.gameObject.SetActive(this._showAbsent); } else { ClientLogger.Error("cannot found IsPresent"); } }
public string GetSummonerSkillId(int newUseId) { if (newUseId < 0) { newUseId = -newUseId; } ReadyPlayerSampleInfo readyPlayerSampleInfo = this.TryFindPlayerInfo(newUseId, null); string unikey = string.Empty; if (LevelManager.Instance.IsPvpBattleType) { if (readyPlayerSampleInfo == null) { return(string.Empty); } if (string.IsNullOrEmpty(readyPlayerSampleInfo.selfDefSkillId)) { return(string.Empty); } unikey = readyPlayerSampleInfo.selfDefSkillId; } else { unikey = Singleton <PvpChoiceSkillView> .Instance.GetSkillID(); } SysSummonersSkillVo dataById = BaseDataMgr.instance.GetDataById <SysSummonersSkillVo>(unikey); if (dataById == null) { if (readyPlayerSampleInfo != null) { ClientLogger.Error("GetSummonerSkillID null:" + readyPlayerSampleInfo.selfDefSkillId); } return(string.Empty); } return(dataById.skill_id); }
private void NewbieSetUserNameForRobot() { string text = string.Empty; string text2 = string.Empty; for (int i = 0; i < this._pvpPlayers.Count; i++) { ReadyPlayerSampleInfo readyPlayerSampleInfo = this._pvpPlayers[i]; if (readyPlayerSampleInfo != null) { if (string.IsNullOrEmpty(readyPlayerSampleInfo.userName)) { if (readyPlayerSampleInfo.heroInfo != null) { text = readyPlayerSampleInfo.heroInfo.heroId; if (!string.IsNullOrEmpty(text)) { SysHeroMainVo heroMainData = BaseDataMgr.instance.GetHeroMainData(text); if (heroMainData != null) { text2 = heroMainData.name; if (!string.IsNullOrEmpty(text2)) { SysLanguageVo languageData = BaseDataMgr.instance.GetLanguageData(text2); if (languageData != null) { readyPlayerSampleInfo.userName = languageData.content + "(电脑)"; } } } } } } } } }
public void InitPVP(ReadyPlayerSampleInfo data, NewHeroItem.CardType cardType = NewHeroItem.CardType.Lock, bool isSelf = false) { SysBattleSceneVo dataById = BaseDataMgr.instance.GetDataById <SysBattleSceneVo>(LevelManager.CurLevelId); if (dataById == null) { return; } this._hideEnemy = (dataById.show_enemy_squad == 0); if (Singleton <PvpManager> .Instance.IsObserver) { this._hideEnemy = false; } this.ShowAbsent(data, cardType, isSelf); HeroData herosData = null; if (this.m_UnConnect == null && this.m_CenterCanChange == null) { return; } if (data == null || data.heroInfo == null) { this.m_UnConnect.gameObject.SetActive(true); this.m_CenterCanChange.gameObject.SetActive(false); } if (data != null && data.heroInfo != null && !string.IsNullOrEmpty(data.GetHeroId())) { herosData = new HeroData { HeroID = data.GetHeroId(), Stars = data.heroInfo.star, Quality = data.heroInfo.quality, LV = CharacterDataMgr.instance.GetLevel(data.heroInfo.exp) }; } this.m_UnConnect.gameObject.SetActive(false); this.m_CustomName.text = string.Empty; if (cardType == NewHeroItem.CardType.Lock) { this.Init(null, cardType, true, true); } else if (cardType == NewHeroItem.CardType.HeroCardLeft) { this.m_CustomName.text = data.userName; if (isSelf) { this.m_CustomName.color = new Color(0.996078432f, 0.772549033f, 0.003921569f); } if (data.CharmRankvalue <= 50) { this.m_CustomName.gameObject.GetComponent <AllochroicLabelChecker>().RenderLabel(data.CharmRankvalue); } this.Init(herosData, NewHeroItem.CardType.HeroCardLeft, true, true); this.m_CenterCanChangeLabel.text = ((!isSelf) ? "?" : LanguageManager.Instance.GetStringById("PVPChooseHeroUI_ChooseHeroHelp")); this.m_CenterCanChange.gameObject.SetActive(true); this.m_CustomName.GetComponent <UIWidget>().rawPivot = UIWidget.Pivot.Left; Transform arg_224_0 = this.m_CustomName.transform; Vector3 localEulerAngles = Vector3.one; this.m_CenterCanChangeLabel.transform.localEulerAngles = localEulerAngles; arg_224_0.localEulerAngles = localEulerAngles; this.m_BottomLeft.gameObject.SetActive(true); } else if (cardType == NewHeroItem.CardType.HeroCardRight) { if (this._hideEnemy) { this.m_CustomName.text = LanguageManager.Instance.GetStringById("SummonerUI_Title_Summoner") + (base.transform.GetSiblingIndex() + 1); this.Init(herosData, NewHeroItem.CardType.HeroCardRight, true, true); if (this.m_CenterCanChangeLabel.text != "?") { this.m_CenterCanChangeLabel.text = "?"; } this.m_HeroTexture.enabled = false; this.m_CenterCanChange.gameObject.SetActive(true); this.m_CustomName.GetComponent <UIWidget>().rawPivot = UIWidget.Pivot.Right; Transform arg_316_0 = this.m_CustomName.transform; Vector3 localEulerAngles = new Vector3(0f, 180f, 0f); this.m_CenterCanChangeLabel.transform.localEulerAngles = localEulerAngles; arg_316_0.localEulerAngles = localEulerAngles; this.m_BottomLeft.gameObject.SetActive(true); } else { this.m_CustomName.text = data.userName; if (data.CharmRankvalue <= 50) { this.m_CustomName.gameObject.GetComponent <AllochroicLabelChecker>().RenderLabel(data.CharmRankvalue); } this.Init(herosData, NewHeroItem.CardType.HeroCardRight, true, true); this.m_CenterCanChangeLabel.text = ((!isSelf) ? "?" : LanguageManager.Instance.GetStringById("PVPChooseHeroUI_ChooseHeroHelp")); this.m_CenterCanChange.gameObject.SetActive(true); this.m_CustomName.GetComponent <UIWidget>().rawPivot = UIWidget.Pivot.Right; Transform arg_3F2_0 = this.m_CustomName.transform; Vector3 localEulerAngles = new Vector3(0f, 180f, 0f); this.m_CenterCanChangeLabel.transform.localEulerAngles = localEulerAngles; arg_3F2_0.localEulerAngles = localEulerAngles; this.m_BottomLeft.gameObject.SetActive(true); } } if (cardType == NewHeroItem.CardType.HeroCardRight || cardType == NewHeroItem.CardType.HeroCardLeft) { if (this.heroData == null) { this.m_TopLeft.gameObject.SetActive(false); this.m_TopRight.gameObject.SetActive(false); } if (this.heroData == null) { this.GrayHeroItem(this.heroData); } } this._bindedNewUid = ((data == null) ? 0 : data.newUid); }
public bool HasPlayerConfirmedReady(int newUId) { ReadyPlayerSampleInfo readyPlayerSampleInfo = this._roomInfo.PvpPlayers.FirstOrDefault((ReadyPlayerSampleInfo x) => x.newUid == newUId); return(readyPlayerSampleInfo.readyChecked); }
public bool IsOurPlayer(int userId) { ReadyPlayerSampleInfo readyPlayerSampleInfo = this.TryFindPlayerInfo(userId, null); return(readyPlayerSampleInfo != null && readyPlayerSampleInfo.GetTeam() == this.SelfTeamType); }
public static TeamType GetTeam(this ReadyPlayerSampleInfo info) { return(PvpProtocolTools.GroupToTeam((int)info.group)); }