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


C# CommandEventArgs.GetString方法代码示例

本文整理汇总了C#中CommandEventArgs.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# CommandEventArgs.GetString方法的具体用法?C# CommandEventArgs.GetString怎么用?C# CommandEventArgs.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CommandEventArgs的用法示例。


在下文中一共展示了CommandEventArgs.GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: msg_invoke

		private static void msg_invoke( CommandEventArgs args )
		{
			if( args.Length == 1 && args.GetString( 0 ) != null )
			{
				string name = args.GetString( 0 );
				bool found = false;

				for( int i = 0; !found && i < NetState.Instances.Count; i++ )
				{
					if( NetState.Instances[i].Mobile != null && NetState.Instances[i].Mobile.RawName.ToLower() == name.ToLower() )
					{
						if( ChatManager.CanChat( args.Mobile, NetState.Instances[i].Mobile ) )
						{
							args.Mobile.SendGump( new ChatMessageGump( args.Mobile, NetState.Instances[i].Mobile ) );
							found = true;
						}
					}
				}

				if( !found )
					args.Mobile.SendGump( new ChatListGump( ListPage.Everyone, args.Mobile ) );
			}
			else
			{
				args.Mobile.SendGump( new ChatListGump( ListPage.Everyone, args.Mobile ) );
			}
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:27,代码来源:ChatCommands.cs

示例2: ExecuteList

        public override void ExecuteList(CommandEventArgs e, ArrayList list)
        {
            if (list.Count > 0)
            {
                List<string> columns = new List<string>();

                columns.Add("Object");

                if (e.Length > 0)
                {
                    int offset = 0;

                    if (Insensitive.Equals(e.GetString(0), "view"))
                        ++offset;

                    while (offset < e.Length)
                        columns.Add(e.GetString(offset++));
                }

                e.Mobile.SendGump(new InterfaceGump(e.Mobile, columns.ToArray(), list, 0, null));
            }
            else
            {
                this.AddResponse("No matching objects found.");
            }
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:26,代码来源:Interface.cs

示例3: SetSkill_OnCommand

		public static void SetSkill_OnCommand( CommandEventArgs arg )
		{
			if( arg.Length != 2 )
			{
				arg.Mobile.SendMessage( "SetSkill <skill name> <value>" );
			}
			else
			{
				SkillName skill;
#if Framework_4_0
				if( Enum.TryParse( arg.GetString( 0 ), true, out skill ) )
				{
					arg.Mobile.Target = new SkillTarget( skill, arg.GetDouble( 1 ) );
				}
				else
				{
					arg.Mobile.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set.
				}
#else
				try
				{
					skill = (SkillName)Enum.Parse( typeof( SkillName ), arg.GetString( 0 ), true );
				}
				catch
				{
					arg.Mobile.SendLocalizedMessage( 1005631 ); // You have specified an invalid skill to set.
					return;
				}
				arg.Mobile.Target = new SkillTarget( skill, arg.GetDouble( 1 ) );
#endif
			}
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:32,代码来源:Skills.cs

示例4: ValidateArgs

        public override bool ValidateArgs(BaseCommandImplementor impl, CommandEventArgs e)
        {
            if (e.Length >= 1)
            {
                Type t = ScriptCompiler.FindTypeByName(e.GetString(0));

                if (t == null)
                {
                    e.Mobile.SendMessage("No type with that name was found.");

                    string match = e.GetString(0).Trim();

                    if (match.Length < 3)
                    {
                        e.Mobile.SendMessage("Invalid search string.");
                        e.Mobile.SendGump(new AddGump(e.Mobile, match, 0, Type.EmptyTypes, false));
                    }
                    else
                    {
                        e.Mobile.SendGump(new AddGump(e.Mobile, match, 0, AddGump.Match(match).ToArray(), true));
                    }
                }
                else
                {
                    return true;
                }
            }
            else
            {
                e.Mobile.SendGump(new CategorizedAddGump(e.Mobile));
            }

            return false;
        }
开发者ID:FreeReign,项目名称:forkuo,代码行数:34,代码来源:Commands.cs

示例5: RemoveAccountTag_OnCommand

		public static void RemoveAccountTag_OnCommand( CommandEventArgs e )
		{
			Mobile from = e.Mobile;
			if( from == null || from.Deleted )
				return;

			if( e.Length == 2 )
			{
				string accString = e.GetString( 0 );
				string tagString = e.GetString( 1 );

				if( !string.IsNullOrEmpty( accString ) )
				{
					Account acct = Accounts.GetAccount( accString ) as Account;

					if( acct != null )
					{
						if( !string.IsNullOrEmpty( tagString ) )
						{
							if( !string.IsNullOrEmpty(acct.GetTag( tagString )) )
							{
								string msg = string.Format( "You are going to remove tag <em><basefont color=red>{0}</basefont></em> " +
								                            "from accunt <em><basefont color=red>{1}</basefont></em>.<br>" +
							                            	"Are you sure you want to proceed?", tagString, accString );
								from.SendGump( new WarningGump( 1060635, 30720, msg, 0xFFC000, 420, 280, new WarningGumpCallback( ConfirmRemoveCallBack ), new object[]{ acct, tagString }, true ) );
							}
							else
							{
								from.SendMessage( "Target account exist but does not have that tag." );
							}
						}
						else
						{
							from.SendMessage( "Invalid tag (null or empty)." );
						}
					}
					else
					{
						from.SendMessage( "Target account does not exist." );
					}
				}
				else
				{
					from.SendMessage( "Invalid userName (null or empty)." );
				}
			}
			else
			{
				from.SendMessage( "CommandUse: [RemoveAccountTag <account> <tag>" );
			}
		}
开发者ID:greeduomacro,项目名称:annox,代码行数:51,代码来源:Dies+Irae+-+RemoveAccountTag.cs

示例6: ChangeSeason_OnCommand

        public static void ChangeSeason_OnCommand(CommandEventArgs e)
        {
            Mobile m = e.Mobile;
            
            if (e.Length != 1)
            {
                m.SendMessage("Usage: [ChangeSeason [Spring|Summer|Autumn|Winter|Desolation]");
                return;
            }

            int season;

            switch (e.GetString(0).ToLower())
            {
                case "spring":
                    season = 0;
                    break;
                case "summer":
                    season = 1;
                    break;
                case "autumn":
                case "fall":
                    season = 2;
                    break;
                case "winter":
                    season = 3;
                    break;
                case "desolation":
                    season = 4;
                    break;
                default:
                    m.SendMessage("Usage: [ChangeSeason [Spring|Summer|Autumn|Winter|Desolation]");
                    return;
            }

            Map map = m.Map;
            map.Season = season;

            foreach (NetState ns in NetState.Instances)
            {
                if (ns.Mobile == null || ns.Mobile.Map != map)
                    continue;

                ns.Send(SeasonChange.Instantiate(ns.Mobile.GetSeason(), true));
                ns.Mobile.SendEverything();
            }

            m.SendMessage("{0} season changed to {1}.", map.Name, e.GetString(0));
        }
开发者ID:greeduomacro,项目名称:last-wish,代码行数:49,代码来源:ChangeSeason.cs

示例7: Equip_OnCommand

		public static void Equip_OnCommand( CommandEventArgs e )
		{
			Mobile from = e.Mobile;

			Type type = ScriptCompiler.FindTypeByName( e.GetString( 0 ).Trim().ToLower(), true );

			if ( type != null && typeof( Item ).IsAssignableFrom( type ) )
			{
				Item item = from.Backpack.FindItemByType( type, true );

				if ( item != null && !item.Deleted )
				{
					from.DropHolding();

					bool rejected;
					LRReason reject;

					from.Lift( item, item.Amount, out rejected, out reject );

					if ( !rejected )
					{
						from.Holding = null;

						if ( !from.EquipItem( item ) )
							item.Bounce( from );
					}

					item.ClearBounce();
				}
			}
			else
				from.SendMessage( "That item type does not exist." );
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:33,代码来源:Equip.cs

示例8: OnCommand

        public static void OnCommand(CommandEventArgs arg)
        {
            Mobile m = arg.Mobile;

            string skillNames = string.Join(", ", Enum.GetNames(typeof(SkillName)));

            if (arg.Length != 1)
            {
                m.SendMessage("Usage: SetSkill <skill name>. List of skill names: {0}.", skillNames);
            }
            else
            {
                SkillName skillName;
                if (Enum.TryParse(arg.GetString(0), true, out skillName))
                {
                    Skill skill = m.Skills[skillName];
                    if (skill != null)
                    {
                        skill.Base = 0;
                        m.SendMessage("You've successfully reset your {0}.", skill.Name);
                    }
                }
                else
                {
                    m.SendMessage("You have specified an invalid skill to set. List of skill names: {0}.", skillNames);
                }
            }
        }
开发者ID:Vorpalstar,项目名称:runuo-custom-scripts,代码行数:28,代码来源:ResetSkill.cs

示例9: Season_OnCommand

		private static void Season_OnCommand( CommandEventArgs e )
		{
			Mobile m = e.Mobile;

			if( e.Length == 1 )
			{
				string seasonType = e.GetString( 0 ).ToLower();
				SeasonList season;

				try
				{
					season = (SeasonList)Enum.Parse( typeof( SeasonList ), seasonType, true );
				}
				catch
				{
					m.SendMessage( "Usage: Season spring | summer | fall | winter | desolation" );
					return;
				}

				m.SendMessage( "Setting season to: " + seasonType + "." );
				SetSeason( m, season );
			}
			else
				m.SendMessage( "Usage: Season spring | summer | fall | winter | desolation" );
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:25,代码来源:SeasonCommand.cs

示例10: DeleteMap_OnCommand

        private static void DeleteMap_OnCommand( CommandEventArgs e )
        {
            try
            {
                BaseInstanceMap basemap = Map.Parse( e.GetString( 0 ) ) as BaseInstanceMap;

                if ( basemap != null )
                {
                    List<Item> items = new List<Item>();
                    List<Mobile> mobiles = new List<Mobile>();

                    foreach ( Item item in World.Items.Values )
                        if ( item.Map == basemap && item.Parent == null )
                            items.Add( item );

                    for ( int i = items.Count-1; i >= 0; i-- )
                        items[i].Delete();

                    foreach ( Mobile m in World.Mobiles.Values )
                        if ( !m.Player && m.Map == basemap )
                            mobiles.Add( m );

                    for ( int i = mobiles.Count-1; i >= 0; i-- )
                        mobiles[i].Delete();

                    basemap.Delete();
                }
            }
            catch
            {
            }
        }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:32,代码来源:InstanceMapCommands.cs

示例11: HelpInfo_OnCommand

		private static void HelpInfo_OnCommand( CommandEventArgs e )
		{
			if( e.Length > 0 )
			{
				string arg = e.GetString( 0 ).ToLower();
				CommandInfo c;

				if( m_HelpInfos.TryGetValue( arg, out c ) )
				{
					Mobile m = e.Mobile;

					if( m.AccessLevel >= c.AccessLevel )
						m.SendGump( new CommandInfoGump( c ) );
					else
						m.SendMessage( "You don't have access to that command." );

					return;
				}
				else
					e.Mobile.SendMessage( String.Format( "Command '{0}' not found!", arg ) );
			}

			e.Mobile.SendGump( new CommandListGump( 0, e.Mobile, null ) );

		}
开发者ID:nathanvy,项目名称:runuo,代码行数:25,代码来源:HelpInfo.cs

示例12: SetSeason_OnCommand

		private static void SetSeason_OnCommand(CommandEventArgs e)
		{
			Mobile from = e.Mobile;

			if (e.Length >= 1)
			{
				Region reg = from.Region;

				if (reg == null || !(reg is ISeasons))
				{
					from.SendMessage("You are not in a region that supports Seasons.");
					from.SendMessage("To set the Map Season, use {0}SetMapSeason", CommandSystem.Prefix);
				}
				else
				{
					try
					{
						ISeasons sreg = reg as ISeasons;

						sreg.Season = (Season)Enum.Parse(typeof(Season), (e.GetString(0).Trim()), true);
						from.SendMessage("Season has been set to {0}.", sreg.Season.ToString());
					}
					catch
					{
						from.SendMessage("Format: SetSeason < Spring | Summer | Autumn/Fall | Winter | Desolation >");
					}
				}
			}
			else
			{
				from.SendMessage("Format: SetSeason < Spring | Summer | Autumn/Fall | Winter | Desolation >");
			}
		}
开发者ID:greeduomacro,项目名称:vivre-uo,代码行数:33,代码来源:Commands.cs

示例13: Unequip_OnCommand

		public static void Unequip_OnCommand( CommandEventArgs e )
		{
			Mobile from = e.Mobile;

			Layer layer;
			if ( Enum.TryParse<Layer>( e.GetString( 0 ).Trim().ToLower(), true, out layer ) )
			{
				if ( layer > Layer.Invalid && layer <= Layer.LastUserValid && layer != Layer.Backpack )
				{
					Item item = from.FindItemOnLayer( layer );

					if ( item != null && !item.Deleted )
					{
						from.DropHolding();

						bool rejected;
						LRReason reject;

						from.Lift( item, item.Amount, out rejected, out reject );

						if ( !rejected )
						{
							from.Drop( from.Backpack, new Point3D( -1, -1, 0 ) );
							from.Holding = null;
						}
					}
				}
				else
					from.SendMessage( "That layer is not accessible." );
			}
			else
				from.SendMessage( "That layer does not exist." );
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:33,代码来源:Unequip.cs

示例14: Execute

        public override void Execute(CommandEventArgs e, object obj)
        {
            Mobile from = e.Mobile;
            Mobile target = obj as Mobile;
            Map map = from.Map;
            Point3D location = Point3D.Zero;

            if (target == null || map == Map.Internal || map == null)
            {
                from.SendAsciiMessage("Invalid target.");
                return;
            }
            else if (e.Length == 0)
            {
                from.SendAsciiMessage("Format:");
                from.SendAsciiMessage("SendTo int x int y");
                from.SendAsciiMessage("SendTo int x int y int z");
                from.SendAsciiMessage("SendTo int yLat int yMins (N|S) ySount int xLong int xMins (E|W) xEast");
                return;
            }
            else if (e.Length == 2)
            {
                int x = e.GetInt32(0);
                int y = e.GetInt32(1);

                location = new Point3D(x, y, map.GetAverageZ(x, y));
            }
            else if (e.Length == 3)
                location = new Point3D(e.GetInt32(0), e.GetInt32(1), e.GetInt32(2));
            else if (e.Length == 6)
            {
                location = Sextant.ReverseLookup(map, e.GetInt32(3), e.GetInt32(0), e.GetInt32(4), e.GetInt32(1), Insensitive.Equals(e.GetString(5), "E"), Insensitive.Equals(e.GetString(2), "S"));

                if (location == Point3D.Zero)
                    from.SendMessage("Sextant reverse lookup failed.");
            }

            if (location != Point3D.Zero)
            {
                target.MoveToWorld(location, map);
                from.SendAsciiMessage(string.Format("Sent {0} to {1}.", target.Name, location));
            }
            else
                from.SendAsciiMessage("Invalid location.");
        }
开发者ID:FreeReign,项目名称:imaginenation,代码行数:45,代码来源:SendTo.cs

示例15: CreateMap_OnCommand

        private static void CreateMap_OnCommand( CommandEventArgs e )
        {
            if ( e.Arguments.Length == 2 )
            {
                try
                {
                    Map map = Map.Parse( e.GetString( 0 ) );
                    if ( map != null )
                    {
                        string name = e.GetString( 1 );

                        BaseInstanceMap basemap = new BaseInstanceMap( map, name, MapRules.FeluccaRules );
                    }
                }
                catch
                {
                }
            }
        }
开发者ID:kamronbatman,项目名称:Defiance-AOS-Pre-2012,代码行数:19,代码来源:InstanceMapCommands.cs


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