public override string ToString() { var sb = new StringBuilder(); sb.AppendLine("AutoDI Settings:"); sb.AppendLine($" Behavior(s): {Behavior}"); sb.AppendLine($" AutoInit: {AutoInit}"); sb.AppendLine($" GenerateRegistrations: {GenerateRegistrations}"); sb.AppendLine($" DebugLogLevel: {DebugLogLevel}"); sb.AppendLine($" DebugExceptions: {DebugExceptions}"); sb.Append(" Included Assemblies: "); if (Assemblies.Any()) { sb.AppendLine(); foreach (MatchAssembly assembly in Assemblies) { sb.AppendLine($" {assembly}"); } } else { sb.AppendLine("<none>"); } sb.Append(" Maps: "); if (Maps.Any()) { sb.AppendLine(); foreach (Map map in Maps) { sb.AppendLine($" {map}"); } } else { sb.AppendLine("<none>"); } sb.Append(" Type Lifetimes: "); if (Types.Any()) { sb.AppendLine(); foreach (MatchType type in Types) { sb.AppendLine($" {type}"); } } else { sb.AppendLine("<none>"); } return(sb.ToString()); }
private PropMap CreatePropMap(Type sourceType, Type destType, ListControlActionType actionType) { PropMap map = new PropMap(sourceType, destType, actionType); if (Maps.Any(m => m.Equals(map))) { throw new InvalidOperationException("Same map already added."); } Maps.Add(map); return(map); }
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(); } } }
public PlayerSelectArena(Golf game, BaseArena previousArena, List <Player> players) : base(game, previousArena) { Players = players; var nextItem = new MenuItem(game, Fonts.GameFont.MeasureString( new Vector2(10, 100), Strings.Next), Strings.Next); var playerItem = new PlayersMenuItem(game, Fonts.GameFont.MeasureString( new Vector2(10, nextItem.Bounds.Y + nextItem.Bounds.Height), Strings.PlayersMStr), () => Game.GameSettings.Players, p => { Game.GameSettings.Players = p; }, Strings.Players); gameType = new GameTypeItem(game, Fonts.GameFont.MeasureString(new Vector2(10, playerItem.Bounds.Y + playerItem.Bounds.Height), Strings.GameType), Strings.GameType); var backItem = new MenuItem(game, Fonts.GameFont.MeasureString(new Vector2(10, gameType.Bounds.Y + gameType.Bounds.Height), Strings.Back), Strings.Back); Maps = new List <SMap>(game.CustomGameStorage.LoadMaps().Maps); if (!Maps.Any()) { Game.CustomGameStorage.AddMap(new TestMap().ToSMap()); Maps = new List <SMap>(game.CustomGameStorage.LoadMaps().Maps); } CustomLevelSelector = new CustomLevelSelector(Maps); NormalLevelSelector = new NormalLevelSelector(); MapChooser = new MapChooser(game, new Rectangle((int)Game.Center.X - ((Textures.MapBorder.Width + (Textures.Back.Width * 2)) / 2), 100, Textures.MapBorder.Width, Textures.MapBorder.Height), string.Empty, gameType.GameType == GameType.Normal?NormalLevelSelector:CustomLevelSelector, this); _menu = Maps.Any()? new Menu(Game, HandleMenuSelect, nextItem, playerItem, gameType, backItem ): new Menu(Game, HandleMenuSelect, nextItem, playerItem, backItem ); }
public MapInfo(int map, string attFile) { Maps[] disabled = new Maps[] { Maps.BloodCastle1, Maps.BloodCastle2, Maps.BloodCastle3, Maps.BloodCastle4, Maps.BloodCastle5, Maps.BloodCastle6, Maps.BloodCastle7, Maps.BloodCastle8, Maps.DevilSquare, Maps.DevilSquare2, Maps.ChaosCastle1, Maps.ChaosCastle2, Maps.ChaosCastle3, Maps.ChaosCastle4, Maps.ChaosCastle5, Maps.ChaosCastle6, Maps.ChaosCastle7, }; IsEvent = disabled.Any(x => (int)x == map); using (var fr = File.OpenRead(attFile)) { var length = fr.Length; var type = fr.ReadByte(); Width = fr.ReadByte(); Height = fr.ReadByte(); length -= fr.Position; var tmp = new byte[length]; fr.Read(tmp, 0, tmp.Length); Layer = tmp.Select(x => (MapAttributes)x).ToArray(); Map = map; } Weather = 0x30; _nextWeater = DateTime.Now.AddMilliseconds(Program.RandomProvider(10000) + 10000); Monsters = new List <Monster>(); Players = new List <Character>(); Items = new Dictionary <ushort, ItemInMap>(); switch ((Maps)Map) { case Maps.Lorencia: SafeArea = new Rectangle(130, 116, 21, 21); break; case Maps.Dugeon: SafeArea = new Rectangle(106, 236, 6, 7); break; case Maps.Davias: SafeArea = new Rectangle(197, 35, 21, 15); break; case Maps.Noria: SafeArea = new Rectangle(174, 101, 13, 24); break; case Maps.LostTower: SafeArea = new Rectangle(201, 70, 12, 11); break; case Maps.Atlans: SafeArea = new Rectangle(14, 11, 13, 12); break; case Maps.Tarkan: SafeArea = new Rectangle(187, 54, 16, 15); break; case Maps.Aida: SafeArea = new Rectangle(82, 8, 5, 6); break; //case Maps.Barracks: // SafeArea = new Rectangle(30, 75, 33, 78); // break; case Maps.Elbeland: SafeArea = new Rectangle(50, 220, 6, 6); break; case Maps.SilentSwamp: SafeArea = new Rectangle(135, 105, 10, 10); break; case Maps.Raklion: SafeArea = new Rectangle(220, 210, 13, 2); break; case Maps.Vulcan: SafeArea = new Rectangle(110, 120, 15, 15); break; case Maps.Kantru1: SafeArea = new Rectangle(124, 123, 3, 2); break; case Maps.Kantru2: SafeArea = new Rectangle(162, 16, 1, 1); break; default: SafeArea = new Rectangle(0, 0, 255, 255); break; } }
public MapInfo(int map, string attFile) { Maps[] disabled = new Maps[] { Maps.BloodCastle1, Maps.BloodCastle2, Maps.BloodCastle3, Maps.BloodCastle4, Maps.BloodCastle5, Maps.BloodCastle6, Maps.BloodCastle7, Maps.BloodCastle8, Maps.DevilSquare, Maps.DevilSquare2, Maps.ChaosCastle1, Maps.ChaosCastle2, Maps.ChaosCastle3, Maps.ChaosCastle4, Maps.ChaosCastle5, Maps.ChaosCastle6, Maps.ChaosCastle7, }; IsEvent = disabled.Any(x => (int)x == map); using (var fr = File.OpenRead(attFile)) { var type = fr.ReadByte(); Width = fr.ReadByte(); Height = fr.ReadByte(); Layer = new byte[Width * Height]; fr.Read(Layer, 0, Width * Height); Map = map; } Weather = 0x30; Monsters = new List <Monster>(); Players = new List <Character>(); Items = new List <ItemInMap>(); switch ((Maps)Map) { case Maps.Lorencia: SafeArea = new Rectangle(130, 116, 21, 21); break; case Maps.Dugeon: SafeArea = new Rectangle(106, 236, 6, 7); break; case Maps.Davias: SafeArea = new Rectangle(197, 35, 21, 15); break; case Maps.Noria: SafeArea = new Rectangle(174, 101, 13, 24); break; case Maps.LostTower: SafeArea = new Rectangle(201, 70, 12, 11); break; case Maps.Atlans: SafeArea = new Rectangle(14, 11, 13, 12); break; case Maps.Tarkan: SafeArea = new Rectangle(187, 54, 16, 15); break; case Maps.Aida: SafeArea = new Rectangle(82, 8, 5, 6); break; //case Maps.Barracks: // SafeArea = new Rectangle(30, 75, 33, 78); // break; case Maps.Elbeland: SafeArea = new Rectangle(50, 220, 6, 6); break; case Maps.SilentSwamp: SafeArea = new Rectangle(135, 105, 10, 10); break; case Maps.Raklion: SafeArea = new Rectangle(220, 210, 13, 2); break; case Maps.Vulcan: SafeArea = new Rectangle(110, 120, 15, 15); break; case Maps.Kantru1: SafeArea = new Rectangle(124, 123, 3, 2); break; case Maps.Kantru2: SafeArea = new Rectangle(162, 16, 1, 1); break; default: SafeArea = new Rectangle(0, 0, 255, 255); break; } }
/// <summary> /// Map transforms require the map's parameters. /// </summary> private void ModifyMapParameters() { if (Maps.Count == 0) { return; } foreach (var transform in GetAllTransforms().Where(t => t.Method == "map" && Maps.Any(m => m.Name == t.Map))) { var parameters = Maps .First(m => m.Name == transform.Map) .Items .Where(i => i.Parameter != string.Empty) .Select(p => p.Parameter) .Distinct(); foreach (var parameter in parameters) { if (parameter.IndexOf('.') > 0) { var split = parameter.Split(new[] { '.' }); transform.Parameters.Add(GetParameter(split[0], split[1])); } else { transform.Parameters.Add(GetParameter(parameter)); } } } }