Beispiel #1
0
        private void OnClickFinishPrev(HUDTextButton sender, HUDButtonEventArgs args)
        {
            if (UnlockManager.IsUnlocked(Levels.WORLD_001, false) != WorldUnlockState.OpenAndUnlocked)
            {
                MainGame.Inst.SetTutorialLevelScreen();
                return;
            }

            if (UnlockManager.IsUnlocked(Levels.WORLD_002, false) != WorldUnlockState.OpenAndUnlocked)
            {
                MainGame.Inst.SetWorldMapScreenZoomedOut(Levels.WORLD_001);
                return;
            }

            if (UnlockManager.IsUnlocked(Levels.WORLD_003, false) != WorldUnlockState.OpenAndUnlocked)
            {
                MainGame.Inst.SetWorldMapScreenZoomedOut(Levels.WORLD_002);
                return;
            }

            if (UnlockManager.IsUnlocked(Levels.WORLD_004, false) != WorldUnlockState.OpenAndUnlocked)
            {
                MainGame.Inst.SetWorldMapScreenZoomedOut(Levels.WORLD_003);
                return;
            }

            MainGame.Inst.SetWorldMapScreenZoomedOut(Levels.WORLD_004);
        }
        private void OnClickUnlock(HUDTextButton sender, HUDButtonEventArgs e)
        {
            try
            {
                var r = MainGame.Inst.GDBridge.IAB.StartPurchase(GDConstants.IAB_MULTIPLAYER);
                switch (r)
                {
                case PurchaseResult.ProductNotFound:
                    SAMLog.Error("MMP::IAB-PNF", "Product not found", "_iabCode -> " + GDConstants.IAB_MULTIPLAYER);
                    Owner.HUD.ShowToast("MMP:ERR1", L10N.T(L10NImpl.STR_IAB_BUYERR), 40, FlatColors.Pomegranate, FlatColors.Foreground, 2.5f);
                    break;

                case PurchaseResult.NotConnected:
                    Owner.HUD.ShowToast("MMP:ERR2", L10N.T(L10NImpl.STR_IAB_BUYNOCONN), 40, FlatColors.Orange, FlatColors.Foreground, 2.5f);
                    break;

                case PurchaseResult.CurrentlyInitializing:
                    Owner.HUD.ShowToast("MMP:ERR3", L10N.T(L10NImpl.STR_IAB_BUYNOTREADY), 40, FlatColors.Orange, FlatColors.Foreground, 2.5f);
                    break;

                case PurchaseResult.PurchaseStarted:
                    SAMLog.Info("MMP::IAB-BUY", "PurchaseStarted");
                    break;

                default:
                    SAMLog.Error("MMP::EnumSwitch_OCU", "OnClickBuy()", "r -> " + r);
                    break;
                }
            }
            catch (Exception ex)
            {
                SAMLog.Error("MMP::IAB_CALL", ex);
            }
        }
        private void OnCreateAccount(HUDTextButton sender, HUDButtonEventArgs e)
        {
            if (editUsername.Text == "" || editPassword.Text == "")
            {
                return;
            }

            if (MainGame.Inst.Profile.AccountType != AccountType.Anonymous)
            {
                return;
            }

            var waitDialog = new HUDIconMessageBox
            {
                L10NText   = L10NImpl.STR_AAP_ACCCREATING,
                TextColor  = FlatColors.TextHUD,
                Background = HUDBackgroundDefinition.CreateRounded(FlatColors.BelizeHole, 16),

                IconColor     = FlatColors.Clouds,
                Icon          = Textures.CannonCog,
                RotationSpeed = 1f,

                CloseOnClick = false,
            };

            HUD.AddModal(waitDialog, false, 0.7f);

            DoSignup(waitDialog, editUsername.Text, editPassword.Text).RunAsync();
        }
