Ejemplo n.º 1
0
    public static string GetPlayerName(uLink.NetworkPlayer player)
    {
        PlayerPersistantInfo p = PPIManager.Instance.GetPPI(player);

        if (p != null)
        {
            return(p.Name);
        }

        return("Unknown");
    }
Ejemplo n.º 2
0
    protected override void Deactivate()
    {
        base.Deactivate();

        PlayerPersistantInfo ppi = GetPPI();

        if (null != ppi)
        {
            ppi.MarkEndGame();
        }
    }
Ejemplo n.º 3
0
    void SynchronizeStatePlayer(uLink.NetworkPlayer player, PlayerPersistantInfo.E_State state)
    {
        PlayerPersistantInfo ppi = GetPPI(player);

        ppi.State = state;

        if (LocalPPI.Player == player)
        {
            LocalPPI.State = state;
        }
    }
    //------------------------------------------------------------------------------------------------------------------
    Color GetColor(PlayerPersistantInfo inPPI)
    {
        Color col = TeamColor[(int)inPPI.Team];

        if (IsAlive(inPPI) == false)
        {
            col *= 0.5f;
        }

        return(col);
    }
    //------------------------------------------------------------------------------------------------------------------
    int GetIndex(PlayerPersistantInfo inPPI, List <PlayerPersistantInfo> inPPIList)
    {
        for (int i = 0; i < inPPIList.Count; ++i)
        {
            if (inPPI.Player == inPPIList[i].Player)
            {
                return(i);
            }
        }

        return(-1);
    }
Ejemplo n.º 6
0
	//-----------------------------------------------------------------------------------------------------------------
	public static void RecordKill(PlayerPersistantInfo killer, PlayerPersistantInfo victim)
	{
		PPILocalStats stats = killer.LocalStats;

		if (stats.m_Kills.ContainsKey(victim.Player))
		{
			stats.m_Kills[victim.Player] += 1;
		}
		else
		{
			stats.m_Kills[victim.Player] = 1;
		}
	}
Ejemplo n.º 7
0
    protected override void Activate()
    {
        base.Activate();

        PlayerPersistantInfo ppi = GetPPI();

        if (null != ppi)
        {
            ppi.MarkStartGame();
        }

        ServerSynchronizeSpeeds(true);
    }
Ejemplo n.º 8
0
        public override bool CanActivate()
        {
            if (Item == null)
            {
                return(false);
            }
            if (Item.GetState() != ResearchState.Active)
            {
                return(false);
            }
            PlayerPersistantInfo ppi = PPIManager.Instance.GetLocalPPI();

            return(ppi != null && ppi.Rank >= MinimalRank?base.CanActivate() : false);
        }
    //------------------------------------------------------------------------------------------------------------------
    static bool IsAlive(PlayerPersistantInfo inPPI)
    {
        ComponentPlayer comp;

        if (Player.Players.TryGetValue(inPPI.Player, out comp) == true)
        {
            if ((comp != null) && (comp.Owner != null))
            {
                return(comp.Owner.IsAlive);
            }
        }

        return(false);
    }
Ejemplo n.º 10
0
    public void ServerAddScoreForSpiderKill(uLink.NetworkPlayer player)
    {
#if !DEADZONE_CLIENT
        PlayerPersistantInfo ppi = PPIManager.Instance.GetPPI(player);

        ppi.AddScore(GameplayRewards.SpiderKill);
        ppi.AddExperience(GameplayRewards.SpiderKill, E_AddMoneyAction.KillSpider);

        Server.Instance.ShowCombatMsgOnClient(ppi.Player, Client.E_MessageType.Spider, GameplayRewards.SpiderKill, (short)(GameplayRewards.SpiderKill * GameplayRewards.MoneyModificator));

        SortDescending();
        SynchronizeScore(ppi);
#endif
    }
    //------------------------------------------------------------------------------------------------------------------
    int ComparePPIsByTeam(PlayerPersistantInfo inA, PlayerPersistantInfo inB)
    {
        int res = inA.Team.CompareTo(inB.Team);

        if (res == 0)
        {
            res = ComparePPIsByScore(inA, inB);
        }
        else
        {
            res = inA.Team == m_FirstTeam ? -1 : +1;
        }

        return(res);
    }
