Ejemplo n.º 1
0
        public static bool Dispatch(EngineCommands command, Context ctx)
        {
            switch (command)
            {
            case EngineCommands.Next:
                return(new NextCommand().Execute(ctx));

            case EngineCommands.Previous:
                return(new PreviousCommand().Execute(ctx));

            case EngineCommands.Flag:
                return(new FlagCommand().Execute(ctx));

            case EngineCommands.Quit:
                return(new QuitCommand().Execute(ctx));

            default:
                return(false);
            }
        }
Ejemplo n.º 2
0
        protected sealed override void LoadContent()
        {
            PlayerData.Initialize();

            Logger = new LoggerConfiguration()
                     .WriteTo.PGNConsole()
                     .WriteTo.File(Path.Combine(PlayerData.UserDataPath, "log.txt"), rollingInterval: RollingInterval.Day)
                     .CreateLogger();

            Renderer = new Renderer(DisplayParams.ScreenWidth, DisplayParams.ScreenHeight, DisplayParams.InitialScale);

            Renderer.GraphicsDeviceMgr.SynchronizeWithVerticalRetrace = false; //Vsync
            IsFixedTimeStep = true;

            TargetElapsedTime     = TimeSpan.FromSeconds(1 / (float)FrameRate);
            Instance.Window.Title = WindowTitle;

            ResourceCache.Initialize(TemplateProcessor);

            GameData.Initialize();

            Renderer.SpriteBatch = new SpriteBatch(GraphicsDevice);

            loadResources();

            Sfx.Initialize();
            Music.Initialize();

            LoadGame();

            Console = new PGNConsole(ConsoleOpts);
            Console.LoadContent();
            Console.AddGlobalCommands(EngineCommands.Build());

            EngineBkgdColor = DefaultBkgdColor;

            World = InitialWorld;
            World.LoadContent();

            Logger.Information("Starting {WindowTitle}", WindowTitle, TargetElapsedTime);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Méthode d'assignation des commandes et des variables
        /// </summary>
        public void AssignCommandsAndValues <T>()
        {
            EngineCommands      = new EngineCommands(SimConnect);
            MiscSystemsCommands = new MiscSystemsCommands(SimConnect);
            LightsCommands      = new LightsCommands(SimConnect);
            FuelSystemsCommands = new FuelSystemsCommands(SimConnect);

            // On assigne les différentes commandes qu'on veut envoyer au simulateur
            foreach (SimEvents simEvent in Enum.GetValues(typeof(SimEvents)))
            {
                SimConnect.MapClientEventToSimEvent(simEvent, simEvent.ToString());
            }

            // Il reste à assigner les différentes variables à récupérer au niveau du simulateur
            foreach (var variable in SimVariables.Variables)
            {
                SimConnect.AddToDataDefinition(DEFINITIONS.Dummy, variable.PropertyName, variable.PropertyType, SIMCONNECT_DATATYPE.FLOAT64, 0.0f, SimConnect.SIMCONNECT_UNUSED);
            }

            SimConnect.RegisterDataDefineStruct <T>(DEFINITIONS.Dummy);
        }