本文整理汇总了C#中RoomItem.UpdateState方法的典型用法代码示例。如果您正苦于以下问题:C# RoomItem.UpdateState方法的具体用法?C# RoomItem.UpdateState怎么用?C# RoomItem.UpdateState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RoomItem
的用法示例。
在下文中一共展示了RoomItem.UpdateState方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnTrigger
public override void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights)
{
RoomUser roomUser = null;
if (session != null)
roomUser = item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id);
if (roomUser == null)
return;
if (Gamemap.TilesTouching(item.X, item.Y, roomUser.X, roomUser.Y))
{
if (item.ExtraData == "-1")
return;
if (request == -1)
{
item.ExtraData = "0";
item.UpdateState();
return;
}
item.ExtraData = "-1";
item.UpdateState(false, true);
item.ReqUpdate(4, true);
return;
}
roomUser.MoveTo(item.SquareInFront);
}
示例2: OnWiredTrigger
public override void OnWiredTrigger(RoomItem item)
{
uint num = item.GetBaseItem().Modes - 1;
if (num <= 0)
item.UpdateState(false, true);
int num2;
int.TryParse(item.ExtraData, out num2);
int num3;
if (num2 <= 0)
num3 = 1;
else
{
if (num2 >= num)
num3 = 0;
else
num3 = num2 + 1;
}
if (num3 == 0 && !item.GetRoom().GetGameMap().ItemCanBePlacedHere(item.X, item.Y))
return;
item.ExtraData = num3.ToString();
item.UpdateState();
item.GetRoom().GetGameMap().UpdateMapForItem(item);
}
示例3: OnTrigger
public void OnTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool HasRights)
{
RoomUser User = null;
if (Session != null)
User = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
if (User == null)
return;
if (Gamemap.TilesTouching(Item.GetX, Item.GetY, User.X, User.Y))
{
if (Item.ExtraData != "-1")
{
if (Request == -1)
{
Item.ExtraData = "0";
Item.UpdateState();
}
else
{
Item.ExtraData = "-1";
Item.UpdateState(false, true);
Item.ReqUpdate(4, true);
}
}
}
else
{
User.MoveTo(Item.SquareInFront);
}
}
示例4: OnTrigger
public void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights)
{
if (!hasRights)
return;
if (item == null || item.GetBaseItem() == null || item.GetBaseItem().InteractionType != Interaction.Gate)
return;
var modes = item.GetBaseItem().Modes - 1;
if (modes <= 0)
item.UpdateState(false, true);
if (item.GetRoom() == null || item.GetRoom().GetGameMap() == null || item.GetRoom().GetGameMap().SquareHasUsers(item.X, item.Y))
return;
int currentMode;
int.TryParse(item.ExtraData, out currentMode);
int newMode;
if (currentMode <= 0)
newMode = 1;
else if (currentMode >= modes)
newMode = 0;
else
newMode = currentMode + 1;
if (newMode == 0 && !item.GetRoom().GetGameMap().ItemCanBePlacedHere(item.X, item.Y))
return;
item.ExtraData = newMode.ToString();
item.UpdateState();
item.GetRoom().GetGameMap().UpdateMapForItem(item);
item.GetRoom().GetWiredHandler().ExecuteWired(Interaction.TriggerStateChanged, item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id), item);
}
示例5: OnTrigger
public void OnTrigger(GameClients.GameClient Session, RoomItem Item, int Request, bool HasRights)
{
int Modes = Item.GetBaseItem().Modes - 1;
if (!HasRights)
{
return;
}
else if (Modes <= 0)
{
Item.UpdateState(false, true);
}
int CurrentMode = 0;
int NewMode = 0;
if(!int.TryParse(Item.ExtraData, out CurrentMode))
{
}
if (CurrentMode <= 0)
{
NewMode = 1;
}
else if (CurrentMode >= Modes)
{
NewMode = 0;
}
else
{
NewMode = CurrentMode + 1;
}
if (NewMode == 0)
{
if (!Item.GetRoom().GetGameMap().itemCanBePlacedHere(Item.GetX, Item.GetY))
{
return;
}
}
Item.ExtraData = NewMode.ToString();
Item.UpdateState();
Item.GetRoom().GetGameMap().updateMapForItem(Item);
Item.GetRoom().GetWiredHandler().ExecuteWired(Rooms.Wired.WiredItemType.TriggerToggleFurni, Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id), Item);
//Item.GetRoom().GenerateMaps();
}
示例6: OnTrigger
public override void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights)
{
if (item.ExtraData == "1" || !item.GetBaseItem().VendingIds.Any() || item.InteractingUser != 0u ||
session == null)
return;
var roomUserByHabbo = item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id);
if (roomUserByHabbo == null)
return;
if (!Gamemap.TilesTouching(roomUserByHabbo.X, roomUserByHabbo.Y, item.X, item.Y))
{
roomUserByHabbo.MoveTo(item.SquareInFront);
return;
}
item.InteractingUser = session.GetHabbo().Id;
roomUserByHabbo.CanWalk = false;
roomUserByHabbo.ClearMovement();
roomUserByHabbo.SetRot(PathFinder.CalculateRotation(roomUserByHabbo.X, roomUserByHabbo.Y, item.X, item.Y));
item.ReqUpdate(2, true);
item.ExtraData = "1";
item.UpdateState(false, true);
}
示例7:
void IFurniTrigger.OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights)
{
if (Item.ExtraData != "1" && Item.GetBaseItem().VendingIds.Count >= 1 && Item.InteractingUser == 0 && Session != null)
{
RoomUser user = Item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);
if (user == null)
return;
if (!Gamemap.TilesTouching(user.X, user.Y, Item.GetX, Item.GetY))
{
user.MoveTo(Item.SquareInFront);
return;
}
Item.InteractingUser = Session.GetHabbo().Id;
//user.ClearMovement(true);
user.SetRot(Rotation.Calculate(user.X, user.Y, Item.GetX, Item.GetY), false);
Item.ReqUpdate(2, true);
Item.ExtraData = "1";
Item.UpdateState(false, true);
}
}
示例8: OnTrigger
public override void OnTrigger(GameClients.GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0)
{
if (!bool_0)
{
return;
}
int num = 0;
int.TryParse(RoomItem_0.ExtraData, out num);
{
switch (int_0)
{
case 1:
num++;
break;
case 2:
num--;
break;
case 3:
num = 0;
break;
}
RoomItem_0.ExtraData = num < 0 ? "0" : num.ToString();
RoomItem_0.UpdateState(false, true);
}
}
示例9: OnTrigger
public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
{
if (!HasRights)
{
return;
}
int num = 0;
int.TryParse(Item.ExtraData, out num);
checked
{
if (Request == 1)
{
num++;
}
else
{
if (Request == 2)
{
num--;
}
else
{
if (Request == 3)
{
num = 0;
}
}
}
Item.ExtraData = num.ToString();
Item.UpdateState(false, true);
}
}
示例10: if
void IFurniTrigger.OnTrigger(GameClient Session, RoomItem Item, int Request, bool UserHasRights)
{
if (!UserHasRights)
{
return;
}
int oldValue = 0;
if (!string.IsNullOrEmpty(Item.ExtraData))
{
try
{
oldValue = int.Parse(Item.ExtraData);
}
catch { }
}
if (Request == 1)
{
oldValue++;
}
else if (Request == 2)
{
oldValue--;
}
else if (Request == 3)
{
oldValue = 0;
}
Item.ExtraData = oldValue.ToString();
Item.UpdateState(false, true);
}
示例11: OnTrigger
public void OnTrigger(GameClient Session, RoomItem Item, int Request, bool HasRights)
{
if (!HasRights)
{
return;
}
int num = 0;
int.TryParse(Item.ExtraData, out num);
checked
{
if (Request == 1)
{
if (Item.pendingReset && num > 0)
{
num = 0;
Item.pendingReset = false;
}
else
{
num += 60;
Item.UpdateNeeded = false;
}
}
else
{
if (Request == 2)
{
Item.UpdateNeeded = !Item.UpdateNeeded;
Item.pendingReset = true;
}
}
Item.ExtraData = num.ToString();
Item.UpdateState();
}
}
示例12: ExecuteAction
public void ExecuteAction(RoomItem theItem)
{
if (string.IsNullOrEmpty(theItem.ExtraData))
return;
int seconds = 0;
try
{
seconds = int.Parse(theItem.ExtraData);
}
catch { }
if (seconds > 0)
{
if (theItem.interactionCountHelper == 1)
{
seconds--;
theItem.interactionCountHelper = 0;
theItem.ExtraData = seconds.ToString();
theItem.UpdateState();
}
else
theItem.interactionCountHelper++;
theItem.UpdateCounter = 1;
}
else
{
theItem.UpdateCounter = 0;
theItem.GetRoom().GetBanzai().BanzaiEnd();
}
}
示例13: OnTrigger
public void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights)
{
if (!hasRights)
return;
switch (request)
{
case -1: // Open interface
break;
default:
if (item.ExtraData == "1")
{
item.GetRoom().GetRoomMusicController().Stop();
item.ExtraData = "0";
}
else
{
item.GetRoom().GetRoomMusicController().Start();
item.ExtraData = "1";
}
item.UpdateState();
item.GetRoom().GetRoomMusicController().BroadcastCurrentSongData(item.GetRoom());
break;
}
}
示例14: OnPlace
public void OnPlace(GameClient Session, RoomItem Item)
{
if (Item.team == Team.none)
return;
Item.ExtraData = Item.GetRoom().GetGameManager().Points[(int)Item.team].ToString();
Item.UpdateState(false, true);
}
示例15: OnTrigger
public override void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights)
{
if (!hasRights)
return;
int num;
int.TryParse(item.ExtraData, out num);
switch (request)
{
case 1:
num++;
break;
case 2:
num--;
break;
case 3:
num = 0;
break;
}
item.ExtraData = num.ToString();
item.UpdateState(false, true);
}