本文整理汇总了C#中ServerMessage类的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage类的具体用法?C# ServerMessage怎么用?C# ServerMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ServerMessage类属于命名空间,在下文中一共展示了ServerMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Compose
public static ServerMessage Compose(Session Session, Dictionary<int, CatalogPage> Pages)
{
ServerMessage Message = new ServerMessage(OpcodesOut.CATALOG_INDEX);
SerializePage(Message, Pages[-1], CalcTreeSize(Session, Pages, -1));
foreach (CatalogPage Page in Pages.Values)
{
if (Page.ParentId != -1 || (Page.RequiredRight.Length > 0 && !Session.HasRight(Page.RequiredRight)))
{
continue;
}
SerializePage(Message, Page, CalcTreeSize(Session, Pages, Page.Id));
foreach (CatalogPage ChildPage in Pages.Values)
{
if (ChildPage.ParentId != Page.Id || (ChildPage.RequiredRight.Length > 0 && !Session.HasRight(ChildPage.RequiredRight)))
{
continue;
}
SerializePage(Message, ChildPage, 0);
}
}
return Message;
}
示例2: Compose
public static ServerMessage Compose(uint ErrorId, uint ConversationId)
{
ServerMessage Message = new ServerMessage(OpcodesOut.MESSENGER_IM_ERROR);
Message.AppendUInt32(ErrorId);
Message.AppendUInt32(ConversationId);
return Message;
}
示例3: Compose
public static ServerMessage Compose(AvatarEffect Effect)
{
ServerMessage Message = new ServerMessage(OpcodesOut.USER_EFFECT_ADDED);
Message.AppendInt32(Effect.SpriteId);
Message.AppendInt32((int)Effect.Duration);
return Message;
}
示例4: Serialize
internal void Serialize(ref ServerMessage message)
{
foreach (ChatMessage chatMessage in listOfMessages)
{
chatMessage.Serialize(ref message);
}
}
示例5: Compose
public static ServerMessage Compose(uint ActorId, int CarryItemId)
{
ServerMessage Message = new ServerMessage(OpcodesOut.ROOM_USER_CARRY);
Message.AppendUInt32(ActorId);
Message.AppendInt32(CarryItemId); // GbIsIkyN
return Message;
}
示例6: Compose
public static ServerMessage Compose(uint SenderId, string Text)
{
ServerMessage Message = new ServerMessage(OpcodesOut.MESSENGER_IM_INVITE);
Message.AppendUInt32(SenderId);
Message.AppendStringWithBreak(Text);
return Message;
}
示例7: Compose
public static ServerMessage Compose(Session Session, ReadOnlyCollection<Achievement> Achievements)
{
ServerMessage Message = new ServerMessage(OpcodesOut.ACHIEVEMENTS_LIST);
Message.AppendInt32(Achievements.Count);
foreach (Achievement Achievement in Achievements)
{
UserAchievement UserData = Session.AchievementCache.GetAchievementData(Achievement.GroupName);
int TargetLevel = (UserData != null ? UserData.Level + 1 : 1);
int TotalLevels = Achievement.Levels.Count;
if (TargetLevel > TotalLevels)
{
TargetLevel = TotalLevels;
}
AchievementLevel TargetLevelData = Achievement.Levels[TargetLevel];
Message.AppendUInt32(Achievement.Id); // Unknown (ID?)
Message.AppendInt32(TargetLevel); // Target level
Message.AppendStringWithBreak(Achievement.GroupName + TargetLevel); // Target name/desc/badge
Message.AppendInt32(TargetLevelData.Requirement); // Progress req/target
Message.AppendInt32(TargetLevelData.PixelReward); // Pixel reward
Message.AppendInt32(TargetLevelData.PointsReward); // Unknown(??)
Message.AppendInt32(UserData != null ? UserData.Progress : 0); // Current progress
Message.AppendBoolean(UserData != null ? (UserData.Level >= TotalLevels) : false); // Set 100% completed(??)
Message.AppendStringWithBreak(Achievement.Category); // Category
Message.AppendInt32(TotalLevels); // Total amount of levels
}
return Message;
}
示例8: Compose
public static ServerMessage Compose(List<Achievement> Achievements)
{
ServerMessage Message = new ServerMessage(OpcodesOut.ACHIEVEMENT_DATA_LIST);
Message.AppendInt32(Achievements.Count);
foreach (Achievement Achievement in Achievements)
{
string DisplayName = Achievement.GroupName;
if (DisplayName.StartsWith("ACH_"))
{
DisplayName = DisplayName.Substring(4);
}
Message.AppendStringWithBreak(DisplayName);
Message.AppendInt32(Achievement.Levels.Count);
foreach (AchievementLevel Level in Achievement.Levels.Values)
{
Message.AppendInt32(Level.Number);
Message.AppendInt32(Level.Requirement);
}
}
return Message;
}
示例9: Compose
public static ServerMessage Compose(uint ItemId, bool CanGift)
{
ServerMessage Message = new ServerMessage(OpcodesOut.CATALOG_CAN_GIFT);
Message.AppendUInt32(ItemId);
Message.AppendBoolean(false/*CanGift*/);
return Message;
}
示例10: SerializeTopic
internal static ServerMessage SerializeTopic(HelpTopic Topic)
{
ServerMessage Top = new ServerMessage(520);
Top.AppendUInt(Topic.TopicId);
Top.AppendStringWithBreak(Topic.Body);
return Top;
}
示例11: Compose
public static ServerMessage Compose(RoomEvent Event)
{
ServerMessage Message = new ServerMessage(OpcodesOut.ROOM_EVENT_INFO);
if (Event == null)
{
Message.AppendStringWithBreak("-1");
}
else
{
Message.AppendStringWithBreak(Event.OwnerId.ToString());
Message.AppendStringWithBreak(CharacterResolverCache.GetNameFromUid(Event.OwnerId));
Message.AppendStringWithBreak(Event.RoomId.ToString());
Message.AppendInt32(Event.CategoryId);
Message.AppendStringWithBreak(Event.Name);
Message.AppendStringWithBreak(Event.Description);
Message.AppendStringWithBreak(UnixTimestamp.GetDateTimeFromUnixTimestamp(Event.TimestampStarted).ToShortTimeString());
List<string> Tags = Event.Tags;
Message.AppendInt32(Tags.Count);
foreach (string Tag in Tags)
{
Message.AppendStringWithBreak(Tag);
}
}
return Message;
}
示例12: SerializeSearchResults
internal static ServerMessage SerializeSearchResults(string Query)
{
DataTable Results = null;
using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
{
if (dbClient.dbType == Database_Manager.Database.DatabaseType.MySQL)
dbClient.setQuery("SELECT id,title FROM help_topics WHERE title LIKE @query OR body LIKE @query LIMIT 25");
else
dbClient.setQuery("SELECT TOP 25 id,title FROM help_topics WHERE title LIKE @query OR body LIKE @query");
dbClient.addParameter("query", Query + "%");
Results = dbClient.getTable();
}
// HII[KBCan I pay to be unbanned?
ServerMessage Search = new ServerMessage(521);
if (Results == null)
{
Search.AppendBoolean(false);
return Search;
}
Search.AppendInt32(Results.Rows.Count);
foreach (DataRow Row in Results.Rows)
{
Search.AppendUInt(Convert.ToUInt32(Row["id"]));
Search.AppendStringWithBreak((string)Row["title"]);
}
return Search;
}
示例13: Compose
public static ServerMessage Compose(uint RoomId)
{
ServerMessage Message = new ServerMessage(OpcodesOut.ROOM_UPDATED_NOTIFICATION_3);
Message.AppendUInt32(RoomId);
Message.AppendBoolean(true);
return Message;
}
示例14: Compose
public static ServerMessage Compose(int ShuttingDownInMinutes)
{
// com.sulake.habbo.communication.messages.incoming.availability.InfoHotelClosingMessageEvent;
ServerMessage Message = new ServerMessage(291);
Message.AppendInt32(ShuttingDownInMinutes);
return Message;
}
示例15: Compose
public static ServerMessage Compose(uint RoomId, uint UserId)
{
ServerMessage Message = new ServerMessage(OpcodesOut.ROOM_RIGHTS_REMOVED_CONFIRMATION);
Message.AppendUInt32(RoomId);
Message.AppendUInt32(UserId);
return Message;
}