void AOnlineBeaconHost::RegisterHost(AOnlineBeaconHostObject* NewHostObject) { const FString& BeaconType = NewHostObject->GetBeaconType(); bool bFound = false; for (int32 HostIdx=0; HostIdx < Children.Num(); HostIdx++) { AOnlineBeaconHostObject* HostObject = Cast<AOnlineBeaconHostObject>(Children[HostIdx]); if (HostObject && HostObject->GetBeaconType() == BeaconType) { bFound = true; break; } } if (!bFound) { NewHostObject->SetOwner(this); OnBeaconSpawned(BeaconType).BindUObject(NewHostObject, &AOnlineBeaconHostObject::SpawnBeaconActor); OnBeaconConnected(BeaconType).BindUObject(NewHostObject, &AOnlineBeaconHostObject::ClientConnected); } else { UE_LOG(LogBeacon, Warning, TEXT("Beacon host type %s already exists"), *BeaconType); } }
AOnlineBeaconHostObject* AOnlineBeaconHost::GetHost(const FString& BeaconType) { for (int32 HostIdx=0; HostIdx < Children.Num(); HostIdx++) { AOnlineBeaconHostObject* HostObject = Cast<AOnlineBeaconHostObject>(Children[HostIdx]); if (HostObject && HostObject->GetBeaconType() == BeaconType) { return HostObject; } } return NULL; }