当前位置: 首页 > news >正文

名律汇网站建设设计淘宝seo优化是什么

名律汇网站建设设计,淘宝seo优化是什么,php网站制作报价,提升学历的十大好处是什么断线重连的整体逻辑是 设备离线后,根据需要决定是否保留pawn,还是设备重连后再重新生成一个,然后是断线重连时的验证方式,最后是playerstate重连后的属性保留 重载Playercontroller的PawnLeavingGame,这里是设备断线后&#xff0…

断线重连的整体逻辑是 设备离线后,根据需要决定是否保留pawn,还是设备重连后再重新生成一个,然后是断线重连时的验证方式,最后是playerstate重连后的属性保留

  1. 重载Playercontroller的PawnLeavingGame,这里是设备断线后,不会删除pawn,根据自己的需求决定是否需要修改,如果不需要保存pawn,没有必要重载该函数。
void AMVNControllerBase::PawnLeavingGame()
{if (GetPawn() != NULL){//GetPawn()->Destroy();//SetPawn(NULL);}
}

2.如果要保留pawn的话,可以重载GameMode的AddInactivePlayer,这个函数原本是保留断线的playerstate的,如果也要保留pawn的话,可以在这个函数里参照保留PlayerState的方式,保存pawn,如果不需要保存pawn,没有必要重载该函数。

void AVTTSGameModeBase::AddInactivePlayer(APlayerState* PlayerState, APlayerController* PC)
{check(PlayerState)UWorld* LocalWorld = GetWorld();// don't store if it's an old PlayerState from the previous level or if it's a spectator... or if we are shutting downif (!PlayerState->IsFromPreviousLevel() && !MustSpectate(PC) && !LocalWorld->bIsTearingDown){APlayerState* const NewPlayerState = PlayerState->Duplicate();APawn* PolicePawn = PC->GetPawn();if (NewPlayerState && PolicePawn){// Side effect of Duplicate() adding PlayerState to PlayerArray (see APlayerState::PostInitializeComponents)GameState->RemovePlayerState(NewPlayerState);// make PlayerState inactiveNewPlayerState->SetReplicates(false);// delete after some timeNewPlayerState->SetLifeSpan(InactivePlayerStateLifeSpan);//设置自动删除的时间PolicePawn->SetLifeSpan(InactivePlayerStateLifeSpan);// On console, we have to check the unique net id as network address isn't validconst bool bIsConsole = !PLATFORM_DESKTOP;// Assume valid unique ids means comparison should be via this methodconst bool bHasValidUniqueId = NewPlayerState->GetUniqueId().IsValid();// Don't accidentally compare empty network addresses (already issue with two clients on same machine during development)const bool bHasValidNetworkAddress = !NewPlayerState->SavedNetworkAddress.IsEmpty();const bool bUseUniqueIdCheck = bIsConsole || bHasValidUniqueId;// make sure no duplicatesfor (int32 Idx = 0; Idx < InactivePlayerArray.Num(); ++Idx){APlayerState* const CurrentPlayerState = InactivePlayerArray[Idx];if ((CurrentPlayerState == nullptr) || CurrentPlayerState->IsPendingKill()){// already destroyed, just remove itInactivePlayerArray.RemoveAt(Idx, 1);InactivePawnArray.RemoveAt(Idx, 1);Idx--;}else if ((!bUseUniqueIdCheck && bHasValidNetworkAddress && (CurrentPlayerState->SavedNetworkAddress == NewPlayerState->SavedNetworkAddress))|| (bUseUniqueIdCheck && (CurrentPlayerState->GetUniqueId() == NewPlayerState->GetUniqueId()))){// destroy the playerstate, then remove it from the trackingCurrentPlayerState->Destroy();InactivePlayerArray.RemoveAt(Idx, 1);InactivePawnArray.RemoveAt(Idx, 1);  //保存角色Idx--;}}InactivePlayerArray.Add(NewPlayerState);InactivePawnArray.Add(PolicePawn);// make sure we dont go over the maximum number of inactive players allowedif (InactivePlayerArray.Num() > MaxInactivePlayers){int32 const NumToRemove = InactivePlayerArray.Num() - MaxInactivePlayers;// destroy the extra inactive playersfor (int Idx = 0; Idx < NumToRemove; ++Idx){APlayerState* const PS = InactivePlayerArray[Idx];if (PS != nullptr){PS->Destroy();}}// and then remove them from the tracking arrayInactivePlayerArray.RemoveAt(0, NumToRemove);InactivePawnArray.RemoveAt(0, NumToRemove);}}}
}
  1. 同理如果需要重新获得之前保留的pawn的话,重载gamemode的restartPlayerAtPlayerStart,默认的话是直接生成新的pawn,如果你想直接使用就的pawn修改响应的逻辑
  2. 重载时设备的验证,GameMode的FindInactivePlayer函数,默认设备重连时会比较网络的UniqueId,如果一致那么会复制原本的设备的playerstate数据,但是如果你的客户端设备经过重启的话,是会识别成新的客户端,所以根据需要自己去决定是否修改验证方式。
  3. 重载PlayerState的CopyProperties,将你自定义的变量进行重新复制

以上就是断线重连基本的涉及的函数了,这一切的前提是gamemode必须继承自AGameMode,然后如果你没有保留pawn,或者自己验证重新登录逻辑的话,只需要修改第5条对应的内容就可以实现断线重连了

http://www.hkea.cn/news/864352/

相关文章:

  • 大兴建站推广google登录
  • 长春个人做网站哪家好百度指数热度榜
  • 嘉兴手机网站开发费用百度学术论文官网入口
  • 刷业务网站怎么做seo关键词挖掘
  • 企业移动网站品牌苏州网站外包
  • 网站建设流程 文档东莞seo技术
  • 公众号开发网站建设合同信息流广告投放流程
  • 长清网站建设费用友情链接出售平台
  • 先做网站再付款百度推广的广告真实可信吗
  • 湖南省人民政府一事一办企业网站seo排名优化
  • 深圳招聘网官方网站网站搜索引擎优化
  • 怎么知道一个网站是谁做的中国最大的企业培训公司
  • m2c是什么意思南昌百度seo
  • 专业做羽绒服的服装网站域名注册网
  • 公司网站建设需要显示什么软件世界球队最新排名
  • 做微信平台图片网站有没有免费的广告平台
  • 渭南网站建设风尚网络站长工具seo词语排名
  • 广告传媒网站模板免费网站推广方式
  • 如何用api方式做网站域名批量查询工具
  • wordpress 网易云跟帖优化合作平台
  • 建设党建网站联盟青岛网站推广公司
  • 石湾网站建设湘潭关键词优化服务
  • 淘宝优惠券怎么做网站网络服务提供商
  • 哪里有网站建设电话查排名官网
  • 做网站需要准备的工具网络营销方案模板
  • 科技未来网站建设百度推广开户公司
  • 十度网站建设保定网站推广公司
  • php可以做视频网站有哪些软文推广渠道主要有
  • 成都网站建设桔子科技淘宝付费推广有几种方式
  • 福田的网站建设公司网络营销成功案例ppt免费