Load() public method

Load this section from a stream (returns true if successful)
public Load ( StreamSerializer stream ) : bool
stream Axiom.Serialization.StreamSerializer
return bool
Ejemplo n.º 1
0
        public bool Load(StreamSerializer stream)
        {
            if (stream.ReadChunkBegin(CHUNK_ID, CHUNK_VERSION, "PageWorld") == null)
            {
                return(false);
            }

            //name
            stream.Read(out this.mName);
            //sections
            while (stream.NextChunkId == PagedWorld.CHUNK_SECTIONDECLARATION_ID)
            {
                stream.ReadChunkBegin();
                string sectionType, sectionName;
                stream.Read(out sectionType);
                stream.Read(out sectionName);
                stream.ReadChunkEnd(CHUNK_SECTIONDECLARATION_ID);
                // Scene manager will be loaded
                PagedWorldSection sec = CreateSection(null, sectionType, sectionName);
                bool sectionOk        = sec.Load(stream);
                if (!sectionOk)
                {
                    DestroySection(sec);
                }
            }

            stream.ReadChunkEnd(CHUNK_ID);

            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Load world data from a serialiser (returns true if successful)
        /// </summary>
        /// <param name="stream"></param>
        public bool Load(StreamSerializer stream)
        {
            if (stream.ReadChunkBegin(CHUNK_ID, CHUNK_VERSION, "PageWorld") == null)
                return false;

            //name
            stream.Read(out mName);
            //sections
            while (stream.NextChunkId == PagedWorldSection.CHUNK_ID)
            {
                PagedWorldSection sec = new PagedWorldSection(this);
                bool sectionOk = sec.Load(stream);
                if (sectionOk)
                    mSections.Add(sec.Name, sec);
                else
                {
                    sec = null;
                    break;
                }
            }

            stream.ReadChunkEnd(CHUNK_ID);

            return true;
        }