本文整理汇总了C#中Yupi.Game.Rooms.Room.SendMessage方法的典型用法代码示例。如果您正苦于以下问题:C# Room.SendMessage方法的具体用法?C# Room.SendMessage怎么用?C# Room.SendMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yupi.Game.Rooms.Room
的用法示例。
在下文中一共展示了Room.SendMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializeGroupInfo
/// <summary>
/// Serializes the theGroup information.
/// </summary>
/// <param name="group">The theGroup.</param>
/// <param name="response">The response.</param>
/// <param name="session">The session.</param>
/// <param name="room">The room.</param>
/// <param name="newWindow">if set to <c>true</c> [new window].</param>
internal void SerializeGroupInfo(Group group, ServerMessage response, GameClient session, Room room,
bool newWindow = false)
{
if (room == null || group == null)
return;
DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);
DateTime dateTime2 = dateTime.AddSeconds(group.CreateTime);
response.Init(LibraryParser.OutgoingRequest("GroupDataMessageComposer"));
response.AppendInteger(group.Id);
response.AppendBool(true);
response.AppendInteger(group.State);
response.AppendString(group.Name);
response.AppendString(group.Description);
response.AppendString(group.Badge);
response.AppendInteger(group.RoomId);
response.AppendString(Yupi.GetGame().GetRoomManager().GenerateRoomData(@group.RoomId) == null
? "No room found.."
: Yupi.GetGame().GetRoomManager().GenerateRoomData(group.RoomId).Name);
response.AppendInteger(@group.CreatorId == session.GetHabbo().Id
? 3
: (group.Requests.ContainsKey(session.GetHabbo().Id)
? 2
: (group.Members.ContainsKey(session.GetHabbo().Id) ? 1 : 0)));
response.AppendInteger(group.Members.Count);
response.AppendBool(session.GetHabbo().FavouriteGroup == group.Id);
response.AppendString($"{dateTime2.Day.ToString("00")}-{dateTime2.Month.ToString("00")}-{dateTime2.Year}");
response.AppendBool(group.CreatorId == session.GetHabbo().Id);
response.AppendBool(group.Admins.ContainsKey(session.GetHabbo().Id));
response.AppendString(Yupi.GetHabboById(@group.CreatorId) == null
? string.Empty
: Yupi.GetHabboById(group.CreatorId).UserName);
response.AppendBool(newWindow);
response.AppendBool(group.AdminOnlyDeco == 0u);
response.AppendInteger(group.Requests.Count);
response.AppendBool(group.Forum.Id != 0);
room.SendMessage(response);
}
示例2: BroadcastCurrentSongData
/// <summary>
/// Broadcasts the current song data.
/// </summary>
/// <param name="instance">The instance.</param>
internal void BroadcastCurrentSongData(Room instance)
{
if (CurrentSong != null)
{
instance.SendMessage(SoundMachineComposer.ComposePlayingComposer(CurrentSong.SongData.Id,
SongQueuePosition, 0));
return;
}
instance.SendMessage(SoundMachineComposer.ComposePlayingComposer(0u, 0, 0));
}