コード例 #1
0
    public void Start()
    {
        playerManager      = FindObjectOfType <PlayerManager>();
        captionCardManager = FindObjectOfType <CaptionCardManager>();

        card = GetComponentInParent <CaptionCard>();

        voteButton = GetComponent <Button>();
        voteButton.onClick.AddListener(VoteActions);
    }
コード例 #2
0
    public void DrawCards(int amount)
    {
        for (int x = currentDrawPosition; x < (currentDrawPosition + amount); x++)
        {
            CaptionCard card = (deck[x] != "") ? Instantiate(cardPrefab, hand) : Instantiate(blankCardPrefab, hand);
            card.captionText = deck[x];
            card.ShowText();
            card.playerId = PhotonNetwork.player.ID;
        }

        currentDrawPosition = currentDrawPosition + amount;
    }
コード例 #3
0
    public void AddHiddenCardToTable(int playerId, string text)
    {
        CaptionCard card = Instantiate(cardPrefab, tableTop);

        card.playerId    = playerId;
        card.captionText = text;

        if (CheckEveryonePlayedACard())
        {
            ActivateShowTableTopCards();
        }
    }
コード例 #4
0
    public void DeleteCardsFromDisconnectedPlayer(int playerId)
    {
        foreach (Transform gameobject in tableTop)
        {
            CaptionCard card = gameobject.GetComponent <CaptionCard>();

            if (card != null)
            {
                if (card.playerId == playerId)
                {
                    Destroy(gameobject.gameObject);
                }
            }
        }
    }
コード例 #5
0
    private IEnumerator ShowTableTopCards()
    {
        yield return(new WaitForEndOfFrame());

        foreach (Transform gameobject in tableTop)
        {
            CaptionCard card = gameobject.GetComponent <CaptionCard>();

            if (card != null)
            {
                card.ShowText();

                //if(card.playerId != PhotonNetwork.player.ID)
                card.addVoteButton();
            }
        }

        yield return(null);
    }
コード例 #6
0
    public void OnDrop(PointerEventData eventData)
    {
        CaptionCard drag = eventData.pointerDrag.GetComponent <CaptionCard>();

        if (drag != null)
        {
            if (canDrop)
            {
                drag.parentToReturn = this.transform;
                drag.canDrag        = false;
                captionManager.AddCardToTable(drag.playerId, drag.captionText);
            }

            if (tableTopZone)
            {
                canDrop = false;

                if (captionManager.CheckEveryonePlayedACard())
                {
                    captionManager.ActivateShowTableTopCards();
                }
            }
        }
    }