本文整理汇总了C#中RoomUser.?.GetClient方法的典型用法代码示例。如果您正苦于以下问题:C# RoomUser.?.GetClient方法的具体用法?C# RoomUser.?.GetClient怎么用?C# RoomUser.?.GetClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RoomUser
的用法示例。
在下文中一共展示了RoomUser.?.GetClient方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Teleport
private bool Teleport(RoomUser user)
{
if (!Items.Any())
return true;
if (user?.GetClient() == null || user.GetClient().GetHabbo() == null)
return true;
Random rnd = new Random();
Items = (from x in Items orderby rnd.Next() select x).ToList();
RoomItem roomItem = null;
foreach (
RoomItem current in
Items.Where(
current => current != null && Room.GetRoomItemHandler().FloorItems.ContainsKey(current.Id)))
roomItem = current;
if (roomItem == null)
{
user.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ActivateCustomEffect(0);
return false;
}
Room.GetGameMap().TeleportToItem(user, roomItem);
Room.GetRoomUserManager().OnUserUpdateStatus();
user.GetClient().GetHabbo().GetAvatarEffectsInventoryComponent().ActivateCustomEffect(0);
return true;
}
示例2: OnUserAdd
/// <summary>
/// Handles the <see cref="E:UserAdd" /> event.
/// </summary>
/// <param name="user"></param>
private void OnUserAdd(RoomUser user)
{
try
{
if (user?.GetClient() == null || user.GetClient().GetHabbo() == null)
return;
GameClient client = user.GetClient();
if (client?.GetHabbo() == null || _userRoom == null)
return;
if (!user.IsSpectator)
{
DynamicRoomModel model = _userRoom.GetGameMap().Model;
if (model == null) return;
user.SetPos(model.DoorX, model.DoorY, model.DoorZ);
user.SetRot(model.DoorOrientation, false);
user.AddStatus(_userRoom.CheckRights(client, true) ? "flatctrl 4" : "flatctrl 1", string.Empty);
user.CurrentItemEffect = ItemEffectType.None;
if (!user.IsBot && client.GetHabbo().IsTeleporting)
{
client.GetHabbo().IsTeleporting = false;
client.GetHabbo().TeleportingRoomId = 0;
RoomItem item = _userRoom.GetRoomItemHandler().GetItem(client.GetHabbo().TeleporterId);
if (item != null)
{
item.ExtraData = "2";
item.UpdateState(false, true);
user.SetPos(item.X, item.Y, item.Z);
user.SetRot(item.Rot, false);
item.InteractingUser2 = client.GetHabbo().Id;
item.ExtraData = "0";
item.UpdateState(false, true);
}
}
if (!user.IsBot && client.GetHabbo().IsHopping)
{
client.GetHabbo().IsHopping = false;
client.GetHabbo().HopperId = 0;
RoomItem item2 = _userRoom.GetRoomItemHandler().GetItem(client.GetHabbo().HopperId);
if (item2 != null)
{
item2.ExtraData = "1";
item2.UpdateState(false, true);
user.SetPos(item2.X, item2.Y, item2.Z);
user.SetRot(item2.Rot, false);
user.AllowOverride = false;
item2.InteractingUser2 = client.GetHabbo().Id;
item2.ExtraData = "2";
item2.UpdateState(false, true);
}
}
if (!user.IsSpectator)
{
ServerMessage serverMessage =
new ServerMessage(LibraryParser.OutgoingRequest("SetRoomUserMessageComposer"));
serverMessage.AppendInteger(1);
user.Serialize(serverMessage, _userRoom.GetGameMap().GotPublicPool);
_userRoom.SendMessage(serverMessage);
}
if (!user.IsBot)
{
ServerMessage serverMessage2 = new ServerMessage();
serverMessage2.Init(LibraryParser.OutgoingRequest("UpdateUserDataMessageComposer"));
serverMessage2.AppendInteger(user.VirtualId);
serverMessage2.AppendString(client.GetHabbo().Look);
serverMessage2.AppendString(client.GetHabbo().Gender.ToLower());
serverMessage2.AppendString(client.GetHabbo().Motto);
serverMessage2.AppendInteger(client.GetHabbo().AchievementPoints);
_userRoom.SendMessage(serverMessage2);
}
if (_userRoom.RoomData.Owner != client.GetHabbo().UserName)
{
Yupi.GetGame()
.GetAchievementManager()
.ProgressUserAchievement(client, "ACH_RoomEntry", 1);
}
}
if (client.GetHabbo().GetMessenger() != null)
client.GetHabbo().GetMessenger().OnStatusChanged(true);
client.GetMessageHandler().OnRoomUserAdd();
//if (client.GetHabbo().HasFuse("fuse_mod")) client.GetHabbo().GetAvatarEffectsInventoryComponent().ActivateCustomEffect(102);
//if (client.GetHabbo().Rank == Convert.ToUInt32(Yupi.GetDbConfig().DbData["ambassador.minrank"])) client.GetHabbo().GetAvatarEffectsInventoryComponent().ActivateCustomEffect(178);
if (OnUserEnter != null)
OnUserEnter(user, null);
if (_userRoom.GotMusicController() && _userRoom.GotMusicController())
//.........这里部分代码省略.........