Ejemplo n.º 12
0
    // PRIVATE METHODS

    void ListReceivedNotifications(PlayerPersistantInfo ppi)
    {
        // On iOS currently if the app is running on foreground and the notification appears in
        // the notification area it's added to receivedNotifications. This means that we can't
        // find out that it was not delivered due to user tapping it.
        var receivedNotifications = MFNotificationService.ReceivedNotifications;

        foreach (var notification in receivedNotifications)
        {
            MFNotificationService.CancelNotification(notification.Id);
        }

        MFNotificationService.ClearReceivedNotifications();
        MFNativeUtils.AppIconBadgeNumber = 0;
    }
Ejemplo n.º 13
0
    protected override void OnViewHide()
    {
        UserPPI  = null;
        UserPPIs = null;

        // unbind buttons
        for (int idx = 0; idx < m_Buttons.Length; ++idx)
        {
            GuiBaseUtils.RegisterButtonDelegate(m_Buttons[idx], null, null);
        }
        RegisterButtonDelegate(USERNAMEPREV, null, null);
        RegisterButtonDelegate(USERNAMENEXT, null, null);

        // call super
        base.OnViewHide();
    }
Ejemplo n.º 14
0
    // IGUIPAGEPLAYERSTATS INTERFACE

    void IGuiPagePlayerStats.Refresh(PlayerPersistantInfo ppi)
    {
        PPIWeaponData weaponData;

        // collected values

        WeaponSettings weapon            = ChooseWeapon(ppi, out weaponData);
        ItemSettings   item              = ChooseItem(ppi);
        PerkSettings   perk              = ChoosePerk(ppi);
        HatSettings    hat               = ChooseHat(ppi);
        SkinSettings   skin              = ChooseSkin(ppi);
        float          totalShots        = weaponData.StatsFire;
        float          totalKills        = weaponData.StatsKills;
        int            killsTextId       = totalKills == 1 ? 01160034 : 01160026;
        int            computedAccurancy = totalShots > 0 ? Mathf.RoundToInt((weaponData.StatsHits / (float)totalShots) * 100) : 0;

        // weapon

        SetImage("WeaponImage", weapon != null ? weapon.ResearchWidget : null);
        SetText("WeaponName", weapon != null && weapon.Name != 0 ? TextDatabase.instance[weapon.Name] : "");
        SetText("Kills_Enum", string.Format(TextDatabase.instance[killsTextId], totalKills));
        SetText("Accuracy_Enum", computedAccurancy.ToString());
        SetText("Headshots_Enum", "N/A" /*weaponData.StatsHeadShots.ToString()*/);
        SetText("Shotsfired_Enum", weaponData.StatsFire.ToString());
        SetText("TotalTime_Enum", "N/A");
        SetText("TotalTime_Units", TextDatabase.instance[01160014]);

        // item

        SetImage("ItemImage", item != null ? item.ShopWidget : null);
        SetText("ItemName", item != null && item.Name != 0 ? TextDatabase.instance[item.Name] : "");

        // perk

        SetImage("PerkImage", perk != null ? perk.ShopWidget : null);
        SetText("PerkName", perk != null && perk.Name != 0 ? TextDatabase.instance[perk.Name] : "");

        // hat

        SetImage("HatImage", hat != null ? hat.ShopWidget : null);
        SetText("HatName", hat != null && hat.Name != 0 ? TextDatabase.instance[hat.Name] : "");

        // skin

        SetImage("SkinImage", skin != null ? skin.ScrollerWidget : null);
        SetText("SkinName", skin != null && skin.Name != 0 ? TextDatabase.instance[skin.Name] : "");
    }
