public void Dispose()
 {
     // Reset all of the UI and GameSystems
     GameSystems.Shutdown();
     UiSystems.DisposeAll();
     Tig.Shutdown();
 }
Beispiel #2
0
        public List <ScraperData> GetGameInformation(FileInfo romFile, GameSystems system, string romTitle = null)
        {
            string MD5  = GetMd5Hash(romFile.FullName);
            string SHA1 = GetSHA1(romFile.FullName);

            return(GetGameInformation(MD5, SHA1, romFile.Name, system, romTitle));
        }
Beispiel #3
0
        /// <summary>Called after the Game and GraphicsDevice are created, but before LoadContent.  Reference page contains code sample.</summary>
        protected virtual void Initialize()
        {
            // Setup the graphics device if it was not already setup.
            SetupGraphicsDeviceEvents();

            GameSystems.Initialize();
        }
Beispiel #4
0
 private void Start()
 {
     towerMenu   = GameObject.Find("TowerManager").GetComponent <TowerMenu>();
     gameSystems = GameObject.Find("GameManager").GetComponent <GameSystems>();
     canvas      = GameObject.Find("Canvas").GetComponent <Transform>();
     towerMenu.buttonList.Add(gameObject);
     gameObject.GetComponent <Button>().onClick.AddListener(TowerMenuSwitch);
 }
Beispiel #5
0
        protected override void Initialize()
        {
            base.Initialize();

            //now we probably are capable of detecting the gpu/cpu/etc so we confirm rendering settings
            if (AutoLoadDefaultSettings)
            {
                ConfirmRenderingSettings();
            }

            // ---------------------------------------------------------
            // Add common GameSystems - Adding order is important
            // (Unless overriden by gameSystem.UpdateOrder)
            // ---------------------------------------------------------

            // Add the input manager
            Input = InputManagerFactory.NewInputManager(Services, Context);
            GameSystems.Add(Input);

            // Add the scheduler system
            // - Must be after Input, so that scripts are able to get latest input
            // - Must be before Entities/Camera/Audio/UI, so that scripts can apply
            // changes in the same frame they will be applied
            GameSystems.Add(Script);

            // Add the Audio System
            GameSystems.Add(Audio);

            // Add the Font system
            GameSystems.Add(gameFontSystem);

            //Add the sprite animation System
            GameSystems.Add(SpriteAnimation);

            GameSystems.Add(ProfilerSystem);

            EffectSystem = new EffectSystem(Services);

            // If requested in game settings, compile effects remotely and/or notify new shader requests
            if (Settings != null)
            {
                EffectSystem.Compiler = EffectSystem.CreateEffectCompiler(EffectSystem, Settings.PackageId, Settings.EffectCompilation, Settings.RecordUsedEffects);
            }

            GameSystems.Add(EffectSystem);

            GameSystems.Add(SceneSystem);

            // TODO: data-driven?
            Content.Serializer.RegisterSerializer(new ImageSerializer());
            Content.Serializer.RegisterSerializer(new SoundEffectSerializer(Audio.AudioEngine));
            Content.Serializer.RegisterSerializer(new SoundMusicSerializer(Audio.AudioEngine));

            // enable multi-touch by default
            Input.MultiTouchEnabled = true;

            OnGameStarted(this);
        }
