예제 #1
0
 // Update is called once per frame
 void Update()
 {
     //For the updation of data from JSON file at run time if there are any changes in the data file
     if (teamDataController.uncheckedData)
     {
         teamDataController.LoadGameData(); // loading the data from file
         teamDict.Clear();
         for (int i = 0; i < teamDataController.teamData.Length; i++)
         {
             teamDict.Add(teamDataController.teamData[i].TeamName, teamDataController.teamData[i]); // setting the data in the dictionary which was fetched from file
         }
     }
 }
예제 #2
0
    /*This method calls when user clicks on Shop button
     * IMP -> Enabled on Button clicks -->  TeamShop(Game obj) all scripts -> From Inspector
     * Called the Select Team script if TeamData.json doesn't exists.
     */

    public void LoadBuyTeamData()
    {
        if (teamDataController == null)
        {
            teamDataController = new TeamDataController();
            teamDataController.LoadGameData();
        }
        teamDataController.LoadGameData(); // loading the data from file
        teamDict.Clear();
        teamCounter = 0;
        for (int i = 0; i < teamDataController.teamData.Length; i++)
        {
            if (teamDataController.teamData[i].LockedStatus)
            {
                teamDict.Add(teamDataController.teamData[i].TeamName, teamDataController.teamData[i]); // setting the data in the dictionary which was fetched from file
                teamCounter++;
            }
        }
        if (teamDataController.teamData != null && teamDict.Count != 0)
        {
            SetTeamFlag(teamImage, teamDict.Keys.First());
            teamNameText.SetText(teamDict.Keys.First());
            teamCostText.SetText(teamDict.Values.First().TeamCost.ToString());
        }
    }