Example #1
0
        public override void Initialize()
        {
            var credits = new Label(
                "Sound of end turn made by Eric Matyas, available from \n" +
                "http://soundimage.org/, Fireball sounds available under Creative Commons license from \n" +
                "http://www.freesound.org/people/LiamG_SFX/sounds/334234/ and http://www.freesound.org/people/CTCollab/sounds/223615/, \n" +
                "Hit sound also available under creative common license from http://www.freesound.org/people/Twisted_Euphoria/sounds/205938/",
                _assetManager.Font,
                Color.Gray)
            {
                Position  = new Vector2(0, 960),
                SortOrder = Camera2D.SortUI,
            };

            AddAndInitializeRootEntity(credits, _assetManager);

            var bg = CreateRootEntity(Camera2D.SortBackground);

            bg.Renderer = new SpriteRenderer(_assetManager[AssetManager.QuestionnaireBg]);
            bg.Position = Vector2.Zero;

            _rootLayout = new VerticalLayout {
                SortOrder = Camera2D.SortUI,
                Position  = new Vector2(530, 250)
            };

            GenerateChildren();

            AddAndInitializeRootEntity(_rootLayout, _assetManager);

            _rootLayout.AddComponent(() => {
                if (InputManager.Instance.IsKeyJustPressed(Keys.Space))
                {
                    RunNextExperiment();
                }

                if (InputManager.Instance.IsKeyJustPressed(Keys.E))
                {
                    LoadNewScene(new MapEditorScene(_gameManager));
                }

                if (InputManager.Instance.IsKeyJustPressed(Keys.Q) && Keyboard.GetState().IsKeyDown(Keys.LeftControl))
                {
                    foreach (var file in AllFiles())
                    {
                        if (IsDone(file))
                        {
                            MarkUndone(file);
                        }
                    }

                    DelayFor(TimeSpan.Zero, GenerateChildren);
                }
            });
        }