private (StringBuilder, LeaderboardDataEntry) BuildEntryRowString(LeaderboardDataEntry data) { return(new StringBuilder() .Append(data.Symbol.ToUpper(CultureInfo.InvariantCulture).PadRight(ColumnPadding)) .Append(data.PositionType.ToString().PadRight(ColumnPadding)) .Append(data.TotalAmount.ToString().PadRight(ColumnPadding)), data); }
private static string GetColor(LeaderboardDataEntry data) { if (data.PositionType == "SHORT") { return("red"); } return("green"); }
public void Initialize(LeaderboardDataEntry data) { _rankText.text = data.Rank.ToString(); _nameText.text = data.Name; _scoreText.text = data.Score.ToString(); Sprite background = data.Rank % 2 == 0 ? _backgroundEven : _backgroundOdd; GetComponent <Image>().sprite = background; }
public void PopulateLeaderboards(LeaderboardDataEntry entry) { if (entry.Type == LeaderboardDataType.Player) { _playerLeaderboard.AddEntry(entry); } else { _teamLeaderboard.AddEntry(entry); } }
public void AddEntry(LeaderboardDataEntry entry) { _data.Add(entry); }
private static void HandleLeaderboardDataEntry(LeaderboardDataEntry response) { UIManager.Instance.PopulateLeaderboards(response); }
public static void ReadMessage(byte[] message) { Envelope envelope = SerializationHandler.Deserialize <Envelope>(message); if (envelope == null) { throw new NotAnEnvelopeException(); } switch (envelope.PacketType) { case Packets.None: Debug.Log("None"); break; case Packets.String: string stringVal = SerializationHandler.Deserialize <string>(envelope.Packet); Debug.Log(stringVal); break; case Packets.AckLogin: AckLogin ackLogin = SerializationHandler.Deserialize <AckLogin>(envelope.Packet); HandleAckLogin(ackLogin); break; case Packets.AckJoinTeam: AckJoinTeam ackJoinTeam = SerializationHandler.Deserialize <AckJoinTeam>(envelope.Packet); HandleAckJoinTeam(ackJoinTeam); break; case Packets.DestroyObject: DestroyObject destroyObject = SerializationHandler.Deserialize <DestroyObject>(envelope.Packet); HandleDestroyObject(destroyObject); break; case Packets.PlayerSync: PlayerSync playerSync = SerializationHandler.Deserialize <PlayerSync>(envelope.Packet); HandlePlayerSync(playerSync); break; case Packets.SnowballSync: SnowballSync snowballSync = SerializationHandler.Deserialize <SnowballSync>(envelope.Packet); HandleSnowballSync(snowballSync); break; case Packets.SnowPileSync: SnowPileSync snowPileSync = SerializationHandler.Deserialize <SnowPileSync>(envelope.Packet); HandleSnowPileSync(snowPileSync); break; case Packets.LeaderboardData: LeaderboardDataEntry leaderboardDataResponse = SerializationHandler.Deserialize <LeaderboardDataEntry>(envelope.Packet); HandleLeaderboardDataEntry(leaderboardDataResponse); break; case Packets.EndLeaderboardResponse: HandleEndLeaderboardResponse(); break; case Packets.AckConnection: HandleAckConnection(); break; default: break; } }