public virtual void Start() { canvasGroup = GetComponent<CanvasGroup>(); randomWord = FindObjectOfType<RandomWord>(); canvasGroup.alpha = 0; canvasGroup.interactable = false; //SetButtons(); textField.text = randomSentence(); }
private void OutputWords(RandomWord wd, enWordType wordType, int numWordsToGenerate) { wd.WordType = wordType; for (int i = 0; i < 10; i++) { _msg.Length = 0; _msg.Append("WordType "); _msg.Append(wd.WordType.ToString()); _msg.Append(": "); _msg.Append(wd.GetWord()); _messageLog.WriteLine(_msg.ToString()); } }
static void Main(string[] args) { var listOfThreeWord = ClassOfRockPapSis.PlayList; string user; int points = 0; int lost = 0; Console.WriteLine("GAME: ROCK - PAPER - SCISSORS"); Console.WriteLine("___________________________________"); Console.ReadLine(); //Console.WriteLine("YOU MUST ONLY WRITE: ROCK, PAPER or SCISSORS"); Console.WriteLine("----------------------------------------"); Console.WriteLine("For exit press: escape, For Continue: enter"); Console.WriteLine("----------------------------------------"); Console.WriteLine("Press Enter for start the Game"); Console.WriteLine("----------------------------------------"); while (Console.ReadKey().Key != ConsoleKey.Escape) { Console.WriteLine("WRITE: ROCK, PAPER or SCISSORS"); Console.WriteLine("----------------------------------------"); user = Console.ReadLine().ToUpper().Trim(); if (user != "ROCK" && user != "PAPER" && user != "SCISSORS") { Console.WriteLine("WRONG WORD"); } else { Console.WriteLine($"{RandomWord.SomeText(listOfThreeWord)}"); if (user == RandomWord.SomeText(listOfThreeWord)) { points = points + 1; } else { lost = lost - 1; } } } Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine($"Winner Points: --{points}"); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"Lost Points: -{lost}"); Console.ReadLine(); }
static void GeneratePseudoWord(int min, int max, int vovel, string charset, string dict) { RandomWord rw = new RandomWord(); rw.MinLetters = min; rw.MaxLetters = max; rw.VovelRandom = vovel; rw.Libs.LoadCharSet(charset); rw.Libs.LoadDict(dict); Console.WriteLine(rw.NewWord); Console.Read(); Console.Clear(); GenerateStaticString(); AwaitAction(); }
// Start is called before the first frame update void Start() { int i; aux = new List <Text>(); chosenWord = RandomWord.getWords(); // RandomWord.getWords() usado para escolher uma palavra aleatoria na lista de palavras. PlayerPrefs.SetString("resposta", chosenWord); // Adicionando a resposta no PlayerPrefs. for (i = 0; i < chosenWord.Length; i++) { GameObject letter = Instantiate(letterPrefab, letterParent) as GameObject; // Instanciando GameObject com parent definido. aux.Add(letter.GetComponent <Text>()); // Inicializando texto da palavra. } boolTest = new Boolean[chosenWord.Length]; // Inicializando for (i = 0; i < boolTest.Length; i++) // vetor de booleanos { // para verificao boolTest[i] = false; // das proximas etapas } }
/// <summary> /// Initializes the values on the view and retrieves a random word /// from the wordnik.com web api /// </summary> private async void RunSetup() { // Put the parameters together for the api call StringBuilder parameters = new StringBuilder(); parameters.Append($"hasDictionaryDef={hasDictionaryDefinition}"); parameters.Append($"&minCorpusCount={minCorpusCount}"); parameters.Append($"&minLength={minLength}"); parameters.Append($"&maxLength={maxLength}"); parameters.Append($"&limit={limit}"); parameters.Append($"&api_key={apiKey}"); var responseData = await httpClient.GetAsync(baseUrl + parameters.ToString()).ConfigureAwait(false); var responseText = await responseData.Content.ReadAsStringAsync().ConfigureAwait(false); /* This is where some magic happens. The web api returns a Json object containing the * random word. Using the Newtonsoft.Json library, I can really simply deserialize the * Json object into a C#.Net object. Check the RandomWord class definition. */ RandomWord randomWord = JsonConvert.DeserializeObject <RandomWord>( responseText.TrimStart('[').TrimEnd(']')); // Trim is needed for correct parsing // Put all the letters of the random word into the list of secret letters foreach (var c in randomWord.Word) { secretLetters.Add(char.ToUpper(c)); } // Mask the letters so the user has to guess displayedLetters = PrepareLetters(secretLetters); // Need to use Dispatcher because the UI is on a different thread this.Dispatcher.Invoke(() => { // A custom extension method spaces the characters nicely. Check Extensions.cs for details. secretWord.Text = displayedLetters.ToHangmanString(); // Enables the buttons after a word has been set EnableButtons(); }); }
public override void SetName() { gameObject.name = "ENEMY LOCATION:" + RandomWord.Adjective() + " " + RandomWord.Noun(); }
public virtual void SetName() { gameObject.name = RandomWord.Adjective() + " " + RandomWord.Noun(); }