Server.Misc.ShardPoller.RemoveOption C# (CSharp) Méthode

RemoveOption() public méthode

public RemoveOption ( ShardPollOption option ) : void
option ShardPollOption
Résultat void
		public void RemoveOption( ShardPollOption option )
		{
			int index = Array.IndexOf( m_Options, option );

			if ( index < 0 )
				return;

			ShardPollOption[] old = m_Options;
			m_Options = new ShardPollOption[old.Length - 1];

			for ( int i = 0; i < index; ++i )
				m_Options[i] = old[i];

			for ( int i = index; i < m_Options.Length; ++i )
				m_Options[i] = old[i + 1];
		}

Usage Example

Exemple #1
0
        public override void OnResponse(Mobile from, string text)
        {
            if (m_Poller.Active)
            {
                from.SendMessage("You may not edit an active poll. Deactivate it first.");
            }
            else if (text == "DEL")
            {
                if (m_Option != null)
                {
                    m_Poller.RemoveOption(m_Option);
                }
            }
            else
            {
                text = UrlToHref(text);

                if (m_Option == null)
                {
                    m_Poller.AddOption(new ShardPollOption(text));
                }
                else
                {
                    m_Option.Title = text;
                }
            }

            from.SendGump(new ShardPollGump(from, m_Poller, true, null));
        }