Ejemplo n.º 1
0
        private static void CheckPoint(GameArea Area, List <Point> BlackAngles, Point point, GameScenario Scenario, Faction faction)
        {
            TerrainDetail terrainDetailByPosition = Scenario.GetTerrainDetailByPosition(point);

            if (terrainDetailByPosition != null)
            {
                if (terrainDetailByPosition.ViewThrough)
                {
                    if (faction != null)
                    {
                        Architecture architectureByPosition = Scenario.GetArchitectureByPosition(point);
                        if (!(architectureByPosition == null || architectureByPosition.Endurance <= 0 || faction.IsFriendlyWithoutTruce(architectureByPosition.BelongedFaction)))
                        {
                            BlackAngles.Add(point);
                            return;
                        }
                    }
                    if (!IsInBlackAngle(Area.Centre, BlackAngles, point))
                    {
                        Area.AddPoint(point);
                    }
                }
                else
                {
                    BlackAngles.Add(point);
                }
            }
        }
Ejemplo n.º 2
0
        public void Extend(Point p)
        {
            RoutePoint point = new RoutePoint();

            point.Position = p;
            TerrainDetail terrainDetailByPosition = base.Scenario.GetTerrainDetailByPosition(p);

            if (this.RoutePoints.Count <= 0)
            {
                point.Index             = 0;
                point.PreviousDirection = SimpleDirection.None;
                point.Direction         = SimpleDirection.None;
                point.ConsumptionRate   = terrainDetailByPosition.RoutewayConsumptionRate * this.BelongedFaction.RateOfRoutewayConsumption;
                point.BuildFundCost     = (int)(terrainDetailByPosition.RoutewayBuildFundCost * this.StartArchitecture.RateOfRoutewayBuildFundCost);
                point.ActiveFundCost    = terrainDetailByPosition.RoutewayActiveFundCost;
                point.BuildWorkCost     = terrainDetailByPosition.RoutewayBuildWorkCost;
            }
            else
            {
                point.Index = this.LastPoint.Index + 1;
                int num  = p.X - this.LastPoint.Position.X;
                int num2 = p.Y - this.LastPoint.Position.Y;
                switch (num)
                {
                case -1:
                    this.LastPoint.Direction = SimpleDirection.Left;
                    break;

                case 0:
                    switch (num2)
                    {
                    case -1:
                        this.LastPoint.Direction = SimpleDirection.Up;
                        break;

                    case 1:
                        this.LastPoint.Direction = SimpleDirection.Down;
                        break;
                    }
                    break;

                case 1:
                    this.LastPoint.Direction = SimpleDirection.Right;
                    break;
                }
                point.PreviousDirection = this.LastPoint.Direction;
                point.Direction         = SimpleDirection.None;
                point.ConsumptionRate   = this.LastPoint.ConsumptionRate + (terrainDetailByPosition.RoutewayConsumptionRate * this.BelongedFaction.RateOfRoutewayConsumption);
                point.BuildFundCost     = this.LastPoint.BuildFundCost + ((int)(terrainDetailByPosition.RoutewayBuildFundCost * this.StartArchitecture.RateOfRoutewayBuildFundCost));
                point.ActiveFundCost    = this.LastPoint.ActiveFundCost + terrainDetailByPosition.RoutewayActiveFundCost;
                point.BuildWorkCost     = terrainDetailByPosition.RoutewayBuildWorkCost;
            }
            point.BelongedRouteway = this;
            this.RoutePoints.AddLast(point);
            if (this.LastActivePointIndex >= point.Index)
            {
                this.BelongedFaction.AddPositionInformation(p, GlobalVariables.RoutewayInformationLevel);
            }
            base.Scenario.MapTileData[p.X, p.Y].AddTileRouteway(this);
        }
Ejemplo n.º 3
0
 void Awake()
 {
     m_terrainDetail = (TerrainDetail)PlayerPrefs.GetInt(m_terrainPrefs, (int)TerrainDetail.High);
     print("Terrain detail loaded: " + m_terrainDetail);
     m_qualityNames = QualitySettings.names;
     m_qualityIndex = QualitySettings.GetQualityLevel();
 }
 public void PrepareMap()
 {
     this.Tiles = null;
     this.Tiles = new Tile[this.mainMap.MapDimensions.X, this.mainMap.MapDimensions.Y];
     for (int i = 0; i < this.mainMap.MapDimensions.X; i++)
     {
         for (int j = 0; j < this.mainMap.MapDimensions.Y; j++)
         {
             this.Tiles[i, j]          = new Tile();
             this.Tiles[i, j].Position = new Point(i, j);
             TerrainDetail terrainDetailByPositionNoCheck = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(this.Tiles[i, j].Position);
             if (terrainDetailByPositionNoCheck != null)
             {
                 if (terrainDetailByPositionNoCheck.Textures.BasicTextures.Count > 0)
                 {
                     this.Tiles[i, j].TileTexture = terrainDetailByPositionNoCheck.Textures.BasicTextures[((i * 7) + (j * 11)) % terrainDetailByPositionNoCheck.Textures.BasicTextures.Count];
                 }
                 else
                 {
                     this.Tiles[i, j].TileTexture = this.screen.Textures.TerrainTextures[this.mainMap.MapData[i, j]];
                 }
             }
         }
     }
 }
Ejemplo n.º 5
0
    private void IncreaseQuality()
    {
        if (m_lastIncreaseWasTerrain)
        {
            print(Time.time + ": Increasing graphics quality");
            if (m_qualityIndex < m_qualityNames.Length - 1)
            {
                m_qualityIndex++;
                m_qualityIndex = Math.Min(m_qualityIndex, m_qualityNames.Length - 1);
                UpdateGraphicsQuality();
            }
        }
        else
        {
            print(Time.time + ": Increasing terrain detail");
            if (m_terrainDetail > TerrainDetail.High)
            {
                m_terrainDetail--;
                m_terrainDetail = (TerrainDetail)Math.Max((int)m_terrainDetail, (int)TerrainDetail.High);
                UpdateTerrainDetail();
            }
        }

        m_lastIncreaseWasTerrain = !m_lastIncreaseWasTerrain;
    }
Ejemplo n.º 6
0
    private void DecreaseQuality()
    {
        if (m_lastDecreaseWasTerrain)
        {
            print(Time.time + ": Decreasing graphics quality");
            if (m_qualityIndex > 0)
            {
                m_qualityIndex--;
                m_qualityIndex = Math.Max(m_qualityIndex, 0);
                UpdateGraphicsQuality();
            }
        }
        else
        {
            print(Time.time + ": Decreasing terrain detail");
            if (m_terrainDetail < TerrainDetail.SuperLow)
            {
                m_terrainDetail++;
                m_terrainDetail = (TerrainDetail)Math.Min((int)m_terrainDetail, (int)TerrainDetail.SuperLow);
                UpdateTerrainDetail();
            }
        }

        m_lastDecreaseWasTerrain = !m_lastDecreaseWasTerrain;
    }
Ejemplo n.º 7
0
 public void DeleteTerrain(string terrainId)
 {
     using (var db = new FeudalismContext())
     {
         SelectedTerrain = db.TerrainDetails.Where(td => td.TerrainDetailId == terrainId).FirstOrDefault();
         db.TerrainDetails.RemoveRange(SelectedTerrain);
         db.SaveChanges();
     }
 }
