Esempio n. 1
0
            public Unit ReadData(RAMBuffer buffer)
            {
                Type                    = (UnitType)buffer.ReadByte();
                NameLength1             = buffer.ReadUShort();
                ID1                     = buffer.ReadShort();
                LanguageDLLName         = buffer.ReadUShort();
                LanguageDLLCreation     = buffer.ReadUShort();
                Class                   = buffer.ReadShort();
                StandingGraphic1        = buffer.ReadShort();
                StandingGraphic2        = buffer.ReadShort();
                DyingGraphic1           = buffer.ReadShort();
                DyingGraphic2           = buffer.ReadShort();
                DeathMode               = buffer.ReadByte();
                HitPoints               = buffer.ReadShort();
                LineOfSight             = buffer.ReadFloat();
                GarrisonCapacity        = buffer.ReadByte();
                SizeRadius1             = buffer.ReadFloat();
                SizeRadius2             = buffer.ReadFloat();
                HPBarHeight1            = buffer.ReadFloat();
                TrainSound1             = buffer.ReadShort();
                TrainSound2             = buffer.ReadShort();
                DeadUnitID              = buffer.ReadShort();
                PlacementMode           = buffer.ReadByte();
                AirMode                 = buffer.ReadByte();
                IconID                  = buffer.ReadShort();
                HideInEditor            = buffer.ReadByte();
                Unknown1                = buffer.ReadShort();
                Enabled                 = buffer.ReadByte();
                Disabled                = buffer.ReadByte();
                PlacementBypassTerrain1 = buffer.ReadShort();
                PlacementBypassTerrain2 = buffer.ReadShort();
                PlacementTerrain1       = buffer.ReadShort();
                PlacementTerrain2       = buffer.ReadShort();
                EditorRadius1           = buffer.ReadFloat();
                EditorRadius2           = buffer.ReadFloat();
                HillMode                = buffer.ReadByte();
                VisibleInFog            = buffer.ReadByte();
                TerrainRestriction      = buffer.ReadShort();
                FlyMode                 = buffer.ReadByte();
                ResourceCapacity        = buffer.ReadShort();
                ResourceDecay           = buffer.ReadFloat();
                BlastType               = buffer.ReadByte();
                Unknown2                = buffer.ReadByte();
                InteractionMode         = buffer.ReadByte();
                MinimapMode             = buffer.ReadByte();
                CommandAttribute        = buffer.ReadByte();
                Unknown3A               = buffer.ReadFloat();
                MinimapColor            = buffer.ReadByte();
                LanguageDLLHelp         = buffer.ReadInteger();
                LanguageDLLHotKeyText   = buffer.ReadInteger();
                HotKey                  = buffer.ReadInteger();
                Unselectable            = buffer.ReadByte();
                Unknown6                = buffer.ReadByte();
                UnknownSelectionMode    = buffer.ReadByte();
                Unknown8                = buffer.ReadByte();
                SelectionMask           = buffer.ReadByte();
                SelectionShapeType      = buffer.ReadByte();
                SelectionShape          = buffer.ReadByte();
                Attribute               = buffer.ReadByte();
                Civilization            = buffer.ReadByte();
                Nothing                 = buffer.ReadShort();
                SelectionEffect         = buffer.ReadByte();
                EditorSelectionColor    = buffer.ReadByte();
                SelectionRadius1        = buffer.ReadFloat();
                SelectionRadius2        = buffer.ReadFloat();
                HPBarHeight2            = buffer.ReadFloat();

                ResourceStorages = new List <ResourceTuple <short, float, byte> >(3);
                for (int i = 0; i < 3; ++i)
                {
                    ResourceStorages.Add(new ResourceTuple <short, float, byte>()
                    {
                        Type = buffer.ReadShort(), Amount = buffer.ReadFloat(), Mode = buffer.ReadByte()
                    });
                }

                int damageGraphicCount = buffer.ReadByte();

                DamageGraphics = new List <DamageGraphic>();
                for (int i = 0; i < damageGraphicCount; ++i)
                {
                    DamageGraphics.Add(new DamageGraphic().ReadData(buffer));
                }

                SelectionSound = buffer.ReadShort();
                DyingSound     = buffer.ReadShort();
                AttackMode     = buffer.ReadByte();
                EdibleMeat     = buffer.ReadByte();
                Name1          = buffer.ReadString(NameLength1);
                ID2            = buffer.ReadShort();
                ID3            = buffer.ReadShort();

                if (Type >= UnitType.Flag)
                {
                    Speed = buffer.ReadFloat();
                }
                if (Type >= UnitType.DeadFish)
                {
                    DeadFish = new UnitTypes.DeadFish().ReadData(buffer);
                }
                if (Type >= UnitType.Bird)
                {
                    Bird = new UnitTypes.Bird().ReadData(buffer);
                }
                if (Type >= UnitType.Type50)
                {
                    Type50 = new UnitTypes.Type50().ReadData(buffer);
                }
                if (Type == UnitType.Projectile)
                {
                    Projectile = new UnitTypes.Projectile().ReadData(buffer);
                }
                if (Type >= UnitType.Creatable)
                {
                    Creatable = new UnitTypes.Creatable().ReadData(buffer);
                }
                if (Type == UnitType.Building)
                {
                    Building = new UnitTypes.Building().ReadData(buffer);
                }

                return(this);
            }
