Esempio n. 1
0
        public override void ForEvery(Tile tile)
        {
            tile.Hex.ToggleGraphics(0.2);
            tile.Hex.ToggleOpenTile();
            tile.Hex.ToggleTileName();
            tile.Hex.TogglePlayerIcon();

            HexagonTile hex = tile.Hex;

            if (tile is Landscape)
            {
                hex.Polygon.Fill = Brushes.Black;
            }
            if (tile is City city)
            {
                if (city.Government != null)
                {
                    hex.Polygon.Fill = ColorHandler.ColorFromRGB(city.Government.RulingParties[0].Color);
                }
                else
                {
                    hex.Polygon.Fill = Brushes.DarkSlateGray;
                }
            }
        }
Esempio n. 2
0
 public void ToggleCountryColor()
 {
     if (Tile.CountryOwner != null)
     {
         Polygon.Fill = ColorHandler.ColorFromRGB(Tile.CountryOwner.RGBColor);
     }
 }
Esempio n. 3
0
 public void ToggleProvinceColor()
 {
     if (Tile.Owner != null)
     {
         Polygon.Fill = ColorHandler.ColorFromRGB(Color);
     }
 }
Esempio n. 4
0
        private Border CreateUnit(Unit unit)
        {
            UnitCounter counter = new UnitCounter();

            //counter.lbl_unit_type.Content = unit.Symbol;
            counter.img_unit_size.Source    = unit.Symbol;
            counter.img_unit_counter.Source = Images.IconQuestionmark;
            if (unit.Color != null)
            {
                counter.border_unit.Background = ColorHandler.ColorFromRGB(unit.Color);
            }

            counter.img_unit_counter.Source = unit.IconCounter;

            string tt = unit.Name + "\n";

            if (unit.Owner != null)
            {
                tt += "Besitzer von " + unit.Owner.Name + "\n";
            }
            if (unit.Commander != null)
            {
                tt += "Unter kontrolle von " + unit.Commander.Name;
            }
            counter.border_unit.ToolTip = tt;

            Border border = (Border)SubWindow.CopyFrom(counter.border_unit);

            unit.BorderParent = border;
            border.Tag        = unit;
            border.MouseUp   += UnitCounterClick;
            return(border);
        }
Esempio n. 5
0
 public void ToggleControllerColor()
 {
     if (Tile.Controller != Tile.CountryOwner)
     {
         SolidColorBrush brush = ColorHandler.ColorFromRGB("10-10-10");
         if (Tile.CountryController != null)
         {
             brush = ColorHandler.ColorFromRGB(Tile.CountryController.RGBColor);
         }
         Polygon.Fill = Hatch(brush);
     }
 }
Esempio n. 6
0
        public override void ForEvery(Tile tile)
        {
            tile.Hex.ToggleGraphics(0.2);
            tile.Hex.ToggleBlackColor();
            int pop = tile.CitizenAmount;
            int max = Citizen.MaxCitizens;

            if (pop > max)
            {
                pop = max;
            }
            double vale = ((double)byte.MaxValue / max) * pop;

            tile.Hex.Polygon.Fill = ColorHandler.ColorFromRGB(255 - (int)vale, 230, 255 - (int)vale);
            tile.Hex.ToggleOpenTile();
            tile.Hex.TogglePlayerIcon();
            tile.Hex.ToggleUnit();
        }
Esempio n. 7
0
 public void CloseUnit()
 {
     if (Window.gui_grid.Children.Contains(Window.gui_grid_unit_left))
     {
         Window.gui_grid.Children.Remove(Window.gui_grid_unit_left);
     }
     foreach (Unit unit in SubUnitBorders)
     {
         if (unit.BorderParent != null)
         {
             unit.BorderParent.Background = ColorHandler.ColorFromRGB(unit.Color);
         }
     }
     SubUnitBorders.Clear();
     if (SubUnitParten != null)
     {
         SubUnitParten.BorderParent.Background = ColorHandler.ColorFromRGB(SubUnitParten.Color);
     }
 }
