コード例 #1
0
    private void Awake()
    {
        rectTransform = textLabel.GetComponent <RectTransform>();
        textFader     = textLabel.GetComponent <TextLabelFader>();

        textFader.OnFadeCompleted += OnFadeCompleted;
    }
コード例 #2
0
 private void MasterClientSwitched(Player newMaster)
 {
     if (ThisIsMasterClient())
     {
         playerNameText.GetComponent <TMPro.TextMeshProUGUI>().fontStyle = masterClientFont;
     }
     else
     {
         playerNameText.GetComponent <TMPro.TextMeshProUGUI>().fontStyle ^= masterClientFont;
     }
 }
コード例 #3
0
    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;
        }
    }
コード例 #4
0
    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);
    }
コード例 #5
0
    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();
    }
コード例 #6
0
    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;
    }
コード例 #7
0
 // 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>();
 }
コード例 #8
0
 // 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");
 }
コード例 #9
0
    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();
            }
        }
    }
コード例 #10
0
 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>();
 }
コード例 #11
0
    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;
        }
    }
コード例 #12
0
    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;
    }
コード例 #13
0
 private void Awake()
 {
     if (box == null)
     {
         box.GetComponent <TMPro.TextMeshProUGUI>();
     }
     if (box != null)
     {
         box.text = string.Empty;
     }
 }
コード例 #14
0
    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));
    }
コード例 #15
0
ファイル: Marquee.cs プロジェクト: riscvul/SCP_Game_Prototype
    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);
    }
コード例 #16
0
 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>();
 }
コード例 #17
0
ファイル: EditMain.cs プロジェクト: zachary2234/gamebuilder
    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());
        }
    }
コード例 #18
0
    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;
        }
    }
コード例 #19
0
    private void Start()
    {
        animatorTextTurn    = textTurn.GetComponent <Animator>();
        currentMask         = debugInterlocutor;
        currentInterlocutor = characterIntro;
        DrawHUD();


        dialogueManager.OnDialogueEnd += EndDiscussionIntro;
        DiscussionIntro();
        introDialog.RemoveAt(0);
    }
コード例 #20
0
ファイル: LevelMenu.cs プロジェクト: ml5885/RoughWaters
 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>();
 }
コード例 #21
0
    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);
    }
コード例 #22
0
 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>();
 }
コード例 #23
0
    // 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;
    }
コード例 #24
0
 void Start()
 {
     plasticBottleText.GetComponent <TMPro.TextMeshProUGUI>();
     plasticBagText.GetComponent <TMPro.TextMeshProUGUI>();
     glassBottleText.GetComponent <TMPro.TextMeshProUGUI>();
 }
コード例 #25
0
 public void SetItemDescription(string newDescription)
 {
     itemDescriptionPrefab.GetComponent <TMPro.TextMeshProUGUI>().text = newDescription;
     currentDescription = newDescription;
 }
コード例 #26
0
 void Start()
 {
     maskRT = GetComponent <RectTransform>();
     textRT = message.GetComponent <RectTransform>();
 }
コード例 #27
0
ファイル: FirearmManager.cs プロジェクト: Jrns1/bullet-hell
 private void Awake()
 {
     ui          = magazineText.GetComponent <UIBase>();
     ui.renderer = magazineText;
     ui.SetValue = () => magazineText.text = magazine.ToString();
 }
コード例 #28
0
    //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;
    }