public void SyncThingsToJoiningPlayer(int playerIndex) { foreach (KeyValuePair <ushort, ICreativePower> item in _powersById) { NetPacket packet = NetCreativePowerPermissionsModule.SerializeCurrentPowerPermissionLevel(item.Key, (int)item.Value.CurrentPermissionLevel); NetManager.Instance.SendToClient(packet, playerIndex); } foreach (KeyValuePair <ushort, ICreativePower> item2 in _powersById) { (item2.Value as IOnPlayerJoining)?.OnPlayerJoining(playerIndex); } }
public void SyncThingsToJoiningPlayer(int playerIndex) { foreach (KeyValuePair <ushort, ICreativePower> keyValuePair in this._powersById) { NetPacket packet = NetCreativePowerPermissionsModule.SerializeCurrentPowerPermissionLevel(keyValuePair.Key, (int)keyValuePair.Value.CurrentPermissionLevel); NetManager.Instance.SendToClient(packet, playerIndex); } foreach (KeyValuePair <ushort, ICreativePower> keyValuePair in this._powersById) { if (keyValuePair.Value is IOnPlayerJoining onPlayerJoining) { onPlayerJoining.OnPlayerJoining(playerIndex); } } }