protected override async Task <bool> OnApply(IGameState gameState)
        {
            var threeChoicesViewModel = MefContainer.GetExportedValue <IThreeChoicesViewModel>();

            threeChoicesViewModel.Option1          = Option1;
            threeChoicesViewModel.Option2          = Option2;
            threeChoicesViewModel.CanSelectOption1 = CanApplyOption1(gameState);
            threeChoicesViewModel.CanSelectOption2 = CanApplyOption2(gameState);

            var result = await MetroDialog.ShowDialog(threeChoicesViewModel);

            if (result == Selection.None)
            {
                return(false);
            }

            if (result == Selection.Option1)
            {
                return(await ApplyOption1(gameState));
            }
            if (result == Selection.Option2)
            {
                return(await ApplyOption2(gameState));
            }
            if (result == Selection.Option3)
            {
                return(await ApplyOption3(gameState));
            }
            return(false);
        }
        protected override async Task <bool> OnApply(IGameState gameState)
        {
            var playerWantsToDoBoth = false;

            if (CanDoBoth(gameState))
            {
                playerWantsToDoBoth =
                    await
                    MetroDialog.ShowMessage("Play visitor",
                                            $"Do you want to perform both actions (cost: {DoBothCost}",
                                            MessageDialogStyle.AffirmativeAndNegative) == MessageDialogResult.Affirmative;
            }

            var twoChoicesViewModel = MefContainer.GetExportedValue <ITwoChoicesViewModel>();

            twoChoicesViewModel.Option1          = Option1;
            twoChoicesViewModel.Option2          = Option2;
            twoChoicesViewModel.CanSelectOption1 = CanApplyOption1(gameState);
            twoChoicesViewModel.CanSelectOption2 = CanApplyOption2(gameState);

            var result = await MetroDialog.ShowDialog(twoChoicesViewModel);

            if (result == Selection.None)
            {
                return(false);
            }

            if (playerWantsToDoBoth)
            {
                if (result == Selection.Option1)
                {
                    await ApplyOption1(gameState);

                    if (CanApplyOption2(gameState))
                    {
                        await ApplyOption2(gameState);
                    }
                }
                else
                {
                    await ApplyOption2(gameState);

                    if (CanApplyOption1(gameState))
                    {
                        await ApplyOption1(gameState);
                    }
                }

                ApplyCostforDoingBoth(gameState);
                return(true);
            }

            return(result == Selection.Option1 ? await ApplyOption1(gameState) : await ApplyOption2(gameState));
        }
示例#3
0
        private void DefaultSymbolButton_Click(object sender, RoutedEventArgs e)
        {
            var editor = new SymbolEditor();

            editor.Symbol = Renderer.DefaultSymbol?.Clone() ?? new SimpleMarkerSymbol();
            var result = MetroDialog.ShowDialog("Symbol Editor", editor, this);

            if (result == true)
            {
                Renderer.DefaultSymbol = editor.Symbol;
            }
        }
示例#4
0
        private void SymbolButton_Click(object sender, RoutedEventArgs e)
        {
            var value = ((Button)sender).DataContext as UniqueValue;

            if (value == null)
            {
                return;
            }
            var editor = new SymbolEditor();

            editor.Symbol = value.Symbol?.Clone() ?? new SimpleMarkerSymbol();
            var result = MetroDialog.ShowDialog("Symbol Editor", editor, this);

            if (result == true)
            {
                value.Symbol = editor.Symbol;
            }
        }