Пример #1
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();
        }
Пример #2
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();
        }
Пример #3
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();
        }
Пример #4
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);
        }
Пример #5
0
        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);
            }
        }
Пример #6
0
        private void OnClickStart(HUDIconTextButton sender, HUDButtonEventArgs e)
        {
            UpdateHostData();

            _server.Mode = SAMNetworkConnection.ServerMode.InLobby;

            MainGame.Inst.Profile.LastMultiplayerHostedLevel = _server.LevelID;
            MainGame.Inst.Profile.LastMultiplayerHostedSpeed = _server.Speed;
            MainGame.Inst.SaveProfile();

            _btnCreate.Icon = Textures.CannonCogBig;

            _speed1.IsEnabled = false;
            _speed2.IsEnabled = false;
            _speed3.IsEnabled = false;
            _speed4.IsEnabled = false;
            _speed5.IsEnabled = false;

            _music1.IsEnabled = false;
            _music2.IsEnabled = false;
            _music3.IsEnabled = false;
            _music4.IsEnabled = false;
            _music5.IsEnabled = false;
            _music6.IsEnabled = false;
        }
Пример #7
0
        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();
        }
Пример #8
0
        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);
     }
 }
Пример #10
0
 private void DeleteSelected(HUDTextButton sender, HUDButtonEventArgs e)
 {
     if (GDScreen.Selection is GameEntity ge)
     {
         ge.Alive = false;
         GDScreen.SelectStub(null);
     }
 }
Пример #11
0
        private void OnCancel(HUDTextButton sender, HUDButtonEventArgs e)
        {
            MainGame.Inst.Profile.BackupOnlineUsername    = "";
            MainGame.Inst.Profile.UnacknowledgedAuthError = false;
            MainGame.Inst.SaveProfile();

            Remove();
        }
Пример #12
0
        private void OnClickCreateLobby(HUDIconTextButton sender, HUDButtonEventArgs e)
        {
            _server.LevelID = _currentLevel.UniqueID;

            if (_music1.Selected)
            {
                _server.MusicIndex = _music1.MusicIndex;
            }
            if (_music2.Selected)
            {
                _server.MusicIndex = _music2.MusicIndex;
            }
            if (_music3.Selected)
            {
                _server.MusicIndex = _music3.MusicIndex;
            }
            if (_music4.Selected)
            {
                _server.MusicIndex = _music4.MusicIndex;
            }
            if (_music5.Selected)
            {
                _server.MusicIndex = _music5.MusicIndex;
            }
            if (_music6.Selected)
            {
                _server.MusicIndex = _music6.MusicIndex;
            }

            if (_speed1.Selected)
            {
                _server.Speed = _speed1.Speed;
            }
            if (_speed2.Selected)
            {
                _server.Speed = _speed2.Speed;
            }
            if (_speed3.Selected)
            {
                _server.Speed = _speed3.Speed;
            }
            if (_speed4.Selected)
            {
                _server.Speed = _speed4.Speed;
            }
            if (_speed5.Selected)
            {
                _server.Speed = _speed5.Speed;
            }

            _server.CreateSession(BlueprintAnalyzer.PlayerCount(_currentLevel));

            MainGame.Inst.Profile.LastMultiplayerHostedLevel = _server.LevelID;
            MainGame.Inst.Profile.LastMultiplayerHostedSpeed = _server.Speed;
            MainGame.Inst.SaveProfile();

            _btnCreate.Icon = Textures.CannonCogBig;
        }
Пример #13
0
        private void DoSave(HUDTextButton sender, HUDButtonEventArgs e)
        {
            var ret = GDScreen.LevelData.UpdateAndSave(GDScreen);

            if (ret)
            {
                MainGame.Inst.SetOverworldScreenWithSCCM(SCCMMainPanel.SCCMTab.MyLevels);
            }
        }
Пример #14
0
        private void OnClickYes(HUDTextButton sender, HUDButtonEventArgs e)
        {
            MainGame.Inst.Profile.AccountReminderShown = true;
            MainGame.Inst.SaveProfile();

            Remove();

            ((ISettingsOwnerHUD)Owner.HUD).ShowAccountPanel();
        }
Пример #15
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();
        }
Пример #16
0
        private void OnReuploadProfile(HUDImageButton sender, HUDButtonEventArgs e)
        {
            if (isUploading)
            {
                return;
            }
            isUploading = true;

            btnReload.RotationSpeed = 0.5f;
            MainGame.Inst.ShowToast(null, L10N.T(L10NImpl.STR_PROFILESYNC_START), 40, FlatColors.Silver, FlatColors.Foreground, 2f);
            MainGame.Inst.Profile.NeedsReupload = true;

            DoReuploadProfile(MainGame.Inst.Profile).RunAsync();
        }
Пример #17
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]);
        }
Пример #18
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);
            }
        }
Пример #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();
        }
Пример #20
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();
        }
Пример #21
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();
        }
Пример #22
0
        private void DoUpload(HUDIconTextButton sender, HUDButtonEventArgs e)
        {
            var waitDialog = new HUDIconMessageBox
            {
                L10NText   = L10NImpl.STR_LVLED_UPLOADING,
                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);

            DoUploadInternal(waitDialog).RunAsync();
        }
Пример #23
0
 private void OnEdit(HUDTextButton sender, HUDButtonEventArgs e)
 {
     MainGame.Inst.SetLevelEditorScreen(_data);
 }
		private void OnClickCancel(HUDTextButton sender, HUDButtonEventArgs e)
		{
			_server.KillSession();
			_server.Stop();
			Remove();
		}
Пример #25
0
 private void DoDiscard(HUDTextButton sender, HUDButtonEventArgs e)
 {
     MainGame.Inst.SetOverworldScreenWithSCCM(SCCMMainPanel.SCCMTab.MyLevels);
 }
Пример #26
0
 private void ShowSingleplayer(HUDTextButton sender, HUDButtonEventArgs e)
 {
     Remove();
     HUD.AddModal(new HighscorePanel(null, false), true);
 }
Пример #27
0
 private void SetModeMouse(HUDTextButton sender, HUDButtonEventArgs e)
 {
     GDScreen.SetMode(LevelEditorMode.Mouse);
 }
Пример #28
0
 private void SetModeCannon(HUDTextButton sender, HUDButtonEventArgs e)
 {
     GDScreen.SetMode(LevelEditorMode.AddCannon);
 }
Пример #29
0
 private void SetModeWall(HUDTextButton sender, HUDButtonEventArgs e)
 {
     GDScreen.SetMode(LevelEditorMode.AddWall);
 }
Пример #30
0
 private void SetModeObstacle(HUDTextButton sender, HUDButtonEventArgs e)
 {
     GDScreen.SetMode(LevelEditorMode.AddObstacle);
 }