using PlayFab.ClientModels; using System.Collections; using System.Collections.Generic; using UnityEngine; public class RankCard : CardBase { public UISprite sprite_rank, sprite_face, sprite_rankbg; public UILabel[] labels; // 0 순위, 1 닉네임, 2 값 public GameObject go_bg; static Dictionary dic_Color = new Dictionary { { false, new Color32(21, 34, 49, 255) }, { true, new Color32(203, 89, 219, 255) }, // 내 색 }; static Color MyrankbgColor = new Color32(114, 10, 129, 255); public override void Set(T _base) { base.Set(_base); var _entry = _base as PlayerLeaderboardEntry; int faceid = _entry.Profile == null || string.IsNullOrEmpty(_entry.Profile.AvatarUrl) ? 1 : int.Parse(_entry.Profile.AvatarUrl); var pcdata = table_itemlist.Ins.Get_Data(faceid); sprite_face.spriteName = pcdata != null ? pcdata.s_ItemIcon : "empty"; Set_Rank(_entry.Position + 1); labels[1].text = _entry.DisplayName; switch (GameUI.Ins.LobbyUI.Get_RankUI().CurTab) { case 0: // 타임어택 labels[2].color = new Color32(0, 255, 246, 255); labels[2].text = _entry.StatValue > 0 ? DSUtil.Get_TimeText_MSms((int.MaxValue - _entry.StatValue) * 0.01f) : "-"; break; case 1: // 스테이지 (10101) labels[2].color = new Color32(0, 255, 246, 255); labels[2].text = _entry.StatValue > 0 ? DSUtil.Format("{0}-{1} {2}웨이브", _entry.StatValue / 10000, _entry.StatValue / 100 % 100, _entry.StatValue % 100) : "-"; break; case 2: // 레벨 (그냥 보여주면 됨) labels[2].color = Color.white; labels[2].text = DSUtil.Format("[ffff00]Lv.{0}", _entry.StatValue); break; case 3: labels[2].color = Color.white; var titleid = table_memorypetbattle.Ins.Get_Data(_entry.StatValue).TitleID; var title = table_title.Ins.Get_TitleName(titleid); labels[2].text = DSUtil.Format("{0} [ffff00]{1}", title, _entry.StatValue); break; } go_bg.GetComponent().color = dic_Color[_entry.PlayFabId.Equals(ServerInfo.Ins.m_LoginInfo.PlayFabId)]; } void Set_Rank(int rank) { if (rank <= 3) { labels[0].text = ""; sprite_rank.spriteName = DSUtil.Format("rank{0}", rank); sprite_rank.gameObject.SetActive(true); } else { labels[0].text = DSUtil.Format("{0}", rank); labels[0].color = new Color32(21, 34, 46, 255); sprite_rank.gameObject.SetActive(false); } } public void Set_MyCard() { go_bg.SetActive(false); sprite_rankbg.color = MyrankbgColor; labels[0].color = new Color32(253, 255, 100, 255); } }