private void UpdateSkinList() { if (m_LastSkinID != null && m_LastSkinID[0] > 0) { return; } m_bLoadSkin = true; Dictionary <ulong, cmd_update_support_vote_person> playersSupportInfo = LogicDataCenter.labelDataManager.GetWarPlayersSupportInfo(); int nPlayerCount = playersSupportInfo.Count; SSetSKinModelInfo[] heroInfoList = new SSetSKinModelInfo[nPlayerCount]; int nSlotID = 0; foreach (cmd_update_support_vote_person voteItem in playersSupportInfo.Values) { if (nSlotID < 0 || nSlotID >= heroInfoList.Length) { continue; } DataCenter.WarRecordTableDataManager.WarPersonInfo info = LogicDataCenter.recordTableDataManager.getWarPersonInfoByPDBID(voteItem.uPDBIU); if (info == null) { continue; } heroInfoList[nSlotID].nSortID = voteItem.nSortID; heroInfoList[nSlotID].nHeroID = info.nHeroId; heroInfoList[nSlotID].nSkinID = info.nSkinID; nSlotID++; } setHeroSkinModel(heroInfoList); }
public void SetData(cmd_update_support_vote_person data, int nPlayerCount) { if (data.uPDBIU <= 0) { return; } // 初始化标签轮盘 WarLabelSelectItem labelItem = VoteButton.GetComponent <WarLabelSelectItem>(); if (labelItem != null && labelItem.gameObject.activeSelf) { labelItem.Init(data.nVoteID, data.uPDBIU); } m_PDBIU = data.uPDBIU; // 计算玩家本次的点赞总数 int nSupportNum = LogicDataCenter.labelDataManager.getPlayerSupportNum(m_PDBIU); if (parentsView) { VotePointImage.sprite = parentsView.GetSupportNumSprite(nSupportNum); } cmd_war_add_label lastLabel; int nLabelCount; // 当前玩家是否最新被点赞的玩家 bool isLastPlayer = LogicDataCenter.labelDataManager.getLastPlayerLabel(m_PDBIU, out lastLabel, out nLabelCount); if (isLastPlayer) { // 播放标签特效 loadLabelEffect(lastLabel, nLabelCount); } VotePointImage.SetNativeSize(); VotePointImage.gameObject.SetActive(VotePointImage.sprite); SSchemeWarSupportPlayerConfig config = WarSupportPlayerConfigPage.Instance.GetWarSupportPlayerConfig(data.nVoteID); if (config != null) { VoteDescText.text = config.sVoteDesc; TitleImage.sprite = parentsView.GetSupportTitleSprite(config.nVoteIconID); TitleImage.gameObject.SetActive(TitleImage.sprite); } else { Debug.LogError(String.Format("GetWarSupportPlayerConfig failed. nVoteID={0},pdbid={1}", data.nVoteID, data.uPDBIU)); } DataCenter.WarRecordTableDataManager.WarPersonInfo info = LogicDataCenter.recordTableDataManager.getWarPersonInfoByPDBID(data.uPDBIU); if (info == null) { return; } PlayerNameText.text = info.playerName; bool bSameCamp = info.nCamp == EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_CAMP); string szColor = bSameCamp ? "7BDBEDFF" : "FF3434FF"; string szEffectColor = bSameCamp ? "0072FF99" : "92000099"; Color32 color = ColorExtension.FromHex(szColor); Color32 effectcolor = ColorExtension.FromHex(szEffectColor); PlayerNameText.color = color; PlayerNameText.gameObject.GetComponent <Outline>().effectColor = effectcolor; SSchemeWarSupportPositionConfig positionConfig = WarSupportPlayerConfigPage.Instance.GetWarSupportPositionConfig(data.nSortID, nPlayerCount); if (positionConfig == null) { return; } Vector3 oldAnchoredPosition = this.GetComponent <RectTransform>().anchoredPosition; this.GetComponent <RectTransform>().anchoredPosition = new Vector3(positionConfig.fUIPositionOffsetX, oldAnchoredPosition.y, oldAnchoredPosition.z); // 播放光效 if (isLastPlayer) { DoEffect(m_PDBIU, bSameCamp, nSupportNum, data.nSortID); } // 播放音效 if (isLastPlayer) { DoSound(nSupportNum); } }
public override void Update() { base.Update(); if (Time.unscaledTime < m_nextUpdateTime) { return; } if (EntityFactory.MainHeroView == null || EntityFactory.MainHeroView.Property == null) { return; } //更新网络延时 int nNetLatency = GameLogicAPI.getNetLatency(); if (nNetLatency < 1000) { netLatency.text = "延迟:" + nNetLatency.ToString() + "毫秒"; } else { netLatency.text = ((float)nNetLatency / 1000).ToString("F2") + "秒"; } if (nNetLatency < 100) { netLatency.color = Color.green; } else { netLatency.color = Color.red; } Color clr; if (nNetLatency <= 60) { ColorUtility.TryParseHtmlString("#32ff4f", out clr); } else if (nNetLatency < 100) { ColorUtility.TryParseHtmlString("#fffd32", out clr); } else { ColorUtility.TryParseHtmlString("#ff3232", out clr); } netLatency.color = clr; //更新fps if (FpsText) { int fpsValue = (int)FPS.Value; FpsText.text = ULocalizationService.Instance.Get("UIView", "Common", "FPS") + ":" + fpsValue; } DataCenter.WarRecordTableDataManager.WarPersonInfo personInfo = LogicDataCenter.recordTableDataManager.getWarPersonInfoByPDBID((ulong)EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_ID)); if (personInfo == null) { return; } attackText.text = personInfo.nKillNum.ToString(); assistText.text = personInfo.nAssists.ToString(); dieText.text = personInfo.nDeadNum.ToString(); m_nextUpdateTime = Time.unscaledTime + 0.5f; }
public void SetData() { int nMainPlayerCamp = LogicDataCenter.recordTableDataManager.GetMainPlayerCamp(); int nHalfPlayerNum = LogicDataCenter.recordTableDataManager.GetHalfPlayerCount(); Dictionary <ulong, WarRecordTableDataManager.WarPersonInfo> dicPersonInfo = LogicDataCenter.recordTableDataManager.recordInfoArry; if (dicPersonInfo == null || dicPersonInfo.Count <= 0) { return; } defaultTeammateItem.gameObject.SetActive(false); foreach (KeyValuePair <ulong, WarRecordTableDataManager.WarPersonInfo> kvp in dicPersonInfo) { DataCenter.WarRecordTableDataManager.WarPersonInfo personInfo = kvp.Value; int nEntityUID = personInfo.nID; if (nEntityUID <= 0) { // 若一开始没有uid的话,就先只是设置下英雄图片 等以后服务器完善再改 SetTeamSlotHeroIcon(personInfo, nMainPlayerCamp, nHalfPlayerNum); continue; } if (LogicDataCenter.teamRightWndDataManager.MyTeamUIDTable.ContainsKey(nEntityUID)) { continue; } if (LogicDataCenter.teamRightWndDataManager.OtherTeamUIDTable.ContainsKey(nEntityUID)) { continue; } if (personInfo.nCamp == nMainPlayerCamp) { int nSlotId = LogicDataCenter.recordTableDataManager.getIndexAcordPDBID(personInfo.uPDBID); int nLevelID = LogicDataCenter.recordTableDataManager.getHeroLvAcordPDBID(personInfo.uPDBID); TeammateViewItem teammateItem = GameObject.Instantiate <TeammateViewItem>(defaultTeammateItem); teammateItem.gameObject.SetActive(true); teammateItem.helpMeImage.gameObject.SetActive(false); teammateItem.transform.SetParent(defaultTeammateItem.transform.parent, false); m_dicMyTeam.Add(nSlotId, teammateItem); Debug.LogWarningFormat("BattleWarTeammateWndView:SetData:{0},{1}", nSlotId, personInfo.uPDBID); TeamRightInfo teamRightInfo = new TeamRightInfo(); teamRightInfo.nSlotId = nSlotId; LogicDataCenter.teamRightWndDataManager.MyTeamUIDTable[nEntityUID] = teamRightInfo; LogicDataCenter.teamRightWndDataManager.MyTeamEntityIdTable[nSlotId] = nEntityUID; SetMyTeamItemViewShow(nSlotId, personInfo.nHeroId, nLevelID); } } int nTeamPlayerNum = LogicDataCenter.teamRightWndDataManager.MyTeamUIDTable.Count + LogicDataCenter.teamRightWndDataManager.OtherTeamUIDTable.Count; int nTotalPlayerNum = dicPersonInfo.Count; if (nTeamPlayerNum == nTotalPlayerNum && nTotalPlayerNum > 0) { // 所有的玩家信息初始化完成 LogicDataCenter.recordTableDataManager.m_bUpdateTeamInfo = false; } if (nTeamPlayerNum > nTotalPlayerNum) { Debug.LogError("nTeamPlayerNum >= nTotalPlayerNum please to check"); } }
// 更新玩家的TeamRight界面显示 public void UpdateTeamRightViewToShow() { int nMainPlayerCamp = LogicDataCenter.recordTableDataManager.GetMainPlayerCamp(); int nHalfPlayerNum = LogicDataCenter.recordTableDataManager.GetHalfPlayerCount(); Dictionary <ulong, WarRecordTableDataManager.WarPersonInfo> dicPersonInfo = LogicDataCenter.recordTableDataManager.recordInfoArry; if (dicPersonInfo == null || dicPersonInfo.Count <= 0) { return; } foreach (KeyValuePair <ulong, WarRecordTableDataManager.WarPersonInfo> kvp in dicPersonInfo) { DataCenter.WarRecordTableDataManager.WarPersonInfo personInfo = kvp.Value; int nEntityUID = personInfo.nID; if (nEntityUID <= 0) { // 若一开始没有uid的话,就先只是设置下英雄图片 等以后服务器完善再改 SetTeamSlotHeroIcon(personInfo, nMainPlayerCamp, nHalfPlayerNum); continue; } if (LogicDataCenter.teamRightWndDataManager.MyTeamUIDTable.ContainsKey(nEntityUID)) { continue; } if (LogicDataCenter.teamRightWndDataManager.OtherTeamUIDTable.ContainsKey(nEntityUID)) { continue; } if (personInfo.nCamp == nMainPlayerCamp) { TeamRightInfo teamRightInfo = new TeamRightInfo(); int nSlotId = LogicDataCenter.recordTableDataManager.getIndexAcordPDBID(personInfo.uPDBID); int nLevelID = LogicDataCenter.recordTableDataManager.getHeroLvAcordPDBID(personInfo.uPDBID); teamRightInfo.nSlotId = nSlotId; LogicDataCenter.teamRightWndDataManager.MyTeamUIDTable[nEntityUID] = teamRightInfo; LogicDataCenter.teamRightWndDataManager.MyTeamEntityIdTable[nSlotId] = nEntityUID; m_wndView.SetMyTeamItemViewShow(nSlotId, personInfo.nHeroId, nLevelID); m_wndView.SetMyTeamAICommandBtn(personInfo.bIsAI, nSlotId); } else { TeamRightInfo teamRightInfo = new TeamRightInfo(); int nSlotId = nHalfPlayerNum * 2 - LogicDataCenter.recordTableDataManager.getIndexAcordPDBID(personInfo.uPDBID) - 1; teamRightInfo.nSlotId = nSlotId; LogicDataCenter.teamRightWndDataManager.OtherTeamUIDTable[nEntityUID] = teamRightInfo; int nLevelID = LogicDataCenter.recordTableDataManager.getHeroLvAcordPDBID(personInfo.uPDBID); m_wndView.SetOtherTeamItemViewShow(nSlotId, personInfo.nHeroId, nLevelID); } } int nTeamPlayerNum = LogicDataCenter.teamRightWndDataManager.MyTeamUIDTable.Count + LogicDataCenter.teamRightWndDataManager.OtherTeamUIDTable.Count; int nTotalPlayerNum = dicPersonInfo.Count; if (nTeamPlayerNum == nTotalPlayerNum && nTotalPlayerNum > 0) { // 所有的玩家信息初始化完成 LogicDataCenter.recordTableDataManager.m_bUpdateTeamInfo = false; } if (nTeamPlayerNum > nTotalPlayerNum) { Debug.LogError("nTeamPlayerNum >= nTotalPlayerNum please to check"); } }