Ejemplo n.º 8
0
 public void UpdateTerrain(string terrainId, int travelSpeed, string terrainDescription)
 {
     using (var db = new FeudalismContext())
     {
         SelectedTerrain = db.TerrainDetails.Where(td => td.TerrainDetailId == terrainId).FirstOrDefault();
         SelectedTerrain.TerrainDescription = terrainDescription;
         SelectedTerrain.TravelSpeed        = travelSpeed;
         db.SaveChanges();
     }
 }
Ejemplo n.º 9
0
        private bool IsPositionPossible(Point p)
        {
            if (base.Scenario.GetArchitectureByPosition(p) != null)
            {
                return(false);
            }
            TerrainDetail terrainDetailByPosition = base.Scenario.GetTerrainDetailByPosition(p);

            return((terrainDetailByPosition != null) && ((this.BelongedFaction.RoutewayWorkForce >= terrainDetailByPosition.RoutewayBuildWorkCost) && (Math.Round((double)(terrainDetailByPosition.RoutewayConsumptionRate + this.LastPoint.ConsumptionRate), 3) < 1.0)));
        }
Ejemplo n.º 10
0
    private void UpdateDetailLevels(TerrainDetail terrainDetail)
    {
        for (int i = 0; i < m_detailLevels.Length; i++)
        {
            m_detailLevels[i].m_lod = Math.Min(5, m_startDetailLevels[i].m_lod + (int)terrainDetail);
        }

        if (m_updateTerrainDetail)
        {
            UpdateAllVisibleChunks();
        }
    }
Ejemplo n.º 11
0
        public void PrepareMap()
        {
            this.Tiles = null;
            this.Tiles = new Tile[this.mainMap.MapDimensions.X, this.mainMap.MapDimensions.Y];
            for (int i = 0; i < this.mainMap.MapDimensions.X; i++)
            {
                for (int j = 0; j < this.mainMap.MapDimensions.Y; j++)
                {
                    this.Tiles[i, j]          = new Tile();
                    this.Tiles[i, j].Position = new Point(i, j);
                    TerrainDetail terrainDetailByPositionNoCheck = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(this.Tiles[i, j].Position);

                    if (terrainDetailByPositionNoCheck != null)
                    {
                        if (terrainDetailByPositionNoCheck.Textures.BasicTextures.Count > 0)
                        {
                            this.Tiles[i, j].TileTexture = terrainDetailByPositionNoCheck.Textures.BasicTextures[((i * 7) + (j * 11)) % terrainDetailByPositionNoCheck.Textures.BasicTextures.Count];
                        }
                        else
                        {
                            this.Tiles[i, j].TileTexture = this.screen.Textures.TerrainTextures[this.mainMap.MapData[i, j]];
                        }
                    }
                }
            }

            this.MapTiles = null;
            this.MapTiles = new MapTile[this.mainMap.NumberOfTiles, this.mainMap.NumberOfTiles];
            for (int i = 0; i < this.mainMap.NumberOfTiles; i++)
            {
                for (int j = 0; j < this.mainMap.NumberOfTiles; j++)
                {
                    this.MapTiles[i, j]          = new MapTile();
                    this.MapTiles[i, j].Position = new Point(i, j);
                    this.MapTiles[i, j].number   = (i + j * this.mainMap.NumberOfTiles).ToString();

                    /*TerrainDetail terrainDetailByPositionNoCheck = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(this.Tiles[i, j].Position);
                     *
                     * if (terrainDetailByPositionNoCheck != null)
                     * {
                     *  if (terrainDetailByPositionNoCheck.Textures.BasicTextures.Count > 0)
                     *  {
                     *      this.Tiles[i, j].TileTexture = terrainDetailByPositionNoCheck.Textures.BasicTextures[((i * 7) + (j * 11)) % terrainDetailByPositionNoCheck.Textures.BasicTextures.Count];
                     *  }
                     *  else
                     *  {
                     *      this.Tiles[i, j].TileTexture = this.screen.Textures.TerrainTextures[this.mainMap.MapData[i, j]];
                     *  }
                     * }*/
                }
            }
        }
Ejemplo n.º 12
0
    private void UpdateTerrainDetail()
    {
        m_terrainDetail = (TerrainDetail)(((int)m_terrainDetail + ((int)TerrainDetail.SuperLow + 1))
                                          % ((int)TerrainDetail.SuperLow + 1));

        if (m_terrainDetail != TerrainDetail)
        {
            TerrainDetail = m_terrainDetail;
            PlayerPrefs.SetInt(m_terrainPrefs, (int)m_terrainDetail);
            print("Terrain detail saved: " + m_terrainDetail);
            EventManager.TriggerEvent(IntegerEventName.ChangeTerrainDetail, (int)m_terrainDetail);
        }
    }
Ejemplo n.º 13
0
        public void CreateTerrain(string terrainDetailId, int travelSpeed, string terrainDescription = "")
        {
            var newTerrain = new TerrainDetail()
            {
                TerrainDetailId = terrainDetailId, TerrainDescription = terrainDescription, TravelSpeed = travelSpeed
            };

            using (var db = new FeudalismContext())
            {
                db.TerrainDetails.Add(newTerrain);
                db.SaveChanges();
            }
        }
Ejemplo n.º 14
0
 public void WhenATerrainIsRemoved_ItIsNoLongerInTheDatabase()
 {
     using (var db = new FeudalismContext())
     {
         var newTerrain = new TerrainDetail()
         {
             TerrainDescription = "LavaFlow", TravelSpeed = 10
         };
         db.TerrainDetails.Add(newTerrain);
         db.SaveChanges();
         var terrainID = db.TerrainDetails.Where(td => td.TerrainDetailId == "LavaFlow").FirstOrDefault().TerrainDetailId;
         _terrainManager.DeleteTerrain(terrainID);
         var LAVACount = db.TerrainDetails.Where(td => td.TerrainDetailId == "LavaFlow").Count();
         Assert.AreEqual(0, LAVACount);
     }
 }
Ejemplo n.º 15
0
        public void chongsheditukuaitupian(int i, int j)
        {
            this.Tiles[i, j]          = new Tile();
            this.Tiles[i, j].Position = new Point(i, j);
            TerrainDetail terrainDetailByPositionNoCheck = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(this.Tiles[i, j].Position);

            if (terrainDetailByPositionNoCheck != null)
            {
                if (terrainDetailByPositionNoCheck.Textures.BasicTextures.Count > 0)
                {
                    this.Tiles[i, j].TileTexture = terrainDetailByPositionNoCheck.Textures.BasicTextures[((i * 7) + (j * 11)) % terrainDetailByPositionNoCheck.Textures.BasicTextures.Count];
                }
                else
                {
                    this.Tiles[i, j].TileTexture = this.screen.Textures.TerrainTextures[this.mainMap.MapData[i, j]];
                }
            }

            this.ReCalculateTileDestination(device);
        }
