コード例 #1
0
        private void LogReceivedStateDelta(NetworkedGameState networkedGameState)
        {
            OsFps.Logger.Log(networkedGameState.SequenceNumber);

            for (var i = 0; i < networkedGameState.NetworkedComponentTypeInfos.Count; i++)
            {
                var networkedComponentTypeInfo = networkedGameState.NetworkedComponentTypeInfos[i];
                var networkedComponentInfos    = networkedGameState.NetworkedComponentInfoLists[i];

                foreach (var componentInfo in networkedComponentInfos)
                {
                    var synchronizedFieldNames = BitUtilities.GetSetBitIndices(componentInfo.ChangeMask)
                                                 .Select(bitIndex =>
                    {
                        if (bitIndex >= networkedComponentTypeInfo.ThingsToSynchronize.Count)
                        {
                            return(null);
                        }

                        var thingToSynchronize = networkedComponentTypeInfo.ThingsToSynchronize[bitIndex];
                        var thingName          = (thingToSynchronize.FieldInfo != null)
                                ? thingToSynchronize.FieldInfo.Name
                                : thingToSynchronize.PropertyInfo.Name;
                        return(thingName);
                    })
                                                 .Where(x => x != null)
                                                 .ToArray();

                    OsFps.Logger.Log(networkedComponentTypeInfo.StateType.Name + ": " + Convert.ToString(componentInfo.ChangeMask, 2) + " | " + string.Join(", ", synchronizedFieldNames));
                }
            }
        }