Example #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();
        }
Example #2
0
        private async Task CreateUserAndShowAnonPanel()
        {
            var waitDialog = new HUDIconMessageBox
            {
                L10NText   = L10NImpl.STR_GLOB_WAITFORSERVER,
                TextColor  = FlatColors.TextHUD,
                Background = HUDBackgroundDefinition.CreateRounded(FlatColors.BelizeHole, 16),

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

                CloseOnClick = false,
            };

            MainGame.Inst.DispatchBeginInvoke(() => { HUD.AddModal(waitDialog, false, 0.7f); });

            await MainGame.Inst.Backend.CreateUser(MainGame.Inst.Profile);

            waitDialog.Remove();

            MainGame.Inst.DispatchBeginInvoke(() =>
            {
                if (MainGame.Inst.Profile.AccountType == AccountType.Anonymous)
                {
                    HUD.AddModal(new AnonymousAccountPanel(), true);
                }
            });
        }
Example #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();
        }
        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();
        }
Example #5
0
 private void ShowAnonPanel()
 {
     if (MainGame.Inst.Profile.AccountType == AccountType.Anonymous)
     {
         HUD.AddModal(new AnonymousAccountPanel(), true);
     }
 }
Example #6
0
        private async Task DoUpload()
        {
            var result = await MainGame.Inst.Backend.SetCustomLevelCompleted(MainGame.Inst.Profile, _level.CustomMeta_LevelID, _difficulty, _time);

            if (result.IsError)
            {
                MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                {
                    _btnReupload.IsVisible   = true;
                    _cannonCog.Color         = FlatColors.Alizarin;
                    _cannonCog.RotationSpeed = 0f;
                    _centerLabel.IsVisible   = false;
                });
            }
            else
            {
                MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                {
                    Remove();

                    HUD.AddModal(new HUDSCCMScorePanel_Won(_level, result.Metadata, _difficulty, result.ScoreGain, _time), false);

                    if (result.IsFirstClear)
                    {
                        AchievementPopup.Show(L10N.T(L10NImpl.STR_ACH_FIRSTCLEAR));
                    }
                    else if (result.IsWorldRecord)
                    {
                        AchievementPopup.Show(L10N.T(L10NImpl.STR_ACH_WORLDRECORD));
                    }
                });
            }
        }
Example #7
0
        public void DoPlayTest()
        {
            SetMode(LevelEditorMode.Mouse);

            LevelData.UpdateAndSave(this);

            var success = LevelData.ValidateWithToasts(HUD);

            if (success)
            {
                var waitDialog = new HUDIconMessageBox
                {
                    L10NText   = L10NImpl.STR_LVLED_COMPILING,
                    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);

                DoCompileAndTest(waitDialog).RunAsync();
            }
        }
Example #8
0
        private async Task DoCompileAndTest(HUDElement spinner)
        {
            try
            {
                var lvl = await Task.Run(() => LevelData.CompileToBlueprint(HUD));

                if (lvl == null)
                {
                    return;
                }

                MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                {
                    spinner.Remove();
                    HUD.AddModal(new LevelEditorTestConfirmPanel(lvl, LevelData), true, 0.7f);
                });
            }
            catch (Exception e)
            {
                SAMLog.Error("LEMP::DCAT", e);

                MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                {
                    spinner.Remove();
                    HUD.AddModal(new HUDFadeOutInfoBox(5, 2, 0.3f)
                    {
                        L10NText   = L10NImpl.STR_CPP_COMERR,
                        TextColor  = FlatColors.Clouds,
                        Background = HUDBackgroundDefinition.CreateRounded(FlatColors.Alizarin, 16),

                        CloseOnClick = true,
                    }, true);
                });
            }
        }
        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();
        }
