Server.Gumps.SetPoint2DGump.OnResponse C# (CSharp) Méthode

OnResponse() public méthode

public OnResponse ( Server.Network.NetState sender, RelayInfo info ) : void
sender Server.Network.NetState
info RelayInfo
Résultat void
		public override void OnResponse( NetState sender, RelayInfo info )
		{
			Point2D toSet;
			bool shouldSet, shouldSend;

			switch ( info.ButtonID )
			{
				case 1: // Current location
				{
					toSet = new Point2D( m_Mobile.Location );
					shouldSet = true;
					shouldSend = true;

					break;
				}
				case 2: // Pick location
				{
					m_Mobile.Target = new InternalTarget( m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List );

					toSet = Point2D.Zero;
					shouldSet = false;
					shouldSend = false;

					break;
				}
				case 3: // Use values
				{
					TextRelay x = info.GetTextEntry( 0 );
					TextRelay y = info.GetTextEntry( 1 );

					toSet = new Point2D( x == null ? 0 : Utility.ToInt32( x.Text ), y == null ? 0 : Utility.ToInt32( y.Text ) );
					shouldSet = true;
					shouldSend = true;

					break;
				}
				default:
				{
					toSet = Point2D.Zero;
					shouldSet = false;
					shouldSend = true;

					break;
				}
			}

			if ( shouldSet )
			{
				try
				{
					CommandLogging.LogChangeProperty( m_Mobile, m_Object, m_Property.Name, toSet.ToString() );
					m_Property.SetValue( m_Object, toSet, null );
					PropertiesGump.OnValueChanged( m_Object, m_Property, m_Stack );
				}
				catch
				{
					m_Mobile.SendMessage( "An exception was caught. The property may not have changed." );
				}
			}

			if ( shouldSend )
				m_Mobile.SendGump( new PropertiesGump( m_Mobile, m_Object, m_Stack, m_List, m_Page ) );
		}
	}