Exemplo n.º 1
0
    private void CreateLobbyCard(Vector3 pos, Vector3 scale, Quaternion rot, LobbyInfo lobby)
    {
        if (ItemPrefab != null)
        {
            SelectorActor sa = Instantiate(ItemPrefab);
            sa.transform.SetParent(transform);
            sa.transform.position   = pos;
            sa.transform.localScale = scale;
            sa.transform.rotation   = rot;

            Step ph = sa.gameObject.GetComponent <Step>();
            ph.NextPhase = JoinLobbyPhase;

            Card card = sa.GetComponentInChildren <Card>();
            if (card != null)
            {
                //\nLast Activity:{4}minutes ago
                //(DateTime.Now - lobby.last_activity).TotalMinutes) // Anzeige ist nicht korrekt, lobby.last_activity überprüfen

                card.CardText = String.Format("Name:\n{0}\n\nPlayers:{1}/{2}\nTarget Score:{3}",
                                              lobby.game_name, lobby.user_count, lobby.max_players, lobby.target_score);
            }

            CreatedItems.Add(sa);
            base.AddActor(sa);
            onScreenShownLobbys.Add(lobby);
        }
    }
Exemplo n.º 2
0
    private SelectorActor CreateCard(Vector3 pos, Vector3 scale, Quaternion rot, Assets.Service.Response.Card card)
    {
        if (ItemPrefab != null)
        {
            SelectorActor sa = Instantiate(ItemPrefab);
            sa.transform.SetParent(transform);
            sa.transform.position   = pos;
            sa.transform.localScale = scale;
            sa.transform.rotation   = rot;

            Step ph = sa.gameObject.GetComponent <Step>();
            ph.NextPhase = CardSelectedPhase;

            Card cardcontroller = sa.GetComponentInChildren <Card>();
            if (cardcontroller != null)
            {
                cardcontroller.CardText = card.text;
                cardcontroller.IsBlack  = card.is_black;
            }
            CreatedItems.Add(sa);
            return(sa);
        }

        throw new Exception("No item prefab set");
    }