Example #10
0
        public void ShowSettings()
        {
            SetMode(LevelEditorMode.Mouse);
            SelectStub(null);

            HUD.AddModal(new LevelEditorConfigPanel(LevelData), false, 0.5f, 0.5f);
        }
        public override void ShowScorePanel(LevelBlueprint lvl, PlayerProfile profile, HashSet <FractionDifficulty> newDifficulties, bool playerHasWon, int addPoints)
        {
            ((GDGameHUD)HUD).BtnPause.IsEnabled = false;
            ((GDGameHUD)HUD).BtnSpeed.IsEnabled = false;

            GameSpeedMode = GameSpeedModes.NORMAL;

            HUD.AddModal(new HUDTutorialScorePanel(profile, addPoints), false);
        }
        public override void ShowScorePanel(LevelBlueprint lvl, PlayerProfile profile, HashSet <FractionDifficulty> newDifficulties, bool playerHasWon, int addPoints, int time)
        {
            ((GDGameHUD)HUD).BtnPause.IsEnabled = false;
            ((GDGameHUD)HUD).BtnSpeed.IsEnabled = false;

            GameSpeedMode = GameSpeedModes.NORMAL;

            HUD.AddModal(new HUDSCCMTestScorePanel(lvl, SCCMData, Difficulty, _lastSpeed, time), false);
        }
        protected override void OnShow()
        {
            MainGame.Inst.GDSound.PlayMusicBackground();

            if (MainGame.Inst.Profile.AccountType == AccountType.Anonymous && MainGame.Inst.Profile.TotalPoints > 128 && !MainGame.Inst.Profile.AccountReminderShown)
            {
                HUD.AddModal(new AccountReminderPanel(), true, 0.8f, 1f);
            }
        }
Example #14
0
        private async Task <SCCMListPresenter.LoadFuncResult> QueryData(SCCMListPresenter list, int page, int reqid)
        {
            try
            {
                var r = await MainGame.Inst.Backend.QueryUserLevel(MainGame.Inst.Profile, QueryUserLevelCategory.NewLevels, string.Empty, page);

                if (r == null)
                {
                    return(SCCMListPresenter.LoadFuncResult.Error);
                }
                else
                {
                    if (r.Count == 0)
                    {
                        return(SCCMListPresenter.LoadFuncResult.LastPage);
                    }
                    else
                    {
                        MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                        {
                            if (list.IsCurrentRequest(reqid))
                            {
                                foreach (var levelmeta in r)
                                {
                                    list.AddEntry(new SCCMListElementOnlinePlayable(levelmeta));
                                }
                            }
                        });

                        return(SCCMListPresenter.LoadFuncResult.Success);
                    }
                }
            }
            catch (Exception e)
            {
                SAMLog.Error("SCCMTN::QD", e);

                MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                {
                    HUD.AddModal(new HUDFadeOutInfoBox(5, 2, 0.3f)
                    {
                        L10NText   = L10NImpl.STR_CPP_COMERR,
                        TextColor  = FlatColors.Clouds,
                        Background = HUDBackgroundDefinition.CreateRounded(FlatColors.Alizarin, 16),

                        CloseOnClick = true,
                    }, true);
                });

                return(SCCMListPresenter.LoadFuncResult.Error);
            }
        }
Example #15
0
        public void TryShowAuthErrorPanel()
        {
            if (!MainGame.Inst.Profile.UnacknowledgedAuthError)
            {
                return;
            }
            if (HUD.GetCurrentModalDialog() != null)
            {
                return;
            }

            HUD.AddModal(new AuthErrorPanel(), false, 0.8f, 0f);
        }
        public override void ShowScorePanel(LevelBlueprint lvl, PlayerProfile profile, HashSet <FractionDifficulty> xnullx, bool playerHasWon, int addPoints, int time)
        {
            ((GDGameHUD)HUD).BtnPause.IsEnabled = false;
            ((GDGameHUD)HUD).BtnSpeed.IsEnabled = false;

            GameSpeedMode = GameSpeedModes.NORMAL;

            if (playerHasWon)
            {
                HUD.AddModal(new HUDSCCMScorePanel_Transmit(lvl, Difficulty, time), false);
            }
            else
            {
                HUD.AddModal(new HUDSCCMScorePanel_Lost(lvl, Difficulty), false);
            }
        }
