Ejemplo n.º 1
0
        public override void OnInitialize()
        {
            AddElement(_btn1 = new HUDImageButton
            {
                Alignment        = HUDAlignment.TOPCENTER,
                RelativePosition = new FPoint(0, 0),
                Size             = new FSize(Width, 64),

                Image         = Textures.TexTriangle,
                ImageRotation = FloatMath.RAD_POS_000,
                ImagePadding  = 4,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth),

                Click = (s, a) => DoScroll(-1),
            });

            AddElement(_btn2 = new HUDImageButton
            {
                Alignment        = HUDAlignment.BOTTOMCENTER,
                RelativePosition = new FPoint(0, 0),
                Size             = new FSize(Width, 64),

                Image         = Textures.TexTriangle,
                ImageRotation = FloatMath.RAD_POS_180,
                ImagePadding  = 4,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth),

                Click = (s, a) => DoScroll(+1),
            });
        }
Ejemplo n.º 2
0
        public override void OnInitialize()
        {
            AddElement(new HUDImage
            {
                RelativePosition = new FPoint(5, (Height - 25 - 32) / 2),
                Size             = new FSize(32, 32),
                Alignment        = HUDAlignment.TOPLEFT,

                Image          = Textures.CannonCog,
                ImageAlignment = HUDImageAlignmentAlgorithm.CENTER,
                ImageScale     = HUDImageScaleAlgorithm.STRETCH,
                RotationSpeed  = 0.25f,
                Color          = FlatColors.SunFlower,
            });

            AddElement(new HUDTextButton
            {
                RelativePosition = new FPoint(5, 5),
                Size             = new FSize(192, 32),
                Alignment        = HUDAlignment.TOPRIGHT,

                L10NText      = L10NImpl.STR_LVLED_BTN_EDIT,
                TextColor     = Color.White,
                Font          = Textures.HUDFontRegular,
                FontSize      = 28,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                Click = OnEdit,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth),
            });
        }
Ejemplo n.º 3
0
        public override void OnInitialize()
        {
            AddElement(new HUDTextButton
            {
                RelativePosition = new FPoint(8, 0),
                Size             = new FSize(384, 48),
                Alignment        = HUDAlignment.CENTERRIGHT,

                L10NText      = L10NImpl.STR_LVLED_BTN_NEWLVL,
                TextColor     = Color.White,
                Font          = Textures.HUDFontRegular,
                FontSize      = 32,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                Click = CreateNewUserLevel,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth),
            });

            AddElement(new HUDImage
            {
                RelativePosition = new FPoint(8, 0),
                Size             = new FSize(48, 48),
                Alignment        = HUDAlignment.CENTERLEFT,

                Image          = Textures.CannonCog,
                ImageAlignment = HUDImageAlignmentAlgorithm.CENTER,
                ImageScale     = HUDImageScaleAlgorithm.STRETCH,
                RotationSpeed  = 0.10f,
                Color          = FlatColors.Asbestos,
            });
        }
