本文整理汇总了C#中Server.Timer类的典型用法代码示例。如果您正苦于以下问题:C# Timer类的具体用法?C# Timer怎么用?C# Timer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Timer类属于Server命名空间,在下文中一共展示了Timer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Deserialize
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
i_Timer=new DBSTimer(this);
i_Timer.Start();
}
示例2: VendorInventory
public VendorInventory( BaseHouse house, GenericReader reader )
{
m_House = house;
int version = reader.ReadEncodedInt();
m_Owner = reader.ReadMobile();
m_VendorName = reader.ReadString();
m_ShopName = reader.ReadString();
m_Items = reader.ReadStrongItemList();
m_Gold = reader.ReadInt();
m_ExpireTime = reader.ReadDeltaTime();
if ( m_Items.Count == 0 && m_Gold == 0 )
{
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( Delete ) );
}
else
{
TimeSpan delay = m_ExpireTime - DateTime.UtcNow;
m_ExpireTimer = new ExpireTimer( this, delay > TimeSpan.Zero ? delay : TimeSpan.Zero );
m_ExpireTimer.Start();
}
}
示例3: Deserialize
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
m_Boat = reader.ReadItem() as BaseBoat;
m_Side = (PlankSide) reader.ReadInt();
m_Locked = reader.ReadBool();
m_KeyValue = reader.ReadUInt();
if ( m_Boat == null )
Delete();
break;
}
}
if ( IsOpen )
{
m_CloseTimer = new CloseTimer( this );
m_CloseTimer.Start();
}
}
示例4: Penthesilea
public Penthesilea(bool decays) : base()
{
Name = "Penthesilea";
Body = 401;
VirtualArmor = 50;
CantWalk = true;
Female = true;
HairItemID= 0x203C;
HairHue = 1153;
AddItem( new Server.Items.FancyDress( 0x481) );
AddItem( new Server.Items.Sandals( 0x481) );;
Blessed = true;
if (decays)
{
m_Decays = true;
m_DecayTime = DateTime.Now + TimeSpan.FromSeconds(30);
m_Timer = new InternalTimer(this, m_DecayTime);
m_Timer.Start();
}
}
示例5: TreeStump
public TreeStump( int itemID )
: base()
{
AddComponent( new AddonComponent( itemID ), 0, 0, 0 );
m_Timer = Timer.DelayCall( TimeSpan.FromDays( 1 ), TimeSpan.FromDays( 1 ), new TimerCallback( GiveLogs ) );
}
示例6: OnTimerTick
private void OnTimerTick()
{
Sandbox.SafeInvoke(
() =>
{
if (_Timer == null)
{
return;
}
DateTime now = DateTime.UtcNow;
if (now.Month != 4 || now.Day != 1)
{
_Timer.Stop();
_Timer = null;
return;
}
foreach (NetState state in NetState.Instances.ToArray())
{
if (state == null || !state.Running || state.Mobile == null || state.Mobile.Deleted || state.Mobile.Hidden)
{
continue;
}
Mobile m = state.Mobile;
m.Say("I used to {0}, then I took an arrow to the knee!", _Vars[Utility.Random(_Vars.Length)]);
}
_Timer.Interval = TimeSpan.FromMinutes(Utility.RandomMinMax(5, 20));
},
this);
}
示例7: DuelWall
public DuelWall( bool northsouth, Mobile from, Mobile to )
: base(0x80)
{
m_From = from;
m_To = to;
Movable = false;
if( northsouth )
{
m_Item1 = new InternalItem( this, 1, 0 );
m_Item2 = new InternalItem( this, -1, 0 );
m_XOffset1 = 1;
m_XOffset2 = -1;
m_YOffset1 = 0;
m_YOffset2 = 0;
}
else
{
m_Item1 = new InternalItem( this, 0, 1 );
m_Item2 = new InternalItem( this, 0, -1 );
m_XOffset1 = 0;
m_XOffset2 = 0;
m_YOffset1 = 1;
m_YOffset2 = -1;
}
m_Timer = new InternalTimer( this, TimeSpan.FromSeconds( 10.0 ), m_From, m_To );
m_Timer.Start();
m_End = DateTime.Now + TimeSpan.FromSeconds( 3.0 );
Effects.PlaySound( new Point3D( X, Y, Z ), Map, 0x1F6 );
}
示例8: Aquarium
public Aquarium( int itemID )
: base(itemID)
{
if ( itemID == 0x3060 )
AddComponent( new AddonContainerComponent( 0x3061 ), -1, 0, 0 );
if ( itemID == 0x3062 )
AddComponent( new AddonContainerComponent( 0x3063 ), 0, -1, 0 );
MaxItems = 30;
Weight = 10.0;
m_Food = new AquariumState();
m_Water = new AquariumState();
m_Food.State = (int) FoodState.Full;
m_Water.State = (int) WaterState.Strong;
m_Food.Maintain = Utility.RandomMinMax( 1, 2 ); ;
m_Food.Improve = m_Food.Maintain + Utility.RandomMinMax( 1, 2 );
m_Water.Maintain = Utility.RandomMinMax( 1, 3 ); ;
m_Events = new List<int>();
m_Timer = Timer.DelayCall( TimeSpan.FromHours( 24 ), TimeSpan.FromHours( 24 ), new TimerCallback( Evaluate ) );
}
示例9: LogoutGump
public LogoutGump( CampfireEntry entry, Bedroll bedroll ) : base( 100, 0 )
{
m_Entry = entry;
m_Bedroll = bedroll;
m_CloseTimer = Timer.DelayCall( TimeSpan.FromSeconds( 10.0 ), new TimerCallback( Close ) );
AddBackground( 0, 0, 400, 350, 0xA28 );
AddHtmlLocalized( 100, 20, 200, 35, 1011015, false, false ); // <center>Logging out via camping</center>
/* Using a bedroll in the safety of a camp will log you out of the game safely.
* If this is what you wish to do choose CONTINUE and you will be logged out.
* Otherwise, select the CANCEL button to avoid logging out at this time.
* The camp will remain secure for 10 seconds at which time this window will close
* and you not be logged out.
*/
AddHtmlLocalized( 50, 55, 300, 140, 1011016, true, true );
AddButton( 45, 298, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 80, 300, 110, 35, 1011011, false, false ); // CONTINUE
AddButton( 200, 298, 0xFA5, 0xFA7, 0, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 235, 300, 110, 35, 1011012, false, false ); // CANCEL
}
示例10: FinishWorking_Callback
private void FinishWorking_Callback( object state )
{
if ( m_Timer != null )
{
m_Timer.Stop();
m_Timer = null;
}
Mobile from = state as Mobile;
if ( from != null && !from.Deleted && !this.Deleted && IsFull )
{
SackFlour flour = new SackFlour();
flour.ItemID = ( Utility.RandomBool() ? 4153 : 4165 );
if ( from.PlaceInBackpack( flour ) )
{
m_Flour = 0;
}
else
{
flour.Delete();
from.SendLocalizedMessage( 500998 ); // There is not enough room in your backpack! You stop grinding.
}
}
UpdateStage();
}
示例11: StartTimer
public virtual void StartTimer()
{
if ( m_Timer != null )
m_Timer.Stop();
m_Timer = Timer.DelayCall( TimeSpan.FromMinutes( 5 ), new TimerCallback( Kill ) );
}
示例12: OnTalk
public override void OnTalk( PlayerMobile player, bool contextMenu )
{
QuestSystem qs = player.Quest;
if ( qs is TheGraveDiggerQuest )
{
QuestObjective obj = qs.FindObjective( typeof( VincentsLittleGirlObjective ) );
if ( obj != null && !obj.Completed )
{
obj.Complete();
this.Say( "Sweetie that strange person over there is stairing at me." );
if ( this.BoyFriend != null )
{
m_RespondTime = DateTime.Now + TimeSpan.FromSeconds( 1.0 );
m_Timer = new InternalTimer( this.BoyFriend, player, m_RespondTime );
m_Timer.Start();
m_Player = player;
}
}
else
{
this.Say( "Yes? can i help you?" );
}
}
}
示例13: Deserialize
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 1:
{
m_Caster = (BaseCreature)reader.ReadMobile();
goto case 0;
}
case 0:
{
m_End = reader.ReadDeltaTime();
m_Timer = new InternalTimer(this, TimeSpan.Zero, true, true);
m_Timer.Start();
break;
}
}
}
示例14: FinishHealing
public void FinishHealing()
{
for ( int i = 0; i < 7 && i < Components.Count; i++ )
Components[ i ].Hue = 0x6;
m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 2 ), new TimerCallback( OpenOrgan ) );
}
示例15: MagicalFishFinder
public MagicalFishFinder() : base(5366)
{
Hue = 2500;
Expires = DateTime.UtcNow + TimeSpan.FromHours(DecayPeriod);
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), CheckDecay);
}