Exemple #1
0
        public void SendSnapShot()
        {
            if (roomstate == 0)
            {
                return;
            }

            PlayerSyncDatas syncs = new PlayerSyncDatas();

            foreach (Player player in players.Values)
            {
                syncs.datas.Add(player.sync);
            }

            foreach (Player player in players.Values)
            {
                GSrv.Send(MessageType.Snapshot, GSrv.Serialize <PlayerSyncDatas>(syncs), player.connection, NetDeliveryMethod.UnreliableSequenced);
            }
        }
Exemple #2
0
        public void SnapshotHandler(NetConnection connection, object data)
        {
            PlayerSyncDatas datas = GCli.Deserialize <PlayerSyncDatas>((byte[])data);

            Players.UpdatePlayerSyncData(datas.datas);
        }