Example #17
0
        private async Task CreateNewUserLevelInternal(HUDElement spinner)
        {
            try
            {
                var r = await MainGame.Inst.Backend.GetNewCustomLevelID(MainGame.Inst.Profile);

                if (!r.Item1)
                {
                    MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                    {
                        spinner.Remove();
                        HUD.AddModal(new HUDFadeOutInfoBox(5, 2, 0.3f)
                        {
                            L10NText   = L10NImpl.STR_CPP_COMERR,
                            TextColor  = FlatColors.Clouds,
                            Background = HUDBackgroundDefinition.CreateRounded(FlatColors.Alizarin, 16),

                            CloseOnClick = true,
                        }, true);
                    });
                    return;
                }

                MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                {
                    spinner.Remove();
                    MainGame.Inst.SetLevelEditorScreen(new SCCMLevelData(r.Item2, MainGame.Inst.Profile.OnlineUserID));
                });
            }
            catch (Exception e)
            {
                SAMLog.Error("SCCMLENUL::DL", e);

                MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                {
                    spinner.Remove();
                    HUD.AddModal(new HUDFadeOutInfoBox(5, 2, 0.3f)
                    {
                        L10NText   = L10NImpl.STR_CPP_COMERR,
                        TextColor  = FlatColors.Clouds,
                        Background = HUDBackgroundDefinition.CreateRounded(FlatColors.Alizarin, 16),

                        CloseOnClick = true,
                    }, true);
                });
            }
        }
        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();
        }
