當前位置: 首頁>>代碼示例>>C#>>正文


C# Network.NetState類代碼示例

本文整理匯總了C#中Server.Network.NetState的典型用法代碼示例。如果您正苦於以下問題:C# NetState類的具體用法?C# NetState怎麽用?C# NetState使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


NetState類屬於Server.Network命名空間,在下文中一共展示了NetState類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: OnResponse

		public override void OnResponse( NetState sender, RelayInfo info )
		{
			switch ( info.ButtonID )
			{
				case 0: // back
				{
					m_From.SendGump( new FactionStoneGump( m_From, m_Election.Faction ) );
					break;
				}
				case 1: // vote
				{
					if ( m_Election.State == ElectionState.Election )
						m_From.SendGump( new VoteGump( m_From, m_Election ) );

					break;
				}
				case 2: // campaign
				{
					if ( m_Election.CanBeCandidate( m_From ) )
						m_Election.AddCandidate( m_From );

					break;
				}
			}
		}
開發者ID:Godkong,項目名稱:Origins,代碼行數:25,代碼來源:ElectionGump.cs

示例2: OnResponse

		public override void OnResponse( NetState state, RelayInfo info )
		{
			m_Mobile.SendGump( new PageResponseGump( m_Mobile, m_Name, m_Text ) );

			//m_Mobile.SendMessage( 0x482, "{0} tells you:", m_Name );
			//m_Mobile.SendMessage( 0x482, m_Text );
		}
開發者ID:zerodowned,項目名稱:angelisland,代碼行數:7,代碼來源:PageQueueGump.cs

示例3: OnResponse

        public override void OnResponse(NetState state, RelayInfo info)
        {
            string bookName = "";
            try
            {
                for (int x = 0; x < 51; x++)
                {
                    bookName = GetString(info, x + 100);
                    if (!(string.IsNullOrEmpty(bookName)) && bookName.Length > 0) Book.Books[x].Name = bookName;
                    else Book.Books[x].Name = string.Format("Book #{0}", ((int)(x + 1)).ToString());
                }
            }
            catch(Exception e)
            {
                Console.WriteLine("Caught Exception in MasterRunebookGump, during the 'for' loop.");
                Console.WriteLine(e.ToString());
            }
            Mobile from = state.Mobile;
            try
            {

                if (info.ButtonID > 0)
                    from.SendGump(new InternalRunebookGump(from, Book.Books[info.ButtonID - 16], Book, info.ButtonID - 16));
            }
            catch (Exception e)
            {
                Console.WriteLine("Caught Exception in MasterRunebookGump, when sending new InternalRunebookGump.");
                Console.WriteLine(e.ToString());
            }
        }
開發者ID:greeduomacro,項目名稱:DimensionsNewAge,代碼行數:30,代碼來源:MasterRunebookGump.cs

示例4: RegisterInvalidAccess

		public static void RegisterInvalidAccess( NetState ns )
		{
			if( ns == null || !Enabled )
				return;

			InvalidAccountAccessLog accessLog = FindAccessLog( ns );

			if( accessLog == null )
				m_List.Add( accessLog = new InvalidAccountAccessLog( ns.Address ) );

			accessLog.Counts += 1;
			accessLog.RefreshAccessTime();

			if ( accessLog.Counts >= 3 ) {
				try {
					using ( StreamWriter op = new StreamWriter( "throttle.log", true ) ) {
						op.WriteLine(
							"{0}\t{1}\t{2}",
							DateTime.Now,
							ns,
							accessLog.Counts
						);
					}
				}
				catch {
				}
			}
		}
開發者ID:greeduomacro,項目名稱:hubroot,代碼行數:28,代碼來源:AccountAttackLimiter.cs

示例5: OnResponse

        public override void OnResponse( NetState sender, RelayInfo info )
        {
            Item item = m_Addon as Item;

            if ( item == null || item.Deleted )
                return;

            if ( info.ButtonID == (int) Buttons.Confirm )
            {
                Mobile m = sender.Mobile;
                BaseHouse house = BaseHouse.FindHouseAt( m );

                if ( house != null && house.IsOwner( m ) )
                {
                    if ( m.InRange( item.Location, 2 ) )
                    {
                        Item deed = m_Addon.Deed;

                        if ( deed != null )
                        {
                            m.AddToBackpack( deed );
                            house.Addons.Remove( item );
                            item.Delete();
                        }
                    }
                    else
                        m.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
                }
                else
                    m.SendLocalizedMessage( 1049784 ); // You can only re-deed this decoration if you are the house owner or originally placed the decoration.
            }
        }
開發者ID:kamronbatman,項目名稱:Defiance-AOS-Pre-2012,代碼行數:32,代碼來源:RewardDemolitionGump.cs

示例6: SendInfoTo

		public override void SendInfoTo(NetState state, bool sendOplPacket)
		{
			if (state == null || state.Mobile == null || state.Mobile.AccessLevel >= AccessLevel.Counselor)
			{
				base.SendInfoTo(state, sendOplPacket);
			}
		}