Ejemplo n.º 4
0
        public void SelectTab(SCCMTab tab)
        {
            var bg1Normal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Clouds, Color.Black, HUD.PixelWidth);
            var bg1Pressd = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Silver, Color.Black, HUD.PixelWidth);

            var bg2Normal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.BelizeHole, Color.Black, HUD.PixelWidth);
            var bg2Pressd = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.PeterRiver, Color.Black, HUD.PixelWidth);

            _btnHeaderMyLevel.BackgroundNormal  = (tab == SCCMTab.MyLevels) ? bg2Normal : bg1Normal;
            _btnHeaderMyLevel.BackgroundPressed = (tab == SCCMTab.MyLevels) ? bg2Pressd : bg1Pressd;

            _btnHeaderNew.BackgroundNormal  = (tab == SCCMTab.New)      ? bg2Normal : bg1Normal;
            _btnHeaderNew.BackgroundPressed = (tab == SCCMTab.New)      ? bg2Pressd : bg1Pressd;

            _btnHeaderHot.BackgroundNormal  = (tab == SCCMTab.Hot)      ? bg2Normal : bg1Normal;
            _btnHeaderHot.BackgroundPressed = (tab == SCCMTab.Hot)      ? bg2Pressd : bg1Pressd;

            _btnHeaderTop.BackgroundNormal  = (tab == SCCMTab.Top)      ? bg2Normal : bg1Normal;
            _btnHeaderTop.BackgroundPressed = (tab == SCCMTab.Top)      ? bg2Pressd : bg1Pressd;

            _btnHeaderSearch.BackgroundNormal  = (tab == SCCMTab.Search)   ? bg2Normal : bg1Normal;
            _btnHeaderSearch.BackgroundPressed = (tab == SCCMTab.Search)   ? bg2Pressd : bg1Pressd;

            switch (tab)
            {
            case SCCMTab.MyLevels:
                _container.SetElement(new SCCMTabMyLevels());
                break;

            case SCCMTab.Hot:
                _container.SetElement(new SCCMTabHot());
                break;

            case SCCMTab.Top:
                _container.SetElement(new SCCMTabTop());
                break;

            case SCCMTab.New:
                _container.SetElement(new SCCMTabNew());
                break;

            case SCCMTab.Search:
                _container.SetElement(new SCCMTabSearch());
                break;

            default:
                SAMLog.Error("SCCMP::EnumSwitch_ST", "tab: " + tab);
                break;
            }
        }
Ejemplo n.º 5
0
        public void Recreate(ILeveleditorStub selection)
        {
            ClearChildren();
            if (selection == null)
            {
                IsVisible = false;
                return;
            }

            IsVisible = true;

            int i = 0;

            foreach (var opt in selection.AttrOptions)
            {
                AddElement(new AttributeButton
                {
                    RelativePosition = new FPoint(32 + i * (128 + 64), 32),
                    Size             = new FSize(128, 128),
                    Alignment        = HUDAlignment.BOTTOMLEFT,

                    Data = opt,
                });
                i++;
            }

            AddElement(new HUDTextButton
            {
                RelativePosition = new FPoint(32, 32),
                Size             = new FSize(192, 64),
                Alignment        = HUDAlignment.BOTTOMRIGHT,

                L10NText      = L10NImpl.STR_LVLED_BTN_DEL,
                TextColor     = Color.White,
                Font          = Textures.HUDFontRegular,
                FontSize      = 48,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                Click = DeleteSelected,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Pomegranate, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Alizarin, Color.Black, HUD.PixelWidth),
            });
        }
Ejemplo n.º 6
0
        public override void OnInitialize()
        {
            AddElement(new HUDTextButton
            {
                RelativePosition = new FPoint(5, 5),
                Size             = new FSize(192, 32),
                Alignment        = HUDAlignment.TOPRIGHT,

                L10NText      = L10NImpl.STR_LVLED_BTN_PLAY,
                TextColor     = Color.White,
                Font          = Textures.HUDFontRegular,
                FontSize      = 28,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                Click = OnPlay,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth),
            });
        }
