public void ShowTotalRoundEnd(BRoundEnd data) { ResetTweeners(); if (!TotalRoundEnd) { return; } ShowBgCover(true); if (MidRoundEnd.gameObject.activeSelf) { MidRoundEnd.gameObject.SetActive(false); } if (!TotalRoundEnd.gameObject.activeSelf) { TotalRoundEnd.gameObject.SetActive(true); } TotalRoundEnd.Reset(); TotalRoundEnd.transform.localScale = new Vector3(0, 0, 1); _totalTweener = TotalRoundEnd.transform .DOScale(new Vector3(1, 1, 1), ShowAnimationTime) .SetEase(Ease.OutBack, 1.1f) .OnComplete(() => TotalRoundEnd.RefreshContent(data)); }
private int GetMyTotalScore(BRoundEnd msg, int rank) { if (msg == null) { return(0); } if (rank == 0) { return(msg.total_score1); } if (rank == 1) { return(msg.total_score2); } if (rank == 2) { return(msg.total_score3); } if (rank == 3) { return(msg.total_score4); } return(0); }
private int GetMyExp(BRoundEnd msg, int rank) { if (msg == null) { return(0); } if (rank == 0) { return(msg.final_exp1); } if (rank == 1) { return(msg.final_exp2); } if (rank == 2) { return(msg.final_exp3); } if (rank == 3) { return(msg.final_exp4); } return(0); }
private int GetMyMoney(BRoundEnd msg, int rank) { if (msg == null) { return(0); } if (rank == 0) { return(msg.final_money1); } if (rank == 1) { return(msg.final_money2); } if (rank == 2) { return(msg.final_money3); } if (rank == 3) { return(msg.final_money4); } return(0); }
public void RefreshContent(BRoundEnd msg) { if (msg == null) { return; } if (!RankContent) { return; } var lost = msg.lost; var tableUser = _tableUserData.Read(); // 只有在已经开局的情况下收到结算命令才有用。 _ranks[0] = msg.username1; _ranks[1] = msg.username2; _ranks[2] = msg.username3; _ranks[3] = msg.username4; _win[0] = true; _win[1] = tableUser.IsSameTeam(msg.username2, msg.username1); _win[2] = tableUser.IsSameTeam(msg.username3, msg.username1); _win[3] = tableUser.IsSameTeam(msg.username4, msg.username1); if (lost || SelfWin) { // 掉线或者赢了,都播放赢的声音。 _soundController.PlayEndRoundWinSound(); } else { _soundController.PlayEndRoundLoseSound(); } var user1 = tableUser.GetUserFormUserName(msg.username1); var user2 = tableUser.GetUserFormUserName(msg.username2); var user3 = tableUser.GetUserFormUserName(msg.username3); var user4 = tableUser.GetUserFormUserName(msg.username4); var users = new[] { user1, user2, user3, user4 }; int currentOtherRank = 0; for (int i = 0; i < users.Length; i++) { var u = users[i]; if (u == null) { continue; } var win = lost || IsWin(u); if (tableUser.IsMySelf(u)) { if (EndImage) { if (!EndImage.gameObject.activeSelf) { EndImage.gameObject.SetActive(true); } EndImage.sprite = win ? WinImg : LoseImg; } if (!_mySelfRank) { _mySelfRank = _rankMySelfFactory.Create(); if (_mySelfRank) { _mySelfRank.transform.SetParent(RankContent, false); } } if (_mySelfRank) { if (!_mySelfRank.gameObject.activeSelf) { _mySelfRank.gameObject.SetActive(true); } var room = _room.Read(); var roomCurrencyType = room == null ? CurrencyType.GOLDEN_EGG : room.currency_type; _mySelfRank.transform.SetSiblingIndex(i); // TODO 完成连打房逻辑 _mySelfRank.ApplyData( false, win, u.nickname, u.vip, GetMyExp(msg, i), roomCurrencyType, GetMyMoney(msg, i), msg.race_id, GetMyTotalScore(msg, i), msg.total_multiple); } } else { if (currentOtherRank >= _otherRanks.Count) { var rank = _rankOtherFactory.Create(); if (rank) { rank.transform.SetParent(RankContent, false); _otherRanks.Add(rank); } } if (currentOtherRank < _otherRanks.Count) { var rank = _otherRanks[currentOtherRank]; if (!rank.gameObject.activeSelf) { rank.gameObject.SetActive(true); } currentOtherRank++; rank.ApplyData(win, u.username, u.nickname, u.vip); rank.transform.SetSiblingIndex(i); } } } }