本文整理汇总了C#中Message.GetBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# Message.GetBoolean方法的具体用法?C# Message.GetBoolean怎么用?C# Message.GetBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Message
的用法示例。
在下文中一共展示了Message.GetBoolean方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: PotionReceiveEvent
public PotionReceiveEvent(Message message)
: base(message)
{
this.UserId = message.GetInteger(0);
this.Potion = (Potion)message.GetInteger(1);
this.Enabled = message.GetBoolean(2);
this.Timeout = message.GetInteger(3);
}
示例3: 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();
}
示例4: 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);
}
示例5: MoveReceiveEvent
/// <summary>
/// Initializes a new instance of the <see cref="MoveReceiveEvent" /> class.
/// </summary>
/// <param name="message">The message.</param>
public MoveReceiveEvent(Message message)
: base(message)
{
this.UserId = message.GetInteger(0);
this.UserPosX = message.GetInteger(1);
this.UserPosY = message.GetInteger(2);
this.SpeedX = message.GetDouble(3);
this.SpeedY = message.GetDouble(4);
this.ModifierX = message.GetDouble(5);
this.ModifierY = message.GetDouble(6);
this.Horizontal = message.GetDouble(7);
this.Vertical = message.GetDouble(8);
this.Coins = message.GetInteger(9);
this.SpaceDown = message.GetBoolean(10);
}
示例6: OnGod
/// <summary>
/// Called when a player toggles god mode.
/// </summary>
/// <param name="m">
/// The message.
/// </param>
public void OnGod(Message m)
{
// Extract data.
bool isGod = m.GetBoolean(1);
int id = m.GetInteger(0);
// Update relevant objects.
Player subject = Tools.GetPlayer(id, this._in.Source);
subject.IsGod = isGod;
// Fire the event.
var e = new PlayerEventArgs(subject, this._in.Source, m);
this._in.Source.Pull.GodMode.GodEvent(e);
}
示例7: NextSequenceReset
protected void NextSequenceReset(Message sequenceReset)
{
bool isGapFill = false;
if (sequenceReset.IsSetField(Fields.Tags.GapFillFlag))
isGapFill = sequenceReset.GetBoolean(Fields.Tags.GapFillFlag);
if (!Verify(sequenceReset, isGapFill, isGapFill))
return;
if (sequenceReset.IsSetField(Fields.Tags.NewSeqNo))
{
int newSeqNo = sequenceReset.GetInt(Fields.Tags.NewSeqNo);
this.Log.OnEvent("Received SequenceReset FROM: " + state_.GetNextTargetMsgSeqNum() + " TO: " + newSeqNo);
if (newSeqNo > state_.GetNextTargetMsgSeqNum())
{
state_.SetNextTargetMsgSeqNum(newSeqNo);
}
else
{
if (newSeqNo < state_.GetNextTargetMsgSeqNum())
GenerateReject(sequenceReset, FixValues.SessionRejectReason.VALUE_IS_INCORRECT);
}
}
}
示例8: OnInit
/// <summary>
/// Called when [initialize].
/// </summary>
/// <param name="m">
/// The m.
/// </param>
private void OnInit(Message m)
{
// Extract data
string owner = m.GetString(0),
name = m.GetString(1),
worldKey = Tools.Derot(m.GetString(5)),
botName = m.GetString(9);
int plays = m.GetInteger(2),
woots = m.GetInteger(3),
totalWoots = m.GetInteger(4),
botId = m.GetInteger(6),
width = m.GetInteger(12),
height = m.GetInteger(13);
double botX = m.GetDouble(7), botY = m.GetDouble(8), gravityMultiplier = m.GetDouble(15);
bool isTutorialRoom = m.GetBoolean(14),
potions = m.GetBoolean(16),
hasAccess = m.GetBoolean(10),
isOwner = m.GetBoolean(11);
// Update relevant objects
this._initMessage = m;
this.Bot.Name = botName;
this.Bot.Id = botId;
this.Bot.X = botX;
this.Bot.Y = botY;
this.Bot.HasAccess = hasAccess;
// Bot.IsOwner = isOwner;
this.Bot.PlayingIn = this.Source;
this.Source.OnlineBots.Add(this.Bot);
if (this.Source.IsInitialized)
{
// You don't need to get the room data multiple times. Save time by returning.
return;
}
// Update the room data.
this.Source.Name = name;
this.Source.Owner = Tools.GetPlayer(owner, this.Source);
this.Source.Plays = plays;
this.Source.Woots = woots;
this.Source.TotalWoots = totalWoots;
this.Source.RoomKey = worldKey;
this.Source.Height = height;
this.Source.Width = width;
RoomAccessor.Width = width;
RoomAccessor.Height = height;
this.Source.PotionsAllowed = potions;
this.Source.IsTutorialRoom = isTutorialRoom;
this.Source.GravityMultiplier = gravityMultiplier;
this.Source.IsInitialized = true;
// Execute the messages that came prematurely.
foreach (Message msg in this._prematureMessages)
{
this.OnMessage(this, msg);
}
this._prematureMessages.Clear();
// Begin loading blocks.
this.LoadBlocks();
this.Source.BlocksLoaded = true;
// Begin updating physics.
this._playerPhysicsThread = new Thread(this.UpdatePhysics);
this._playerPhysicsThread.Start();
// Fire the event.
var e = new RoomEventArgs(this.Source, m);
this.Source.Pull.InitEvent(e);
}
示例9: ReadConsole
private async Task ReadConsole(Message request, bool allowEval, CancellationToken ct) {
TaskUtilities.AssertIsOnBackgroundThread();
request.ExpectArguments(5);
var contexts = GetContexts(request);
var len = request.GetInt32(1, "len");
var addToHistory = request.GetBoolean(2, "addToHistory");
var retryReason = request.GetString(3, "retry_reason", allowNull: true);
var prompt = request.GetString(4, "prompt", allowNull: true);
string input;
try {
_canEval = allowEval;
input = await _callbacks.ReadConsole(contexts, prompt, len, addToHistory, _canEval, ct);
} finally {
_canEval = false;
}
ct.ThrowIfCancellationRequested();
input = input.Replace("\r\n", "\n");
await RespondAsync(request, ct, input);
}
示例10: GuardianModeReceiveEvent
/// <summary>
/// Initializes a new instance of the <see cref="GuardianModeReceiveEvent" /> class.
/// </summary>
/// <param name="message">The message.</param>
public GuardianModeReceiveEvent(Message message)
: base(message)
{
this.UserId = message.GetInteger(0);
this.IsGuardian = message.GetBoolean(1);
}
示例11: Move
public void Move(Message m)
{
if (this.C != null)
{
this.C.Send(
"m",
m.GetDouble(1),
m.GetDouble(2),
m.GetDouble(3),
m.GetDouble(4),
m.GetDouble(5),
m.GetDouble(6),
m.GetDouble(7),
m.GetDouble(8),
m.GetInt(9),
m.GetBoolean(10),
m.GetBoolean(11));
}
}
示例12: conn_OnMessage
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void conn_OnMessage(object sender, Message e)
{
if (!ListenForPackets) return;
if (OnPacket != null)
{
Packet packet = new Packet(e.Type);
for (uint n = 0; n < e.Count; n++)
{
packet.Add(e[n]);
}
OnPacket(this, packet);
}
switch (e.Type)
{
case "init":
WorldKey = Rot13(e.GetString(5));
if (OnWorldKey != null) OnWorldKey(this, WorldKey);
MapData = Init2Array(e);
if (OnInit != null)
{
User bot = new User(e.GetString(9), e.GetInt(6));
bot.Move.Position.X = (double)e.GetInt(7);
bot.Move.Position.Y = (double)e.GetInt(8);
Dictionary<int, int> potData = Init2Pot(e);
OnInit(this,
e.GetString(0),
e.GetString(1),
e.GetString(2),
e.GetInt(3),
e.GetInt(4),
WorldKey,
bot,
e.GetBoolean(10),
e.GetBoolean(11),
e.GetInt(12),
e.GetInt(13),
e.GetBoolean(14),
e.GetDouble(15),
e.GetBoolean(16),
MapData,
potData);
}
break;
case "info":
if (OnInfo != null) OnInfo(this, e.GetString(0), e.GetString(1));
break;
case "p":
if (OnPotion != null) OnPotion(this, e.GetInt(0), e.GetInt(1), e.GetBoolean(2));
break;
case "write":
if (OnWrite != null) OnWrite(this, e.GetString(0), e.GetString(1));
break;
case "upgrade":
if (OnUpgrade != null) OnUpgrade(this);
break;
case "m":
if (OnMove != null)
{
User.Motion motion = new User.Motion();
motion.Position.X = e.GetDouble(1);
motion.Position.Y = e.GetDouble(2);
motion.Velocity.X = e.GetDouble(3);
motion.Velocity.Y = e.GetDouble(4);
motion.Acceleration.X = e.GetDouble(5);
motion.Acceleration.Y = e.GetDouble(6);
motion.KeyDown.X = e.GetDouble(7);
motion.KeyDown.Y = e.GetDouble(8);
OnMove(this, e.GetInt(0), motion, e.GetInt(9), e.GetBoolean(10), e.GetBoolean(11));
}
break;
case "add":
if (OnAdd != null || ListUsers)
{
User u = new User(e.GetString(1), e.GetInt(0));
u.SmileyID = e.GetInt(2);
u.Move.Position.X = e.GetDouble(3);
u.Move.Position.Y = e.GetDouble(4);
u.isGod = e.GetBoolean(5);
u.isMod = e.GetBoolean(6);
u.isChat = e.GetBoolean(7);
u.Coins = e.GetInt(8);
u.isFriend = e.GetBoolean(9);
u.isPurple = e.GetBoolean(10);
u.Level = e.GetInt(11);
u.isClubMember = e.GetBoolean(12);
if (OnAdd != null) OnAdd(this, u);
if (ListUsers) Manager.UserJoined(u);
}
break;
case "c":
if (OnCoin != null) OnCoin(this, e.GetInt(0), e.GetInt(1));
break;
case "k":
if (OnCrown != null) OnCrown(this, e.GetInt(0));
break;
//.........这里部分代码省略.........