//Version<0x04
 public FoundationCatalogResource(int APIversion,
     uint version,
     Common common,
     FoundationType foundation,
     uint wallCatalogIndex,
     uint floorCatalogIndex,
     uint index3,
     uint index4,
     uint unknown5,
     uint unknown6,
     ShapeType shape,
     TGIBlockList ltgib)
     : this(APIversion,
     version,
     foundation,
     common,
     wallCatalogIndex,
     floorCatalogIndex,
     index3,
     index4,
     unknown5,
     unknown6,
     shape,
     ltgib)
 {
     if (checking) if (version >= 0x00000004)
             throw new InvalidOperationException(String.Format("Version {0} invalid with these arguments", version));
 }
예제 #2
0
 //Version<0x04
 public FoundationCatalogResource(int APIversion,
                                  uint version,
                                  Common common,
                                  FoundationType foundation,
                                  uint wallCatalogIndex,
                                  uint floorCatalogIndex,
                                  uint index3,
                                  uint index4,
                                  uint unknown5,
                                  uint unknown6,
                                  ShapeType shape,
                                  TGIBlockList ltgib)
     : this(APIversion,
            version,
            foundation,
            common,
            wallCatalogIndex,
            floorCatalogIndex,
            index3,
            index4,
            unknown5,
            unknown6,
            shape,
            ltgib)
 {
     if (checking)
     {
         if (version >= 0x00000004)
         {
             throw new InvalidOperationException(String.Format("Version {0} invalid with these arguments", version));
         }
     }
 }
예제 #3
0
 //Current
 public FoundationCatalogResource(uint version,
                                  FoundationType foundation,
                                  MaterialList materials,
                                  Common common,
                                  uint wallCatalogIndex,
                                  uint floorCatalogIndex,
                                  uint vpxyIndex,
                                  uint index3,
                                  uint index4,
                                  uint unknown5,
                                  uint unknown6,
                                  ShapeType shape,
                                  TGIBlockList ltgib)
     : this(version,
            foundation,
            common,
            wallCatalogIndex,
            floorCatalogIndex,
            index3,
            index4,
            unknown5,
            unknown6,
            shape,
            ltgib)
 {
     if (version < 0x00000004)
     {
         throw new InvalidOperationException(String.Format("Version {0} invalid with these arguments", version));
     }
     this.materials = new MaterialList(OnResourceChanged, materials);
     this.vpxyIndex = vpxyIndex;
 }
예제 #4
0
        public GameObject SpawnFoundation(FoundationType foundationType)
        {
            GameObject prefab   = foundationData.First(pair => pair.Key.Equals(foundationType)).Value.Prefabs.GetRandomItem();
            GameObject instance = Instantiate(prefab, CachedTransform.position, CachedTransform.rotation);

            instance.transform.Translate(foundationSpawnpoint, Space.World);

            instance.name = foundationType.ToString().ReplaceUnderscoreWithSpace();

            return(instance);
        }
예제 #5
0
        public Building SpawnBuilding(BuildingType buildingType, FoundationType foundationType, SoilType soilType)
        {
            GameObject prefab   = buildingTierData.First(pair => pair.Key.Equals(buildingType)).Value[0].GetPrefab();
            GameObject instance = Instantiate(prefab, CachedTransform.position, CachedTransform.rotation, CachedTransform);

            instance.transform.Translate(buildingSpawnpoint, Space.World);

            instance.name = buildingType.ToString().InsertSpaceBeforeCapitals();

            Building building = instance.GetComponent <Building>();

            building.Initialize(buildingType,
                                GetBuildingData(buildingType, foundationType, soilType), GetFoundationData(foundationType), GetSoilData(soilType));

            return(building);
        }
