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


C# ServerMessage.Init方法代码示例

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


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

示例1: GenerateMessage

 internal void GenerateMessage(ServerMessage message)
 {
     message.Init(LibraryParser.OutgoingRequest("TargetedOfferMessageComposer"));
     message.AppendInteger(1);//show
     message.AppendInteger(Id);
     message.AppendString(Identifier);
     message.AppendString(Identifier);
     message.AppendInteger(CostCredits);
     if (CostDiamonds > 0)
     {
         message.AppendInteger(CostDiamonds);
         message.AppendInteger(105);
     }
     else
     {
         message.AppendInteger(CostDuckets);
         message.AppendInteger(0);
     }
     message.AppendInteger(PurchaseLimit);
     var TimeLeft = ExpirationTime - AzureEmulator.GetUnixTimeStamp();
     message.AppendInteger(TimeLeft);
     message.AppendString(Title);
     message.AppendString(Description);
     message.AppendString(Image);
     message.AppendString("");
     message.StartArray();
     foreach (string Product in Products)
     {
         message.AppendString(Product);
         message.SaveArray();
     }
     message.EndArray();
 }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:33,代码来源:TargetedOffers.cs

示例2: Execute

        public override void Execute(GameClient session, string[] pms)
        {
            ushort result;
            ushort.TryParse(pms[0], out result);

            if (result > 4)
            {
                session.SendWhisper(TextManager.GetText("command_dance_false"));
                result = 0;
            }
            var message = new ServerMessage();
            message.Init(LibraryParser.OutgoingRequest("DanceStatusMessageComposer"));
            message.AppendInteger(session.CurrentRoomUserId);
            message.AppendInteger(result);
            session.GetHabbo().CurrentRoom.SendMessage(message);
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:16,代码来源:Dance.cs

示例3: AppendEntrySubmitMessage

        internal ServerMessage AppendEntrySubmitMessage(ServerMessage message, int status, Room room = null)
        {
            message.Init(LibraryParser.OutgoingRequest("CompetitionEntrySubmitResultMessageComposer"));

            message.AppendInteger(Id);
            message.AppendString(Name);
            message.AppendInteger(status);
            // 0 : roomSent - 1 : send room - 2 : confirm register - 3 : neededFurnis - 4 : doorClosed - 6 : acceptRules

            if (status != 3)
            {
                message.AppendInteger(0);
                message.AppendInteger(0);
            }
            else
            {
                message.StartArray();

                foreach (var furni in RequiredFurnis)
                {
                    message.AppendString(furni);
                    message.SaveArray();
                }

                message.EndArray();

                if (room == null)
                    message.AppendInteger(0);
                else
                {
                    message.StartArray();

                    foreach (var furni in RequiredFurnis)
                    {
                        if (!room.GetRoomItemHandler().HasFurniByItemName(furni))
                        {
                            message.AppendString(furni);
                            message.SaveArray();
                        }
                    }

                    message.EndArray();
                }
            }

            return message;
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:47,代码来源:RoomCompetitionManager.cs

示例4: Execute

 public override bool Execute(GameClient session, string[] pms)
 {
     var message = string.Join(" ", pms);
     if (string.IsNullOrEmpty(message)) return true;
     foreach (var client in Azure.GetGame().GetClientManager().Clients.Values)
     {
         var serverMessage = new ServerMessage();
         serverMessage.Init(LibraryParser.OutgoingRequest("WhisperMessageComposer"));
         serverMessage.AppendInteger(client.CurrentRoomUserId);
         serverMessage.AppendString(message);
         serverMessage.AppendInteger(0);
         serverMessage.AppendInteger(36);
         serverMessage.AppendInteger(0);
         serverMessage.AppendInteger(-1);
         client.SendMessage(serverMessage);
     }
     return true;
 }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:18,代码来源:WhisperHotel.cs

示例5: Execute

        public override void Execute(GameClient session, string[] pms)
        {
            var room = session.GetHabbo().CurrentRoom;
            if (!session.GetHabbo().CurrentRoom.RoomMuted)
            {
                session.SendWhisper("Room isn't muted.");
                return;
            }

            session.GetHabbo().CurrentRoom.RoomMuted = false;
            var message = new ServerMessage();
            message.Init(LibraryParser.OutgoingRequest("AlertNotificationMessageComposer"));
            message.AppendString("Room is now UnMuted.");
            message.AppendString("");
            room.SendMessage(message);
            AzureEmulator.GetGame()
                .GetModerationTool().LogStaffEntry(session.GetHabbo().UserName, string.Empty,
                    "Room Unmute", "Room UnMuted");
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:19,代码来源:RoomUnMute.cs

示例6: GenerateMessage

        internal static void GenerateMessage(ServerMessage message, TargetedOffer offer)
        {
            message.Init(LibraryParser.OutgoingRequest("TargetedOfferMessageComposer"));
            message.AppendInteger(1);
            message.AppendInteger(offer.Id);
            message.AppendString(offer.Identifier);
            message.AppendString(offer.Identifier);
            message.AppendInteger(offer.CostCredits);

            if (offer.CostDiamonds > 0)
            {
                message.AppendInteger(offer.CostDiamonds);
                message.AppendInteger(105);
            }
            else
            {
                message.AppendInteger(offer.CostDuckets);
                message.AppendInteger(0);
            }

            message.AppendInteger(offer.PurchaseLimit);

            var timeLeft = offer.ExpirationTime - Azure.GetUnixTimeStamp();

            message.AppendInteger(timeLeft);
            message.AppendString(offer.Title);
            message.AppendString(offer.Description);
            message.AppendString(offer.Image);
            message.AppendString(string.Empty);
            message.StartArray();

            foreach (var product in offer.Products)
            {
                message.AppendString(product);
                message.SaveArray();
            }

            message.EndArray();
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:39,代码来源:TargetedOfferComposer.cs

示例7: AddExperience

        /// <summary>
        /// Adds the experience.
        /// </summary>
        /// <param name="amount">The amount.</param>
        internal void AddExperience(int amount)
        {
            {
                var oldExperienceGoal = ExperienceGoal;
                Experience += amount;
                if (Experience >= 51900)
                    return;
                if (DbState != DatabaseUpdateState.NeedsInsert)
                    DbState = DatabaseUpdateState.NeedsUpdate;
                if (Room == null)
                    return;
                ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("AddPetExperienceMessageComposer"));
                serverMessage.AppendInteger(PetId);
                serverMessage.AppendInteger(VirtualId);
                serverMessage.AppendInteger(amount);
                Room.SendMessage(serverMessage);
                if (Experience < oldExperienceGoal)
                    return;
                var ownerSession = AzureEmulator.GetGame().GetClientManager().GetClientByUserId(OwnerId);

                // Reset pet commands
                PetCommands.Clear();
                PetCommands = PetCommandHandler.GetPetCommands(this);

                if (ownerSession == null)
                    return;
                ServerMessage levelNotify = new ServerMessage(LibraryParser.OutgoingRequest("NotifyNewPetLevelMessageComposer"));
                SerializeInventory(levelNotify, true);
                ownerSession.SendMessage(levelNotify);

                ServerMessage tp = new ServerMessage();
                tp.Init(LibraryParser.OutgoingRequest("PetTrainerPanelMessageComposer"));
                tp.AppendInteger(PetId);

                List<short> availableCommands = new List<short>();

                tp.AppendInteger(PetCommands.Count);
                foreach (short sh in PetCommands.Keys)
                {
                    tp.AppendInteger(sh);
                    if (PetCommands[sh])
                        availableCommands.Add(sh);
                }

                tp.AppendInteger(availableCommands.Count);
                foreach (short sh in availableCommands)
                    tp.AppendInteger(sh);
                ownerSession.SendMessage(tp);
            }
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:54,代码来源:Pet.cs

示例8: OnTrigger

        public void OnTrigger(GameClient session, RoomItem item, int request, bool hasRights)
        {
            if (session == null)
            {
                return;
            }
            RoomUser roomUserByHabbo = item.GetRoom().GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id);
            if (roomUserByHabbo == null)
            {
                return;
            }

            if (PathFinder.GetDistance(roomUserByHabbo.X, roomUserByHabbo.Y, item.X, item.Y) > 1)
            {
                roomUserByHabbo.MoveTo(item.SquareInFront);
            }

            if (Math.Abs(roomUserByHabbo.X - item.X) < 2 && Math.Abs(roomUserByHabbo.Y - item.Y) < 2)
            {
                roomUserByHabbo.SetRot(PathFinder.CalculateRotation(roomUserByHabbo.X, roomUserByHabbo.Y, item.X, item.Y), false);
                Room room = item.GetRoom();
                var point = new Point(0, 0);
                switch (roomUserByHabbo.RotBody)
                {
                    case 4:
                        point = new Point(item.X, item.Y + 1);
                        break;

                    case 0:
                        point = new Point(item.X, item.Y - 1);
                        break;

                    case 6:
                        point = new Point(item.X - 1, item.Y);
                        break;

                    default:
                        if (roomUserByHabbo.RotBody != 2)
                        {
                            return;
                        }
                        point = new Point(item.X + 1, item.Y);
                        break;
                }
                if (!room.GetGameMap().ValidTile2(point.X, point.Y))
                {
                    return;
                }
                var coordinatedItems = room.GetGameMap().GetCoordinatedItems(point);
                if (coordinatedItems.Any(i => !i.GetBaseItem().Stackable)) return;
                double num = item.GetRoom().GetGameMap().SqAbsoluteHeight(point.X, point.Y);
                var serverMessage = new ServerMessage();
                serverMessage.Init(LibraryParser.OutgoingRequest("ItemAnimationMessageComposer"));
                serverMessage.AppendInteger(item.X);
                serverMessage.AppendInteger(item.Y);
                serverMessage.AppendInteger(point.X);
                serverMessage.AppendInteger(point.Y);
                serverMessage.AppendInteger(1);
                serverMessage.AppendInteger(item.Id);
                serverMessage.AppendString(item.Z.ToString(AzureEmulator.CultureInfo));
                serverMessage.AppendString(num.ToString(AzureEmulator.CultureInfo));
                serverMessage.AppendInteger(0);
                room.SendMessage(serverMessage);
                item.GetRoom().GetRoomItemHandler().SetFloorItem(roomUserByHabbo.GetClient(), item, point.X, point.Y, item.Rot, false, false, false);
            }
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:66,代码来源:InteractorPuzzleBox.cs

示例9: SerializeTicketChatlog

        /// <summary>
        /// Serializes the ticket chatlog.
        /// </summary>
        /// <param name="ticket">The ticket.</param>
        /// <param name="roomData">The room data.</param>
        /// <param name="timestamp">The timestamp.</param>
        /// <returns>ServerMessage.</returns>
        /// <exception cref="System.NullReferenceException">No room found.</exception>
        internal static ServerMessage SerializeTicketChatlog(SupportTicket ticket, RoomData roomData, double timestamp)
        {
            var message = new ServerMessage();
            RoomData room = AzureEmulator.GetGame().GetRoomManager().GenerateRoomData(ticket.RoomId);
            //if (room == null)
            //{
            //    throw new NullReferenceException("No room found.");
            //}

            message.Init(LibraryParser.OutgoingRequest("ModerationToolIssueChatlogMessageComposer"));

            message.AppendInteger(ticket.TicketId);
            message.AppendInteger(ticket.SenderId);
            message.AppendInteger(ticket.ReportedId);
            message.AppendInteger(ticket.RoomId);

            message.AppendByte(1);
            message.AppendShort(2);
            message.AppendString("roomName");
            message.AppendByte(2);
            message.AppendString(ticket.RoomName);
            message.AppendString("roomId");
            message.AppendByte(1);
            message.AppendInteger(ticket.RoomId);

            var tempChatlogs = room.RoomChat.Reverse().Skip(Math.Max(0, room.RoomChat.Count() - 60)).Take(60).ToList();

            message.AppendShort(tempChatlogs.Count());
            foreach (var chatLog in tempChatlogs)
            {
                chatLog.Serialize(ref message);
            }
            tempChatlogs = null;

            return message;
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:44,代码来源:ModerationTool.cs

示例10: SerializeRoomChatlog

        /// <summary>
        /// Serializes the room chatlog.
        /// </summary>
        /// <param name="roomId">The room identifier.</param>
        /// <returns>ServerMessage.</returns>
        /// <exception cref="System.NullReferenceException">No room found.</exception>
        internal static ServerMessage SerializeRoomChatlog(uint roomId)
        {
            var message = new ServerMessage();
            Room room = AzureEmulator.GetGame().GetRoomManager().LoadRoom(roomId);

             message.Init(LibraryParser.OutgoingRequest("ModerationToolRoomChatlogMessageComposer"));
            message.AppendByte(1); //type
            message.AppendShort(2);
            message.AppendString("roomName");
            message.AppendByte(2);
            message.AppendString(room.RoomData.Name);
            message.AppendString("roomId");
            message.AppendByte(1);
            message.AppendInteger(room.RoomData.Id);

            if (room != null)
            {
                var tempChatlogs = room.RoomData.RoomChat.Reverse().Skip(Math.Max(0, room.RoomData.RoomChat.Count() - 150)).Take(150).ToList();
                message.AppendShort(tempChatlogs.Count());
                foreach (var chatLog in tempChatlogs)
                {
                    chatLog.Serialize(ref message);
                }
                tempChatlogs = null;
            }
            else
            {
                DateTime Date = AzureEmulator.UnixToDateTime(1413672144);
                message.AppendInteger((DateTime.Now - Date).Seconds); // niet goed denk ik
                message.AppendInteger(1);
                message.AppendString("*Kamer is niet geladen!*");
                message.AppendString("");
                message.AppendBool(false);

            }
            return message;
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:43,代码来源:ModerationTool.cs

示例11: FreezeUser

        private void FreezeUser(RoomUser user)
        {
            if (user.IsBot || user.ShieldActive || user.Team == Team.None || user.Freezed)
                return;

            user.Freezed = true;
            user.FreezeCounter = 0;
            --user.FreezeLives;

            if (user.FreezeLives <= 0)
            {
                var serverMessage = new ServerMessage();
                serverMessage.Init(LibraryParser.OutgoingRequest("UpdateFreezeLivesMessageComposer"));
                serverMessage.AppendInteger(user.InternalRoomId);
                serverMessage.AppendInteger(user.FreezeLives);
                user.GetClient().SendMessage(serverMessage);
                user.ApplyEffect(-1);
                _room.GetGameManager().AddPointToTeam(user.Team, -10, user);
                var managerForFreeze = _room.GetTeamManagerForFreeze();
                managerForFreeze.OnUserLeave(user);
                user.Team = Team.None;
                if (ExitTeleport != null) _room.GetGameMap().TeleportToItem(user, ExitTeleport);
                user.Freezed = false;
                user.SetStep = false;
                user.IsWalking = false;
                user.UpdateNeeded = true;
                if (!managerForFreeze.BlueTeam.Any() && !managerForFreeze.RedTeam.Any() &&
                    !managerForFreeze.GreenTeam.Any() && managerForFreeze.YellowTeam.Any())
                    StopGame();
                else if (managerForFreeze.BlueTeam.Any() && !managerForFreeze.RedTeam.Any() &&
                         !managerForFreeze.GreenTeam.Any() && !managerForFreeze.YellowTeam.Any())
                    StopGame();
                else if (!managerForFreeze.BlueTeam.Any() && managerForFreeze.RedTeam.Any() &&
                         !managerForFreeze.GreenTeam.Any() && !managerForFreeze.YellowTeam.Any())
                    StopGame();
                else
                {
                    if (managerForFreeze.BlueTeam.Any() || managerForFreeze.RedTeam.Any() ||
                        !managerForFreeze.GreenTeam.Any() || managerForFreeze.YellowTeam.Any())
                        return;
                    StopGame();
                }
            }
            else
            {
                _room.GetGameManager().AddPointToTeam(user.Team, -10, user);
                user.ApplyEffect(12);
                var serverMessage = new ServerMessage();
                serverMessage.Init(LibraryParser.OutgoingRequest("UpdateFreezeLivesMessageComposer"));
                serverMessage.AppendInteger(user.InternalRoomId);
                serverMessage.AppendInteger(user.FreezeLives);
                user.GetClient().SendMessage(serverMessage);
            }
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:54,代码来源:Freeze.cs

示例12: NewHeightMap

        /// <summary>
        /// News the height map.
        /// </summary>
        /// <returns>ServerMessage.</returns>
        private ServerMessage NewHeightMap()
        {
            var serverMessage = new ServerMessage();
            serverMessage.Init(LibraryParser.OutgoingRequest("HeightMapMessageComposer"));
            serverMessage.AppendInteger(Model.MapSizeX);

            {
                serverMessage.AppendInteger(Model.MapSizeX * Model.MapSizeY);
                for (Int32 i = 0; i < Model.MapSizeY; i++)
                    for (Int32 j = 0; j < Model.MapSizeX; j++)
                        serverMessage.AppendShort((short)(SqAbsoluteHeight(j, i) * 256));
                //  serverMessage.AppendShort(this.Model.SqFloorHeight[j, i] * 256);
                return serverMessage;
            }
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:19,代码来源:Gamemap.cs

示例13: SerializeEventInfo

        /// <summary>
        /// Serializes the event information.
        /// </summary>
        /// <param name="roomId">The room identifier.</param>
        internal void SerializeEventInfo(uint roomId)
        {
            Room room = AzureEmulator.GetGame().GetRoomManager().GetRoom(roomId);
            if (room == null)
            {
                return;
            }
            RoomEvent @event = GetEvent(roomId);
            if (@event == null || @event.HasExpired)
            {
                return;
            }
            if (!RoomHasEvents(roomId))
            {
                return;
            }
            var serverMessage = new ServerMessage();
            serverMessage.Init(LibraryParser.OutgoingRequest("RoomEventMessageComposer"));
            serverMessage.AppendInteger(roomId);
            serverMessage.AppendInteger(room.RoomData.OwnerId);
            serverMessage.AppendString(room.RoomData.Owner);
            serverMessage.AppendInteger(1);
            serverMessage.AppendInteger(1);
            serverMessage.AppendString(@event.Name);
            serverMessage.AppendString(@event.Description);
            serverMessage.AppendInteger(0);
            serverMessage.AppendInteger(
                ((int)Math.Floor((@event.Time - AzureEmulator.GetUnixTimeStamp()) / 60.0)));

            serverMessage.AppendInteger(@event.Category);
            room.SendMessage(serverMessage);
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:36,代码来源:RoomEvents.cs

示例14: SendNewItems

 /// <summary>
 ///     Sends the new items.
 /// </summary>
 /// <param name="id">The identifier.</param>
 internal void SendNewItems(uint id)
 {
     var serverMessage = new ServerMessage();
     serverMessage.Init(LibraryParser.OutgoingRequest("NewInventoryObjectMessageComposer"));
     serverMessage.AppendInteger(1);
     serverMessage.AppendInteger(1);
     serverMessage.AppendInteger(1);
     serverMessage.AppendInteger(id);
     _mClient.SendMessage(serverMessage);
 }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:14,代码来源:InventoryComponent.cs

示例15: SerializeBotInventory

        /// <summary>
        ///     Serializes the bot inventory.
        /// </summary>
        /// <returns>ServerMessage.</returns>
        internal ServerMessage SerializeBotInventory()
        {
            var serverMessage = new ServerMessage();
            serverMessage.Init(LibraryParser.OutgoingRequest("BotInventoryMessageComposer"));

            serverMessage.AppendInteger(_inventoryBots.Count);
            foreach (RoomBot current in _inventoryBots.Values)
            {
                serverMessage.AppendInteger(current.BotId);
                serverMessage.AppendString(current.Name);
                serverMessage.AppendString(current.Motto);
                serverMessage.AppendString("m");
                serverMessage.AppendString(current.Look);
            }
            return serverMessage;
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:20,代码来源:InventoryComponent.cs


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