Ejemplo n.º 15
0
    //------------------------------------------------------------------------------------------------------------------
    E_Team GetPreferredTeam()
    {
        if ((Client.Instance != null) && (Client.Instance.GameState.GameType != E_MPGameType.ZoneControl))
        {
            return(E_Team.None);
        }

        PlayerPersistantInfo playerPPI = PPIManager.Instance.GetLocalPPI();

        if (playerPPI.Team != E_Team.None)
        {
            return(playerPPI.Team);
        }
        else
        {
            int bCounter = 0;
            int gCounter = 0;
            List <PlayerPersistantInfo> ppiList = PPIManager.Instance.GetPPIList();

            foreach (PlayerPersistantInfo ppi in ppiList)
            {
                if (ppi.Team == E_Team.Bad)
                {
                    bCounter++;
                }
                else if (ppi.Team == E_Team.Good)
                {
                    gCounter++;
                }
            }

            if (bCounter < gCounter)
            {
                return(E_Team.Bad);
            }
            if (bCounter > gCounter)
            {
                return(E_Team.Good);
            }

            int bScore = Client.Instance.GameState.ZCInfo.TeamScore[E_Team.Bad];
            int gScore = Client.Instance.GameState.ZCInfo.TeamScore[E_Team.Good];

            return((bScore < gScore) ? E_Team.Bad : E_Team.Good);
        }
    }
Ejemplo n.º 16
0
    void UpdateTables()
    {
        PlayerPersistantInfo player = PPIManager.Instance.GetLocalPlayerPPI();

        if (player == null)
        {
            return;
        }

        int killedMe   = 0;
        int killedByMe = 0;

        if (m_MyBestVictim != null)
        {
            PlayerPersistantInfo victim = PPILocalStats.GetBestVictim(player, ref killedByMe);

            if (victim != null)
            {
                killedMe = PPILocalStats.GetKills(victim, player);

                m_MyBestVictim.Show();
                m_MyBestVictim.Update(victim, killedMe, killedByMe);
            }
            else
            {
                m_MyBestVictim.Hide();
            }
        }

        if (m_MyBestKiller != null)
        {
            PlayerPersistantInfo killer = PPILocalStats.GetBestKiller(player, ref killedMe);

            if (killer != null)
            {
                killedByMe = PPILocalStats.GetKills(player, killer);

                m_MyBestKiller.Show();
                m_MyBestKiller.Update(killer, killedMe, killedByMe);
            }
            else
            {
                m_MyBestKiller.Hide();
            }
        }
    }
    //------------------------------------------------------------------------------------------------------------------
    void UpdateLines()
    {
        if ((m_Lines == null) || (m_Lines.Length == 0))
        {
            return;
        }

        int highlight = -1;
        PlayerPersistantInfo        local         = PPIManager.Instance.GetLocalPlayerPPI();
        List <PlayerPersistantInfo> original      = PPIManager.Instance.GetPPIList();
        List <PlayerPersistantInfo> sortedByTeam  = new List <PlayerPersistantInfo>(original);
        List <PlayerPersistantInfo> sortedByScore = new List <PlayerPersistantInfo>(original);

        m_FirstTeam = local.Team;

        sortedByTeam.Sort(ComparePPIsByTeam);
        sortedByScore.Sort(ComparePPIsByScore);

        for (int i = 0; i < m_Lines.Length; ++i)
        {
            ChartLine line = m_Lines[i];

            if (i < sortedByTeam.Count)
            {
                PlayerPersistantInfo ppi = sortedByTeam[i];
                Color col = GetColor(ppi);
                int   idx = GetIndex(ppi, sortedByScore) + 1;

                line.Show();
                line.Update(ppi, idx, col);

                if (ppi.Player == local.Player)
                {
                    m_PlayerPlace = idx;
                    highlight     = i;
                }
            }
            else
            {
                line.Hide();
            }
        }

        UpdateHighlighiting(highlight);
    }
    // PRIVATE METHODS

    int ComparePPIsByScore(PlayerPersistantInfo left, PlayerPersistantInfo right)
    {
        int res = right.Score.Score.CompareTo(left.Score.Score);         // 1) descending by score

        if (res == 0)
        {
            res = right.Score.Kills.CompareTo(left.Score.Kills);             // 2) descending by kills
            if (res == 0)
            {
                res = left.Score.Deaths.CompareTo(right.Score.Deaths);                 // 3) increasing by deaths
                if (res == 0)
                {
                    res = left.Name.CompareTo(right.Name);                     // 4) increasing by names
                }
            }
        }
        return(res);
    }