Esempio n. 8
0
 public override void ForEvery(Tile tile)
 {
     tile.Hex.ToggleGraphics(0.2);
     tile.Hex.ToggleBlackColor();
     if (tile.Units.Count > 0)
     {
         tile.Hex.Polygon.Fill = ColorHandler.ColorFromRGB("50-200-50");
         foreach (Unit unit in tile.Units)
         {
             if (unit.IsHostile)
             {
                 tile.Hex.Polygon.Fill = ColorHandler.ColorFromRGB("200-0-0");
                 break;
             }
         }
         if (tile.Battles.Count > 0)
         {
             tile.Hex.Polygon.Fill = ColorHandler.ColorFromRGB("200-200-0");
         }
     }
     tile.Hex.TogglePlayerIcon();
     tile.Hex.ToggleUnit();
 }
        private void LoadTabParlament()
        {
            if (Tile is Landscape)
            {
                tab_control.Items.Remove(tab_parlament);
            }
            img_parlament_header.Source = Images.IconTabParlament;
            img_parlament_bg.Source     = Images.IconBackground2;

            Border vorlage = (Border)SubWindow.CopyFrom(border_parlament_vorlage);

            panel_parlament_head.Children.Clear();
            border_parlament_vorlage = null;
            panel_parlament_body.Children.Clear();
            lbl_government_person.Content = Tile.Persons.Count + " Personen";
            if (Tile is City city)
            {
                if (city.Government == null)
                {
                    return;
                }
                lbl_parlament_ruling_party.Content   = city.Government.RulingParties[0].ShortName;
                lbl_government_last_election.Content = city.Government.LastElection.ToString();
                lbl_government_next_election.Content = city.Government.NextElection.ToString();
                lbl_government_party.Content         = city.Government.RegisteredParties.Count + " Parteien";
                if (city.Government.Cancelor != null)
                {
                    Border canelor = (Border)SubWindow.CopyFrom(vorlage);
                    Image  img     = (Image)((Button)(canelor.Child)).Content;
                    img.Source      = city.Government.Cancelor.Image;
                    canelor.ToolTip = city.Government.Cancelor.Name + " (" + city.Government.Cancelor.Party.ShortName + ")";
                    panel_parlament_head.Children.Add(canelor);
                }
                if (city.Government.Seats.Count > 0)
                {
                    int        count     = city.Government.Seats.Count;
                    StackPanel hor_panel = new StackPanel()
                    {
                        Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center
                    };
                    for (int i = 0; i < city.Government.Seats.Count; i++)
                    {
                        Border seat = (Border)SubWindow.CopyFrom(vorlage);
                        Button btn  = (Button)(seat.Child);
                        btn.Click += city.Government.Seats[i].Person.PersonClick;
                        Image img = (Image)btn.Content;
                        img.Source      = city.Government.Seats[i].Person.Image;
                        seat.ToolTip    = city.Government.Seats[i].Person.Name + " (" + city.Government.Seats[i].Party.ShortName + ")";
                        seat.Background = ColorHandler.ColorFromRGB(city.Government.Seats[i].Party.Color);
                        hor_panel.Children.Add(seat);
                        if (hor_panel.Children.Count == 12)
                        {
                            panel_parlament_body.Children.Add(hor_panel);
                            hor_panel = new StackPanel()
                            {
                                Orientation = Orientation.Horizontal, HorizontalAlignment = HorizontalAlignment.Center
                            };
                        }
                    }
                    if (hor_panel.Children.Count != 0)
                    {
                        panel_parlament_body.Children.Add(hor_panel);
                    }
                }
            }
        }