Ejemplo n.º 7
0
        public override void OnInitialize()
        {
            RelativePosition = HUD.UnsafeTopRight;
            Size             = new FSize(WIDTH + HUD.SafetyMargins.MarginRight, HUD.RealHeight);
            Alignment        = HUDAlignment.TOPRIGHT;

            AddElement(BtnMouse = new HUDTextButton(1)
            {
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(24, 16 + 75 * 0),
                Size             = new FSize((WIDTH - 2 * 24), 64),

                L10NText      = L10NImpl.STR_LVLED_MOUSE,
                TextColor     = Color.White,
                Font          = Textures.HUDFontRegular,
                FontSize      = 48,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth),

                Click = SetModeMouse,
            });

            AddElement(BtnCannon = new HUDTextButton(1)
            {
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(24, 16 + 75 * 1),
                Size             = new FSize((WIDTH - 2 * 24), 64),

                L10NText      = L10NImpl.STR_LVLED_CANNON,
                TextColor     = Color.White,
                Font          = Textures.HUDFontRegular,
                FontSize      = 48,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth),

                Click = SetModeCannon,
            });

            AddElement(BtnWall = new HUDTextButton(1)
            {
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(24, 16 + 75 * 2),
                Size             = new FSize((WIDTH - 2 * 24), 64),

                L10NText      = L10NImpl.STR_LVLED_WALL,
                TextColor     = Color.White,
                Font          = Textures.HUDFontRegular,
                FontSize      = 48,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth),

                Click = SetModeWall,
            });

            AddElement(BtnObstacle = new HUDTextButton(1)
            {
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(24, 16 + 75 * 3),
                Size             = new FSize((WIDTH - 2 * 24), 64),

                L10NText      = L10NImpl.STR_LVLED_OBSTACLE,
                TextColor     = Color.White,
                Font          = Textures.HUDFontRegular,
                FontSize      = 48,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth),

                Click = SetModeObstacle,
            });

            AddElement(BtnPortal = new HUDTextButton(1)
            {
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(24, 16 + 75 * 4),
                Size             = new FSize((WIDTH - 2 * 24), 64),

                L10NText      = L10NImpl.STR_LVLED_PORTAL,
                TextColor     = Color.White,
                Font          = Textures.HUDFontRegular,
                FontSize      = 48,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth),

                Click = SetModePortal,
            });

            AddElement(BtnSettings = new HUDTextButton(1)
            {
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(24, 16 + 75 * 5.5f),
                Size             = new FSize((WIDTH - 2 * 24), 64),

                L10NText      = L10NImpl.STR_LVLED_SETTINGS,
                TextColor     = Color.White,
                Font          = Textures.HUDFontRegular,
                FontSize      = 48,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth),

                Click = (o, e) => GDScreen.ShowSettings(),
            });

            AddElement(BtnPlay = new HUDTextButton(1)
            {
                Alignment        = HUDAlignment.BOTTOMLEFT,
                RelativePosition = new FPoint(24, 16 + 75 * 4),
                Size             = new FSize((WIDTH - 2 * 24), 64),

                L10NText      = L10NImpl.STR_LVLED_PLAY,
                TextColor     = Color.White,
                Font          = Textures.HUDFontRegular,
                FontSize      = 48,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Orange, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.SunFlower, Color.Black, HUD.PixelWidth),

                Click = (o, e) => GDScreen.DoPlayTest(),
            });

            AddElement(BtnTest = new HUDTextButton(1)
            {
                Alignment        = HUDAlignment.BOTTOMLEFT,
                RelativePosition = new FPoint(24, 16 + 75 * 3),
                Size             = new FSize((WIDTH - 2 * 24), 64),

                L10NText      = L10NImpl.STR_LVLED_UPLOAD,
                TextColor     = Color.White,
                Font          = Textures.HUDFontRegular,
                FontSize      = 48,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Nephritis, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Emerald, Color.Black, HUD.PixelWidth),

                Click = (o, e) => GDScreen.TryUpload(),
            });

            AddElement(BtnDelete = new HUDTextButton(1)
            {
                Alignment        = HUDAlignment.BOTTOMRIGHT,
                RelativePosition = new FPoint(24 + HUD.SafetyMargins.MarginRight, 16 + 75 * 1),
                Size             = new FSize((WIDTH - 3 * 24), 64),

                L10NText      = L10NImpl.STR_LVLED_BTN_DEL,
                TextColor     = Color.White,
                Font          = Textures.HUDFontRegular,
                FontSize      = 48,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Pomegranate, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Alizarin, Color.Black, HUD.PixelWidth),

                Click = (o, e) => GDScreen.DeleteLevel(),
            });

            AddElement(BtnExit = new HUDTextButton(1)
            {
                Alignment        = HUDAlignment.BOTTOMRIGHT,
                RelativePosition = new FPoint(24 + HUD.SafetyMargins.MarginRight, 16 + 75 * 0),
                Size             = new FSize((WIDTH - 3 * 24), 64),

                L10NText      = L10NImpl.STR_LVLED_EXIT,
                TextColor     = FlatColors.Foreground,
                Font          = Textures.HUDFontRegular,
                FontSize      = 48,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Clouds, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Silver, Color.Black, HUD.PixelWidth),

                Click = (o, e) => GDScreen.ExitEditor(),
            });

            Buttons.Add(Tuple.Create(BtnMouse, BtnMouse.BackgroundNormal, BtnMouse.BackgroundPressed));
            Buttons.Add(Tuple.Create(BtnCannon, BtnCannon.BackgroundNormal, BtnCannon.BackgroundPressed));
            Buttons.Add(Tuple.Create(BtnWall, BtnWall.BackgroundNormal, BtnWall.BackgroundPressed));
            Buttons.Add(Tuple.Create(BtnObstacle, BtnObstacle.BackgroundNormal, BtnObstacle.BackgroundPressed));
            Buttons.Add(Tuple.Create(BtnPortal, BtnObstacle.BackgroundNormal, BtnObstacle.BackgroundPressed));
            Buttons.Add(Tuple.Create(BtnSettings, BtnSettings.BackgroundNormal, BtnSettings.BackgroundPressed));
            Buttons.Add(Tuple.Create(BtnPlay, BtnPlay.BackgroundNormal, BtnPlay.BackgroundPressed));
            Buttons.Add(Tuple.Create(BtnTest, BtnTest.BackgroundNormal, BtnTest.BackgroundPressed));
            Buttons.Add(Tuple.Create(BtnExit, BtnExit.BackgroundNormal, BtnExit.BackgroundPressed));

            SetActiveButton(BtnMouse);
        }
