当前位置: 首页>>代码示例>>C#>>正文


C# Server.Timer类代码示例

本文整理汇总了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();
		}
开发者ID:greeduomacro,项目名称:annox,代码行数:7,代码来源:DrunkenBarstool.cs

示例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();
            }
        }
开发者ID:nathanvy,项目名称:runuo,代码行数:26,代码来源:VendorInventory.cs

示例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();
			}
		}
开发者ID:jsrn,项目名称:MidnightWatchServer,代码行数:28,代码来源:Plank.cs

示例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();
            }
        }
开发者ID:greeduomacro,项目名称:cov-shard-svn-1,代码行数:25,代码来源:penthesilea.cs

示例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 ) );
        }
开发者ID:breadval,项目名称:azure_uo_script,代码行数:7,代码来源:TreeStump.cs

示例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);
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:34,代码来源:ATTKTest.cs

示例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 );
        }
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:33,代码来源:DuelWall.cs

示例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 ) );
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:27,代码来源:Aquarium.cs

示例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
			}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:25,代码来源:Bedroll.cs

示例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();
		}
开发者ID:jsrn,项目名称:MidnightWatchServer,代码行数:29,代码来源:FlourMillSouthAddon.cs

示例11: StartTimer

		public virtual void StartTimer()
		{
			if ( m_Timer != null )
				m_Timer.Stop();
						
			m_Timer = Timer.DelayCall( TimeSpan.FromMinutes( 5 ), new TimerCallback( Kill ) );
		}
开发者ID:romeov007,项目名称:imagine-uo,代码行数:7,代码来源:BaseFish.cs

示例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?" );
				}
			}
		}
开发者ID:romeov007,项目名称:imagine-uo,代码行数:26,代码来源:Linda.cs

示例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;
                    }
            }
        }
开发者ID:greeduomacro,项目名称:dragonknights-uo,代码行数:25,代码来源:AOE.cs

示例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 ) );
        }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:7,代码来源:PlagueBeastOrgans.cs

示例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);
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:7,代码来源:MagicFishFinder.cs


注:本文中的Server.Timer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。