本文整理汇总了C#中ClientMsg类的典型用法代码示例。如果您正苦于以下问题:C# ClientMsg类的具体用法?C# ClientMsg怎么用?C# ClientMsg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClientMsg类属于命名空间,在下文中一共展示了ClientMsg类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeclineClanInvite
internal void DeclineClanInvite(ulong clanID)
{
var request = new ClientMsg<CMsgClientClanInviteAction>((int) EMsg.ClientAcknowledgeClanInvite);
request.Body.GroupID = clanID;
request.Body.AcceptInvite = false;
Client.Send(request);
}
示例2: HandleNumberOfPlayersResponse
void HandleNumberOfPlayersResponse( IPacketMsg packetMsg )
{
var msg = new ClientMsg<MsgClientGetNumberOfCurrentPlayersResponse>( packetMsg );
var callback = new NumberOfPlayersCallback( msg.Header.TargetJobID, msg.Body );
Client.PostCallback( callback );
}
示例3: PayloadReaderReadsNullTermString
public void PayloadReaderReadsNullTermString()
{
var msg = new ClientMsg<MsgClientChatEnter>( BuildStructMsg() );
string chatName = msg.ReadNullTermString();
Assert.Equal( chatName, "Saxton Hell" );
}
示例4: GetNumberOfCurrentPlayers
/// <summary>
/// Retrieves the number of current players for a given <see cref="GameID"/>.
/// Results are returned in a <see cref="NumberOfPlayersCallback"/>.
/// </summary>
/// <param name="gameId">The GameID to request the number of players for.</param>
/// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="NumberOfPlayersCallback"/>.</returns>
public AsyncJob<NumberOfPlayersCallback> GetNumberOfCurrentPlayers( GameID gameId )
{
var msg = new ClientMsg<MsgClientGetNumberOfCurrentPlayers>();
msg.SourceJobID = Client.GetNextJobID();
msg.Body.GameID = gameId;
Client.Send( msg );
return new AsyncJob<NumberOfPlayersCallback>( this.Client, msg.SourceJobID );
}
示例5: GetNumberOfCurrentPlayers
/// <summary>
/// Retrieves the number of current players for a given <see cref="GameID"/>.
/// Results are returned in a <see cref="NumberOfPlayersCallback"/>.
/// </summary>
/// <param name="gameId">The GameID to request the number of players for.</param>
/// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="NumberOfPlayersCallback"/>.</returns>
public JobID GetNumberOfCurrentPlayers( GameID gameId )
{
var msg = new ClientMsg<MsgClientGetNumberOfCurrentPlayers>();
msg.SourceJobID = Client.GetNextJobID();
msg.Body.GameID = gameId;
Client.Send( msg );
return msg.SourceJobID;
}
示例6: HandleNumberOfPlayersResponse
void HandleNumberOfPlayersResponse( IPacketMsg packetMsg )
{
var msg = new ClientMsg<MsgClientGetNumberOfCurrentPlayersResponse>( packetMsg );
#if STATIC_CALLBACKS
var innerCallback = new NumberOfPlayersCallback( Client, msg.Body );
var callback = new SteamClient.JobCallback<NumberOfPlayersCallback>( Client, msg.Header.TargetJobID, innerCallback );
SteamClient.PostCallback( callback );
#else
var innerCallback = new NumberOfPlayersCallback( msg.Body );
var callback = new SteamClient.JobCallback<NumberOfPlayersCallback>( msg.Header.TargetJobID, innerCallback );
Client.PostCallback( callback );
#endif
}
示例7: Respond
private bool Respond(SteamID roomID, string message)
{
string[] query = StripCommand(message, Options.ChatCommand.Command);
if(query != null)
{
var msg = new ClientMsg<MsgClientChatAction>();
msg.Body.SteamIdChat = SteamHelper.ToChatID(roomID);
msg.Body.SteamIdUserToActOn = SteamHelper.ToChatID(roomID);
msg.Body.ChatAction = EChatAction.LockChat;
Bot.steamClient.Send(msg);
return true;
}
return false;
}
示例8: PayloadReaderDoesNotOverflowPastNullTermString
public void PayloadReaderDoesNotOverflowPastNullTermString()
{
var msg = new ClientMsg<MsgClientChatEnter>( BuildStructMsg() );
string chatName = msg.ReadNullTermString();
Assert.Equal( chatName, "Saxton Hell" );
byte nextByte = msg.ReadByte();
char mByte = (char)msg.ReadByte();
// next byte should be a null
Assert.Equal( nextByte, 0 );
// and the one after should be the beginning of a MessageObject
Assert.Equal( mByte, 'M' );
}
示例9: BanChatMember
/// <summary>
/// Bans the specified chat member from the given chat room.
/// </summary>
/// <param name="steamIdChat">The SteamID of chat room to ban the member from.</param>
/// <param name="steamIdMember">The SteamID of the member to ban from the chat.</param>
public void BanChatMember( SteamID steamIdChat, SteamID steamIdMember )
{
SteamID chatId = steamIdChat.ConvertToUInt64(); // copy the steamid so we don't modify it
var banMember = new ClientMsg<MsgClientChatAction>();
if ( chatId.IsClanAccount )
{
// this steamid is incorrect, so we'll fix it up
chatId.AccountInstance = ( uint )SteamID.ChatInstanceFlags.Clan;
chatId.AccountType = EAccountType.Chat;
}
banMember.Body.SteamIdChat = chatId;
banMember.Body.SteamIdUserToActOn = steamIdMember;
banMember.Body.ChatAction = EChatAction.Ban;
this.Client.Send( banMember );
}
示例10: IgnoreFriend
/// <summary>
/// Ignores or unignores a friend on Steam.
/// Results are returned in a <see cref="IgnoreFriendCallback"/>.
/// </summary>
/// <param name="steamId">The SteamID of the friend to ignore or unignore.</param>
/// <param name="setIgnore">if set to <c>true</c>, the friend will be ignored; otherwise, they will be unignored.</param>
/// <returns>The Job ID of the request. This can be used to find the appropriate <see cref="IgnoreFriendCallback"/>.</returns>
public JobID IgnoreFriend( SteamID steamId, bool setIgnore = true )
{
var ignore = new ClientMsg<MsgClientSetIgnoreFriend>();
ignore.SourceJobID = Client.GetNextJobID();
ignore.Body.MySteamId = Client.SteamID;
ignore.Body.Ignore = ( byte )( setIgnore ? 1 : 0 );
ignore.Body.SteamIdFriend = steamId;
this.Client.Send( ignore );
return ignore.SourceJobID;
}
示例11: HandleChatEnter
void HandleChatEnter( IPacketMsg packetMsg )
{
var chatEnter = new ClientMsg<MsgClientChatEnter>( packetMsg );
byte[] payload = chatEnter.Payload.ToArray();
var callback = new ChatEnterCallback( chatEnter.Body, payload );
this.Client.PostCallback( callback );
}
示例12: LeaveChat
/// <summary>
/// Attempts to leave a chat room.
/// </summary>
/// <param name="steamId">The SteamID of the chat room.</param>
public void LeaveChat( SteamID steamId )
{
SteamID chatId = steamId.ConvertToUInt64(); // copy the steamid so we don't modify it
var leaveChat = new ClientMsg<MsgClientChatMemberInfo>();
if ( chatId.IsClanAccount )
{
// this steamid is incorrect, so we'll fix it up
chatId.AccountInstance = ( uint )SteamID.ChatInstanceFlags.Clan;
chatId.AccountType = EAccountType.Chat;
}
leaveChat.Body.SteamIdChat = chatId;
leaveChat.Body.Type = EChatInfoType.StateChange;
leaveChat.Write( Client.SteamID.ConvertToUInt64() ); // ChatterActedOn
leaveChat.Write( ( uint )EChatMemberStateChange.Left ); // StateChange
leaveChat.Write( Client.SteamID.ConvertToUInt64() ); // ChatterActedBy
Client.Send( leaveChat );
}
示例13: SendChatRoomMessage
/// <summary>
/// Sends a message to a chat room.
/// </summary>
/// <param name="steamIdChat">The SteamID of the chat room.</param>
/// <param name="type">The message type.</param>
/// <param name="message">The message.</param>
public void SendChatRoomMessage( SteamID steamIdChat, EChatEntryType type, string message )
{
SteamID chatId = steamIdChat.ConvertToUInt64(); // copy the steamid so we don't modify it
if ( chatId.IsClanAccount )
{
// this steamid is incorrect, so we'll fix it up
chatId.AccountInstance = ( uint )SteamID.ChatInstanceFlags.Clan;
chatId.AccountType = EAccountType.Chat;
}
var chatMsg = new ClientMsg<MsgClientChatMsg>();
chatMsg.Body.ChatMsgType = type;
chatMsg.Body.SteamIdChatRoom = chatId;
chatMsg.Body.SteamIdChatter = Client.SteamID;
chatMsg.WriteNullTermString( message, Encoding.UTF8 );
this.Client.Send( chatMsg );
}
示例14: DeclineGroupInvite
/// <summary>
/// Declines the invite to a Steam Group
/// </summary>
/// <param name="group">SteamID of the group to decline the invite from.</param>
private void DeclineGroupInvite(SteamID group)
{
var declineMsg = new ClientMsg<CMsgGroupInviteAction>((int)EMsg.ClientAcknowledgeClanInvite);
declineMsg.Body.GroupID = group.ConvertToUInt64();
declineMsg.Body.AcceptInvite = false;
SteamClient.Send(declineMsg);
Log.Info("Declined group invite to {0}.", group.ToString());
}
示例15: DeclineGroupInvite
/// <summary>
/// Declines the invite to a Steam Group
/// </summary>
/// <param name="group">SteamID of the group to decline the invite from.</param>
private void DeclineGroupInvite(SteamID group)
{
var DeclineInvite = new ClientMsg<CMsgGroupInviteAction>((int)EMsg.ClientAcknowledgeClanInvite);
DeclineInvite.Body.GroupID = group.ConvertToUInt64();
DeclineInvite.Body.AcceptInvite = false;
this.SteamClient.Send(DeclineInvite);
}