コード例 #1
0
        private void Sync()
        {
            int iteration = 0;

            while (_opened)
            {
                iteration++;

                // TODO: Make this update when a user leaves or something
                Thread.Sleep((int)(_userSyncTime * 1000) / 3);

                SetMasterClient();

                Messaging.instance.SendNetworkPlayers(ByteParser.ConvertNetworkPlayersToBytes(clientSockets.Values.ToArray()), clientSockets, 2);

                Thread.Sleep((int)(_userSyncTime * 1000) / 3);

                Messaging.instance.SendServerData(ByteParser.ConvertKeyValuePairsToData(serverData.ToArray()), clientSockets, 2);

                Thread.Sleep((int)(_userSyncTime * 1000) / 3);

                SyncUser(2);
            }
        }