コード例 #1
0
        private static void parseDataMessageFromServer(NetIncomingMessage msg)
        {
            while ((long)msg.LengthBits - msg.Position >= 8L)
            {
                switch (msg.ReadByte())
                {
                case 0:
                    Game1.otherFarmers[msg.ReadInt64()].setMoving(msg.ReadByte());
                    break;

                case 1:
                    Game1.otherFarmers[msg.ReadInt64()].updatePositionFromServer(msg.ReadVector2());
                    break;

                case 2:
                    MultiplayerUtility.receivePlayerIntroduction(msg.ReadInt64(), msg.ReadString());
                    break;

                case 3:
                {
                    long key = msg.ReadInt64();
                    Game1.otherFarmers[key].FarmerSprite.CurrentToolIndex = msg.ReadInt32();
                    if (msg.ReadByte() == 1)
                    {
                        ((FarmerSprite)Game1.otherFarmers[key].sprite).animateBackwardsOnce(msg.ReadInt32(), msg.ReadFloat());
                        msg.ReadByte();
                    }
                    else
                    {
                        ((FarmerSprite)Game1.otherFarmers[key].sprite).animateOnce(msg.ReadInt32(), msg.ReadFloat(), (int)msg.ReadByte());
                    }
                    break;
                }

                case 4:
                    MultiplayerUtility.performObjectAlteration(msg.ReadInt16(), msg.ReadInt16(), msg.ReadByte(), msg.ReadByte(), msg.ReadInt32());
                    break;

                case 5:
                    MultiplayerUtility.warpCharacter(msg.ReadInt16(), msg.ReadInt16(), msg.ReadString(), msg.ReadByte(), msg.ReadInt64());
                    break;

                case 6:
                    MultiplayerUtility.performSwitchHeldItem(msg.ReadInt64(), msg.ReadByte(), (int)msg.ReadInt16());
                    break;

                case 7:
                    MultiplayerUtility.performToolAction(msg.ReadByte(), msg.ReadByte(), msg.ReadInt16(), msg.ReadInt16(), msg.ReadString(), msg.ReadByte(), msg.ReadInt16(), msg.ReadInt64());
                    break;

                case 8:
                    MultiplayerUtility.performDebrisPickup(msg.ReadInt32(), msg.ReadString(), msg.ReadInt64());
                    break;

                case 9:
                    MultiplayerUtility.performCheckAction(msg.ReadInt16(), msg.ReadInt16(), msg.ReadString(), msg.ReadInt64());
                    break;

                case 10:
                    MultiplayerUtility.receiveChatMessage(msg.ReadString(), msg.ReadInt64());
                    break;

                case 11:
                    MultiplayerUtility.receiveNameChange(msg.ReadString(), msg.ReadInt64());
                    break;

                case 12:
                    MultiplayerUtility.receiveTenMinuteSync(msg.ReadInt16());
                    break;

                case 13:
                    MultiplayerUtility.receiveBuildingChange(msg.ReadByte(), msg.ReadInt16(), msg.ReadInt16(), msg.ReadString(), msg.ReadInt64(), msg.ReadInt64());
                    break;

                case 14:
                    MultiplayerUtility.performDebrisCreate(msg.ReadInt16(), msg.ReadInt32(), msg.ReadInt32(), msg.ReadByte(), msg.ReadByte(), msg.ReadInt16(), msg.ReadInt16(), 0L);
                    break;

                case 15:
                    MultiplayerUtility.performNPCMove(msg.ReadInt32(), msg.ReadInt32(), msg.ReadInt64());
                    break;

                case 16:
                    MultiplayerUtility.performNPCBehavior(msg.ReadInt64(), msg.ReadByte());
                    break;

                case 17:
                    MultiplayerUtility.allFarmersReadyCheck();
                    break;

                case 18:
                    MultiplayerUtility.parseServerToClientsMessage(msg.ReadString());
                    break;

                case 19:
                    MultiplayerUtility.interpretMessageToEveryone(msg.ReadInt32(), msg.ReadString(), msg.ReadInt64());
                    break;
                }
            }
        }