예제 #1
0
        public override void Initialize()
        {
            base.Initialize();

            _scaleFactor = ScreenHelper.GetScale();

            timeCounterWheelEntity.Scale     = _scaleFactor;
            timeCounterWheelEntity.Position  = new Vector2(YnG.Width / 2 - timeCounterWheelEntity.ScaledWidth / 2 + (timeCounterWheelEntity.Origin.X * timeCounterWheelEntity.Scale.X), ScreenHelper.GetScaleY(-70));
            timeCounterNeedleEntity.Scale    = _scaleFactor;
            timeCounterNeedleEntity.Position = new Vector2(YnG.Width / 2 - timeCounterNeedleEntity.ScaledWidth / 2, 0);
            timeText.Scale   *= _scaleFactor;
            timeText.Position = new Vector2(YnG.Width / 2 - timeText.ScaledWidth / 2, timeCounterNeedleEntity.ScaledHeight + ScreenHelper.GetScaleY(10));

            scoreCounterEntity.Scale    = _scaleFactor;
            scoreCounterEntity.Position = new Vector2(0, ScreenHelper.GetScaleY(15));
            scoreText.Scale            *= _scaleFactor;
            scoreText.Position          = new Vector2(scoreCounterEntity.ScaledWidth + ScreenHelper.GetScaleX(10), scoreCounterEntity.Y + scoreCounterEntity.ScaledHeight / 2 - scoreText.ScaledHeight / 2);

            itemsCounterEntity.Scale    = _scaleFactor;
            itemsCounterEntity.Position = new Vector2(0, scoreCounterEntity.Y + scoreCounterEntity.ScaledHeight);
            itemsCounter.Scale         *= _scaleFactor;
            itemsCounter.Position       = new Vector2(itemsCounterEntity.ScaledWidth + ScreenHelper.GetScaleX(10), itemsCounterEntity.Y + itemsCounterEntity.ScaledHeight / 2 - scoreText.ScaledHeight / 2);

            bottomBar.Rectangle = new Rectangle(0, (int)(YnG.Height - bottomBar.ScaledHeight), YnG.Width, bottomBar.Height);
            bottomLogo.Position = new Vector2(YnG.Width / 2 - bottomLogo.ScaledWidth / 2, YnG.Height - bottomLogo.ScaledHeight);
        }
예제 #2
0
        public override void LoadContent()
        {
            base.LoadContent();

            Camera.Position = _mazeLevel.StartPosition;

            _gameHUD.LoadContent();
            _gameHUD.Initialize();
            _gameHUD.InitializeMinimap(_mazeLevel);

            virtualPad = new VirtualPad();
            virtualPad.LoadContent();

            float vpZoomValue = 1.0f;

            switch (GameConfiguration.VirtualPadSize)
            {
            case VirtualPadSize.Small: vpZoomValue = 0.9f; break;

            case VirtualPadSize.Normal: vpZoomValue = 1.2f; break;

            case VirtualPadSize.Big: vpZoomValue = 1.7f; break;
            }

            vpZoomValue *= ScreenHelper.GetScale().X;
            virtualPad.UpdateScale(vpZoomValue);
            virtualPad.Position = new Vector2(YnG.Width - virtualPad.Width * vpZoomValue - 10, YnG.Height - virtualPad.Height * vpZoomValue - 10);
            virtualPad.UpdateLayoutPosition();

            if (GameConfiguration.ControlMode == ControlMode.New)
            {
                virtualPad.Pressed += (s, e) => control.SetControlDirection(e.Direction);
            }
            else
            {
                virtualPad.JustPressed += (s, e) => control.SetControlDirection(e.Direction);
            }

            virtualPad.Active = GameConfiguration.EnabledVirtualPad;

            if (GameConfiguration.EnabledMusic)
            {
                YnG.AudioManager.PlayMusic("Audio/Lost_in_dark_way", true);
            }
        }
예제 #3
0
        public MenuState(string name)
            : base(name, true)
        {
            _background = new YnEntity("Backgrounds/Accueil");
            Add(_background);

            playRectangle = new Rectangle(
                (int)ScreenHelper.GetScaleX(135),
                (int)ScreenHelper.GetScaleY(265),
                (int)(ScreenHelper.GetScale().X * 226),
                (int)(ScreenHelper.GetScale().Y * 65));

            quitRectangle = new Rectangle(
                (int)ScreenHelper.GetScaleX(135),
                (int)ScreenHelper.GetScaleY(420),
                (int)(ScreenHelper.GetScale().X * 226),
                (int)(ScreenHelper.GetScale().Y * 65));
        }
예제 #4
0
        public PopupState(string name)
            : base(name, false)
        {
            int y = YnG.Height / 2 - ((YnG.Height / 4) / 2);

            _background       = new YnSprite(new Rectangle(0, y, YnG.Width, (int)(ScreenHelper.GetScaleY(300))), Color.WhiteSmoke);
            _background.Alpha = 0.9f;
            Add(_background);

            _headerBackground = new YnEntity(new Rectangle((int)_background.X, (int)_background.Y, YnG.Width, (int)ScreenHelper.GetScaleY(50)), Color.DarkGray);
            Add(_headerBackground);

            _title       = new YnText(Assets.FontKozuka30, "Fin de partie");
            _title.Color = Color.White;
            _title.Scale = ScreenHelper.GetScale() * 1.25f;
            Add(_title);

            _content       = new YnText(Assets.FontKozuka20, "Vous avez terminé le niveau, que voulez vous faire ?");
            _content.Color = Color.Black;
            _content.Scale = ScreenHelper.GetScale() * 1.1f;
            Add(_content);

            _waitMessage        = new YnText(Assets.FontKozuka30, "Chargement en cours...");
            _waitMessage.Color  = Color.White;
            _waitMessage.Scale  = ScreenHelper.GetScale() * 1.2f;
            _waitMessage.Active = false;
            Add(_waitMessage);

            _itemActionA               = new MessageBoxButton(MessageBoxButtonType.Cancel, "Menu");
            _itemActionA.Position      = new Vector2(_background.Width / 3, _background.Y + _background.Height - ScreenHelper.GetScaleY(100));
            _itemActionA.MouseClicked += (s, e) => OnActionMenu(new MessageBoxEventArgs(false, true));
            _itemActionA.Scale         = ScreenHelper.GetScale();
            Add(_itemActionA);

            _itemActionB               = new MessageBoxButton(MessageBoxButtonType.Validate, "Suivant");
            _itemActionB.Position      = new Vector2((_background.Width / 3) * 2, _itemActionA.Y);
            _itemActionB.MouseClicked += (s, e) => OnActionMenu(new MessageBoxEventArgs(true, false));
            _itemActionB.Scale         = ScreenHelper.GetScale();
            Add(_itemActionB);

            _enabled = true;
        }