Beispiel #1
0
        private void City_Clicked(object sender, RoutedEventArgs e)
        {
            this.Hide();
            CityWindow cityWindow = new CityWindow(this);

            cityWindow.Show();
        }
Beispiel #2
0
        public CityWindow CreateCityWindow(City city)
        {
            var window   = new CityWindow(_guiServices);
            var hasData  = false;
            var infoText = "";
            var daysText = "";

            window.Image = _cityWindowImages[city.WallType];

            window.ButtonOkText = _texts.Get("ok");
            if (city.Owner != null && city.Owner.IsUserControlled)
            {
                window.ButtonMoreText = _texts.Get("commands");
                hasData = true;
            }
            else
            {
                window.ButtonMoreText = _texts.Get("interview");
                if (city.DaysToGetInfo > 25)
                {
                    hasData  = false;
                    infoText = _texts.Get("noInformation");
                }
                else
                {
                    infoText = city.DaysToGetInfo > 1 ?
                               _texts.Get("informationsInXDays", city.DaysToGetInfo) :
                               _texts.Get("informationsInOneDay");
                    hasData = false;
                }
                if (city.DaysToGetInfo == 0)
                {
                    infoText = "";
                    hasData  = true;
                }
            }

            if (city.Population > 700)
            {
                window.NameText = _texts.Get("city") + " " + city.Name;
            }
            else
            {
                window.NameText = _texts.Get("village") + " " + city.Name;
            }

            if (!hasData && !_legionConfig.GoDmOdE)
            {
                window.InfoText = infoText;
            }
            else
            {
                window.CountText = _texts.Get("peopleCount", city.Population);
                window.TaxText   = _texts.Get("tax") + ": " + city.Tax;

                var morale2 = city.Morale / 20;
                if (morale2 > 4)
                {
                    morale2 = 4;
                }
                //TODO: handle morale texts better way
                var moraleTexts = new []
                {
                    _texts.Get("rebelious"),
                    _texts.Get("discontented"),
                    _texts.Get("serf"),
                    _texts.Get("loyal"),
                    _texts.Get("fanatics")
                };
                //Text OKX + 50,OKY + 45,"Morale :" + GUL$(MORALE2)
                window.MoraleText = _texts.Get("morale") + ": " + moraleTexts[morale2];

                var buildings = new List <string>();
                foreach (var name in city.Buildings.Where(b => b.Type.Type == BuildingType.Shop).Select(b => b.Type.Name))
                {
                    if (!buildings.Contains(name))
                    {
                        buildings.Add(name);
                    }
                }
                window.Buildings = buildings;
            }

            if (city.Owner != null && city.Owner.IsUserControlled)
            {
                window.MoreClicked += args =>
                {
                    args.Handled = true;
                    var ordersWindow = CreateCityOrdersWindow(city);
                    _modalLayer.Window = ordersWindow;
                };
            }
            else
            {
                window.MoreClicked += args =>
                {
                    _modalLayer.Window = _commonMapGuiFactory.CreateBuyInformationWindow(city);
                };
            }

            return(window);
        }
Beispiel #3
0
 public Window1(CityWindow cityWindow)
 {
     InitializeComponent();
     this.cityWindow = cityWindow;
 }