開發者ID:Ravenwolfe,項目名稱:Core,代碼行數:7,代碼來源:BoundsPreviewTile.cs

示例7: OnResponse

        public override void OnResponse(NetState sender, RelayInfo info)
        {
            if (m_Deed.Deleted || !m_Deed.IsChildOf(sender.Mobile.Backpack))
                return;

            switch (info.ButtonID)
            {
                case (int)Buttons.Exit:
                    return;
                case (int)Buttons.Add:
                    m_Deed.BeginCombine(sender.Mobile);
                    return;
                case (int)Buttons.PlaceInHouse:
                    if (m_Deed.NumOfPartsAdded > 0)
                    {
                        m_Deed.PlaceInHouse(sender.Mobile);
                        return;
                    }
                    else
                        sender.Mobile.SendMessage("You cannot add the pentagram to a house without any parts in the deed.");
                    break;
            }

            sender.Mobile.SendGump(new BloodPentagramPartGump(sender.Mobile, m_Deed));
        }
開發者ID:kamronbatman,項目名稱:Defiance-AOS-Pre-2012,代碼行數:25,代碼來源:BloodPentagramPartGump.cs

示例8: OnResponse

		public override void OnResponse( NetState sender, RelayInfo info )
		{
			PlayerMobile pm = sender.Mobile as PlayerMobile;

			if( !IsMember( pm, guild ) )
				return;

			switch( info.ButtonID )
			{
				case 1:
				{
					pm.SendGump( new GuildInfoGump( pm, guild ) );
					break;
				}
				case 2:
				{
					pm.SendGump( new GuildRosterGump( pm, guild ) );
					break;
				}
				case 3:
				{
					pm.SendGump( new GuildDiplomacyGump( pm, guild ) );
					break;
				}
			}
		}
開發者ID:Godkong,項目名稱:Origins,代碼行數:26,代碼來源:BaseGuildGump.cs

示例9: OnResponse

        public override void OnResponse( NetState state, RelayInfo info )
        {
            Mobile from = state.Mobile;

            if( info.IsSwitched( (int)Buttons.rdoYesJoin ) )
            {
                if( ScavengerSignup.signupEnabled && from is PlayerMobile )
                {
                    ScavengerBasket newBasket = new ScavengerBasket( (PlayerMobile)from );
                    if( !from.Backpack.CheckHold( from, newBasket, false ) )
                    {
                        from.SendMessage( "Your backpack is too full to even consider entering this event!" );
                        newBasket.Delete();
                        return;
                    }

                    from.AddToBackpack( newBasket );
                    ScavengerSignup.ScavengerBaskets.Add( newBasket );
                    from.SendMessage( "You are now entered in the scavenger hunt. Use the supplied basket to gather the scavenger items!" );
                }
                else
                {
                    from.SendMessage( "You have waited too long and signup for the scavenger hunt has ended" );
                }
            }
            else
            {
                from.SendMessage( "You have not been entered into the scavenger hunt event" );
            }
        }
開發者ID:greeduomacro,項目名稱:divinity,代碼行數:30,代碼來源:ScavengerSignupGump.cs

示例10: GetPacketFor

		public override Packet GetPacketFor( NetState ns )
		{
			if ( ns.HighSeas )
				return new MultiTargetReqHS( this );
			else
				return new MultiTargetReq( this );
		}
開發者ID:jackuoll,項目名稱:Pre-AOS-RunUO,代碼行數:7,代碼來源:MultiTarget.cs

示例11: OnResponse

		public override void OnResponse(NetState state, RelayInfo info)
		{
			Mobile from = state.Mobile;
			
			switch(info.ButtonID)
			{
				default:
				case 0: break;
				case 1: 
					from.SendGump(new StallLeasingGump(from, m_Plot));
					from.SendGump(new BazaarInformationGump(-1, 1150391));
					break;
				case 2: // SEE TOP BIDS
					from.SendGump(new TopBidsGump(from, m_Plot));
					break;
				case 3: // MY STALL LEASE
                    if (m_Plot.IsOwner(from))
                        from.SendGump(new MyStallLeaseGump(from, m_Plot));
                    else
                        from.SendLocalizedMessage(1150685); // You are currently viewing a stall that you are not leasing. In order to set up or modify your stall, please use that stall's sign.
					break;
				case 4: // MY STALL BID
					from.SendGump(new StallBidGump(from, m_Plot));
					break;
				case 5: // MY BID MATCHING
					if(m_Plot.IsOwner(from))
                        from.SendGump(new MatchBidGump(from, m_Plot));
					else
						from.SendLocalizedMessage(1150685); // You are currently viewing a stall that you are not leasing. In order to set up or modify your stall, please use that stall's sign.
					break;
			}
		}
開發者ID:Crome696,項目名稱:ServUO,代碼行數:32,代碼來源:BizaarSignGump.cs

