Beispiel #1
0
        /// @return The serialized data
        ///
        public object Serialize()
        {
            var jsonData = new JsonDictionary()
            {
                { k_keyWidth, m_width },
                { k_keyHeight, m_height },
                { k_keyMoves, m_moves },
            };

            if (m_tiles.Count > 0)
            {
                var tilesArray = JsonWrapper.CreateJsonArray(m_tiles.Count);
                for (int i = 0; i < m_tiles.Count; ++i)
                {
                    tilesArray[i] = m_tiles[i].ToString();
                }
                jsonData.Add(k_keyTiles, tilesArray);
            }
            if (m_scores.Count > 0)
            {
                jsonData.Add(k_keyScores, JsonWrapper.SerializeListOfTypes(m_scores));
            }
            if (m_objectives.Count > 0)
            {
                jsonData.Add(k_keyObjectives, JsonWrapper.SerializeListOfSerializables(m_objectives));
            }
            return(jsonData);
        }
Beispiel #2
0
        /// @return The serialized data
        ///
        public object Serialize()
        {
            var jsonData = new JsonDictionary();

            if (m_levels.Count > 0)
            {
                jsonData.Add(k_keyLevels, JsonWrapper.SerializeListOfSerializables(m_levels));
            }
            return(jsonData);
        }