Exemple #1
0
        public void Deserialize(INetDataReader reader)
        {
            TechBonuses    = new PlayerTechBonuses();
            Inventory      = new StorageComponent(4);
            ReactorStorage = new StorageComponent(4);
            WarpStorage    = new StorageComponent(1);
            Forge          = new MechaForge
            {
                tasks      = new List <ForgeTask>(),
                extraItems = new ItemBundle()
            };
            TechBonuses.Deserialize(reader);
            SandCount     = reader.GetInt();
            CoreEnergy    = reader.GetDouble();
            ReactorEnergy = reader.GetDouble();
            bool isPayloadPresent = reader.GetBool();

            if (isPayloadPresent)
            {
                int    mechaLength = reader.GetInt();
                byte[] mechaBytes  = new byte[mechaLength];
                reader.GetBytes(mechaBytes, mechaLength);
                using (MemoryStream ms = new MemoryStream(mechaBytes))
                    using (BinaryReader br = new BinaryReader(ms))
                    {
                        Inventory.Import(br);
                        ReactorStorage.Import(br);
                        WarpStorage.Import(br);
                        Forge.Import(br);
                    }
            }
        }
 public void Deserialize(INetDataReader reader)
 {
     coreEnergyCap            = reader.GetDouble();
     corePowerGen             = reader.GetDouble();
     reactorPowerGen          = reader.GetDouble();
     walkPower                = reader.GetDouble();
     jumpEnergy               = reader.GetDouble();
     thrustPowerPerAcc        = reader.GetDouble();
     warpKeepingPowerPerSpeed = reader.GetDouble();
     warpStartPowerPerSpeed   = reader.GetDouble();
     miningPower              = reader.GetDouble();
     replicatePower           = reader.GetDouble();
     researchPower            = reader.GetDouble();
     droneEjectEnergy         = reader.GetDouble();
     droneEnergyPerMeter      = reader.GetDouble();
     coreLevel                = reader.GetInt();
     thrusterLevel            = reader.GetInt();
     miningSpeed              = reader.GetFloat();
     replicateSpeed           = reader.GetFloat();
     walkSpeed                = reader.GetFloat();
     jumpSpeed                = reader.GetFloat();
     maxSailSpeed             = reader.GetFloat();
     maxWarpSpeed             = reader.GetFloat();
     buildArea                = reader.GetFloat();
     droneCount               = reader.GetInt();
     droneSpeed               = reader.GetFloat();
     droneMovement            = reader.GetInt();
     inventorySize            = reader.GetInt();
 }
Exemple #3
0
        public void Deserialize_5(INetDataReader reader)
        {
            Username      = reader.GetString();
            PlayerId      = reader.GetUShort();
            LocalPlanetId = reader.GetInt();
            MechaColors   = new Float4[reader.GetInt()];
            for (int i = 0; i < MechaColors.Length; i++)
            {
                MechaColors[i] = reader.GetFloat4();
            }
            LocalPlanetPosition = reader.GetFloat3();
            UPosition           = reader.GetDouble3();
            Rotation            = reader.GetFloat3();
            BodyRotation        = reader.GetFloat3();
            Mecha = new MechaData();
            Mecha.Deserialize(reader);
            bool isAppearancePresent = reader.GetBool();

            if (isAppearancePresent)
            {
                int    len  = reader.GetInt();
                byte[] data = new byte[len];
                reader.GetBytes(data, len);
                using (MemoryStream ms = new MemoryStream(data))
                    using (BinaryReader br = new BinaryReader(ms))
                    {
                        Appearance = new MechaAppearance();
                        Appearance.Init();
                        Appearance.Import(br);
                    }
            }
        }
Exemple #4
0
        public void Deserialize(INetDataReader reader)
        {
            StarIndex = reader.GetInt();
            int starId = (StarIndex + 1) * 100;
            int count  = reader.GetUShort();

            BulletList = new List <Projectile>(count);
            for (int i = 0; i < count; i++)
            {
                Projectile data = new Projectile
                {
                    PlanetId = reader.GetByte() + starId,
                    Interval = reader.GetByte(),
                    TargetId = reader.GetUShort(),
                    LocalPos = reader.GetFloat3().ToVector3()
                };
                BulletList.Add(data);
            }
            count      = reader.GetUShort();
            RocketList = new List <Projectile>(count);
            for (ushort i = 0; i < count; i++)
            {
                Projectile data = new Projectile
                {
                    PlanetId = reader.GetByte() + starId,
                    Interval = reader.GetByte(),
                    TargetId = reader.GetUShort(),
                    LocalPos = reader.GetFloat3().ToVector3()
                };
                RocketList.Add(data);
            }
        }
Exemple #5
0
 public void Deserialize_4(INetDataReader reader)
 {
     Username      = reader.GetString();
     PlayerId      = reader.GetUShort();
     LocalPlanetId = reader.GetInt();
     MechaColors   = new Float4[reader.GetInt()];
     for (int i = 0; i < MechaColors.Length; i++)
     {
         MechaColors[i] = reader.GetFloat4();
     }
     LocalPlanetPosition = reader.GetFloat3();
     UPosition           = reader.GetDouble3();
     Rotation            = reader.GetFloat3();
     BodyRotation        = reader.GetFloat3();
     Mecha = new MechaData();
     Mecha.Deserialize(reader);
 }
 public void Deserialize(INetDataReader reader)
 {
     ItemId = reader.GetInt();
     Count  = reader.GetInt();
     BeltId = reader.GetInt();
 }