Beispiel #4
0
        private void OnChangePassword(HUDTextButton sender, HUDButtonEventArgs e)
        {
            if (editPassword.Text == "")
            {
                editPassword.AddHUDOperation(new HUDTextBoxBlinkOperation(Color.Red));
                return;
            }

            if (MainGame.Inst.Profile.AccountType != AccountType.Full)
            {
                return;
            }

            var waitDialog = new HUDIconMessageBox
            {
                L10NText   = L10NImpl.STR_CPP_CHANGING,
                TextColor  = FlatColors.TextHUD,
                Background = HUDBackgroundDefinition.CreateRounded(FlatColors.BelizeHole, 16),

                IconColor     = FlatColors.Clouds,
                Icon          = Textures.CannonCogBig,
                RotationSpeed = 1f,

                CloseOnClick = false,
            };

            HUD.AddModal(waitDialog, false, 0.7f);

            DoChangePassword(waitDialog, editPassword.Text).RunAsync();
        }
Beispiel #5
0
        private void CreateNewUserLevel(HUDTextButton sender, HUDButtonEventArgs e)
        {
            if (MainGame.Inst.Profile.AccountType == AccountType.Local)
            {
                CreateUserAndShowAnonPanel().EnsureNoError();
                return;
            }
            else if (MainGame.Inst.Profile.AccountType == AccountType.Anonymous)
            {
                ShowAnonPanel();
                HUD.ShowToast(null, L10N.T(L10NImpl.STR_SCCM_NEEDS_ACC), 40, FlatColors.Orange, FlatColors.Foreground, 2f);
                return;
            }

            var waitDialog = new HUDIconMessageBox
            {
                L10NText   = L10NImpl.STR_GENERIC_SERVER_QUERY,
                TextColor  = FlatColors.TextHUD,
                Background = HUDBackgroundDefinition.CreateRounded(FlatColors.BelizeHole, 16),

                IconColor     = FlatColors.Clouds,
                Icon          = Textures.CannonCogBig,
                RotationSpeed = 1f,

                CloseOnClick = false,
            };

            HUD.AddModal(waitDialog, false, 0.7f);

            CreateNewUserLevelInternal(waitDialog).RunAsync();
        }
Beispiel #6
0
        private void ToggleView(HUDTextButton sender, HUDButtonEventArgs e)
        {
            if (_size == SCCMLevelData.SIZES[0])
            {
                _view = FlatAlign9.CC;
            }
            else
            {
                switch (_view)
                {
                case FlatAlign9.TOP:         _view = FlatAlign9.TOPRIGHT;    break;

                case FlatAlign9.TOPRIGHT:    _view = FlatAlign9.RIGHT;       break;

                case FlatAlign9.RIGHT:       _view = FlatAlign9.BOTTOMRIGHT; break;

                case FlatAlign9.BOTTOMRIGHT: _view = FlatAlign9.BOTTOM;      break;

                case FlatAlign9.BOTTOM:      _view = FlatAlign9.BOTTOMLEFT;  break;

                case FlatAlign9.BOTTOMLEFT:  _view = FlatAlign9.LEFT;        break;

                case FlatAlign9.LEFT:        _view = FlatAlign9.TOPLEFT;     break;

                case FlatAlign9.TOPLEFT:     _view = FlatAlign9.CENTER;      break;

                case FlatAlign9.CENTER:      _view = FlatAlign9.TOP;         break;

                default:                     _view = FlatAlign9.CENTER;      break;
                }
            }

            RefreshControls();
        }
