public override void OnResponse( NetState sender, RelayInfo info )
{
if ( m_Polls != null && m_Polls.Count > 0 )
{
ShardPoller poller = m_Polls.Dequeue();
if ( poller != null )
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( poller.SendQueuedPoll_Callback ), new object[]{ m_From, m_Polls } );
}
if ( info.ButtonID == 1 )
{
int[] switches = info.Switches;
if ( switches.Length == 0 )
return;
int switched = switches[0] - 1;
ShardPollOption opt = null;
if ( switched >= 0 && switched < m_Poller.Options.Length )
opt = m_Poller.Options[switched];
if ( opt == null && !m_Editing )
return;
if ( m_Editing )
{
if ( !m_Poller.Active )
{
m_From.SendMessage( "Enter a title for the option. Escape to cancel.{0}", opt == null ? "" : " Use \"DEL\" to delete." );
m_From.Prompt = new ShardPollPrompt( m_Poller, opt );
}
else
{
m_From.SendMessage( "You may not edit an active poll. Deactivate it first." );
m_From.SendGump( new ShardPollGump( m_From, m_Poller, m_Editing, m_Polls ) );
}
}
else
{
if ( !m_Poller.Active )
m_From.SendMessage( "The poll has been deactivated." );
else if ( m_Poller.HasAlreadyVoted( sender ) )
m_From.SendMessage( "You have already voted on this poll." );
else
m_Poller.AddVote( sender, opt );
}
}
else if ( info.ButtonID == 2 && m_Editing )
{
m_From.SendGump( new ShardPollGump( m_From, m_Poller, m_Editing, m_Polls ) );
m_From.SendGump( new PropertiesGump( m_From, m_Poller ) );
}
}
}