예제 #6
0
        public BuildingData(int rent, float secondsPerRent, int weight, int price, int repairCost, int destructionCost, int cleanupCosts,
                            SoilType soilType,
                            FoundationType foundation, float maxHealth)
        {
            this.rent           = rent;
            this.secondsPerRent = secondsPerRent;
            this.weight         = weight;
            this.price          = price;

            this.repairCost      = repairCost;
            this.destructionCost = destructionCost;
            this.cleanupCosts    = cleanupCosts;
            this.maxHealth       = maxHealth;

            SoilType   = soilType;
            Foundation = foundation;
        }
예제 #7
0
        public BuildingData[] GetBuildingData(BuildingType buildingType, FoundationType foundationType, SoilType soilType)
        {
            List <BuildingTierData> buildingTypeData = buildingTierData.First(pair => pair.Key.Equals(buildingType)).Value;

            BuildingData[] data = new BuildingData[buildingTypeData.Count];

            for (int i = 0; i < buildingTypeData.Count; i++)
            {
                BuildingData datum = buildingTypeData[i].GetData();

                datum.SoilType   = soilType;
                datum.Foundation = foundationType;

                data[i] = datum;
            }

            return(data);
        }
예제 #8
0
        public static float FoundationTypeSwitch(FoundationType foundationType)
        {
            switch (foundationType)
            {
            case FoundationType.Wooden_Poles:
                return(300.0f);

            case FoundationType.Shallow_Foundation:
                return(240.0f);

            case FoundationType.Reinforced_Concrete:
                return(180.0f);

            case FoundationType.Floating_Floor_Plate:
                return(120.0f);

            default:
                return(0.0f);
            }
        }
예제 #9
0
        protected override void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);

            base.Parse(s);
            if (version >= 0x00000004)
            {
                this.foundation = (FoundationType)r.ReadUInt32();
                if ((uint)foundation >= (uint)FoundationType.StiltedConcrete)
                {
                    this.materials = new MaterialList(OnResourceChanged, s);
                }
            }
            this.common = new Common(requestedApiVersion, OnResourceChanged, s);
            if (version < 0x00000004)
            {
                this.foundation = (FoundationType)r.ReadUInt32();
            }
            this.wallCatalogIndex  = r.ReadUInt32();
            this.floorCatalogIndex = r.ReadUInt32();
            if (version >= 0x00000004)
            {
                this.vpxyIndex = r.ReadUInt32();
            }
            this.index3   = r.ReadUInt32();
            this.index4   = r.ReadUInt32();
            this.unknown5 = r.ReadUInt32();
            this.unknown6 = r.ReadUInt32();
            this.shape    = (ShapeType)r.ReadUInt32();

            list = new TGIBlockList(OnResourceChanged, s, tgiPosn, tgiSize);

            if (checking)
            {
                if (this.GetType().Equals(typeof(FoundationCatalogResource)) && s.Position != s.Length)
                {
                    throw new InvalidDataException(String.Format("Data stream length 0x{0:X8} is {1:X8} bytes longer than expected at {2:X8}",
                                                                 s.Length, s.Length - s.Position, s.Position));
                }
            }
        }
예제 #10
0
        public void GetType(AbstractTile tile)
        {
            // check and cast to approriate type directly
            if (tile is AbstractBuildingTile buildingTile)
            {
                hasSoil       = buildingTile.HasSoil;
                hasFoundation = buildingTile.HasFoundation;
                hasDebris     = buildingTile.HasDebris;

                if (!hasSoil)
                {
                    return;
                }

                soilType = buildingTile.GetSoilType();

                if (!hasFoundation)
                {
                    return;
                }

                foundationType = buildingTile.GetFoundationType();

                if (!buildingTile.HasBuilding || hasDebris)
                {
                    return;
                }

                buildingType = buildingTile.GetBuildingType();
                buildingTier = buildingTile.Building.CurrentTier;

                BuildingHealth buildingHealth = buildingTile.Building.GetComponent <BuildingHealth>();

                this.buildingHealth = buildingHealth.CurrentBuildingHealth;
                foundationHealth    = buildingHealth.CurrentFoundationHealth;
                soilHealth          = buildingHealth.CurrentSoilHealth;
            }
        }
