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


C# ICommand.GiveFeedback方法代码示例

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


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

示例1: Create

        public static IAction Create(ICommand command)
        {
            if (command.Arguments.Count == 0)
            {
                throw new ArgumentException("At least 1 argument is required");
            }

            // TODO : Support passing in the final heading
            CoordsObject coords;
            if (command.Arguments.Count == 1)
            {
                // goto is being used to go to an object.  Locate the object
                var woId = int.Parse(command.Arguments[0]);
                var woObj = woId.ToWorldObject();

                if (woObj == null)
                {
                    command.GiveFeedback(FeedbackType.Ignored, "Could not locate object : {0}", woId);
                    throw new DisplayToUserException(string.Format("Could not locate object : {0}", woId), command);
                }

                coords = woObj.Coordinates();
                //x = woCoords.NorthSouth;
                //y = woCoords.EastWest;
            }
            else if (command.Arguments.Count == 2)
            {
                double ns = double.Parse(command.Arguments[0]);
                double ew = double.Parse(command.Arguments[1]);
                coords = new CoordsObject(ns, ew);
            }
            else
            {
                // Note : In the future maybe I support more complex goto abilities.
                throw new NotImplementedException("Support for more complicated goto operations has not been implemented");
            }

            return Create(command, coords);
        }
开发者ID:mrvoorhe,项目名称:redox-extensions,代码行数:39,代码来源:GoTo.cs

示例2: HandleCommand


//.........这里部分代码省略.........
                    break;

                #endregion

                #region Give

                case "give":
                    Actions.Dispatched.GiveItems.Create(command).Enqueue();
                    break;

                #endregion

                #region List

                case "list":
                    Actions.Dispatched.ListItems.Create(command).Enqueue();
                    break;

                #endregion

                #region Cram

                case "cram":
                    Actions.Dispatched.CramItems.Create(command).Enqueue();
                    break;

                #endregion

                #region Jumping

                case "hop":
                    if(!SourceIsWithinJumpRange(command))
                    {
                        command.GiveFeedback(FeedbackType.Ignored, "You are too far away");
                        return;
                    }

                    Actions.Dispatched.Jump.CreateHop(command).Enqueue();
                    break;
                case "shifthop":
                case "shop":
                    if (!SourceIsWithinJumpRange(command))
                    {
                        command.GiveFeedback(FeedbackType.Ignored, "You are too far away");
                        return;
                    }

                    Actions.Dispatched.Jump.CreateShiftHop(command).Enqueue();
                    break;
                case "hopfull":
                case "hopf":
                    if (!SourceIsWithinJumpRange(command))
                    {
                        command.GiveFeedback(FeedbackType.Ignored, "You are too far away");
                        return;
                    }

                    Actions.Dispatched.Jump.CreateHopFull(command).Enqueue();
                    break;
                case "shifthopfull":
                case "shopf":
                    if (!SourceIsWithinJumpRange(command))
                    {
                        command.GiveFeedback(FeedbackType.Ignored, "You are too far away");
                        return;
                    }
开发者ID:mrvoorhe,项目名称:redox-extensions,代码行数:67,代码来源:ForeignHandler.cs


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