Ejemplo n.º 19
0
    // PUBLIC METHOD

    public void Update()
    {
        PlayerPersistantInfo ppi = PPIManager.Instance.GetLocalPlayerPPI();

        if (ppi == null)
        {
            return;
        }

        int blueScore = Client.Instance.GameState.ZCInfo.TeamScore[E_Team.Good];
        int redScore  = Client.Instance.GameState.ZCInfo.TeamScore[E_Team.Bad];

        SetText(m_BlueTickets, blueScore.ToString("D2"));
        SetText(m_RedTickets, redScore.ToString("D2"));

        ShowText(m_BlueState, ppi.Team == E_Team.Good);
        ShowText(m_RedState, ppi.Team == E_Team.Bad);
    }
Ejemplo n.º 20
0
        // ABSTRACT INTERFACE

        public virtual string HintText()
        {
            PlayerPersistantInfo ppi = PPIManager.Instance.GetLocalPPI();

            if (ppi != null && ppi.Rank < MinimalRank)
            {
                return(string.Format(TextDatabase.instance[09900007], MinimalRank));
            }
            if (ShouldBeIngame == false)
            {
                return(GuiFrontendMain.IsVisible ? null : TextDatabase.instance[09900008]);
            }
            if (GuiFrontendIngame.IsVisible == false && GuiFrontendIngame.IsHudVisible == false)
            {
                return(TextDatabase.instance[09900009]);
            }
            return(null);
        }
Ejemplo n.º 21
0
    // PRIVATE METHODS

    IEnumerator ShowEarnings_Coroutine()
    {
        PlayerPersistantInfo ppi = PPIManager.Instance.GetLocalPlayerPPI();
        bool  hasPremium         = CloudUser.instance.isPremiumAccountActive;
        float premiumMult        = hasPremium ? (1.0f / GameplayRewards.PremiumAccountModificator) : GameplayRewards.PremiumAccountModificator;

        GuiBaseUtils.GetControl <GUIBase_Label>(Layout, PRIMARYEARNINGS_LABEL)
        .SetNewText(hasPremium ? m_EarnWithPremiumTextId : m_EarnWithoutPremiumTextId);
        GuiBaseUtils.GetControl <GUIBase_Label>(Layout, SECONDARYEARNINGS_LABEL)
        .SetNewText(hasPremium ? m_EarnWithoutPremiumTextId : m_EarnWithPremiumTextId);

        var kills  = GuiBaseUtils.GetControl <GUIBase_Label>(Layout, KILLS_ENUM);
        var xp1    = GuiBaseUtils.GetControl <GUIBase_Label>(Layout, PRIMARYXP_ENUM);
        var xp2    = GuiBaseUtils.GetControl <GUIBase_Label>(Layout, SECONDARYXP_ENUM);
        var money1 = GuiBaseUtils.GetControl <GUIBase_Label>(Layout, PRIMARYMONEY_ENUM);
        var money2 = GuiBaseUtils.GetControl <GUIBase_Label>(Layout, SECONDARYMONEY_ENUM);
        var rank   = GuiBaseUtils.GetControl <GUIBase_MultiSprite>(Layout, PLAYERRANKPIC);

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

        kills.SetNewText("0");
        xp1.SetNewText("0");
        xp2.SetNewText("0");
        money1.SetNewText("0");
        money2.SetNewText("0");

        yield return(new WaitForSeconds(m_FirstCountDelay));

        yield return(StartCoroutine(CountDown_Coroutine(kills, null, 0, ppi.Score.Kills, premiumMult)));

        yield return(StartCoroutine(Highlight_Coroutine(kills.Widget, m_ScaleKills)));

        yield return(new WaitForSeconds(m_NextCountDelay));

        yield return(StartCoroutine(CountDown_Coroutine(xp1, xp2, 0, ppi.Score.Experience, premiumMult)));

        yield return(StartCoroutine(Highlight_Coroutine(xp1.Widget, m_ScaleXP)));

        yield return(new WaitForSeconds(m_NextCountDelay));

        yield return(StartCoroutine(CountDown_Coroutine(money1, money2, 0, ppi.Score.Money, premiumMult)));

        yield return(StartCoroutine(Highlight_Coroutine(money1.Widget, m_ScaleMoney)));
    }
