private void Awake() { buttons = new List <Button>(); foreach (var option in SelectedDifficulty.GetOptions()) { InitializeButton(option); } }
private void SelectOption(Button button, string option) { foreach (var btn in buttons) { var color = btn == button ? selectedColor : normalColor; SetButtonColor(btn, color); } SelectedDifficulty.SetDifficulty(option); }
private void Awake() { Instance = this; waveIndex = -1; NextWaveTimer = nextWaveTime; audioSource = GetComponent <AudioSource>(); difficultyProgression = SelectedDifficulty.GetDifficulty(); normalWaves = JsonUtility.FromJson <WaveList>(normalWavesJson.text).waves; infiniteWaves = JsonUtility.FromJson <WaveList>(infiniteWavesJson.text).waves; }
private void InitializeButton(string option) { var button = Instantiate(buttonPrefab, transform).GetComponent <Button>(); button.GetComponentInChildren <Text>().text = option.ToUpper(); var color = option == SelectedDifficulty.GetDifficultyOption() ? selectedColor : normalColor; SetButtonColor(button, color); button.onClick.AddListener(() => SelectOption(button, option)); buttons.Add(button); }
void OnMouseOver() { if (GetComponent <TextMeshPro>().color != Color.red) { GetComponent <TextMeshPro>().color = OnMouseOverColor; mouseOver = true; if (Input.GetButton("Fire1")) { foreach (var item in difficulties) { SelectedDifficulty stuff = item.GetComponent <SelectedDifficulty>(); stuff.selected = false; } selected = true; GameObject.Find("Data").GetComponent <DataForPlayers>().difficulty = int.Parse(this.name); GetComponent <TextMeshPro>().color = OnMouseClickColor; } } }
private async Task <HttpResponseMessage> CreateManual() { JArray drawing = DrawViewModel.GetDrawing(); List <string> clues = new List <string>(); foreach (var hint in Hints) { clues.Add(hint.Hint.Trim()); } var newGame = new JObject(new JProperty("solution", Solution.Trim()), new JProperty("clues", clues.ToArray()), new JProperty("difficulty", SelectedDifficulty.ToLower()), new JProperty("drawing", drawing), new JProperty("displayMode", SelectedDisplayMode.ToLower()), new JProperty("side", SelectedPanoramicMode.ToLower())); var content = new StringContent(newGame.ToString(), Encoding.UTF8, "application/json"); return(await ServerService.instance.client.PostAsync(Constants.SERVER_PATH + Constants.GAMECREATOR_PATH, content)); }
private async Task <HttpResponseMessage> CreateAssisted2() { List <string> clues = new List <string>(); foreach (var hint in Hints) { if (hint.Hint.Length > 0) { clues.Add(hint.Hint.Trim()); } } var newGame = new JObject(new JProperty("solution", ObjectName.Trim()), new JProperty("clues", clues.ToArray()), new JProperty("difficulty", SelectedDifficulty.ToLower()), new JProperty("drawing", GeneratedImageStrokes), new JProperty("displayMode", SelectedDisplayMode), new JProperty("side", SelectedPanoramicMode.ToLower())); var content = new StringContent(newGame.ToString(), Encoding.UTF8, "application/json"); return(await ServerService.instance.client.PostAsync(Constants.SERVER_PATH + Constants.GAMECREATOR_PATH, content)); }
public override int GetHashCode() { int hash = 1; if (Guid.Length != 0) { hash ^= Guid.GetHashCode(); } hash ^= players_.GetHashCode(); if (leaderCase_ == LeaderOneofCase.Coordinator) { hash ^= Coordinator.GetHashCode(); } if (leaderCase_ == LeaderOneofCase.Player) { hash ^= Player.GetHashCode(); } if (selectedLevel_ != null) { hash ^= SelectedLevel.GetHashCode(); } if (selectedCharacteristic_ != null) { hash ^= SelectedCharacteristic.GetHashCode(); } if (SelectedDifficulty != global::TournamentAssistantShared.Models.BeatmapDifficulty.Easy) { hash ^= SelectedDifficulty.GetHashCode(); } hash ^= (int)leaderCase_; if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public async void ClickedNext() { OpentdbParams opentdbParams = new OpentdbParams(); if (SelectedCategoryIndex > 0) { opentdbParams.Category = "&category=" + (SelectedCategoryIndex + 8); } else { opentdbParams.Category = ""; } if (SelectedDifficulty == null || SelectedDifficulty.Equals("All difficulties", StringComparison.Ordinal)) { opentdbParams.Difficulty = ""; } else { opentdbParams.Difficulty = "&difficulty=" + SelectedDifficulty.ToLower(new CultureInfo("en-Us", false)); } if (SelectedAmount == 0) { opentdbParams.Amount = "&amount=3"; } else { opentdbParams.Amount = "&amount=" + selectedAmount; } RootObject rootObject = await ExternalRequest.GetQuizzesFromExternal(opentdbParams).ConfigureAwait(true); if (rootObject == null) { DisplayErrorMessageAsync("Didn't find enough quizzes to match your request!"); return; } Quiz quiz = new Quiz(); quiz.QuizName = SelectedCategoryItem + " Quiz"; quiz.QuizCategory = SelectedCategoryItem; foreach (var opentdbQuestion in rootObject.results) { Question question = new Question(); question.QuestionText = System.Web.HttpUtility.HtmlDecode(opentdbQuestion.question); question.CorrectAnswerNumber = 1; question.AnswersList.Add(new Answer(System.Web.HttpUtility.HtmlDecode(opentdbQuestion.correct_answer), question, 1, 0)); int i = 2; foreach (var answer in opentdbQuestion.incorrect_answers) { question.AnswersList.Add(new Answer(System.Web.HttpUtility.HtmlDecode(answer), question, i++, 0)); } quiz.QuestionList.Add(question); } QuizCompletionParams q = new QuizCompletionParams(); q.Quiz = quiz; q.QuestionToHandle = 1; if (quiz.QuestionList.Count == 0) { DisplayErrorMessageAsync("Didn't find enough quizzes to match your request!"); return; } foreach (var question in quiz.QuestionList) { ScrambleAnswers(question); } NavigationService.Navigate(typeof(TakeQuiz), q); }
private void HandleOptions(KeyboardState currentKeyboardState, KeyboardState previousKeyboardState) { if ((currentKeyboardState.IsKeyDown(Keys.Down) && !previousKeyboardState.IsKeyDown(Keys.Down)) | (currentKeyboardState.IsKeyDown(Keys.S) && !previousKeyboardState.IsKeyDown(Keys.S))) { selectCount++; if (selectCount >= 5) selectCount = 1; } else if ((currentKeyboardState.IsKeyDown(Keys.Up) && !previousKeyboardState.IsKeyDown(Keys.Up)) | (currentKeyboardState.IsKeyDown(Keys.W) && !previousKeyboardState.IsKeyDown(Keys.W))) { selectCount--; if (selectCount <= 0) selectCount = 4; } switch (selectCount) { case 1: //Difficulty if ((currentKeyboardState.IsKeyDown(Keys.Space) && !previousKeyboardState.IsKeyDown(Keys.Space)) | (currentKeyboardState.IsKeyDown(Keys.Enter) && !previousKeyboardState.IsKeyDown(Keys.Enter)) | (currentKeyboardState.IsKeyDown(Keys.Right) && !previousKeyboardState.IsKeyDown(Keys.Right)) | (currentKeyboardState.IsKeyDown(Keys.D) && !previousKeyboardState.IsKeyDown(Keys.D))) { difficultyCount++; if (difficultyCount >= 4) difficultyCount = 1; } else if ((currentKeyboardState.IsKeyDown(Keys.Left) && !previousKeyboardState.IsKeyDown(Keys.Left)) | (currentKeyboardState.IsKeyDown(Keys.A) && !previousKeyboardState.IsKeyDown(Keys.A))) { difficultyCount--; if (difficultyCount <= 0) difficultyCount = 3; } if (difficultyCount == 1) { selectedDifficulty = SelectedDifficulty.Easy; health.startLifes = 5; } else if (difficultyCount == 2) { selectedDifficulty = SelectedDifficulty.Medium; health.startLifes = 3; } else if (difficultyCount == 3) { selectedDifficulty = SelectedDifficulty.Hard; health.startLifes = 1; } if (selectedDifficulty == SelectedDifficulty.Easy) DifficultyColor2 = new Color(124, 252, 0); else if (selectedDifficulty == SelectedDifficulty.Medium) DifficultyColor2 = new Color(255, 165, 0); else if (selectedDifficulty == SelectedDifficulty.Hard) DifficultyColor2 = new Color(255, 0, 0); DifficultyColor1 = SelectedColor; CharacterColor = UnselectedColor; MusicColor = UnselectedColor; BackColor = UnselectedColor; break; case 2: //Character if ((currentKeyboardState.IsKeyDown(Keys.Space) && !previousKeyboardState.IsKeyDown(Keys.Space)) | (currentKeyboardState.IsKeyDown(Keys.Enter) && !previousKeyboardState.IsKeyDown(Keys.Enter)) | (currentKeyboardState.IsKeyDown(Keys.Right) && !previousKeyboardState.IsKeyDown(Keys.Right)) | (currentKeyboardState.IsKeyDown(Keys.D) && !previousKeyboardState.IsKeyDown(Keys.D))) { characterCount++; if (characterCount >= 4) characterCount = 1; } else if ((currentKeyboardState.IsKeyDown(Keys.Left) && !previousKeyboardState.IsKeyDown(Keys.Left)) | (currentKeyboardState.IsKeyDown(Keys.A) && !previousKeyboardState.IsKeyDown(Keys.A))) { characterCount--; if (characterCount <= 0) characterCount = 3; } if (characterCount == 1) { Character.playerTexture = Game1.character1Texture; selectedCharacter = "Bandit"; } else if (characterCount == 2) { Character.playerTexture = Game1.character2Texture; selectedCharacter = "Jos"; } else if (characterCount == 3) { Character.playerTexture = Game1.character3Texture; selectedCharacter = "Maarten"; } DifficultyColor1 = UnselectedColor; CharacterColor = SelectedColor; MusicColor = UnselectedColor; BackColor = UnselectedColor; break; case 3: //Music if ((currentKeyboardState.IsKeyDown(Keys.Space) && !previousKeyboardState.IsKeyDown(Keys.Space)) | (currentKeyboardState.IsKeyDown(Keys.Enter) && !previousKeyboardState.IsKeyDown(Keys.Enter)) | (currentKeyboardState.IsKeyDown(Keys.Right) && !previousKeyboardState.IsKeyDown(Keys.Right)) | (currentKeyboardState.IsKeyDown(Keys.D) && !previousKeyboardState.IsKeyDown(Keys.D))) { songCount++; if (songCount >= 7) songCount = 1; } else if ((currentKeyboardState.IsKeyDown(Keys.Left) && !previousKeyboardState.IsKeyDown(Keys.Left)) | (currentKeyboardState.IsKeyDown(Keys.A) && !previousKeyboardState.IsKeyDown(Keys.A))) { songCount--; if (songCount <= 0) songCount = 6; } if ((currentKeyboardState.IsKeyDown(Keys.Space) && !previousKeyboardState.IsKeyDown(Keys.Space)) | (currentKeyboardState.IsKeyDown(Keys.Enter) && !previousKeyboardState.IsKeyDown(Keys.Enter)) | (currentKeyboardState.IsKeyDown(Keys.Right) && !previousKeyboardState.IsKeyDown(Keys.Right)) | (currentKeyboardState.IsKeyDown(Keys.D) && !previousKeyboardState.IsKeyDown(Keys.D)) | (currentKeyboardState.IsKeyDown(Keys.Left) && !previousKeyboardState.IsKeyDown(Keys.Left)) | (currentKeyboardState.IsKeyDown(Keys.A) && !previousKeyboardState.IsKeyDown(Keys.A))) { //Change music if (songCount == 1) { Game1.PlayMusic(Game1.soundtrackSong); selectedSong = "Soundtrack"; } else if (songCount == 2) { MediaPlayer.Stop(); selectedSong = "None"; } else if (songCount == 3) { Game1.PlayMusic(Game1.rapidSong); selectedSong = "Rapid"; } else if (songCount == 4) { Game1.PlayMusic(Game1.rickSong); selectedSong = "Rick Roll"; } else if (songCount == 5) { Game1.PlayMusic(Game1.littleSong); selectedSong = "Little"; } else if (songCount == 6) { Game1.PlayMusic(Game1.slagsmalklubbenSong); selectedSong = "Slagsmalklubben"; } } DifficultyColor1 = UnselectedColor; CharacterColor = UnselectedColor; MusicColor = SelectedColor; BackColor = UnselectedColor; break; case 4: //back if ((currentKeyboardState.IsKeyDown(Keys.Space) && !previousKeyboardState.IsKeyDown(Keys.Space)) | (currentKeyboardState.IsKeyDown(Keys.Enter) && !previousKeyboardState.IsKeyDown(Keys.Enter))) { game.gameState = Prototype.Game1.GameState.mainmenu; } DifficultyColor1 = UnselectedColor; CharacterColor = UnselectedColor; MusicColor = UnselectedColor; BackColor = SelectedColor; break; } }