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


C# RoomItem.SetState方法代码示例

本文整理汇总了C#中RoomItem.SetState方法的典型用法代码示例。如果您正苦于以下问题:C# RoomItem.SetState方法的具体用法?C# RoomItem.SetState怎么用?C# RoomItem.SetState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在RoomItem的用法示例。


在下文中一共展示了RoomItem.SetState方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetFloorItem


//.........这里部分代码省略.........
                {
                    newRot = 0;
                }
            }
            else if (item.GetBaseItem().Name == "val14_b_roof" || item.GetBaseItem().Name == "val14_g_roof" ||
                     item.GetBaseItem().Name == "val14_y_roof")
            {
                if (newRot != 2 && newRot != 3 && newRot != 4 && newRot != 7)
                {
                    newRot = 0;
                }
            }
            else if (item.GetBaseItem().Name == "val13_div_1")
            {
                if (newRot < 0 || newRot > 6)
                {
                    newRot = 0;
                }
            }
            else if (item.GetBaseItem().Name == "room_info15_shrub1")
            {
                if (newRot != 0 && newRot != 2 && newRot != 3 && newRot != 4 && newRot != 6)
                {
                    newRot = 0;
                }
            }
            else if (item.GetBaseItem().Name == "room_info15_div")
            {
                if (newRot < 0 || newRot > 5)
                {
                    newRot = 0;
                }
            }
            else
            {
                if (newRot != 0 && newRot != 2 && newRot != 4 && newRot != 6 && newRot != 8)
                {
                    newRot = 0;
                }
            }
            item.Rot = newRot;

            item.SetState(newX, newY, height, affectedTiles);
            if (!onRoller && session != null) item.Interactor.OnPlace(session, item);
            if (newItem)
            {
                if (FloorItems.ContainsKey(item.Id)) return true;
                if (item.IsFloorItem) FloorItems.TryAdd(item.Id, item);
                else if (item.IsWallItem) WallItems.TryAdd(item.Id, item);

                AddOrUpdateItem(item.Id);
                if (sendMessage)
                {
                    var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("AddFloorItemMessageComposer"));
                    item.Serialize(serverMessage);
                    serverMessage.AppendString(_room.RoomData.Group != null
                        ? session.GetHabbo().UserName
                        : _room.RoomData.Owner);
                    _room.SendMessage(serverMessage);
                }
            }
            else
            {
                AddOrUpdateItem(item.Id);
                if (!onRoller && sendMessage)
                {
                    if (specialMove)
                    {
                        var message = new ServerMessage(LibraryParser.OutgoingRequest("ItemAnimationMessageComposer"));
                        message.AppendInteger(oldCoord.X);
                        message.AppendInteger(oldCoord.Y);
                        message.AppendInteger(newX);
                        message.AppendInteger(newY);
                        message.AppendInteger(1);
                        message.AppendInteger(item.Id);
                        message.AppendString(TextHandling.GetString(item.Z));
                        message.AppendString(TextHandling.GetString(item.Z));
                        message.AppendInteger(-1);
                        _room.SendMessage(message);
                    }
                    else
                    {
                        var message = new ServerMessage(LibraryParser.OutgoingRequest("UpdateRoomItemMessageComposer"));
                        item.Serialize(message);
                        _room.SendMessage(message);
                    }
                }
                if (item.IsWired) _room.GetWiredHandler().MoveWired(item);
            }
            _room.GetGameMap().AddToMap(item);
            if (item.GetBaseItem().IsSeat) updateRoomUserStatuses = true;
            if (updateRoomUserStatuses)
            {
                _room.GetRoomUserManager().OnUserUpdateStatus(oldCoord.X, oldCoord.Y);
                _room.GetRoomUserManager().OnUserUpdateStatus(item.X, item.Y);
            }
            if (newItem) OnHeightMapUpdate(affectedTiles);

            return true;
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:101,代码来源:RoomItemHandler.cs

示例2: DeveloperSetFloorItem

        internal void DeveloperSetFloorItem(GameClient session, RoomItem item)
        {
            if (FloorItems.ContainsKey(item.Id)) return;
            FloorItems.TryAdd(item.Id, item);

            AddOrUpdateItem(item.Id);

            var affectedTiles = Gamemap.GetAffectedTiles(item.GetBaseItem().Length, item.GetBaseItem().Width, item.X,
                item.Y, item.Rot);
            item.SetState(item.X, item.Y, item.Z, affectedTiles);

            var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("AddFloorItemMessageComposer"));
            item.Serialize(serverMessage);
            serverMessage.AppendString(_room.RoomData.Group != null ? session.GetHabbo().UserName : _room.RoomData.Owner);
            _room.SendMessage(serverMessage);

            _room.GetGameMap().AddToMap(item);
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:18,代码来源:RoomItemHandler.cs

示例3: SetFloorItem

        internal bool SetFloorItem(RoomItem Item, int newX, int newY, Double newZ)
        {
            room.GetGameMap().RemoveFromMap(Item);
            Item.SetState(newX, newY, newZ, Gamemap.GetAffectedTiles(Item.GetBaseItem().Length, Item.GetBaseItem().Width, newX, newY, Item.Rot));

            UpdateItem(Item);
            room.GetGameMap().AddItemToMap(Item);

            return true;
        }
