Exemplo n.º 1
0
        protected override void OnActivate()
        {
            base.OnActivate();

            if (CurrentLayout == null && Layouts.Any())
            {
                CurrentLayout = Layouts.First();
            }
        }
Exemplo n.º 2
0
        internal void InitBaseData()
        {
            if (!Maps.Any())
            {
                var lines = File.ReadAllLines("SquadMaps.csv").Skip(1);
                foreach (var line in lines)
                {
                    var items = line.Split(';');
                    Maps.Add(new GameMap()
                    {
                        Name   = items[0],
                        Region = Enum.Parse <GameMapRegion>(items[1]),
                    });
                }
                SaveChanges();
            }
            if (!Layouts.Any())
            {
                var lines = File.ReadAllLines("SquadLayouts.csv").Skip(1);
                foreach (var line in lines)
                {
                    var items = line.Split(';');
                    var name  = items[0];
                    Layouts.Add(new GameLayout()
                    {
                        Name      = name,
                        Left      = !string.IsNullOrEmpty(items[1]) ? (Faction?)Enum.Parse <Faction>(items[1]) : null,
                        Right     = !string.IsNullOrEmpty(items[2]) ? (Faction?)Enum.Parse <Faction>(items[2]) : null,
                        Thumbnail = items[3],
                        MapFull   = items[4],
                        GameMap   = Maps.FirstOrDefault(m => name.Contains(m.Name)) ?? Maps.FirstOrDefault(m => m.Region == GameMapRegion.Training)
                    });
                }
                SaveChanges();
            }

            if (!Users.Any())
            {
                for (int i = 1; i <= 80; ++i)
                {
                    Users.Add(new User()
                    {
                        Name = $"User {i}", SteamId = "XXXXXXXXX"
                    });
                    SaveChanges();
                }
            }
        }
Exemplo n.º 3
0
 public bool IsShortcutUsed(Shortcut sc, ILayout layout)
 {
     return(!sc.IsEmpty() && Layouts.Any(l => l != layout && l.Shortcut.Match(sc)));
 }