Ejemplo n.º 1
0
 private PointerRegion InRegionUpPointer(int x, int y)
 {
     if (curRegion != null && curRegion.CenterTile != null && translateToRegion(x, y) == curRegion)
     {
         Point            centerP = curMap.GetTileCenterPoint(curRegion.CenterTile.Row, curRegion.CenterTile.Col);
         DirectionPointer dp      = new DirectionPointer(centerP.X, centerP.Y, 12);
         return(dp.Translate(x, y));
     }
     return(PointerRegion.None);
 }
Ejemplo n.º 2
0
 private void drawPointer(Graphics g, Region region, int pointerSize)
 {
     if (region != null && region.CenterTile != null)
     {
         Point            centerP = curMap.GetTileCenterPoint(region.CenterTile.Row, region.CenterTile.Col);
         DirectionPointer dp      = new DirectionPointer(centerP.X, centerP.Y, pointerSize);
         if (region.LeftRegion != null && region.LeftRegion != region)
         {
             if (curMap.InMap(region.LeftRegion))
             {
                 dp.EnableLeft = false;
             }
         }
         if (region.RightRegion != null && region.RightRegion != region)
         {
             if (curMap.InMap(region.RightRegion))
             {
                 dp.EnableRight = false;
             }
         }
         if (region.UpRegion != null && region.UpRegion != region)
         {
             if (curMap.InMap(region.UpRegion))
             {
                 dp.EnableUp = false;
             }
         }
         if (region.DownRegion != null && region.DownRegion != region)
         {
             if (curMap.InMap(region.DownRegion))
             {
                 dp.EnableDown = false;
             }
         }
         dp.Draw(g);
         Point leavePoint = dp.GetSrcPoint();;
         Point endPoint;
         Tile  endTile;
         if (!dp.EnableLeft)
         {
             if (region.LeftRegion != null && region.LeftRegion.CenterTile != null)
             {
                 endTile = region.LeftRegion.CenterTile;
             }
             else
             {
                 endTile = region.LeftRegion.GetTiles().First();
             }
             if (endTile != null)
             {
                 endPoint = curMap.GetTileCenterPoint(endTile.Row, endTile.Col);
                 drawArrow(g, leavePoint.X, leavePoint.Y, endPoint.X, endPoint.Y);
             }
         }
         if (!dp.EnableRight)
         {
             if (region.RightRegion != null && region.RightRegion.CenterTile != null)
             {
                 endTile = region.RightRegion.CenterTile;
             }
             else
             {
                 endTile = region.RightRegion.GetTiles().First();
             }
             if (endTile != null)
             {
                 endPoint = curMap.GetTileCenterPoint(endTile.Row, endTile.Col);
                 drawArrow(g, leavePoint.X, leavePoint.Y, endPoint.X, endPoint.Y);
             }
         }
         if (!dp.EnableUp)
         {
             if (region.UpRegion != null && region.UpRegion.CenterTile != null)
             {
                 endTile = region.UpRegion.CenterTile;
             }
             else
             {
                 endTile = region.UpRegion.GetTiles().First();
             }
             if (endTile != null)
             {
                 endPoint = curMap.GetTileCenterPoint(endTile.Row, endTile.Col);
                 drawArrow(g, leavePoint.X, leavePoint.Y, endPoint.X, endPoint.Y);
             }
         }
         if (!dp.EnableDown)
         {
             if (region.DownRegion != null && region.DownRegion.CenterTile != null)
             {
                 endTile = region.DownRegion.CenterTile;
             }
             else
             {
                 endTile = region.DownRegion.GetTiles().First();
             }
             if (endTile != null)
             {
                 endPoint = curMap.GetTileCenterPoint(endTile.Row, endTile.Col);
                 drawArrow(g, leavePoint.X, leavePoint.Y, endPoint.X, endPoint.Y);
             }
         }
     }
 }
Ejemplo n.º 3
0
 private PointerRegion InRegionUpPointer(int x, int y)
 {
     if (curRegion != null && curRegion.CenterTile!=null && translateToRegion(x, y) == curRegion)
     {
         Point centerP = curMap.GetTileCenterPoint(curRegion.CenterTile.Row, curRegion.CenterTile.Col);
         DirectionPointer dp = new DirectionPointer(centerP.X, centerP.Y, 12);
         return dp.Translate(x, y);
     }
     return PointerRegion.None;
 }
Ejemplo n.º 4
0
 private void drawPointer(Graphics g, Region region, int pointerSize)
 {
     if (region != null && region.CenterTile != null)
     {
         Point centerP = curMap.GetTileCenterPoint(region.CenterTile.Row, region.CenterTile.Col);
         DirectionPointer dp = new DirectionPointer(centerP.X, centerP.Y, pointerSize);
         if (region.LeftRegion != null && region.LeftRegion != region)
         {
             if (curMap.InMap(region.LeftRegion))
             {
                 dp.EnableLeft = false;
             }
         }
         if (region.RightRegion != null && region.RightRegion != region)
         {
             if (curMap.InMap(region.RightRegion))
             {
                 dp.EnableRight = false;
             }
         }
         if (region.UpRegion != null && region.UpRegion != region)
         {
             if (curMap.InMap(region.UpRegion))
             {
                 dp.EnableUp = false;
             }
         }
         if (region.DownRegion != null && region.DownRegion != region)
         {
             if (curMap.InMap(region.DownRegion))
             {
                 dp.EnableDown = false;
             }
         }
         dp.Draw(g);
         Point leavePoint = dp.GetSrcPoint(); ;
         Point endPoint;
         Tile endTile;
         if (!dp.EnableLeft)
         {
             if (region.LeftRegion != null && region.LeftRegion.CenterTile!=null)
             {
                 endTile = region.LeftRegion.CenterTile;
             }
             else
             {
                 endTile = region.LeftRegion.GetTiles().First();
             }
             if (endTile != null)
             {
                 endPoint = curMap.GetTileCenterPoint(endTile.Row, endTile.Col);
                 drawArrow(g, leavePoint.X, leavePoint.Y, endPoint.X, endPoint.Y);
             }
         }
         if (!dp.EnableRight)
         {
             if (region.RightRegion != null && region.RightRegion.CenterTile!=null)
             {
                 endTile = region.RightRegion.CenterTile;
             }
             else
             {
                 endTile = region.RightRegion.GetTiles().First();
             }
             if (endTile != null)
             {
                 endPoint = curMap.GetTileCenterPoint(endTile.Row, endTile.Col);
                 drawArrow(g, leavePoint.X, leavePoint.Y, endPoint.X, endPoint.Y);
             }
         }
         if (!dp.EnableUp)
         {
             if (region.UpRegion != null && region.UpRegion.CenterTile != null)
             {
                 endTile = region.UpRegion.CenterTile;
             }
             else
             {
                 endTile = region.UpRegion.GetTiles().First();
             }
             if (endTile != null)
             {
                 endPoint = curMap.GetTileCenterPoint(endTile.Row, endTile.Col);
                 drawArrow(g, leavePoint.X, leavePoint.Y, endPoint.X, endPoint.Y);
             }
         }
         if (!dp.EnableDown)
         {
             if (region.DownRegion != null && region.DownRegion.CenterTile != null)
             {
                 endTile = region.DownRegion.CenterTile;
             }
             else
             {
                 endTile = region.DownRegion.GetTiles().First();
             }
             if (endTile != null)
             {
                 endPoint = curMap.GetTileCenterPoint(endTile.Row, endTile.Col);
                 drawArrow(g, leavePoint.X, leavePoint.Y, endPoint.X, endPoint.Y);
             }
         }
     }
 }