本文整理汇总了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);
}
示例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);
}
示例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;
}
示例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");
}
}
示例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));
}
示例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));
}