using System;
using System.Collections.Generic;
using System.Linq;
using Robust.Shared.Interfaces.Serialization;
using Robust.Shared.Serialization;
namespace Content.Shared.Preferences
{
///
/// Contains all player characters and the index of the currently selected character.
/// Serialized both over the network and to disk.
///
[Serializable, NetSerializable]
public class PlayerPreferences
{
public static PlayerPreferences Default()
{
return new PlayerPreferences
{
Characters = new List
{
HumanoidCharacterProfile.Default()
},
SelectedCharacterIndex = 0
};
}
private List _characters;
private int _selectedCharacterIndex;
///
/// All player characters.
///
public List Characters
{
get => _characters;
set => _characters = value;
}
///
/// Index of the currently selected character.
///
public int SelectedCharacterIndex
{
get => _selectedCharacterIndex;
set => _selectedCharacterIndex = value;
}
///
/// Retrieves the currently selected character.
///
public ICharacterProfile SelectedCharacter => Characters.ElementAtOrDefault(SelectedCharacterIndex);
}
}