Exemplo n.º 1
0
 public HTMLControl(object htmlObject, DwarfTabControl tabControl, World world)
 {
     World = world;
     HTMLObject = htmlObject;
     Printer = HTMLPrinter.GetPrinter(htmlObject, world);
     Title = Printer.GetTitle();
     TabControl = tabControl;
 }
Exemplo n.º 2
0
 public HtmlControl(object htmlObject, DwarfTabControl tabControl, World world)
 {
     _world     = world;
     HtmlObject = htmlObject;
     _printer   = HtmlPrinter.GetPrinter(htmlObject, world);
     Title      = _printer.GetTitle();
     TabControl = tabControl;
 }
Exemplo n.º 3
0
 public ChartControl(World world, DwarfObject focusObject, DwarfTabControl dwarfTabControl)
 {
     World = world; FocusObject = focusObject; TabControl = dwarfTabControl;
     Title = "Chart";
     if (FocusObject != null)
     {
         Title += " - " + FocusObject.ToLink(false, FocusObject);
     }
 }
Exemplo n.º 4
0
        public MapControl(World world, object focusObject, DwarfTabControl dwarfTabControl)
        {
            Title = "Map";
            if (focusObject != null && focusObject is DwarfObject)
            {
                Title += " - " + (focusObject as DwarfObject).ToLink(false, focusObject as DwarfObject);
            }

            World = world; FocusObject = focusObject; TabControl = dwarfTabControl;
        }
Exemplo n.º 5
0
        public QueryControl(World world, DwarfTabControl browser)
        {
            World = world;
            Browser = browser;

            InitializeComponent();
            SelectionPanel.SizeChanged += new EventHandler(PanelResized);
            SearchPanel.SizeChanged += new EventHandler(PanelResized);
            OrderByPanel.SizeChanged += new EventHandler(PanelResized);

            SelectionPanel.CriteriaStartLocation = lblSelectCriteria.Bottom + 3;
            SearchPanel.CriteriaStartLocation = lblSearchCriteria.Bottom + 3;
            OrderByPanel.CriteriaStartLocation = lblOrderCriteria.Bottom + 3;

            SelectionPanel.SelectCriteria = true;
            SearchPanel.SearchCriteria = true;
            OrderByPanel.OrderByCriteria = true;

            PanelResized(this, null);
            SelectList.SelectedIndex = 0;
        }
Exemplo n.º 6
0
        public QueryControl(World world, DwarfTabControl browser)
        {
            World   = world;
            Browser = browser;

            InitializeComponent();
            SelectionPanel.SizeChanged += new EventHandler(PanelResized);
            SearchPanel.SizeChanged    += new EventHandler(PanelResized);
            OrderByPanel.SizeChanged   += new EventHandler(PanelResized);

            SelectionPanel.CriteriaStartLocation = lblSelectCriteria.Bottom + 3;
            SearchPanel.CriteriaStartLocation    = lblSearchCriteria.Bottom + 3;
            OrderByPanel.CriteriaStartLocation   = lblOrderCriteria.Bottom + 3;

            SelectionPanel.SelectCriteria = true;
            SearchPanel.SearchCriteria    = true;
            OrderByPanel.OrderByCriteria  = true;

            PanelResized(this, null);
            SelectList.SelectedIndex = 0;
        }
Exemplo n.º 7
0
 public ReadMeControl(DwarfTabControl tabControl)
 {
     Title      = "README.md";
     TabControl = tabControl;
 }
