コード例 #1
0
        private static void Save()
        {
            PrintLine("Atempting Save of leaderboards");
            FileStream fs = UFile.Create(_savePath);

            CustomXmlWriter cxw = CustomXmlWriter.Create(fs);

            cxw.WriteStartDocument();
            cxw.WriteStartElement("LocalScores");
            foreach (QueuededScore qs in _scoresToSend)
            {
                cxw.WriteStartElement("ScoresToSend");

                cxw.WriteAttributeString("Leaderboard", qs.Leaderboard);
                cxw.WriteAttributeULong("Id", qs.Score.Principal_ID);
                cxw.WriteAttributeULong("Nex_Id", qs.Score.Nex_Unique_ID);
                cxw.WriteAttributeULong("Misc", qs.Score.Misc);
                cxw.WriteAttributeUInt("Score", qs.Score.Score);
                cxw.WriteAttributeArray <byte>("Cud", qs.Score.CommonDataBinary);
                cxw.WriteAttributeString("UserName", qs.Score.CommonDataUserName);
                cxw.WriteAttributeInt("Type", (int)qs.Type);
                cxw.WriteEndElement();
            }

            foreach (KeyValuePair <string, List <HighScore> > kvp in _localLeaderboards)
            {
                cxw.WriteStartElement("Leaderboard");
                cxw.WriteAttributeString("Name", kvp.Key);

                foreach (HighScore hs in kvp.Value)
                {
                    cxw.WriteStartElement("Score");
                    cxw.WriteAttributeULong("Id", hs.Principal_ID);
                    cxw.WriteAttributeULong("Nex_Id", hs.Nex_Unique_ID);
                    cxw.WriteAttributeUInt("Score", hs.Score);
                    cxw.WriteAttributeULong("Misc", hs.Misc);
                    cxw.WriteAttributeString("UserName", hs.CommonDataUserName);
                    cxw.WriteAttributeArray <byte>("Cud", hs.CommonDataBinary);
                    cxw.WriteEndElement();
                }
                cxw.WriteEndElement();
            }
            cxw.WriteEndElement();

            cxw.WriteEndDocument();
            cxw.Close();
            fs.Close();
            UFile.Commit();
            PrintLine("Save Compleate");
        }