Beispiel #6
0
        protected override void Initialize()
        {
            // ---------------------------------------------------------
            // Add common GameSystems - Adding order is important
            // (Unless overriden by gameSystem.UpdateOrder)
            // ---------------------------------------------------------

            // Add the input manager
            // Add it first so that it can obtained by the UI system
            Input = new InputManager(Services);
            Services.AddService(Input);
            GameSystems.Add(Input);

            // Initialize the systems
            base.Initialize();

            // Add the scheduler system
            // - Must be after Input, so that scripts are able to get latest input
            // - Must be before Entities/Camera/Audio/UI, so that scripts can apply
            // changes in the same frame they will be applied
            GameSystems.Add(Script);

            // Add the Font system
            GameSystems.Add(gameFontSystem);

            //Add the sprite animation System
            GameSystems.Add(SpriteAnimation);

            GameSystems.Add(DebugTextSystem);
            GameSystems.Add(ProfilingSystem);

            EffectSystem = new EffectSystem(Services);
            Services.AddService(EffectSystem);

            // If requested in game settings, compile effects remotely and/or notify new shader requests
            if (Settings != null)
            {
                EffectSystem.Compiler = EffectSystem.CreateEffectCompiler(EffectSystem, Settings.PackageId, Settings.EffectCompilation, Settings.RecordUsedEffects);
            }

            GameSystems.Add(EffectSystem);

            GameSystems.Add(Streaming);
            GameSystems.Add(SceneSystem);

            // Add the Audio System
            GameSystems.Add(Audio);

            // Add the VR System
            GameSystems.Add(VRDeviceSystem);

            // TODO: data-driven?
            Content.Serializer.RegisterSerializer(new ImageSerializer());

            OnGameStarted(this);
        }
Beispiel #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Game"/> class.
        /// </summary>
        public Game()
        {
            // Register the logger backend before anything else
            logListener = GetLogListener();

            if (logListener != null)
            {
                GlobalLogger.GlobalMessageLogged += logListener;
            }

            // Create and register all core services
            Input           = new InputManager(Services);
            Script          = new ScriptSystem(Services);
            SceneSystem     = new SceneSystem(Services);
            Audio           = new AudioSystem(Services);
            UI              = new UISystem(Services);
            gameFontSystem  = new GameFontSystem(Services);
            SpriteAnimation = new SpriteAnimationSystem(Services);
            ProfilerSystem  = new GameProfilingSystem(Services);

            // ---------------------------------------------------------
            // Add common GameSystems - Adding order is important
            // (Unless overriden by gameSystem.UpdateOrder)
            // ---------------------------------------------------------

            // Add the input manager
            GameSystems.Add(Input);

            // Add the scheduler system
            // - Must be after Input, so that scripts are able to get latest input
            // - Must be before Entities/Camera/Audio/UI, so that scripts can apply
            // changes in the same frame they will be applied
            GameSystems.Add(Script);

            // Add the UI System
            GameSystems.Add(UI);

            // Add the Audio System
            GameSystems.Add(Audio);

            // Add the Font system
            GameSystems.Add(gameFontSystem);

            //Add the sprite animation System
            GameSystems.Add(SpriteAnimation);

            Asset.Serializer.LowLevelSerializerSelector = ParameterContainerExtensions.DefaultSceneSerializerSelector;

            // Creates the graphics device manager
            GraphicsDeviceManager = new GraphicsDeviceManager(this);

            GameSystems.Add(ProfilerSystem);

            AutoLoadDefaultSettings = true;
        }
Beispiel #8
0
        protected override void Update(GameTime gameTime)
        {
            if (_isFirstUpdate)
            {
                GameSystems.Update(gameTime);   // HACK: need to force a first update flag inside this instance even if its empty
                _gameEngine.InitialUpdate();
                _isFirstUpdate = false;
                return;
            }

            // Don't call base.Update(gameTime); since this everything must be updated through _gameEngine
            _gameEngine.Update();
        }
Beispiel #9
0
        public PacmanGame()
        {
            Logger.NewMessageLogged += new Logger.LogAction(Logger_NewMessageLogged);
            Logger.Info("Logger initiated.");

            _graphics = new GraphicsDeviceManager(this);
            _graphics.PreferredBackBufferWidth  = ScreenWidth;
            _graphics.PreferredBackBufferHeight = ScreenHeight;

            _screenManager = new PacmanScreenManager(this);
            GameSystems.Add(_screenManager);

            Content.RootDirectory = "Content";
        }
Beispiel #10
0
        static void Main(string[] args)
        {
            GameSystems.Initialize(new GameStartInfo()
            {
                WindowName = "WindowTestUnit",
                GameName   = "WindowTestUnit",
                IconName   = "",
                WindowSize = new Size <int>(1920, 1080)
            });

            InitializeWindowEvent();

            GameSystems.RunLoop();
        }
