本文整理汇总了C#中Message.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# Message.GetString方法的具体用法?C# Message.GetString怎么用?C# Message.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message.GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateMetaReceiveEvent
/// <summary>
/// Initializes a new instance of the <see cref="ReceiveEvent" /> class.
/// </summary>
/// <param name="message">The message.</param>
public UpdateMetaReceiveEvent(Message message)
: base(message)
{
this.OwnerUsername = message.GetString(0);
this.WorldName = message.GetString(1);
this.Plays = message.GetInteger(2);
this.CurrentWoots = message.GetInteger(3);
this.TotalWoots = message.GetInteger(4);
}
示例2: LabelPlaceReceiveEvent
public LabelPlaceReceiveEvent(Message message)
: base(message)
{
this.PosX = message.GetInteger(0);
this.PosY = message.GetInteger(1);
this.Block = (LabelBlock)message.GetInteger(2);
this.Text = message.GetString(3);
this.TextColor = message.GetString(4);
}
示例3: create_figure
private void create_figure(Player player, Message message)
{
try {
string position = message.GetString(0);
string figure = message.GetString(1);
player.GameModel.CreateFigure(position, figure);
Broadcast("Create figure", player.ConnectUserId, position, figure);
}
catch (Exception e) {
Log("Create figure message processing failed.", e);
player.Send("Denied", "Incorrect message format.");
}
}
示例4: OnAutotext
/// <summary>
/// Called when someone says a message using the auto text function.
/// </summary>
/// <param name="m">The m.</param>
public void OnAutotext(Message m)
{
// Extract data.
int id = m.GetInteger(0);
string message = m.GetString(1);
var autoTextConversions = new Dictionary<int, string>
{
{ 0, "Left." },
{ 1, "Hi." },
{ 2, "Goodbye." },
{ 3, "Help me!" },
{ 4, "Thank you." },
{ 5, "Follow me." },
{ 6, "Stop!" },
{ 7, "Yes." },
{ 8, "No." },
{ 9, "Right." }
};
// Update relevant objects.
Player subject = Tools.GetPlayer(id, this._in.Source);
this._in.Source.ChatLog.Add(new KeyValuePair<string, Player>(message, subject));
// Fire the event.
var e = new ChatEventArgs(subject, m, this._in.Source, message);
this._in.Source.Pull.Autotext.AutotextEvent(e);
}
示例5: SayReceiveEvent
/// <summary>
/// Initializes a new instance of the <see cref="ReceiveEvent" /> class.
/// </summary>
/// <param name="message">The message.</param>
public SayReceiveEvent(Message message)
: base(message)
{
this.UserId = message.GetInteger(0);
this.Text = message.GetString(1);
this.IsMyFriend = message.GetBoolean(2);
}
示例6: handleGameMessage
/**
* Handles game-specific messages (messages which are sent only during the game)
*/
public void handleGameMessage(Player player, Message msg)
{
switch (msg.Type)
{
case MessageTypes.TRY_USE:
tryUseSpell(msg.GetInt(0), player);
break;
case MessageTypes.TICK:
player.onTick(msg.GetDouble(0), msg.GetString(1), msg.GetString(2));
//update sever duplication model
break;
default:
handleSpecialGameMessage(msg);
break;
}
}
示例7: SignPlaceReceiveEvent
/// <summary>
/// Initializes a new instance of the <see cref="SignPlaceReceiveEvent" /> class.
/// </summary>
/// <param name="message">The message.</param>
public SignPlaceReceiveEvent(Message message)
: base(message)
{
this.PosX = message.GetInteger(0);
this.PosY = message.GetInteger(1);
this.Block = (SignBlock)message.GetInteger(2);
this.Text = message.GetString(3);
}
示例8: WorldPortalPlaceReceiveEvent
/// <summary>
/// Initializes a new instance of the <see cref="ReceiveEvent" /> class.
/// </summary>
/// <param name="message">The message.</param>
public WorldPortalPlaceReceiveEvent(Message message)
: base(message)
{
this.PosX = message.GetInteger(0);
this.PosY = message.GetInteger(1);
this.Block = (WorldPortalBlock)message.GetInteger(2);
this.WorldPortalTarget = message.GetString(3);
}
示例9: OnUpdateMeta
/// <summary>
/// Called when the room metadata changes (such as title, woots or plays).
/// </summary>
/// <param name="m">
/// The message.
/// </param>
public void OnUpdateMeta(Message m)
{
// Extract data.
string ownerName = m.GetString(0), roomName = m.GetString(1);
int plays = m.GetInteger(2), woots = m.GetInteger(3), totalWoots = m.GetInteger(4);
// Update relevant objects.
this._in.Source.Owner.Name = ownerName;
this._in.Source.Name = roomName;
this._in.Source.Plays = plays;
this._in.Source.Woots = woots;
this._in.Source.TotalWoots = totalWoots;
// Fire the event.
var e = new RoomEventArgs(this._in.Source, m);
this._in.Source.Pull.Meta.UpdateMetaEvent(e);
}
示例10: AllowPotionsReceiveEvent
/// <summary>
/// Initializes a new instance of the <see cref="AllowPotionsReceiveEvent" /> class.
/// </summary>
/// <param name="message">The message.</param>
public AllowPotionsReceiveEvent(Message message)
: base(message)
{
this.Allowed = message.GetBoolean(0);
var potsList = new List<Potion>();
for (uint i = 1; i <= message.Count - 1; i += 1)
{
potsList.Add((Potion)Int32.Parse(message.GetString(i)));
}
this.DisabledPotions = potsList.ToArray();
}
示例11: onUnitCreate
public void onUnitCreate(Player player, Message message) {
int entityID = ++entityIndex;
int ownerID = player.Id;
String type = message.GetString(0);
double x = message.GetDouble(1);
double y = message.GetDouble(2);
Console.WriteLine("[ENGINE] " + player + ": create Unit - id=" + entityID + ", owner=" + ownerID + ", type=" + type + ", pos=" + x + "," + y);
room.Broadcast(MessageTypes.SV_UNIT_CREATE, entityID, ownerID, type, x, y);
}
示例12: OnSayOld
/// <summary>
/// Called when premature messages are given to the client.
/// </summary>
/// <param name="m">The message.</param>
public void OnSayOld(Message m)
{
// Extract data.
string message = m.GetString(1);
// Update relevant objects.
_in.Source.ChatLog.Add(new KeyValuePair<string, Player>(message, null));
// Fire the event.
var e = new ChatEventArgs(null, m, _in.Source, message);
_in.Source.Pull.ChatOld.SayOldEvent(e);
}
示例13: InitReceiveEvent
/// <summary>
/// Initializes a new instance of the <see cref="InitReceiveEvent" /> class.
/// </summary>
/// <param name="message">The EE message.</param>
public InitReceiveEvent(Message message)
: base(message)
{
this.OwnerUsername = message.GetString(0);
this.WorldName = message.GetString(1);
this.Plays = message.GetInteger(2);
this.CurrentWoots = message.GetInteger(3);
this.TotalWoots = message.GetInteger(4);
this.Encryption = message.GetString(5);
this.UserId = message.GetInteger(6);
this.Face = (Smiley)message.GetInteger(7);
// Aura
this.SpawnX = message.GetInteger(9);
this.SpawnY = message.GetInteger(10);
this.ChatColor = message.GetUInt(11);
this.Username = message.GetString(12);
this.CanEdit = message.GetBoolean(13);
this.IsOwner = message.GetBoolean(14);
this.RoomWidth = message.GetInteger(15);
this.RoomHeight = message.GetInteger(16);
this.IsTutorialRoom = message.GetBoolean(17);
this.Gravity = message.GetDouble(18);
}
示例14: AddReceiveEvent
/// <summary>
/// Initializes a new instance of the <see cref="AddReceiveEvent" /> class.
/// </summary>
/// <param name="message">The EE message.</param>
public AddReceiveEvent(Message message)
: base(message)
{
this.UserId = message.GetInteger(0);
this.Username = message.GetString(1);
this.Face = (Smiley)message.GetInteger(2);
this.UserPosX = message.GetInteger(3);
this.UserPosY = message.GetInteger(4);
this.IsGod = message.GetBoolean(5);
this.IsMod = message.GetBoolean(6);
this.HasChat = message.GetBoolean(7);
this.Coins = message.GetInteger(8);
this.BlueCoins = message.GetInteger(9);
this.IsMyFriend = message.GetBoolean(10);
this.IsClubMember = message.GetBoolean(11);
this.IsGuardian = message.GetBoolean(12);
}
示例15: challenge_player
private void challenge_player(Player player, Message message)
{
try {
if (player.IsPlaying) {
player.Send("Denied", "You are already playing.");
}
Player target = FindPlayerByName(message.GetString(0));
if (target.IsPlaying) {
player.Send("Denied", "Target is already playing.");
}
player.ChallengePlayer(target);
}
catch (Exception e) {
Log("Challenge player message processing failed.", e);
player.Send("Denied", "Incorrect message format.");
}
}