예제 #11
0
 //Common
 private FoundationCatalogResource(int APIversion,
                                   uint version,
                                   FoundationType foundation,//Here to avoid same method signature as Version<0x04
                                   Common common,
                                   uint wallCatalogIndex,
                                   uint floorCatalogIndex,
                                   uint index3,
                                   uint index4,
                                   uint unknown5,
                                   uint unknown6,
                                   ShapeType shape,
                                   TGIBlockList ltgib)
     : base(APIversion, version, common, ltgib)
 {
     this.foundation        = foundation;
     this.wallCatalogIndex  = wallCatalogIndex;
     this.floorCatalogIndex = floorCatalogIndex;
     this.index3            = index3;
     this.index4            = index4;
     this.unknown5          = unknown5;
     this.unknown6          = unknown6;
     this.shape             = shape;
 }
예제 #12
0
        public override void Deserialize( GenericReader reader )
        {
            int version = reader.ReadInt();

            switch ( version )
            {
                case 5:
                case 4:
                {
                    m_Signpost = reader.ReadItem();
                    m_SignpostGraphic = reader.ReadInt();

                    goto case 3;
                }
                case 3:
                {
                    m_Type = (FoundationType)reader.ReadInt();

                    goto case 2;
                }
                case 2:
                {
                    m_SignHanger = reader.ReadItem();

                    goto case 1;
                }
                case 1:
                {
                    if ( version < 5 )
                        m_DefaultPrice = reader.ReadInt();

                    goto case 0;
                }
                case 0:
                {
                    if ( version < 3 )
                        m_Type = FoundationType.Stone;

                    if ( version < 4 )
                        m_SignpostGraphic = 9;

                    m_LastRevision = reader.ReadInt();
                    m_Fixtures = reader.ReadItemList();

                    m_Current = new DesignState( this, reader );
                    m_Design = new DesignState( this, reader );
                    m_Backup = new DesignState( this, reader );

                    break;
                }
            }

            base.Deserialize( reader );
        }
예제 #13
0
 public static void GetFoundationGraphics( FoundationType type, out int east, out int south, out int post, out int corner )
 {
     switch ( type )
     {
         default:
         case FoundationType.DarkWood:		corner = 0x0014; east = 0x0015; south = 0x0016; post = 0x0017; break;
         case FoundationType.LightWood:		corner = 0x00BD; east = 0x00BE; south = 0x00BF; post = 0x00C0; break;
         case FoundationType.Dungeon:		corner = 0x02FD; east = 0x02FF; south = 0x02FE; post = 0x0300; break;
         case FoundationType.Brick:			corner = 0x0041; east = 0x0043; south = 0x0042; post = 0x0044; break;
         case FoundationType.Stone:			corner = 0x0065; east = 0x0064; south = 0x0063; post = 0x0066; break;
     }
 }
예제 #14
0
        public static void ApplyFoundation( FoundationType type, MultiComponentList mcl )
        {
            int east, south, post, corner;

            GetFoundationGraphics( type, out east, out south, out post, out corner );

            int xCenter = mcl.Center.X;
            int yCenter = mcl.Center.Y;

            mcl.Add( post, 0 - xCenter, 0 - yCenter, 0 );
            mcl.Add( corner, mcl.Width - 1 - xCenter, mcl.Height - 2 - yCenter, 0 );

            for ( int x = 1; x < mcl.Width; ++x )
            {
                mcl.Add( south, x - xCenter, 0 - yCenter, 0 );

                if ( x < mcl.Width-1 )
                    mcl.Add( south, x - xCenter, mcl.Height - 2 - yCenter, 0 );
            }

            for ( int y = 1; y < mcl.Height - 1; ++y )
            {
                mcl.Add( east, 0 - xCenter, y - yCenter, 0 );

                if ( y < mcl.Height - 2 )
                    mcl.Add( east, mcl.Width - 1 - xCenter, y - yCenter, 0 );
            }
        }
