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


C# NetworkMessage类代码示例

本文整理汇总了C#中NetworkMessage的典型用法代码示例。如果您正苦于以下问题:C# NetworkMessage类的具体用法?C# NetworkMessage怎么用?C# NetworkMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ToNetworkMessage

 public override void ToNetworkMessage(NetworkMessage msg)
 {
     msg.AddByte((byte)Type);
     msg.AddLocation(FromLocation);
     msg.AddByte(FromStackPosition);
     msg.AddLocation(ToLocation);
 }
开发者ID:Xileck,项目名称:tibiaapi,代码行数:7,代码来源:CreatureMovePacket.cs

示例2: ToNetworkMessage

 public override void ToNetworkMessage(NetworkMessage msg)
 {
     msg.AddByte((byte)Type);
     msg.AddUInt32(CreatureId);
     msg.AddByte(LightLevel);
     msg.AddByte(LightColor);
 }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:7,代码来源:CreatureLightPacket.cs

示例3: AddMessageToSend

 public void AddMessageToSend(NetworkMessage mes)
 {
     lock (messageQueue)
     {
         messageQueue.Enqueue(mes);
     }
 }
开发者ID:kamiljano,项目名称:PCRemote,代码行数:7,代码来源:MouseController.xaml.cs

示例4: OnConnected

	void OnConnected(NetworkMessage msg)
	{
		Debug.Log (string.Format("Connected to Server"));
		connectionIdMessage connIdMsg = new connectionIdMessage ();
		connIdMsg.setConnId (client.connection.connectionId);
		client.Send(Message.GET_HAS_ROOM, connIdMsg);
	}
开发者ID:AE2GRP-CH,项目名称:game,代码行数:7,代码来源:MainMenu.cs

示例5: OnSetupGameOver

    public static void OnSetupGameOver(NetworkMessage netMsg)
    {
        var msg = netMsg.ReadMessage<PlayerMessage>();

        var gameOver = msg.player.GetComponent<PlayerRespawn>();
        gameOver.anim = GameObject.Find("HUDCanvas").GetComponent<Animator>();
    }
开发者ID:dshook,项目名称:chaos-king,代码行数:7,代码来源:GameSetup.cs

示例6: ParseMessage

        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)OutgoingPacketType.AutoWalk)
                return false;

            Destination = destination;
            Type = OutgoingPacketType.AutoWalk;

            Directions = new List<Pokemon.Constants.Direction> { };
            byte count = msg.GetByte();

            for (int i = 0; i < count; i++)
            {
                Constants.Direction direction;
                byte dir = msg.GetByte();

                switch (dir)
                {
                    case 1: direction = Pokemon.Constants.Direction.Right; break;
                    case 2: direction = Pokemon.Constants.Direction.UpRight; break;
                    case 3: direction = Pokemon.Constants.Direction.Up; break;
                    case 4: direction = Pokemon.Constants.Direction.UpLeft; break;
                    case 5: direction = Pokemon.Constants.Direction.Left; break;
                    case 6: direction = Pokemon.Constants.Direction.DownLeft; break;
                    case 7: direction = Pokemon.Constants.Direction.Down; break;
                    case 8: direction = Pokemon.Constants.Direction.DownRight; break;
                    default: continue;
                }

                Directions.Add(direction);
            }

            return true;
        }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:34,代码来源:AutoWalkPacket.cs

示例7: ParseMessage

        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.ChannelOpen)
                return false;

            Destination = destination;
            Type = IncomingPacketType.ChannelOpen;

            ChannelId = (ChatChannel)msg.GetUInt16();
            ChannelName = msg.GetString();

            if (Client.VersionNumber >= 872)
            {
                NumberOfParticipants = msg.GetUInt16();
                for (ushort p = 0; p < NumberOfParticipants; p++)
                {
                    Participants[p] = msg.GetString();
                }
                NumberOfInvitees = msg.GetUInt16();
                for (ushort i = 0; i < NumberOfInvitees; i++)
                {
                    Invitees[i] = msg.GetString();
                }
            }

            return true;
        }
开发者ID:Xileck,项目名称:tibiaapi,代码行数:29,代码来源:ChannelOpenPacket.cs

示例8: ParseMessage

        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.ContainerOpen)
                return false;

            Destination = destination;
            Type = IncomingPacketType.ContainerOpen;

            Id = msg.GetByte();
            ItemId = msg.GetUInt16();
            Name = msg.GetString();
            Capacity = msg.GetByte();
            HasParent = msg.GetByte();
            ItemCount = msg.GetByte();

            Items = new List<Tibia.Objects.Item>(ItemCount);

            for (int i = 0; i < ItemCount; i++)
            {
                Objects.Item item = msg.GetItem();
                item.Location = Tibia.Objects.ItemLocation.FromContainer(Id, (byte)i);
                Items.Add(item);
            }

            return true;
        }
开发者ID:Xileck,项目名称:tibiaapi,代码行数:28,代码来源:ContainerOpenPacket.cs

