本文整理汇总了C#中Snowlight.Game.Sessions.Session.SendInfoUpdate方法的典型用法代码示例。如果您正苦于以下问题:C# Session.SendInfoUpdate方法的具体用法?C# Session.SendInfoUpdate怎么用?C# Session.SendInfoUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Snowlight.Game.Sessions.Session
的用法示例。
在下文中一共展示了Session.SendInfoUpdate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetMotto
private static void SetMotto(Session Session, ClientMessage Message)
{
string NewMotto = UserInputFilter.FilterString(Message.PopString().Trim());
if (NewMotto.Length > 38)
{
NewMotto = NewMotto.Substring(0, 38);
}
if (NewMotto == Session.CharacterInfo.Motto)
{
return;
}
using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
{
Session.CharacterInfo.UpdateMotto(MySqlClient, NewMotto);
AchievementManager.ProgressUserAchievement(MySqlClient, Session, "ACH_Motto", 1);
}
QuestManager.ProgressUserQuest(Session, QuestType.PROFILE_CHANGE_MOTTO);
Session.SendInfoUpdate();
}
示例2: ProgressUserAchievement
public static bool ProgressUserAchievement(SqlDatabaseClient MySqlClient, Session Session, string AchievementGroup, int ProgressAmount)
{
if (!mAchievements.ContainsKey(AchievementGroup))
{
return false;
}
Achievement AchievementData = null;
lock (mSyncRoot)
{
AchievementData = mAchievements[AchievementGroup];
}
UserAchievement UserData = Session.AchievementCache.GetAchievementData(AchievementGroup);
int TotalLevels = AchievementData.Levels.Count;
if (UserData != null && UserData.Level == TotalLevels)
{
return false; // done, no more.
}
int TargetLevel = (UserData != null ? UserData.Level + 1 : 1);
if (TargetLevel > TotalLevels)
{
TargetLevel = TotalLevels;
}
AchievementLevel TargetLevelData = AchievementData.Levels[TargetLevel];
int NewProgress = (UserData != null ? UserData.Progress + ProgressAmount : ProgressAmount);
int NewLevel = (UserData != null ? UserData.Level : 0);
int NewTarget = NewLevel + 1;
if (NewTarget > TotalLevels)
{
NewTarget = TotalLevels;
}
if (NewProgress >= TargetLevelData.Requirement)
{
NewLevel++;
NewTarget++;
int ProgressRemainder = NewProgress - TargetLevelData.Requirement;
NewProgress = 0;
Badge BadgeData = RightsManager.GetBadgeByCode(AchievementGroup + TargetLevel);
if (NewTarget > TotalLevels)
{
NewTarget = TotalLevels;
}
Session.BadgeCache.UpdateAchievementBadge(MySqlClient, AchievementGroup, BadgeData);
Session.NewItemsCache.MarkNewItem(MySqlClient, 4, BadgeData.Id);
Session.SendData(InventoryNewItemsComposer.Compose(4, BadgeData.Id));
Session.CharacterInfo.UpdateActivityPointsBalance(MySqlClient, TargetLevelData.PixelReward);
Session.SendData(ActivityPointsBalanceComposer.Compose(Session.CharacterInfo.ActivityPointsBalance,
TargetLevelData.PixelReward));
Session.SendData(AchievementUnlockedComposer.Compose(AchievementData, TargetLevel, TargetLevelData.PointsReward,
TargetLevelData.PixelReward));
Session.AchievementCache.AddOrUpdateData(MySqlClient, AchievementGroup, NewLevel, NewProgress);
Session.CharacterInfo.UpdateScore(MySqlClient, TargetLevelData.PointsReward);
Session.SendData(AchievementScoreUpdateComposer.Compose(Session.CharacterInfo.Score));
AchievementLevel NewLevelData = AchievementData.Levels[NewTarget];
Session.SendData(AchievementProgressComposer.Compose(AchievementData, NewTarget, NewLevelData,
TotalLevels, Session.AchievementCache.GetAchievementData(AchievementGroup)));
Session.SendInfoUpdate();
Session.MessengerFriendCache.BroadcastToFriends(MessengerFriendEventComposer.Compose(Session.CharacterId,
MessengerFriendEventType.AchievementUnlocked, BadgeData.Code));
RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);
if (Instance != null)
{
Instance.BroadcastMessage(RoomUserBadgesComposer.Compose(Session.CharacterId,
Session.BadgeCache.EquippedBadges));
}
if (ProgressRemainder > 0)
{
ProgressUserAchievement(MySqlClient, Session, AchievementGroup, ProgressRemainder);
}
return true;
}
Session.AchievementCache.AddOrUpdateData(MySqlClient, AchievementGroup, NewLevel, NewProgress);
Session.SendData(AchievementProgressComposer.Compose(AchievementData, TargetLevel, TargetLevelData,
TotalLevels, Session.AchievementCache.GetAchievementData(AchievementGroup)));
//.........这里部分代码省略.........
示例3: SetFigure
private static void SetFigure(Session Session, ClientMessage Message)
{
// todo: verify data(!!!!)
string NewGender = Message.PopString().ToLower();
string NewFigure = UserInputFilter.FilterString(Message.PopString());
if (NewGender != "m" && NewGender != "f")
{
NewGender = "m";
}
if (NewFigure.Length == 0 || (NewFigure == Session.CharacterInfo.Figure))
{
return;
}
using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
{
Session.CharacterInfo.UpdateFigure(MySqlClient, NewGender, NewFigure);
AchievementManager.ProgressUserAchievement(MySqlClient, Session, "ACH_AvatarLooks", 1);
}
QuestManager.ProgressUserQuest(Session, QuestType.PROFILE_CHANGE_LOOK);
Session.SendInfoUpdate();
}