コード例 #1
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="Window{TCommands,TData}" /> class.
        /// </summary>
        /// <param name="simUnit">Core simulation which is controlling the form factory.</param>
        protected Window(SimulationApp simUnit)
        {
            // Copy over reference for simulation core.
            _simUnit = simUnit;

            // Reference for our text user interface data so we can build it up in pieces.
            _menuPrompt = new StringBuilder();

            // Create the user data object casted to correct type from generics while still adhering to common base class.
            UserData = FactoryExtensions.New <TData> .Instance();

            // Determines if the menu system should show raw input names in the menu rendering or just number selections by enum value.
            ShowCommandNamesInMenu = SimulationApp.SHOW_COMMANDS;

            // Complain the generics implemented is not of an enum type.
            if (!typeof(TCommands).GetTypeInfo().IsEnum)
            {
                throw new InvalidCastException("TCommands must be an enumerated type!");
            }

            // Create empty list of menu choices.
            _menuCommands = new List <IMenuChoice <TCommands> >();

            // Dictionary of mappings for the choices and their associated values and actions.
            _menuMappings = new Dictionary <string, TCommands>();
            _menuActions  = new Dictionary <TCommands, Action>();

            // Menu header and footer is empty strings by default.
            _menuHeader = string.Empty;
            _menuFooter = string.Empty;
        }
コード例 #2
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="WindowFactory" /> class.
        ///     Creates a new Windows factory that will look over the application for all known game types and create reference
        ///     list which we can use to get instances of a given Windows by asking for it.
        /// </summary>
        /// <param name="simUnit">Core simulation which is controlling the window factory.</param>
        public WindowFactory(SimulationApp simUnit)
        {
            // Copy over reference for simulation core.
            _simUnit = simUnit;

            // Create dictionaries for holding statistics about times run and for reference loading.
            Windows = new Dictionary <string, Type>();

            // Loop through every possible game Windows type defined in enumeration.
            foreach (var window in simUnit.AllowedWindows)
            {
                // Add the game Windows to reference list for lookup and instancing later during runtime.
                Windows.Add(window.Name, window);
            }
        }
コード例 #3
0
ファイル: SceneGraph.cs プロジェクト: allisterb/WolfCurses
 /// <summary>
 ///     Initializes a new instance of the <see cref="SceneGraph" /> class.
 /// </summary>
 /// <param name="simUnit">Core simulation which is controlling the window manager.</param>
 public SceneGraph(SimulationApp simUnit)
 {
     _simUnit     = simUnit;
     ScreenBuffer = string.Empty;
 }
コード例 #4
0
ファイル: GameOver.cs プロジェクト: Gigabutt/OregonTrail
 /// <summary>
 ///     Initializes a new instance of the <see cref="Window{TCommands,TData}" /> class.
 /// </summary>
 /// <param name="simUnit">Core simulation which is controlling the form factory.</param>
 public GameOver(SimulationApp simUnit) : base(simUnit)
 {
 }
コード例 #5
0
ファイル: ConsoleWindow.cs プロジェクト: sycomix/ClassifyBot
 public ConsoleWindow(SimulationApp app) : base(app)
 {
 }
コード例 #6
0
ファイル: InputManager.cs プロジェクト: McNeight/WolfCurses
 /// <summary>
 ///     Initializes a new instance of the <see cref="InputManager" /> class.
 /// </summary>
 /// <param name="simUnit">Core simulation which is controlling the window manager.</param>
 public InputManager(SimulationApp simUnit)
 {
     _simUnit      = simUnit;
     _commandQueue = new Queue <string>();
     InputBuffer   = string.Empty;
 }
コード例 #7
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Window{TCommands,TData}" /> class.
 /// </summary>
 /// <param name="simUnit">Core simulation which is controlling the form factory.</param>
 public MainMenu(SimulationApp simUnit) : base(simUnit)
 {
 }
コード例 #8
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Window{TCommands,TData}" /> class.
 /// </summary>
 /// <param name="simUnit">Core simulation which is controlling the form factory.</param>
 public Travel(SimulationApp simUnit) : base(simUnit)
 {
 }
コード例 #9
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Window{TCommands,TData}" /> class.
 /// </summary>
 /// <param name="simUnit">Core simulation which is controlling the form factory.</param>
 // ReSharper disable once UnusedMember.Global
 public ExampleWindow(SimulationApp simUnit) : base(simUnit)
 {
 }
コード例 #10
0
ファイル: Graveyard.cs プロジェクト: Gigabutt/OregonTrail
 /// <summary>
 ///     Initializes a new instance of the <see cref="Window{TCommands,TData}" /> class.
 /// </summary>
 /// <param name="simUnit">Core simulation which is controlling the form factory.</param>
 public Graveyard(SimulationApp simUnit) : base(simUnit)
 {
 }
コード例 #11
0
 public LabelAnnotatorWindow(SimulationApp app) : base(app)
 {
 }
コード例 #12
0
ファイル: RandomEvent.cs プロジェクト: Gigabutt/OregonTrail
 /// <summary>
 ///     Initializes a new instance of the <see cref="Window{TCommands,TData}" /> class.
 /// </summary>
 /// <param name="simUnit">Core simulation which is controlling the form factory.</param>
 public RandomEvent(SimulationApp simUnit) : base(simUnit)
 {
 }
コード例 #13
0
ファイル: WindowManager.cs プロジェクト: allisterb/WolfCurses
 /// <summary>
 ///     Initializes a new instance of the <see cref="WindowManager" /> class.
 ///     Initializes a new instance of the <see cref="T:TrailSimulation.Core.ModuleProduct" /> class.
 /// </summary>
 /// <param name="simUnit">Core simulation which is controlling the window manager.</param>
 public WindowManager(SimulationApp simUnit)
 {
     // Factories for modes and states that can be attached to them during runtime.
     windowFactory = new WindowFactory(simUnit);
     formFactory   = new FormFactory();
 }