Esempio n. 10
0
        public void OpenUnit(Unit unit)
        {
            CloseUnit();
            Window.gui_grid.Children.Add(Window.gui_grid_unit_left);

            #region Parents
            Window.panel_unit_parents.Children.Clear();
            Unit             parent  = unit.Parent;
            List <UIElement> parents = new List <UIElement>();
            int c = 0;
            while (true)
            {
                if (parent == null)
                {
                    break;
                }
                Window.btn_unit_parent.Content = parent.Name;
                Button btn = (Button)SubWindow.CopyFrom(Window.btn_unit_parent);
                btn.Click += ParentClick;
                btn.Tag    = parent;
                parents.Add(btn);
                parent = parent.Parent;
                c++;
            }
            parents.Reverse();
            foreach (UIElement element in parents)
            {
                Window.panel_unit_parents.Children.Add(element);
            }
            #endregion

            #region Top
            Window.img_unit_commander.Source    = Images.IconPerson;
            Window.lbl_unit_commander.Content   = "Kein Befehlshaber";
            Window.img_unit_main_size.Source    = unit.Symbol;
            Window.img_unit_main_counter.Source = unit.IconCounter;
            Window.lbl_unit_name.Content        = unit.Name;
            Window.lbl_unit_amount.Content      = unit.CurStrength;

            Window.proBar_unit_org.Maximum = unit.MaxOrganisation;
            Window.proBar_unit_org.Value   = unit.CurOrganisation;
            Window.proBar_unit_org.ToolTip = unit.CurOrganisation + " / " + unit.MaxOrganisation;

            Window.proBar_unit_strenght.Maximum = unit.MaxStrength;
            Window.proBar_unit_strenght.Value   = unit.CurStrength;
            Window.proBar_unit_strenght.ToolTip = unit.CurStrength + " / " + unit.MaxStrength;

            if (unit.Commander != null)
            {
                Window.img_unit_commander.Source  = unit.Commander.Image;
                Window.img_unit_commander.Tag     = unit.Commander;
                Window.lbl_unit_commander.Content = unit.Commander.Name;
                Window.lbl_unit_commander.Tag     = unit.Commander;
            }
            #endregion

            #region Center
            Window.lbl_unit_location.Content = unit.Location.Name;
            Window.lbl_unit_location.Tag     = unit.Location;
            if (unit.IsLinked)
            {
                Window.btn_unit_link.Content = "Link-Out";
            }
            else
            {
                Window.btn_unit_link.Content = "Linkup";
            }
            Window.btn_unit_link.Tag       = unit;
            Window.btn_unit_link.IsEnabled = true;
            if (unit.Parent == null || unit.Parent.LocationID != unit.LocationID)
            {
                Window.btn_unit_link.IsEnabled = false;
            }

            //- Orders
            Window.lbl_unit_order.Content = "Kein Befehl";
            if (unit.Orders.Count != 0)
            {
                Order order = unit.Orders[0];
                Window.lbl_unit_order.Content    = order.OrderText;
                Window.btn_unit_order_cancel.Tag = unit;
            }
            #endregion

            #region LocalUnits
            Window.panel_unit_localunits.Children.Clear();
            Window.lbl_unit_localunit_count.Content = unit.LocalUnits.Count;
            foreach (Unit local_unit in unit.LocalUnits)
            {
                Window.img_localunit_counter.Source      = local_unit.IconCounter;
                Window.img_localunit_size.Source         = local_unit.Symbol;
                Window.lbl_localunit_name.Content        = local_unit.Name;
                Window.lbl_localunit_size.Content        = local_unit.CurStrength;
                Window.proBar_localunit_org.Maximum      = local_unit.MaxOrganisation;
                Window.proBar_localunit_org.Value        = local_unit.CurOrganisation;
                Window.proBar_localunit_strenght.Maximum = local_unit.MaxStrength;
                Window.proBar_localunit_strenght.Value   = local_unit.CurStrength;

                Border sub = (Border)SubWindow.CopyFrom(Window.border_localunit_vorlage);
                HoverHandler.AddHover(sub);
                Window.panel_unit_localunits.Children.Add(sub);
            }
            #endregion

            #region SubUnits
            Window.panel_unit_subunits.Children.Clear();
            Window.lbl_unit_subunit_count.Content = unit.SubUnits.Count;
            int subunits_amount = 0;
            foreach (Unit sub_unit in unit.SubUnits)
            {
                //- Mark other Units in Unit
                SubUnitBorders.Add(sub_unit);
                if (sub_unit.BorderParent != null)
                {
                    sub_unit.BorderParent.Background = ColorHandler.ColorFromRGB("10-10-220");
                }

                Window.img_subunit_counter.Source      = sub_unit.IconCounter;
                Window.img_subunit_size.Source         = sub_unit.Symbol;
                Window.lbl_subunit_name.Content        = sub_unit.Name;
                Window.lbl_subunit_size.Content        = sub_unit.CurStrength;
                Window.proBar_subunit_org.Maximum      = sub_unit.MaxOrganisation;
                Window.proBar_subunit_org.Value        = sub_unit.CurOrganisation;
                Window.proBar_subunit_strenght.Maximum = sub_unit.MaxStrength;
                Window.proBar_subunit_strenght.Value   = sub_unit.CurStrength;
                Window.lbl_subunit_commander.Content   = "Kein Befehlshaber";
                if (sub_unit.Commander != null)
                {
                    Window.lbl_subunit_commander.Content = sub_unit.Commander.Name;
                }

                subunits_amount += sub_unit.CurStrength;

                Border sub = (Border)SubWindow.CopyFrom(Window.border_unit_vorlage);
                sub.Tag = sub_unit;
                sub.MouseLeftButtonUp += SubUnitClick;
                HoverHandler.AddHover(sub);
                Window.panel_unit_subunits.Children.Add(sub);
            }
            Window.lbl_unit_subunit_amount.Content = subunits_amount;
            #endregion

            //- Parent
            if (unit.Parent != null && unit.Parent.BorderParent != null)
            {
                unit.Parent.BorderParent.Background = ColorHandler.ColorFromRGB("20-220-20");
                SubUnitParten = unit.Parent;
            }
        }
Esempio n. 11
0
 public void ToggleBlackColor()
 {
     Polygon.Fill = ColorHandler.ColorFromRGB("10-10-10");
 }
Esempio n. 12
0
 public void ToggleCityColor()
 {
     Polygon.Fill = ColorHandler.ColorFromRGB("0-0-0");
 }