void UpdateTextureColors() { if (coloredWords.Count == 0) { return; } Color[] pixelData = backgroundTexture.GetPixels(); int iterator = pixelData.Length - 1; int numRows = textureSize / coloredWords.Count; for (int i = 0; i < coloredWords.Count; i++) { ColorScheme curColor = EmotionColorPicker.GetColorSchemeForWord(coloredWords[i]); Debug.Log(curColor.colorName); for (int j = 0; j < numRows; j++) { for (int k = 0; k < textureSize; k++) { pixelData[iterator] = curColor.background; iterator--; } } } backgroundTexture.SetPixels(pixelData); backgroundTexture.Apply(); }
public WordData() { this.word = NodeServerManager.GetLastUnconfirmedWord(); this.volume = MicVolume.MicLoudness; ColorScheme scheme = EmotionColorPicker.GetColorSchemeForWord(NodeServerManager.GetLastUnconfirmedWord()); Debug.Log(scheme.colorName); this.colorType = (WordDataManager.WordData.ColorType)System.Enum.Parse(typeof(WordDataManager.WordData.ColorType), scheme.colorName); }
void CheckNewWords() { fullText.text = NodeServerManager.confirmedFullText + " " + NodeServerManager.currentPossibleText; string[] confirmedWords = NodeServerManager.GetConfirmedWords(); foreach (string word in confirmedWords) { ColorScheme wordColor = EmotionColorPicker.GetColorSchemeForWord(word); if (word != "" && wordColor.colorName != "None" && wordColor.colorName != "error" && coloredWords.IndexOf(word) == -1) { coloredWords.Add(word); } } currentWord.text = NodeServerManager.GetLastUnconfirmedWord(); if (currentWord.text == "") { currentWord.text = NodeServerManager.GetLastConfirmedWord(); } UpdateTextureColors(); }
void UpdateText() { // Fill out text as it comes in fullText.text = NodeServerManager.confirmedFullText + " " + NodeServerManager.currentPossibleText; // Prevent ourselves from transitioning mid transition if (!transitioningBackgroundColor) { // Cut words into an arry and then look at last word of array string[] separatedWords = fullText.text.Split(" ".ToCharArray()); string currentWord = separatedWords[separatedWords.Length - 1]; if (currentWord != "") { displayText.text = currentWord; ColorScheme newScheme = EmotionColorPicker.GetColorSchemeForWord(currentWord); if (newScheme.colorName != "error") { StartCoroutine(LerpColors(newScheme)); } } } }