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


C# IController.Write方法代码示例

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


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

示例1: Execute

        /// <summary>Executes the command.</summary>
        /// <param name="sender">Sender of the command.</param>
        /// <param name="bridge">The system to script bridge.</param>
        /// <param name="command">The full command requested.</param>
        public override void Execute(IController sender, ISystemToScriptBridge bridge, ICommand command)
        {
            string version = this.GetType().Assembly.GetName().Version.ToString();
            string name = new MudEngineAttributes().MudName;
            string output = string.Format("{0} is running version {1} of the WheelMUD Engine.", name, version);

            sender.Write(output);
        }
开发者ID:Hobbitron,项目名称:WheelMUD,代码行数:12,代码来源:Version.cs

示例2: Execute

        /// <summary>Executes the command.</summary>
        /// <param name="sender">Sender of the command.</param>
        /// <param name="bridge">The system to script bridge.</param>
        /// <param name="command">The full command requested.</param>
        public override void Execute(IController sender, ISystemToScriptBridge bridge, ICommand command)
        {
            string name = new MudEngineAttributes().MudName;
            string duration = CalculateDuration(bridge.ServerManager.StartTime);
            string output = string.Format("{0} has been running for {1}.", name, duration);

            sender.Write(output);
        }
开发者ID:Hobbitron,项目名称:WheelMUD,代码行数:12,代码来源:Uptime.cs

示例3: FillFrom

        public void FillFrom(IController sender, HoldsLiquidBehavior source)
        {
            // @@@ If this behavior's thing has no room left, abort.
            // sender.Write(string.Format("The {0} is full and no more can be added to it.", this.destinationContainerName));

            // Iterate through the source thing's Children to find the first Liquid thing.
            LiquidBehavior liquidBehavior = null;
            foreach (Thing thing in source.Parent.Children)
            {
                liquidBehavior = thing.Behaviors.FindFirst<LiquidBehavior>();
                if (liquidBehavior != null)
                {
                    break;
                }
            }

            if (liquidBehavior == null)
            {
                sender.Write("The source does not contain any liquids right now.");
                return;
            }

            // @@@ Maybe prevent the mixing of liquids or whatnot by default...
            // sender.Write("You cannot mix the two different types of liquids.");

            // @@@ Determine the maximum amount we can take from that liquid stack.

            // Move that liquid stack over into this liquid-holder.
            if (this.Parent.Add(liquidBehavior.Parent))
            {
                string message = string.Format(
                    "You filled {0} with {1} from {2}.",
                    this.Parent.Name,
                    liquidBehavior.Parent.Name,
                    source.Parent.Name);
                sender.Write(message);

                // @@@ If the source is now empty, sender.Write that the source is empty.
            }

            return;
        }
开发者ID:Hobbitron,项目名称:WheelMUD,代码行数:42,代码来源:HoldsLiquidBehavior.cs

示例4: Execute

        /// <summary>Executes the command.</summary>
        /// <param name="sender">Sender of the command.</param>
        /// <param name="bridge">The system to script bridge.</param>
        /// <param name="command">The full command requested.</param>
        public override void Execute(IController sender, ISystemToScriptBridge bridge, ICommand command)
        {
            ISession session = (ISession) sender;

            if (session.Connection.OutputBuffer.HasMoreData)
            {
                session.Connection.ProcessBuffer(BufferDirection.Forward);
            }
            else
            {
                sender.Write("There is no more data");
            }
        }
开发者ID:Hobbitron,项目名称:WheelMUD,代码行数:17,代码来源:Done.cs

示例5: RemoveFriend

        private void RemoveFriend(IController sender, string targetedFriendName)
        {
            string playerName = (from string f in this.playerBehavior.Friends
                                 where f.Equals(targetedFriendName, System.StringComparison.CurrentCultureIgnoreCase)
                                 select f).FirstOrDefault();

            if (string.IsNullOrEmpty(playerName))
            {
                sender.Write(string.Format("{0} is not on your friends list.", targetedFriendName));
                return;
            }

            this.playerBehavior.RemoveFriend(playerName);

            sender.Write(string.Format("{0} has been removed from your friends list.", this.player.Name));
        }
开发者ID:Hobbitron,项目名称:WheelMUD,代码行数:16,代码来源:Friends.cs

示例6: AddFriend

        private void AddFriend(IController sender, Thing targetFriend)
        {
            if (targetFriend == null)
            {
                sender.Write(string.Format("{0} doesn't appear to be online at the moment.", targetFriend.Name));
                return;
            }

            if (targetFriend == this.player)
            {
                sender.Write("You cannot add yourself as a friend.");
                return;
            }

            if (this.playerBehavior.Friends.Contains(targetFriend.Name))
            {
                sender.Write(string.Format("{0} is already on your friends list.", this.player.Name));
                return;
            }

            this.playerBehavior.AddFriend(this.player.Name);
            sender.Write(string.Format("You have added {0} to your friends list.", targetFriend.Name));
        }
开发者ID:Hobbitron,项目名称:WheelMUD,代码行数:23,代码来源:Friends.cs


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