コード例 #1
0
    private void UpdateMove(NetIncomingMessage incmsg)
    {
        string name = incmsg.ReadString();
        World  w    = serverCore.GetWorld();

        for (int i = 0; i < w.ships.Count; i++)
        {
            if (w.ships[i].shipName.Equals(name))
            {
                w.ships[i].timeOut        = 0;
                w.ships[i].cursorPosition = new Vector2(incmsg.ReadSingle(), incmsg.ReadSingle());
                w.ships[i].isWPress       = incmsg.ReadBoolean();
                w.ships[i].isSPress       = incmsg.ReadBoolean();
                w.ships[i].isAPress       = incmsg.ReadBoolean();
                w.ships[i].isDPress       = incmsg.ReadBoolean();
                w.ships[i].isXPress       = incmsg.ReadBoolean();
                w.ships[i].isLeftPress    = incmsg.ReadBoolean();
                w.ships[i].isRightPress   = incmsg.ReadBoolean();
                return;
            }
        }
        NetOutgoingMessage outmsg = serverCore.CreateMessage();

        outmsg.Write((byte)PacketType.DestroyShip);
        outmsg.Write(name);
        ServerPacketSender.SendMessageTo(outmsg, incmsg.SenderConnection);
    }