Beispiel #7
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(_btnPlay = 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),
            });
        }
        private void OnLogin(HUDTextButton sender, HUDButtonEventArgs e)
        {
            if (editUsername.Text == "")
            {
                editUsername.AddOperation(new HUDTextBoxBlinkOperation(Color.Red));
                return;
            }

            if (editPassword.Text == "")
            {
                editPassword.AddOperation(new HUDTextBoxBlinkOperation(Color.Red));
                return;
            }

            var waitDialog = new HUDIconMessageBox
            {
                L10NText   = L10NImpl.STR_AAP_LOGGINGIN,
                TextColor  = FlatColors.TextHUD,
                Background = HUDBackgroundDefinition.CreateRounded(FlatColors.BelizeHole, 16),

                IconColor     = FlatColors.Clouds,
                Icon          = Textures.CannonCogBig,
                RotationSpeed = 1f,

                CloseOnClick = false,
            };

            HUD.AddModal(waitDialog, false, 0.7f);

            DoLogin(waitDialog, editUsername.Text, editPassword.Text).RunAsync();
        }
 private void OnClickStart(HUDTextButton sender, HUDButtonEventArgs e)
 {
     if (_server.Mode == SAMNetworkConnection.ServerMode.InLobby && _server.SessionCount == _server.SessionCapacity)
     {
         byte[] binData = _server.GetLobbySyncData();
         _server.StartLobbySync(binData);
     }
 }
 private void DeleteSelected(HUDTextButton sender, HUDButtonEventArgs e)
 {
     if (GDScreen.Selection is GameEntity ge)
     {
         ge.Alive = false;
         GDScreen.SelectStub(null);
     }
 }
Beispiel #11
0
        private void OnCancel(HUDTextButton sender, HUDButtonEventArgs e)
        {
            MainGame.Inst.Profile.BackupOnlineUsername    = "";
            MainGame.Inst.Profile.UnacknowledgedAuthError = false;
            MainGame.Inst.SaveProfile();

            Remove();
        }
Beispiel #12
0
        private void DoSave(HUDTextButton sender, HUDButtonEventArgs e)
        {
            var ret = GDScreen.LevelData.UpdateAndSave(GDScreen);

            if (ret)
            {
                MainGame.Inst.SetOverworldScreenWithSCCM(SCCMMainPanel.SCCMTab.MyLevels);
            }
        }
        private void OnClickYes(HUDTextButton sender, HUDButtonEventArgs e)
        {
            MainGame.Inst.Profile.AccountReminderShown = true;
            MainGame.Inst.SaveProfile();

            Remove();

            ((ISettingsOwnerHUD)Owner.HUD).ShowAccountPanel();
        }
Beispiel #14
0
        private void ToggleSize(HUDTextButton sender, HUDButtonEventArgs e)
        {
            _size = SCCMLevelData.SIZES[(SCCMLevelData.SIZES.IndexOf(_size) + 1) % SCCMLevelData.SIZES.Length];
            if (_size == SCCMLevelData.SIZES[0])
            {
                _view = FlatAlign9.CC;
            }

            RefreshControls();
        }
        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_ATTRIBUTIONS,
                TextColor = FlatColors.Clouds,
            });

            for (int i = 0; i < Attributions.LINK_BACK.Length; i++)
            {
                var dd = Attributions.LINK_BACK[i];

                var btn = new HUDTextButton(1)
                {
                    TextAlignment    = HUDAlignment.CENTERLEFT,
                    Alignment        = HUDAlignment.TOPCENTER,
                    RelativePosition = new FPoint(((i % 2) * 2 - 1) * LINE_OFFSET, 96 + (i / 2) * 48),
                    Size             = new FSize(LINE_WIDTH, 32),

                    Font     = Textures.HUDFontRegular,
                    FontSize = 24,

                    Text = dd.Item1,

                    TextColor   = FlatColors.Foreground,
                    TextPadding = 16,

                    BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleBlur(FlatColors.TextHUD, 16),
                    BackgroundPressed = HUDBackgroundDefinition.CreateSimpleBlur(FlatColors.ControlHighlight, 16),

                    ClickMode = HUDButton.HUDButtonClickMode.Single,
                };

                if (!string.IsNullOrWhiteSpace(dd.Item2))
                {
                    btn.ButtonClick += (s, a) =>
                    {
                        HUD.ShowToast(null, dd.Item2, 32, FlatColors.Silver, FlatColors.Foreground, 3f);
                        MainGame.Inst.GDBridge.OpenURL(dd.Item2);
                    };
                }

                AddElement(btn);
            }
        }
