Ejemplo n.º 1
0
        public void Update(LeaderBoard.Row row, float normalizedScore, bool isFriend, bool inHighlightPlayer, string facebookName = null)
        {
            int xp   = row.Experience > 0 ? row.Experience : row.Score;
            int rank = PlayerPersistantInfo.GetPlayerRankFromExperience(xp);

            string displayname = string.IsNullOrEmpty(row.DisplayName) ? row.PrimaryKey : GuiBaseUtils.FixNameForGui(row.DisplayName);

            if (facebookName != null)
            {
                displayname = GuiBaseUtils.FixNickname(facebookName + " (" + displayname + ")", displayname, false);
            }

            m_Order.SetNewText(row.Order < 0 ? "" : row.Order.ToString());
            m_RankText.SetNewText(rank <= 0 ? "" : rank.ToString());
            m_DisplayName.SetNewText(displayname);
            m_Score.SetNewText(row.Score < 0 ? "" : row.Score.ToString("N0"));

            string rankState = string.Format("Rank_{0}", Mathf.Min(rank, m_RankIcon.Count - 1).ToString("D2"));

            m_RankIcon.State = rank <= 0 ? GUIBase_MultiSprite.DefaultState : rankState;

            SetProgress(normalizedScore);

            m_Order.Widget.Color       = inHighlightPlayer ? HIGHLIGHT_COLOR : DEFAULT_COLOR;
            m_DisplayName.Widget.Color = inHighlightPlayer ? HIGHLIGHT_COLOR : DEFAULT_COLOR;
            m_Score.Widget.Color       = inHighlightPlayer ? HIGHLIGHT_COLOR : DEFAULT_COLOR;

            m_FriendIcon.FadeAlpha         = isFriend && (facebookName == null) ? 1.0f : 0.0f;
            m_FacebookFriendIcon.FadeAlpha = facebookName != null ? 1.0f : 0.0f;
        }
Ejemplo n.º 2
0
    // 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;
    }
Ejemplo n.º 3
0
    void UpdateXp(PlayerPersistantInfo ppi, bool reset)
    {
        if (GuiFrontendMain.IsVisible == false)
        {
            return;
        }

        int xp    = ppi != null ? ppi.Experience : 0;
        int level = PlayerPersistantInfo.GetPlayerRankFromExperience(xp);

        if (reset == false)
        {
            SetLabelValue(m_LevelLabel, m_Rank, level, AnimateRank);
            m_Rank = level;
        }
        else
        {
            m_LevelLabel.SetNewText(level.ToString());
        }

        int minXp = PlayerPersistantInfo.GetPlayerMinExperienceForRank(Mathf.Clamp(level, 1, PlayerPersistantInfo.MAX_RANK));
        int maxXp = PlayerPersistantInfo.GetPlayerMinExperienceForRank(Mathf.Clamp(level + 1, 1, PlayerPersistantInfo.MAX_RANK));

        m_LevelPic.State = string.Format("Rank_{0}", Mathf.Min(level, m_LevelPic.Count - 1).ToString("D2"));
        m_XPLabel.SetNewText(xp.ToString() + "/" + maxXp.ToString());

        Transform emptyTrans = m_EmptyBar.transform;
        Vector3   pos        = emptyTrans.localPosition;
        Vector3   scale      = emptyTrans.localScale;
        float     width      = m_EmptyBar.GetWidth();
        float     ratio      = minXp != maxXp?Mathf.Clamp((xp - minXp) / (float)(maxXp - minXp), 0.01f, 1.0f) : 0.0f;

        pos.x   -= (width - width * ratio) * scale.x * 0.5f;
        scale.x *= ratio;

        Transform fullTrans = m_FullBar.transform;

        fullTrans.localScale    = scale;
        fullTrans.localPosition = pos;
        m_FullBar.SetModify();
    }
Ejemplo n.º 4
0
        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"));
        }
Ejemplo n.º 5
0
        public void Update()
        {
            if (m_Player == null)
            {
                return;
            }

            m_Root.Show(true, true);

            var animation = MFGuiManager.AnimateWidget(m_Root);

            animation.Duration = 0.15f;
            animation.Scale    = 1.1f;
            animation.Alpha    = 0.0f;

            bool isFriend = GameCloudManager.friendList.friends.FindIndex(obj => obj.PrimaryKey == m_Player.PrimaryKey) != -1;

            m_FriendIcon.Show(isFriend, true);

            int rank = PlayerPersistantInfo.GetPlayerRankFromExperience(m_Player.Experience);

            Color color = m_TeamColors[(int)m_Player.Team];

            color.a      = m_LocalPlayer == true ? 1.0f : 0.5f;
            m_Root.Color = color;

            m_NicknameLabel.SetNewText(GuiBaseUtils.FixNameForGui(m_Player.NickName));
            m_StandLabel.SetNewText(m_Index.ToString());
            m_ScoreLabel.SetNewText(m_Player.Score.ToString());
            m_KillsLabel.SetNewText(m_Player.Kills.ToString());
            m_DeadsLabel.SetNewText(m_Player.Deaths.ToString());
            m_RankLabel.SetNewText(rank.ToString());
            m_RankIcon.State = string.Format("Rank_{0}", Mathf.Min(rank, m_RankIcon.Count - 1).ToString("D2"));

            string platform;

            switch (m_Player.Platform)
            {
            case RuntimePlatform.Android:
                platform = "Plat_Andro";
                break;

            case RuntimePlatform.IPhonePlayer:
                platform = "Plat_Apple";
                break;

            case RuntimePlatform.WindowsPlayer:
                platform = "Plat_Pc";
                break;

            case RuntimePlatform.OSXPlayer:
                platform = "Plat_Mac";
                break;

            case RuntimePlatform.WindowsWebPlayer:
                platform = "Plat_Fb";
                break;

            case RuntimePlatform.OSXWebPlayer:
                platform = "Plat_Fb";
                break;

            default:
                platform = "Plat_Skull";
                break;
            }
            m_PlatformIcon.State = platform;
        }