public ChallengeGenerationWorkflow(ChallengeGenerator challengeGenerator, BggApiService bggApiService, GameMetadata metadata, ScgOptions options) { _challengeGenerator = challengeGenerator; _bggApiService = bggApiService; _metadata = metadata; _options = options; }
public void UpdateInfo() { ChallengeInformationText[] cits = FindObjectsOfType <ChallengeInformationText>(); ChallengeGenerator cg = FindObjectOfType <ChallengeGenerator>(); foreach (var cit in cits) { ChallengeInformation info = cg.GetChallengeInfo(cit.gameObject.name); if (info.Completed) { cit.tick.enabled = true; } } }
private Level CreateLevelWithChallenges() { //count new Level Number var newLevelNr = _context.Levels.Count() + 1; //generate new Level with Challenges var challengeGen = new ChallengeGenerator(); var newLevel = challengeGen.GenerateChallengesAndLevel(newLevelNr); //add newLevel _context.Levels.Add(newLevel); _context.SaveChanges(); return(newLevel); }
protected void Page_Load(object sender, EventArgs e) { var signer = new Signer(ConfigurationManager.AppSettings["pfxFile"], ConfigurationManager.AppSettings["pfxPassword"]); var generator = new OcesAppletElementGenerator(signer); generator.AddServerUrlPrefix(ConfigurationManager.AppSettings["nemIDAppletPrefix"]); generator.AddReturnUrl(Request["ReturnUrl"]); var challenge = ChallengeGenerator.GenerateChallenge(Session); generator.SetChallenge(challenge); generator.SetLogLevel("debug"); // INFO/DEBUG/ERROR generatorSpan.InnerHtml = generator.GenerateLogonAppletElement("logon.aspx"); loginOtpLink.PostBackUrl = "log-ind-med-engangsnoegle.aspx?ReturnUrl=" + RequestValidator.getValidatedEncodedParam(Request["returnUrl"]); loginDigSignaturLink.PostBackUrl = "log-ind-med-digital-signatur.aspx?ReturnUrl=" + RequestValidator.getValidatedEncodedParam(Request["returnUrl"]); }
protected void Page_Load(object sender, EventArgs e) { var result = Request["result"]; if (result.Length % 4 == 0) { result = SignHandler.Base64Decode(result); } if ("ok" == result.ToLower()) { try { String friendlyName = ConfigurationManager.AppSettings.Get("logonto"); if (friendlyName == null || "".Equals(friendlyName.Trim())) { throw new ConfigurationException("Fejl: Logonto / friendlyname mangler, eller er tom i konfigurationen"); } string signature = SignHandler.Base64Decode(Request["signature"]); CertificateAndStatus certificateAndStatus = LogonHandler.ValidateAndExtractCertificateAndStatus(signature, Challenge(), friendlyName); if (certificateAndStatus.Certificate is PocesCertificate) { CertificateStatus status = certificateAndStatus.CertificateStatus; if (status == CertificateStatus.Valid) { Session.Add(KeyPid, ((PocesCertificate)certificateAndStatus.Certificate).Pid); if (Session[Global.CurrentUser] == null) { var randomUserName = ChallengeGenerator.GenerateChallenge(); Session.Add(Global.CurrentUser, randomUserName); } if (!Roles.IsUserInRole((string)Session[Global.CurrentUser], "poces")) { Roles.AddUserToRole((string)Session[Global.CurrentUser], "poces"); } FormsAuthentication.RedirectFromLoginPage((string)Session[Global.CurrentUser], false); } else { Session.Add("errorText", "Certifikatet er " + ErrorHandler.GetCertificateStatusText(status)); } } else { Session.Add("notPoces", true); } } catch (NonOcesCertificateException) { Session.Add("errorText", "Ikke et OCES-certifikat"); } catch (Exception ex) { Session.Add("errorText", "Ukendt server-fejl: " + ex.Message); } } else { Session.Add("errorText", ErrorHandler.GetErrorText(result)); } }
protected void Page_Load(object sender, EventArgs e) { var result = Request["result"]; if (result.Length % 4 == 0) { result = SignHandler.Base64Decode(result); } if ("ok" == result.ToLower()) { try { String logonto = ConfigurationManager.AppSettings["logonto"]; if (logonto == null || "".Equals(logonto.Trim())) { throw new ConfigurationErrorsException("Error - logonto parameter from configuration is missing or empty"); } string signature = SignHandler.Base64Decode(Request["signature"]); CertificateAndStatus certificateAndStatus = LogonHandler.ValidateAndExtractCertificateAndStatus(signature, Challenge(), logonto); if (certificateAndStatus.Certificate is PocesCertificate || certificateAndStatus.Certificate is MocesCertificate) { CertificateStatus status = certificateAndStatus.CertificateStatus; if (status == CertificateStatus.Valid) { SetAttributesForMocesOrPoces(certificateAndStatus.Certificate); if (Session[Global.CurrentUser] == null) { var randomUserName = ChallengeGenerator.GenerateChallenge(); Session.Add(Global.CurrentUser, randomUserName); } if (!Roles.IsUserInRole((string)Session[Global.CurrentUser], "nemid")) { Roles.AddUserToRole((string)Session[Global.CurrentUser], "nemid"); } FormsAuthentication.RedirectFromLoginPage((string)Session[Global.CurrentUser], false); } else { Session.Add("errorText", "Certifikatet er " + ErrorHandler.GetCertificateStatusText(status)); } } else { Session.Add("notPocesOrMoces", true); } } catch (NonOcesCertificateException) { Session.Add("errorText", "Ikke et OCES-certifikat"); } catch (Exception) { Session.Add("errorText", "Ukendt server-fejl"); } } else { Session.Add("errorText", ErrorHandler.GetErrorText(result)); } }
// Use this for initialization private void Start() { // Initialise variables GameOptions.LoadOptions(); challengeGenerator = GetComponent <ChallengeGenerator>(); challengeGenerator.GenerateChallenges(); audioManager = GetComponent <AudioManager>(); menu = FindObjectOfType <Menu>(); dictData = new DictData(dict); dictData.Setup(); letterList = new DictData(challengesFile); letterList.CleanLetterCombos(); letters = new char[3]; scores = new Scores(); answers = new List <string>(); word = new Word(); input.onEndEdit.AddListener(CheckInput); gameState = GameState.Pregame; IncreasePoints = new IntEvent(); IncreaseTime = new IntEvent(); bannedWords = bannedWordsAsset.ToString().Split('\n').ToList(); for (int i = 0; i < bannedWords.Count(); ++i) { bannedWords[i] = bannedWords[i].TrimEnd('\r'); } // Check if this is the first time the game has been played bool playedBefore = false; for (int mode = 1; mode < 3; ++mode) { // For each game mode for (int diff = 1; diff < 4; ++diff) { // For each difficulty if (scores.GetBestScore((GameMode)mode, (Difficulty)diff) > 0) { // If high score > 0 then played before playedBefore = true; break; } } if (playedBefore) { break; } } // Finished initialising variables // If not played before then start with the tutorial if (!playedBefore) { FindObjectOfType <LogoOpening>().SetNotPlayedBefore(); GameInfo.SetGameMode(GameMode.Welcome); } #if UNITY_IOS || UNITY_ANDROID // Initialise ads on mobile Ads.AdFinished.AddListener(AdCompleted); Ads.AdSkipped.AddListener(AdCompleted); Ads.AdFailed.AddListener(GoToMenu); #endif }