Example #19
0
        public override void ShowScorePanel(LevelBlueprint lvl, PlayerProfile profile, HashSet <FractionDifficulty> newDifficulties, bool playerHasWon, int addPoints, int time)
        {
            ((GDGameHUD)HUD).BtnPause.IsEnabled = false;
            ((GDGameHUD)HUD).BtnSpeed.IsEnabled = false;

            GameSpeedMode = GameSpeedModes.NORMAL;

            HUD.AddModal(new HUDScorePanel(lvl, profile, newDifficulties, Difficulty, playerHasWon, addPoints, time), false);

            if (playerHasWon && (MainGame.Flavor == GDFlavor.IAB || MainGame.Flavor == GDFlavor.IAB_NOMP))
            {
                var diff = UnlockManager.GetFullUnlockState().Except(_unlocksBefore);
                foreach (var d in diff)
                {
                    if (d == Levels.WORLD_ID_ONLINE)
                    {
                        AchievementPopup.Show(L10N.T(L10NImpl.STR_ACH_UNLOCK_ONLINE));
                    }
                    if (d == Levels.WORLD_ID_MULTIPLAYER)
                    {
                        AchievementPopup.Show(L10N.T(L10NImpl.STR_ACH_UNLOCK_MULTIPLAYER));
                    }
                    if (d == Levels.WORLD_001.ID)
                    {
                        AchievementPopup.Show(L10N.TF(L10NImpl.STR_ACH_UNLOCK_WORLD, 1));
                    }
                    if (d == Levels.WORLD_002.ID)
                    {
                        AchievementPopup.Show(L10N.TF(L10NImpl.STR_ACH_UNLOCK_WORLD, 2));
                    }
                    if (d == Levels.WORLD_003.ID)
                    {
                        AchievementPopup.Show(L10N.TF(L10NImpl.STR_ACH_UNLOCK_WORLD, 3));
                    }
                    if (d == Levels.WORLD_004.ID)
                    {
                        AchievementPopup.Show(L10N.TF(L10NImpl.STR_ACH_UNLOCK_WORLD, 4));
                    }
                }
            }
        }
        private async Task DoSignup(HUDElement spinner, string username, string password)
        {
            try
            {
                var profile = MainGame.Inst.Profile;

                var r = await MainGame.Inst.Backend.UpgradeUser(profile, username, password);

                switch (r.Item1)
                {
                case UpgradeResult.Success:
                    MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                    {
                        spinner.Remove();
                        HUD.AddModal(new HUDFadeOutInfoBox(3, 1, 0.3f)
                        {
                            L10NText     = L10NImpl.STR_AAP_ACCCREATED,
                            TextColor    = FlatColors.TextHUD,
                            Background   = HUDBackgroundDefinition.CreateRounded(FlatColors.Nephritis, 16),
                            CloseOnClick = true,
                        }, true);

                        Remove();
                    });
                    break;

                case UpgradeResult.UsernameTaken:
                    MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                    {
                        spinner.Remove();
                        HUD.AddModal(new HUDFadeOutInfoBox(5, 2, 0.3f)
                        {
                            L10NText     = L10NImpl.STR_AAP_USERTAKEN,
                            TextColor    = FlatColors.Clouds,
                            Background   = HUDBackgroundDefinition.CreateRounded(FlatColors.Alizarin, 16),
                            CloseOnClick = true,
                        }, true);
                    });
                    break;

                case UpgradeResult.AlreadyFullAcc:
                    MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                    {
                        spinner.Remove();
                        HUD.AddModal(new HUDFadeOutInfoBox(5, 2, 0.3f)
                        {
                            L10NText     = L10NImpl.STR_AAP_ALREADYCREATED,
                            TextColor    = FlatColors.Clouds,
                            Background   = HUDBackgroundDefinition.CreateRounded(FlatColors.Alizarin, 16),
                            CloseOnClick = true,
                        }, true);
                        Remove();
                    });
                    break;

                case UpgradeResult.InternalError:
                    MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                    {
                        spinner.Remove();
                        HUD.AddModal(new HUDFadeOutInfoBox(10, 2, 0.3f)
                        {
                            Text         = r.Item2,
                            TextColor    = FlatColors.Clouds,
                            Background   = HUDBackgroundDefinition.CreateRounded(FlatColors.Alizarin, 16),
                            CloseOnClick = true,
                        }, true);
                        Remove();
                    });
                    break;

                case UpgradeResult.NoConnection:
                    MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                    {
                        spinner.Remove();
                        HUD.AddModal(new HUDFadeOutInfoBox(5, 2, 0.3f)
                        {
                            L10NText     = L10NImpl.STR_AAP_NOCOM,
                            TextColor    = FlatColors.Clouds,
                            Background   = HUDBackgroundDefinition.CreateRounded(FlatColors.Alizarin, 16),
                            CloseOnClick = true,
                        }, true);
                        Remove();
                    });
                    break;

                case UpgradeResult.AuthError:
                    MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                    {
                        spinner.Remove();
                        HUD.AddModal(new HUDFadeOutInfoBox(5, 2, 0.3f)
                        {
                            L10NText     = L10NImpl.STR_AAP_AUTHERROR,
                            TextColor    = FlatColors.Clouds,
                            Background   = HUDBackgroundDefinition.CreateRounded(FlatColors.Alizarin, 16),
                            CloseOnClick = true,
                        }, true);
                        Remove();
                    });
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
            }
            catch (Exception e)
            {
                SAMLog.Error("CreateAccount", e);

                MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                {
                    spinner.Remove();
                    HUD.AddModal(new HUDFadeOutInfoBox(5, 2, 0.3f)
                    {
                        L10NText     = L10NImpl.STR_AAP_COULDNOTCREATE,
                        TextColor    = FlatColors.Clouds,
                        Background   = HUDBackgroundDefinition.CreateRounded(FlatColors.Alizarin, 16),
                        CloseOnClick = true,
                    }, true);

                    Remove();
                });
            }
        }
Example #21
0
 public void ExitEditor()
 {
     SetMode(LevelEditorMode.Mouse);
     HUD.AddModal(new LevelEditorSaveConfirmPanel(), true, 0.5f, 0.5f);
 }