예제 #15
0
		public static void GetFoundationGraphics( FoundationType type, out int east, out int south, out int post, out int corner )
		{
			switch( type )
			{
				default:
				case FoundationType.DarkWood: corner = 0x0014; east = 0x0015; south = 0x0016; post = 0x0017; break;
				case FoundationType.LightWood: corner = 0x00BD; east = 0x00BE; south = 0x00BF; post = 0x00C0; break;
				case FoundationType.Dungeon: corner = 0x02FD; east = 0x02FF; south = 0x02FE; post = 0x0300; break;
				case FoundationType.Brick: corner = 0x0041; east = 0x0043; south = 0x0042; post = 0x0044; break;
				case FoundationType.Stone: corner = 0x0065; east = 0x0064; south = 0x0063; post = 0x0066; break;

				case FoundationType.ElvenGrey: corner = 0x2DF7; east = 0x2DF9; south = 0x2DFA; post = 0x2DF8; break;
				case FoundationType.ElvenNatural: corner = 0x2DFB; east = 0x2DFD; south = 0x2DFE; post = 0x2DFC; break;

				case FoundationType.Crystal: corner = 0x3672; east = 0x3671; south = 0x3670; post = 0x3673; break;
				case FoundationType.Shadow: corner = 0x3676; east = 0x3675; south = 0x3674; post = 0x3677; break;
			}
		}
		public static void GetFoundationGraphics( FoundationType type, out int east, out int south, out int post, out int corner )
		{
			switch ( type )
			{
				default:
				case FoundationType.DarkWood: corner = 0x0014; east = 0x0015; south = 0x0016; post = 0x0017; break;
				case FoundationType.LightWood: corner = 0x00BD; east = 0x00BE; south = 0x00BF; post = 0x00C0; break;
				case FoundationType.Dungeon: corner = 0x02FD; east = 0x02FF; south = 0x02FE; post = 0x0300; break;
				case FoundationType.Brick: corner = 0x0041; east = 0x0043; south = 0x0042; post = 0x0044; break;
				case FoundationType.Stone: corner = 0x0065; east = 0x0064; south = 0x0063; post = 0x0066; break;
				case FoundationType.ElvenStone: corner = 0x2DF7; east = 0x2DF9; south = 0x2DFA; post = 0x2DF8; break;
				case FoundationType.ElvenWood: corner = 0x2DFB; east = 0x2DFD; south = 0x2DFE; post = 0x2DFC; break;
				case FoundationType.ElvenSimple: corner = 0x2BC7; east = 0x2CEF; south = 0x2CF0; post = 0x2BC8; break;
				case FoundationType.ElvenPlain: corner = 0x2DC3; east = 0x2DCF; south = 0x2DD0; post = 0x2DC6; break;
				case FoundationType.Crystal: corner = 0x3672; east = 0x3671; south = 0x3670; post = 0x3673; break;
				case FoundationType.Shadow: corner = 0x3676; east = 0x3675; south = 0x3674; post = 0x3677; break;
                case FoundationType.Jungle: corner = 0x9ABE; east = 0x9AC0; south = 0x9ABF; post = 0x9AC1; break;
                case FoundationType.Shadowguard: corner = 0x9BD0; east = 0x9BD2; south = 0x9BD1; post = 0x9BD3; break;
				case FoundationType.GargishGreenMarble: corner = 0x41A6; east = 0x41A8; south = 0x41A7; post = 0x419E; break;
				case FoundationType.GargishTwoToneStone: corner = 0x415C; east = 0x4166; south = 0x4167; post = 0x415F; break;
			}
		}
 //Common
 private FoundationCatalogResource(int APIversion,
     uint version,
     FoundationType foundation,//Here to avoid same method signature as Version<0x04
     Common common,
     uint wallCatalogIndex,
     uint floorCatalogIndex,
     uint index3,
     uint index4,
     uint unknown5,
     uint unknown6,
     ShapeType shape,
     TGIBlockList ltgib)
     : base(APIversion, version, common, ltgib)
 {
     this.foundation = foundation;
     this.wallCatalogIndex = wallCatalogIndex;
     this.floorCatalogIndex = floorCatalogIndex;
     this.index3 = index3;
     this.index4 = index4;
     this.unknown5 = unknown5;
     this.unknown6 = unknown6;
     this.shape = shape;
 }
        protected override void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);
            base.Parse(s);
            if (version >= 0x00000004)
            {
                this.foundation = (FoundationType)r.ReadUInt32();
                if ((uint)foundation >= (uint)FoundationType.StiltedConcrete)
                {
                    this.materials = new MaterialList(OnResourceChanged, s);
                }
            }
            this.common = new Common(requestedApiVersion, OnResourceChanged, s);
            if (version < 0x00000004)
                this.foundation = (FoundationType)r.ReadUInt32();
            this.wallCatalogIndex = r.ReadUInt32();
            this.floorCatalogIndex = r.ReadUInt32();
            if (version >= 0x00000004)
                this.vpxyIndex = r.ReadUInt32();
            this.index3 = r.ReadUInt32();
            this.index4 = r.ReadUInt32();
            this.unknown5 = r.ReadUInt32();
            this.unknown6 = r.ReadUInt32();
            this.shape = (ShapeType)r.ReadUInt32();

            list = new TGIBlockList(OnResourceChanged, s, tgiPosn, tgiSize);

            if (checking) if (this.GetType().Equals(typeof(FoundationCatalogResource)) && s.Position != s.Length)
                    throw new InvalidDataException(String.Format("Data stream length 0x{0:X8} is {1:X8} bytes longer than expected at {2:X8}",
                        s.Length, s.Length - s.Position, s.Position));
        }