Ejemplo n.º 22
0
    public Item(PlayerPersistantInfo ppi, AgentHuman owner, E_ItemID itemID)
    {
        Owner    = owner;
        Settings = ItemSettingsManager.Instance.Get(itemID);

        if (Settings.ItemBehaviour == E_ItemBehaviour.Booster)
        {
            Timer = Settings.BoostTimer;
        }
        else
        {
            Timer = Settings.Timer;
        }
        Detected = false;

        if (Settings.Consumable)
        {
// for cunsumables get real count from inventory !!!
            PPIItemData data = ppi.InventoryList.Items.Find(item => item.ID == itemID);
            Count = data.Count > Settings.MaxCountInMission ? Settings.MaxCountInMission : data.Count;
        }
        else
        {
            Count = Settings.Count > Settings.MaxCountInMission ? Settings.MaxCountInMission : Settings.Count;

            if (ppi.Upgrades.OwnsUpgrade(E_UpgradeID.ExplosivePouch))
            {
                switch (itemID)
                {
                case E_ItemID.GrenadeEMP:
                case E_ItemID.GrenadeEMPII:
                case E_ItemID.GrenadeFlash:
                case E_ItemID.GrenadeFrag:
                case E_ItemID.GrenadeFragII:
                case E_ItemID.Mine:
                case E_ItemID.MineEMP:
                case E_ItemID.MineEMPII:
                    ++Count;
                    break;
                }
            }
        }
        OrigCount = Count;
    }
Ejemplo n.º 23
0
    protected void AskForBoost(E_ItemID gadget)
    {
        if (uLink.Network.isServer == false)
        {
            return;
        }

        if (Owner.BlackBoard.DontUpdate)
        {
            return;
        }

        Item item = Owner.GadgetsComponent.GetGadget(gadget);

        if (item == null)
        {
            return;
        }

        if (!item.IsAvailableForUse())
        {
            return;
        }

        PlayerPersistantInfo ppi = PPIManager.Instance.GetPPI(Owner.NetworkView.owner);

        if (ppi == null)
        {
            return;
        }

        ActiveBoosts.Add(new BoostInfo()
        {
            Settings     = item.Settings,
            TimeToEnd    = Time.timeSinceLevelLoad + item.Settings.BoostTimer,
            CurrentPower = 1
        });

        ppi.ConsumableItemUsed(gadget);

        item.BoostUsed();

        Owner.NetworkView.RPC("RcvBoost", uLink.RPCMode.Others, gadget);
    }
Ejemplo n.º 24
0
    public void ServerAddScoreForMineKill(uLink.NetworkPlayer player)
    {
#if !DEADZONE_CLIENT
        PlayerPersistantInfo ppi = PPIManager.Instance.GetPPI(player);

        ppi.AddScore(GameplayRewards.MineKill);

        //TODO I added the E_AddMoneyAction.KillMine enumerator but I'm not sure if it is supported on the Kontangent side. On the other side -
        //the E_AddMoneyAction do not interact with clients at all - thus such modification should be safe.
        ppi.AddExperience(GameplayRewards.MineKill, E_AddMoneyAction.KillMine);

        //FIXME The message type should be E_MessageType.Mine but there is no such message on the current clients at the moment
        //(and it is unclear if we are ever going to update clients) - thus we have to use what we already have supported on the client side.
        Server.Instance.ShowCombatMsgOnClient(ppi.Player, Client.E_MessageType.Turret, GameplayRewards.MineKill, (short)(GameplayRewards.MineKill * GameplayRewards.MoneyModificator));

        SortDescending();
        SynchronizeScore(ppi);
#endif
    }
Ejemplo n.º 25
0
    public void RegisterUsedItem()
    {
        if (PlayerControlsDrone.Enabled)
        {
            return;
        }

        Count--;
        Timer = 0;

        if (Settings.Consumable)         // if consumable, then
        {
            PlayerPersistantInfo ppi = PPIManager.Instance.GetPPI(Owner.NetworkView.owner);
            if (ppi != null)
            {
                ppi.ConsumableItemUsed(Settings.ID);
            }
        }
    }
