/*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()); } }
void Start() { teamAChoice.text = teamList[indexA].ToString(); teamBChoice.text = teamList[indexB].ToString(); changeModeA.image.sprite = mode[modeCounterA]; changeModeB.image.sprite = mode[modeCounterB]; flags = Resources.LoadAll <Sprite>("Flags"); modeA = "human"; modeB = "bot"; teamDict = new Dictionary <string, TeamStatus>(); teamDataController = new TeamDataController(); loadFileData(); //teamDataController.EditTeamData(new TeamStatus("Africa","Afr", true,3)); //For testing the data is loading from JSON file in updation at runtime }
void Start() { teamDict = new Dictionary <string, TeamStatus>(); teamCounter = 0; index = 0; userDataController = new UserDataController(); userDataController.LoadGameData(); baskyCoins.SetText(userDataController.userData.baskyCoins.ToString()); teamDataController = new TeamDataController(); LoadBuyTeamData(); if (teamDict == null || teamDict.Count == 0) { noTeamToBuyPopup.SetActive(true); } else { noTeamToBuyPopup.SetActive(false); } flags = Resources.LoadAll <Sprite>("Flags"); }
public void loadFileData() { if (File.Exists(Application.persistentDataPath + "/teamData.json")) { if (teamDataController == null) { teamDataController = new TeamDataController(); } teamDataController.LoadGameData(); // loading the data from file 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 } } else { if (teamDataController == null) { teamDataController = new TeamDataController(); teamDict = new Dictionary <string, TeamStatus>(); } teamDataController.teamData = new TeamStatus[16]; for (int i = 0; i < teamList.Capacity; i++) { if (teamRating[i] == 3) { teamDict.Add(teamList[i], new TeamStatus(teamList[i], teamListShort[i], true, teamCost[i], teamRating[i])); teamDataController.teamData[i] = new TeamStatus(teamList[i], teamListShort[i], true, teamCost[i], teamRating[i]); } else { teamDict.Add(teamList[i], new TeamStatus(teamList[i], teamListShort[i], false, teamCost[i], teamRating[i])); teamDataController.teamData[i] = new TeamStatus(teamList[i], teamListShort[i], false, teamCost[i], teamRating[i]); } } teamDataController.SaveGameData(); } }
public ServerGameController() { int matchTime = random.Next(60, 120) * 1000; matchTimer = new MatchTimer(matchTime); matchStanding = new OverallMatchStanding { TimeElapsed = new MatchTime { Time = matchTime } }; matchTimer.TimeElapsed += MatchTimer_Elapsed; // The size of the Pith is fixed pitch = new Pitch { Width = 500, Height = 500 }; homeTeamData = new TeamData(); awayTeamData = new TeamData(); var dataController = new TeamDataController(homeTeamData, awayTeamData); dataController.TeamsAreReady += DataController_TeamsAreReady; }