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


C# CmdRequest.AdvanceArgs方法代码示例

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


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

示例1: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            if (args.Length < 1)
                return ShowUsage();

            int argsUsed;
            List<SimObject> PS = WorldSystem.GetSingleArg(args, out argsUsed);
            args = args.AdvanceArgs(argsUsed);
            AttachmentPoint attachmentPoint = AttachmentPoint.Default;
            if (args.Length > 0)
            {
                object obj;
                if (TryEnumParse(typeof (AttachmentPoint), args, 0, out argsUsed, out obj))
                {
                    attachmentPoint = (AttachmentPoint) obj;
                }
            }
            args = args.AdvanceArgs(argsUsed);
            Quaternion rotation = Quaternion.Identity;
            if (args.Length > 0)
            {
                Quaternion quat;
                if (Quaternion.TryParse(Parser.Rejoin(args, 0), out quat))
                {
                    rotation = quat;
                }
            }
            foreach (var found in PS)
            {
                Client.Objects.AttachObject(found.GetSimulator(), found.LocalID, attachmentPoint, rotation);
                AddSuccess("attaching " + found + " to " + attachmentPoint + " with rotation " + rotation);
            }
            return SuccessOrFailure();
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:34,代码来源:AttachCommand.cs

示例2: ExecuteRequest

 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     if (args.Length == 0)
     {
         WorldObjects.ResetSelectedObjects();
         return Success("ResetSelectedObjects");
     }
     string note = "";
     var autoDeselect = (args[0] == "re");
     if (autoDeselect)
     {
         note += "re";
         args = args.AdvanceArgs(1);
     }
     var deSelect = (args[0] == "de");
     if (deSelect)
     {
         note += "de";
         args = args.AdvanceArgs(1);
     }
     int used;
     List<SimObject> PS = WorldSystem.GetPrimitives(args, out used);
     if (IsEmpty(PS)) return Failure("Cannot find objects from " + args.str);
     List<uint> selectobjs = new List<uint>();
     var fp = PS[0].RegionHandle;
     foreach (var P in PS)
     {
         if (fp != P.RegionHandle)
         {
             SelectObjects(deSelect, fp, selectobjs, autoDeselect);
             fp = P.RegionHandle;
             selectobjs = new List<uint>();
         }
         selectobjs.Add(P.LocalID);
         uint pid = P.ParentID;
         if (pid != 0)
         {
             selectobjs.Add(pid);
         }
     }
     SelectObjects(deSelect, fp, selectobjs, autoDeselect);
     return Success("objects " + note + "selected " + PS.Count);
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:43,代码来源:SelectObjectCommand.cs

