本文整理汇总了C++中GetNetMode函数的典型用法代码示例。如果您正苦于以下问题:C++ GetNetMode函数的具体用法?C++ GetNetMode怎么用?C++ GetNetMode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetNetMode函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ClientSlotSwap
void UGISInventoryBaseComponent::AddItemOnSlot(const FGISSlotInfo& TargetSlotType, const FGISSlotInfo& LastSlotType)
{
//Before we start swapping item, let's check if tags match!
if (!TargetSlotType.CurrentInventoryComponent->RequiredTags.MatchesAny(LastSlotType.CurrentInventoryComponent->OwnedTags, false))
return;
//next check should be against item tags, but that's later!
//Tabs.InventoryTabs[TargetSlotType.SlotTabIndex].TabSlots[TargetSlotType.SlotTabIndex].ItemData
if (TargetSlotType.CurrentInventoryComponent->Tabs.InventoryTabs[TargetSlotType.SlotTabIndex].TabSlots[TargetSlotType.SlotIndex].ItemData == nullptr)
{
TWeakObjectPtr<UGISItemData> TargetItem = LastSlotType.CurrentInventoryComponent->Tabs.InventoryTabs[LastSlotType.SlotTabIndex].TabSlots[LastSlotType.SlotIndex].ItemData;
TWeakObjectPtr<UGISItemData> LastItem = TargetSlotType.CurrentInventoryComponent->Tabs.InventoryTabs[TargetSlotType.SlotTabIndex].TabSlots[TargetSlotType.SlotIndex].ItemData; //Tabs.InventoryTabs[TargetSlotType.SlotTabIndex].TabSlots[TargetSlotType.SlotIndex].ItemData;
TargetSlotType.CurrentInventoryComponent->Tabs.InventoryTabs[TargetSlotType.SlotTabIndex].TabSlots[TargetSlotType.SlotIndex].ItemData = TargetItem;
LastSlotType.CurrentInventoryComponent->Tabs.InventoryTabs[LastSlotType.SlotTabIndex].TabSlots[LastSlotType.SlotIndex].ItemData = nullptr;
TargetItem->OnItemAddedToSlot();
//FGISSlotSwapInfo SlotSwapInfo;
SlotSwapInfo.LastSlotIndex = LastSlotType.SlotIndex;
SlotSwapInfo.LastTabIndex = LastSlotType.SlotTabIndex;
SlotSwapInfo.LastSlotData = LastItem;
SlotSwapInfo.LastSlotComponent = LastSlotType.CurrentInventoryComponent;
SlotSwapInfo.TargetSlotIndex = TargetSlotType.SlotIndex;
SlotSwapInfo.TargetTabIndex = TargetSlotType.SlotTabIndex;
SlotSwapInfo.TargetSlotData = TargetItem;
SlotSwapInfo.TargetSlotComponent = TargetSlotType.CurrentInventoryComponent;
if (GetNetMode() == ENetMode::NM_Standalone)
OnItemSlotSwapped.Broadcast(SlotSwapInfo);
ClientSlotSwap(SlotSwapInfo);
}
else
{
TWeakObjectPtr<UGISItemData> TargetItem = LastSlotType.CurrentInventoryComponent->Tabs.InventoryTabs[LastSlotType.SlotTabIndex].TabSlots[LastSlotType.SlotIndex].ItemData;
TWeakObjectPtr<UGISItemData> LastItem = TargetSlotType.CurrentInventoryComponent->Tabs.InventoryTabs[TargetSlotType.SlotTabIndex].TabSlots[TargetSlotType.SlotIndex].ItemData; //Tabs.InventoryTabs[TargetSlotType.SlotTabIndex].TabSlots[TargetSlotType.SlotIndex].ItemData;
TargetSlotType.CurrentInventoryComponent->Tabs.InventoryTabs[TargetSlotType.SlotTabIndex].TabSlots[TargetSlotType.SlotIndex].ItemData = TargetItem;
LastSlotType.CurrentInventoryComponent->Tabs.InventoryTabs[LastSlotType.SlotTabIndex].TabSlots[LastSlotType.SlotIndex].ItemData = LastItem;
TargetItem->OnItemAddedToSlot();
LastItem->OnItemAddedToSlot();
//FGISSlotSwapInfo SlotSwapInfo;
SlotSwapInfo.LastSlotIndex = LastSlotType.SlotIndex;
SlotSwapInfo.LastTabIndex = LastSlotType.SlotTabIndex;
SlotSwapInfo.LastSlotData = LastItem;
SlotSwapInfo.LastSlotComponent = LastSlotType.CurrentInventoryComponent;
SlotSwapInfo.TargetSlotIndex = TargetSlotType.SlotIndex;
SlotSwapInfo.TargetTabIndex = TargetSlotType.SlotTabIndex;
SlotSwapInfo.TargetSlotData = TargetItem;
SlotSwapInfo.TargetSlotComponent = TargetSlotType.CurrentInventoryComponent;
if (GetNetMode() == ENetMode::NM_Standalone)
OnItemSlotSwapped.Broadcast(SlotSwapInfo);
ClientSlotSwap(SlotSwapInfo);
}
}
开发者ID:1111joshua1111,项目名称:GameInventorySystemPlugin,代码行数:58,代码来源:GISInventoryBaseComponent.cpp
示例2: GetNetMode
void AARCharacter::PossessedBy(AController* NewController)
{
ARPController = Cast<AARPlayerController>(NewController);
if ((GetNetMode() == ENetMode::NM_Standalone
|| GetNetMode() == ENetMode::NM_Client)
&& ARPController)
{
Abilities->PCOwner = ARPController;
Abilities->InitializeGUI();
}
Super::PossessedBy(NewController);
}
开发者ID:DaedalusProspect,项目名称:ActionRPGGame,代码行数:12,代码来源:ARCharacter.cpp
示例3: DealDamage
void AShooterWeapon_Instant::ProcessInstantHit_Confirmed(const FHitResult& Impact, const FVector& Origin, const FVector& ShootDir, int32 RandomSeed, float ReticleSpread)
{
// handle damage
if (ShouldDealDamage(Impact.GetActor()))
{
DealDamage(Impact, ShootDir);
}
// play FX on remote clients
if (Role == ROLE_Authority)
{
HitNotify.Origin = Origin;
HitNotify.RandomSeed = RandomSeed;
HitNotify.ReticleSpread = ReticleSpread;
}
// play FX locally
if (GetNetMode() != NM_DedicatedServer)
{
const FVector EndTrace = Origin + ShootDir * InstantConfig.WeaponRange;
const FVector EndPoint = Impact.GetActor() ? Impact.ImpactPoint : EndTrace;
SpawnTrailEffect(EndPoint);
SpawnImpactEffects(Impact);
}
}
开发者ID:t-p-tan,项目名称:CS4350-Die-Another-Day,代码行数:26,代码来源:ShooterWeapon_Instant.cpp
示例4: ProcessInstantHit
void AShooterWeapon_Instant::ProcessInstantHit(const FHitResult& Impact, const FVector& Origin, const FVector& ShootDir, int32 RandomSeed, float ReticleSpread)
{
if (MyPawn && MyPawn->IsLocallyControlled() && GetNetMode() == NM_Client)
{
// if we're a client and we've hit something that is being controlled by the server
if (Impact.GetActor() && Impact.GetActor()->GetRemoteRole() == ROLE_Authority)
{
// notify the server of the hit
ServerNotifyHit(Impact, ShootDir, RandomSeed, ReticleSpread);
}
else if (Impact.GetActor() == NULL)
{
if (Impact.bBlockingHit)
{
// notify the server of the hit
ServerNotifyHit(Impact, ShootDir, RandomSeed, ReticleSpread);
}
else
{
// notify server of the miss
ServerNotifyMiss(ShootDir, RandomSeed, ReticleSpread);
}
}
}
// process a confirmed hit
ProcessInstantHit_Confirmed(Impact, Origin, ShootDir, RandomSeed, ReticleSpread);
}
开发者ID:t-p-tan,项目名称:CS4350-Die-Another-Day,代码行数:28,代码来源:ShooterWeapon_Instant.cpp
示例5: GetWorld
void APawn::PostInitializeComponents()
{
Super::PostInitializeComponents();
if (!IsPendingKill())
{
GetWorld()->AddPawn( this );
// Automatically add Controller to AI Pawns if we are allowed to.
if (AutoPossessPlayer == EAutoReceiveInput::Disabled)
{
if (AutoPossessAI != EAutoPossessAI::Disabled && Controller == NULL && GetNetMode() != NM_Client)
{
const bool bPlacedInWorld = (GetWorld()->bStartup);
if ((AutoPossessAI == EAutoPossessAI::PlacedInWorldOrSpawned) ||
(AutoPossessAI == EAutoPossessAI::PlacedInWorld && bPlacedInWorld) ||
(AutoPossessAI == EAutoPossessAI::Spawned && !bPlacedInWorld))
{
SpawnDefaultController();
}
}
}
// update movement component's nav agent values
UpdateNavAgent();
}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:27,代码来源:Pawn.cpp
示例6: PreInitializeComponents
void APawn::PreInitializeComponents()
{
Super::PreInitializeComponents();
if (Instigator == nullptr)
{
Instigator = this;
}
if (AutoPossessPlayer != EAutoReceiveInput::Disabled && GetNetMode() != NM_Client )
{
const int32 PlayerIndex = int32(AutoPossessPlayer.GetValue()) - 1;
APlayerController* PC = UGameplayStatics::GetPlayerController(this, PlayerIndex);
if (PC)
{
PC->Possess(this);
}
else
{
GetWorld()->PersistentLevel->RegisterActorForAutoReceiveInput(this, PlayerIndex);
}
}
UpdateNavigationRelevance();
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:26,代码来源:Pawn.cpp
示例7: ForceNetUpdate
void APawn::PossessedBy(AController* NewController)
{
AController* const OldController = Controller;
Controller = NewController;
ForceNetUpdate();
if (Controller->PlayerState != NULL)
{
PlayerState = Controller->PlayerState;
}
if (APlayerController* PlayerController = Cast<APlayerController>(Controller))
{
if (GetNetMode() != NM_Standalone)
{
SetReplicates(true);
SetAutonomousProxy(true);
}
}
else
{
CopyRemoteRoleFrom(GetDefault<APawn>());
}
// dispatch Blueprint event if necessary
if (OldController != NewController)
{
ReceivePossessed(Controller);
}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:31,代码来源:Pawn.cpp
示例8: PreInitializeComponents
void AWorldSettings::PreInitializeComponents()
{
Super::PreInitializeComponents();
// create the emitter pool
// we only need to do this for the persistent level's WorldSettings as sublevel actors will have their WorldSettings set to it on association
if (GetNetMode() != NM_DedicatedServer && IsInPersistentLevel())
{
UWorld* World = GetWorld();
check(World);
// only create once -
if (World->MyParticleEventManager == NULL && !GEngine->ParticleEventManagerClassPath.IsEmpty())
{
TSubclassOf<AParticleEventManager> ParticleEventManagerClass = Cast<UClass>(StaticLoadObject(UClass::StaticClass(), NULL, *GEngine->ParticleEventManagerClassPath, NULL, LOAD_NoWarn, NULL));
if (ParticleEventManagerClass != NULL)
{
FActorSpawnParameters SpawnParameters;
SpawnParameters.Owner = this;
SpawnParameters.Instigator = Instigator;
World->MyParticleEventManager = World->SpawnActor<AParticleEventManager>(ParticleEventManagerClass, SpawnParameters );
}
}
}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:25,代码来源:WorldSettings.cpp
示例9: GetSlotsInTab
void UGISInventoryBaseComponent::CopyItemsFromOtherInventoryTab(class UGISInventoryBaseComponent* OtherIn, int32 OtherTabIndex, int32 TargetTabIndex)
{
if (OtherIn)
{
int32 OtherSlotCount = OtherIn->GetSlotsInTab(OtherTabIndex);
int32 TargetSlotCount = GetSlotsInTab(TargetTabIndex);
if (OtherSlotCount > TargetSlotCount)
{
for (int32 Index = 0; Index < TargetSlotCount; Index++)
{
SetItemDataInSlot(TargetTabIndex, Index, OtherIn->GetItemDataInSlot(OtherTabIndex,Index));
OnCopyItemsFromOtherInventoryTab(Tabs.InventoryTabs[TargetTabIndex].TabSlots[Index].ItemData);
}
}
else
{
for (int32 Index = 0; Index < OtherSlotCount; Index++)
{
SetItemDataInSlot(TargetTabIndex, Index, OtherIn->GetItemDataInSlot(OtherTabIndex, Index));
OnCopyItemsFromOtherInventoryTab(Tabs.InventoryTabs[TargetTabIndex].TabSlots[Index].ItemData);
}
}
TabUpdateInfo.ReplicationCounter++;
TabUpdateInfo.TargetTabIndex = TargetTabIndex;
if (GetNetMode() == ENetMode::NM_Standalone)
OnTabChanged.ExecuteIfBound(TabUpdateInfo.TargetTabIndex);
}
}
开发者ID:Chooka,项目名称:ActionRPGGame,代码行数:28,代码来源:GISInventoryBaseComponent.cpp
示例10: GetOwnerRole
void UGISInventoryBaseComponent::InitializeWidgets(APlayerController* PCIn)
{
ENetRole CurrentRole = GetOwnerRole();
ENetMode CurrentNetMode = GetNetMode();
if (CurrentRole < ROLE_Authority || CurrentNetMode == ENetMode::NM_Standalone)
{
if (InventoryConfiguration.IsValid())
{
InventoryContainer = CreateWidget<UGISContainerBaseWidget>(PCIn, InventoryConfiguration.InventoryContainerClass);
if (InventoryContainer)
{
InventoryContainer->InitializeContainer(InventoryConfiguration, this, PCIn);
InventoryContainer->SetVisibility(InventoryConfiguration.InventoryVisibility);
//call last
}
}
if (LootConfiguration.IsValid())
{
LootWidget = CreateWidget<UGISLootContainerBaseWidget>(PCIn, LootConfiguration.LootWidgetClass);
if (LootWidget)
{
LootWidget->InitializeLootWidget(LootConfiguration, this, PCIn);
LootWidget->SetVisibility(LootConfiguration.LootWindowVisibility);
}
}
}
}
开发者ID:Chooka,项目名称:ActionRPGGame,代码行数:29,代码来源:GISInventoryBaseComponent.cpp
示例11: GetWorld
void ANTPlayerController::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
AccumulativeDeltaTime += DeltaSeconds;
// If we're the Client and we haven't updated Ping in a while, try to get a ping update
const float LocTimeSec = GetWorld()->GetTimeSeconds();
if (((LocTimeSec - LastPingCalcTime) > 0.5f) && (GetNetMode() == NM_Client))
{
LastPingCalcTime = LocTimeSec;
ServerBouncePing(LocTimeSec);
}
if (PlayerState)
{
if (Role == ROLE_Authority && !IsLocalController())
{
GEngine->AddOnScreenDebugMessage(-1, DeltaSeconds, FColor::Blue, FString::Printf(TEXT("Server Ping %f - TimeStamp %i"), PlayerState->ExactPing, GetLocalTime()));
}
else if (Role < ROLE_Authority)
{
GEngine->AddOnScreenDebugMessage(-1, DeltaSeconds, FColor::Green, FString::Printf(TEXT("Client Ping %f - TimeStamp %i"), PlayerState->ExactPing, GetNetworkTime()));
}
}
}
开发者ID:Snowcrash5,项目名称:NetworkedPhysics,代码行数:26,代码来源:NTPlayerController.cpp
示例12: onPickedUp
void AFPSGWeapon::onPickedUp(class AActor* otherActor)
{
GEngine->AddOnScreenDebugMessage(-1, 6.0f, FColor::Red, "AFPSGWeapon::onPickedUp");
/*
* Overlaps on AFPSGWeapon will only be executed on the server since only the server owns the boxCollisionComponent
*/
//Just return if we are a client (should not happen, but checks just in case)
if (Role < ROLE_Authority && GetNetMode() == NM_Client)
{
return;
}
// Get the character that picked up the weapon
AFPSGCharacter* theCharacter = Cast<AFPSGCharacter>(otherActor);
if (theCharacter != NULL)
{
if (GEngine != NULL)
{
//GEngine->AddOnScreenDebugMessage(-1, 6.0f, FColor::Red, TEXT("AFPSGWeapon::onPickedUp"));
}
theCharacter->manageWeapon(this);
}
}
开发者ID:Gardern,项目名称:FPSGame_code,代码行数:26,代码来源:FPSGWeapon.cpp
示例13: GetWorld
void AGameplayDebuggingReplicator::TickActor(float DeltaTime, enum ELevelTick TickType, FActorTickFunction& ThisTickFunction)
{
Super::TickActor(DeltaTime, TickType, ThisTickFunction);
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
UWorld* World = GetWorld();
if (!IsGlobalInWorld() || !World || GetNetMode() == ENetMode::NM_Client || !IGameplayDebugger::IsAvailable())
{
// global level replicator don't have any local player and it's prepared to work only on servers
return;
}
UGameInstance* GameInstance = World->GetGameInstance();
if (!GameInstance || !World->IsGameWorld())
{
return;
}
PlayerControllersUpdateDelay -= DeltaTime;
if (PlayerControllersUpdateDelay <= 0)
{
for (FConstPlayerControllerIterator Iterator = World->GetPlayerControllerIterator(); Iterator; Iterator++)
{
APlayerController* PC = *Iterator;
if (PC)
{
IGameplayDebugger& Debugger = IGameplayDebugger::Get();
Debugger.CreateGameplayDebuggerForPlayerController(PC);
}
}
PlayerControllersUpdateDelay = 5;
}
#endif
}
开发者ID:PopCap,项目名称:GameIdea,代码行数:34,代码来源:GameplayDebuggingReplicator.cpp
示例14: CalculateReloadAmmo
void AGWWeaponRanged::EndReload()
{
if (Role < ROLE_Authority)
{
if (!CheckIfCanReload())
return;
CalculateReloadAmmo();
ServerEndReload();
}
else
{
/*
Impelemtnsome reload mechanic..
1. Where is ammo coming from ?
2. How it is setup ?
3. Does weapon have it's own magazine max ammo count, or is it stored externally ?
*/
if (!CheckIfCanReload())
return;
CalculateReloadAmmo();
ReloadEndCount++;
if (GetNetMode() == ENetMode::NM_Standalone)
OnRep_ReloadEnd();
}
}
开发者ID:HaoDrang,项目名称:ActionRPGGame,代码行数:25,代码来源:GWWeaponRanged.cpp
示例15: onClickEndGame
void AFPSGPlayerController::onClickEndGame() const
{
//Make sure it is the server calling the function
if (Role < ROLE_Authority && GetNetMode() == NM_Client) return;
//GEngine->AddOnScreenDebugMessage(-1, 40.0f, FColor::Cyan, "AFPSGPlayerController::onClickEndGame");
IOnlineSubsystem* onlineSubsystem = IOnlineSubsystem::Get();
IOnlineSessionPtr sessions = onlineSubsystem != NULL ? onlineSubsystem->GetSessionInterface() : NULL;
if (sessions.IsValid())
{
UWorld* world = GetWorld();
AFPSGGameState* gameState = world != NULL ? world->GetGameState<AFPSGGameState>() : NULL;
if (gameState != NULL)
{
//Retrieve the session state and match state
EOnlineSessionState::Type sessionState = sessions->GetSessionState(GameSessionName);
FName matchState = gameState->GetMatchState();
//Only attempt to end the game if both the session and match are in progress
if (sessionState == EOnlineSessionState::Type::InProgress && matchState == MatchState::InProgress)
{
gameState->onClickEndGame();
}
}
}
}
开发者ID:Gardern,项目名称:FPSGame_code,代码行数:29,代码来源:FPSGPlayerController.cpp
示例16: GetMaxHealth
void ANimModCharacter::PostInitializeComponents()
{
Super::PostInitializeComponents();
if (Role == ROLE_Authority)
{
Health = GetMaxHealth();
SpawnDefaultInventory();
}
// set initial mesh visibility (3rd person view)
UpdatePawnMeshes();
// create material instance for setting team colors (3rd person view)
for (int32 iMat = 0; iMat < GetMesh()->GetNumMaterials(); iMat++)
{
MeshMIDs.Add(GetMesh()->CreateAndSetMaterialInstanceDynamic(iMat));
}
// play respawn effects
if (GetNetMode() != NM_DedicatedServer)
{
if (RespawnFX)
{
UGameplayStatics::SpawnEmitterAtLocation(this, RespawnFX, GetActorLocation(), GetActorRotation());
}
if (RespawnSound)
{
UGameplayStatics::PlaySoundAtLocation(this, RespawnSound, GetActorLocation());
}
}
}
开发者ID:Nimgoble,项目名称:NimMod,代码行数:33,代码来源:NimModCharacter.cpp
示例17: ServerAddItemToInventory
void UGISInventoryBaseComponent::AddItemToInventory(class UGISItemData* ItemIn)
{
if (GetOwnerRole() < ROLE_Authority)
{
ServerAddItemToInventory(ItemIn);
}
else
{
//add item to first empty slot in first matching tab.
for (FGISTabInfo& TabInfo : Tabs.InventoryTabs)
{
for (FGISSlotInfo& Slot : TabInfo.TabSlots)
{
if (Slot.ItemData == nullptr)
{
Slot.ItemData = ItemIn;
//Slot.ItemData->OnItemRemovedFromSlot();
SlotUpdateInfo.TabIndex = TabInfo.TabIndex;
SlotUpdateInfo.SlotIndex = Slot.SlotIndex;
SlotUpdateInfo.SlotData = Slot.ItemData;
SlotUpdateInfo.SlotComponent = this;
if (GetNetMode() == ENetMode::NM_Standalone)
OnItemAdded.Broadcast(SlotUpdateInfo);
ClientUpdateInventory(SlotUpdateInfo);
return;
}
}
}
}
}
开发者ID:1111joshua1111,项目名称:GameInventorySystemPlugin,代码行数:31,代码来源:GISInventoryBaseComponent.cpp
示例18: InitPlayerState
void AController::InitPlayerState()
{
if ( GetNetMode() != NM_Client )
{
UWorld* const World = GetWorld();
AGameMode* const GameMode = World ? World->GetAuthGameMode() : NULL;
if (GameMode != NULL)
{
FActorSpawnParameters SpawnInfo;
SpawnInfo.Owner = this;
SpawnInfo.Instigator = Instigator;
SpawnInfo.bNoCollisionFail = true;
SpawnInfo.ObjectFlags |= RF_Transient; // We never want player states to save into a map
PlayerState = World->SpawnActor<APlayerState>(GameMode->PlayerStateClass, SpawnInfo );
// force a default player name if necessary
if (PlayerState && PlayerState->PlayerName.IsEmpty())
{
// don't call SetPlayerName() as that will broadcast entry messages but the GameMode hasn't had a chance
// to potentially apply a player/bot name yet
PlayerState->PlayerName = GameMode->DefaultPlayerName.ToString();
}
}
}
}
开发者ID:johndpope,项目名称:UE4,代码行数:25,代码来源:Controller.cpp
示例19: BindDynamicMaterial
void ARadiantWebViewActor::BindDynamicMaterial()
{
if ((GetNetMode() != NM_DedicatedServer) && MeshComponent && (WebViewRenderComponent->WebView->WebViewCanvas))
{
if (OldMeshMaterial)
{
MeshComponent->SetMaterial(OldMaterialIndex, OldMeshMaterial);
}
OldMeshMaterial = MeshComponent->GetMaterial(MaterialIndex);
if (WebViewMID)
{
WebViewMID->MarkPendingKill();
}
if (ReplaceMaterial)
{
WebViewMID = UMaterialInstanceDynamic::Create(ReplaceMaterial, GetTransientPackage());
}
else if (OldMeshMaterial)
{
WebViewMID = UMaterialInstanceDynamic::Create(OldMeshMaterial, GetTransientPackage());
}
if (WebViewMID)
{
WebViewMID->SetTextureParameterValue(TEXT("WebViewTexture"), WebViewRenderComponent->WebView->WebViewCanvas->RenderTargetTexture);
}
}
}
开发者ID:LeGone,项目名称:RadiantUI,代码行数:31,代码来源:RadiantWebViewActor.cpp
示例20: GetNetMode
void AGameNetworkManager::UpdateNetSpeeds(bool bIsLanMatch)
{
// Don't adjust net speeds for LAN matches or dedicated servers
ENetMode NetMode = GetNetMode();
if ( (NetMode == NM_DedicatedServer) || (NetMode == NM_Standalone) || bIsLanMatch )
{
return;
}
if ( GetWorld()->TimeSeconds - LastNetSpeedUpdateTime < 1.0f )
{
GetWorldTimerManager().SetTimer(TimerHandle_UpdateNetSpeedsTimer, this, &AGameNetworkManager::UpdateNetSpeedsTimer, 1.0f);
return;
}
LastNetSpeedUpdateTime = GetWorld()->TimeSeconds;
int32 NewNetSpeed = CalculatedNetSpeed();
UE_LOG(LogNet, Log, TEXT("New Dynamic NetSpeed %i vs old %i"), NewNetSpeed, AdjustedNetSpeed);
if ( AdjustedNetSpeed != NewNetSpeed )
{
AdjustedNetSpeed = NewNetSpeed;
for( FConstPlayerControllerIterator Iterator = GetWorld()->GetPlayerControllerIterator(); Iterator; ++Iterator )
{
(*Iterator)->SetNetSpeed(AdjustedNetSpeed);
}
}
}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:29,代码来源:GameNetworkManager.cpp
注:本文中的GetNetMode函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论