Beispiel #16
0
        private void OnClickFinishPrev(HUDTextButton sender, HUDButtonEventArgs args)
        {
            if (_unlockWorldNumber == 0)
            {
                MainGame.Inst.SetTutorialLevelScreen();
                return;
            }

            int missPoints = UnlockManager.PointsForUnlock(_id) - MainGame.Inst.Profile.TotalPoints;

            HUD.ShowToast("WPP::HINT", L10N.TF(L10NImpl.STR_PREV_MISS_TOAST, missPoints, _worldNumber), 32, FlatColors.Orange, FlatColors.Foreground, 4f);

            MainGame.Inst.SetWorldMapScreenZoomedOut(Levels.WORLDS_BY_NUMBER[_unlockWorldNumber]);
        }
Beispiel #17
0
        private void OnLogout(HUDTextButton sender, HUDButtonEventArgs e)
        {
            var delta = MonoSAMGame.CurrentTime.TotalElapsedSeconds - _lastClickLogout;

            if (delta > 5f)
            {
                _logOutCounter = 0;
            }

            if (_logOutCounter == 0)
            {
                HUD.ShowToast(null, L10N.T(L10NImpl.STR_FAP_WARN1), 40, FlatColors.Flamingo, FlatColors.Foreground, 3f);
                _lastClickLogout = MonoSAMGame.CurrentTime.TotalElapsedSeconds;
                _logOutCounter++;
                return;
            }
            else if (_logOutCounter == 1)
            {
                if (delta < 0.5f)
                {
                    return;
                }

                HUD.ShowToast(null, L10N.T(L10NImpl.STR_FAP_WARN2), 40, FlatColors.Flamingo, FlatColors.Foreground, 3f);
                _lastClickLogout = MonoSAMGame.CurrentTime.TotalElapsedSeconds;
                _logOutCounter++;
                return;
            }
            else if (_logOutCounter == 2)
            {
                MainGame.Inst.Profile.LevelData.Clear();
                MainGame.Inst.Profile.CustomLevelData.Clear();
                MainGame.Inst.Profile.ScoreSCCM         = 0;
                MainGame.Inst.Profile.ScoreStars        = 0;
                MainGame.Inst.Profile.MultiplayerPoints = 0;

                MainGame.Inst.Profile.AccountType        = AccountType.Local;
                MainGame.Inst.Profile.OnlineUserID       = -1;
                MainGame.Inst.Profile.OnlineUsername     = "******";
                MainGame.Inst.Profile.OnlinePasswordHash = string.Empty;
                MainGame.Inst.Profile.OnlineRevisionID   = -1;
                MainGame.Inst.Profile.NeedsReupload      = false;

                MainGame.Inst.Backend.CreateUser(MainGame.Inst.Profile).ContinueWith(t => MainGame.Inst.Backend.DownloadHighscores(MainGame.Inst.Profile)).EnsureNoError();

                HUD.ShowToast(null, L10N.T(L10NImpl.STR_FAP_LOGOUT_SUCESS), 40, FlatColors.Emerald, FlatColors.Foreground, 1.5f);
                MainGame.Inst.SetOverworldScreenCopy(HUD.Screen as GDOverworldScreen);
            }
        }
Beispiel #18
0
        private void ToggleMusic(HUDTextButton sender, HUDButtonEventArgs e)
        {
            _music = (((_music + 1) + 1) % MainGame.Inst.GDSound.LevelMusic.Length) - 1;

            if (_music != -1)
            {
                MainGame.Inst.GDSound.PlayMusicLevel(_music);
            }
            else
            {
                MainGame.Inst.GDSound.StopSong();
            }

            RefreshControls();
        }
