本文整理汇总了C#中CmdRequest.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# CmdRequest.ContainsKey方法的具体用法?C# CmdRequest.ContainsKey怎么用?C# CmdRequest.ContainsKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CmdRequest
的用法示例。
在下文中一共展示了CmdRequest.ContainsKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteRequest
public override CmdResult ExecuteRequest(CmdRequest args)
{
bool moveInsteadOfCopy = args.IsTrue("--move");
if (!args.ContainsKey("items") || !args.ContainsKey("to"))
{
return ShowUsage();
}
int argsUsed;
List<SimObject> allTargets;
if (!args.TryGetValue("to", out allTargets))
{
return Failure("Cannot find avatar/objects 'to' give to");
}
Success("Going to give to " + allTargets.Count + " avatar/objects");
var man = Client.BotInventory;
var found = man.FindAll(args.GetProperty("items"), false,
inventoryName => Failure("No inventory item named " + inventoryName + " found."));
int given = 0;
foreach (var dest in allTargets)
{
foreach (InventoryBase item in found)
{
GiveAll(man, item, dest, moveInsteadOfCopy);
}
}
return SuccessOrFailure();
}
示例2: ExecuteRequestProc
public static CmdResult ExecuteRequestProc(CmdRequest args, Command cmd)
{
if (!args.ContainsKey("to"))
args.SetValue("to", "verb");
;
if (!cmd.Client.IsLoggedInAndReady)
{
return cmd.Failure("Not yet logged in!");
}
var TheSimAvatar = cmd.WorldSystem.TheSimAvatar;
if (TheSimAvatar.IsSitting && !TheSimAvatar.IsDrivingVehical)
{
cmd.WriteLine("$bot is standing up before moving.");
TheSimAvatar.StandUp();
// WriteLine("$bot is sitting, Please stand up to move.");
}
SimPosition position;
if (!args.TryGetValue("to", out position))
{
return cmd.Failure("I don't understand how to move " + args.str);
}
if (position == null)
{
return cmd.Failure("Coulnd not resolve location: " + args.str);
}
if (!position.IsRegionAttached)
{
return cmd.Failure("!IsRegionAttached: " + position);
}
if (position.SimPosition == Vector3.Zero)
{
return cmd.Failure("SimPosition.Zero: " + position);
}
Vector3d delta0 = position.GlobalPosition - TheSimAvatar.GlobalPosition;
Vector3 delta = new Vector3((float) delta0.X, (float) delta0.Y, (float) delta0.Z);
float fnd;
if (args.TryGetValue("dist", out fnd))
{
delta.Normalize();
delta = delta*fnd;
position = new SimOffsetPosition(TheSimAvatar, delta);
}
MovementProceedure proc;
bool salientProc = args.TryGetValue("sproc", out proc);
if (salientProc)
{
TheSimAvatar.SalientMovementProceedure = proc;
}
if (args.TryGetValue("proc", out proc))
{
TheSimAvatar.SimpleMoveToMovementProceedure = proc;
}
Vector3d g = position.GlobalPosition;
TheSimAvatar.SetClient(cmd.TheBotClient);
if (salientProc)
{
return cmd.Result(string.Format("SalientGoto: {0},{1},{2}", position, g, position.SimPosition),
TheSimAvatar.SalientGoto(position));
}
else
{
TheSimAvatar.SetMoveTarget(position, position.GetSizeDistance());
}
//Client.Self.AutoPilot(g.X, g.Y, g.Z);
// MoveThread = new Thread(MoveProc);
return cmd.Success(string.Format("SetMoveTarget: {0},{1},{2}", position, g, position.SimPosition));
}