您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetNetMode函数代码示例

51自学网 2021-06-01 21:11:25
  C++
这篇教程C++ GetNetMode函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GetNetMode函数的典型用法代码示例。如果您正苦于以下问题:C++ GetNetMode函数的具体用法?C++ GetNetMode怎么用?C++ GetNetMode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GetNetMode函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例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,


示例21: ServerGiveAbilityAndInsert

void UGSAbilitiesComponent::GiveAbilityAndInsert(TSubclassOf<class  UGSAbility> AbilityIn){	if (GetOwnerRole() < ROLE_Authority)	{		ServerGiveAbilityAndInsert(AbilityIn);	}	else	{		int32 abIndex = AddAbilityToActiveList(AbilityIn);		if (abIndex != -1)		{			for (FGSAbilitiesSets& set : AbilitySets)			{				for (FGSAbilitySlot& slot : set.AbilitySlots)				{					if (slot.AbilityIndex == -1)					{						set.RepMe++;						slot.AbilityIndex = abIndex;						if (GetNetMode() == ENetMode::NM_Standalone)							OnAbilityAddedToSet.ExecuteIfBound();												return;					}				}			}		}	}}
开发者ID:zimzimdz,项目名称:ActionRPGGame,代码行数:30,


示例22: ServerGiveAbility

