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


C# RoomUser.GetDoubleCoordinate方法代码示例

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


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

示例1: UpdateUserOnRoller

		//internal ServerMessage UpdateItemOnRoller(RoomItem pItem, Point NextCoord, uint pRolledID, Double NextZ)
		//{
		//	return UpdateItemOnRoller(pItem, NextCoord, pRolledID, NextZ);
		//}

		//internal ServerMessage UpdateUserOnRoller(RoomUser pUser, Point pNextCoord, uint pRollerID, Double NextZ)
		//{
		//	return UpdateUserOnRoller(pUser, pNextCoord.X, pNextCoord.Y, pRollerID, NextZ);
		//}

        internal ServerMessage UpdateUserOnRoller(RoomUser pUser, int newX, int newY, ref int newCoord, uint pRollerID, Double NextZ)
        {
            ServerMessage mMessage = PacketHandelingManager.GetRecycledItem(OutputCode.SlideObjectBundleMessageEvent);
            mMessage.AddInt32(pUser.X);
            mMessage.AddInt32(pUser.Y);

			mMessage.AddInt32(newX);
			mMessage.AddInt32(newY);

            mMessage.AddInt32(0);
            mMessage.AddUInt32(pRollerID);
            mMessage.AddInt32(2);
            mMessage.AddInt32(pUser.VirtualId);

			mMessage.AddString(TextHandling.GetString(pUser.Z));
			mMessage.AddString(TextHandling.GetString(NextZ));

            mMessage.AddInt32(0);
            mMessage.AddInt32(0);

			int userCoord = pUser.GetDoubleCoordinate();
            room.GetGameMap().UpdateUserMovement(ref userCoord, ref newCoord, pUser);
            room.GetGameMap().GameMap[pUser.X, pUser.Y] = 1;
			pUser.X = newX;
			pUser.Y = newY;
            pUser.Z = NextZ;
            room.GetGameMap().GameMap[pUser.X, pUser.Y] = 0;
            room.GetRoomUserManager().UpdateUserStatus(pUser, true);
            return mMessage;
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:40,代码来源:RoomItemHandling.cs

示例2: TeleportToItem

		internal void TeleportToItem(RoomUser user, RoomItem item)
		{
            if (user.SetStep)
                room.GetGameMap().GameMap[user.SetX, user.SetY] = user.SqState;
            else
                room.GetGameMap().GameMap[user.X, user.Y] = user.SqState;
            int itemCoord = item.GetDoubleCoordinate();
            int userCoord = user.GetDoubleCoordinate();
            UpdateUserMovement(ref userCoord, ref itemCoord, user);
            user.X = item.GetX;
            user.Y = item.GetY;
            user.Z = item.GetZ;
            
            if (user.isFlying)
                user.Z += 4 + 0.5 * Math.Sin(0.7 * user.flyk);

            user.SqState = GameMap[item.GetX, item.GetY];
            GameMap[user.X, user.Y] = 1;

            user.GoalX = user.X;
            user.GoalY = user.Y;
            user.SetStep = false;
            user.IsWalking = false;
            user.UpdateNeeded = true;
            user.OnStopWalk();

            if (item.GetBaseItem().IsSeat)
            {
                if (!user.Statusses.ContainsKey("sit"))
                {
                    user.Statusses.Add("sit", TextHandling.GetString(item.Height));
                }
            }
            else if (item.GetBaseItem().InteractionType == InteractionType.bed)
            {
                if (!user.Statusses.ContainsKey("lay"))
                {
                    user.Statusses.Add("lay", TextHandling.GetString(item.Height) + " null");
                }
            }
            user.Z = item.GetZ;
            if (user.isFlying)
                user.Z += 4 + (0.2 * 0.5 * Math.Sin(0.7 * user.flyk));
            user.RotHead = item.Rot;
            user.RotBody = item.Rot;

            user.UpdateNeeded = true;

            
            //item.OnUserWalk(user, false); BE GONE BUG
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:51,代码来源:Gamemap.cs

示例3: RemoveRoomUser

        private void RemoveRoomUser(RoomUser user)
        {
            UserList.Remove(user.InternalRoomID);

            if (user.SetStep)
                room.GetGameMap().GameMap[user.SetX, user.SetY] = user.SqState;
            else
                room.GetGameMap().GameMap[user.X, user.Y] = user.SqState;

			int coordinate = user.GetDoubleCoordinate();
			room.GetGameMap().RemoveUserFromMap(user, ref coordinate);

			if (!user.IsBot)
			{
				usersByUsername.Remove(user.username);
				usersByUserID.Remove(user.userID);
			}

            ServerMessage LeaveMessage = PacketHandelingManager.GetRecycledItem(OutputCode.UserRemoveMessageEvent);
            LeaveMessage.AddString(user.VirtualId.ToString());
            room.SendMessage(LeaveMessage);
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:22,代码来源:RoomUserManager.cs

示例4: UpdateUserStatus

        internal void UpdateUserStatus(RoomUser User, bool cyclegameitems)
        {
            if (User == null)
                return;
            bool isBot = User.IsBot;
            if (isBot)
                cyclegameitems = false;

            if (User.Statusses.ContainsKey("lay") || User.Statusses.ContainsKey("sit"))
            {
                User.Statusses.Remove("lay");
                if (!User.forcesit)
                    User.Statusses.Remove("sit");
                User.UpdateNeeded = true;
            }

            //List<RoomItem> ItemsOnSquare = GetFurniObjects(User.X, User.Y);
            //CoordItemSearch ItemSearch = new CoordItemSearch(room.GetGameMap().CoordinatedItems);
			int userCoord = User.GetDoubleCoordinate();
			List<RoomItem> ItemsOnSquare = room.GetGameMap().GetCoordinatedItems(ref userCoord); //ItemSearch.GetAllRoomItemForSquare(User.X, User.Y);
            double newZ = room.GetGameMap().GetNewZForUser(User.X, User.Y, User.Z);
            
            if (newZ != User.Z)
            {
                if (User.isFlying)
                    newZ += 4 + (0.5 * Math.Sin(0.7 * User.flyk));
                if (User.UserIsRidingAHorse())
                    newZ += 1;

                User.Z = newZ;
                User.UpdateNeeded = true;
            }

            DynamicRoomModel Model = room.GetGameMap().Model;
            if (Model.SqState[User.X, User.Y] == SquareState.SEAT)
            {
                if (!User.Statusses.ContainsKey("sit"))
                {
                    User.Statusses.Add("sit", "1.0");
                }

                User.Z = Model.SqFloorHeight[User.X, User.Y];
                if (User.isFlying)
                    User.Z += 4 + (0.5 * Math.Sin(0.7 * User.flyk));
                User.RotHead = Model.SqSeatRot[User.X, User.Y];
                User.RotBody = Model.SqSeatRot[User.X, User.Y];

                User.UpdateNeeded = true;
			}

            RoomItem[] items = room.GetGameMap().GetCoordinatedHeighestItems(ref userCoord).ToArray();

            foreach (RoomItem item in items)
                item.OnUserWalk(User, cyclegameitems);

            if (User.pressurePlate != 0)
            {
                if (User.PressurePlateReset)
                {
                    RoomItem plate = room.GetRoomItemHandler().GetItem(User.pressurePlate);

                    if (plate == null)
                        return;

                    User.pressurePlate = 0;

                    plate.ExtraData = "0";
                    plate.UpdateState(false, true);
                }

                User.PressurePlateReset = true;
            }

			if (cyclegameitems)
            {
                if (room.GotSoccer())
                    room.GetSoccer().OnUserWalk(User);

                if (room.GotBanzai())
                    room.GetBanzai().OnUserWalk(User);

                if (room.GotFreeze())
                    room.GetFreeze().OnUserWalk(User);
			}
		}
开发者ID:BjkGkh,项目名称:R106,代码行数:85,代码来源:RoomUserManager.cs

示例5: SetStepForUser

        private bool SetStepForUser(RoomUser User)
        {
            if (room.GetGameMap().CanWalk(User.SetX, User.SetY, User.SetZ, User.AllowOverride) || User.ignoreMap || User.PetGotUserRiding())
            {
				int currentCoord = User.GetDoubleCoordinate();
				int newCoord = TextHandling.CombineXYCoord(User.SetX, User.SetY);

				room.GetGameMap().UpdateUserMovement(ref currentCoord, ref newCoord, User);
				RoomItem[] items = room.GetGameMap().GetCoordinatedHeighestItems(ref currentCoord);

                User.X = User.SetX;
                User.Y = User.SetY;
                User.Z = User.SetZ;

                if (User.isFlying)
                {
                    User.Z += 4 + 0.5 * Math.Sin(0.7 * User.flyk);
                }
                else
                {
                    foreach (RoomItem item in items)
                    {
                        item.UserWalksOffFurni(User);
                    }
                   
                }

                if (User.X == room.GetGameMap().Model.DoorX && User.Y == room.GetGameMap().Model.DoorY && !ToRemove.Contains(User) && !User.IsBot)
                {
                    ToRemove.Add(User);
                    return true;
                }


                UpdateUserStatus(User, true);
            }
            User.SetStep = false;
            return false;
        }
开发者ID:BjkGkh,项目名称:R106,代码行数:39,代码来源:RoomUserManager.cs


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