Exemple #1
0
        public SlotViewModel(int slotIndex, Slot slot)
        {
            this.slotIndex = slotIndex;
            this.slot      = slot;
            Name           = $"Slot {slotIndex}";
            Value          = this;

            Difficulty = new KhEnumListModel <DifficultyType>(() => slot.Difficulty, x => slot.Difficulty = x);
            Location   = new KhEnumListModel <LocationType>(() => slot.Location, x => slot.Location = x);
            Maps       = new KhEnumListModel <MapType>(
                () => Enum.TryParse <MapType>(CurrentMap, out var result) ? result : default(MapType),
                x => MapInfoAttribute.GetMapId(x),
                x => InfoAttribute.GetInfo(x));
            SpawnPoints = new KhEnumListModel <SpawnType>(
                () => Enum.TryParse <SpawnType>(MapSpawn, out var result) ? result : default(SpawnType),
                x => x.ToString());
        }
Exemple #2
0
 private static string DefaultNameGetter(TEnum value) => InfoAttribute.GetInfo(value);