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


C# RoomUser.ClearMovement方法代码示例

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


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

示例1: UserCycleOnRoom

        /// <summary>
        ///     Turns the user thread
        /// </summary>
        /// <param name="roomUsers"></param>
        internal void UserCycleOnRoom(RoomUser roomUsers)
        {
            // Region Check User Elegibility
            if (!IsValid(roomUsers))
            {
                if (roomUsers.GetClient() != null)
                    RemoveUserFromRoom(roomUsers.GetClient(), false, false);
                else
                    RemoveRoomUser(roomUsers);
            }

            // Region Check User Remove Unlocking
            lock (_removeUsers)
            {
                if (roomUsers.NeedsAutokick && !_removeUsers.Contains(roomUsers))
                {
                    _removeUsers.Add(roomUsers);
                    return;
                }
            }

            // Region Idle and Room Tiem Check
            roomUsers.IdleTime++;

            // Region User Achievement of Room
            UserRoomTimeCycles(roomUsers);

            // Carry Item Hand Checking
            if (roomUsers.CarryItemId > 0)
            {
                roomUsers.CarryTimer--;

                // If The Carry Timer is 0.. Remove CarryItem.
                if (roomUsers.CarryTimer <= 0)
                    roomUsers.CarryItem(0);
            }

            // Region Check User Got Freezed
            if (_userRoom.GotFreeze())
                Freeze.CycleUser(roomUsers);

            // Region Variable Registering
            bool invalidStep = false;
            // Region Check User Tile Selection
            if (roomUsers.SetStep)
            {
                // Check if User is Going to the Door.
                lock (_removeUsers)
                {
                    if ((roomUsers.SetX == _userRoom.GetGameMap().Model.DoorX) && (roomUsers.SetY == _userRoom.GetGameMap().Model.DoorY) && !_removeUsers.Contains(roomUsers) && !roomUsers.IsBot && !roomUsers.IsPet)
                    {
                        _removeUsers.Add(roomUsers);
                        return;
                    }
                }

                // Check Elegibility of Walk In Tile
                invalidStep = UserCanWalkInTile(roomUsers);

                // User isn't Anymore Set a Tile to Walk
                roomUsers.SetStep = false;
            }

            // Pet Must Stop Too!
            if ((roomUsers.GoalX == roomUsers.X) && (roomUsers.GoalY == roomUsers.Y) && roomUsers.RidingHorse && !roomUsers.IsPet)
            {
                RoomUser horseStopWalkRidingPet = GetRoomUserByVirtualId(Convert.ToInt32(roomUsers.HorseId));

                if (horseStopWalkRidingPet != null)
                {
                    ServerMessage horseStopWalkRidingPetMessage =
                        new ServerMessage(LibraryParser.OutgoingRequest("UpdateUserStatusMessageComposer"));
                    horseStopWalkRidingPetMessage.AppendInteger(1);
                    horseStopWalkRidingPet.SerializeStatus(horseStopWalkRidingPetMessage, "");
                    _userRoom.SendMessage(horseStopWalkRidingPetMessage);

                    horseStopWalkRidingPet.IsWalking = false;
                    horseStopWalkRidingPet.ClearMovement();
                }
            }

            // User Reached Goal Need Stop.
            if (((roomUsers.GoalX == roomUsers.X) && (roomUsers.GoalY == roomUsers.Y)) || roomUsers.Freezed)
            {
                roomUsers.IsWalking = false;
                roomUsers.ClearMovement();
                roomUsers.SetStep = false;
                UpdateUserStatus(roomUsers, false);
            }

            // Check if Proably the Pathfinder is with Some Errors..
            if (roomUsers.PathRecalcNeeded)
            {
                roomUsers.Path.Clear();
                roomUsers.Path = PathFinder.FindPath(roomUsers, _userRoom.GetGameMap().DiagonalEnabled,
                    _userRoom.GetGameMap(), new Vector2D(roomUsers.X, roomUsers.Y),
//.........这里部分代码省略.........
开发者ID:bblackv,项目名称:Yupi,代码行数:101,代码来源:RoomUserManager.cs

示例2: UserGoToTile

        internal void UserGoToTile(RoomUser roomUsers, bool invalidStep)
        {
            // If The Tile that the user want to Walk is Invalid!
            if (invalidStep || (roomUsers.PathStep >= roomUsers.Path.Count) ||
                ((roomUsers.GoalX == roomUsers.X) && (roomUsers.GoalY == roomUsers.Y)))
            {
                // Erase all Movement Data..
                roomUsers.IsWalking = false;
                roomUsers.ClearMovement();
                roomUsers.HandelingBallStatus = 0;
                RoomUserBreedInteraction(roomUsers);

                // Check if he is in a Horse, and if if Erase Horse and User Movement Data
                if (roomUsers.RidingHorse && !roomUsers.IsPet)
                {
                    RoomUser horseStopWalkRidingPet = GetRoomUserByVirtualId(Convert.ToInt32(roomUsers.HorseId));

                    if (horseStopWalkRidingPet != null)
                    {
                        ServerMessage horseStopWalkRidingPetMessage =
                            new ServerMessage(LibraryParser.OutgoingRequest("UpdateUserStatusMessageComposer"));
                        horseStopWalkRidingPetMessage.AppendInteger(1);
                        horseStopWalkRidingPet.SerializeStatus(horseStopWalkRidingPetMessage, "");
                        _userRoom.SendMessage(horseStopWalkRidingPetMessage);

                        horseStopWalkRidingPet.IsWalking = false;
                        horseStopWalkRidingPet.ClearMovement();
                    }
                }

                // Finally Update User Status
                UpdateUserStatus(roomUsers, false);
                return;
            }

            // Ins't a Invalid Step.. Continuing.
            // Region Set Variables
            int pathDataCount = roomUsers.Path.Count - roomUsers.PathStep - 1;
            Vector2D nextStep = roomUsers.Path[pathDataCount];

            // Increase Step Data...
            roomUsers.PathStep++;

            // Check Against if is a Valid Step...
            if (_userRoom.GetGameMap()
                .IsValidStep3(roomUsers, new Vector2D(roomUsers.X, roomUsers.Y), new Vector2D(nextStep.X, nextStep.Y),
                    (roomUsers.GoalX == nextStep.X) && (roomUsers.GoalY == nextStep.Y), roomUsers.AllowOverride,
                    roomUsers.GetClient()))
            {
                // If is a PET Must Give the Time Tick In Syncrony with User..
                if (roomUsers.RidingHorse && !roomUsers.IsPet)
                {
                    RoomUser horsePetAi = GetRoomUserByVirtualId(Convert.ToInt32(roomUsers.HorseId));

                    if (horsePetAi != null)
                        horsePetAi.BotAi.OnTimerTick();
                }

                // Horse Ridding need be Updated First
                if (roomUsers.RidingHorse)
                {
                    // Set User Position Data
                    UserSetPositionData(roomUsers, nextStep);
                    CheckUserSittableLayable(roomUsers);

                    // Add Status of Walking
                    roomUsers.AddStatus("mv",
                        +roomUsers.SetX + "," + roomUsers.SetY + "," + ServerUserChatTextHandler.GetString(roomUsers.SetZ));
                }

                // Check if User is Ridding in Horse, if if Let's Update Ride Data.
                if (roomUsers.RidingHorse && !roomUsers.IsPet)
                {
                    RoomUser horseRidingPet = GetRoomUserByVirtualId(Convert.ToInt32(roomUsers.HorseId));

                    if (horseRidingPet != null)
                    {
                        string theUser = "mv " + roomUsers.SetX + "," + roomUsers.SetY + "," +
                                      ServerUserChatTextHandler.GetString(roomUsers.SetZ);
                        string thePet = "mv " + roomUsers.SetX + "," + roomUsers.SetY + "," +
                                     ServerUserChatTextHandler.GetString(horseRidingPet.SetZ);

                        ServerMessage horseRidingPetMessage =
                            new ServerMessage(LibraryParser.OutgoingRequest("UpdateUserStatusMessageComposer"));
                        horseRidingPetMessage.AppendInteger(2);
                        roomUsers.SerializeStatus(horseRidingPetMessage, theUser);
                        horseRidingPet.SerializeStatus(horseRidingPetMessage, thePet);
                        _userRoom.SendMessage(horseRidingPetMessage);

                        horseRidingPet.RotBody = roomUsers.RotBody;
                        horseRidingPet.RotHead = roomUsers.RotBody;
                        horseRidingPet.SetX = roomUsers.SetX;
                        horseRidingPet.SetY = roomUsers.SetY;
                        horseRidingPet.SetZ = roomUsers.SetZ - 1;
                        horseRidingPet.SetStep = true;

                        UpdateUserEffect(horseRidingPet, horseRidingPet.SetX, horseRidingPet.SetY);
                        UpdateUserStatus(horseRidingPet, false);
                    }
                }
//.........这里部分代码省略.........
开发者ID:bblackv,项目名称:Yupi,代码行数:101,代码来源:RoomUserManager.cs


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