public override void parseConfig(string str)
    {
        LaddersMedalSample sample = new LaddersMedalSample(str);

        sample.index = index;
        samples.Add(sample);
        index++;
    }
示例#2
0
    /// <summary>
    /// 更新玩家的当前信息 vip,战斗力,称号,奖章等
    /// </summary>
    public void M_updateUserInfo()
    {
        User self   = UserManager.Instance.self;
        int  vipLv  = self.getVipLevel();
        int  combat = ArmyManager.Instance.getTeamCombat(ArmyManager.PVP_TEAMID);

        LaddersTitleSample currentTitle = LaddersManagement.Instance.M_getCurrentPlayerTitle();

        if (currentTitle != null)
        {
            label_title.text = LaddersManagement.Instance.M_getCurrentPlayerTitle().name;
        }
        else
        {
            label_title.text = Language("laddersTip_14");
        }

        LaddersMedalSample currentMedal = LaddersManagement.Instance.M_getCurrentPlayerMedal();

        if (currentMedal != null)
        {
            sprite_medalBg.spriteName = "medal_" + Math.Min(currentMedal.index + 1, 5);
        }
        else
        {
            sprite_medalBg.spriteName = "medal_0";
        }

        label_userName.text = self.nickname;
        if (vipLv > 0)
        {
            sprite_vip.gameObject.SetActive(true);
            sprite_vip.spriteName = "vip" + vipLv;
        }
        else
        {
            sprite_vip.gameObject.SetActive(false);
        }

        label_level.text = "Lv." + self.getUserLevel().ToString();

        label_rank.text   = Language("laddersPrefix_01") + LaddersManagement.Instance.currentPlayerRank.ToString();
        label_combat.text = Language("laddersPrefix_02") + combat.ToString();

        //获取自身声望值
        int myPrestige = UserManager.Instance.self.prestige;
        //通过自身声望值获取对应称号
        LaddersTitleSample currentTitleSample = LaddersConfigManager.Instance.config_Title.M_getTitle(myPrestige);
        //通过自身称号获取下一级称号
        LaddersTitleSample nextTitleSample = LaddersConfigManager.Instance.config_Title.M_getTitleByIndex(currentTitleSample.index + 1);

        //如果不存在下一级称号
        if (nextTitleSample == null)
        {
            prestigeExpBar.updateValue(myPrestige, myPrestige);
            label_prestige.text = myPrestige + "/" + myPrestige;
        }
        //存在下一级称号
        else
        {
            if (LaddersConfigManager.Instance.config_Title.isMaxIndex(currentTitleSample.index + 1))
            {
                prestigeExpBar.updateValue(nextTitleSample.minPrestige, nextTitleSample.minPrestige);
                label_prestige.text = nextTitleSample.minPrestige + "/" + nextTitleSample.minPrestige;
            }
            else
            {
                prestigeExpBar.updateValue(myPrestige, nextTitleSample.minPrestige);
                label_prestige.text = myPrestige + "/" + nextTitleSample.minPrestige;
            }
        }
        label_laddersTimes.text = Language("laddersPrefix_04", (LaddersManagement.Instance.maxFightTime - LaddersManagement.Instance.currentChallengeTimes).ToString(), LaddersManagement.Instance.maxFightTime.ToString());

        UserManager.Instance.setSelfHeadIcon(texture_userHead);

        LaddersRecordInfo lastRecord = LaddersManagement.Instance.Records.M_getLastRecord();

        if (lastRecord != null)
        {
            label_lastRecord.text = lastRecord.description;
        }
        else
        {
            label_lastRecord.text = "";
        }
    }