Ejemplo n.º 1
0
 private void <RawDataToTiles> m__7(int i, ushort data)
 {
     this.tiles[i].biome = (DefDatabase <BiomeDef> .GetByShortHash(data) ?? BiomeDefOf.TemperateForest);
 }
Ejemplo n.º 2
0
 public static T GetDefById <T>(ushort id) where T : Def => DefDatabase <T> .GetByShortHash(id);
Ejemplo n.º 3
0
        private void RawDataToTiles()
        {
            if (this.tiles.Count != this.TilesCount)
            {
                this.tiles.Clear();
                for (int m = 0; m < this.TilesCount; m++)
                {
                    this.tiles.Add(new Tile());
                }
            }
            else
            {
                for (int j = 0; j < this.TilesCount; j++)
                {
                    this.tiles[j].potentialRoads  = null;
                    this.tiles[j].potentialRivers = null;
                }
            }
            DataSerializeUtility.LoadUshort(this.tileBiome, this.TilesCount, delegate(int i, ushort data)
            {
                this.tiles[i].biome = (DefDatabase <BiomeDef> .GetByShortHash(data) ?? BiomeDefOf.TemperateForest);
            });
            DataSerializeUtility.LoadUshort(this.tileElevation, this.TilesCount, delegate(int i, ushort data)
            {
                this.tiles[i].elevation = (float)(data - 8192);
            });
            DataSerializeUtility.LoadByte(this.tileHilliness, this.TilesCount, delegate(int i, byte data)
            {
                this.tiles[i].hilliness = (Hilliness)data;
            });
            DataSerializeUtility.LoadUshort(this.tileTemperature, this.TilesCount, delegate(int i, ushort data)
            {
                this.tiles[i].temperature = (float)data / 10f - 300f;
            });
            DataSerializeUtility.LoadUshort(this.tileRainfall, this.TilesCount, delegate(int i, ushort data)
            {
                this.tiles[i].rainfall = (float)data;
            });
            DataSerializeUtility.LoadByte(this.tileSwampiness, this.TilesCount, delegate(int i, byte data)
            {
                this.tiles[i].swampiness = (float)data / 255f;
            });
            int[]    array  = DataSerializeUtility.DeserializeInt(this.tileRoadOrigins);
            byte[]   array2 = DataSerializeUtility.DeserializeByte(this.tileRoadAdjacency);
            ushort[] array3 = DataSerializeUtility.DeserializeUshort(this.tileRoadDef);
            for (int k = 0; k < array.Length; k++)
            {
                int     num          = array[k];
                int     tileNeighbor = this.GetTileNeighbor(num, (int)array2[k]);
                RoadDef byShortHash  = DefDatabase <RoadDef> .GetByShortHash(array3[k]);

                if (byShortHash != null)
                {
                    if (this.tiles[num].potentialRoads == null)
                    {
                        this.tiles[num].potentialRoads = new List <Tile.RoadLink>();
                    }
                    if (this.tiles[tileNeighbor].potentialRoads == null)
                    {
                        this.tiles[tileNeighbor].potentialRoads = new List <Tile.RoadLink>();
                    }
                    this.tiles[num].potentialRoads.Add(new Tile.RoadLink
                    {
                        neighbor = tileNeighbor,
                        road     = byShortHash
                    });
                    this.tiles[tileNeighbor].potentialRoads.Add(new Tile.RoadLink
                    {
                        neighbor = num,
                        road     = byShortHash
                    });
                }
            }
            int[]    array4 = DataSerializeUtility.DeserializeInt(this.tileRiverOrigins);
            byte[]   array5 = DataSerializeUtility.DeserializeByte(this.tileRiverAdjacency);
            ushort[] array6 = DataSerializeUtility.DeserializeUshort(this.tileRiverDef);
            for (int l = 0; l < array4.Length; l++)
            {
                int      num2          = array4[l];
                int      tileNeighbor2 = this.GetTileNeighbor(num2, (int)array5[l]);
                RiverDef byShortHash2  = DefDatabase <RiverDef> .GetByShortHash(array6[l]);

                if (byShortHash2 != null)
                {
                    if (this.tiles[num2].potentialRivers == null)
                    {
                        this.tiles[num2].potentialRivers = new List <Tile.RiverLink>();
                    }
                    if (this.tiles[tileNeighbor2].potentialRivers == null)
                    {
                        this.tiles[tileNeighbor2].potentialRivers = new List <Tile.RiverLink>();
                    }
                    this.tiles[num2].potentialRivers.Add(new Tile.RiverLink
                    {
                        neighbor = tileNeighbor2,
                        river    = byShortHash2
                    });
                    this.tiles[tileNeighbor2].potentialRivers.Add(new Tile.RiverLink
                    {
                        neighbor = num2,
                        river    = byShortHash2
                    });
                }
            }
        }
Ejemplo n.º 4
0
 private static T GetDefById <T>(ushort id) where T : Def, new() => DefDatabase <T> .GetByShortHash(id);