Example #22
0
 public void DeleteLevel()
 {
     SetMode(LevelEditorMode.Mouse);
     HUD.AddModal(new LevelEditorDeleteConfirmPanel(), true, 0.5f, 0.5f);
 }
Example #23
0
        public override void Update(SAMTime gameTime, InputState istate)
        {
            base.Update(gameTime, istate);

            if (_server.Mode == SAMNetworkConnection.ServerMode.Stopped || _server.Mode == SAMNetworkConnection.ServerMode.Error)
            {
                bool dc = false;

                if (_btnNext != null && _btnNext.IsEnabled)
                {
                    _btnNext.BackgroundNormal  = HUDBackgroundDefinition.CreateRounded(FlatColors.Asbestos, 16);
                    _btnNext.BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.Asbestos, 16);
                    _btnNext.IsEnabled         = false;
                    dc = true;
                }
                if (_btnRand != null && _btnRand.IsEnabled)
                {
                    _btnRand.BackgroundNormal  = HUDBackgroundDefinition.CreateRounded(FlatColors.Asbestos, 16);
                    _btnRand.BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.Asbestos, 16);
                    _btnRand.IsEnabled         = false;
                    dc = true;
                }

                if (_server.ConnType == MultiplayerConnectionType.P2P && dc && _server.Mode == SAMNetworkConnection.ServerMode.Stopped)
                {
                    Owner.HUD.ShowToast("HMSP:ConnStop", L10N.TF(L10NImpl.STR_MP_TIMEOUT_USER, (_server.SessionUserID == 0) ? "1" : "0"), 32, FlatColors.Flamingo, FlatColors.Foreground, 7f);
                }
            }

            if (_server.Mode == SAMNetworkConnection.ServerMode.BroadcastNewGame ||
                _server.Mode == SAMNetworkConnection.ServerMode.BeforeNewGame ||
                _server.Mode == SAMNetworkConnection.ServerMode.CreatingNewGame)
            {
                _loadingCog.IsVisible = true;
            }

            if (_server.SessionUserID == 0 && _nextLevelRandom)
            {
                if (_server.Mode == SAMNetworkConnection.ServerMode.InLobby)
                {
                    byte[] binData = _serverHost.GetLobbySyncData();
                    _server.StartLobbySync(binData);
                }

                if (_server.Mode == SAMNetworkConnection.ServerMode.InGame)
                {
                    _preventStopOnRem();
                    MainGame.Inst.SetMultiplayerServerLevelScreen(Levels.LEVELS[_serverHost.LevelID], _serverHost.Speed, _serverHost.MusicIndex, _serverHost);
                }
            }

            if (_server.SessionUserID == 0)
            {
                if (_server.Mode == SAMNetworkConnection.ServerMode.CreatingNewGame)
                {
                    if (_nextLevelRandom)
                    {
                        SetLevelDataRandom();

                        _server.Mode = SAMNetworkConnection.ServerMode.InLobby;

                        byte[] binData = _serverHost.GetLobbySyncData();
                        _serverHost.StartLobbySync(binData);
                    }
                    else
                    {
                        _preventStopOnRem();
                        Remove();

                        HUD.AddModal(new MultiplayerRehostPanel(_server as GDMultiplayerServer), false, 0.5f, 0.5f);
                    }
                }
            }
            else
            {
                if (_server.Mode == SAMNetworkConnection.ServerMode.InLobby)
                {
                    _preventStopOnRem();

                    Remove();
                    HUD.AddModal(new MultiplayerClientLobbyPanel(_server as GDMultiplayerClient), false, 0.5f, 0.5f);
                }
            }
        }
Example #24
0
 private void OnChangePassword(HUDTextButton sender, HUDButtonEventArgs e)
 {
     Remove();
     HUD.AddModal(new ChangePasswordPanel(), true);
 }
