Пример #1
0
        public void Restore(System.IO.BinaryReader r)
        {
            Result = (EResult)r.ReadSByte();

            int length = r.ReadInt32();

            byte[] data = r.ReadBytes(length);

            mVarMgr = VariableMgr.Import(data);

            mTriggerGroup.Restore(r);
        }
Пример #2
0
        public void Restore(System.IO.BinaryReader r)
        {
            Repeat = new RepeatCount(r.ReadInt32());
            mStep  = (EStep)r.ReadSByte();

            int length = r.ReadInt32();

            byte[] data = r.ReadBytes(length);
            mVarMgr = VariableMgr.Import(data);

            mAction.Restore(r);
        }
Пример #3
0
        public static PsScriptMgr Deserialize(Factory factory, byte[] data)
        {
            if (null == data)
            {
                return(null);
            }

            factory.Init();

            PsScriptMgr scriptMgr = new PsScriptMgr(factory);

            MemoryStream sm = new MemoryStream(data, false);

            using (BinaryReader r = new BinaryReader(sm))
            {
                int    varDatalength = r.ReadInt32();
                byte[] varData       = r.ReadBytes(varDatalength);

                scriptMgr.mVarMgr = VariableMgr.Import(varData);

                int count = r.ReadInt32();

                for (int i = 0; i < count; i++)
                {
                    int id = r.ReadInt32();

                    PsScript script = PsScript.Load(scriptMgr, id);
                    if (null == script)
                    {
                        continue;
                    }

                    if (!script.Init())
                    {
                        continue;
                    }

                    scriptMgr.mScriptList.Add(script);

                    script.Restore(r);
                }

                DeserializeList(scriptMgr.mScriptLoadList, r);
                DeserializeList(scriptMgr.mScriptRemoveList, r);
            }

            return(scriptMgr);
        }