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


C# CmdRequest类代码示例

本文整理汇总了C#中CmdRequest的典型用法代码示例。如果您正苦于以下问题:C# CmdRequest类的具体用法?C# CmdRequest怎么用?C# CmdRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 2)
                return ShowUsage(); // " moveprim prim [x y [z]]";

            int used;
            List<SimObject> PS = WorldSystem.GetSingleArg(args, out used);
            if (IsEmpty(PS)) return Failure("Cannot find prim: " + args.str);
            string[] to = Parser.SplitOff(args, used);
            SimPosition aPos = WorldSystem.GetVector(to, out used);
            if (aPos == null) return Failure("Cannot find position: " + string.Join(" ", to));
            if (!aPos.IsRegionAttached) return Failure("!IsRegionAttached: " + aPos);
            List<SimObject> TODO = new List<SimObject>();
            foreach (var O in PS)
            {
                if (!O.IsRegionAttached) return Failure("!IsRegionAttached: " + O);
                TODO.Add(O);
            }
            foreach (var O in TODO)
            {
                SimPosition localPos = WorldSystem.GetVector(to, out used, O);
                Vector3d local = localPos.GlobalPosition;
                O.SetObjectPosition(local);
            }
            return Success("acted on " + PS.Count);
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:26,代码来源:MovePrimCommand.cs

示例2: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length > 0)
            {
                try
                {
                    string treeName = args[0].Trim(new char[] {' '});
                    Tree tree = (Tree) 0;
                    if (!args.TryGetValue("tree", out tree))
                    {
                        object value;
                        int argsUsed;
                        if (TryEnumParse(typeof (Tree), args, 0, out argsUsed, out value))
                        {
                            tree = (Tree) value;
                        }
                    }

                    Vector3 treePosition = GetSimPosition();
                    treePosition.Z += 3.0f;
                    Vector3 size = new Vector3(0.5f, 0.5f, 0.5f);
                    Client.Objects.AddTree(Client.Network.CurrentSim, size,
                                           Quaternion.Identity, treePosition, tree, TheBotClient.GroupID, false);

                    return Success("Attempted to rez a " + treeName + " tree");
                }
                catch (Exception e)
                {
                    return Failure("" + e);
                }
            }
            return ShowUsage();
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:33,代码来源:TreeCommand.cs

示例3: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length != 2)
                return ShowUsage(); // " packetlog 10 tenpackets.xml";

            return Success("This function is currently unimplemented");
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:7,代码来源:PacketLogCommand.cs

示例4: ExecuteRequest

 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     string verb = args.CmdName;
     // base.acceptInput(verb, args);
     UUID primID = UUID.Zero;
     SimActor TheSimAvatar = this.TheSimAvatar;
     if (verb == "stop-following")
     {
         // SimPosition ap = TheSimAvatar.ApproachPosition;
         if (TheSimAvatar.CurrentAction is MoveToLocation)
         {
             TheSimAvatar.CurrentAction = null;
         }
         TheSimAvatar.SetMoveTarget(null, 10);
         TheSimAvatar.StopMoving();
     }
     SimPosition position;
     if (!args.TryGetValue("target", out position))
     {
         return Failure("$bot don't know who " + args.GetString("target") + " is.");
     }
     {
         if (position != null)
         {
             String str = "" + Client + " start to follow " + position + ".";
             WriteLine(str);
             // The thread that accepts the Client and awaits messages
             TheSimAvatar.CurrentAction = new FollowerAction(TheSimAvatar, position);
             return Success("$bot started following " + position);
         }
     }
     {
         return Success("$bot ApproachPosition: " + TheSimAvatar.CurrentAction);
     }
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:35,代码来源:FollowCommand.cs

示例5: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            float distance = 2.0f;

            int argsUsed;
            SimPosition simObject = WorldSystem.GetVector(args, out argsUsed);

            if (simObject == null) return Failure("Cannot find " + args.str);
            if (!simObject.IsRegionAttached)
            {
                return Failure("Cannot get SimPosition of " + simObject);
            }

            distance = 0.5f + simObject.GetSizeDistance();
            if (argsUsed < args.Length)
            {
                float d;
                if (float.TryParse(args[argsUsed], out d))
                {
                    distance = d;
                }
            }
            WriteLine("WalkTo {0} {1}", simObject, distance);
            WorldSystem.TheSimAvatar.SimpleMoveTo(simObject.GlobalPosition, distance, 10, false);
            WorldSystem.TheSimAvatar.StopMoving();
            return Success(WorldSystem.TheSimAvatar.DistanceVectorString(simObject));
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:27,代码来源:WalkToCommand.cs