Esempio n. 2
0
            public override void ReadData(RAMBuffer buffer)
            {
                Type = (UnitType)buffer.ReadByte();
                NameLength1 = buffer.ReadUShort();
                ID1 = buffer.ReadShort();
                LanguageDLLName = buffer.ReadUShort();
                LanguageDLLCreation = buffer.ReadUShort();
                Class = buffer.ReadShort();
                StandingGraphic1 = buffer.ReadShort();
                StandingGraphic2 = buffer.ReadShort();
                DyingGraphic1 = buffer.ReadShort();
                DyingGraphic2 = buffer.ReadShort();
                DeathMode = buffer.ReadByte();
                HitPoints = buffer.ReadShort();
                LineOfSight = buffer.ReadFloat();
                GarrisonCapacity = buffer.ReadByte();
                SizeRadius1 = buffer.ReadFloat();
                SizeRadius2 = buffer.ReadFloat();
                HPBarHeight1 = buffer.ReadFloat();
                TrainSound1 = buffer.ReadShort();
                TrainSound2 = buffer.ReadShort();
                DeadUnitID = buffer.ReadShort();
                PlacementMode = buffer.ReadByte();
                AirMode = buffer.ReadByte();
                IconID = buffer.ReadShort();
                HideInEditor = buffer.ReadByte();
                Unknown1 = buffer.ReadShort();
                Enabled = buffer.ReadByte();
                Disabled = buffer.ReadByte();
                PlacementBypassTerrain1 = buffer.ReadShort();
                PlacementBypassTerrain2 = buffer.ReadShort();
                PlacementTerrain1 = buffer.ReadShort();
                PlacementTerrain2 = buffer.ReadShort();
                EditorRadius1 = buffer.ReadFloat();
                EditorRadius2 = buffer.ReadFloat();
                HillMode = buffer.ReadByte();
                VisibleInFog = buffer.ReadByte();
                TerrainRestriction = buffer.ReadShort();
                FlyMode = buffer.ReadByte();
                ResourceCapacity = buffer.ReadShort();
                ResourceDecay = buffer.ReadFloat();
                BlastType = buffer.ReadByte();
                Unknown2 = buffer.ReadByte();
                InteractionMode = buffer.ReadByte();
                MinimapMode = buffer.ReadByte();
                CommandAttribute = buffer.ReadByte();
                Unknown3A = buffer.ReadFloat();
                MinimapColor = buffer.ReadByte();
                LanguageDLLHelp = buffer.ReadInteger();
                LanguageDLLHotKeyText = buffer.ReadInteger();
                HotKey = buffer.ReadInteger();
                Unselectable = buffer.ReadByte();
                Unknown6 = buffer.ReadByte();
                UnknownSelectionMode = buffer.ReadByte();
                Unknown8 = buffer.ReadByte();
                SelectionMask = buffer.ReadByte();
                SelectionShapeType = buffer.ReadByte();
                SelectionShape = buffer.ReadByte();
                Attribute = buffer.ReadByte();
                Civilization = buffer.ReadByte();
                Nothing = buffer.ReadShort();
                SelectionEffect = buffer.ReadByte();
                EditorSelectionColor = buffer.ReadByte();
                SelectionRadius1 = buffer.ReadFloat();
                SelectionRadius2 = buffer.ReadFloat();
                HPBarHeight2 = buffer.ReadFloat();

                ResourceStorages = new List<ResourceTuple<short, float, byte>>(3);
                for(int i = 0; i < 3; ++i)
                    ResourceStorages.Add(new ResourceTuple<short, float, byte>() { Type = buffer.ReadShort(), Amount = buffer.ReadFloat(), Enabled = buffer.ReadByte() });

                int damageGraphicCount = buffer.ReadByte();
                DamageGraphics = new List<DamageGraphic>();
                for(int i = 0; i < damageGraphicCount; ++i)
                    DamageGraphics.Add(new DamageGraphic().ReadDataInline(buffer));

                SelectionSound = buffer.ReadShort();
                DyingSound = buffer.ReadShort();
                AttackMode = buffer.ReadByte();
                EdibleMeat = buffer.ReadByte();
                Name1 = buffer.ReadString(NameLength1);
                ID2 = buffer.ReadShort();
                ID3 = buffer.ReadShort();

                if(Type >= UnitType.Flag)
                    Speed = buffer.ReadFloat();
                if(Type >= UnitType.DeadFish)
                    DeadFish = new UnitTypes.DeadFish().ReadDataInline(buffer);
                if(Type >= UnitType.Bird)
                    Bird = new UnitTypes.Bird().ReadDataInline(buffer);
                if(Type >= UnitType.Type50)
                    Type50 = new UnitTypes.Type50().ReadDataInline(buffer);
                if(Type == UnitType.Projectile)
                    Projectile = new UnitTypes.Projectile().ReadDataInline(buffer);
                if(Type >= UnitType.Creatable)
                    Creatable = new UnitTypes.Creatable().ReadDataInline(buffer);
                if(Type == UnitType.Building)
                    Building = new UnitTypes.Building().ReadDataInline(buffer);
            }