Пример #1
0
 public void Initialize(CommandArguments commandArguments)
 {
     raceName    = commandArguments[CommandArguments.Option.RaceName];
     turnNumber  = int.Parse(commandArguments[CommandArguments.Option.Turn], System.Globalization.CultureInfo.InvariantCulture);
     clientState = new ClientData();
     clientState.Initialize(commandArguments.ToArray());
 }
Пример #2
0
        /// <Summary>
        /// Launch the Nova GUI to play a turn for a give player.
        /// </Summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A <see cref="EventArgs"/> that contains the event data.</param>
        private void PlayerList_DoubleClick(object sender, EventArgs e)
        {
            // On occasion this fires but SelectedItems is empty. Ignore and let the user re-click. See issue #2974019.
            if (playerList.SelectedItems.Count == 0)
            {
                return;
            }

            // Find what was clicked
            string raceName = playerList.SelectedItems[0].SubItems[1].Text;

            try
            {
                // Launch the nova GUI
                CommandArguments args = new CommandArguments();
                args.Add(CommandArguments.Option.RaceName, raceName);
                args.Add(CommandArguments.Option.Turn, serverState.TurnYear);
                args.Add(CommandArguments.Option.IntelFileName, Path.Combine(serverState.GameFolder, raceName + Global.IntelExtension));

                Nova.WinForms.Gui.NovaGUI gui = new Nova.WinForms.Gui.NovaGUI(args.ToArray());
                gui.Show();
            }
            catch (Exception ex)
            {
                Report.Error("NovaConsole.cs : PlayerList_DoubleClick() - Failed to launch GUI. Details:" +
                             Environment.NewLine + ex.ToString());
            }
        }
Пример #3
0
        /// <Summary>
        /// When the 'Continue Game' button is pressed, continue the last opened game.
        /// </Summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A <see cref="EventArgs"/> that contains the event data.</param>
        private void ContinueGameButton_Click(object sender, EventArgs e)
        {
            // start the GUI
            if (this.clientStateFile != null)
            {
                CommandArguments args = new CommandArguments();
                args.Add(CommandArguments.Option.GuiSwitch);
                args.Add(CommandArguments.Option.StateFileName, this.clientStateFile);

                try
                {
                    Nova.WinForms.Gui.NovaGUI gui = new Nova.WinForms.Gui.NovaGUI(args.ToArray());
                    gui.Show();
                }
                catch
                {
                    Report.Error("Failed to launch GUI.");
                }
            }

            // start the server
            if (this.serverStateFile != null)
            {
                try
                {
                    Nova.WinForms.Console.NovaConsole novaConsole = new Nova.WinForms.Console.NovaConsole();
                    novaConsole.Show();
                    return;
                }
                catch
                {
                    Report.FatalError("Unable to launch Console.");
                }
            }
        }
Пример #4
0
        /// <Summary>
        /// Load Next Turn
        /// </Summary>
        /// <remarks>
        /// This menu Item has been disabled as it does not currently detect if there is
        /// a valid next turn.
        /// TODO (priority 6) - detect when a new turn is available.
        /// </remarks>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A <see cref="EventArgs"/> that contains the event data.</param>
        private void LoadNextTurnToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // prepare the arguments that will tell how to re-initialize.
            CommandArguments commandArguments = new CommandArguments();

            commandArguments.Add(CommandArguments.Option.RaceName, clientState.EmpireState.Race.Name);
            commandArguments.Add(CommandArguments.Option.Turn, clientState.EmpireState.TurnYear + 1);

            clientState.Initialize(commandArguments.ToArray());
            this.NextTurn();
        }