示例6: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            string inventoryName;
            uint timeout;
            string fileName;

            if (args.Length != 3)
                return ShowUsage(); // " uploadimage [inventoryname] [timeout] [filename]";

            TextureID = UUID.Zero;
            inventoryName = args[0];
            fileName = args[2];
            if (!UInt32.TryParse(args[1], out timeout))
                return ShowUsage(); // " uploadimage [inventoryname] [timeout] [filename]";

            WriteLine("Loading image " + fileName);
            byte[] jpeg2k = LoadImage(fileName);
            if (jpeg2k == null)
                return Failure("failed to compress image to JPEG2000");
            WriteLine("Finished compressing image to JPEG2000, uploading...");
            start = DateTime.Now;
            DoUpload(jpeg2k, inventoryName);

            if (UploadCompleteEvent.WaitOne((int) timeout, false))
            {
                return
                    Success(string.Format("Texture upload {0}: {1}", (TextureID != UUID.Zero) ? "succeeded" : "failed",
                                          TextureID));
            }
            else
            {
                return Failure("Texture upload timed out");
            }
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:34,代码来源:UploadImageCommand.cs

示例7: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            //  base.acceptInput(verb, args);

            if (args.str == "stop")
            {
                Client.Self.Fly(false);
                return Success("stopped flying");
            }
            if (args.str == "up")
            {
                Client.Self.Movement.UpPos = true;
                Client.Self.Movement.SendUpdate(true);
                Thread.Sleep(1000);
                Client.Self.Movement.UpPos = false;
                Client.Self.Movement.SendUpdate(true);
                return Success("flew up");
            }
            else if (args.str == "down")
            {
                Client.Self.Movement.UpNeg = true;
                Client.Self.Movement.SendUpdate(true);
                Thread.Sleep(1000);
                Client.Self.Movement.UpNeg = false;
                Client.Self.Movement.SendUpdate(true);
                return Success("flew down");
            }
            else
            {
                Client.Self.Fly(true);
                return Success("now flying");
            }
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:33,代码来源:FlyCommand.cs

示例8: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
            {
                return ShowUsage(); // " goto_landmark [UUID]";
            }

            UUID landmark = UUID.Zero;
            int argsUsed;
            if (!UUIDTryParse(args, 0, out landmark, out argsUsed))
            {
                return Failure("Invalid LLUID");
            }
            else
            {
                WriteLine("Teleporting to " + landmark.ToString());
            }
            if (Client.Self.Teleport(landmark))
            {
                return Success("Teleport Succesful");
            }
            else
            {
                return Failure("Teleport Failed");
            }
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:26,代码来源:GotoLandmark.cs

示例9: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            StringBuilder output = new StringBuilder();
            {
                foreach (Simulator sim in LockInfo.CopyOf(Client.Network.Simulators))
                {
                    output.AppendLine(String.Format(
                                          "[{0}] Dilation: {1} InBPS: {2} OutBPS: {3} ResentOut: {4}  ResentIn: {5}",
                                          sim.ToString(), sim.Stats.Dilation, sim.Stats.IncomingBPS,
                                          sim.Stats.OutgoingBPS,
                                          sim.Stats.ResentPackets, sim.Stats.ReceivedResends));
                    output.Append("Packets in the queue: " + Client.Network.InboxCount);
                    Simulator csim = sim;
                    output.AppendLine(
                        String.Format(
                            "FPS : {0} PhysicsFPS : {1} AgentUpdates : {2} Objects : {3} Scripted Objects : {4}",
                            csim.Stats.FPS, csim.Stats.PhysicsFPS, csim.Stats.AgentUpdates, csim.Stats.Objects,
                            csim.Stats.ScriptedObjects));
                    output.AppendLine(
                        String.Format(
                            "Frame Time : {0} Net Time : {1} Image Time : {2} Physics Time : {3} Script Time : {4} Other Time : {5}",
                            csim.Stats.FrameTime, csim.Stats.NetTime, csim.Stats.ImageTime, csim.Stats.PhysicsTime,
                            csim.Stats.ScriptTime, csim.Stats.OtherTime));
                    output.AppendLine(String.Format("Agents : {0} Child Agents : {1} Active Scripts : {2}",
                                                    csim.Stats.Agents, csim.Stats.ChildAgents, csim.Stats.ActiveScripts));
                }
            }


            return Success(output.ToString());
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:31,代码来源:StatsCommand.cs

示例10: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            ulong regionHandle;

            int argsUsed;
            Simulator CurSim = TryGetSim(args, out argsUsed) ?? Client.Network.CurrentSim;
            if (args.Length == 0)
                regionHandle = CurSim.Handle;
            else if (!(args.Length == 1 && UInt64.TryParse(args[0], out regionHandle)))
                return ShowUsage(); // " agentlocations [regionhandle]";

            List<MapItem> items = Client.Grid.MapItems(regionHandle, GridItemType.AgentLocations,
                                                       GridLayerType.Objects, 1000*20);

            if (items != null)
            {
                StringBuilder ret = new StringBuilder();
                ret.AppendLine("Agent locations:");

                for (int i = 0; i < items.Count; i++)
                {
                    MapAgentLocation location = (MapAgentLocation) items[i];

                    ret.AppendLine(String.Format("{0} avatar(s) at {1},{2}", location.AvatarCount, location.LocalX,
                                                 location.LocalY));
                }

                return Success(ret.ToString());
            }
            else
            {
                return Failure("failed to fetch agent locations");
            }
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:34,代码来源:AgentLocationsCommand.cs