void UGSAbilitiesComponent::GiveAbility(TSubclassOf<class  UGSAbility> AbilityIn){	if (GetOwnerRole() < ROLE_Authority)	{		ServerGiveAbility(AbilityIn);	}	else	{		//ok this is very basic implementation, which will simply add ability to the first available slot.		for (FGSAbilityBookTab& tab : OwnedAbilities.AbilitiesTab)		{			for (FGSAbilityBookSlot& slot : tab.Abilities)			{				if (slot.AbilityClass == nullptr)				{					slot.AbilityClass = AbilityIn;					slot.bIsAbilityActive = true;					slot.bIsAbilityVisible = true;					break;				}			}		}		//make sure changes are replicated back.		OwnedAbilities.ForceRep++;		if (GetNetMode() == ENetMode::NM_Standalone)			OnRep_OwnedAbilities();	}}
开发者ID:zimzimdz,项目名称:ActionRPGGame,代码行数:28,


示例23: UpdateSessionJoinability

void AGameSession::UpdateSessionJoinability(FName InSessionName, bool bPublicSearchable, bool bAllowInvites, bool bJoinViaPresence, bool bJoinViaPresenceFriendsOnly){	if (GetNetMode() != NM_Standalone)	{		UOnlineEngineInterface::Get()->UpdateSessionJoinability(GetWorld(), InSessionName, bPublicSearchable, bAllowInvites, bJoinViaPresence, bJoinViaPresenceFriendsOnly);	}}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:7,


示例24: PostInitializeComponents

void ACharacter::PostInitializeComponents(){    Super::PostInitializeComponents();    if (!IsPendingKill())    {        if (Mesh)        {            BaseTranslationOffset = Mesh->RelativeLocation;            BaseRotationOffset = Mesh->RelativeRotation.Quaternion();            // force animation tick after movement component updates            if (Mesh->PrimaryComponentTick.bCanEverTick && CharacterMovement)            {                Mesh->PrimaryComponentTick.AddPrerequisite(CharacterMovement, CharacterMovement->PrimaryComponentTick);            }        }        if (CharacterMovement && CapsuleComponent)        {            CharacterMovement->UpdateNavAgent(*CapsuleComponent);        }        if (Controller == NULL && GetNetMode() != NM_Client)        {            if (CharacterMovement && CharacterMovement->bRunPhysicsWithNoController)            {                CharacterMovement->SetDefaultMovementMode();            }        }    }}
开发者ID:colwalder,项目名称:unrealengine,代码行数:32,


示例25: ProcessInstantHit

void ASWeaponInstant::ProcessInstantHit(const FHitResult& Impact, const FVector& Origin, const FVector& ShootDir){    if (MyPawn && MyPawn->IsLocallyControlled() && GetNetMode() == NM_Client)    {        // If we are a client and hit something that is controlled by server        if (Impact.GetActor() && Impact.GetActor()->GetRemoteRole() == ROLE_Authority)        {            // Notify the server of our local hit to validate and apply actual hit damage.            ServerNotifyHit(Impact, ShootDir);        }        else if (Impact.GetActor() == nullptr)        {            if (Impact.bBlockingHit)            {                ServerNotifyHit(Impact, ShootDir);            }            else            {                ServerNotifyMiss(ShootDir);            }        }    }    // Process a confirmed hit.    ProcessInstantHitConfirmed(Impact, Origin, ShootDir);}
开发者ID:Raynaron,项目名称:EpicSurvivalGameSeries,代码行数:26,


示例26: AssignViewTarget

void APlayerCameraManager::AssignViewTarget(AActor* NewTarget, FTViewTarget& VT, struct FViewTargetTransitionParams TransitionParams){	if( !NewTarget || (NewTarget == VT.Target) )	{		return;	}// 	UE_LOG(LogPlayerCameraManager, Log, TEXT("%f AssignViewTarget OldTarget: %s, NewTarget: %s, BlendTime: %f"), GetWorld()->TimeSeconds, VT.Target ? *VT.Target->GetFName().ToString() : TEXT("NULL"),// 		NewTarget ? *NewTarget->GetFName().ToString() : TEXT("NULL"),// 		TransitionParams.BlendTime);	AActor* OldViewTarget = VT.Target;	VT.Target = NewTarget;	// Use default FOV and aspect ratio.	VT.POV.AspectRatio = DefaultAspectRatio;	VT.POV.FOV = DefaultFOV;	if (OldViewTarget)	{		OldViewTarget->EndViewTarget(PCOwner);	}	VT.Target->BecomeViewTarget(PCOwner);	if (!PCOwner->IsLocalPlayerController() && (GetNetMode() != NM_Client))	{		PCOwner->ClientSetViewTarget(VT.Target, TransitionParams);	}}
开发者ID:mysheng8,项目名称:UnrealEngine,代码行数:30,


示例27: IsLocallyControlled

void UGripMotionControllerComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction){	Super::TickComponent(DeltaTime, TickType, ThisTickFunction);	// Moved this here instead of in the polling function, it was ticking once per frame anyway so no loss of perf	// It doesn't need to be there and now I can pre-check	// Also epics implementation in the polling function didn't work anyway as it was based off of playercontroller which is not the owner of this controller		// Cache state from the game thread for use on the render thread	// No need to check if in game thread here as tick always is	bHasAuthority = IsLocallyControlled();	bIsServer = IsServer();	// Server/remote clients don't set the controller position in VR	// Don't call positional checks and don't create the late update scene view	if (bHasAuthority)	{		if (!ViewExtension.IsValid() && GEngine)		{			TSharedPtr< FViewExtension, ESPMode::ThreadSafe > NewViewExtension(new FViewExtension(this));			ViewExtension = NewViewExtension;			GEngine->ViewExtensions.Add(ViewExtension);		}		// This is the owning player, now you can get the controller's location and rotation from the correct source		FVector Position;		FRotator Orientation;		bTracked = PollControllerState(Position, Orientation);		if (bTracked)		{			SetRelativeLocationAndRotation(Position, Orientation);		}		if (!bTracked && !bUseWithoutTracking)			return; // Don't update anything including location		// Don't bother with any of this if not replicating transform		if (bReplicates && bTracked)		{			ReplicatedControllerTransform.Position = Position;			ReplicatedControllerTransform.Orientation = Orientation;			if (GetNetMode() == NM_Client)//bReplicateControllerTransform)			{				ControllerNetUpdateCount += DeltaTime;				if (ControllerNetUpdateCount >= (1.0f / ControllerNetUpdateRate))				{					ControllerNetUpdateCount = 0.0f;					Server_SendControllerTransform(ReplicatedControllerTransform);				}			}		}	}	// Process the gripped actors	TickGrip();}
开发者ID:ProteusVR,项目名称:SteamVR_Template,代码行数:59,


示例28: UpdateTeam

void AUTBetrayalPlayerState::UpdateTeam(AUTBetrayalTeam* Team){	if (GetNetMode() != NM_DedicatedServer)	{		// for listen server support, call notify team change locally		NotifyTeamChanged();	}}
开发者ID:RattleSN4K3,项目名称:UT4-Gametype-Betrayal,代码行数:8,



注:本文中的GetNetMode函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ GetNetwork函数代码示例
C++ GetNativeSystemInfo函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。