Ejemplo n.º 8
0
        public override void OnInitialize()
        {
            RelativePosition = new FPoint(GDConstants.TILE_WIDTH, 0);
            Size             = new FSize(HUD.Width - 6 * GDConstants.TILE_WIDTH, HUD.Height - 2 * GDConstants.TILE_WIDTH);
            Alignment        = HUDAlignment.CENTERLEFT;

            AddElement(new HUDLabel(1)
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(32, 32 + (96 * 0)),
                Size             = new FSize(384, 64),

                Font     = Textures.HUDFontBold,
                FontSize = 64,

                L10NText  = L10NImpl.STR_LVLED_CFG_ID,
                TextColor = FlatColors.Clouds,
            });

            AddElement(_ctrlID = new HUDLabel(1)
            {
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(416, 32 + (96 * 0)),
                Size             = new FSize(512, 64),

                Text          = "000000000000",
                TextColor     = Color.Black,
                Font          = Textures.HUDFontRegular,
                FontSize      = 48,
                TextAlignment = HUDAlignment.CENTER,

                Background = HUDBackgroundDefinition.CreateSimpleOutline(Color.White, Color.Black, HUD.PixelWidth),
            });

            AddElement(new HUDLabel(1)
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(32, 32 + (96 * 1)),
                Size             = new FSize(384, 64),

                Font     = Textures.HUDFontBold,
                FontSize = 64,

                L10NText  = L10NImpl.STR_LVLED_CFG_NAME,
                TextColor = FlatColors.Clouds,
            });

            AddElement(_ctrlName = new HUDSimpleTextBox(1)
            {
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(416, 32 + (96 * 1)),
                Size             = new FSize(512, 64),

                ColorText = Color.Black,
                Font      = Textures.HUDFontRegular,
                FontSize  = 48,

                MaxLength = SCCMLevelData.MaxNameLength,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(Color.White, Color.Black, HUD.PixelWidth),
                BackgroundFocused = HUDBackgroundDefinition.CreateSimpleOutline(Color.White, Color.Black, HUD.PixelWidth),

                Changed = UpdateText,
            });

            AddElement(new HUDLabel(1)
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(32, 32 + (96 * 2)),
                Size             = new FSize(384, 64),

                Font     = Textures.HUDFontBold,
                FontSize = 64,

                L10NText  = L10NImpl.STR_LVLED_CFG_SIZE,
                TextColor = FlatColors.Clouds,
            });

            AddElement(_ctrlSize = new HUDTextButton(1)
            {
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(416, 32 + (96 * 2)),
                Size             = new FSize(512, 64),

                TextColor     = Color.White,
                Font          = Textures.HUDFontRegular,
                FontSize      = 48,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth),

                Click = ToggleSize,
            });

            AddElement(new HUDLabel(1)
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(32, 32 + (96 * 3)),
                Size             = new FSize(384, 64),

                Font     = Textures.HUDFontBold,
                FontSize = 64,

                L10NText  = L10NImpl.STR_LVLED_CFG_VIEW,
                TextColor = FlatColors.Clouds,
            });

            AddElement(_ctrlView = new HUDTextButton(1)
            {
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(416, 32 + (96 * 3)),
                Size             = new FSize(512, 64),

                TextColor     = Color.White,
                Font          = Textures.HUDFontRegular,
                FontSize      = 48,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth),

                Click = ToggleView,
            });

            AddElement(new HUDLabel(1)
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(32, 32 + (96 * 4)),
                Size             = new FSize(384, 64),

                Font     = Textures.HUDFontBold,
                FontSize = 64,

                L10NText  = L10NImpl.STR_LVLED_CFG_GEOMETRY,
                TextColor = FlatColors.Clouds,
            });

            AddElement(_ctrlGeometry = new HUDTextButton(1)
            {
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(416, 32 + (96 * 4)),
                Size             = new FSize(512, 64),

                TextColor     = Color.White,
                Font          = Textures.HUDFontRegular,
                FontSize      = 48,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth),

                Click = ToggleGeometry,
            });

            AddElement(new HUDLabel(1)
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(32, 32 + (96 * 5)),
                Size             = new FSize(384, 64),

                Font     = Textures.HUDFontBold,
                FontSize = 64,

                L10NText  = L10NImpl.STR_LVLED_CFG_MUSIC,
                TextColor = FlatColors.Clouds,
            });

            AddElement(_ctrlMusic = new HUDTextButton(1)
            {
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(416, 32 + (96 * 5)),
                Size             = new FSize(512, 64),

                TextColor     = Color.White,
                Font          = Textures.HUDFontRegular,
                FontSize      = 48,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth),

                Click = ToggleMusic,
            });

            //------

            AddElement(new HUDTextButton(1)
            {
                Alignment        = HUDAlignment.BOTTOMRIGHT,
                RelativePosition = new FPoint(24 + 384 + 24, 16 + 75 * 0),
                Size             = new FSize(384, 64),

                L10NText      = L10NImpl.STR_MENU_CANCEL,
                TextColor     = Color.White,
                Font          = Textures.HUDFontRegular,
                FontSize      = 48,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Pomegranate, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Alizarin, Color.Black, HUD.PixelWidth),

                Click = Abort,
            });

            AddElement(new HUDTextButton(1)
            {
                Alignment        = HUDAlignment.BOTTOMRIGHT,
                RelativePosition = new FPoint(24, 16 + 75 * 0),
                Size             = new FSize(384, 64),

                L10NText      = L10NImpl.STR_BTN_OK,
                TextColor     = Color.White,
                Font          = Textures.HUDFontRegular,
                FontSize      = 48,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Emerald, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Nephritis, Color.Black, HUD.PixelWidth),

                Click = Close,
            });

            RefreshControls();
        }
