コード例 #1
0
    public void SetSngTournamentObjects(API_GameInfo games)
    {
        DestroyAllObjects();
        gameInfo = games;

        sngTournamentObjectList = new List <GameObject> ();

        if (games.gameList.Count > 0)
        {
            txtMessage.text = "";
            for (int i = 0; i < games.gameList.Count; i++)
            {
                GameObject o = Instantiate(objPrefab) as GameObject;
                o.transform.SetParent(scrollViewContent);
                o.transform.localScale = Vector3.one;

                sngTournamentObjectList.Add(o);

                o.transform.position = new Vector3(o.transform.position.x, o.transform.position.y, scrollViewContent.position.z);

                SnGTournamentObject sto = o.GetComponent <SnGTournamentObject> ();
                sto.txtName.text      = games.gameList [i].game_name;
                sto.txtBuyin.text     = Utility.GetCommaSeperatedAmount(games.gameList [i].buy_in);
                sto.txtPrizePool.text = Utility.GetCommaSeperatedAmount(games.gameList [i].prize_pool);
                sto.txtStatus.text    = games.gameList [i].status.ToCamelCase();
                sto.txtEnrolled.text  = games.gameList [i].users + "/" + games.gameList [i].maximum_players;
                sto.gameID            = games.gameList [i].id;

                sto.imgBackground.color = new Color(0, 0, 0, i % 2 == 0 ? .25f : 0f);

                if (games.gameList [i].status.Equals(APIConstants.TOURNAMENT_STATUS_REGISTERING))
                {
                    sto.imgTournamentStatus.color = Color.green;
                }
                else if (games.gameList [i].status.Equals(APIConstants.TOURNAMENT_STATUS_PENDING) ||
                         games.gameList [i].status.Equals(APIConstants.TOURNAMENT_STATUS_RUNNING))
                {
                    sto.imgTournamentStatus.color = Color.yellow;
                }
                else
                {
                    sto.imgTournamentStatus.color = Color.red;
                }

                sto.index = i;
            }
        }
        else
        {
            txtMessage.text = APIConstants.MESSAGE_NO_GAMES_FOUND;
        }

//		SetContentHeight (games.gameList.Count);

        gameObject.SetActive(true);
    }
コード例 #2
0
    private void UpdateTournamentStack(string gameID, string stack)
    {
        foreach (GameObject go in sngTournamentObjectList)
        {
            SnGTournamentObject sto = go.GetComponent <SnGTournamentObject> ();

            if (sto.gameID.Equals(gameID))
            {
//				sto.imgTournamentStatus.color = Color.green;
            }
        }
    }
コード例 #3
0
    private void UpdateTournamentStatusToRunning(string gameID)
    {
        foreach (GameObject go in sngTournamentObjectList)
        {
            SnGTournamentObject sto = go.GetComponent <SnGTournamentObject> ();

            if (sto.gameID.Equals(gameID))
            {
                GameData gd = gameInfo.gameList [sto.index];
                gd.status = APIConstants.TOURNAMENT_STATUS_RUNNING;

                sto.txtStatus.text            = gd.status.ToCamelCase();
                sto.imgTournamentStatus.color = Color.green;
            }
        }
    }
コード例 #4
0
    private void UpdatePlayersCount(string gameID, int totalPlayers)
    {
        totalPlayers = totalPlayers < 0 ? 0 : totalPlayers;

        foreach (GameObject go in sngTournamentObjectList)
        {
            SnGTournamentObject sto = go.GetComponent <SnGTournamentObject> ();

            if (sto.gameID.Equals(gameID))
            {
                GameData gd = gameInfo.gameList [sto.index];
                gd.users = totalPlayers;

                sto.txtEnrolled.text = gd.users + "/" + gd.maximum_players;
            }
        }

        tournamentDetailPanel.UpdateTournamentDetailText(gameID);
    }