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

网站开发哪些公司今日重大新闻头条十条

网站开发哪些公司,今日重大新闻头条十条,安徽省住房和城乡建设厅网站,wordpress可以做门户网站# UE5 C UGameInstance 功能及作用 网上有很多文章介绍,例如在游戏中只有一个实例,换关卡不会丢失等。暂时省略。 # UE5 C UGameInstance 应用 ## 应用一,UE5 C UGameInstance 里监听player创建事件 UWebSocketGameInstance.h里的定义 …

# UE5 C++ UGameInstance  功能及作用
 


网上有很多文章介绍,例如在游戏中只有一个实例,换关卡不会丢失等。暂时省略。

#  UE5 C++ UGameInstance  应用


## 应用一,UE5 C++ UGameInstance  里监听player创建事件


UWebSocketGameInstance.h里的定义

UCLASS()
class MYUE521_API UUWebSocketGameInstance : public UGameInstance
{GENERATED_BODY()public:virtual void Init() override;virtual void Shutdown() override;void OnPlayerCreated(ULocalPlayer* player);
}

说明:

  1.  Init()方法是在UGameInstance.h里定义的。源码里的注解是允许在这里自定义一些实现
  2. Shutdown()方法是在UGameInstance.h里定义的。源码里的注解是允许在这里自定义一些清理工作
  3. void OnPlayerCreated(ULocalPlayer* player) 方法是我自己定义的方法,用来监听创建player以后执行的方法

下面来看一下实现UWebSocketGameInstance.cpp里

void UUWebSocketGameInstance::Init() {Super::Init();OnLocalPlayerAddedEvent.AddUObject(this,&UUWebSocketGameInstance::OnPlayerCreated);}void UUWebSocketGameInstance::Shutdown() {//先写自定义的清理工作Super::Shutdown();
}void UUWebSocketGameInstance::OnPlayerCreated(ULocalPlayer* player) {UE_LOG(LogTemp, Warning, TEXT("%s plaer is created"), *FString(__FUNCTION__));
}

说明:

  1.  UE5里的事件绑定,这里绑定到自定义的OnPlayerCreated 方法里
  2. 触发事件OnLocalPlayerAddedEvent的位置在GameInstance.cpp里有AddLocalPlayer(ULocalPlayer* NewLocalPlayer, FPlatformUserId UserId)方法里有OnLocalPlayerAddedEvent.Broadcast(NewLocalPlayer); 通过广播通知


## 应用二,UE5 C++ UGameInstance  里player转成目标Characher的方法


ACharacter* character = UGameplayStatics::GetPlayerCharacter(this->GetWorld(), 0);
Amyue521Character* character2 = Cast<Amyue521Character>(character);
if (character2 == nullptr) {UE_LOG(LogTemp, Warning, TEXT("%s  1强制类型转换成Amyue521Character失败"), *FString(__FUNCTION__));
}
else {UE_LOG(LogTemp, Warning, TEXT("%s  1强制类型转换成Amyue521Character成功"), *FString(__FUNCTION__));
}

## 应用三,UE5 C++ UGameInstance  里一些方法罗列

/** Returns number of fully registered local players */
int32					GetNumLocalPlayers() const;/** Returns the local player at a certain index, or null if not found */
ULocalPlayer*			GetLocalPlayerByIndex(const int32 Index) const;/** Returns the first local player, will not be null during normal gameplay */
ULocalPlayer*			GetFirstGamePlayer() const;/** Returns the player controller assigned to the first local player. If World is specified it will search within that specific world */
APlayerController*		GetFirstLocalPlayerController(const UWorld* World = nullptr) const;/** Returns the local player assigned to a physical Controller Id, or null if not found */
ULocalPlayer*			FindLocalPlayerFromControllerId(const int32 ControllerId) const;/** Returns the local player assigned to this platform user id, or null if not found */
ULocalPlayer* FindLocalPlayerFromPlatformUserId(const FPlatformUserId UserId) const;/** Returns the local player that has been assigned the specific unique net id */
ULocalPlayer*			FindLocalPlayerFromUniqueNetId(FUniqueNetIdPtr UniqueNetId) const;
ULocalPlayer*			FindLocalPlayerFromUniqueNetId(const FUniqueNetId& UniqueNetId) const;
ULocalPlayer*			FindLocalPlayerFromUniqueNetId(const FUniqueNetIdRepl& UniqueNetId) const;/** Returns const iterator for searching list of local players */
TArray<ULocalPlayer*>::TConstIterator	GetLocalPlayerIterator() const;/** Returns reference to entire local player list */
const TArray<ULocalPlayer*> &			GetLocalPlayers() const;

#  UE5 C++ UGameInstance  其他

待补充

http://www.qdjiajiao.com/news/4504.html

相关文章:

  • 多元网络兰州网站建设网络营销考试答案
  • 做网站要用什么软件图文教程备案查询
  • 网页设计作业电影介绍网站网络app推广是什么工作
  • 像网站分类一样的表格图怎么做上海seo服务
  • 手机app网站seo的优化方向
  • 义乌网站建设工作室最新热点新闻事件素材
  • 手机低价购买网站网络营销推广策划方案
  • 资阳视频网站建设广东seo外包服务
  • 专业建设金融行业网站的公司如何推广我的网站
  • 网站建设在线视频关键词是怎么排名的
  • 最新公司名字大全吉林seo刷关键词排名优化
  • 保定市做网站的公司百度统计工具
  • 公司网站备案怎么做今日郑州头条最新新闻
  • 怎样在网上注册自己的公司安顺seo
  • 什么网站可以做投票百度快照客服
  • 响应式网站案例源码企业营销培训课程
  • 知名的咨询行业网站制作免费的网站域名查询565wcc
  • 深圳福田住房和建设局网站官网北京网站建设公司案例
  • 做网站要有什么功能新媒体运营培训班
  • 佛山顺德网站建设网址查询ip地址
  • 综合门户网站是什么意思百度网盘怎么找资源
  • 做的比较漂亮的网站win优化大师
  • 直播间网站开发长春网站推广排名
  • 网上做兼职老师的正规网站seo关键词外包
  • 做课件挣钱的网站湖南网络优化
  • 周至县做网站免费引流微信推广
  • 网站效果图尺寸拉新平台哪个好佣金高
  • 做房产中介需要有内部网站吗百度热线客服24小时
  • 做运动鞋评价的网站北京建站优化
  • 旅游类网站建设教案淘宝引流推广平台