Ejemplo n.º 9
0
        public override void OnInitialize()
        {
            base.OnInitialize();

            AddElement(new HUDLabel(1)
            {
                TextAlignment    = HUDAlignment.CENTER,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(0, 0),
                Size             = new FSize(WIDTH, 96),

                Font     = Textures.HUDFontBold,
                FontSize = 64,

                L10NText  = L10NImpl.STR_UNLOCK,
                TextColor = FlatColors.Clouds,
            });

            var gridDisplay = new HUDFixedUniformGrid
            {
                Alignment        = HUDAlignment.TOPCENTER,
                RelativePosition = new FPoint(0, 96),
                GridWidth        = 8,
                GridHeight       = 1,
                ColumnWidth      = 64,
                RowHeight        = 64,
                Padding          = 10,
            };

            AddElement(gridDisplay);

            for (int i = 0; i < 8; i++)
            {
                CharDisp[i] = new HUDCharacterControl(1)
                {
                    Background = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Clouds, Color.Black, 4f),

                    TextPadding = 2,
                    TextColor   = Color.Black
                };

                gridDisplay.AddElement(i, 0, CharDisp[i]);
            }

            var pad = new HUDKeypad(3, 4, 64, 24)
            {
                Alignment        = HUDAlignment.CENTER,
                RelativePosition = new FPoint(0, 176 / 2f),

                ButtonTextAlignment = HUDAlignment.CENTER,

                ButtonFont     = Textures.HUDFontBold,
                ButtonFontSize = 48,

                ButtonTextColor = FlatColors.Foreground,

                ButtonBackgroundNormal  = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.ControlHighlight, 4f),
                ButtonBackgroundPressed = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Background, 4f),
            };

            AddElement(pad);

            pad.AddKey('1', 0, 0);
            pad.AddKey('2', 1, 0);
            pad.AddKey('3', 2, 0);

            pad.AddKey('4', 0, 1);
            pad.AddKey('5', 1, 1);
            pad.AddKey('6', 2, 1);

            pad.AddKey('7', 0, 2);
            pad.AddKey('8', 1, 2);
            pad.AddKey('9', 2, 2);

            pad.AddKey('#', 0, 3);
            pad.AddKey('0', 1, 3);
            pad.AddKey('*', 2, 3);

            pad.PadClick += DoClick;
        }