Beispiel #11
0
        static void Main(string[] args)
        {
            const int width  = 1920;
            const int height = 1080;

            var adapters = GalEngine.Runtime.Graphics.GpuAdapter.EnumerateGraphicsAdapter();

            GameSystems.Initialize(new GameStartInfo()
            {
                WindowName = "Bezier Render System",
                GameName   = "Bezier Render System",
                IconName   = null,
                WindowSize = new Size <int>(width, height),
                Adapter    = adapters[1]
            });

            BezierRender bezierRender = new BezierRender(GameSystems.GpuDevice);

            GameSystems.AddBehaviorSystem(
                new BezierFillSystem(bezierRender,
                                     new Rectangle <int>(0, 0, width, height)));

            /*GameSystems.AddBehaviorSystem(
             * new BezierDrawSystem(bezierRender,
             * new Rectangle<int>(0, 0, width, height)));*/

            GameSystems.MainScene = new GameScene("Main");

            Random random = new Random(0);

            Flower[] flowers = new Flower[500];

            for (int i = 0; i < flowers.Length; i++)
            {
                flowers[i] = new Flower(
                    new Position <float>(random.Next(0, width), random.Next(0, height)),
                    random.Next(100, 200));

                foreach (var leaf in flowers[i].Leaves)
                {
                    GameSystems.MainScene.AddGameObject(leaf);
                }
            }

            GameSystems.RunLoop();
        }
Beispiel #12
0
        static void Main(string[] args)
        {
            GameSystems.Initialize(new GameStartInfo()
            {
                GameName   = "GuiSystemTestUnit",
                WindowName = "GuiSystemTestUnit",
                IconName   = "",
                WindowSize = new Size <int>(1920, 1080)
            });

            var guiText      = new GuiText("This is a test text!", new Font(20), new Color <float>(0, 0, 0, 1));
            var guiButton    = new GuiButton();
            var guiInputText = new GuiInputText("input", 100,
                                                DefaultInputTextProperty.Background,
                                                DefaultInputTextProperty.Frontground, new Font(30));

            //guiInputText.GetComponent<InputTextGuiComponent>().Content = "2333";
            guiInputText.GetComponent <InputTextGuiComponent>().CursorLocation = 1;
            guiInputText.GetComponent <TransformGuiComponent>().Position       = new Position <float>(100, 100);

            (guiButton.GetComponent <ButtonGuiComponent>().Shape as RectangleShape).Size = new Size <float>(80, 40);
            //guiButton.GetComponent<TransformGuiComponent>().Position = new Position<float>(100, 100);

            guiButton.GetComponent <LogicGuiComponent>().EventParts.Get(GuiComponentSupportEvent.MouseClick)
            .Solver += (x, y) =>
            {
                var eventArg = y as GuiComponentMouseClickEvent;

                if (eventArg.IsDown && eventArg.Button == MouseButton.Left)
                {
                    Console.WriteLine(1);
                }
            };

            GameSystems.SystemScene.Root.AddChild(guiButton);
            //GameSystems.SystemScene.Root.AddChild(guiText);
            GameSystems.SystemScene.Root.AddChild(guiInputText);


            GameSystems.VisualGuiSystem.GuiRenderDebugProperty = new GuiRenderDebugProperty()
            {
                //ShapeProperty = new ShapeDebugProperty(2.0f, new Color<float>(1, 0, 0, 1))
            };

            GameSystems.RunLoop();
        }
Beispiel #13
0
 void PowerReceiver_RequiredInputChanged(GameSystems.Electricity.MyPowerReceiver receiver, float oldRequirement, float newRequirement)
 {
     UpdateDetailedInfo();
 }
Beispiel #14
0
 /// <summary>
 /// LoadContent will be called once per game and is the place to load
 /// all of your content.
 /// </summary>
 protected override void LoadContent()
 {
     _systems = new GameSystems(GraphicsDevice);
     var gameLoader = new GameLoader(Content, GraphicsDevice.Viewport);
     _world = gameLoader.LoadLevel();
 }