Ejemplo n.º 16
0
 private void screen_OnMouseLeftDown(Point position)
 {
     if (StaticMethods.PointInRectangle(position, this.BackgroundDisplayPosition))
     {
         if (StaticMethods.PointInRectangle(position, this.ExtendButtonDisplayPosition))
         {
             if ((this.ExtendButtonState == ButtonState.Selected) || (this.ExtendButtonState == ButtonState.Normal))
             {
                 this.ExtendButtonState = ButtonState.Down;
             }
             else if (this.ExtendButtonState == ButtonState.Down)
             {
                 this.ExtendButtonState = ButtonState.Selected;
             }
             if (this.CutButtonState == ButtonState.Down)
             {
                 this.CutButtonState = ButtonState.Normal;
             }
         }
         else if (StaticMethods.PointInRectangle(position, this.CutButtonDisplayPosition))
         {
             if (this.ExtendButtonState == ButtonState.Down)
             {
                 this.ExtendButtonState = ButtonState.Normal;
             }
             if ((this.CutButtonState == ButtonState.Normal) || (this.CutButtonState == ButtonState.Selected))
             {
                 this.CutButtonState = ButtonState.Down;
             }
             else if (this.CutButtonState == ButtonState.Down)
             {
                 this.CutButtonState = ButtonState.Selected;
             }
         }
         else if (StaticMethods.PointInRectangle(position, this.DirectionSwitchDisplayPosition))
         {
             if ((this.DirectionSwitchState == ButtonState.Normal) || (this.DirectionSwitchState == ButtonState.Selected))
             {
                 if (this.ExtendButtonState == ButtonState.Down)
                 {
                     this.ExtendButtonState = ButtonState.Normal;
                 }
                 if (this.CutButtonState == ButtonState.Down)
                 {
                     this.CutButtonState = ButtonState.Normal;
                 }
                 this.EditingRouteway.ReverseDirection();
             }
         }
         else if (StaticMethods.PointInRectangle(position, this.BuildButtonDisplayPosition))
         {
             this.BuildButtonState = ButtonState.Down;
         }
         else if (StaticMethods.PointInRectangle(position, this.EndButtonDisplayPosition))
         {
             this.EndButtonState = ButtonState.Down;
         }
     }
     else
     {
         Point positionByPoint;
         if (this.ExtendButtonState == ButtonState.Down)
         {
             GameArea currentExtendArea = this.EditingRouteway.CurrentExtendArea;
             if (currentExtendArea != null)
             {
                 positionByPoint = this.screen.GetPositionByPoint(position);
                 if (currentExtendArea.HasPoint(positionByPoint))
                 {
                     TerrainDetail terrainDetailByPosition = this.screen.Scenario.GetTerrainDetailByPosition(positionByPoint);
                     if ((terrainDetailByPosition != null) && ((terrainDetailByPosition.RoutewayConsumptionRate + this.EditingRouteway.LastPoint.ConsumptionRate) < 1f))
                     {
                         this.ExtendRouteway(positionByPoint);
                         this.extending = true;
                     }
                 }
             }
         }
         else if (this.CutButtonState == ButtonState.Down)
         {
             positionByPoint = this.screen.GetPositionByPoint(position);
             if (this.CutRouteway(positionByPoint))
             {
                 this.screen.Scenario.RemoveRouteway(this.EditingRouteway);
                 this.IsShowing = false;
             }
         }
     }
 }
Ejemplo n.º 17
0
        public void Draw(SpriteBatch spriteBatch)
        {
            if (this.EditingRouteway.RoutePoints.Count != 0)
            {
                Rectangle?sourceRectangle = null;
                spriteBatch.Draw(this.BackgroundTexture, this.BackgroundDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.25f);
                this.TitleText.Draw(spriteBatch, 0.2499f);
                switch (this.ExtendButtonState)
                {
                case ButtonState.Normal:
                    sourceRectangle = null;
                    spriteBatch.Draw(this.ExtendButtonTexture, this.ExtendButtonDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.249f);
                    break;

                case ButtonState.Selected:
                    sourceRectangle = null;
                    spriteBatch.Draw(this.ExtendButtonSelectedTexture, this.ExtendButtonDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.249f);
                    break;

                case ButtonState.Down:
                    sourceRectangle = null;
                    spriteBatch.Draw(this.ExtendButtonDownTexture, this.ExtendButtonDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.249f);
                    break;

                case ButtonState.Disabled:
                    sourceRectangle = null;
                    spriteBatch.Draw(this.ExtendButtonDisabledTexture, this.ExtendButtonDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.249f);
                    break;
                }
                switch (this.CutButtonState)
                {
                case ButtonState.Normal:
                    sourceRectangle = null;
                    spriteBatch.Draw(this.CutButtonTexture, this.CutButtonDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.249f);
                    break;

                case ButtonState.Selected:
                    sourceRectangle = null;
                    spriteBatch.Draw(this.CutButtonSelectedTexture, this.CutButtonDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.249f);
                    break;

                case ButtonState.Down:
                    sourceRectangle = null;
                    spriteBatch.Draw(this.CutButtonDownTexture, this.CutButtonDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.249f);
                    break;

                case ButtonState.Disabled:
                    sourceRectangle = null;
                    spriteBatch.Draw(this.CutButtonDisabledTexture, this.CutButtonDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.249f);
                    break;
                }
                switch (this.DirectionSwitchState)
                {
                case ButtonState.Normal:
                    sourceRectangle = null;
                    spriteBatch.Draw(this.DirectionSwitchTexture, this.DirectionSwitchDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.249f);
                    break;

                case ButtonState.Selected:
                    sourceRectangle = null;
                    spriteBatch.Draw(this.DirectionSwitchSelectedTexture, this.DirectionSwitchDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.249f);
                    break;

                case ButtonState.Disabled:
                    sourceRectangle = null;
                    spriteBatch.Draw(this.DirectionSwitchDisabledTexture, this.DirectionSwitchDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.249f);
                    break;
                }
                switch (this.BuildButtonState)
                {
                case ButtonState.Normal:
                    sourceRectangle = null;
                    spriteBatch.Draw(this.BuildButtonTexture, this.BuildButtonDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.249f);
                    break;

                case ButtonState.Selected:
                    sourceRectangle = null;
                    spriteBatch.Draw(this.BuildButtonSelectedTexture, this.BuildButtonDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.249f);
                    break;

                case ButtonState.Down:
                    sourceRectangle = null;
                    spriteBatch.Draw(this.BuildButtonDownTexture, this.BuildButtonDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.249f);
                    break;
                }
                switch (this.EndButtonState)
                {
                case ButtonState.Normal:
                    sourceRectangle = null;
                    spriteBatch.Draw(this.EndButtonTexture, this.EndButtonDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.249f);
                    break;

                case ButtonState.Selected:
                    sourceRectangle = null;
                    spriteBatch.Draw(this.EndButtonSelectedTexture, this.EndButtonDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.249f);
                    break;

                case ButtonState.Down:
                    sourceRectangle = null;
                    spriteBatch.Draw(this.EndButtonDownTexture, this.EndButtonDisplayPosition, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.249f);
                    break;
                }
                if (this.ExtendButtonState == ButtonState.Down)
                {
                    this.ClearExtendPointTexts();
                    GameArea currentExtendArea = this.EditingRouteway.CurrentExtendArea;
                    for (int i = 0; i < currentExtendArea.Count; i++)
                    {
                        if (this.screen.TileInScreen(currentExtendArea[i]))
                        {
                            Rectangle destination = this.screen.GetDestination(currentExtendArea[i]);
                            if (this.screen.Scenario.GetRoutewayArchitecturesByPosition(this.EditingRouteway, currentExtendArea[i]).Count > 0)
                            {
                                sourceRectangle = null;
                                spriteBatch.Draw(this.ExtendPointEndTexture, destination, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.8498001f);
                            }
                            else
                            {
                                sourceRectangle = null;
                                spriteBatch.Draw(this.ExtendPointTexture, destination, sourceRectangle, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.8498001f);
                            }
                            TerrainDetail terrainDetailByPosition = this.screen.Scenario.GetTerrainDetailByPosition(currentExtendArea[i]);
                            this.ExtendPointTexts[i].Position      = new Rectangle(0, 0, destination.Width, destination.Height);
                            this.ExtendPointTexts[i].Text          = StaticMethods.GetPercentString((terrainDetailByPosition.RoutewayConsumptionRate * this.EditingRouteway.BelongedFaction.RateOfRoutewayConsumption) + this.EditingRouteway.LastPoint.ConsumptionRate, 1);
                            this.ExtendPointTexts[i].DisplayOffset = new Point(destination.X, destination.Y);
                        }
                    }
                    foreach (FreeText text in this.ExtendPointTexts)
                    {
                        text.Draw(spriteBatch, 0.8499f);
                    }
                }
                if (!((!this.commentDrawing || this.draging) || this.extending))
                {
                    spriteBatch.Draw(this.CommentBackgroundTexture, this.CommentDisplayPosition, null, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.25f);
                    this.Comment.Draw(spriteBatch, 0.2499f);
                }
            }
        }
