public TacticsController(MainWindow window, string basePath) { mainwindow = window; tanks = new Tanks(basePath + "\\stamps\\tanks\\tanks.xml"); icons = new Icons(basePath + "\\stamps\\icons\\icons.xml"); maps = new Maps(basePath + "\\maps\\maps.xml", icons); }
public AbstractTactic(Maps maps, Tanks tanks, Icons icons) { this.maps = maps; this.tanks = tanks; this.icons = icons; timer = true; }
public StaticTactic(Maps maps, Tanks tanks, Icons icons) : base(maps, tanks, icons) { staticTactics = new Dictionary<int, StaticMapEntry>(); var source = new Uri(@"pack://application:,,,/Resources/clearTactics.png", UriKind.Absolute); clearTactic = new BitmapImage(source); }
public Tactic(Maps maps, Tanks tanks, Icons icons, string map_or_path) { this.maps = maps; this.tanks = tanks; this.icons = icons; int mapId; if (int.TryParse(map_or_path, out mapId)) { staticTactic = new StaticTactic(maps, tanks, icons); dynamicTactic = new DynamicTactic(maps, tanks, icons); staticTactic.setMap(map_or_path); dynamicTactic.setMap(map_or_path); this.map = maps.getMap(map_or_path); } else { load(map_or_path); } }
public Maps(string mapsDescriptor, Icons icons) { maps = new Dictionary<string, Map>(); sortedMaps = new SortedList<string, Map>(); XmlDocument XD = new XmlDocument(); XD.Load(mapsDescriptor); XmlNode XN = XD.DocumentElement; XmlNodeList XNL = XN.SelectNodes("/maps/map"); for (int i = 0; i < XNL.Count; i++) { XmlNodeList presets = XNL.Item(i).SelectSingleNode("gamemodes").ChildNodes; List<MapIcon> presetIcons = new List<MapIcon>(); for (int j = 0; j < presets.Count; j++) { XmlNodeList iconlist = presets[j].ChildNodes; for (int k = 0; k < iconlist.Count; k++) { StaticIcon sicon = (StaticIcon)icons.getStaticIcon(iconlist[k].Attributes["id"].InnerText).Clone(); sicon.position = new Point( Convert.ToDouble(iconlist[k].Attributes["X"].InnerText, CultureInfo.InvariantCulture) * 1024, Convert.ToDouble(iconlist[k].Attributes["Y"].InnerText, CultureInfo.InvariantCulture) * 1024 ); MapIcon icon = new MapIcon( sicon, presets[j].Name == "normal" ? BattleType.Normal : presets[j].Name == "encounter" ? BattleType.Encounter : presets[j].Name == "assault" ? BattleType.Assault : BattleType.Undefined, presets[j].Attributes["variation"].InnerText ); presetIcons.Add(icon); } } Map map = new Map( XNL.Item(i).Attributes["id"].InnerText, XNL.Item(i).SelectSingleNode("name").InnerText, System.IO.Path.GetDirectoryName(mapsDescriptor) + "\\" + XNL.Item(i).SelectSingleNode("original").InnerText, System.IO.Path.GetDirectoryName(mapsDescriptor) + "\\" + XNL.Item(i).SelectSingleNode("hd").InnerText, presetIcons.ToArray() ); maps.Add(map.id, map); sortedMaps.Add(map.name, map); } }
public DynamicTactic(Maps maps, Tanks tanks, Icons icons) : base(maps, tanks, icons) { dynamicTanks = new List<DynamicTank>(); staticIcons = new List<StaticIcon>(); brush = new SolidColorBrush(Color.FromRgb(255, 0, 0)); brush.Freeze(); iconsSize = 50; ShowPlayerName = true; ShowTankName = false; TankIcon = DisplayTankIcon.tanktype; selectedStaticIcon = new List<StaticIcon>(); selectedDynamicTank = new List<DynamicTank>(); copyDynamicTank = new List<DynamicTank>(); var source = new Uri(@"pack://application:,,,/Resources/clearTactics.png", UriKind.Absolute); clearTactic = new BitmapImage(source); }