Beispiel #19
0
        private void ToggleGeometry(HUDTextButton sender, HUDButtonEventArgs e)
        {
            switch (_geometry)
            {
            case GameWrapMode.Death:   _geometry = GameWrapMode.Donut;   break;

            case GameWrapMode.Donut:   _geometry = GameWrapMode.Reflect; break;

            case GameWrapMode.Reflect: _geometry = GameWrapMode.Death;   break;

            default:                   _geometry = GameWrapMode.Donut;   break;
            }

            RefreshControls();
        }
Beispiel #20
0
        private void Close(HUDTextButton sender, HUDButtonEventArgs e)
        {
            if (string.IsNullOrWhiteSpace(_name))
            {
                HUD.ShowToast("LECP::NONAME", L10N.T(L10NImpl.STR_LVLED_ERR_NONAME), 40, FlatColors.Flamingo, FlatColors.Foreground, 3f);
                return;
            }

            _data.Name     = _name;
            _data.Size     = _size;
            _data.View     = _view;
            _data.Geometry = _geometry;
            _data.Music    = _music;

            this.Remove();
        }
Beispiel #21
0
 public void SetActiveButton(HUDTextButton activeButton)
 {
     foreach (var btnObj in Buttons)
     {
         if (btnObj.Item1 == activeButton)
         {
             btnObj.Item1.BackgroundNormal  = HUDBackgroundDefinition.CreateSimpleOutlineBlur(btnObj.Item3.Color, btnObj.Item3.OutlineColor, btnObj.Item3.OutlineThickness, 16);
             btnObj.Item1.BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutlineBlur(btnObj.Item2.Color, btnObj.Item2.OutlineColor, btnObj.Item2.OutlineThickness, 16);
         }
         else
         {
             btnObj.Item1.BackgroundNormal  = btnObj.Item2;
             btnObj.Item1.BackgroundPressed = btnObj.Item3;
         }
     }
 }
 private void OnEdit(HUDTextButton sender, HUDButtonEventArgs e)
 {
     MainGame.Inst.SetLevelEditorScreen(_data);
 }
		private void OnClickCancel(HUDTextButton sender, HUDButtonEventArgs e)
		{
			_server.KillSession();
			_server.Stop();
			Remove();
		}
Beispiel #24
0
 private void DoDiscard(HUDTextButton sender, HUDButtonEventArgs e)
 {
     MainGame.Inst.SetOverworldScreenWithSCCM(SCCMMainPanel.SCCMTab.MyLevels);
 }
