示例#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);
        }
示例#2
0
        /// @return The serialized data
        ///
        public object Serialize()
        {
            object data = null;

            if (Count > 0)
            {
                var bitData = BitUtils.GetBitData(this, k_bitSize);
                data = JsonWrapper.SerializeListOfTypes(bitData);
            }
            return(data);
        }