示例11: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
                return ShowUsage(); // " findsim [Simulator Name]";

            // Build the simulator name from the args list
            string simName = string.Empty;
            for (int i = 0; i < args.Length; i++)
                simName += args[i] + " ";
            simName = simName.TrimEnd().ToLower();

            //if (!GridDataCached[Client])
            //{
            //    Client.Grid.RequestAllSims(GridManager.MapLayerType.Objects);
            //    System.Threading.Thread.Sleep(5000);
            //    GridDataCached[Client] = true;
            //}

            GridRegion region;

            if (Client.Grid.GetGridRegion(simName, GridLayerType.Objects, out region))
                return
                    Success(string.Format("{0}: handle={1} ({2},{3})", region.Name, region.RegionHandle, region.X,
                                          region.Y));

            else
                return Failure("Lookup of " + simName + " failed");
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:28,代码来源:FindSimCommand.cs

示例12: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            int seconds;
            if (args.Length != 1 || !Int32.TryParse(args[0], out seconds))
                return ShowUsage(); // " sleep [seconds]";

            AgentPausePacket pause = new AgentPausePacket();
            pause.AgentData.AgentID = Client.Self.AgentID;
            pause.AgentData.SessionID = Client.Self.SessionID;
            pause.AgentData.SerialNum = sleepSerialNum++;

            Client.Network.SendPacket(pause);

            // Sleep
            Thread.Sleep(seconds*1000);

            AgentResumePacket resume = new AgentResumePacket();
            resume.AgentData.AgentID = Client.Self.AgentID;
            resume.AgentData.SessionID = Client.Self.SessionID;
            resume.AgentData.SerialNum = pause.AgentData.SerialNum;

            Client.Network.SendPacket(resume);

            return Success("Paused, slept for " + seconds + " second(s), and resumed");
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:25,代码来源:SleepCommand.cs

示例13: ExecuteRequest

 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     if (args.Length < 1) return ShowUsage();
     string botcmd = args.GetString("act");
     TheSimAvatar.CurrentAction = new CommandAction(TheSimAvatar, botcmd);
     return Success(string.Format("{0} CurrentAction = {1}", TheSimAvatar, botcmd));
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:7,代码来源:BotActionCommand.cs

示例14: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args0)
        {
            var args = args0.GetProperty("targets");
            if (args.Length == 0)
            {
                return ShowUsage();
            }

            int argsUsed;
            List<string> searchArgs = new List<string> {"family"};
            searchArgs.AddRange(args);
            List<SimObject> PSO = WorldSystem.GetPrimitives(searchArgs.ToArray(), out argsUsed);
            List<Primitive> PS = new List<Primitive>();
            WorldSystem.AsPrimitives(PS,PSO);
            if (IsEmpty(PS)) return Failure("Cannot find objects from " + string.Join(" ", args));
            Primitive rootPim = PS[0];
            foreach (Primitive ps in PS)
            {
                if (ps.ParentID == 0)
                {
                    rootPim = ps;
                }
            }
            TheBotClient.InvokeGUI(() =>
                                    {
                                        frmPrimWorkshop pw = new frmPrimWorkshop(TheBotClient.TheRadegastInstance,
                                                                                 rootPim.LocalID);
                                       // pw.LoadPrims(PS);
                                       // pw.
                                        pw.Show();
                                    });
            return Success(Name + " on " + PS.Count);
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:33,代码来源:PrimWorkshopCommand.cs

示例15: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
                return ShowUsage(); // " searchevents [search text]";

            string searchText = string.Empty;
            for (int i = 0; i < args.Length; i++)
                searchText += args[i] + " ";
            searchText = searchText.TrimEnd();

            waitQuery.Reset();

            Client.Directory.DirEventsReply += Directory_DirEvents;

            // send the request to the directory manager
            Client.Directory.StartEventsSearch(searchText, 0);

            try
            {
                if (waitQuery.WaitOne(20000, false) && Client.Network.Connected)
                {
                    return Success("Your query '" + searchText + "' matched " + resultCount + " Events. ");
                }
                else
                {
                    return Failure("Timeout waiting for simulator to respond.");
                }
            }
            finally
            {
                Client.Directory.DirEventsReply -= Directory_DirEvents;
            }
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:33,代码来源:SearchEventsCommand.cs


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