Exemplo n.º 1
0
    public void getData()     // Called at the start
    {
        //Checks if PlayerTeams.xml exists, if not creates one from template
        if (!System.IO.File.Exists(Application.persistentDataPath + Path.DirectorySeparatorChar + "PlayerTeams.xml"))
        {
            Debug.Log("NO XML");
            TextAsset XMLData = Resources.Load("PlayerTeams") as TextAsset;
            System.IO.File.WriteAllText(Application.persistentDataPath + Path.DirectorySeparatorChar + "PlayerTeams.xml", XMLData.ToString());
        }

        //Trys to load the team data, should never fail as at least 2 teams should always exist
        try
        {
            rawTeamList.Load(Application.persistentDataPath + Path.DirectorySeparatorChar + "PlayerTeams.xml");             // Loads the XML file from the data path
            Debug.Log(1);
            teamList  = rawTeamList.SelectNodes("/TEAMS/TEAM");
            teamCount = teamList.Count;
            Debug.Log("Has teams");
            hasTeam = true;
        }
        catch
        {
            Debug.Log("No teams");
            hasTeam = false;
        }

        charDetails.getData();
        characterCache = cacheIcons(charDetails.characterCount);
        teamsCache     = cacheTeams(teamCount);
    }
Exemplo n.º 2
0
    public void instantiateTeam(int teamID)
    {
        CharacterXML chars = new CharacterXML();

        chars.getData();

        TeamXML teams = new TeamXML();

        teams.getData();

        List <string> teamC = teams.getTeam(teamID);

        one   = chars.getCharacter(Convert.ToInt32(teamC[1]));
        two   = chars.getCharacter(Convert.ToInt32(teamC[2]));
        three = chars.getCharacter(Convert.ToInt32(teamC[3]));
        four  = chars.getCharacter(Convert.ToInt32(teamC[4]));
        five  = chars.getCharacter(Convert.ToInt32(teamC[5]));
    }
Exemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     testingXMLLoading.getData();
     currentCharacter = testingXMLLoading.getCharacter(searchID);
 }