示例9: OnPlayerExperience

        public static void OnPlayerExperience(NetworkMessage netMsg)
        {
            var msg = netMsg.ReadMessage<PlayerExperienceMessage>();

            //Seems like the server is receiving the message as well
            FloatingTextManager.PlayerXp(msg.amount, msg.position);
        }
开发者ID:dshook,项目名称:chaos-king,代码行数:7,代码来源:PlayerLevel.cs

示例10: LogIn

    void LogIn(NetworkMessage netMsg, InfoMessage msg)
    {
        bool loggedIn = false;
        string query = "SELECT * FROM shogi.players WHERE players_email = \"" + msg.email + "\"";
        if (con.State.ToString () != "Open")
            con.Open ();

        using (con) {

            using (cmd = new MySqlCommand (query, con)) {
                rdr = cmd.ExecuteReader();
                if (rdr.HasRows) {
                    rdr.Read ();
                    if (msg.password == rdr["players_password"].ToString ()) {
                        incomeMessages.text += netMsg.conn.address + " logged in as " + msg.email + "\n";
                        loggedIn = true;
                    }
                    else
                        incomeMessages.text += netMsg.conn.address + " failed logging in for wrong password " + msg.password + "\n";
                }
                else
                    incomeMessages.text += netMsg.conn.address + " failed logging in for no entry " + msg.email + "\n";
                rdr.Dispose ();
            }

            string queryIP = "UPDATE shogi.players SET players_ip = \"" + netMsg.conn.address + "\" WHERE players_email = \"" + msg.email + "\"";
            if (loggedIn) {
                using (cmd = new MySqlCommand (queryIP, con))
                    cmd.ExecuteNonQuery ();
                msg.goal = "loggedin";
                NetworkServer.SendToClient(netMsg.conn.connectionId, MyMsgType.Info, msg);
            }
        }
    }
开发者ID:Fayanzar,项目名称:ShogiServer,代码行数:34,代码来源:InitNetwork.cs

示例11: ParseMessage

        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.PlayerStatus)
                return false;

            Destination = destination;
            Type = IncomingPacketType.PlayerStatus;

            Health = msg.GetUInt16();
            MaxHealth = msg.GetUInt16();
            PokemonsCount = msg.GetUInt32();

            Experience = msg.GetUInt32();

            Level = msg.GetUInt16();

            LevelPercent = msg.GetByte();

            Pokemons = msg.GetUInt16();
            PokemonsMax = msg.GetUInt16();

            MagicLevel = msg.GetByte();
            MagicLevelPercent = msg.GetByte();
            Soul = msg.GetByte();

            Stamina = msg.GetUInt16();

            return true;
        }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:31,代码来源:PlayerStatusPacket.cs

示例12: ToNetworkMessage

        public override void ToNetworkMessage(NetworkMessage msg)
        {
            msg.AddByte((byte)Type);

            msg.AddUInt16(ChannelId);
            msg.AddString(Name);
        }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:7,代码来源:PrivateChannelCreatePacket.cs

示例13: ToNetworkMessage

 public override void ToNetworkMessage(NetworkMessage msg)
 {
     msg.AddByte((byte)Type);
     msg.AddUInt32(PlayerId);
     msg.AddString(PlayerName);
     msg.AddByte(PlayerState);
 }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:7,代码来源:VipStatePacket.cs

示例14: ToNetworkMessage

        public override void ToNetworkMessage(NetworkMessage msg)
        {
            msg.AddByte((byte)Type);

            msg.AddUInt16(Health);
            msg.AddUInt16(MaxHealth);
            msg.AddUInt32(Capacity);

            if (Client.VersionNumber >= 870)
            {
                msg.AddUInt64(Experience);
            }
            else
            {
                msg.AddUInt32((uint)Experience);
            }

            msg.AddUInt16(Level);

            msg.AddByte(LevelPercent);

            msg.AddUInt16(Mana);
            msg.AddUInt16(MaxMana);

            msg.AddByte(MagicLevel);
            msg.AddByte(MagicLevelPercent);
            msg.AddByte(Soul);

            msg.AddUInt16(Stamina);
        }
开发者ID:Xileck,项目名称:tibiaapi,代码行数:30,代码来源:PlayerStatusPacket.cs

示例15: ParseMessage

        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.OutfitWindow)
                return false;

            Destination = destination;
            Type = IncomingPacketType.OutfitWindow;

            Default = msg.GetOutfit();

            byte count = msg.GetByte();
            OutfitList = new List<AvalibleOutfit> { };

            for (int i = 0; i < count; i++)
            {
                AvalibleOutfit outfit = new AvalibleOutfit();

                outfit.Id = msg.GetUInt16();
                outfit.Name = msg.GetString();
                outfit.Addons = msg.GetByte();

                OutfitList.Add(outfit);
            }

            return true;
        }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:28,代码来源:OutfitWindowPacket.cs


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