public async Task ConnessioneDomande() { var client = new HttpClient(); try { var values = new List <KeyValuePair <string, string> >(); values.Add(new KeyValuePair <string, string>("nome_set", SetDomande.setDomandeSelezionato.nome_set)); var content = new FormUrlEncodedContent(values); var result = await client.PostAsync(Costanti.domandeNew, content); resultcontent = await result.Content.ReadAsStringAsync(); if (resultcontent.ToString() == "Impossibile connettersi al servizio") { flag = true; throw new Exception(); } else { flag = false; struttura = JsonConvert.DeserializeObject <List <Domande> >(resultcontent); struttura = ShuffleList.Shuffle <Domande>(struttura); numeroTotaleDelSetDiDomande = struttura.Count; RisultatoSimulazione.conteggioDomandeSvoltePerSimulazione = numeroTotaleDelSetDiDomande; } } catch (Exception e) { resultcontent = "Impossibile connettersi al servizio"; await DisplayAlert("Errore", resultcontent.ToString(), "Ok"); await Navigation.PopToRootAsync(); } }
/// <summary> /// Cette méthode crée une liste contenant les différentes énigmes et la mélange avant de la retourner. /// </summary> /// <returns>Une liste d'énigme mélangées</returns> public static List<Enigma> ReferenceEnigmas() { ShuffleList<Enigma> enigmas = new ShuffleList<Enigma>(); enigmas.Add(new Enigma(new SimpleEnigmaPanel(), "C'est simple")); enigmas.Add(new Enigma(new SimplePuzzleEnigmaPanel(), "Puzzle")); enigmas.Add(new Enigma(new OuEstLaReponseEnigmaPanel(), "Où est la réponse ?")); enigmas.Add(new Enigma(new OiseauxEnigmaPanel(), "Le plus long mot")); enigmas.Add(new Enigma(new BusEnigmaPanel(), "Sens du bus")); enigmas.Add(new Enigma(new CharadeEnigmaPanel(), "Charade")); enigmas.Add(new Enigma(new InstinctEnigmaPanel(), "Instinct")); enigmas.Add(new Enigma(new SeptDifferencesEnigmaPanel(), "Le jeu des 7 différences")); enigmas.Add(new Enigma(new OpenDoorEnigmaPanel(), "Ouvrez la porte !")); enigmas.Add(new Enigma(new HazardEnigmaPanel(), "Hazard")); enigmas.Add(new Enigma(new MemoireDesChiffresEnigmaPanel(), "Souviens toi")); enigmas.Add(new Enigma(new NbrCarresEnigmaPanel(), "Nombre de carrés")); enigmas.Add(new Enigma(new AppuieReponseEnigmaPanel(), "Appuie sur la réponse")); enigmas.Add(new Enigma(new CaseVideEnigmaPanel(), "Et ben non")); enigmas.Add(new Enigma(new ReflexeEnigmaPanel(), "Reflexe")); enigmas.Add(new Enigma(new DingbatEnigmaPanel(), "Jeu de mot")); enigmas.Shuffle(); return enigmas; }
public void SetQuestion(Question question) //Sets the current question { this.question = question; switch (question.questionType) { case QuestionType.TEXT: //Test question questionImage.transform.parent.gameObject.SetActive(false); break; case QuestionType.IMAGE: //Image question type (Jordan picture is an example) ImageHolder(); questionImage.transform.gameObject.SetActive(true); questionImage.sprite = question.questionImage; break; } questionText.text = question.questionInfo; List <string> answerList = ShuffleList.ShuffleListItems <string>(question.options); for (int i = 0; i < options.Count; i++) { options[i].GetComponentInChildren <Text>().text = answerList[i]; options[i].name = answerList[i]; options[i].image.color = regular; } answered = false; }
public void Shuffle() { do { foreach (Piece piece in Pieces) { if (piece.Location == new Point(PiecesSize.X - 1, PiecesSize.Y - 1)) { Swap(piece, EmptyPiece); break; } } ShuffleList <Piece> shuffledList = new ShuffleList <Piece>(); foreach (Piece piece in Pieces) { shuffledList.Add(piece); } shuffledList.Shuffle(); for (int i = 0; i < shuffledList.Count; i++) { Pieces[i].Location = shuffledList[i].Destination; } if (!IsSolvable()) { Swap(shuffledList[0], shuffledList[1]); } } while (IsSolved()); Moves = 0; Start = true; }
public async override void RemoveTrack(PlayableBase track) { base.RemoveTrack(track); ShuffleList.Remove(track); track.IsRemoving = true; await Task.Delay(500); if (!track.TrackExists) { for (var i = 0; i < Tracks.Count; i++) { if (Tracks[i].AuthenticationCode != track.AuthenticationCode) { continue; } Tracks.RemoveAt(i); break; } } else { Tracks.Remove(track); } track.IsRemoving = false; //The track could be also in another playlist }
public void DeckSetup(List <Card> deck) { Cards = new List <Card>(); Cards.AddRange(deck); ShuffleList.Shuffle <Card>(Cards); SetDeckCountUI(); }
private void loadFlagForm() { lbCount.Text = count.ToString(); lbTime.Text = "Время: 15 сек"; timeLeft = 15; //flag = flagDb.getConcreteFlag(count); flag = flagIter.CurrentItem(); Draw(); arrayBut.Add(btnVariantA); arrayBut.Add(btnVariantB); arrayBut.Add(btnVariantC); arrayBut.Add(btnVariantD); foreach (var btn in arrayBut) { btn.Enabled = true; } ShuffleList.Shuffle(arrayBut); foreach (var btn in arrayBut) { btn.Text = flagDb.getRandomFlag().Name; } trueButton = arrayBut[0]; arrayBut[0].Text = flag.Name; flagDb.clearWorkFlags(); }
/// <summary> /// Cette méthode crée une liste contenant les différentes énigmes et la mélange avant de la retourner. /// </summary> /// <returns>Une liste d'énigme mélangées</returns> public static List<Enigma> ReferenceEnigmas() { ShuffleList<Enigma> enigmas = new ShuffleList<Enigma>(); enigmas.Add(new Enigma(new SimpleEnigmaPanel(), "C'est simple")); enigmas.Add(new Enigma(new SimplePuzzleEnigmaPanel(), "Puzzle")); enigmas.Add(new Enigma(new OuEstLaReponseEnigmaPanel(), "Où est la réponse ?")); enigmas.Add(new Enigma(new OiseauxEnigmaPanel(), "Le plus long mot")); enigmas.Add(new Enigma(new BusEnigmaPanel(), "Sens du bus")); enigmas.Add(new Enigma(new CharadeEnigmaPanel(), "Charade")); enigmas.Add(new Enigma(new TrouverEnigmaPanel(), "Trouver Cristiano")); enigmas.Add(new Enigma(new SeptDifferencesEnigmaPanel(), "Le jeu des 7 différences")); enigmas.Add(new Enigma(new OpenDoorEnigmaPanel(), "Ouvrez la porte !")); enigmas.Add(new Enigma(new HazardEnigmaPanel(), "Hazard")); enigmas.Add(new Enigma(new MemoireDesChiffresEnigmaPanel(), "Souviens toi")); enigmas.Add(new Enigma(new NbrCarresEnigmaPanel(), "Nombre de carrés")); enigmas.Add(new Enigma(new AppuieReponseEnigmaPanel(), "Appuie sur la réponse")); enigmas.Add(new Enigma(new CaseVideEnigmaPanel(), "Et ben non")); enigmas.Add(new Enigma(new ReflexeEnigmaPanel(), "Reflexe")); enigmas.Add(new Enigma(new DingbatEnigmaPanel(), "Jeu de mot")); enigmas.Add(new Enigma(new NfsEnigmaPanel(), "Need For Speed")); enigmas.Add(new Enigma(new RectangleEnigmaPanel(), "Trouve le rectangle")); enigmas.Add(new Enigma(new PenduEnigmaPanel(), "Le jeu du pendu")); Enigma runEnigma = new Enigma(new RunEnigmaPanel(), "Roux run"); enigmas.Add(runEnigma); Enigma runEnigmaInverse = new Enigma(new RunEnigmaPanel(true), "Roux run encore"); runEnigmaInverse.AddPrerequisite(runEnigma); enigmas.Add(runEnigmaInverse); enigmas.Shuffle(); return enigmas; }
public async Task ConnessioneDomande() { var client = new HttpClient(); var result = new HttpResponseMessage(); try { var values = new List <KeyValuePair <string, string> >(); values.Add(new KeyValuePair <string, string>("id_concorso", QuizVeloce.idConcorsoSelezionato)); values.Add(new KeyValuePair <string, string>("materia", QuizVeloce.materiaSelezionata)); if (QuizVeloce.numeroDomandeQuizVeloceSelezionato != 0) { values.Add(new KeyValuePair <string, string>("numerodomande", QuizVeloce.numeroDomandeQuizVeloceSelezionato.ToString())); RisultatoSimulazione.conteggioDomandeSvoltePerSimulazione = QuizVeloce.numeroDomandeQuizVeloceSelezionato; } else { values.Add(new KeyValuePair <string, string>("numerodomande", QuizVeloce.numeroDomandeMassimoDelTestQuizVeloce.ToString())); RisultatoSimulazione.conteggioDomandeSvoltePerSimulazione = QuizVeloce.numeroDomandeMassimoDelTestQuizVeloce; } var content = new FormUrlEncodedContent(values); if (modalitaSelezionata == "Modalità Casuale" && QuizVeloce.idConcorsoSelezionato != Costanti.eseguiTestSuInteroDb) { content = new FormUrlEncodedContent(values); result = await client.PostAsync(Costanti.domconcorsorandomNew, content); } else if (modalitaSelezionata == "Modalità Casuale" && QuizVeloce.idConcorsoSelezionato == Costanti.eseguiTestSuInteroDb) { content = new FormUrlEncodedContent(values); result = await client.PostAsync(Costanti.domconcorsorandomtotaliNew, content); } else { values.Add(new KeyValuePair <string, string>("domandainiziale", QuizVeloce.numeroselezionato.ToString())); content = new FormUrlEncodedContent(values); result = await client.PostAsync(Costanti.domconcorsosequenzaNew, content); } resultcontent = await result.Content.ReadAsStringAsync(); if (resultcontent.ToString() == "errore nella get") { flag = true; } else { flag = false; struttura = JsonConvert.DeserializeObject <List <Domande> >(resultcontent); if (modalitaSelezionata == "Modalità Casuale") { struttura = ShuffleList.Shuffle <Domande>(struttura); } numeroTotaleDelSetDiDomande = struttura.Count; } } catch (Exception e) { await DisplayAlert("Errore", resultcontent.ToString(), "Ok"); } }
void SetQuestion() { gameStatus = GameStatus.Playing; //set GameStatus to playing //set the answerWord string variable answerWord = questionDataScriptable.questions[currentQuestionIndex].answer; //set the image of question questionImage.sprite = questionDataScriptable.questions[currentQuestionIndex].questionImage; ResetQuestion(); //reset the answers and options value to orignal selectedWordsIndex.Clear(); //clear the list for new question Array.Clear(wordsArray, 0, wordsArray.Length); //clear the array //add the correct char to the wordsArray for (int i = 0; i < answerWord.Length; i++) { wordsArray[i] = char.ToUpper(answerWord[i]); } //add the dummy char to wordsArray for (int j = answerWord.Length; j < wordsArray.Length; j++) { wordsArray[j] = (char)UnityEngine.Random.Range(65, 90); } wordsArray = ShuffleList.ShuffleListItems <char>(wordsArray.ToList()).ToArray(); //Randomly Shuffle the words array //set the options words Text value for (int k = 0; k < optionsWordList.Length; k++) { optionsWordList[k].SetWord(wordsArray[k]); } }
/// <summary> /// Method which populate the question on the screen /// </summary> /// <param name="question"></param> public void SetQuestion(Question question) { //set the question this.question = question; //check for questionType switch (question.questionType) { case QuestionType.TEXT: questionImg.transform.parent.gameObject.SetActive(false); //deactivate image holder break; case QuestionType.IMAGE: questionImg.transform.parent.gameObject.SetActive(true); //activate image holder questionVideo.transform.gameObject.SetActive(false); //deactivate questionVideo questionImg.transform.gameObject.SetActive(true); //activate questionImg questionAudio.transform.gameObject.SetActive(false); //deactivate questionAudio questionImg.sprite = question.questionImage; //set the image sprite break; case QuestionType.AUDIO: questionVideo.transform.parent.gameObject.SetActive(true); //activate image holder questionVideo.transform.gameObject.SetActive(false); //deactivate questionVideo questionImg.transform.gameObject.SetActive(false); //deactivate questionImg questionAudio.transform.gameObject.SetActive(true); //activate questionAudio audioLength = question.audioClip.length; //set audio clip StartCoroutine(PlayAudio()); //start Coroutine break; case QuestionType.VIDEO: questionVideo.transform.parent.gameObject.SetActive(true); //activate image holder questionVideo.transform.gameObject.SetActive(true); //activate questionVideo questionImg.transform.gameObject.SetActive(false); //deactivate questionImg questionAudio.transform.gameObject.SetActive(false); //deactivate questionAudio questionVideo.clip = question.videoClip; //set video clip questionVideo.Play(); //play video break; } questionInfoText.text = question.questionInfo; //set the question text //suffle the list of options List <string> ansOptions = ShuffleList.ShuffleListItems <string>(question.options); //assign options to respective option buttons for (int i = 0; i < options.Count; i++) { //set the child text options[i].GetComponentInChildren <Text>().text = ansOptions[i]; options[i].name = ansOptions[i]; //set the name of button options[i].image.color = normalCol; //set color of button to normal } answered = false; }
public override void Load() { placement = new List <int>(); caractere = new ShuffleList <char>(); toutestouches = new ShuffleList <char>(); listeTouche = new List <Touche>(); placement.Add(3); placement.Add(17); placement.Add(21); placement.Add(25); caractere.Add('P'); caractere.Add('R'); caractere.Add('E'); caractere.Add('S'); lblPresser = new Label() { Text = "PRESSER", Location = new Point(315, 60), TextAlign = ContentAlignment.MiddleCenter, Font = new Font("Arial", 22), Width = 160, Height = 45 }; Controls.Add(lblPresser); // boucle qui va ajouter dans le tableau toutetouches toute les lettre de l'alphabet for (char i = 'A'; i <= 'Z'; i++) { if (i == 'P' | i == 'R' | i == 'E' | i == 'S') // on exclue les touches avec un emplacement reservé { continue; } toutestouches.Add(i); } toutestouches.Shuffle(); caractere.Shuffle(); //Place les lettres avec un emplacement réservé au bon endroit dans la liste toutestouches while (placement.Count > 0) { int iPlace = placement[0]; placement.RemoveAt(0); char clettre = caractere[0]; caractere.RemoveAt(0); toutestouches.Insert(iPlace, clettre); } for (int i = 0; i <= 25; i++) { Touche touche = new Touche("" + toutestouches[i], iWidth, iHeight); Controls.Add(touche); listeTouche.Add(touche); touche.BringToFront(); // Fait passer le contrôle au premier rang dans l'ordre de plan. } PlaceTouche(); }
public void RefreshList() { currentListFighter.Clear(); ShuffleList.Shuffle(listFighter); for (int i = 0; i < maxOpponentDisplayed; i++) { currentListFighter.Add(listFighter[i]); ModifyDatas(listFighter[i], listFrame[i]); } }
public ActionResult Index() { ProductDao productDao = new ProductDao(); List <Product> listTemp = productDao.getAll(); List <Product> listProduct = new List <Product>(); ShuffleList.Shuffle(listTemp); for (int i = 0; i < 12; i++) { listProduct.Add(listTemp[i]); } listTemp = productDao.getAllByCategoryId(2); List <Product> listMeasurement = new List <Product>(); ShuffleList.Shuffle(listTemp); for (int i = 0; i < 12; i++) { listMeasurement.Add(listTemp[i]); } listTemp = productDao.getAllByCategoryId(5); List <Product> listHomeAndGarden = new List <Product>(); ShuffleList.Shuffle(listTemp); for (int i = 0; i < 12; i++) { listHomeAndGarden.Add(listTemp[i]); } listTemp = productDao.getAllByCategoryId(1); List <Product> listTool = new List <Product>(); ShuffleList.Shuffle(listTemp); for (int i = 0; i < 12; i++) { listTool.Add(listTemp[i]); } List <Product> newArrival = productDao.sortByDateDesc(); List <Category> listCategory = new CategoryDao().getAll(); ViewData["listProduct"] = listProduct; ViewData["listMeasurement"] = listMeasurement; ViewData["listHomeAndGarden"] = listHomeAndGarden; ViewData["listTool"] = listTool; ViewData["newArrival"] = newArrival; ViewData["listCategory"] = listCategory; Session["url"] = "https://localhost:44394/Home/Index"; return(View()); }
public void ShuffleTest_ItemChangeIndex_True() { var mylist = new List <int>(); mylist.Add(9); mylist.Add(7); mylist.Add(3); var shuffled = ShuffleList.Shuffle <int>(mylist); Assert.AreNotEqual(1, shuffled.IndexOf(7)); }
public void ShuffleTest_LengthDoesNotChange_True() { var mylist = new List <int>(); mylist.Add(9); mylist.Add(7); mylist.Add(3); var shuffled = ShuffleList.Shuffle <int>(mylist); Assert.AreEqual(3, shuffled.Count); }
public ExamMainQuestionViewModel GetExamQuestions(string userId, string timeLookUp) { try { //Get sql time object var timeObjectSql = _storedProcedure.GetTimeObject(timeLookUp); //Get time Object mapping var examTimeObjectMapping = Mapper.Map <ExamScheduleTime, TimeViewModel>(timeObjectSql); //Get Exam topic sql var examTopicsQL = _storedProcedure.GetExamTopics(userId); //Get Exam Topic mapping var examTopicMapping = Mapper.Map <List <ExamTopic>, List <TopicViewModel> >(examTopicsQL); //initialize the view model to carry topic and subsquent question lists var examExamQuestionModel = new List <ExamTopicViewModel>(); //Iterate over topics to get all the questions under it. foreach (var topic in examTopicMapping) { //Get sql exam questions var examQuestionSql = _storedProcedure.GetExamQuestions(topic.ExamTopicId); if (examQuestionSql.Count() > 0) { ShuffleList.Shuffle(examQuestionSql); try { var examQuestionModel = Mapper.Map <List <ExamQuestion>, List <ExamQuestionsViewModel> >(examQuestionSql); var examTopicModels = new ExamTopicViewModel() { TopicViewModel = topic, ExamQuestionsViewModels = examQuestionModel, }; examExamQuestionModel.Add(examTopicModels); } catch (Exception ex) { } } } //Return the View models carrying all the questions. var examTimeInstruction = new ExamMainQuestionViewModel() { ExamTopicViewModels = examExamQuestionModel, TimeViewModel = examTimeObjectMapping }; return(examTimeInstruction); } catch (Exception ex) { string errorMessage = "GetExamQuestions(): " + ex.Message; _unitOfWork.AuditTrail(errorMessage, userId); return(new ExamMainQuestionViewModel()); } }
private void comboBoxLoad() { List <string> arrayAnswersBuf = new List <string>(arrayAnswers); ShuffleList.Shuffle(arrayAnswersBuf); foreach (var cbA in arrayCb) { for (int i = 0; i < 4; i++) { cbA.Items.Add(arrayAnswersBuf.ElementAt(i)); } } }
private List <Fighter> ChooseOpponents(int treshold, int level) { List <Fighter> fighters = new List <Fighter>(); do { fighters = fullListOfFighter.FindAll((fighter) => int.Parse(fighter.level) >= (level - treshold) && int.Parse(fighter.level) <= (level + treshold)); treshold++; } while(fighters.Count < maxOpponentDisplayed); ShuffleList.Shuffle(fighters); return(fighters); }
/// <summary> /// Cette méthode crée une liste contenant les différentes énigmes et la mélange avant de la retourner. /// </summary> /// <returns>Une liste d'énigme mélangées</returns> public static List<Enigma> ReferenceEnigmas() { ShuffleList<Enigma> enigmas = new ShuffleList<Enigma>(); enigmas.Add(new Enigma(new SimpleEnigmaPanel(), "C'est simple")); enigmas.Add(new Enigma(new SimplePuzzleEnigmaPanel(), "Puzzle")); enigmas.Add(new Enigma(new OuEstLaReponseEnigmaPanel(), "Ou est la réponse ?")); enigmas.Add(new Enigma(new AppuieReponseEnigmaPanel(), "Appuie sur la réponse")); enigmas.Add(new Enigma(new CaseVideEnigmaPanel(), "Et ben non")); enigmas.Add(new Enigma(new NfsEnigmaPanel(), "Need For Speed")); enigmas.Add(new Enigma(new RectangleEnigmaPanel(), "Trouve le rectangle")); enigmas.Shuffle(); return enigmas; }
public void OnGet() { //when no id is passed through url if (string.IsNullOrWhiteSpace(ProductId)) { ProductId = "Invalid Id"; validId = false; } else { shoeSelectedDB = eFdb.GetProducts() .Where(x => x.ShoeID == ProductId) .FirstOrDefault <Product>(); // get selected products shoe promos ShoePromos = eFdb.GetShoePromos(shoeSelectedDB.ShoeID); if (ShoePromos != null) // if promo shoes not null set bool promo true { Promo = true; } if (Promo == true) { ShuffleList.ShuffleThisList(ShoePromos); // if there are promo matches shuffle the list so that new products are promoted each OnGet ShoePromos = ShoePromos.Take(3).ToList(); // only take the first three after shuffling the list promoShoesOnly = eFdb.GetProducts(); foreach (var item in ShoePromos) { item.SelectPromoProduct = promoShoesOnly.Where(x => x.ShoeID == item.ShoeIdMatch).FirstOrDefault(); // store the product data onto the selected promo product } } // if product id is a valid id then do if (shoeSelectedDB != null) { validId = true; } else { ProductId = "Invalid Id"; validId = false; } } }
/// <summary> /// Cette méthode crée une liste contenant les différentes énigmes et la mélange avant de la retourner. /// </summary> /// <returns>Une liste d'énigme mélangées</returns> public static List <Enigma> ReferenceEnigmas() { ShuffleList <Enigma> enigmas = new ShuffleList <Enigma>(); enigmas.Add(new Enigma(new AppuieReponseEnigmaPanel(), "Appuie sur la réponse")); enigmas.Add(new Enigma(new BeatThemAllEnigmaPanel(), "Beat them all")); enigmas.Add(new Enigma(new BusEnigmaPanel(), "Sens du bus")); enigmas.Add(new Enigma(new CaseVideEnigmaPanel(), "Et ben non")); enigmas.Add(new Enigma(new CharadeEnigmaPanel(), "Charade")); enigmas.Add(new Enigma(new ClicRapideEnigmaPanel(), "Clic-rapide")); enigmas.Add(new Enigma(new DingbatEnigmaPanel(), "Jeu de mot")); enigmas.Add(new Enigma(new CodeBarreEnigmaPanel(), "Le code barre")); enigmas.Add(new Enigma(new FruitsEnigmaPanel(), "Calcul")); enigmas.Add(new Enigma(new HazardEnigmaPanel(), "Hazard")); enigmas.Add(new Enigma(new HiddenCharacterEnigmalPanel(), "Caractère caché")); enigmas.Add(new Enigma(new InvisibleAnwerEnigmaPanel(), "Invisible Answer")); enigmas.Add(new Enigma(new LettreHaute(), "Quelle est la plus haute ?")); enigmas.Add(new Enigma(new MemoireDesChiffresEnigmaPanel(), "Souviens toi")); enigmas.Add(new Enigma(new MorpionEnigmaPanel(), "Morpion")); enigmas.Add(new Enigma(new NbrCarresEnigmaPanel(), "Nombre de carrés")); enigmas.Add(new Enigma(new NfsEnigmaPanel(), "Need For Speed")); enigmas.Add(new Enigma(new NinePointsEnigmaPanel(), "9 Points")); enigmas.Add(new Enigma(new OiseauxEnigmaPanel(), "Le plus long mot")); enigmas.Add(new Enigma(new OpenDoorEnigmaPanel(), "Ouvrez la porte !")); enigmas.Add(new Enigma(new OuEstLaReponseEnigmaPanel(), "Où est la réponse ?")); enigmas.Add(new Enigma(new PenduEnigmaPanel(), "Le jeu du pendu")); enigmas.Add(new Enigma(new PhoqueEnigmaPanel(), "Chop' les poissons")); enigmas.Add(new Enigma(new RectangleEnigmaPanel(), "Trouve le rectangle")); enigmas.Add(new Enigma(new ReflexeEnigmaPanel(), "Reflexe")); enigmas.Add(new Enigma(new SeptDifferencesEnigmaPanel(), "Le jeu des 7 différences")); enigmas.Add(new Enigma(new SimpleEnigmaPanel(), "C'est simple")); enigmas.Add(new Enigma(new SimplePuzzleEnigmaPanel(), "Puzzle")); enigmas.Add(new Enigma(new TapeTaupeEnigmaPanel(), "Tape-taupe")); enigmas.Add(new Enigma(new TrouverEnigmaPanel(), "Trouver Cristiano")); enigmas.Add(new Enigma(new ZombieInvasionEnigmaPanel(), "ZombieInvasion")); Enigma runEnigma = new Enigma(new RunEnigmaPanel(), "Roux run"); enigmas.Add(runEnigma); Enigma runEnigmaInverse = new Enigma(new RunEnigmaPanel(true), "Roux run encore"); runEnigmaInverse.AddPrerequisite(runEnigma); enigmas.Add(runEnigmaInverse); enigmas.Shuffle(); return(enigmas); }
public override void AddTrack(PlayableBase track) { base.AddTrack(track); Tracks.Add(track); ShuffleList?.Add(track); track.IsAdded = true; var tmr = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(500) }; tmr.Tick += (s, e) => { track.IsAdded = false; tmr.Stop(); }; tmr.Start(); }
public void SetQuestion(Question question) { this.question = question; questionInfo.text = question.question; List <string> ansOptions = ShuffleList.ShuffleListItems(question.options); for (int i = 0; i < options.Count; i++) { options[i].GetComponentInChildren <Text>().text = ansOptions[i]; options[i].name = ansOptions[i]; options[i].image.color = normalCol; } SetQuestionImage(question); answered = false; }
public static string GenerateNewPlayerName(string startingName, short pokerClientId, bool obfuscate) { string newPlayerName = ""; if (DatabaseMode.LOCALMODE.Equals(Mode)) { List <string> obfuscatedNames = new List <string>() { "Bob", "Alice", "Charlene", "Eve", "Tak", "Marc", "Matt", "Ailwyn", "Edmund", "Lucifer", "Denis", "Kent", "Clark", "Bruce", "Peter", "Nike", "Steve", "Rio", "Tony", "Stan" }; List <string> characters = new List <string>() { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }; //Check to see if we have created a player with this name before do { string tryName; if (obfuscate) { tryName = ShuffleList.Shuffle(obfuscatedNames)[0] + "-" + String.Join("", ShuffleList.Shuffle(characters).Take(3).ToArray()); } else { tryName = startingName + "-" + String.Join("", ShuffleList.Shuffle(characters).Take(3).ToArray()); } //Unique name check PokerPlayer playerDetails = playerDetailsByPlayerName(tryName, pokerClientId); if (playerDetails == null) { newPlayerName = tryName; break; } } while (true); } else { throw new NotImplementedException(); } return(newPlayerName); }
public void SetQuestion(QuizManager.Question question) { this.question = question; questionText.text = question.questionInfo; int index = quizManager.HowManyAnswered() + 1; questionIndex.text = index.ToString(); //shuffles answer options randomly List <string> answerList = ShuffleList.ShuffleListItems <string>(question.options); for (int i = 0; i < options.Count; i++) { options[i].GetComponentInChildren <Text>().text = answerList[i]; options[i].name = answerList[i]; options[i].image.color = normal; } answered = false; }
public void SetQuestion(QuizManager.Question question) { this.question = question; switch (question.questionType) { case QuizManager.QuestionType.TEXT: questionImage.transform.parent.gameObject.SetActive(false); break; case QuizManager.QuestionType.IMAGE: ImageHolder(); questionImage.transform.gameObject.SetActive(true); questionImage.sprite = question.questionImg; break; case QuizManager.QuestionType.VIDEO: ImageHolder(); questionVideo.transform.gameObject.SetActive(true); questionVideo.clip = question.questionVideo; questionVideo.Play(); break; case QuizManager.QuestionType.AUDIO: ImageHolder(); questionAudio.transform.gameObject.SetActive(true); break; } questionText.text = question.questionInfo; List <string> answerList = ShuffleList.ShuffleListItems <string>(question.options); for (int i = 0; i < options.Count; i++) { options[i].GetComponentInChildren <Text>().text = answerList[i]; options[i].name = answerList[i]; options[i].image.color = normalColor; } answered = false; }
public void LoadList(List <Card> myCards, bool shuffle = true, ClickEffect clickEffect = ClickEffect.nothing, Zones zone = Zones.master, bool forSale = false, bool free = true, int cap = -99) { List <Card> copyOfmyCards = new List <Card>(); int i = 0; copyOfmyCards.AddRange(myCards); if (shuffle) { ShuffleList.Shuffle <Card>(copyOfmyCards); } print(clickEffect); foreach (Card card in copyOfmyCards) { if (clickEffect == ClickEffect.upgrade && card.CanUpgrade == false) { continue; } GameObject newCard = Instantiate(ListItemPrefab) as GameObject; ListItemController controller = newCard.GetComponentInChildren <ListItemController>(); controller.myCard = card; controller.icon.sprite = card.mySprite; controller.clickEffect = clickEffect; controller.zone = zone; controller.free = free; if (forSale) { controller.UiText.text = "Cost: " + card.FactoryCost; } newCard.transform.SetParent(ControlPanel.transform, false); newCard.transform.localScale = Vector3.one; i++; if (i >= cap && cap > 0) { break; } } }
private void Ok() { // Méthode si l'utilisateur trouve la bonne réponse // Dimension des pictureBox pour les réponses pbxReponse1.Size = new Size(200, 200); pbxReponse2.Size = new Size(200, 200); pbxReponse3.Size = new Size(200, 200); // Insertion d'une image dans les pictureBox de réponse pbxReponse1.BackgroundImage = Properties.Resources.Bus_Reponse1; pbxReponse2.BackgroundImage = Properties.Resources.Bus_Reponse2; pbxReponse3.BackgroundImage = Properties.Resources.Bus_Reponse3; // Suppression de la mise en page de la question centerQuestion.Controls.Clear(); // Listage des réponses ShuffleList <PictureBox> lstPics = new ShuffleList <PictureBox>() { pbxReponse1, pbxReponse2, pbxReponse3 }; lstPics.Shuffle(); // Coordonées des objets centerQuestion.Controls.Add(pbxReponse1, 1, 2); centerQuestion.Controls.Add(pbxReponse2, 2, 2); centerQuestion.Controls.Add(pbxReponse3, 3, 2); lblEnigme.Text = "Bravo, mais moi je veux savoir pourquoi."; centerQuestion.Controls.Add(lblEnigme, 1, 1); t1.Tick += new EventHandler(Timer_Tick); // Démarrage du Timer pour écrire la réponse finale t1.Enabled = true; t1.Interval = 30000; }
public void AdicionarQuestao(IQuestao questao) { atualQuestao = questao; switch (questao.TipoDadosQuestao) { case TipoDadosQuestao.Texto: { m_txtAnunciado.transform.gameObject.SetActive(true); } break; case TipoDadosQuestao.Imagem: { m_imgAnuciado.transform.gameObject.SetActive(true); //questionImg.sprite = question.Imagem; } break; } //m_txtAnunciado.text = questao.Anunciado; if (questao.TipoQuestao == TipoQuestao.C) { QuestaoC q = questao as QuestaoC; m_txtAnunciado.text = q.Anunciado; List <string> respostas = ShuffleList.ShuffleListItems <string>(q.Opcoes); for (int i = 0; i < respostas.Count; i++) { m_listRespostas[i].GetComponentInChildren <Text>().text = respostas[i]; m_listRespostas[i].name = respostas[i]; m_listRespostas[i].image.color = m_colorNormal; } } respondido = false; }
/// <summary> /// Cette méthode permet de générer une liste de pièces de puzzle d'après un texte. /// /// Le texte est d'abord inséré dans un Label avec la police GenericMonospace de taille 72pt avant d'être découpé en plusieurs morceaux. /// </summary> /// <param name="text">Le texte à afficher</param> /// <param name="xCuts">Le nombre de pièces en largeur</param> /// <param name="yCuts">Le nombre de pièces en hauteur</param> /// <returns>Une liste de pièces contenant chacun une partie de l'image</returns> public static List <PuzzlePiece> GeneratePieces(string text, int xCuts, int yCuts) { ShuffleList <PuzzlePiece> pieces = new ShuffleList <PuzzlePiece>(); Size referenceRealSize = TextRenderer.MeasureText(text, new Font(FontFamily.GenericMonospace, 72)); int width = referenceRealSize.Width / xCuts; int height = referenceRealSize.Height / yCuts; for (int j = 0; j <= referenceRealSize.Height - height; j += height) { for (int i = 0; i <= referenceRealSize.Width - width; i += width) { Label label = new Label(); label.Text = text; label.Font = new Font(FontFamily.GenericMonospace, 72); label.AutoSize = true; PuzzlePiece piece = new PuzzlePiece(label, new Point(-i, -j)); piece.Size = new Size(width, height); pieces.Add(piece); } } pieces.Shuffle(); return(pieces); }
public override void Clear() { Tracks.Clear(); ShuffleList.Clear(); }
private void Ok() { // Méthode si l'utilisateur trouve la bonne réponse // Dimension des pictureBox pour les réponses pbxReponse1.Size = new Size(200, 200); pbxReponse2.Size = new Size(200, 200); pbxReponse3.Size = new Size(200, 200); // Insertion d'une image dans les pictureBox de réponse pbxReponse1.BackgroundImage = Properties.Resources.Bus_Reponse1; pbxReponse2.BackgroundImage = Properties.Resources.Bus_Reponse2; pbxReponse3.BackgroundImage = Properties.Resources.Bus_Reponse3; // Suppression de la mise en page de la question centerQuestion.Controls.Clear(); // Listage des réponses ShuffleList<PictureBox> lstPics = new ShuffleList<PictureBox>() {pbxReponse1, pbxReponse2, pbxReponse3}; lstPics.Shuffle(); // Coordonées des objets centerQuestion.Controls.Add(pbxReponse1, 1, 2); centerQuestion.Controls.Add(pbxReponse2, 2, 2); centerQuestion.Controls.Add(pbxReponse3, 3, 2); lblEnigme.Text = "Bravo, mais moi je veux savoir pourquoi."; centerQuestion.Controls.Add(lblEnigme, 1, 1); }
/// <summary> /// マップ全域を4x4のブロックに分け、部屋を作るブロックを選択する /// </summary> /// <returns></returns> List<int> ChooseBlocks() { var result = new List<int>(); var blockSource = new ShuffleList<int>(Rand); blockSource.AddRange(GeneralUtil.Range(16)); //blockSource.Draw(GameProperty.gameRand.Next(5, 10)); // 今は全ブロックをそのまま返す result.AddRange(blockSource.RemainList); return result; }
public IActionResult Get() { try { /* var taskModel = await Task.Run(() => * { * return db.TaskModel.ToList(); * });*/ var totalMinutes = 420; var minutesBeforeLunch = 180; var minutesAfterLunch = 240; var cumulativeMinutes = 0; var selectedTasks = new List <TaskModel>(); var morningTask = new List <TaskModel>(); var eveningTask = new List <TaskModel>(); var taskList = new List <TaskModel> { new TaskModel { Title = "Writing Fast Tests Against Enterprise Rails", Minutes = 60 }, new TaskModel { Title = "Overdoing it in Python", Minutes = 45 }, new TaskModel { Title = "Lua for the Masses", Minutes = 30 }, new TaskModel { Title = "Ruby Errors from Mismatched Gem Versions", Minutes = 45 }, new TaskModel { Title = "Common Ruby Errors", Minutes = 45 }, new TaskModel { Title = "Rails for Python Developers lightning", Minutes = 35 }, new TaskModel { Title = "Communicating Over Distance", Minutes = 60 }, new TaskModel { Title = "Accounting - Driven Development", Minutes = 45 }, new TaskModel { Title = "Woah", Minutes = 30 }, new TaskModel { Title = "Sit Down and Write", Minutes = 30 }, new TaskModel { Title = "Pair Programming vs Noise", Minutes = 45 }, new TaskModel { Title = "Rails Magic", Minutes = 60 }, new TaskModel { Title = "Ruby on Rails: Why We Should Move On ?", Minutes = 60 }, new TaskModel { Title = "Clojure Ate Scala(on my project)", Minutes = 45 }, new TaskModel { Title = "Programming in the Boondocks of Seattle", Minutes = 30 }, new TaskModel { Title = "Ruby vs.Clojure for Back - End Development", Minutes = 30 }, new TaskModel { Title = "Ruby on Rails Legacy App Maintenance", Minutes = 60 }, new TaskModel { Title = "A World Without HackerNews", Minutes = 30 }, new TaskModel { Title = "User Interface CSS in Rails Apps", Minutes = 30 } }; var shuffledList = ShuffleList.Shuffle <TaskModel>(taskList); foreach (var item in shuffledList) { var nextCumulativeMinutes = cumulativeMinutes + item.Minutes; if (cumulativeMinutes < totalMinutes) { cumulativeMinutes += item.Minutes; selectedTasks.Add(item); } else { break; } } var morningCumulativeMinutes = 0; foreach (var item in selectedTasks) { var nextCumulativeMinutes = morningCumulativeMinutes + item.Minutes; if (nextCumulativeMinutes < minutesBeforeLunch) { morningCumulativeMinutes += item.Minutes; morningTask.Add(item); selectedTasks.Remove(item); } } var eveningCumulativeMinutes = 0; foreach (var item in selectedTasks) { var nextCumulativeMinutes = eveningCumulativeMinutes + item.Minutes; if (nextCumulativeMinutes < minutesBeforeLunch) { eveningCumulativeMinutes += item.Minutes; eveningTask.Add(item); selectedTasks.Remove(item); } } var a = cumulativeMinutes; return(Ok(new { data = taskList })); } catch (Exception e) { throw; } }