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


C# RoomUser.SerializeStatus方法代码示例

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


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

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