示例3: ExecuteRequest

 public override CmdResult ExecuteRequest(CmdRequest args)
 {
     if (args.Length < 2) return ShowUsage();
     SimTypeUsage use = SimTypeSystem.FindObjectUse(args[0]);
     if (use == null) return Failure("Unknown use: " + args[0]);
     args = args.AdvanceArgs(1);
     int argsUsed;
     SimObject O = WorldSystem.GetSimObjectS(args, out argsUsed);
     if (O == null) return Failure("Cant find simobject " + args.str);
     WriteLine("Doing " + use + " for " + O);
     WorldSystem.TheSimAvatar.Do(use, O);
     return Success("Did " + use + " for " + O);
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:13,代码来源:OpenSimsCommand.cs

示例4: ExecuteRequest

        public override CmdResult ExecuteRequest(CmdRequest args)
        {
            //opensim drew this line because of clients might be hardcoded to only support 255? or was this trying to copy linden?
            try
            {
                //Client.Objects.OnObjectProperties += callback;
                int argsUsed;
                Simulator CurSim = TryGetSim(args, out argsUsed) ?? Client.Network.CurrentSim;
                UUID groupID = UUID.Zero;
                Simulator CurrentSim = CurSim;
                Permissions AddPerms = new Permissions();
                Permissions SubPerms = new Permissions();
                bool doTaskInv = false;
                List<Primitive> TaskPrims = new List<Primitive>();
                List<uint> localIDs = new List<uint>();

                // Reset class-wide variables
                PermsSent = false;
                Objects.Clear();
                PermCount = 0;
                bool oneAtATime = false;

                if (args.Length < 3)
                    return ShowUsage();

                if (!UUIDTryParse(args, 0, out groupID, out argsUsed))
                    return ShowUsage();

                args.AdvanceArgs(argsUsed);
                List<SimObject> PS = WorldSystem.GetSingleArg(args, out argsUsed);
                if (IsEmpty(PS)) return Failure("Cannot find objects from " + args.str);

                PermissionWho who = 0;

                bool deed = false;
                for (int i = argsUsed; i < args.Length; i++)
                {
                    bool add = true;
                    bool setPerms = false;
                    string arg = args[i];
                    int whoint = (int) who;
                    PermissionMask Perms = PermsAdd[whoint];
                    if (arg.StartsWith("+"))
                    {
                        arg = arg.Substring(1);
                    }
                    else if (arg.StartsWith("-"))
                    {
                        arg = arg.Substring(1);
                        add = false;
                        Perms = PermsSub[whoint];
                    }

                    switch (arg.ToLower())
                    {
                            // change owner referall
                        case "who":
                            who = 0;
                            break;

                        case "o":
                            who |= PermissionWho.Owner;
                            break;

                        case "g":
                            who |= PermissionWho.Group;
                            break;

                        case "e":
                            who |= PermissionWho.Everyone;
                            break;

                        case "n":
                            who |= PermissionWho.NextOwner;
                            break;

                        case "a":
                            who = PermissionWho.All;
                            break;

                            // change perms for owner
                        case "copy":
                            Perms |= PermissionMask.Copy;
                            setPerms = true;
                            break;
                        case "mod":
                            Perms |= PermissionMask.Modify;
                            setPerms = true;
                            break;
                        case "xfer":
                            Perms |= PermissionMask.Transfer;
                            setPerms = true;
                            break;
                        case "all":
                            Perms |= PermissionMask.All;
                            setPerms = true;
                            break;
                        case "dmg":
                            Perms |= PermissionMask.Damage;
                            setPerms = true;
//.........这里部分代码省略.........
开发者ID:drzo,项目名称:opensim4opencog,代码行数:101,代码来源:DeedObjectsCommand.cs

示例5: ExecuteRequestTree

        public CmdResult ExecuteRequestTree(CmdRequest args)
        {
            BotClient Client = TheBotClient;
            bool showPLVersionOfHelp = false;
            if (args.Length == 1)
            {
                if (args[0] == "prolog")
                {
                    showPLVersionOfHelp = true;
                    args = args.AdvanceArgs(1);
                }
                if (showPLVersionOfHelp)
                {
                    foreach (var s in Client.AllCommands().Values)
                    {
                        WriteLine(s.ToPrologString() + ".");
                    }
                    return Success("showPLVersion(done).");
                }
            }
            if (args.Length > 0)
            {
                int found = 0;
                foreach (var s in Client.AllCommands().Values)
                {
                    if (s.Matches(args[0]))
                    {
                        found++;
                        WriteLine(s.Name + ": " + s.Description);
                    }
                }
                if (found == 0)
                {
                    return Failure("Command " + args[0] + " Does not exist. \"help\" to display all available commands.");
                }
                return Success("found=" + found);
            }
            StringBuilder result = new StringBuilder();
            var CommandTree = new SortedDictionary<string, List<CommandInfo>>();

            string cc;
            foreach (CommandInfo c in TheBotClient.AllCommands().Values)
            {
                if (c.Category.Equals(null))
                    cc = "Unknown";
                else
                    cc = c.Category;

                if (CommandTree.ContainsKey(cc))
                    CommandTree[cc].Add(c);
                else
                {
                    var l = new List<CommandInfo>();
                    l.Add(c);
                    CommandTree.Add(cc, l);
                }
            }

            foreach (var kvp in CommandTree)
            {
                result.AppendFormat(Environment.NewLine + "* {0} Related Commands:" + Environment.NewLine,
                                    kvp.Key.ToString());
                int colMax = 0;
                for (int i = 0; i < kvp.Value.Count; i++)
                {
                    if (colMax >= 120)
                    {
                        result.AppendLine();
                        colMax = 0;
                    }

                    result.AppendFormat(" {0,-15}", kvp.Value[i].Name);
                    colMax += 15;
                }
                result.AppendLine();
            }
            result.AppendLine(Environment.NewLine + "Help [command] for usage/information");

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


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