예제 #1
0
    public void LoadPlayerInfo(int slot)
    {
        if (slot < 0 || slot >= PlayerInfoHolder.LoadedHolders.Count)
        {
            Debug.LogError("CharacterSelectionButton: LoadPlayerInfo: slot [" + slot + "] outside the bounds of PlayerInfoHolder.LoadedHolders");
            return;
        }

        PlayerInfoHolder p = PlayerInfoHolder.LoadedHolders[slot];

        if (p.Portrait >= 0 && p.Portrait < PlayerCustomization.PlayerPortraits.Length)
        {
            Portrait.sprite = PlayerCustomization.PlayerPortraits[p.Portrait];
        }
        if (p.Badge >= 0 && p.Badge < PlayerCustomization.PlayerBadges.Length)
        {
            Badge.sprite = PlayerCustomization.PlayerBadges[p.Badge];
        }

        NameText.text      = p.RPGName;
        ClassText.text     = p.RPGProfession;
        Difficulty.text    = "Level " + p.Level + ", " + ((DifficultyLevel)p.Difficulty).ToString() + " difficulty";
        FactionColor.color = p.FactionColor;

        string mapname = "";

        if (MissionDesignator.Designations.ContainsKey(p.CurrentMap))
        {
            mapname = MissionDesignator.Designations[p.CurrentMap].DisplayName;
        }
        CurrentMap.text = "Currently in: " + mapname;

        GetComponent <GUIButton>().onClick.AddListener(() =>
        {
            SaveLoadSystem.SelectPlayerSlot(slot);
        });
    }