Пример #1
0
    public void AdicionaPontos()
    {
        PlayerRanking a = new PlayerRanking();
        Ranking       r = new Ranking();
        string        m_XmlTextAssetPath = Application.dataPath.ToString() + @"/Resources/" + strFileXML.Trim() + ".xml";

        if (File.Exists(m_XmlTextAssetPath))
        {
            r = XmlSupport.Deserialize <Ranking>(strFileXML);
        }
        a.nome  = nomeSave.text;
        a.ponto = Convert.ToInt32(pontosSave.text);
        r.players.Add(a);
        XmlSupport.Serialize <Ranking>(strFileXML, r);
        View();
    }
Пример #2
0
    public void View()
    {
        innerText           = "";
        pontosListText.text = "";

        string  m_XmlTextAssetPath = Application.dataPath.ToString() + @"/Resources/" + strFileXML.Trim() + ".xml";
        Ranking r = new Ranking();

        if (File.Exists(m_XmlTextAssetPath))
        {
            r = XmlSupport.Deserialize <Ranking>(strFileXML);
        }
        if (!r.Equals(null))
        {
            foreach (var item in r.players)
            {
                innerText += item.nome + " - " + item.ponto.ToString() + "\n";
            }
            pontosListText.text = innerText;
        }
    }