// PRIVATE METHODS IEnumerator ShowEarnings_Coroutine(RoundFinalResult finalResult, RoundFinalResult.PlayerResult playerResult) { var ppi = PPIManager.Instance.GetLocalPPI(); int rank = PlayerPersistantInfo.GetPlayerRankFromExperience(ppi.Experience + finalResult.Experience); int rankBonusMoney = finalResult.NewRank ? (int)GameplayRewards.MoneyRank : 0; m_Labels.Update(m_IsPremiumAccountActive, finalResult.NewRank, finalResult.FirstRound, 0, 0, rankBonusMoney); m_Labels.ShowRank(rank); yield return(new WaitForSeconds(m_FirstCountDelay)); m_Xp.Update(m_IsPremiumAccountActive, finalResult.NewRank, finalResult.FirstRound, finalResult.Experience, finalResult.MissionExp, 0); ppi.Experience += finalResult.Experience; m_Money.Update(m_IsPremiumAccountActive, finalResult.NewRank, finalResult.FirstRound, finalResult.Money, finalResult.MissioMoney, rankBonusMoney); ppi.Money += finalResult.Money; m_Gold.Update(m_IsPremiumAccountActive, false, false, finalResult.Gold, 0, 0); ppi.Gold += finalResult.Gold; yield break; }
public Row(int index, GUIBase_Widget root, RoundFinalResult.PlayerResult player, bool localPlayer) { m_Index = index; m_LocalPlayer = localPlayer; m_Player = player; m_Root = root; m_NicknameLabel = GuiBaseUtils.GetChild <GUIBase_Label>(root, "Name"); m_StandLabel = GuiBaseUtils.GetChild <GUIBase_Label>(root, "Stand_Enum"); m_ScoreLabel = GuiBaseUtils.GetChild <GUIBase_Label>(root, "Score_Enum"); m_KillsLabel = GuiBaseUtils.GetChild <GUIBase_Label>(root, "Kills_Enum"); m_DeadsLabel = GuiBaseUtils.GetChild <GUIBase_Label>(root, "Deads_Enum"); m_RankLabel = GuiBaseUtils.GetChild <GUIBase_Label>(root, "RankNumber"); m_RankIcon = GuiBaseUtils.GetChild <GUIBase_MultiSprite>(root, "RankPic"); m_PlatformIcon = GuiBaseUtils.GetChild <GUIBase_MultiSprite>(root, "PlatformPic"); m_FriendIcon = GuiBaseUtils.GetChild <GUIBase_Widget>(root, "FriendIcon"); m_Root.Show(false, true); }
public void Update(RoundFinalResult.PlayerResult player, RoundFinalResult.PreyNightmare data) { if (player == null) { return; } m_Root.Show(true, true); int rank = PlayerPersistantInfo.GetPlayerRankFromExperience(player.Experience); bool isFriend = GameCloudManager.friendList.friends.FindIndex(obj => obj.PrimaryKey == player.PrimaryKey) != -1; m_FriendIcon.Show(isFriend, true); AnimateWidget(m_NicknameLabel, GuiBaseUtils.FixNameForGui(player.NickName)); AnimateWidget(m_KilledByMeLabel, 0, data.KilledByMe); AnimateWidget(m_KilledMeLabel, 0, data.KilledMe); m_RankLabel.SetNewText(rank.ToString()); m_RankIcon.State = string.Format("Rank_{0}", Mathf.Min(rank, m_RankIcon.Count - 1).ToString("D2")); }
// PUBLIC METHODS public void SetData(RoundFinalResult finalResult, RoundFinalResult.PlayerResult playerResult) { StartCoroutine(ShowEarnings_Coroutine(finalResult, playerResult)); }
IEnumerator UpdateList(List <RoundFinalResult.PlayerResult> players, E_Team winners) { GUIBase_List list = GuiBaseUtils.GetControl <GUIBase_List>(Layout, "Table"); GUIBase_Widget outline = GuiBaseUtils.GetChild <GUIBase_Widget>(list, "MyPlayer"); Row[] rows = new Row[list.numOfLines]; outline.Show(false, true); // sort player by score RoundFinalResult.PlayerResult[] score = players.ToArray(); System.Array.Sort(score, (x, y) => { int res = y.Score.CompareTo(x.Score); if (res == 0) { // descending by kills res = y.Kills.CompareTo(x.Kills); if (res == 0) { // increasing by deaths res = x.Deaths.CompareTo(y.Deaths); if (res == 0) { // increasing by names res = x.NickName.CompareTo(y.NickName); } } } return(res); }); // prepare rows E_Team team = E_Team.Last; for (int idx = 0; idx < list.numOfLines; ++idx) { RoundFinalResult.PlayerResult player = idx < players.Count ? players[idx] : null; if (player != null && player.Team != team) { team = player.Team; } int stand = player != null?System.Array.FindIndex(score, obj => obj.PrimaryKey == player.PrimaryKey) + 1 : -1; rows[idx] = new Row(stand, list.GetWidgetOnLine(idx), player, player != null && player.PrimaryKey == m_PrimaryKey); } yield return(new WaitForSeconds(0.2f)); // show rows for (int idx = 0; idx < list.numOfLines; ++idx) { rows[idx].Update(); do { if (m_SkipAnimations == true) { MFGuiManager.FlushAnimations(); } yield return(new WaitForEndOfFrame()); } while (MFGuiManager.IsAnimating == true); if (rows[idx].PrimaryKey == m_PrimaryKey) { outline.transform.position = list.GetWidgetOnLine(idx).transform.position; outline.SetModify(); outline.Show(true, true); } MFGuiManager.Instance.PlayOneShot(m_ShowRowSound); } }