Esempio n. 1
0
 private void Exit_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     if (ExitClicked != null)
     {
         ExitClicked.Invoke();
     }
 }
Esempio n. 2
0
        public LoadGameWindow(IGuiServices guiServices, ITexts texts) : base(guiServices)
        {
            //TODO: keep archives path in common place
            //TODO: sort out this line:
            var archives = Directory.EnumerateFiles(Path.Combine("data", "archive"))
                           .Take(10)
                           .Select(Path.GetFileName)
                           .ToList();

            var dict = new Dictionary <string, Action <HandledEventArgs> >();

            foreach (var name in archives)
            {
                dict.Add(name, args =>
                {
                    ArchiveNameClicked?.Invoke(args, name);
                    Closing?.Invoke(args);
                });
            }
            dict.Add(texts.Get("exit"), args =>
            {
                ExitClicked?.Invoke(args);
                Closing?.Invoke(args);
            });
            ButtonNames = dict;
        }
 private void PositionDetailsComp_Exit(object sender, System.ComponentModel.CancelEventArgs e)
 {
     this.Visibility = Visibility.Collapsed;
     if (ExitClicked != null)
     {
         ExitClicked.Invoke(this, EventArgs.Empty);
     }
 }
Esempio n. 4
0
 void Exit_Click(object sender, EventArgs e)
 {
     if (ExitClicked != null)
     {
         ExitClicked.Invoke(this, e);
     }
     else
     {
         Application.Exit();
     }
 }
Esempio n. 5
0
 public ControlBar()
 {
     InitializeComponent();
     this.Background              = new SolidColorBrush(Colors.Transparent);
     Seekbar.TimePositionChanged += Seekbar_OnTimePositionChange;
     Seekbar.PositionChanged     += (position) => PositionChanged?.Invoke(position);
     Volume.VolumeChanged        += (volume) => VolumeChanged?.Invoke(volume);
     Play.PlayStateChanged       += (play) => PlayStateChanged?.Invoke(play);
     Maximize.Clicked            += () => MaximizeClicked?.Invoke();
     Menu.AudioClicked           += () => AudiosClicked?.Invoke();
     Menu.SubtitlesClicked       += () => SubtitlesClicked?.Invoke();
     Menu.ExitClicked            += () => ExitClicked?.Invoke();
     Menu.ConfigClicked          += () => ConfigClicked?.Invoke();
     this.MouseLeave             += ControlBar_MouseLeave;
     this.MouseEnter             += ControlBar_MouseEnter;
 }
Esempio n. 6
0
 public CityOrdersWindow(IGuiServices guiServices, ITexts texts) : base(guiServices)
 {
     //TODO: provide translations for all items here
     ButtonNames = new Dictionary <string, Action <HandledEventArgs> >
     {
         {
             "Podatki", args =>
             {
                 TaxesClicked?.Invoke(args);
                 Closing?.Invoke(args);
             }
         },
         {
             "Nowy Legion", args =>
             {
                 NewLegionClicked?.Invoke(args);
                 Closing?.Invoke(args);
             }
         },
         {
             "Rozbudowa", args =>
             {
                 BuildClicked?.Invoke(args);
                 Closing?.Invoke(args);
             }
         },
         {
             "Budowa Murow", args =>
             {
                 WallsBuildClicked?.Invoke(args);
                 Closing?.Invoke(args);
             }
         },
         {
             texts.Get("exit"), args =>
             {
                 ExitClicked?.Invoke(args);
                 Closing?.Invoke(args);
             }
         }
     };
 }
Esempio n. 7
0
 public Menu()
 {
     InitializeComponent();
     top.Visibility  = Visibility.Collapsed;
     MouseLeave     += Menu_MouseLeave;
     MouseEnter     += Menu_MouseEnter;
     Open.Clicked   += () => MenuIsShown = !MenuIsShown;
     Config.Clicked += () =>
     {
         FastOff();
         ConfigClicked?.Invoke();
     };
     Audio.Clicked += () =>
     {
         FastOff();
         AudioClicked?.Invoke();
     };
     Subs.Clicked += () =>
     {
         FastOff();
         SubtitlesClicked?.Invoke();
     };
     Exit.Clicked += () => ExitClicked?.Invoke();
 }
 void Awake()
 {
     ReturnButton.onClick.AddListener(() => ReturnClicked?.Invoke(null, null));
     ExitButton.onClick.AddListener(() => ExitClicked?.Invoke(null, null));
 }