示例12: OnResponse

      		public override void OnResponse( NetState state, RelayInfo info ) 
      		{ 
			Mobile from = state.Mobile; 

			if ( from == null )
				return;

        		if ( info.ButtonID == 0 ) // Close
         		{
				from.SendGump( new CityManagementGump( m_Stone, from ) );
			}

        		if ( info.ButtonID == 1 ) // Previous page
         		{
         			if ( m_ListPage > 0 )
					from.SendGump( new ChangeCitizenTitleGump( m_Stone, m_ListPage - 1, m_List, m_CountList ) );
			}

        		if ( info.ButtonID == 2 ) // Next page
         		{ 
         			if ( (m_ListPage + 1) * 7 < m_List.Count )
					from.SendGump( new ChangeCitizenTitleGump( m_Stone, m_ListPage + 1, m_List, m_CountList ) );
			}

        		if ( info.ButtonID >= 100 && info.ButtonID <= 999 ) // Decline
         		{
				Mobile mob = m_List[ info.ButtonID - 100 ] as Mobile;
				
				from.SendMessage( "Please enter the members new title, You are limited to 25 charactors or less." );
				from.Prompt = new CitizenTitleChangePrompt( m_Stone, mob, from );
			}
		}
開發者ID:greeduomacro,項目名稱:unknown-shard-1,代碼行數:32,代碼來源:ChangeCitizenTitleGump.cs

示例13: OnResponse

        public override void OnResponse( NetState state, RelayInfo info )
        {
            Mobile from = state.Mobile;

            if ( info.ButtonID == 1 )
            {
                if ( m_crop != null && !m_crop.Deleted )
                {
                    if ( m_crop is WheatCrop )
                        ((WheatCrop)m_crop).UpRoot( m_Owner );
                    else if ( m_crop is CottonCrop )
                        ((CottonCrop)m_crop).UpRoot( m_Owner );
                    else if ( m_crop is CarrotCrop )
                        ((CarrotCrop)m_crop).UpRoot( m_Owner );
                    else if ( m_crop is FlaxCrop )
                        ((FlaxCrop)m_crop).UpRoot( m_Owner );
                    else if ( m_crop is LettuceCrop )
                        ((LettuceCrop)m_crop).UpRoot( m_Owner );
                    else if ( m_crop is OnionCrop )
                        ((OnionCrop)m_crop).UpRoot( m_Owner );
                    else if ( m_crop is GarlicCrop )
                        ((GarlicCrop)m_crop).UpRoot( m_Owner );
                    else if ( m_crop is CabbageCrop )
                        ((CabbageCrop)m_crop).UpRoot( m_Owner );
                    else if ( m_crop is CornCrop )
                        ((CornCrop)m_crop).UpRoot( m_Owner );
                }
            }
        }
開發者ID:justdanofficial,項目名稱:khaeros,代碼行數:29,代碼來源:UpRootGump.cs

示例14: OnResponse

		public override void OnResponse( NetState sender, RelayInfo info )
		{
			int id = info.ButtonID;

			if ( m_PetSummonBall.Deleted || id <= 0 )
				return;

			id --;

			ArrayList pets = GetPetList( m_Mobile );

			if ( id < pets.Count && id >= 0 )
			{
				if ( m_Mobile.BankBox.ConsumeTotal( typeof( Gold ), 75000 ) )
				{
					m_PetSummonBall.UseCharge();
					SufferSkillLoss( (Mobile)pets[id], 10 );
					((Mobile)pets[id]).MoveToWorld( m_Mobile.Location, m_Mobile.Map );
					m_Mobile.SendMessage( "You pay the fee and your pet is returned to you. Your pet has suffered some skills from the travel." );
				}
				else
				{
					m_Mobile.SendMessage( "You need 75,000 gold in your bank to return your pet." );
				}
			}
		}
開發者ID:kamronbatman,項目名稱:DefianceUO-Pre1.10,代碼行數:26,代碼來源:CorruptedPetSummonGump.cs

示例15: OnResponse

		public override void OnResponse( NetState sender, RelayInfo info )
		{
			if ( info.ButtonID == 0 )
			{
				m_From.SendLocalizedMessage( 501235, "", 0x35 ); // Help request aborted.
			}
			else
			{
				TextRelay entry = info.GetTextEntry( 0 );
				string text = ( entry == null ? "" : entry.Text.Trim() );

				if ( text.Length == 0 )
				{
					m_From.SendMessage( 0x35, "You must enter a description." );
					m_From.SendGump( new PagePromptGump( m_From, m_Type ) );
				}
				else
				{
					m_From.SendLocalizedMessage( 501234, "", 0x35 ); /* The next available Counselor/Game Master will respond as soon as possible.
																	  * Please check your Journal for messages every few minutes.
																	  */

					PageQueue.Enqueue( new PageEntry( m_From, text, m_Type ) );
				}
			}
		}
開發者ID:greeduomacro,項目名稱:last-wish,代碼行數:26,代碼來源:PagePromptGump.cs


注:本文中的Server.Network.NetState類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。