Ejemplo n.º 18
0
        private void CheckTileTexture(Tile tile, out List <Texture2D> decorativeTextures)
        {
            decorativeTextures = null;
            TerrainDetail terrainDetailByPositionNoCheck = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(tile.Position);

            if (terrainDetailByPositionNoCheck.Textures != null && terrainDetailByPositionNoCheck.Textures.BasicTextures.Count != 0)
            {
                int        i;
                List <int> list;
                int        num12;
                for (i = 0; i < this.TerrainList.Count; i++)
                {
                    this.TerrainList[i] = 0;
                }
                TerrainDirection direction = TerrainDirection.None;
                int num2 = 0;

                Point         position   = new Point(tile.Position.X - 1, tile.Position.Y);
                int           leftId     = 0;
                TerrainDetail leftDetail = null;
                if (!this.screen.Scenario.PositionOutOfRange(position))
                {
                    leftDetail = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(position);
                    leftId     = leftDetail.ID;
                    //(list = this.TerrainList)[num12 = this.mainMap.MapData[position.X, position.Y]] = list[num12] + 1;
                }
                Point point2    = new Point(tile.Position.X - 1, tile.Position.Y - 1);
                int   topLeftId = 0;
                if (!this.screen.Scenario.PositionOutOfRange(point2))
                {
                    topLeftId = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(point2).ID;
                    //(list = this.TerrainList)[num12 = this.mainMap.MapData[point2.X, point2.Y]] = list[num12] + 1;
                }
                Point         point3 = new Point(tile.Position.X, tile.Position.Y - 1);
                int           topId  = 0;
                TerrainDetail top    = null;
                if (!this.screen.Scenario.PositionOutOfRange(point3))
                {
                    top   = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(point3);
                    topId = top.ID;
                }
                Point point4     = new Point(tile.Position.X + 1, tile.Position.Y - 1);
                int   topRightId = 0;
                if (!this.screen.Scenario.PositionOutOfRange(point4))
                {
                    topRightId = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(point4).ID;
                }
                Point         point5  = new Point(tile.Position.X + 1, tile.Position.Y);
                int           rightId = 0;
                TerrainDetail right   = null;
                if (!this.screen.Scenario.PositionOutOfRange(point5))
                {
                    right   = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(point5);
                    rightId = right.ID;
                }
                Point point6        = new Point(tile.Position.X + 1, tile.Position.Y + 1);
                int   bottomRightId = 0;
                if (!this.screen.Scenario.PositionOutOfRange(point6))
                {
                    bottomRightId = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(point6).ID;
                }
                Point         point7   = new Point(tile.Position.X, tile.Position.Y + 1);
                int           bottomId = 0;
                TerrainDetail bottom   = null;
                if (!this.screen.Scenario.PositionOutOfRange(point7))
                {
                    bottom   = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(point7);
                    bottomId = bottom.ID;
                }
                Point point8       = new Point(tile.Position.X - 1, tile.Position.Y + 1);
                int   bottomLeftId = 0;
                if (!this.screen.Scenario.PositionOutOfRange(point8))
                {
                    bottomLeftId = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(point8).ID;
                }

                int equalTerrainCnt = 0;
                if ((leftId > 0) && (leftId == terrainDetailByPositionNoCheck.ID))
                {
                    equalTerrainCnt++;
                }
                if ((topId > 0) && (topId == terrainDetailByPositionNoCheck.ID))
                {
                    equalTerrainCnt++;
                }
                if ((rightId > 0) && (rightId == terrainDetailByPositionNoCheck.ID))
                {
                    equalTerrainCnt++;
                }
                if ((bottomId > 0) && (bottomId == terrainDetailByPositionNoCheck.ID))
                {
                    equalTerrainCnt++;
                }

                if (equalTerrainCnt < 4)
                {
                    if (top != null)
                    {
                        (list = this.TerrainList)[num12 = this.mainMap.MapData[point3.X, point3.Y]] = list[num12] + 1;
                        for (i = 0; i < this.TerrainList.Count; i++)
                        {
                            if ((i != terrainDetailByPositionNoCheck.ID) && ((((this.TerrainList[i] >= 2) && (leftId == i)) && (topLeftId != terrainDetailByPositionNoCheck.ID)) && (topId == i)))
                            {
                                direction = TerrainDirection.TopLeft;
                                num2      = i;
                                break;
                            }
                        }
                    }
                    if (topRightId > 0)
                    {
                        (list = this.TerrainList)[num12 = this.mainMap.MapData[point4.X, point4.Y]] = list[num12] + 1;
                    }
                    if (rightId > 0)
                    {
                        (list = this.TerrainList)[num12 = this.mainMap.MapData[point5.X, point5.Y]] = list[num12] + 1;
                        for (i = 0; i < this.TerrainList.Count; i++)
                        {
                            if (i != terrainDetailByPositionNoCheck.ID)
                            {
                                if (((direction == TerrainDirection.None) && (this.TerrainList[i] >= 2)) && (((topId == i) && (topRightId != terrainDetailByPositionNoCheck.ID)) && (rightId == i)))
                                {
                                    direction = TerrainDirection.TopRight;
                                    num2      = i;
                                }
                                if (this.TerrainList[i] >= 3)
                                {
                                    if ((((leftId == i) && (topId == i)) && ((rightId == i) && (topRightId != terrainDetailByPositionNoCheck.ID))) && (topLeftId != terrainDetailByPositionNoCheck.ID))
                                    {
                                        direction = TerrainDirection.Top;
                                        num2      = i;
                                    }
                                    break;
                                }
                            }
                        }
                    }
                    if (bottomRightId > 0)
                    {
                        (list = this.TerrainList)[num12 = this.mainMap.MapData[point6.X, point6.Y]] = list[num12] + 1;
                    }
                    if (bottomId > 0)
                    {
                        (list = this.TerrainList)[num12 = this.mainMap.MapData[point7.X, point7.Y]] = list[num12] + 1;
                        for (i = 0; i < this.TerrainList.Count; i++)
                        {
                            if (i != terrainDetailByPositionNoCheck.ID)
                            {
                                if (((direction == TerrainDirection.None) && (this.TerrainList[i] >= 2)) && (((rightId == i) && (bottomRightId != terrainDetailByPositionNoCheck.ID)) && (bottomId == i)))
                                {
                                    direction = TerrainDirection.BottomRight;
                                    num2      = i;
                                }
                                if ((this.TerrainList[i] >= 3) && ((((topId == i) && (rightId == i)) && ((bottomId == i) && (topRightId != terrainDetailByPositionNoCheck.ID))) && (bottomRightId != terrainDetailByPositionNoCheck.ID)))
                                {
                                    direction = TerrainDirection.Right;
                                    num2      = i;
                                }
                            }
                        }
                    }
                    if (bottomLeftId > 0)
                    {
                        (list = this.TerrainList)[num12 = this.mainMap.MapData[point8.X, point8.Y]] = list[num12] + 1;
                    }
                    if (leftId > 0)
                    {
                        for (i = 0; i < this.TerrainList.Count; i++)
                        {
                            if (i != terrainDetailByPositionNoCheck.ID)
                            {
                                if (((direction == TerrainDirection.None) && (this.TerrainList[i] >= 2)) && (((bottomId == i) && (bottomLeftId != terrainDetailByPositionNoCheck.ID)) && (leftId == i)))
                                {
                                    direction = TerrainDirection.BottomLeft;
                                    num2      = i;
                                }
                                if ((this.TerrainList[i] >= 3) && ((((rightId == i) && (bottomId == i)) && ((leftId == i) && (bottomRightId != terrainDetailByPositionNoCheck.ID))) && (bottomLeftId != terrainDetailByPositionNoCheck.ID)))
                                {
                                    direction = TerrainDirection.Bottom;
                                    num2      = i;
                                }
                                if (((((this.TerrainList[i] >= 4) && (leftId == i)) && ((topId == i) && (rightId == i))) && (bottomId == i)) && ((((topLeftId != terrainDetailByPositionNoCheck.ID) && (topRightId != terrainDetailByPositionNoCheck.ID)) && ((bottomRightId != terrainDetailByPositionNoCheck.ID) && (bottomLeftId != terrainDetailByPositionNoCheck.ID))) || (this.TerrainList[i] >= 7)))
                                {
                                    direction = TerrainDirection.Centre;
                                    num2      = i;
                                    break;
                                }
                            }
                        }
                    }
                    if ((((direction != TerrainDirection.Centre) && (direction != TerrainDirection.Top)) && ((direction != TerrainDirection.Right) && (direction != TerrainDirection.Bottom))) && (topId > 0))
                    {
                        for (i = 0; i < this.TerrainList.Count; i++)
                        {
                            if (((i != terrainDetailByPositionNoCheck.ID) && (this.TerrainList[i] >= 3)) && ((((bottomId == i) && (leftId == i)) && ((topId == i) && (bottomLeftId != terrainDetailByPositionNoCheck.ID))) && (topLeftId != terrainDetailByPositionNoCheck.ID)))
                            {
                                direction = TerrainDirection.Left;
                                num2      = i;
                            }
                        }
                    }
                    decorativeTextures = new List <Texture2D>();
                    switch (direction)
                    {
                    case TerrainDirection.Top:
                        decorativeTextures.Add(top.Textures.TopTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % top.Textures.TopTextures.Count]);
                        if ((((bottom != null) && (bottom.ID != terrainDetailByPositionNoCheck.ID)) && ((bottomRightId != terrainDetailByPositionNoCheck.ID) && (bottomLeftId != terrainDetailByPositionNoCheck.ID))) && (bottom.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                        {
                            decorativeTextures.Add(bottom.Textures.BottomEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % bottom.Textures.BottomEdgeTextures.Count]);
                        }
                        return;

                    case TerrainDirection.Left:
                        decorativeTextures.Add(leftDetail.Textures.LeftTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % leftDetail.Textures.LeftTextures.Count]);
                        if ((((right != null) && (right.ID != terrainDetailByPositionNoCheck.ID)) && ((topRightId != terrainDetailByPositionNoCheck.ID) && (bottomRightId != terrainDetailByPositionNoCheck.ID))) && (right.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                        {
                            decorativeTextures.Add(right.Textures.RightEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % right.Textures.RightEdgeTextures.Count]);
                        }
                        return;

                    case TerrainDirection.Right:
                        decorativeTextures.Add(right.Textures.RightTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % right.Textures.RightTextures.Count]);
                        if ((((leftDetail != null) && (leftDetail.ID != terrainDetailByPositionNoCheck.ID)) && ((bottomLeftId != terrainDetailByPositionNoCheck.ID) && (topLeftId != terrainDetailByPositionNoCheck.ID))) && (leftDetail.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                        {
                            decorativeTextures.Add(leftDetail.Textures.LeftEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % leftDetail.Textures.LeftEdgeTextures.Count]);
                        }
                        return;

                    case TerrainDirection.Bottom:
                        decorativeTextures.Add(bottom.Textures.BottomTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % bottom.Textures.BottomTextures.Count]);
                        if ((((top != null) && (top.ID != terrainDetailByPositionNoCheck.ID)) && ((topLeftId != terrainDetailByPositionNoCheck.ID) && (topRightId != terrainDetailByPositionNoCheck.ID))) && (top.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                        {
                            decorativeTextures.Add(top.Textures.TopEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % top.Textures.TopEdgeTextures.Count]);
                        }
                        return;

                    case TerrainDirection.TopLeft:
                        decorativeTextures.Add(leftDetail.Textures.TopLeftCornerTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % leftDetail.Textures.TopLeftCornerTextures.Count]);
                        if ((((right == null) || (terrainDetailByPositionNoCheck.ID == bottomRightId)) || (rightId != bottomId)) || (terrainDetailByPositionNoCheck.ID == rightId))
                        {
                            if ((((right != null) && (right.ID != terrainDetailByPositionNoCheck.ID)) && ((topRightId != terrainDetailByPositionNoCheck.ID) && (bottomRightId != terrainDetailByPositionNoCheck.ID))) && (right.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                            {
                                decorativeTextures.Add(right.Textures.RightEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % right.Textures.RightEdgeTextures.Count]);
                            }
                            if ((((bottom != null) && (bottom.ID != terrainDetailByPositionNoCheck.ID)) && ((bottomRightId != terrainDetailByPositionNoCheck.ID) && (bottomLeftId != terrainDetailByPositionNoCheck.ID))) && (bottom.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                            {
                                decorativeTextures.Add(bottom.Textures.BottomEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % bottom.Textures.BottomEdgeTextures.Count]);
                            }
                            return;
                        }
                        decorativeTextures.Add(right.Textures.BottomRightCornerTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % right.Textures.BottomRightCornerTextures.Count]);
                        return;

                    case TerrainDirection.TopRight:
                        decorativeTextures.Add(top.Textures.TopRightCornerTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % top.Textures.TopRightCornerTextures.Count]);
                        if ((((bottom == null) || (terrainDetailByPositionNoCheck.ID == bottomLeftId)) || (bottomId != leftId)) || (terrainDetailByPositionNoCheck.ID == bottomId))
                        {
                            if ((((leftDetail != null) && (leftDetail.ID != terrainDetailByPositionNoCheck.ID)) && ((bottomLeftId != terrainDetailByPositionNoCheck.ID) && (topLeftId != terrainDetailByPositionNoCheck.ID))) && (leftDetail.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                            {
                                decorativeTextures.Add(leftDetail.Textures.LeftEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % leftDetail.Textures.LeftEdgeTextures.Count]);
                            }
                            if ((((bottom != null) && (bottom.ID != terrainDetailByPositionNoCheck.ID)) && ((bottomRightId != terrainDetailByPositionNoCheck.ID) && (bottomLeftId != terrainDetailByPositionNoCheck.ID))) && (bottom.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                            {
                                decorativeTextures.Add(bottom.Textures.BottomEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % bottom.Textures.BottomEdgeTextures.Count]);
                            }
                            return;
                        }
                        decorativeTextures.Add(bottom.Textures.BottomLeftCornerTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % bottom.Textures.BottomLeftCornerTextures.Count]);
                        return;

                    case TerrainDirection.BottomLeft:
                        decorativeTextures.Add(bottom.Textures.BottomLeftCornerTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % bottom.Textures.BottomLeftCornerTextures.Count]);
                        if ((((top == null) || (terrainDetailByPositionNoCheck.ID == topRightId)) || (topId != rightId)) || (terrainDetailByPositionNoCheck.ID == topId))
                        {
                            if ((((top != null) && (top.ID != terrainDetailByPositionNoCheck.ID)) && ((topLeftId != terrainDetailByPositionNoCheck.ID) && (topRightId != terrainDetailByPositionNoCheck.ID))) && (top.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                            {
                                decorativeTextures.Add(top.Textures.TopEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % top.Textures.TopEdgeTextures.Count]);
                            }
                            if ((((right != null) && (right.ID != terrainDetailByPositionNoCheck.ID)) && ((topRightId != terrainDetailByPositionNoCheck.ID) && (bottomRightId != terrainDetailByPositionNoCheck.ID))) && (right.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                            {
                                decorativeTextures.Add(right.Textures.RightEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % right.Textures.RightEdgeTextures.Count]);
                            }
                            return;
                        }
                        decorativeTextures.Add(top.Textures.TopRightCornerTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % top.Textures.TopRightCornerTextures.Count]);
                        return;

                    case TerrainDirection.BottomRight:
                        decorativeTextures.Add(right.Textures.BottomRightCornerTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % right.Textures.BottomRightCornerTextures.Count]);
                        if ((((leftDetail == null) || (terrainDetailByPositionNoCheck.ID == topLeftId)) || (leftId != topId)) || (terrainDetailByPositionNoCheck.ID == leftId))
                        {
                            if ((((leftDetail != null) && (leftDetail.ID != terrainDetailByPositionNoCheck.ID)) && ((bottomLeftId != terrainDetailByPositionNoCheck.ID) && (topLeftId != terrainDetailByPositionNoCheck.ID))) && (leftDetail.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                            {
                                decorativeTextures.Add(leftDetail.Textures.LeftEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % leftDetail.Textures.LeftEdgeTextures.Count]);
                            }
                            if ((((top != null) && (top.ID != terrainDetailByPositionNoCheck.ID)) && ((topLeftId != terrainDetailByPositionNoCheck.ID) && (topRightId != terrainDetailByPositionNoCheck.ID))) && (top.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                            {
                                decorativeTextures.Add(top.Textures.TopEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % top.Textures.TopEdgeTextures.Count]);
                            }
                            return;
                        }
                        decorativeTextures.Add(leftDetail.Textures.TopLeftCornerTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % leftDetail.Textures.TopLeftCornerTextures.Count]);
                        return;

                    case TerrainDirection.Centre:
                        decorativeTextures.Add(leftDetail.Textures.CentreTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % leftDetail.Textures.CentreTextures.Count]);
                        return;

                    case TerrainDirection.None:
                        if ((((leftDetail != null) && (leftDetail.ID != terrainDetailByPositionNoCheck.ID)) && ((bottomLeftId != terrainDetailByPositionNoCheck.ID) && (topLeftId != terrainDetailByPositionNoCheck.ID))) && (leftDetail.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                        {
                            decorativeTextures.Add(leftDetail.Textures.LeftEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % leftDetail.Textures.LeftEdgeTextures.Count]);
                        }
                        if ((((top != null) && (top.ID != terrainDetailByPositionNoCheck.ID)) && ((topLeftId != terrainDetailByPositionNoCheck.ID) && (topRightId != terrainDetailByPositionNoCheck.ID))) && (top.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                        {
                            decorativeTextures.Add(top.Textures.TopEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % top.Textures.TopEdgeTextures.Count]);
                        }
                        if ((((right != null) && (right.ID != terrainDetailByPositionNoCheck.ID)) && ((topRightId != terrainDetailByPositionNoCheck.ID) && (bottomRightId != terrainDetailByPositionNoCheck.ID))) && (right.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                        {
                            decorativeTextures.Add(right.Textures.RightEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % right.Textures.RightEdgeTextures.Count]);
                        }
                        if ((((bottom != null) && (bottom.ID != terrainDetailByPositionNoCheck.ID)) && ((bottomRightId != terrainDetailByPositionNoCheck.ID) && (bottomLeftId != terrainDetailByPositionNoCheck.ID))) && (bottom.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                        {
                            decorativeTextures.Add(bottom.Textures.BottomEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % bottom.Textures.BottomEdgeTextures.Count]);
                        }
                        return;
                    }
                }
            }
        }
        private void CheckTileTexture(Tile tile, out List <Texture2D> decorativeTextures)
        {
            decorativeTextures = null;
            TerrainDetail terrainDetailByPositionNoCheck = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(tile.Position);

            if (terrainDetailByPositionNoCheck.Textures.BasicTextures.Count != 0)
            {
                int        num;
                List <int> list;
                int        num12;
                for (num = 0; num < this.TerrainList.Count; num++)
                {
                    this.TerrainList[num] = 0;
                }
                TerrainDirection none  = TerrainDirection.None;
                int           num2     = 0;
                Point         position = new Point(tile.Position.X - 1, tile.Position.Y);
                int           iD       = 0;
                TerrainDetail detail2  = null;
                if (!this.screen.Scenario.PositionOutOfRange(position))
                {
                    detail2 = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(position);
                    iD      = detail2.ID;
                    (list = this.TerrainList)[num12 = this.mainMap.MapData[position.X, position.Y]] = list[num12] + 1;
                }
                Point point2 = new Point(tile.Position.X - 1, tile.Position.Y - 1);
                int   num4   = 0;
                if (!this.screen.Scenario.PositionOutOfRange(point2))
                {
                    num4 = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(point2).ID;
                    (list = this.TerrainList)[num12 = this.mainMap.MapData[point2.X, point2.Y]] = list[num12] + 1;
                }
                Point         point3  = new Point(tile.Position.X, tile.Position.Y - 1);
                int           num5    = 0;
                TerrainDetail detail4 = null;
                if (!this.screen.Scenario.PositionOutOfRange(point3))
                {
                    detail4 = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(point3);
                    num5    = detail4.ID;
                }
                Point point4 = new Point(tile.Position.X + 1, tile.Position.Y - 1);
                int   num6   = 0;
                if (!this.screen.Scenario.PositionOutOfRange(point4))
                {
                    num6 = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(point4).ID;
                }
                Point         point5  = new Point(tile.Position.X + 1, tile.Position.Y);
                int           num7    = 0;
                TerrainDetail detail6 = null;
                if (!this.screen.Scenario.PositionOutOfRange(point5))
                {
                    detail6 = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(point5);
                    num7    = detail6.ID;
                }
                Point point6 = new Point(tile.Position.X + 1, tile.Position.Y + 1);
                int   num8   = 0;
                if (!this.screen.Scenario.PositionOutOfRange(point6))
                {
                    num8 = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(point6).ID;
                }
                Point         point7  = new Point(tile.Position.X, tile.Position.Y + 1);
                int           num9    = 0;
                TerrainDetail detail8 = null;
                if (!this.screen.Scenario.PositionOutOfRange(point7))
                {
                    detail8 = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(point7);
                    num9    = detail8.ID;
                }
                Point point8 = new Point(tile.Position.X - 1, tile.Position.Y + 1);
                int   num10  = 0;
                if (!this.screen.Scenario.PositionOutOfRange(point8))
                {
                    num10 = this.screen.Scenario.GetTerrainDetailByPositionNoCheck(point8).ID;
                }
                int num11 = 0;
                if ((iD > 0) && (iD == terrainDetailByPositionNoCheck.ID))
                {
                    num11++;
                }
                if ((num5 > 0) && (num5 == terrainDetailByPositionNoCheck.ID))
                {
                    num11++;
                }
                if ((num7 > 0) && (num7 == terrainDetailByPositionNoCheck.ID))
                {
                    num11++;
                }
                if ((num9 > 0) && (num9 == terrainDetailByPositionNoCheck.ID))
                {
                    num11++;
                }
                if (num11 < 4)
                {
                    if (detail4 != null)
                    {
                        (list = this.TerrainList)[num12 = this.mainMap.MapData[point3.X, point3.Y]] = list[num12] + 1;
                        for (num = 0; num < this.TerrainList.Count; num++)
                        {
                            if ((num != terrainDetailByPositionNoCheck.ID) && ((((this.TerrainList[num] >= 2) && (iD == num)) && (num4 != terrainDetailByPositionNoCheck.ID)) && (num5 == num)))
                            {
                                none = TerrainDirection.TopLeft;
                                num2 = num;
                                break;
                            }
                        }
                    }
                    if (num6 > 0)
                    {
                        (list = this.TerrainList)[num12 = this.mainMap.MapData[point4.X, point4.Y]] = list[num12] + 1;
                    }
                    if (num7 > 0)
                    {
                        (list = this.TerrainList)[num12 = this.mainMap.MapData[point5.X, point5.Y]] = list[num12] + 1;
                        for (num = 0; num < this.TerrainList.Count; num++)
                        {
                            if (num != terrainDetailByPositionNoCheck.ID)
                            {
                                if (((none == TerrainDirection.None) && (this.TerrainList[num] >= 2)) && (((num5 == num) && (num6 != terrainDetailByPositionNoCheck.ID)) && (num7 == num)))
                                {
                                    none = TerrainDirection.TopRight;
                                    num2 = num;
                                }
                                if (this.TerrainList[num] >= 3)
                                {
                                    if ((((iD == num) && (num5 == num)) && ((num7 == num) && (num6 != terrainDetailByPositionNoCheck.ID))) && (num4 != terrainDetailByPositionNoCheck.ID))
                                    {
                                        none = TerrainDirection.Top;
                                        num2 = num;
                                    }
                                    break;
                                }
                            }
                        }
                    }
                    if (num8 > 0)
                    {
                        (list = this.TerrainList)[num12 = this.mainMap.MapData[point6.X, point6.Y]] = list[num12] + 1;
                    }
                    if (num9 > 0)
                    {
                        (list = this.TerrainList)[num12 = this.mainMap.MapData[point7.X, point7.Y]] = list[num12] + 1;
                        for (num = 0; num < this.TerrainList.Count; num++)
                        {
                            if (num != terrainDetailByPositionNoCheck.ID)
                            {
                                if (((none == TerrainDirection.None) && (this.TerrainList[num] >= 2)) && (((num7 == num) && (num8 != terrainDetailByPositionNoCheck.ID)) && (num9 == num)))
                                {
                                    none = TerrainDirection.BottomRight;
                                    num2 = num;
                                }
                                if ((this.TerrainList[num] >= 3) && ((((num5 == num) && (num7 == num)) && ((num9 == num) && (num6 != terrainDetailByPositionNoCheck.ID))) && (num8 != terrainDetailByPositionNoCheck.ID)))
                                {
                                    none = TerrainDirection.Right;
                                    num2 = num;
                                }
                            }
                        }
                    }
                    if (num10 > 0)
                    {
                        (list = this.TerrainList)[num12 = this.mainMap.MapData[point8.X, point8.Y]] = list[num12] + 1;
                    }
                    if (iD > 0)
                    {
                        for (num = 0; num < this.TerrainList.Count; num++)
                        {
                            if (num != terrainDetailByPositionNoCheck.ID)
                            {
                                if (((none == TerrainDirection.None) && (this.TerrainList[num] >= 2)) && (((num9 == num) && (num10 != terrainDetailByPositionNoCheck.ID)) && (iD == num)))
                                {
                                    none = TerrainDirection.BottomLeft;
                                    num2 = num;
                                }
                                if ((this.TerrainList[num] >= 3) && ((((num7 == num) && (num9 == num)) && ((iD == num) && (num8 != terrainDetailByPositionNoCheck.ID))) && (num10 != terrainDetailByPositionNoCheck.ID)))
                                {
                                    none = TerrainDirection.Bottom;
                                    num2 = num;
                                }
                                if (((((this.TerrainList[num] >= 4) && (iD == num)) && ((num5 == num) && (num7 == num))) && (num9 == num)) && ((((num4 != terrainDetailByPositionNoCheck.ID) && (num6 != terrainDetailByPositionNoCheck.ID)) && ((num8 != terrainDetailByPositionNoCheck.ID) && (num10 != terrainDetailByPositionNoCheck.ID))) || (this.TerrainList[num] >= 7)))
                                {
                                    none = TerrainDirection.Centre;
                                    num2 = num;
                                    break;
                                }
                            }
                        }
                    }
                    if ((((none != TerrainDirection.Centre) && (none != TerrainDirection.Top)) && ((none != TerrainDirection.Right) && (none != TerrainDirection.Bottom))) && (num5 > 0))
                    {
                        for (num = 0; num < this.TerrainList.Count; num++)
                        {
                            if (((num != terrainDetailByPositionNoCheck.ID) && (this.TerrainList[num] >= 3)) && ((((num9 == num) && (iD == num)) && ((num5 == num) && (num10 != terrainDetailByPositionNoCheck.ID))) && (num4 != terrainDetailByPositionNoCheck.ID)))
                            {
                                none = TerrainDirection.Left;
                                num2 = num;
                            }
                        }
                    }
                    decorativeTextures = new List <Texture2D>();
                    switch (none)
                    {
                    case TerrainDirection.Top:
                        decorativeTextures.Add(detail4.Textures.TopTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail4.Textures.TopTextures.Count]);
                        if ((((detail8 != null) && (detail8.ID != terrainDetailByPositionNoCheck.ID)) && ((num8 != terrainDetailByPositionNoCheck.ID) && (num10 != terrainDetailByPositionNoCheck.ID))) && (detail8.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                        {
                            decorativeTextures.Add(detail8.Textures.BottomEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail8.Textures.BottomEdgeTextures.Count]);
                        }
                        return;

                    case TerrainDirection.Left:
                        decorativeTextures.Add(detail2.Textures.LeftTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail2.Textures.LeftTextures.Count]);
                        if ((((detail6 != null) && (detail6.ID != terrainDetailByPositionNoCheck.ID)) && ((num6 != terrainDetailByPositionNoCheck.ID) && (num8 != terrainDetailByPositionNoCheck.ID))) && (detail6.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                        {
                            decorativeTextures.Add(detail6.Textures.RightEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail6.Textures.RightEdgeTextures.Count]);
                        }
                        return;

                    case TerrainDirection.Right:
                        decorativeTextures.Add(detail6.Textures.RightTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail6.Textures.RightTextures.Count]);
                        if ((((detail2 != null) && (detail2.ID != terrainDetailByPositionNoCheck.ID)) && ((num10 != terrainDetailByPositionNoCheck.ID) && (num4 != terrainDetailByPositionNoCheck.ID))) && (detail2.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                        {
                            decorativeTextures.Add(detail2.Textures.LeftEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail2.Textures.LeftEdgeTextures.Count]);
                        }
                        return;

                    case TerrainDirection.Bottom:
                        decorativeTextures.Add(detail8.Textures.BottomTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail8.Textures.BottomTextures.Count]);
                        if ((((detail4 != null) && (detail4.ID != terrainDetailByPositionNoCheck.ID)) && ((num4 != terrainDetailByPositionNoCheck.ID) && (num6 != terrainDetailByPositionNoCheck.ID))) && (detail4.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                        {
                            decorativeTextures.Add(detail4.Textures.TopEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail4.Textures.TopEdgeTextures.Count]);
                        }
                        return;

                    case TerrainDirection.TopLeft:
                        decorativeTextures.Add(detail2.Textures.TopLeftCornerTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail2.Textures.TopLeftCornerTextures.Count]);
                        if ((((detail6 == null) || (terrainDetailByPositionNoCheck.ID == num8)) || (num7 != num9)) || (terrainDetailByPositionNoCheck.ID == num7))
                        {
                            if ((((detail6 != null) && (detail6.ID != terrainDetailByPositionNoCheck.ID)) && ((num6 != terrainDetailByPositionNoCheck.ID) && (num8 != terrainDetailByPositionNoCheck.ID))) && (detail6.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                            {
                                decorativeTextures.Add(detail6.Textures.RightEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail6.Textures.RightEdgeTextures.Count]);
                            }
                            if ((((detail8 != null) && (detail8.ID != terrainDetailByPositionNoCheck.ID)) && ((num8 != terrainDetailByPositionNoCheck.ID) && (num10 != terrainDetailByPositionNoCheck.ID))) && (detail8.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                            {
                                decorativeTextures.Add(detail8.Textures.BottomEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail8.Textures.BottomEdgeTextures.Count]);
                            }
                            return;
                        }
                        decorativeTextures.Add(detail6.Textures.BottomRightCornerTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail6.Textures.BottomRightCornerTextures.Count]);
                        return;

                    case TerrainDirection.TopRight:
                        decorativeTextures.Add(detail4.Textures.TopRightCornerTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail4.Textures.TopRightCornerTextures.Count]);
                        if ((((detail8 == null) || (terrainDetailByPositionNoCheck.ID == num10)) || (num9 != iD)) || (terrainDetailByPositionNoCheck.ID == num9))
                        {
                            if ((((detail2 != null) && (detail2.ID != terrainDetailByPositionNoCheck.ID)) && ((num10 != terrainDetailByPositionNoCheck.ID) && (num4 != terrainDetailByPositionNoCheck.ID))) && (detail2.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                            {
                                decorativeTextures.Add(detail2.Textures.LeftEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail2.Textures.LeftEdgeTextures.Count]);
                            }
                            if ((((detail8 != null) && (detail8.ID != terrainDetailByPositionNoCheck.ID)) && ((num8 != terrainDetailByPositionNoCheck.ID) && (num10 != terrainDetailByPositionNoCheck.ID))) && (detail8.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                            {
                                decorativeTextures.Add(detail8.Textures.BottomEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail8.Textures.BottomEdgeTextures.Count]);
                            }
                            return;
                        }
                        decorativeTextures.Add(detail8.Textures.BottomLeftCornerTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail8.Textures.BottomLeftCornerTextures.Count]);
                        return;

                    case TerrainDirection.BottomLeft:
                        decorativeTextures.Add(detail8.Textures.BottomLeftCornerTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail8.Textures.BottomLeftCornerTextures.Count]);
                        if ((((detail4 == null) || (terrainDetailByPositionNoCheck.ID == num6)) || (num5 != num7)) || (terrainDetailByPositionNoCheck.ID == num5))
                        {
                            if ((((detail4 != null) && (detail4.ID != terrainDetailByPositionNoCheck.ID)) && ((num4 != terrainDetailByPositionNoCheck.ID) && (num6 != terrainDetailByPositionNoCheck.ID))) && (detail4.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                            {
                                decorativeTextures.Add(detail4.Textures.TopEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail4.Textures.TopEdgeTextures.Count]);
                            }
                            if ((((detail6 != null) && (detail6.ID != terrainDetailByPositionNoCheck.ID)) && ((num6 != terrainDetailByPositionNoCheck.ID) && (num8 != terrainDetailByPositionNoCheck.ID))) && (detail6.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                            {
                                decorativeTextures.Add(detail6.Textures.RightEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail6.Textures.RightEdgeTextures.Count]);
                            }
                            return;
                        }
                        decorativeTextures.Add(detail4.Textures.TopRightCornerTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail4.Textures.TopRightCornerTextures.Count]);
                        return;

                    case TerrainDirection.BottomRight:
                        decorativeTextures.Add(detail6.Textures.BottomRightCornerTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail6.Textures.BottomRightCornerTextures.Count]);
                        if ((((detail2 == null) || (terrainDetailByPositionNoCheck.ID == num4)) || (iD != num5)) || (terrainDetailByPositionNoCheck.ID == iD))
                        {
                            if ((((detail2 != null) && (detail2.ID != terrainDetailByPositionNoCheck.ID)) && ((num10 != terrainDetailByPositionNoCheck.ID) && (num4 != terrainDetailByPositionNoCheck.ID))) && (detail2.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                            {
                                decorativeTextures.Add(detail2.Textures.LeftEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail2.Textures.LeftEdgeTextures.Count]);
                            }
                            if ((((detail4 != null) && (detail4.ID != terrainDetailByPositionNoCheck.ID)) && ((num4 != terrainDetailByPositionNoCheck.ID) && (num6 != terrainDetailByPositionNoCheck.ID))) && (detail4.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                            {
                                decorativeTextures.Add(detail4.Textures.TopEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail4.Textures.TopEdgeTextures.Count]);
                            }
                            return;
                        }
                        decorativeTextures.Add(detail2.Textures.TopLeftCornerTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail2.Textures.TopLeftCornerTextures.Count]);
                        return;

                    case TerrainDirection.Centre:
                        decorativeTextures.Add(detail2.Textures.CentreTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail2.Textures.CentreTextures.Count]);
                        return;

                    case TerrainDirection.None:
                        if ((((detail2 != null) && (detail2.ID != terrainDetailByPositionNoCheck.ID)) && ((num10 != terrainDetailByPositionNoCheck.ID) && (num4 != terrainDetailByPositionNoCheck.ID))) && (detail2.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                        {
                            decorativeTextures.Add(detail2.Textures.LeftEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail2.Textures.LeftEdgeTextures.Count]);
                        }
                        if ((((detail4 != null) && (detail4.ID != terrainDetailByPositionNoCheck.ID)) && ((num4 != terrainDetailByPositionNoCheck.ID) && (num6 != terrainDetailByPositionNoCheck.ID))) && (detail4.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                        {
                            decorativeTextures.Add(detail4.Textures.TopEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail4.Textures.TopEdgeTextures.Count]);
                        }
                        if ((((detail6 != null) && (detail6.ID != terrainDetailByPositionNoCheck.ID)) && ((num6 != terrainDetailByPositionNoCheck.ID) && (num8 != terrainDetailByPositionNoCheck.ID))) && (detail6.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                        {
                            decorativeTextures.Add(detail6.Textures.RightEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail6.Textures.RightEdgeTextures.Count]);
                        }
                        if ((((detail8 != null) && (detail8.ID != terrainDetailByPositionNoCheck.ID)) && ((num8 != terrainDetailByPositionNoCheck.ID) && (num10 != terrainDetailByPositionNoCheck.ID))) && (detail8.GraphicLayer < terrainDetailByPositionNoCheck.GraphicLayer))
                        {
                            decorativeTextures.Add(detail8.Textures.BottomEdgeTextures[((tile.Position.X * 7) + (tile.Position.Y * 11)) % detail8.Textures.BottomEdgeTextures.Count]);
                        }
                        return;
                    }
                }
            }
        }