Esempio n. 9
0
 private void OnExitClicked()
 {
     ExitClicked.SafeRaise();
 }
Esempio n. 10
0
        public ArmyOrdersWindow(IGuiServices guiServices,
                                ITexts texts,
                                bool isTerrainActionButtonVisible,
                                bool isRecruitButtonVisible) : base(guiServices)
        {
            var dict = new Dictionary <string, Action <HandledEventArgs> >
            {
                {
                    texts.Get("move"), args =>
                    {
                        MoveClicked?.Invoke(args);
                        Closing?.Invoke(args);
                    }
                },
                {
                    texts.Get("fastMove"), args =>
                    {
                        FastMoveClicked?.Invoke(args);
                        Closing?.Invoke(args);
                    }
                },
                {
                    texts.Get("attack"), args =>
                    {
                        AttackClicked?.Invoke(args);
                        Closing?.Invoke(args);
                    }
                }
            };

            if (isRecruitButtonVisible)
            {
                dict.Add(texts.Get("recruit"), args =>
                {
                    RecruitClicked?.Invoke(args);
                    Closing?.Invoke(args);
                });
            }
            else
            {
                dict.Add(texts.Get("hunt"), args =>
                {
                    HuntClicked?.Invoke(args);
                    Closing?.Invoke(args);
                });
            }

            dict.Add(texts.Get("camp"), args =>
            {
                CampClicked?.Invoke(args);
                Closing?.Invoke(args);
            });

            dict.Add(texts.Get("equipment"), args =>
            {
                EquipmentClicked?.Invoke(args);
                Closing?.Invoke(args);
            });

            if (isTerrainActionButtonVisible)
            {
                dict.Add(texts.Get("action"), args =>
                {
                    ActionClicked?.Invoke(args);
                    Closing?.Invoke(args);
                });
            }

            dict.Add(texts.Get("exit"), args =>
            {
                ExitClicked?.Invoke(args);
                Closing?.Invoke(args);
            });

            ButtonNames = dict;
        }
Esempio n. 11
0
        public GameOptionsWindow(
            IGuiServices guiServices,
            ITexts texts,
            IPlayersRepository playersRepository,
            ILegionInfo legionInfo) : base(guiServices)
        {
            ButtonWidth = OverrideButtonWidth;

            var day   = legionInfo.CurrentDay;
            var money = playersRepository.UserPlayer.Money;

            var dict = new Dictionary <string, Action <HandledEventArgs> >
            {
                {
                    texts.Get("mapOptions.title", day, money), args => args.Handled = true
                },
                {
                    texts.Get("mapOptions.loadGame"), args =>
                    {
                        LoadGameClicked?.Invoke(args);
                        Closing?.Invoke(args);
                    }
                },
                {
                    texts.Get("mapOptions.saveGame"), args =>
                    {
                        SaveGameClicked?.Invoke(args);
                        Closing?.Invoke(args);
                    }
                },
                {
                    texts.Get("mapOptions.statistics"), args =>
                    {
                        StatisticsClicked?.Invoke(args);
                        Closing?.Invoke(args);
                    }
                },
                {
                    texts.Get("mapOptions.options"), args =>
                    {
                        OptionsClicked?.Invoke(args);
                        Closing?.Invoke(args);
                    }
                },
                {
                    texts.Get("mapOptions.endGame"), args =>
                    {
                        EndGameClicked?.Invoke(args);
                        Closing?.Invoke(args);
                    }
                },
                {
                    texts.Get("mapOptions.exit"), args =>
                    {
                        ExitClicked?.Invoke(args);
                        Closing?.Invoke(args);
                    }
                }
            };

            ButtonNames = dict;
        }