开发者ID:habb0,项目名称:PiciEmulator,代码行数:10,代码来源:RoomItemHandling.cs

示例4: MoveBall

        internal bool MoveBall(RoomItem item, GameClient mover, int newX, int newY)
        {
            if (item == null || item.GetBaseItem() == null /*|| mover == null || mover.GetHabbo() == null*/)
                return false;

            if (!_room.GetGameMap().ItemCanBePlacedHere(newX, newY))
                return false;

            var oldRoomCoord = item.Coordinate;
            var itemIsOnGameItem = GameItemOverlaps(item);
            double newZ = _room.GetGameMap().Model.SqFloorHeight[newX][newY];

            var mMessage = new ServerMessage();
            mMessage.Init(LibraryParser.OutgoingRequest("ItemAnimationMessageComposer")); // Cf
            mMessage.AppendInteger(item.Coordinate.X);
            mMessage.AppendInteger(item.Coordinate.Y);
            mMessage.AppendInteger(newX);
            mMessage.AppendInteger(newY);
            mMessage.AppendInteger(1);
            mMessage.AppendInteger(item.Id);
            mMessage.AppendString(TextHandling.GetString(item.Z));
            mMessage.AppendString(TextHandling.GetString(newZ));
            mMessage.AppendInteger(item.Id);
            _room.SendMessage(mMessage);

            if (oldRoomCoord.X == newX && oldRoomCoord.Y == newY)
                return false;

            item.SetState(newX, newY, item.Z,
                Gamemap.GetAffectedTiles(item.GetBaseItem().Length, item.GetBaseItem().Width, newX, newY, item.Rot));

            if (itemIsOnGameItem || mover == null || mover.GetHabbo() == null)
                return false;
            HandleFootballGameItems(new Point(newX, newY),
                _room.GetRoomUserManager().GetRoomUserByHabbo(mover.GetHabbo().Id));
            return false;
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:37,代码来源:Soccer.cs

示例5: SetFloorItem

		internal bool SetFloorItem(RoomItem Item, int newX, int newY, double newZ, int rot, bool sendupdate)
		{
			this.room.GetGameMap().RemoveFromMap(Item);
			Item.SetState(newX, newY, newZ, Gamemap.GetAffectedTiles(Item.GetBaseItem().InteractionType, Item.GetBaseItem().Length, Item.GetBaseItem().Width, newX, newY, rot));
			if (Item.GetBaseItem().InteractionType == InteractionType.roombg && this.room.TonerData == null)
			{
				this.room.TonerData = new TonerData(Item.Id);
			}
			this.UpdateItem(Item);
			this.room.GetGameMap().AddItemToMap(Item, true);
			if (sendupdate)
			{
				ServerMessage message = new ServerMessage(Outgoing.UpdateRoomItemMessageComposer);
				Item.Serialize(message);
				this.room.SendMessage(message);
			}
			return true;
		}
开发者ID:BjkGkh,项目名称:Mercury,代码行数:18,代码来源:RoomItemHandling.cs

示例6: SetFloorItem


//.........这里部分代码省略.........
                        newZ = I.TotalHeight;
                    }

                    if (I.GetBaseItem().InteractionType == InteractionType.magictile)
                    {
                        StacktitleZ = I.TotalHeight;
                    }
                }

                if (StacktitleZ != 99998)
                    newZ = StacktitleZ;
            }

            // Verify the rotation is valid
            if (Item.GetBaseItem().InteractionType == InteractionType.mannequin)
            {
                if (newRot < 0 || newRot > 12) 
                    newRot = 0;
            }
            else
            {
                if (newRot < 0 || newRot > 12 || newRot % 2 != 0)
                    newRot = 0;
            }

            //Item.GetX = newX;
            //Item.GetY = newY;
            //Item.GetZ = newZ;


            Item.Rot = newRot;
            int oldX = Item.GetX;
            int oldY = Item.GetY;
            Item.SetState(newX, newY, newZ, AffectedTiles);

            if (!OnRoller && Session != null)
                Item.Interactor.OnPlace(Session, Item);


            if (newItem)
            {
                if (mFloorItems.ContainsKey(Item.Id))
                {
                    if (Session != null)
                        Session.SendNotif("Oeps! Er is iets mis gegaan, probeer het opnieuw!\r\r<b>Beschrijving:</b>\rJe hebt dit Meubi al eerder in je kamer geplaatst.");

                    return true;
                }

                if (Item.IsFloorItem && !mFloorItems.ContainsKey(Item.Id))
                    mFloorItems.Add(Item.Id, Item);
                else if (Item.IsWallItem && !mWallItems.ContainsKey(Item.Id))
                    mWallItems.Add(Item.Id, Item);

                AddItem(Item);

                if (sendMessage)
                {
                    ServerMessage Message = PacketHandelingManager.GetRecycledItem(OutputCode.ObjectAddMessageEvent);
                    Item.Serialize(Message);
                    Message.AddString(room.Owner);
                    room.SendMessage(Message);
                }
            }
            else
            {
开发者ID:BjkGkh,项目名称:R106,代码行数:67,代码来源:RoomItemHandling.cs


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