Ejemplo n.º 26
0
    void Update()
    {
        if (CloudUser.instance.isUserAuthenticated == false)
        {
            return;
        }

        PlayerPersistantInfo ppi = PPIManager.Instance.GetLocalPPI();

        if (ppi == null)
        {
            return;
        }

        ListReceivedNotifications(ppi);
        CancelScheduledNotifications();

        enabled = false;
    }
    protected override void OnUpdate()
    {
        base.OnUpdate();

        PlayerPersistantInfo playerPPI = PPIManager.Instance.GetLocalPlayerPPI();

        if (playerPPI == null)
        {
            return;
        }

        // colect data...

        int blueScore = Client.Instance.GameState.ZCInfo.TeamScore[E_Team.Good];
        int redScore  = Client.Instance.GameState.ZCInfo.TeamScore[E_Team.Bad];

        string goodCourse = TextDatabase.instance[playerPPI.Team == E_Team.Good ? TextID_YourTeam : TextID_EnemyTeam] + " - ";
        string badCourse  = TextDatabase.instance[playerPPI.Team == E_Team.Bad ? TextID_YourTeam : TextID_EnemyTeam] + " - ";

        if (blueScore > redScore)
        {
            goodCourse += TextDatabase.instance[TextID_Winning];
            badCourse  += TextDatabase.instance[TextID_Losing];
        }
        else if (blueScore < redScore)
        {
            goodCourse += TextDatabase.instance[TextID_Losing];
            badCourse  += TextDatabase.instance[TextID_Winning];
        }
        else
        {
            goodCourse += TextDatabase.instance[TextID_Draw];
            badCourse  += TextDatabase.instance[TextID_Draw];
        }

        // update gui...

        m_GoodCourse.SetNewText(goodCourse);
        m_GoodSpawns.SetNewText(blueScore.ToString("D2"));
        m_BadCourse.SetNewText(badCourse);
        m_BadSpawns.SetNewText(redScore.ToString("D2"));
    }
Ejemplo n.º 28
0
    //-----------------------------------------------------------------------------------------------------------------
    // Process result of "Does user follows/likes this site" request.
    //-----------------------------------------------------------------------------------------------------------------
    void OnStatusCheckResult(bool result)
    {
        //	Debug.Log( "CAPA : GuiScreenBank : OnStatusCheckResult( " + Result + " )" );

        Notification.Hide();

        if (!result)
        {
            return;
        }

        // inform about reward...

        int    reward  = 5;
        string caption = TextDatabase.instance[TextID_Reward_Caption];
        string message = TextDatabase.instance[TextID_Reward_Message].Replace("%d", reward.ToString());

        Notification.Show(caption, message, true);

        // add reward...

        PlayerPersistantInfo ppi = PPIManager.Instance.GetLocalPPI();

        if (m_VisitingSite.m_FBSite)
        {
            ppi.BankData.FacebookSites.Add(m_VisitingSite.m_ID);
        }
        else
        {
            ppi.BankData.TwitterSites.Add(m_VisitingSite.m_ID);
        }

        //	ppi.AddGold( reward );
        //	ppi.Save();

        m_VisitingSite.m_Rewarded = true;
        UpdateSiteButton(m_VisitingSite);

        m_VisitingSite = null;

        //	Debug.Log( "CAPA : GuiScreenBank : OnStatusCheckResult : End" );
    }
Ejemplo n.º 29
0
    public void ServerAddScoreForTurretKill(uLink.NetworkPlayer player, int extraGold)
    {
#if !DEADZONE_CLIENT
        PlayerPersistantInfo ppi = PPIManager.Instance.GetPPI(player);

        ppi.AddScore(GameplayRewards.TurretKill);
        ppi.AddExperience(GameplayRewards.TurretKill, E_AddMoneyAction.KillSentry);
        ppi.AddGoldFromGameplay(extraGold);

        Server.Instance.ShowCombatMsgOnClient(ppi.Player, Client.E_MessageType.Turret, GameplayRewards.TurretKill, (short)(GameplayRewards.TurretKill * GameplayRewards.MoneyModificator));

        if (extraGold > 0)
        {
            Server.Instance.ShowGoldMsgOnClient(player, (short)extraGold);
        }

        SortDescending();
        SynchronizeScore(ppi);
#endif
    }
Ejemplo n.º 30
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();
    }