private void btnCreate_Click(object sender, RoutedEventArgs e)
        {
            Slider slMoney = UIHelpers.FindChild<Slider>(this, "money");
            Slider slLoan = UIHelpers.FindChild<Slider>(this, "loan");
            Slider slPrice = UIHelpers.FindChild<Slider>(this, "price");
            Slider slPassengers = UIHelpers.FindChild<Slider>(this, "passengers");
            Slider slAI = UIHelpers.FindChild<Slider>(this, "AI");
            Slider slStartData = UIHelpers.FindChild<Slider>(this, "startdata");

            double money = slMoney.Value;
            double loan= slLoan.Value;
            double passengers = slPassengers.Value;
            double price = slPrice.Value;
            double AI = slAI.Value;
            double startData = slStartData.Value;

            DifficultyLevel level = new DifficultyLevel("Custom", money, loan, passengers, price, AI,startData);

            WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2406"), Translator.GetInstance().GetString("MessageBox", "2406", "message"), WPFMessageBoxButtons.YesNo);

            if (result == WPFMessageBoxResult.Yes)
            {
                DifficultyLevels.AddDifficultyLevel(level);

                PageNavigator.NavigateTo(new PageNewGame());
            }
        }
        public static object ShowPopUp(DifficultyLevel level)
        {
            PopUpWindow window = new  PopUpDifficulty(level);
            window.ShowDialog();

            return window.Selected;
        }
        public PopUpDifficulty(DifficultyLevel level)
        {
            this.Level = level;

            InitializeComponent();

            this.Uid = "1000";

            this.Title = Translator.GetInstance().GetString("PopUpDifficulty", this.Uid);

            this.Width = 400;

            this.Height = 210;

            this.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen;

            StackPanel mainPanel = new StackPanel();
            mainPanel.Margin = new Thickness(10, 10, 10, 10);

            ListBox lbContent = new ListBox();
            lbContent.ItemContainerStyleSelector = new ListBoxItemStyleSelector();
            lbContent.SetResourceReference(ListBox.ItemTemplateProperty, "QuickInfoItem");
            mainPanel.Children.Add(lbContent);

            DifficultyLevel easyLevel = DifficultyLevels.GetDifficultyLevel("Easy");
            DifficultyLevel normalLevel = DifficultyLevels.GetDifficultyLevel("Normal");
            DifficultyLevel hardLevel = DifficultyLevels.GetDifficultyLevel("Hard");

            slMoney = createDifficultySlider(easyLevel.MoneyLevel, normalLevel.MoneyLevel, hardLevel.MoneyLevel,level.MoneyLevel);
            slLoan = createDifficultySlider(easyLevel.LoanLevel, normalLevel.LoanLevel, hardLevel.LoanLevel,level.LoanLevel);
            slAI = createDifficultySlider(easyLevel.AILevel, normalLevel.AILevel, hardLevel.AILevel,level.AILevel);
            slPassengers = createDifficultySlider(easyLevel.PassengersLevel, normalLevel.PassengersLevel, hardLevel.PassengersLevel,level.PassengersLevel);
            slPrice = createDifficultySlider(easyLevel.PriceLevel, normalLevel.PriceLevel, hardLevel.PriceLevel,level.PriceLevel);
            slStartData = createDifficultySlider(easyLevel.StartDataLevel, normalLevel.StartDataLevel, hardLevel.StartDataLevel, level.StartDataLevel);

            lbContent.Items.Add(new QuickInfoValue("", createIndicator()));
            lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpDifficulty","200"), slMoney));
            lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpDifficulty", "201"), slPrice));
            lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpDifficulty", "202"), slLoan));
            lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpDifficulty", "203"), slPassengers));
            lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpDifficulty", "204"), slAI));
            lbContent.Items.Add(new QuickInfoValue(Translator.GetInstance().GetString("PopUpDifficulty","205"),slStartData));

            mainPanel.Children.Add(createButtonsPanel());

            this.Content = mainPanel;
        }
 private void btnOk_Click(object sender, RoutedEventArgs e)
 {
     DifficultyLevel level = new DifficultyLevel("Custom", slMoney.Value, slLoan.Value, slPassengers.Value, slPrice.Value, slAI.Value,slStartData.Value);
     this.Selected = level;
     this.Close();
 }
Exemplo n.º 5
0
 //adds a difficulty level to the level
 public static void AddDifficultyLevel(DifficultyLevel level)
 {
     levels.Add(level);
 }
Exemplo n.º 6
0
 //removes a difficulty level
 public static void RemoveDifficultyLevel(DifficultyLevel level)
 {
     levels.Remove(level);
 }
Exemplo n.º 7
0
 //removes a difficulty level
 public static void RemoveDifficultyLevel(DifficultyLevel level)
 {
     levels.Remove(level);
 }
Exemplo n.º 8
0
 //adds a difficulty level to the level
 public static void AddDifficultyLevel(DifficultyLevel level)
 {
     levels.Add(level);
 }