Beispiel #25
0
 private void SetModeWall(HUDTextButton sender, HUDButtonEventArgs e)
 {
     GDScreen.SetMode(LevelEditorMode.AddWall);
 }
        public override void OnInitialize()
        {
            base.OnInitialize();

            string txt = "?";

            if (_showMultiplayer)
            {
                txt = L10N.T(L10NImpl.STR_HSP_MULTIPLAYERRANKING);
            }
            else if (_focus == null)
            {
                txt = L10N.T(L10NImpl.STR_HSP_GLOBALRANKING);
            }
            else
            {
                txt = L10N.TF(L10NImpl.STR_HSP_RANKINGFOR, L10N.T(Levels.WORLD_NAMES[_focus.ID]));
            }

            AddElement(new HUDLabel(1)
            {
                TextAlignment    = (_showMultiplayer || _focus == null) ? HUDAlignment.CENTER : HUDAlignment.CENTERLEFT,
                Alignment        = HUDAlignment.TOPCENTER,
                RelativePosition = new FPoint(0, 0),
                Size             = new FSize(TAB_WIDTH, TEXT_HEIGHT_REAL),

                Font     = Textures.HUDFontBold,
                FontSize = 64,

                Text      = txt,
                TextColor = FlatColors.Clouds,
            });

            if (MainGame.Inst.Profile.HasMultiplayerGames)
            {
                if (!_showMultiplayer)
                {
                    AddElement(_btn = new HUDTextButton(1)
                    {
                        Alignment        = HUDAlignment.TOPRIGHT,
                        RelativePosition = FPoint.Zero,
                        Size             = new FSize(3.5f * GDConstants.TILE_WIDTH, 48),

                        L10NText      = L10NImpl.STR_WORLD_MULTIPLAYER,
                        TextColor     = FlatColors.Foreground,
                        Font          = Textures.HUDFontBold,
                        FontSize      = 42,
                        TextAlignment = HUDAlignment.CENTER,
                        TextPadding   = 8,

                        BackgroundNormal  = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Amethyst, 16, false, true, false, false),
                        BackgroundPressed = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Wisteria, 16, false, true, false, false),

                        Click = ShowMultiplayer,

                        IsVisible = false,
                    });
                }
                else
                {
                    AddElement(_btn = new HUDTextButton(1)
                    {
                        Alignment        = HUDAlignment.TOPRIGHT,
                        RelativePosition = FPoint.Zero,
                        Size             = new FSize(3.5f * GDConstants.TILE_WIDTH, 48),

                        L10NText      = L10NImpl.STR_WORLD_SINGLEPLAYER,
                        TextColor     = FlatColors.Foreground,
                        Font          = Textures.HUDFontBold,
                        FontSize      = 42,
                        TextAlignment = HUDAlignment.CENTER,
                        TextPadding   = 8,

                        BackgroundNormal  = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Amethyst, 16, false, true, false, false),
                        BackgroundPressed = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Wisteria, 16, false, true, false, false),

                        Click = ShowSingleplayer,

                        IsVisible = false,
                    });
                }
            }

            _loader = new HUDImage
            {
                RelativePosition = new FPoint(0, TEXT_HEIGHT / 2f),
                Alignment        = HUDAlignment.CENTER,
                Size             = new FSize(2 * GDConstants.TILE_WIDTH, 2 * GDConstants.TILE_WIDTH),
                Color            = FlatColors.Clouds,
                Image            = Textures.CannonCogBig,

                RotationSpeed = 0.1f,

                IsVisible = true,
            };
            AddElement(_loader);

            _table = new HUDScrollTable
            {
                RelativePosition = new FPoint(0, TEXT_HEIGHT / 2f),
                Alignment        = HUDAlignment.CENTER,
                Size             = new FSize(TAB_WIDTH, TAB_HEIGHT),

                Background       = FlatColors.BackgroundHUD2,
                Foreground       = FlatColors.TextHUD,
                LineColor        = Color.Black,
                HeaderBackground = FlatColors.Asbestos,
                HeaderForeground = Color.Black,
                ScrollThumbColor = FlatColors.Silver,
                ScrollWidth      = 16,
                ScrollHeight     = 64,
                LineWidth        = 2 * HUD.PixelWidth,
                FontSize         = 32,

                IsVisible = false,
            };
            _table.FixHeightToMultipleOfRowHeight();
            AddElement(_table);

            _table.AddColumn("", 100);
            _table.AddColumn(L10N.T(L10NImpl.STR_TAB_NAME), null);
            _table.AddColumn(L10N.T(L10NImpl.STR_TAB_POINTS), 100);
            if (!_showMultiplayer)
            {
                _table.AddColumn(L10N.T(L10NImpl.STR_TAB_TIME), 175);
            }

            LoadHighscore().EnsureNoError();
        }
 private void ShowSingleplayer(HUDTextButton sender, HUDButtonEventArgs e)
 {
     Remove();
     HUD.AddModal(new HighscorePanel(null, false), true);
 }
Beispiel #28
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);
        }
Beispiel #29
0
 private void SetModeMouse(HUDTextButton sender, HUDButtonEventArgs e)
 {
     GDScreen.SetMode(LevelEditorMode.Mouse);
 }
Beispiel #30
0
 private void SetModeCannon(HUDTextButton sender, HUDButtonEventArgs e)
 {
     GDScreen.SetMode(LevelEditorMode.AddCannon);
 }