本文整理汇总了C#中Server.Rectangle2D类的典型用法代码示例。如果您正苦于以下问题:C# Rectangle2D类的具体用法?C# Rectangle2D怎么用?C# Rectangle2D使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Rectangle2D类属于Server命名空间,在下文中一共展示了Rectangle2D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MarkBounds
public void MarkBounds(Rectangle2D rec)
{
m_Markers = new List<Item>();
int w = rec.X + rec.Width;
int h = rec.Y + rec.Height;
int t = 0;
for (int x = rec.X; x <= w; x++)
{
for (int y = rec.Y; y <= h; y++)
{
if (x == rec.X || x == rec.X + rec.Width || y == rec.Y || y == rec.Y + rec.Height)
{
if (t >= 10)
{
MarkerItem i = new MarkerItem(14089);
i.MoveToWorld(new Point3D(x, y, 0), this.Map);
m_Markers.Add(i);
t = 0;
}
else
t++;
}
}
}
}
示例2: GoldPrintCarpetAddon
public GoldPrintCarpetAddon( Rectangle2D rect )
{
for ( int x = 0; x < rect.Width; x++ )
for ( int y = 0; y < rect.Height; y++ )
{
if ( y == 0 && x != 0 && x != rect.Width - 1 )
AddComponent( new AddonComponent( RugPieceId( RugPiece.Top ) ), x, y, 0 );
if ( y == rect.Height - 1 && x != 0 && x != rect.Width - 1 )
AddComponent( new AddonComponent( RugPieceId( RugPiece.Bottom ) ), x, y, 0 );
if ( x == 0 && y != 0 && y != rect.Height - 1 )
AddComponent( new AddonComponent( RugPieceId( RugPiece.Left ) ), x, y, 0 );
if ( x == rect.Width - 1 && y != 0 && y != rect.Height - 1 )
AddComponent( new AddonComponent( RugPieceId( RugPiece.Right ) ), x, y, 0 );
if ( y == 0 && x == 0 )
AddComponent( new AddonComponent( RugPieceId( RugPiece.TopLeft ) ), x, y, 0 );
if ( y == 0 && x == rect.Width - 1 )
AddComponent( new AddonComponent( RugPieceId( RugPiece.TopRight ) ), x, y, 0 );
if ( y == rect.Height - 1 && x == 0 )
AddComponent( new AddonComponent( RugPieceId( RugPiece.BottomLeft ) ), x, y, 0 );
if ( y == rect.Height - 1 && x == rect.Width - 1 )
AddComponent( new AddonComponent( RugPieceId( RugPiece.BottomRight ) ), x, y, 0 );
if ( y != 0 && x != 0 && x != rect.Width - 1 && y != rect.Height - 1 )
AddComponent( new AddonComponent( RugPieceId( RugPiece.Center ) ), x, y, 0 );
}
Hue = 1710; // Set Hue of Rug Here
}
示例3: SetDisplay
public override void SetDisplay(int x1, int y1, int x2, int y2, int w, int h)
{
Width = w;
Height = h;
Bounds = new Rectangle2D(5121 ,2305, 1020, 1788);
}
示例4: OnExit
public override void OnExit( Mobile m )
{
if ( m.IsPlayer && !m.Alive )
{
Rectangle2D rect = new Rectangle2D( 342, 168, 16, 16 );
int x = Utility.Random( rect.X, rect.Width );
int y = Utility.Random( rect.Y, rect.Height );
if ( x >= 345 && x <= 352 && y >= 173 && y <= 179 )
{
x = 353;
y = 172;
}
m.MoveToWorld( new Point3D( x, y, -1 ), Map.Malas );
if ( m.Corpse != null )
{
Region region = Region.Find( m.Corpse.Location, Map.Malas );
if ( region.Name == "Doom Dark Guardians Room" )
{
m.Corpse.MoveToWorld( new Point3D( x, y, -1 ), Map.Malas );
}
}
}
}
示例5: CorgulWarpRegion
public CorgulWarpRegion(CorgulAltar ped, Rectangle2D rec)
: base("Corgul Warp Region", ped.Map, Region.DefaultPriority, new Rectangle2D[] { rec })
{
m_Pedestal = ped;
m_Bounds = rec;
//MarkBounds(rec);
}
示例6: Ensure
public void Ensure()
{
m_Blocks = new List<Item>();
foreach ( Rectangle3D r3d in Area )
{
Rectangle2D r2d = new Rectangle2D( r3d.Start, r3d.End );
foreach ( Item item in Map.GetItemsInBounds( r2d ) )
{
if ( item is Static )
m_Blocks.Add( item );
}
}
if ( m_Blocks.Count == 0 )
{
m_Blocks = null;
return;
}
foreach ( Item item in m_Blocks )
{
item.Hue = 0x807;
item.Visible = false;
}
m_FadingTimer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromSeconds( 0.33 ), new TimerCallback( OnTick ) );
}
示例7: SafeZone
/*public override bool AllowReds{ get{ return true; } }*/
public SafeZone( Rectangle2D area, Point3D goloc, Map map )
: base(null, map, SafeZonePriority, area)
{
GoLocation = goloc;
Register();
}
示例8: OnExportBounds2D
public static void OnExportBounds2D(Mobile m, string speech, string comment)
{
if (m == null || m.Deleted || !(m is PlayerMobile))
{
return;
}
if (String.IsNullOrWhiteSpace(speech))
{
speech = "Bounds";
}
BoundingBoxPicker.Begin(
m,
(from, map, start, end, state) =>
{
var r = new Rectangle2D(start, end.Clone2D(1, 1));
IOUtility.EnsureFile(
VitaNexCore.DataDirectory + "/Exported Bounds/2D/" + IOUtility.GetSafeFileName(speech) + ".txt")
.AppendText(
false,
String.Format(
"new Rectangle2D({0}, {1}, {2}, {3}), //{4}",
//
r.Start.X,
r.Start.Y,
r.Width,
r.Height,
comment ?? String.Empty));
},
null);
}
示例9: CorgulRegion
public CorgulRegion(Rectangle2D rec, CorgulAltar altar)
: base("Corgul Boss Region", altar.Map, Region.DefaultPriority, new Rectangle2D[] { rec })
{
//MarkBounds(rec);
m_Altar = altar;
m_Bounds = rec;
}
示例10: OnExportBounds2D
public static void OnExportBounds2D(Mobile m, string speech)
{
if (m == null || m.Deleted || !(m is PlayerMobile))
{
return;
}
if (String.IsNullOrWhiteSpace(speech))
{
speech = TimeStamp.UtcNow.ToString();
}
BoundingBoxPicker.Begin(
m,
(from, map, start, end, state) =>
{
var r = new Rectangle2D(start, end.Clone3D(1, 1));
using (
StreamWriter w =
IOUtility.EnsureFile(
VitaNexCore.DataDirectory + "/Exported Bounds/2D/" + IOUtility.GetSafeFileName(speech) + ".txt").AppendText())
{
w.WriteLine("new Rectangle2D({0}, {1}, {2}, {3}),", r.Start.X, r.Start.Y, r.Width, r.Height);
w.Close();
}
},
null);
}
示例11: FindEntity
public static bool FindEntity( Type type, Point3D p, Map map, bool mob )
{
IPooledEnumerable loc;
Rectangle2D rect = new Rectangle2D( p.X, p.Y, 1, 1 );
if( mob )
loc = map.GetMobilesInBounds( rect );
else
loc = map.GetItemsInBounds( rect );
bool found = false;
try
{
foreach( object o in loc )
if( o != null && o.GetType() == type || o.GetType().IsSubclassOf( type ) )
{
found = true;
break;
}
}
catch
{
}
loc.Free();
return found;
}
示例12: PresetMapEntry
public PresetMapEntry( int name, int width, int height, int xLeft, int yTop, int xRight, int yBottom )
{
m_Name = name;
m_Width = width;
m_Height = height;
m_Bounds = new Rectangle2D( xLeft, yTop, xRight - xLeft, yBottom - yTop );
}
示例13: AddDynamicWeather
public static void AddDynamicWeather( int temperature, int chanceOfPercipitation, int chanceOfExtremeTemperature, int moveSpeed, int width, int height, Rectangle2D bounds )
{
for ( int i = 0; i < m_Facets.Length; ++i )
{
Rectangle2D area = new Rectangle2D();
bool isValid = false;
for ( int j = 0; j < 10; ++j )
{
area = new Rectangle2D( bounds.X + Utility.Random( bounds.Width - width ), bounds.Y + Utility.Random( bounds.Height - height ), width, height );
if ( !CheckWeatherConflict( m_Facets[i], null, area ) )
isValid = true;
if ( isValid )
break;
}
if ( !isValid )
continue;
Weather w = new Weather( m_Facets[i], new Rectangle2D[]{ area }, temperature, chanceOfPercipitation, chanceOfExtremeTemperature, TimeSpan.FromSeconds( 30.0 ) );
w.m_Bounds = bounds;
w.m_MoveSpeed = moveSpeed;
}
}
示例14: FixRect
public static Rectangle2D FixRect( Rectangle2D rect )
{
Point3D pointOne = Point3D.Zero;
Point3D pointTwo = Point3D.Zero;
if ( rect.Start.X < rect.End.X )
{
pointOne.X = rect.Start.X;
pointTwo.X = rect.End.X;
}
else
{
pointOne.X = rect.End.X;
pointTwo.X = rect.Start.X;
}
if ( rect.Start.Y < rect.End.Y )
{
pointOne.Y = rect.Start.Y;
pointTwo.Y = rect.End.Y;
}
else
{
pointOne.Y = rect.End.Y;
pointTwo.Y = rect.Start.Y;
}
return new Rectangle2D( pointOne, pointTwo );
}
示例15: TheHuntRegion
public TheHuntRegion(TheHuntStone pTheHuntStone, string name, Map map, Rectangle2D[] area)
: base(name, map, 50, area)
{
this.TheHuntStone = pTheHuntStone;
this.playerMobileBackupList = new List<Mobile>();
}