コード例 #1
0
    void Collapse()
    {
        ProgressManager.Instance.level = 0;
        collapsed = true;

        playerAnimator.speed = 1f;
        playerAnimator.SetTrigger("end");

        face.Emote(Face.Emotion.Sad);

        text1.Show();
        text2.Show();
        menuButton.GetComponent <BoxCollider2D> ().size = menuButton.GetComponent <BoxCollider2D> ().size;
        menuButton.ChangeVisibility(true);
    }
コード例 #2
0
    void Update()
    {
        if (PhotonNetwork.IsConnectedAndReady == false)
        {
            RandomButton.GetComponent <Button>().interactable             = false;
            RandomButton.GetComponentInChildren <TextMeshProUGUI>().color = Color.black;
            CustomButton.GetComponent <Button>().interactable             = false;
            CustomButton.GetComponentInChildren <TextMeshProUGUI>().color = Color.black;
        }

        if (PhotonNetwork.IsConnected == false)
        {
            PhotonNetwork.ConnectUsingSettings();
        }

        if (PhotonNetwork.PlayerList.Length == 2)
        {
            SceneManager.LoadScene("Game");
        }

        if (roomid_input.GetComponent <TextMeshProUGUI>().text.Length > 3)
        {
            letsgo_btn.GetComponent <Button>().interactable             = true;
            letsgo_btn.GetComponentInChildren <TextMeshProUGUI>().color = Color.white;
        }
        else
        {
            letsgo_btn.GetComponent <Button>().interactable             = false;
            letsgo_btn.GetComponentInChildren <TextMeshProUGUI>().color = Color.black;
        }
    }
コード例 #3
0
 void activate()
 {
     RandomButton.GetComponent <Button>().interactable             = true;
     RandomButton.GetComponentInChildren <TextMeshProUGUI>().color = Color.white;
     CustomButton.GetComponent <Button>().interactable             = true;
     CustomButton.GetComponentInChildren <TextMeshProUGUI>().color = Color.white;
 }
コード例 #4
0
    void AddChipButton(Chip chip)
    {
        if (hideList.Contains(chip.chipName))
        {
            //Debug.Log("Hiding")
            return;
        }
        CustomButton button = Instantiate(buttonPrefab);

        button.gameObject.name = "Create (" + chip.chipName + ")";
        // Set button text
        var buttonTextUI = button.GetComponentInChildren <TMP_Text> ();

        buttonTextUI.text = chip.chipName;

        // Set button size
        var buttonRect = button.GetComponent <RectTransform> ();

        buttonRect.sizeDelta = new Vector2(buttonTextUI.preferredWidth + buttonWidthPadding, buttonRect.sizeDelta.y);

        // Set button position
        buttonRect.SetParent(buttonHolder, false);
        //buttonRect.localPosition = new Vector3 (rightmostButtonEdgeX + buttonSpacing + buttonRect.sizeDelta.x / 2f, 0, 0);
        rightmostButtonEdgeX = buttonRect.localPosition.x + buttonRect.sizeDelta.x / 2f;

        // Set button event
        //button.onClick.AddListener (() => manager.SpawnChip (chip));
        button.AddListener(() => manager.SpawnChip(chip));

        customButton.Add(button);
    }
コード例 #5
0
 void Start()
 {
     details.GetComponent <TextMeshProUGUI>().text = "Please wait or try again";
     if (PhotonNetwork.IsConnectedAndReady)
     {
         RandomButton.GetComponent <Button>().interactable             = true;
         RandomButton.GetComponentInChildren <TextMeshProUGUI>().color = Color.white;
         CustomButton.GetComponent <Button>().interactable             = true;
         CustomButton.GetComponentInChildren <TextMeshProUGUI>().color = Color.white;
     }
 }
コード例 #6
0
ファイル: PollController.cs プロジェクト: cutiemod/Poll
 private void OptionIsClicked(CustomButton option)
 {
     foreach (PollOption o in poll.questions[currentQuestion].options)
     {
         if (o.id == option.GetComponent <OptionObject>().GetID())
         {
             o.Vote();
         }
     }
     StartCoroutine(RevealResutls(option));
 }
コード例 #7
0
ファイル: PollController.cs プロジェクト: cutiemod/Poll
    private IEnumerator RevealAnswerPercentage(CustomButton answer, float percentage, float endY)
    {
        answer.GetComponent <Collider2D>().enabled = false;

        SpriteRenderer percentageBar  = answer.GetComponentInChildren <SpriteRenderer>();
        Text           percentageText = answer.GetComponentInChildren <Text>();

        percentageText.text = percentage + "%";

        float elapsedTime = 0;

        Color tempColor;

        Vector3 startPosition = answer.transform.localPosition;
        Vector3 endPosition   = new Vector3(startPosition.x, endY, startPosition.z);

        Vector3 startScale = percentageBar.transform.localScale;
        Vector3 endScale   = new Vector3(startScale.x * percentage / 100, startScale.y, startScale.z);

        while (elapsedTime < revealTime)
        {
            percentageBar.transform.localScale = Vector3.Lerp(startScale, endScale, elapsedTime / revealTime);
            answer.transform.localPosition     = Vector3.Lerp(startPosition, endPosition, elapsedTime / revealTime);

            tempColor            = percentageText.color;
            tempColor.a          = Mathf.Lerp(0, 1, elapsedTime / revealTime);
            percentageText.color = tempColor;

            elapsedTime += Time.deltaTime;
            yield return(new WaitForEndOfFrame());
        }

        answer.transform.localPosition     = endPosition;
        percentageBar.transform.localScale = endScale;

        tempColor            = percentageText.color;
        tempColor.a          = 1;
        percentageText.color = tempColor;

        yield break;
    }