public void UpdateLocalRank(int rank, NetworkGameScore ranking) { if (localRanking != null) { localRanking.SetData(rank, ranking); } }
public NetworkGameScore[] GetSortedScores() { for (var i = Characters.Count - 1; i >= 0; --i) { var character = Characters[i]; if (character == null) { Characters.RemoveAt(i); } } Characters.Sort(); var scores = new NetworkGameScore[Characters.Count]; for (var i = 0; i < Characters.Count; ++i) { var character = Characters[i]; var ranking = new NetworkGameScore(); ranking.netId = character.netId; ranking.playerName = character.playerName; ranking.score = character.Score; ranking.killCount = character.KillCount; ranking.assistCount = character.AssistCount; ranking.dieCount = character.DieCount; scores[i] = ranking; } return(scores); }
public NetworkGameScore[] GetSortedScores() { for (var i = Characters.Count - 1; i >= 0; --i) { var character = Characters[i]; if (character == null) { Characters.RemoveAt(i); } } Characters.Sort(); var scores = new NetworkGameScore[Characters.Count]; for (var i = 0; i < Characters.Count; ++i) { var character = Characters[i]; var score = new NetworkGameScore(); score.netId = character.ObjectId; score.playerName = character.playerName; score.team = character.playerTeam; score.score = character.Score; score.killCount = character.KillCount; score.assistCount = character.AssistCount; score.dieCount = character.DieCount; if (score.netId == BaseNetworkGameCharacter.LocalNetId) { BaseNetworkGameCharacter.LocalRank = i + 1; } scores[i] = score; } return(scores); }
protected void RpcUpdateScores(int length, object[] objects) { if (length == 0 || objects == null) { return; } var scores = new NetworkGameScore[length]; var j = 0; for (var i = 0; i < length; ++i) { var score = new NetworkGameScore(); score.viewId = (int)objects[j++]; score.playerName = (string)objects[j++]; score.team = (byte)objects[j++]; score.score = (int)objects[j++]; score.killCount = (int)objects[j++]; score.assistCount = (int)objects[j++]; score.dieCount = (int)objects[j++]; if (score.viewId == BaseNetworkGameCharacter.LocalViewId) { BaseNetworkGameCharacter.LocalRank = i + 1; } scores[i] = score; } UpdateScores(scores); }
public void SetData(int rank, NetworkGameScore ranking) { Clear(); if (ranking.Equals(NetworkGameScore.Empty) || ranking.viewId <= 0) { return; } if (textRank != null) { textRank.text = "#" + rank; } if (textName != null) { textName.text = ranking.playerName; } if (textScore != null) { textScore.text = ranking.score.ToString("N0"); } if (textKillCount != null) { textKillCount.text = ranking.killCount.ToString("N0"); } if (textAssistCount != null) { textAssistCount.text = ranking.assistCount.ToString("N0"); } if (textDieCount != null) { textDieCount.text = ranking.dieCount.ToString("N0"); } if (textTeam != null) { switch (ranking.team) { case 1: textTeam.text = teamA; break; case 2: textTeam.text = teamB; break; default: textTeam.text = noTeam; break; } } var isLocal = BaseNetworkGameCharacter.Local != null && ranking.viewId.Equals(BaseNetworkGameCharacter.Local.photonView.ViewID); SetTextColor(isLocal, textRank); SetTextColor(isLocal, textName); SetTextColor(isLocal, textScore); SetTextColor(isLocal, textKillCount); SetTextColor(isLocal, textAssistCount); SetTextColor(isLocal, textDieCount); SetTextColor(isLocal, textTeam); }
public override void Deserialize(NetDataReader reader) { int length = reader.GetPackedInt(); scores = new NetworkGameScore[length]; for (int i = 0; i < length; ++i) { var score = new NetworkGameScore(); score.Deserialize(reader); scores[i] = score; } }
public void SetData(int rank, NetworkGameScore ranking) { Clear(); if (ranking.Equals(NetworkGameScore.Empty) || ranking.netId.IsEmpty()) { return; } if (textRank != null) { textRank.text = "#" + rank; } if (textName != null) { textName.text = ranking.playerName; } if (textScore != null) { textScore.text = ranking.fixScore.ToString("N0"); } if (textKillCount != null) { textKillCount.text = ranking.killCount.ToString("N0"); } if (textAssistCount != null) { textAssistCount.text = ranking.killCount.ToString("N0"); } if (textDieCount != null) { textDieCount.text = ranking.killCount.ToString("N0"); } var isLocal = BaseNetworkGameCharacter.Local != null && ranking.netId.Equals(BaseNetworkGameCharacter.Local.netId); SetTextColor(isLocal, textRank); SetTextColor(isLocal, textName); SetTextColor(isLocal, textScore); SetTextColor(isLocal, textKillCount); }
protected void RpcUpdateScores(int length, object[] objects) { if (length == 0 || objects == null) { return; } var scores = new NetworkGameScore[length]; var j = 0; for (var i = 0; i < length; ++i) { var score = new NetworkGameScore(); score.viewId = (int)objects[j++]; score.playerName = (string)objects[j++]; score.team = (PunTeams.Team)objects[j++]; score.score = (int)objects[j++]; score.killCount = (int)objects[j++]; score.assistCount = (int)objects[j++]; score.dieCount = (int)objects[j++]; scores[i] = score; } UpdateScores(scores); }