本文整理汇总了C#中Server.Map.OnEnter方法的典型用法代码示例。如果您正苦于以下问题:C# Map.OnEnter方法的具体用法?C# Map.OnEnter怎么用?C# Map.OnEnter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Map
的用法示例。
在下文中一共展示了Map.OnEnter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MoveToWorld
/// <summary>
/// Moves the Item to a given <paramref name="location" /> and <paramref name="map" />.
/// </summary>
public void MoveToWorld( Point3D location, Map map )
{
if ( Deleted )
return;
Point3D oldLocation = GetWorldLocation();
Point3D oldRealLocation = m_Location;
SetLastMoved();
if ( Parent is Mobile )
((Mobile)Parent).RemoveItem( this );
else if ( Parent is Item )
((Item)Parent).RemoveItem( this );
if ( m_Map != map )
{
Map old = m_Map;
if ( m_Map != null )
{
m_Map.OnLeave( this );
if ( oldLocation.m_X != 0 )
{
Packet remPacket = null;
IPooledEnumerable eable = m_Map.GetClientsInRange( oldLocation, GetMaxUpdateRange() );
foreach ( NetState state in eable )
{
Mobile m = state.Mobile;
if ( m.InRange( oldLocation, GetUpdateRange( m ) ) )
{
if ( remPacket == null )
remPacket = this.RemovePacket;
state.Send( remPacket );
}
}
eable.Free();
}
}
if ( m_Items != null )
{
for ( int i = 0; i < m_Items.Count; ++i )
((Item)m_Items[i]).Map = map;
}
m_Location = location;
this.OnLocationChange( oldRealLocation );
m_WorldPacket = null;
m_Map = map;
if ( m_Map != null )
m_Map.OnEnter( this );
OnMapChange();
if ( m_Map != null )
{
IPooledEnumerable eable = m_Map.GetClientsInRange( m_Location, GetMaxUpdateRange() );
foreach ( NetState state in eable )
{
Mobile m = state.Mobile;
if ( m.CanSee( this ) && m.InRange( m_Location, GetUpdateRange( m ) ) )
SendInfoTo( state );
}
eable.Free();
}
RemDelta( ItemDelta.Update );
if ( old == null || old == Map.Internal )
InvalidateProperties();
}
else if ( m_Map != null )
{
IPooledEnumerable eable;
if ( oldLocation.m_X != 0 )
{
Packet removeThis = null;
eable = m_Map.GetClientsInRange( oldLocation, GetMaxUpdateRange() );
foreach ( NetState state in eable )
{
Mobile m = state.Mobile;
//.........这里部分代码省略.........
示例2: Deserialize
//.........这里部分代码省略.........
m_Map = reader.ReadMap();
else
m_Map = Map.Internal;
if ( GetSaveFlag( flags, SaveFlag.Visible ) )
SetFlag( ImplFlag.Visible, reader.ReadBool() );
else
SetFlag( ImplFlag.Visible, true );
if ( GetSaveFlag( flags, SaveFlag.Movable ) )
SetFlag( ImplFlag.Movable, reader.ReadBool() );
else
SetFlag( ImplFlag.Movable, true );
if ( GetSaveFlag( flags, SaveFlag.Stackable ) )
SetFlag( ImplFlag.Stackable, reader.ReadBool() );
if ( GetSaveFlag( flags, SaveFlag.ImplFlags ) )
m_Flags = (ImplFlag)reader.ReadEncodedInt();
if ( GetSaveFlag( flags, SaveFlag.InsuredFor ) )
/*m_InsuredFor = */reader.ReadMobile();
if ( GetSaveFlag( flags, SaveFlag.BlessedFor ) )
m_BlessedFor = reader.ReadMobile();
if ( GetSaveFlag( flags, SaveFlag.HeldBy ) )
m_HeldBy = reader.ReadMobile();
if ( GetSaveFlag( flags, SaveFlag.SavedFlags ) )
m_SavedFlags = reader.ReadEncodedInt();
if ( m_Map != null && m_Parent == null )
m_Map.OnEnter( this );
break;
}
case 5:
{
SaveFlag flags = (SaveFlag)reader.ReadInt();
LastMoved = reader.ReadDeltaTime();
if ( GetSaveFlag( flags, SaveFlag.Direction ) )
m_Direction = (Direction)reader.ReadByte();
if ( GetSaveFlag( flags, SaveFlag.Bounce ) )
m_Bounce = BounceInfo.Deserialize( reader );
if ( GetSaveFlag( flags, SaveFlag.LootType ) )
m_LootType = (LootType)reader.ReadByte();
if ( GetSaveFlag( flags, SaveFlag.LocationFull ) )
m_Location = reader.ReadPoint3D();
if ( GetSaveFlag( flags, SaveFlag.ItemID ) )
m_ItemID = reader.ReadInt();
if ( GetSaveFlag( flags, SaveFlag.Hue ) )
m_Hue = reader.ReadInt();
if ( GetSaveFlag( flags, SaveFlag.Amount ) )
m_Amount = reader.ReadInt();
else
m_Amount = 1;
示例3: MoveToWorld
public virtual void MoveToWorld( Point3D newLocation, Map map )
{
if ( m_Map == map )
{
SetLocation( newLocation, true );
return;
}
BankBox box = FindBankNoCreate();
if ( box != null && box.Opened )
box.Close();
Point3D oldLocation = m_Location;
Map oldMap = m_Map;
Region oldRegion = m_Region;
if ( oldMap != null )
{
oldMap.OnLeave( this );
ClearScreen();
SendRemovePacket();
}
for ( int i = 0; i < m_Items.Count; ++i )
((Item)m_Items[i]).Map = map;
m_Map = map;
m_Region.InternalExit( this );
m_Location = newLocation;
NetState ns = m_NetState;
if ( m_Map != null )
{
m_Map.OnEnter( this );
m_Region = Region.Find( m_Location, m_Map );
OnRegionChange( oldRegion, m_Region );
m_Region.InternalEnter( this );
if ( ns != null && m_Map != null )
{
ns.Sequence = 0;
ns.Send( new MapChange( this ) );
ns.Send( new MapPatches() );
ns.Send( SeasonChange.Instantiate( GetSeason(), true ) );
ns.Send( new MobileUpdate( this ) );
ClearFastwalkStack();
}
}
if ( ns != null )
{
if ( m_Map != null )
Send( new ServerChange( this, m_Map ) );
ns.Sequence = 0;
ClearFastwalkStack();
Send( new MobileIncoming( this, this ) );
Send( new MobileUpdate( this ) );
CheckLightLevels( true );
Send( new MobileUpdate( this ) );
}
SendEverything();
SendIncomingPacket();
if ( ns != null )
{
m_NetState.Sequence = 0;
ClearFastwalkStack();
Send( new MobileIncoming( this, this ) );
Send( SupportedFeatures.Instantiate( ns.Account ) );
Send( new MobileUpdate( this ) );
Send( new MobileAttributes( this ) );
}
OnMapChange( oldMap );
OnLocationChange( oldLocation );
m_Region.OnLocationChanged( this, oldLocation );
}
示例4: MoveToWorld
public virtual void MoveToWorld( Point3D newLocation, Map map )
{
if ( m_Deleted )
return;
if ( m_Map == map )
{
SetLocation( newLocation, true );
return;
}
BankBox box = FindBankNoCreate();
if ( box != null && box.Opened )
box.Close();
Point3D oldLocation = m_Location;
Map oldMap = m_Map;
//Region oldRegion = m_Region;
if ( oldMap != null )
{
oldMap.OnLeave( this );
this.ClearScreen();
this.SendRemovePacket();
}
for ( int i = 0; i < m_EquippedItems.Count; ++i )
( (Item) m_EquippedItems[i] ).Map = map;
m_Map = map;
m_Location = newLocation;
GameClient ns = m_Client;
if ( m_Map != null )
{
m_Map.OnEnter( this );
UpdateRegion();
if ( ns != null && m_Map != null )
{
ns.Sequence = 0;
ns.Send( new MapChange( this ) );
ns.Send( SeasonChange.Instantiate( GetSeason(), true ) );
ns.Send( new MobileUpdate( this ) );
ClearFastwalkStack();
}
}
else
{
UpdateRegion();
}
if ( ns != null )
{
if ( m_Map != null )
Send( new ServerChange( this, m_Map ) );
ns.Sequence = 0;
ClearFastwalkStack();
Send( new MobileIncoming( this, this ) );
Send( new MobileUpdate( this ) );
CheckLightLevels( true );
Send( new MobileUpdate( this ) );
}
this.SendEverything();
this.SendIncomingPacket();
if ( ns != null )
{
m_Client.Sequence = 0;
ClearFastwalkStack();
Send( new MobileIncoming( this, this ) );
Send( SupportedFeatures.Instantiate( ns ) );
Send( new MobileUpdate( this ) );
Send( new MobileAttributes( this ) );
}
EventSink.Instance.InvokeMapChanged( new MapChangedEventArgs( this, oldMap ) );
OnMapChange( oldMap );
OnLocationChange( oldLocation );
if ( m_Region != null )
m_Region.OnLocationChanged( this, oldLocation );
}
示例5: MoveToWorld
/// <summary>
/// Moves the Item to a given <paramref name="location" /> and <paramref name="map" />.
/// </summary>
public void MoveToWorld( Point3D location, Map map )
{
if ( Deleted )
return;
Point3D oldLocation = GetWorldLocation();
Point3D oldRealLocation = m_Location;
SetLastMoved();
if ( Parent is Mobile )
( (Mobile) Parent ).RemoveItem( this );
else if ( Parent is Item )
( (Item) Parent ).RemoveItem( this );
if ( m_Map != map )
{
Map old = m_Map;
if ( m_Map != null )
{
m_Map.OnLeave( this );
if ( oldLocation.X != 0 )
{
Packet remPacket = null;
foreach ( GameClient state in m_Map.GetClientsInRange( oldLocation, GetMaxUpdateRange() ) )
{
Mobile m = state.Mobile;
if ( m.InRange( oldLocation, GetUpdateRange( m ) ) )
{
if ( remPacket == null )
remPacket = this.RemovePacket;
state.Send( remPacket );
}
}
}
}
m_Location = location;
this.OnLocationChange( oldRealLocation );
ReleaseWorldPackets();
if ( m_Items != null )
{
for ( int i = 0; i < m_Items.Count; ++i )
( (Item) m_Items[i] ).Map = map;
}
m_Map = map;
if ( m_Map != null )
m_Map.OnEnter( this );
OnMapChange();
EventSink.Instance.InvokeMapChanged( new MapChangedEventArgs( this, old ) );
if ( m_Map != null )
{
foreach ( GameClient state in m_Map.GetClientsInRange( m_Location, GetMaxUpdateRange() ) )
{
Mobile m = state.Mobile;
if ( m.CanSee( this ) && m.InRange( m_Location, GetUpdateRange( m ) ) )
SendInfoTo( state );
}
}
RemDelta( ItemDelta.Update );
if ( old == null || old == Map.Internal )
InvalidateProperties();
}
else if ( m_Map != null )
{
if ( oldLocation.X != 0 )
{
Packet removeThis = null;
foreach ( GameClient state in m_Map.GetClientsInRange( oldLocation, GetMaxUpdateRange() ) )
{
Mobile m = state.Mobile;
if ( !m.InRange( location, GetUpdateRange( m ) ) )
{
if ( removeThis == null )
removeThis = this.RemovePacket;
state.Send( removeThis );
}
}
}
//.........这里部分代码省略.........
示例6: Deserialize
//.........这里部分代码省略.........
TotalGold = reader.ReadInt32();
}
if (GetSaveFlag(flags, SaveFlag.FreezeDried))
{
int count = reader.ReadInt();
m_SerializedContentsIdx = new byte[count];
for (int i = 0; i < count; i++)
m_SerializedContentsIdx[i] = reader.ReadByte();
count = reader.ReadInt();
m_SerializedContentsBin = new byte[count];
for (int i = 0; i < count; i++)
m_SerializedContentsBin[i] = reader.ReadByte();
}
if (GetSaveFlag(flags, SaveFlag.InsuredFor))
/*m_InsuredFor = */
reader.ReadMobile();
if (GetSaveFlag(flags, SaveFlag.BlessedFor))
m_BlessedFor = reader.ReadMobile();
if (GetSaveFlag(flags, SaveFlag.HeldBy))
m_HeldBy = reader.ReadMobile();
if (GetSaveFlag(flags, SaveFlag.SavedFlags))
m_SavedFlags = reader.ReadEncodedInt();
//wea: 13/Mar/2007 Rare Factory
if (GetSaveFlag(flags, SaveFlag.RareData))
m_RareData = (UInt32)reader.ReadInt();
if (m_Map != null && m_Parent == null)
m_Map.OnEnter(this);
break;
}
case 5:
{
//SaveFlag flags = (SaveFlag)reader.ReadInt();
LastMoved = reader.ReadDeltaTime();
if (GetSaveFlag(flags, SaveFlag.Direction))
m_Direction = (Direction)reader.ReadByte();
if (GetSaveFlag(flags, SaveFlag.Bounce))
m_Bounce = BounceInfo.Deserialize(reader);
if (GetSaveFlag(flags, SaveFlag.LootType))
m_LootType = (LootType)reader.ReadByte();
if (GetSaveFlag(flags, SaveFlag.LocationFull))
m_Location = reader.ReadPoint3D();
if (GetSaveFlag(flags, SaveFlag.ItemID))
m_ItemID = reader.ReadInt();
if (GetSaveFlag(flags, SaveFlag.Hue))
m_Hue = reader.ReadInt();
if (GetSaveFlag(flags, SaveFlag.Amount))
m_Amount = reader.ReadInt();
else
m_Amount = 1;