Exemplo n.º 1
0
        public static async ValueTask <NetFieldExport> ReadNetFieldExportAsync(this ArchiveAsync ar)
        {
            bool exported = await ar.ReadByteAsync() == 1;

            if (!exported)
            {
                return(NetFieldExport.InstantiateNotExported());
            }
            uint handle = await ar.ReadIntPackedAsync();

            uint checksum = await ar.ReadUInt32Async();

            if (ar.EngineNetVer < EngineNetworkVersionHistory.HISTORY_NETEXPORT_SERIALIZATION)
            {
                string name = await ar.ReadStringAsync();

                string type = await ar.ReadStringAsync();

                return(NetFieldExport.InstantiateExported(handle, checksum, name, type));
            }
            if (ar.EngineNetVer < EngineNetworkVersionHistory.HISTORY_NETEXPORT_SERIALIZE_FIX)
            {
                string exportName = await ar.ReadStringAsync();

                return(NetFieldExport.InstantiateExported(handle, checksum, exportName, ""));
            }
            StaticName staticName = await ar.ReadStaticNameAsync();

            return(NetFieldExport.InstantiateExported(handle, checksum, staticName.Name, ""));
        }
Exemplo n.º 2
0
        public static NetFieldExport ReadNetFieldExport(this Archive ar)
        {
            bool exported = ar.ReadByte() == 1;

            if (!exported)
            {
                return(NetFieldExport.InstantiateNotExported());
            }
            uint handle   = ar.ReadIntPacked();
            uint checksum = ar.ReadUInt32();

            if (ar.EngineNetVer < EngineNetworkVersionHistory.HISTORY_NETEXPORT_SERIALIZATION)
            {
                string name = ar.ReadString();
                string type = ar.ReadString();
                return(NetFieldExport.InstantiateExported(handle, checksum, name, type));
            }
            if (ar.EngineNetVer < EngineNetworkVersionHistory.HISTORY_NETEXPORT_SERIALIZE_FIX)
            {
                string exportName = ar.ReadString();
                return(NetFieldExport.InstantiateExported(handle, checksum, exportName, ""));
            }
            var staticName = ar.ReadStaticName();

            return(NetFieldExport.InstantiateExported(handle, checksum, staticName.Name, ""));
        }