当前位置: 首页>>代码示例>>C#>>正文


C# RoomItem.UpdateState方法代码示例

本文整理汇总了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);
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:29,代码来源:InteractorDice.cs

示例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);
        }
开发者ID:sgf,项目名称:Yupi,代码行数:28,代码来源:InteractorHCGate.cs

示例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);
            }
        }
开发者ID:BjkGkh,项目名称:Custom-R2,代码行数:30,代码来源:InteractorDice.cs

示例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);
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:32,代码来源:InteractorGate.cs

示例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();
        }
开发者ID:BjkGkh,项目名称:Custom-R2,代码行数:48,代码来源:InteractorGate.cs

示例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);
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:27,代码来源:InteractorVendor.cs

示例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);
            }
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:25,代码来源:VendingTrigger.cs

示例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);
            }
        }
开发者ID:RootkitR,项目名称:Essential-5.1,代码行数:28,代码来源:InteractorScoreCounter.cs

示例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);
			}
		}
开发者ID:kessiler,项目名称:habboServer,代码行数:32,代码来源:InteractorScoreCounter.cs

示例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);
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:35,代码来源:ScoreCounterTrigger.cs

示例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();
			}
		}
开发者ID:kessiler,项目名称:habboServer,代码行数:35,代码来源:InteractorScoreboard.cs

示例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();
            }
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:35,代码来源:BanzaiCounterInteractor.cs

示例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;
            }
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:29,代码来源:InteractorJukebox.cs

示例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);
 }
开发者ID:kessiler,项目名称:habboServer,代码行数:7,代码来源:InteractorFreezeScoreCounter.cs

示例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);
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:27,代码来源:InteractorScoreCounter.cs


注:本文中的RoomItem.UpdateState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。