Ejemplo n.º 1
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="engine">The <see cref="EnginePivot"/>.</param>
 public CityNameWindow(EnginePivot engine)
 {
     InitializeComponent();
     _engine = engine;
     City    = null;
     TextBoxCityName.Text = _engine.HumanPlayer.GetNextCityName;
 }
Ejemplo n.º 2
0
        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            var res = MessageBox.Show("Save the game ?", "ErsatzCiv", MessageBoxButton.YesNoCancel);

            if (res == MessageBoxResult.Yes)
            {
                var serRes = EnginePivot.SerializeToFile(_engine, Settings.Default.datasPath + Settings.Default.savesSubFolder);
                if (!string.IsNullOrWhiteSpace(serRes))
                {
                    MessageBox.Show($"Save has failed with the following error : {serRes}", "ErsatzCiv");
                    e.Cancel = true;
                }
                else
                {
                    MessageBox.Show("Save done !", "ErsatzCiv");
                    // Quit hard.
                    Environment.Exit(0);
                }
            }
            else if (res == MessageBoxResult.Cancel)
            {
                e.Cancel = true;
            }
            else
            {
                // Quit hard.
                Environment.Exit(0);
            }
        }
Ejemplo n.º 3
0
 public WindowAdvancePick(EnginePivot engine)
 {
     InitializeComponent();
     _engine = engine;
     ComboBoxAdvancePick.ItemsSource  = _engine.HumanPlayer.GetAvailableAdvances();
     ComboBoxAdvancePick.SelectedItem = _engine.HumanPlayer.CurrentAdvance;
     ComboBoxEra.ItemsSource          = Enum.GetValues(typeof(EraPivot));
 }
Ejemplo n.º 4
0
        public MainWindow(EnginePivot engine)
        {
            InitializeComponent();
            ExpanderMenu.ExpandDirection = ExpandDirection.Up;

            _engine = engine;
            CheckBoxWaitTurn.IsChecked = Settings.Default.waitEndTurn;

            InitializeEngineEvents();

            DrawFullMapAndMiniMap();
            RefreshDynamicView();

            SliderScienceRate.Value = _engine.HumanPlayer.ScienceRate;
            SliderLuxuryRate.Value  = _engine.HumanPlayer.LuxuryRate;
            RefreshRateLabels();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="engine">The <see cref="EnginePivot"/>.</param>
        /// <param name="city">The <see cref="CityPivot"/> to manage.</param>
        public CityWindow(EnginePivot engine, CityPivot city)
        {
            InitializeComponent();

            for (int i = 0; i < COUNT_SHOW_CITY_SQUARES; i++)
            {
                GridCityMap.ColumnDefinitions.Add(new ColumnDefinition {
                    Width = new GridLength(CITY_GRID_SIZE)
                });
                GridCityMap.RowDefinitions.Add(new RowDefinition {
                    Height = new GridLength(CITY_GRID_SIZE)
                });
            }

            _engine = engine;
            _city   = city;

            RefreshDisplay();
        }
Ejemplo n.º 6
0
 public WindowRegimePick(EnginePivot engine)
 {
     InitializeComponent();
     _engine = engine;
     ComboBoxRegimes.ItemsSource = _engine.HumanPlayer.GetAvailableRegimes();
 }