Exemplo n.º 8
0
        public MapPanel(Bitmap map, World world, DwarfTabControl dwarfTabControl, Object focusObject)
        {
            TabControl = dwarfTabControl;
            Map = map;
            World = world;
            FocusObject = focusObject;
            if (FocusObject != null && FocusObject.GetType() == typeof(World))
                FocusObject = null;
            DisplayObjects = new List<Object>();
            DoubleBuffered = true;
            Dock = DockStyle.Fill;
            //Anchor = AnchorStyles.Bottom | AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            Source = new Rectangle(new Point(Center.X - (this.Width / 2), Center.Y - (this.Height / 2)), new Size(this.Width, this.Height));

            HoverMenu = new MapMenu(this);
            ControlMenu = new MapMenu(this);
            ControlMenu.AddOptions(new List<object>() { "Zoom In", "Zoom Out", "Toggle Civs", "Toggle Sites", "Toggle Wars", "Toggle Battles", "Toggle Overlay", "Toggle Alt Map" });
            ControlMenu.Open = true;
            YearMenu = new MapMenu(this);
            YearMenu.AddOptions(new List<object>() { "+1000", "+100", "+10", "+1", "-1", "-10", "-100", "-1000" });
            YearMenu.Open = true;
            OptionsMenu = new MapMenuHorizontal(this);
            OptionsMenu.Open = true;
            OptionsMenu.AddOptions(new List<object>() { "Load Alternate Map...", "Overlays" });
            MapMenu overlayOptions = new MapMenu(this);
            overlayOptions.AddOptions(new List<object>() { "Battles", "Battles (Notable)", "Battle Deaths", "Beast Attacks", "Site Population...", "Site Events", "Site Events (Filtered)" });
            overlayOptions.Options.ForEach(option => option.OptionObject = "Overlay");
            OptionsMenu.Options.Last().SubMenu = overlayOptions;

            AltMapTransparency.Minimum = 0;
            AltMapTransparency.Maximum = 100;
            AltMapTransparency.AutoSize = false;
            AltMapTransparency.Size = new System.Drawing.Size(150, 25);
            AltMapTransparency.TickFrequency = 1;
            AltMapTransparency.TickStyle = TickStyle.None;
            AltMapTransparency.BackColor = YearMenu.MenuColor;
            AltMapTransparency.Visible = false;
            AltMapTransparency.Scroll += ChangeAltMapTransparency;
            AltMapTransparency.Value = 100;
            Controls.Add(AltMapTransparency);
            //AltMapTransparency.Anchor = AnchorStyles.Bottom;
            AltMapTransparency.Location = new Point(MiniMapAreaSideLength + YearMenu.MenuBox.Width, this.Height - AltMapTransparency.Height);


            MinYear = World.Eras.First().StartYear;
            if (MinYear == -1) MinYear = 0;
            MaxYear = CurrentYear = World.Eras.Last().EndYear;
            //Set Map Year if Entity has no active sites so they show on map
            if (FocusObject != null && FocusObject.GetType() == typeof(Entity) && (FocusObject as Entity).SiteHistory.Count(sitePeriod => sitePeriod.EndYear == -1) == 0)
                CurrentYear = (FocusObject as Entity).SiteHistory.Max(sitePeriod => sitePeriod.EndYear) - 1;
            else if (FocusObject != null && FocusObject.GetType() == typeof(Battle))
                CurrentYear = MinYear = MaxYear = (focusObject as Battle).StartYear;
            else if (FocusObject != null && FocusObject.GetType() == typeof(SiteConquered))
                CurrentYear = MinYear = MaxYear = (FocusObject as SiteConquered).StartYear;

            if (focusObject != null && focusObject.GetType() == typeof(List<object>))
            {
                FocusObjects = (focusObject as List<object>).GroupBy(item => item).Select(item => item.Key).ToList();
                if (FocusObjects.First().GetType() == typeof(Battle))
                    Battles.AddRange(FocusObjects.Cast<Battle>());
                else
                    DisplayObjects.AddRange(FocusObjects);
            }
            else
                FocusObjects = new List<object>();
            if (focusObject != null && focusObject.GetType() != typeof(Battle)) DisplayObjects.Add(focusObject);
            if (focusObject != null && focusObject.GetType() == typeof(Battle)) Battles.Add(focusObject as Battle);
            if (FocusObject != null && FocusObject.GetType() == typeof(War))
            {
                War war = FocusObject as War;
                MinYear = CurrentYear = war.StartYear;
                if (war.EndYear != -1) MaxYear = war.EndYear;
                UpdateWarDisplay();
                foreach (Battle battle in war.Collections.OfType<Battle>())
                    Battles.Add(battle);
                //DisplayObjects.Insert(battle);
            }

            //Center and zoom map on focusObject of the map
            if (FocusObject == null || FocusObjects.Count > 0) Center = new Point(Map.Width / 2, Map.Height / 2);
            else if (FocusObject.GetType() == typeof(Site))
            {
                Site site = (focusObject as Site);
                Center = new Point(site.Coordinates.X * TileSize + TileSize / 2, site.Coordinates.Y * TileSize + TileSize / 2);
                ZoomCurrent = 0.85;
            }
            else if (FocusObject.GetType() == typeof(Entity) || FocusObject.GetType() == typeof(War)
                  || FocusObject.GetType() == typeof(Battle) || FocusObject.GetType() == typeof(SiteConquered)) //Calculate zoom rectangle for civs / wars / battles
            {
                List<Entity> entities = new List<Entity>();
                if (FocusObject.GetType() == typeof(Entity))
                    entities.Add(FocusObject as Entity);
                else if (FocusObject.GetType() == typeof(War))
                {
                    entities.Add((FocusObject as War).Attacker);
                    entities.Add((FocusObject as War).Defender);
                }
                ZoomBounds = new Rectangle(-1, -1, -1, -1);

                foreach (Entity displayEntity in entities)
                    foreach (OwnerPeriod sitePeriod in displayEntity.SiteHistory.Where(site => ((site.StartYear == CurrentYear && site.StartCause != "took over") || site.StartYear < CurrentYear)
                        && (((site.EndYear >= CurrentYear) || site.EndYear == -1))))
                    {
                        if (ZoomBounds.Top == -1)
                        {
                            ZoomBounds.Y = ZoomBounds.Height = sitePeriod.Site.Coordinates.Y;
                            ZoomBounds.X = ZoomBounds.Width = sitePeriod.Site.Coordinates.X;
                        }
                        if (sitePeriod.Site.Coordinates.Y < ZoomBounds.Y) ZoomBounds.Y = sitePeriod.Site.Coordinates.Y;
                        if (sitePeriod.Site.Coordinates.X < ZoomBounds.X) ZoomBounds.X = sitePeriod.Site.Coordinates.X;
                        if (sitePeriod.Site.Coordinates.Y > ZoomBounds.Height) ZoomBounds.Height = sitePeriod.Site.Coordinates.Y;
                        if (sitePeriod.Site.Coordinates.X > ZoomBounds.Width) ZoomBounds.Width = sitePeriod.Site.Coordinates.X;
                    }

                if (FocusObject.GetType() == typeof(War))
                {
                    War war = FocusObject as War;

                    foreach (Battle battle in war.Collections.OfType<Battle>())
                    {
                        if (ZoomBounds.Top == -1)
                        {
                            ZoomBounds.Y = ZoomBounds.Height = battle.Coordinates.Y;
                            ZoomBounds.X = ZoomBounds.Width = battle.Coordinates.X;
                        }
                        if (battle.Coordinates.Y < ZoomBounds.Y) ZoomBounds.Y = battle.Coordinates.Y;
                        if (battle.Coordinates.X < ZoomBounds.X) ZoomBounds.X = battle.Coordinates.X;
                        if (battle.Coordinates.Y > ZoomBounds.Height) ZoomBounds.Height = battle.Coordinates.Y;
                        if (battle.Coordinates.X > ZoomBounds.Width) ZoomBounds.Width = battle.Coordinates.X;
                    }
                }

                if (FocusObject.GetType() == typeof(Battle) || FocusObject.GetType() == typeof(SiteConquered))
                {
                    Battle battle;
                    if (FocusObject.GetType() == typeof(Battle)) battle = FocusObject as Battle;
                    else battle = (FocusObject as SiteConquered).Battle;
                    Center = new Point(battle.Coordinates.X * TileSize + TileSize / 2, battle.Coordinates.Y * TileSize + TileSize / 2);
                    ZoomBounds.Y = ZoomBounds.Height = battle.Coordinates.Y;
                    ZoomBounds.X = ZoomBounds.Width = battle.Coordinates.X;
                    Site attackerSite = GetClosestSite(battle.Attacker, battle.Coordinates);
                    if (attackerSite.Coordinates.Y < ZoomBounds.Y) ZoomBounds.Y = attackerSite.Coordinates.Y;
                    if (attackerSite.Coordinates.X < ZoomBounds.X) ZoomBounds.X = attackerSite.Coordinates.X;
                    if (attackerSite.Coordinates.Y > ZoomBounds.Height) ZoomBounds.Height = attackerSite.Coordinates.Y;
                    if (attackerSite.Coordinates.X > ZoomBounds.Width) ZoomBounds.Width = attackerSite.Coordinates.X;

                    Site defenderSite = GetClosestSite(battle.Defender, battle.Coordinates);
                    if (defenderSite.Coordinates.Y < ZoomBounds.Y) ZoomBounds.Y = defenderSite.Coordinates.Y;
                    if (defenderSite.Coordinates.X < ZoomBounds.X) ZoomBounds.X = defenderSite.Coordinates.X;
                    if (defenderSite.Coordinates.Y > ZoomBounds.Height) ZoomBounds.Height = defenderSite.Coordinates.Y;
                    if (defenderSite.Coordinates.X > ZoomBounds.Width) ZoomBounds.Width = defenderSite.Coordinates.X;
                }

                ZoomBounds.X = ZoomBounds.X * TileSize - TileSize / 2 - TileSize;
                ZoomBounds.Width = ZoomBounds.Width * TileSize + TileSize / 2 + TileSize;
                ZoomBounds.Y = ZoomBounds.Y * TileSize - TileSize / 2 - TileSize;
                ZoomBounds.Height = ZoomBounds.Height * TileSize + TileSize / 2 + TileSize;
                Center.X = (ZoomBounds.Left + ZoomBounds.Width) / 2;
                Center.Y = (ZoomBounds.Top + ZoomBounds.Height) / 2;
                ZoomToBoundsOnFirstPaint = true;
            }
            else
                Center = new Point(0, 0);

            BattleLocations = Battles.GroupBy(battle => battle.Coordinates).Select(battle => battle.Key).ToList();

            GenerateCivPaths();
            Minimap = world.MiniMap;
            UpdateWarDisplay();
            Invalidate();

            if (MapUtil.AlternateMap != null)
            {
                AlternateMap = MapUtil.AlternateMap;
                AltMapAlpha = MapUtil.AltMapAlpha;
                AltMapTransparency.Value = (int)(AltMapAlpha * 100);
                AlternateMapToggled = false;
                ToggleAlternateMap();
            }
        }
Exemplo n.º 9
0
 public MapControl(World world, Object focusObject, DwarfTabControl dwarfTabControl)
 {
     Title = "Map";
     if (focusObject != null && focusObject is DwarfObject) Title += " - " + (focusObject as DwarfObject).ToLink(false, (focusObject as DwarfObject));
     World = world; FocusObject = focusObject; TabControl = dwarfTabControl;
 }
Exemplo n.º 10
0
 public SearchControl(DwarfTabControl browser)
 {
     TabControl = browser;
     Title = "Advanced Search";
 }
Exemplo n.º 11
0
 public SearchControl(DwarfTabControl browser)
 {
     TabControl = browser;
     Title      = "Advanced Search";
 }