Example #25
0
 private void OnClickHostOnline(HUDTextButton sender, HUDButtonEventArgs e)
 {
     Remove();
     HUD.AddModal(new MultiplayerHostPanel(MultiplayerConnectionType.PROXY), true, 0.5f);
 }
        private async Task DoLogin(HUDElement spinner, string username, string password)
        {
            try
            {
                var profile = MainGame.Inst.Profile;

                var r = await MainGame.Inst.Backend.MergeLogin(profile, username, password);

                var verifyResult = r.Item1;

                if (verifyResult != VerifyResult.Success)
                {
                    MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                    {
                        var text = "???";
                        if (verifyResult == VerifyResult.InternalError)
                        {
                            text = r.Item2;
                        }
                        if (verifyResult == VerifyResult.WrongPassword)
                        {
                            text = L10N.T(L10NImpl.STR_AAP_WRONGPW);
                        }
                        if (verifyResult == VerifyResult.WrongUsername)
                        {
                            text = L10N.T(L10NImpl.STR_AAP_USERNOTFOUND);
                        }
                        if (verifyResult == VerifyResult.NoConnection)
                        {
                            text = L10N.T(L10NImpl.STR_AAP_NOCOM);
                        }

                        spinner.Remove();
                        HUD.AddModal(new HUDFadeOutInfoBox(5, 2, 0.3f)
                        {
                            Text       = text,
                            TextColor  = FlatColors.Clouds,
                            Background = HUDBackgroundDefinition.CreateRounded(FlatColors.Alizarin, 16),

                            CloseOnClick = true,
                        }, true);

                        Remove();
                    });
                    return;
                }

                MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                {
                    spinner.Remove();

                    MainGame.Inst.SetOverworldScreenCopy(HUD.Screen as GDOverworldScreen);
                    var screen = MainGame.Inst.GetCurrentScreen();
                    screen?.HUD?.AddModal(new HUDFadeOutInfoBox(3, 1, 0.3f)
                    {
                        L10NText   = L10NImpl.STR_AAP_LOGINSUCCESS,
                        TextColor  = FlatColors.TextHUD,
                        Background = HUDBackgroundDefinition.CreateRounded(FlatColors.Nephritis, 16),

                        CloseOnClick = true,
                    }, true);

                    Remove();
                });
            }
            catch (Exception e)
            {
                SAMLog.Error("Login", e);

                MonoSAMGame.CurrentInst.DispatchBeginInvoke(() =>
                {
                    spinner.Remove();
                    HUD.AddModal(new HUDFadeOutInfoBox(5, 2, 0.3f)
                    {
                        L10NText   = L10NImpl.STR_AAP_NOLOGIN,
                        TextColor  = FlatColors.Clouds,
                        Background = HUDBackgroundDefinition.CreateRounded(FlatColors.Alizarin, 16),

                        CloseOnClick = true,
                    }, true);

                    Remove();
                });
            }
        }
 private void ShowSingleplayer(HUDTextButton sender, HUDButtonEventArgs e)
 {
     Remove();
     HUD.AddModal(new HighscorePanel(null, false), true);
 }
Example #28
0
 private void OnClickJoinBluetooth(HUDTextButton sender, HUDButtonEventArgs e)
 {
     Remove();
     HUD.AddModal(new MultiplayerFindLobbyScreen(MultiplayerConnectionType.P2P), true, 0.5f);
 }
 public override void ShowScorePanel(LevelBlueprint lvl, PlayerProfile profile, HashSet <FractionDifficulty> newDifficulties, bool playerHasWon, int addPoints)
 {
     GameSpeedMode = GameSpeedModes.NORMAL;
     HUD.AddModal(new HUDMultiplayerScorePanel(lvl, profile, playerHasWon, addPoints, _server, () => { _doNotStop = true; }), false);
 }
Example #30
0
 private void OnClickJoinOnline(HUDTextButton sender, HUDButtonEventArgs e)
 {
     Remove();
     HUD.AddModal(new MultiplayerJoinLobbyScreen(MultiplayerConnectionType.PROXY), true, 0.5f);
 }