예제 #19
0
 public FoundationTypeData GetFoundationData(FoundationType foundationType)
 {
     return(foundationData.First(pair => pair.Key.Equals(foundationType)).Value);
 }
예제 #20
0
        public override void Deserialize(GenericReader reader)
        {
            int version = reader.ReadInt();

            switch (version)
            {
                case 6:
                    {
                        m_flags = (SaveFlags)reader.ReadInt32();
                        goto case 5;
                    }
                case 5:
                    {
                        // versions < 6 always read Design & Backup
                        if (version < 6)
                        {
                            m_flags |= SaveFlags.DesignState_Design;
                            m_flags |= SaveFlags.DesignState_Backup;
                        }
                        goto case 4;
                    }
                case 4:
                    {
                        m_Signpost = reader.ReadItem();
                        m_SignpostGraphic = reader.ReadInt();
                        goto case 3;
                    }
                case 3:
                    {
                        m_Type = (FoundationType)reader.ReadInt();
                        goto case 2;
                    }
                case 2:
                    {
                        m_SignHanger = reader.ReadItem();
                        goto case 1;
                    }
                case 1:
                    {
                        if (version < 5)
                            m_DefaultPrice = reader.ReadInt();

                        goto case 0;
                    }
                case 0:
                    {
                        if (version < 3)
                            m_Type = FoundationType.Stone;

                        if (version < 4)
                            m_SignpostGraphic = 9;

                        m_LastRevision = reader.ReadInt();
                        m_Fixtures = reader.ReadItemList();

                        m_Current = new DesignState(this, reader);

                        if ((m_flags & SaveFlags.DesignState_Design) != 0)
                            m_Design = new DesignState(this, reader);

                        if ((m_flags & SaveFlags.DesignState_Backup) != 0)
                            m_Backup = new DesignState(this, reader);

                        break;
                    }
            }

            base.Deserialize(reader);
        }
 // PUT: api/FoundationType/5
 public IHttpActionResult Put([FromBody] FoundationType FoundationTypeData)
 {
     foundationTypeRepo.SaveOrUpdate(FoundationTypeData);
     return(Ok(new { Status = "success" }));
 }
예제 #22
0
 public void SetBuildingFoundationSoil(BuildingType buildingType, FoundationType foundationType, SoilType soilType)
 {
     BuildingType   = buildingType;
     FoundationType = foundationType;
     SoilType       = soilType;
 }