private void Awake() { rectTransform = textLabel.GetComponent <RectTransform>(); textFader = textLabel.GetComponent <TextLabelFader>(); textFader.OnFadeCompleted += OnFadeCompleted; }
private void MasterClientSwitched(Player newMaster) { if (ThisIsMasterClient()) { playerNameText.GetComponent <TMPro.TextMeshProUGUI>().fontStyle = masterClientFont; } else { playerNameText.GetComponent <TMPro.TextMeshProUGUI>().fontStyle ^= masterClientFont; } }
private void SetDisabled(bool disabled = true) { float targetAlpha; if (disabled) { targetAlpha = 0.25f; } else { targetAlpha = 1; } foreach (var image in images) { Color color = image.color; color.a = targetAlpha; image.color = color; } TextStyler textStyler = text.GetComponent <TextStyler>(); if (textStyler != null) { textStyler.AlphaMultiplier = targetAlpha; } }
public void Initialize(OpCode op) { this.command = op; this.revealed = false; this.obfuscator.SetActive(true); transform.SetAsLastSibling(); instructionHeader = transform.Find("Header").GetComponentInChildren <TMPro.TextMeshProUGUI>(); instructionHeader.text = command.ToString(); instructionDescription = transform.Find("Description").GetComponentInChildren <TMPro.TextMeshProUGUI>(); GameObject instructionObj = PuzzleGenerator.GetComponent <InstructionFactory>().SpawnInstruction(this.command, instructionHeader.transform); instructionDescription.text = instructionObj.GetComponent <Command>().Description; // Get rid of unnecessary components Destroy(instructionObj.GetComponent <UIControl>()); Destroy(instructionObj.GetComponent <DragNDrop>()); Destroy(instructionObj.GetComponent <GraphicRaycaster>()); Destroy(instructionObj.GetComponent <Canvas>()); instructionObj.GetComponent <RectTransform>().anchorMin = Vector2.zero; instructionObj.GetComponent <RectTransform>().anchorMax = Vector2.one; instructionObj.GetComponent <RectTransform>().sizeDelta = Vector2.zero; instructionObj.GetComponent <RectTransform>().anchoredPosition = instructionHeader.GetComponent <RectTransform>().anchoredPosition; instructionObj.GetComponent <RectTransform>().localScale = new Vector3(1.75f, 1.75f, 1.75f); }
void CreateNameText() { string playerName = photonView.Owner.NickName; GameObject nameTextGO = new GameObject("player_" + playerName); playerNameText = nameTextGO.AddComponent <TMPro.TextMeshProUGUI>(); Canvas canvas = GameObject.FindWithTag(playerNamesCanvasTag).GetComponent <Canvas>(); playerNameText.transform.SetParent(canvas.transform); playerNameText.text = playerName; playerNameText.font = Resources.Load("Fonts/gothic_pixel_SDF", typeof(TMPro.TMP_FontAsset)) as TMPro.TMP_FontAsset; playerNameText.rectTransform.localScale = new Vector3(1, 1, 1); playerNameText.alignment = TMPro.TextAlignmentOptions.Midline; playerNameText.rectTransform.localScale = new Vector2(0.1f, 0.1f); playerNameText.fontSize = nameFontSize; if (ThisIsMasterClient()) { playerNameText.GetComponent <TMPro.TextMeshProUGUI>().fontStyle = masterClientFont; } UpdateNameTextPosition(); }
private void Start() { _shadowLeft = Instantiate(_textMesh, transform.parent); Destroy(_shadowLeft.GetComponent <ShadedText>()); _shadowLeft.color = colorLeft; _shadowLeft.rectTransform.anchoredPosition = _shadowLeft.rectTransform.anchoredPosition + Vector2.left * offset; _shadowRight = Instantiate(_textMesh, transform.parent); Destroy(_shadowRight.GetComponent <ShadedText>()); _shadowRight.color = colorRight; _shadowRight.rectTransform.anchoredPosition = _shadowRight.rectTransform.anchoredPosition + Vector2.right * offset; _shadowUp = Instantiate(_textMesh, transform.parent); Destroy(_shadowUp.GetComponent <ShadedText>()); _shadowUp.color = colorUp; _shadowUp.rectTransform.anchoredPosition = _shadowUp.rectTransform.anchoredPosition + Vector2.up * offset; _shadowDown = Instantiate(_textMesh, transform.parent); Destroy(_shadowDown.GetComponent <ShadedText>()); _shadowDown.color = colorDown; _shadowDown.rectTransform.anchoredPosition = _shadowDown.rectTransform.anchoredPosition + Vector2.down * offset; transform.SetAsLastSibling(); _initialized = true; }
// Use this for initialization void Start() { thisText = GetComponent <TMPro.TextMeshProUGUI>(); if (referenceText == null) { foreach (TMPro.TextMeshProUGUI tmpu in transform.parent.GetComponentsInChildren <TMPro.TextMeshProUGUI>()) { if (tmpu != thisText) { referenceText = tmpu; break; } } } linkedLayout = referenceText.linkedTextComponent.GetComponent <LayoutElement>(); referenceLayout = referenceText.GetComponent <LayoutElement>(); }
// Start is called before the first frame update void Start() { TMPro.TextMeshProUGUI text = GameObject.Find("Canvas").GetComponentInChildren <TMPro.TextMeshProUGUI>(); timer = text.GetComponent <Timer>(); lm = gameObject.GetComponent <LevelManager>(); playerStats = gameObject.GetComponent <PlayerStats>(); player = GameObject.Find("Player"); }
private void OnStateCollapse() { //string selectedAxis = currentIndex >= 5 ? Random.value < 0.5f ? "x" : "z" : tmp.text.ToLower(); string selectedAxis = currentIndex >= 5 ? UnityQASM.unityQASM.GetRandomBool() ? "x" : "z" : tmp.text.ToLower(); bool isX = selectedAxis == "x"; bool currentBaseIsX = referenceQBits[currentIndex].qBase.ToLower() == "x"; bool readSuccess = isX == currentBaseIsX; QBitInfo qBitInfo = new QBitInfo(); if (!readSuccess) { qBitInfo.SetRandom(); qBitInfo.qBase = tmp.text; } else { qBitInfo = referenceQBits[currentIndex]; if (isEva) { gameData.evaSuccessCount++; } else { gameData.bobSuccessCount++; } } if (isEva) { gameData.evaReadQBitsInfo.Add(qBitInfo); } else { gameData.bobReadQBitsInfo.Add(qBitInfo); } tmp.GetComponent <SwitchState>().Restart(); if (currentIndex < 5) { managers[currentIndex].QValue = qBitInfo.qValue; managers[currentIndex].QBase = qBitInfo.qBase; reader.sprite = isX ? readX : readZ; animator.SetTrigger("Read"); } currentIndex++; if (currentIndex == 5) { for (int i = 0; i < 15; i++) { OnStateCollapse(); } } }
protected override void OnAwake() { _mainCamera = Camera.main; _animFade = Animator.StringToHash("fade"); _animPopMenuBar = Animator.StringToHash("pop"); _animPopOverview = Animator.StringToHash("pop"); _gameCommands = new Queue <GameCommand>(); _planetTextAnimator = _planetText.GetComponent <Animator>(); _depthOfField = _postProcessVolume.profile.GetSetting <DepthOfField>(); }
private void Update() { totalScoreText.text = "Total Score: " + scoreCounter.totalScore; if (!TimerScript.keepTiming && !TimerScript.flashing) { totalScoreText.GetComponent <RectTransform>().anchoredPosition = showVector; } else if (TimerScript.flashing && !localFlashing) { localFlashing = true; flashTotalScoreScript(); } else if (!TimerScript.flashing) { totalScoreText.GetComponent <RectTransform>().anchoredPosition = hideVector; } }
public void Init(TMPro.TextMeshProUGUI textLabel) { this.textLabel = textLabel; rectTransform = textLabel.GetComponent <RectTransform>(); //Reset text color alpha Color textColor = textLabel.color; textColor.a = 1; textLabel.color = textColor; }
private void Awake() { if (box == null) { box.GetComponent <TMPro.TextMeshProUGUI>(); } if (box != null) { box.text = string.Empty; } }
public void OnLineUpdate(string word) { int indexOfColon = word.IndexOf(':'); string name = word.Substring(0, indexOfColon); string text = word.Substring(indexOfColon + 2, word.Length - indexOfColon - 2); m_nameText.text = name; LayoutRebuilder.ForceRebuildLayoutImmediate(m_nameText.GetComponent <RectTransform>()); StartCoroutine(DoUpdateText(text, m_stringBuilder)); }
void Awake() { m_textRectTransform = MarqueeText.GetComponent<RectTransform>(); MarqueeText.text = message; cloneObject = Instantiate(MarqueeText) as TextMeshProUGUI; RectTransform cloneRectTransform = cloneObject.GetComponent<RectTransform>(); cloneRectTransform.SetParent(m_textRectTransform); //m_textRectTransform.position = new Vector3(MarqueeText.preferredWidth, 0, 0); cloneRectTransform.anchorMin = new Vector2(1, 0.5f); cloneRectTransform.localScale = new Vector3(1, 1, 1); }
void Start() { currentLevel = 0; pm = gameObject.GetComponent <PlayerMovement>(); pd = gameObject.GetComponent <ProcessData>(); logWritter = gameObject.GetComponent <LogWritter>(); playerStats = gameObject.GetComponent <PlayerStats>(); TMPro.TextMeshProUGUI text = GameObject.Find("Canvas").GetComponentInChildren <TMPro.TextMeshProUGUI>(); timer = text.GetComponent <Timer>(); mp = gameObject.GetComponent <MenuPause>(); }
void UpdateSelectionRayAndReticle() { Vector2 reticleVec; if (ShouldUseCursorForSelectionRay()) { selectionRay = GetCamera().ScreenPointToRay(Input.mousePosition); RectTransformUtility.ScreenPointToLocalPointInRectangle(hudRect, Input.mousePosition, null, out reticleVec); reticleFeedbackRect.anchoredPosition = reticleVec; reticleLabel.alignment = TMPro.TextAlignmentOptions.Left; reticleLabel.GetComponent <RectTransform>().anchoredPosition = new Vector2(40, 0); } else { reticleFeedbackRect.anchoredPosition = Vector2.zero; reticleLabel.alignment = TMPro.TextAlignmentOptions.Center; reticleLabel.GetComponent <RectTransform>().anchoredPosition = new Vector2(0, -30); selectionRay = GetCamera().ViewportPointToRay(navigationControls.GetDefaultSelectionPoint()); } }
public void SetText(string text) { textMesh.GetComponent <UnityEngine.UI.LayoutElement>().preferredWidth = maxWidth; textMesh.rectTransform.sizeDelta.Set(maxWidth, 100); textMesh.SetText(text); var bounds = textMesh.GetPreferredValues(); //textMesh.ForceMeshUpdate(); //Debug.Log(bounds); //bounds.x += 2*marginX; //bounds.y += 2*marginY; //image.rectTransform.sizeDelta = bounds; textMesh.GetComponent <UnityEngine.UI.LayoutElement>().preferredWidth = Mathf.Min(maxWidth, bounds.x); if (secondsPerCharacter > 0) { textMesh.maxVisibleCharacters = 1; textBuildDelta = 0f; } }
private void Start() { animatorTextTurn = textTurn.GetComponent <Animator>(); currentMask = debugInterlocutor; currentInterlocutor = characterIntro; DrawHUD(); dialogueManager.OnDialogueEnd += EndDiscussionIntro; DiscussionIntro(); introDialog.RemoveAt(0); }
void Start() { plasticBagScore = plasticBagScore.GetComponent <TMPro.TextMeshProUGUI>(); plasticBottleScore = plasticBottleScore.GetComponent <TMPro.TextMeshProUGUI>(); plasticBagNumber = plasticBagNumber.GetComponent <TMPro.TextMeshProUGUI>(); plasticBottleNumber = plasticBottleNumber.GetComponent <TMPro.TextMeshProUGUI>(); timeNumber = timeNumber.GetComponent <TMPro.TextMeshProUGUI>(); timeScore = timeScore.GetComponent <TMPro.TextMeshProUGUI>(); scoreText = scoreText.GetComponent <TMPro.TextMeshProUGUI>(); glassBottleScore = glassBottleScore.GetComponent <TMPro.TextMeshProUGUI>(); glassBottleNumber = glassBottleNumber.GetComponent <TMPro.TextMeshProUGUI>(); time = time.GetComponent <TMPro.TextMeshProUGUI>(); }
IEnumerator WinVisualsTextRoutine(byte playerId) { var canvasGroup = winLoseText.GetComponent <CanvasGroup>(); // Enable the text winLoseText.gameObject.SetActive(true); // Start fade in canvasGroup.DOFade(1.0f, 1.0f); // If is is us who won if (NetworkManager.IsMe(playerId)) { winLoseText.text = "YOU WIN"; float timer = 0.0f; float hue = 0.0f; // Randomize the glow color for 5 seconds while (timer < 5.0f) { timer += Time.deltaTime; hue = Mathf.Repeat(hue += Time.deltaTime, 1.0f); winLoseText.materialForRendering.SetColor("_FaceColor", Color.HSVToRGB(hue, 1.0f, 1.0f)); yield return(null); } } // If the other player won (we lost) else if (NetworkManager.IsOther(playerId)) { winLoseText.text = "YOU LOSE"; winLoseText.materialForRendering.SetColor("_FaceColor", Color.red); yield return(new WaitForSeconds(5.0f)); } // If this coroutine was sent a playerId of zero, it was a stalemate else { winLoseText.text = "STALEMATE!"; winLoseText.materialForRendering.SetColor("_FaceColor", Color.red); yield return(new WaitForSeconds(5.0f)); } // Fade out and yield yield return(canvasGroup.DOFade(0.0f, 1.0f).WaitForCompletion()); // Disable the text winLoseText.gameObject.SetActive(false); }
void Start() { pd = gameObject.GetComponent <ProcessData>(); // nbCoins = 0; startingTime = DateTime.Now; // Initialize dictionary of level information levelInfo.Add("Level0", Tuple.Create(6, 20.0f)); levelInfo.Add("Level1", Tuple.Create(7, 30.0f)); levelInfo.Add("Level2", Tuple.Create(4, 40.0f)); levelInfo.Add("Level3", Tuple.Create(5, 50.0f)); coinsTotal = levelInfo["Level" + currentLevel].Item1; // // temps optimal adapté au ratio temps du joueur // timeOptimal = levelInfo["Level" + currentLevel].Item2 + (levelInfo["Level" + currentLevel].Item2 * (1 - pd.timeRatioList[pd.timeRatioList.Count - 1])); text = GameObject.Find("Canvas").GetComponentInChildren <TMPro.TextMeshProUGUI>(); timer = text.GetComponent <Timer>(); }
// Start is called before the first frame update void Start() { //Get component for each object, allows functions to be performed on them mainMenu = mainMenu.GetComponent <Canvas>(); settingsScreen = settingsScreen.GetComponent <Canvas>(); howToPlay = howToPlay.GetComponent <Canvas>(); quitScreen = quitScreen.GetComponent <Canvas>(); bounceSound.GetComponent <AudioSource>(); startButton = startButton.GetComponent <Button>(); settingsButton = settingsButton.GetComponent <Button>(); HTPButton = HTPButton.GetComponent <Button>(); closeHTPButton = closeHTPButton.GetComponent <Button>(); quitButton = quitButton.GetComponent <Button>(); backToMain = backToMain.GetComponent <Button>(); muteToggle = muteToggle.GetComponent <Toggle>(); fullScreenToggle = fullScreenToggle.GetComponent <Toggle>(); //Set the default screen mainMenu.enabled = true; settingsScreen.enabled = false; quitScreen.enabled = false; howToPlay.enabled = false; homeHelp = homeHelp.GetComponent <Button>(); rosterHelp = rosterHelp.GetComponent <Button>(); generalHelp = generalHelp.GetComponent <Button>(); standingsHelp = standingsHelp.GetComponent <Button>(); generalText = generalText.GetComponent <TMPro.TextMeshProUGUI>(); rosterText = rosterText.GetComponent <TMPro.TextMeshProUGUI>(); standingsText = standingsText.GetComponent <TMPro.TextMeshProUGUI>(); homeText = homeText.GetComponent <TMPro.TextMeshProUGUI>(); generalText.enabled = true; rosterText.enabled = false; standingsText.enabled = false; homeText.enabled = false; }
void Start() { plasticBottleText.GetComponent <TMPro.TextMeshProUGUI>(); plasticBagText.GetComponent <TMPro.TextMeshProUGUI>(); glassBottleText.GetComponent <TMPro.TextMeshProUGUI>(); }
public void SetItemDescription(string newDescription) { itemDescriptionPrefab.GetComponent <TMPro.TextMeshProUGUI>().text = newDescription; currentDescription = newDescription; }
void Start() { maskRT = GetComponent <RectTransform>(); textRT = message.GetComponent <RectTransform>(); }
private void Awake() { ui = magazineText.GetComponent <UIBase>(); ui.renderer = magazineText; ui.SetValue = () => magazineText.text = magazine.ToString(); }
//public AudioSource bounceSound; // Start is called before the first frame update void Start() { //Assign variables to placeholders buttonLayout = buttonLayout.GetComponent <Canvas>(); homeScreen = homeScreen.GetComponent <Canvas>(); settingsScreen = settingsScreen.GetComponent <Canvas>(); rosterScreen = rosterScreen.GetComponent <Canvas>(); tradeScreen = tradeScreen.GetComponent <Canvas>(); lineUpScreen = lineUpScreen.GetComponent <Canvas>(); standingsScreen = standingsScreen.GetComponent <Canvas>(); statsScreen = statsScreen.GetComponent <Canvas>(); confirmQuit = confirmQuit.GetComponent <Canvas>(); rosterDropdowns = rosterDropdowns.GetComponent <Canvas>(); standingsDropdowns = standingsDropdowns.GetComponent <Canvas>(); settingsDropDowns = settingsDropDowns.GetComponent <Canvas>(); //bounceSound.GetComponent<AudioSource>(); homeButton = homeButton.GetComponent <Button>(); rosterButton = rosterButton.GetComponent <Button>(); standingsButton = standingsButton.GetComponent <Button>(); settingsButton = settingsButton.GetComponent <Button>(); quitButton = quitButton.GetComponent <Button>(); continueButton = continueButton.GetComponent <Button>(); yesQuit = yesQuit.GetComponent <Button>(); noQuit = noQuit.GetComponent <Button>(); rosterView = rosterView.GetComponent <Button>(); tradeFinder = tradeFinder.GetComponent <Button>(); lineupEditor = lineupEditor.GetComponent <Button>(); leagueRankings = leagueRankings.GetComponent <Button>(); teamStats = teamStats.GetComponent <Button>(); gameSettingsButton = gameSettingsButton.GetComponent <Button>(); htpButton = htpButton.GetComponent <Button>(); muteToggle = muteToggle.GetComponent <Toggle>(); fullScreenToggle = fullScreenToggle.GetComponent <Toggle>(); homeHelp = homeHelp.GetComponent <Button>(); rosterHelp = rosterHelp.GetComponent <Button>(); generalHelp = generalHelp.GetComponent <Button>(); standingsHelp = standingsHelp.GetComponent <Button>(); generalText = generalText.GetComponent <TMPro.TextMeshProUGUI>(); rosterText = rosterText.GetComponent <TMPro.TextMeshProUGUI>(); standingsText = standingsText.GetComponent <TMPro.TextMeshProUGUI>(); homeText = homeText.GetComponent <TMPro.TextMeshProUGUI>(); //Set the default screen buttonLayout.enabled = true; homeScreen.enabled = true; settingsScreen.enabled = false; rosterScreen.enabled = false; lineUpScreen.enabled = false; tradeScreen.enabled = false; standingsScreen.enabled = false; statsScreen.enabled = false; confirmQuit.enabled = false; howToPlayScreen.enabled = false; rosterDropdowns.enabled = false; standingsDropdowns.enabled = false; generalText.enabled = true; rosterText.enabled = false; standingsText.enabled = false; homeText.enabled = false; }