public void JsonToList()
    {
        string playerScorelistAsString = "";

        playerScorelistAsString += "{";
        playerScorelistAsString += "\"list\": [";
        playerScorelistAsString += "        {";
        playerScorelistAsString += "            \"name\": \"matt\",";
        playerScorelistAsString += "            \"score\": 800";
        playerScorelistAsString += "        },";
        playerScorelistAsString += "        {";
        playerScorelistAsString += "            \"name\": \"joelle\",";
        playerScorelistAsString += "            \"score\": 901";
        playerScorelistAsString += "        }";
        playerScorelistAsString += "    ]";
        playerScorelistAsString += "}";

        PlayerScoreList playerScoreList = PlayerScoreList.FromJSON(playerScorelistAsString);


        foreach (var playerScore in playerScoreList.list)
        {
            print("from list :: " + playerScore.name + ", " + playerScore.score);
        }
    }
示例#2
0
 void Awake()
 {
     grid    = GetComponentInChildren <HexGrid> ();
     players = new List <Player>()
     {
         new RandomStrat(), new RandomStrat1(), new PepesDisciples(), new PepesDisciples()
     };
     colors = new List <Color> {
         Color.blue, Color.green, Color.red, Color.magenta
     };
     playerNames = new List <string> ();
     SetPlayerNames();
     scoreboard   = GameObject.FindObjectOfType <ScoreBoard>();
     playerScores = GameObject.FindObjectOfType <PlayerScoreList>();
     Timer        = GameObject.FindGameObjectWithTag("Timer");
 }
 void Awake()
 {
     playerScoreList = GetComponent <PlayerScoreList> ();
     instance        = this;
     //Debug.Log (instance);
 }
示例#4
0
 // Use this for initialization
 void Start()
 {
     playerScoreList = FindObjectOfType <PlayerScoreList>();
 }