Ejemplo n.º 10
0
        public override void OnInitialize()
        {
            AddElement(_textbox = new HUDSimpleTextBox
            {
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(16, 16),
                Size             = new FSize(Width - 16 - 16 - 64, 64),

                ColorText = Color.Black,
                Font      = Textures.HUDFontRegular,
                FontSize  = 48,

                MaxLength = SCCMLevelData.MaxNameLength,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Clouds, Color.Black, HUD.PixelWidth),
                BackgroundFocused = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Clouds, Color.Black, HUD.PixelWidth),

                EnterKey = (s, e) => StartSearch(),

                CloseKeyboard = (s, e) => StartSearch(),
            });

            AddElement(new HUDImageButton
            {
                Alignment        = HUDAlignment.TOPRIGHT,
                RelativePosition = new FPoint(16 + HUD.PixelWidth, 16),
                Size             = new FSize(64, 64),

                Image        = Textures.TexHUDButtonIconMagnifier,
                ImagePadding = 8,
                ImageColor   = FlatColors.Asbestos,

                BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Clouds, Color.Black, HUD.PixelWidth),
                BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Concrete, Color.Black, HUD.PixelWidth),

                Click = (s, e) => StartSearch(),
            });

            AddElement(_presenter = new SCCMListPresenter
            {
                Alignment        = HUDAlignment.BOTTOMLEFT,
                RelativePosition = new FPoint(16, 16),
                Size             = new FSize(Width - 16 - 16 - 48 - 16, Height - 16 - 16 - 16 - 64),

                IsVisible = true,
            });

            AddElement(_scrollbar = new SCCMListScrollbar
            {
                Alignment        = HUDAlignment.BOTTOMRIGHT,
                RelativePosition = new FPoint(16, 16),
                Size             = new FSize(48, Height - 16 - 16 - 16 - 64),

                IsVisible = true,
            });

            AddElement(_waitingCog = new HUDImage
            {
                Alignment        = HUDAlignment.CENTER,
                RelativePosition = new FPoint(0, 16 + 32),
                Image            = Textures.CannonCogBig,
                RotationSpeed    = 0.35f,
                Color            = FlatColors.Clouds,
                Size             = new FSize(192, 192),

                IsVisible = false,
            });

            _presenter.Load(QueryData, _scrollbar, _waitingCog);
        }
        public override void OnInitialize()
        {
            base.OnInitialize();

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTER,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(0, 0),
                Size             = new FSize(WIDTH, 100),

                Font     = Textures.HUDFontBold,
                FontSize = 64,

                L10NText  = L10NImpl.STR_MENU_CAP_LOBBY,
                TextColor = FlatColors.Clouds,
            });

            AddElement(new MultiplayerConnectionStateControl(_server)
            {
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(16, 16)
            });

            if (_server.ConnType == MultiplayerConnectionType.PROXY)
            {
                var gridDisplay = new HUDFixedUniformGrid
                {
                    Alignment        = HUDAlignment.TOPCENTER,
                    RelativePosition = new FPoint(0, 100),
                    GridWidth        = 8,
                    GridHeight       = 1,
                    ColumnWidth      = 84,
                    RowHeight        = 84,
                    Padding          = 16,
                };
                AddElement(gridDisplay);

                for (int i = 0; i < 8; i++)
                {
                    CharDisp[i] = new HUDCharacterControl(1)
                    {
                        Background = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Clouds, Color.Black, 4f),

                        TextPadding = 2,
                        TextColor   = Color.Black
                    };

                    gridDisplay.AddElement(i, 0, CharDisp[i]);
                }

                var scode = KiddieCryptography.SpiralHexEncode(_server.SessionID, _server.SessionSecret);
                for (int i = 0; i < 8; i++)
                {
                    if (i < scode.Length)
                    {
                        CharDisp[i].Character = scode[i];
                    }
                }

                AddOperation(new CharacterControlWaveOperation(CharDisp));

                AddElement(new HUDLabel
                {
                    TextAlignment    = HUDAlignment.BOTTOMRIGHT,
                    Alignment        = HUDAlignment.BOTTOMRIGHT,
                    RelativePosition = new FPoint(16, FOOTER_HEIGHT + 16),
                    Size             = new FSize(320, 128),
                    MaxWidth         = 320,
                    WordWrap         = HUDWordWrap.WrapByWordTrusted,

                    Font     = Textures.HUDFontRegular,
                    FontSize = 32,

                    L10NText  = L10NImpl.STR_MENU_MP_LOBBYINFO,
                    TextColor = ColorMath.Blend(FlatColors.Clouds, FlatColors.Background, 0.5f),
                });
            }

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(INFO_C1_LEFT, 208 + 0 * 32),
                Size             = new FSize(INFO_C1_WIDTH, 32),
                Font             = Textures.HUDFontRegular,
                FontSize         = 32,
                L10NText         = L10NImpl.STR_MENU_MP_LOBBY_PING,
                TextColor        = FlatColors.Clouds,
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(INFO_C1_LEFT, 208 + 1 * 32),
                Size             = new FSize(INFO_C1_WIDTH, 32),
                Font             = Textures.HUDFontRegular,
                FontSize         = 32,
                L10NText         = L10NImpl.STR_MENU_MP_LOBBY_USER,
                TextColor        = FlatColors.Clouds,
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(INFO_C1_LEFT, 208 + 2 * 32),
                Size             = new FSize(INFO_C1_WIDTH, 32),
                Font             = Textures.HUDFontRegular,
                FontSize         = 32,
                L10NText         = L10NImpl.STR_MENU_MP_LOBBY_LEVEL,
                TextColor        = FlatColors.Clouds,
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(INFO_C1_LEFT, 208 + 3 * 32),
                Size             = new FSize(INFO_C1_WIDTH, 32),
                Font             = Textures.HUDFontRegular,
                FontSize         = 32,
                L10NText         = L10NImpl.STR_MENU_MP_LOBBY_MUSIC,
                TextColor        = FlatColors.Clouds,
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(INFO_C1_LEFT, 208 + 4 * 32),
                Size             = new FSize(INFO_C1_WIDTH, 32),
                Font             = Textures.HUDFontRegular,
                FontSize         = 32,
                L10NText         = L10NImpl.STR_MENU_MP_LOBBY_SPEED,
                TextColor        = FlatColors.Clouds,
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(INFO_C1_LEFT, 208 + 5 * 32),
                Size             = new FSize(INFO_C1_WIDTH, 32),
                Font             = Textures.HUDFontRegular,
                FontSize         = 32,
                L10NText         = L10NImpl.STR_MENU_MP_LOBBY_COLOR,
                TextColor        = FlatColors.Clouds,
            });



            AddElement(new HUDLambdaLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(INFO_C2_LEFT, 208 + 0 * 32),
                Size             = new FSize(INFO_C2_WIDTH, 32),
                MaxWidth         = INFO_C2_WIDTH,
                Font             = Textures.HUDFontRegular,
                FontSize         = 32,
                Lambda           = () => $"{(int)(_server.ProxyPing.Value * 1000)}ms",
                WordWrap         = HUDWordWrap.Ellipsis,
                TextColor        = FlatColors.Clouds,
            });

            AddElement(new HUDLambdaLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(INFO_C2_LEFT, 208 + 1 * 32),
                Size             = new FSize(INFO_C2_WIDTH, 32),
                MaxWidth         = INFO_C2_WIDTH,
                Font             = Textures.HUDFontRegular,
                FontSize         = 32,
                Lambda           = () => $"{_server.SessionCount} / {_server.SessionCapacity}",
                WordWrap         = HUDWordWrap.Ellipsis,
                TextColor        = FlatColors.Clouds,
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(INFO_C2_LEFT, 208 + 2 * 32),
                Size             = new FSize(INFO_C2_WIDTH, 32),
                MaxWidth         = INFO_C2_WIDTH,
                Font             = Textures.HUDFontRegular,
                FontSize         = 32,
                Text             = Levels.LEVELS[_server.LevelID].FullName,
                WordWrap         = HUDWordWrap.Ellipsis,
                TextColor        = FlatColors.Clouds,
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(INFO_C2_LEFT, 208 + 3 * 32),
                Size             = new FSize(INFO_C2_WIDTH, 32),
                MaxWidth         = INFO_C2_WIDTH,
                Font             = Textures.HUDFontRegular,
                FontSize         = 32,
                Text             = (_server.MusicIndex + 1).ToString(),
                WordWrap         = HUDWordWrap.Ellipsis,
                TextColor        = FlatColors.Clouds,
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(INFO_C2_LEFT, 208 + 4 * 32),
                Size             = new FSize(INFO_C2_WIDTH, 32),
                MaxWidth         = INFO_C2_WIDTH,
                Font             = Textures.HUDFontRegular,
                FontSize         = 32,
                Text             = Fmt(_server.Speed),
                WordWrap         = HUDWordWrap.Ellipsis,
                TextColor        = FlatColors.Clouds,
            });

            AddElement(new HUDLabel
            {
                TextAlignment    = HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPLEFT,
                RelativePosition = new FPoint(INFO_C2_LEFT, 208 + 5 * 32),
                Size             = new FSize(INFO_C2_WIDTH, 32),
                MaxWidth         = INFO_C2_WIDTH,
                Font             = Textures.HUDFontRegular,
                FontSize         = 32,
                L10NText         = Fraction.NAME_PLAYER,
                WordWrap         = HUDWordWrap.Ellipsis,
                TextColor        = Fraction.COLOR_PLAYER,
            });



            AddElement(new HUDRectangle(0)
            {
                Alignment = HUDAlignment.BOTTOMRIGHT,
                Size      = new FSize(WIDTH, FOOTER_HEIGHT),

                Definition = HUDBackgroundDefinition.CreateRounded(FlatColors.BackgroundHUD2, 16, false, false, true, true),
            });

            AddElement(new HUDTextButton(2)
            {
                Alignment        = HUDAlignment.BOTTOMLEFT,
                RelativePosition = new FPoint(0.5f * GDConstants.TILE_WIDTH, 0.5f * GDConstants.TILE_WIDTH),
                Size             = new FSize(6.5f * GDConstants.TILE_WIDTH, 1.0f * GDConstants.TILE_WIDTH),

                L10NText      = L10NImpl.STR_MENU_DISCONNECT,
                TextColor     = Color.White,
                Font          = Textures.HUDFontBold,
                FontSize      = 55,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                BackgroundNormal  = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Asbestos, 16),
                BackgroundPressed = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.MidnightBlue, 16),

                Click = OnClickCancel,
            });

            AddElement(_btnStart = new HUDTextButton(2)
            {
                Alignment        = HUDAlignment.BOTTOMRIGHT,
                RelativePosition = new FPoint(0.5f * GDConstants.TILE_WIDTH, 0.5f * GDConstants.TILE_WIDTH),
                Size             = new FSize(5.5f * GDConstants.TILE_WIDTH, 1.0f * GDConstants.TILE_WIDTH),

                L10NText      = L10NImpl.STR_MENU_MP_START,
                TextColor     = Color.White,
                Font          = Textures.HUDFontBold,
                FontSize      = 55,
                TextAlignment = HUDAlignment.CENTER,
                TextPadding   = 8,

                BackgroundNormal  = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Emerald, 16),
                BackgroundPressed = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Nephritis, 16),

                IsVisible = false,

                Click = OnClickStart,
            });
        }