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

论坛网站建设用工具软件在360网站做公告怎么弄

论坛网站建设用工具软件,在360网站做公告怎么弄,百度应用商店官网,网页制作成品代码# 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.yayakq.cn/news/389325/

相关文章:

  • 网站申请界面怎么做沈阳做网站 熊掌号
  • 免费的求职简历模板网站专业SEO教程网站
  • 宁波网站推广平台咨询国内扁平化网站欣赏
  • 买了万网的域名跟定制网站还要买空间吗网站活动专题模板
  • 山东好的网站建设排行榜企业网页设计
  • 做flash网站框架引擎wordpress缓存怎么清理
  • 湘潭做网站价格 d磐石网络ui界面设计分析
  • 湛江网站制作推广协会网站建设
  • 书店网站建设技术风险微信个人小程序
  • 常用的建一个网站要多少钱百度餐饮网站建设
  • 网站设计哪里公司好网站建设好卖吗
  • 手机端网站用dw怎么做网速在线测速
  • 品牌宣传型网站构成国际物流公司
  • wordpress tax麒麟seo软件
  • 云主机建多个网站友情链接交换的作用在于
  • 成都网站建设案例单招网国外 素材 网站
  • 网站开发流行吗网站开发工程师职业
  • 找不同 网站开发厦门网站建设培训费用
  • 东莞建设网站制作网络优化的工作流程
  • 网站的类型大全如东县文化馆网站建设
  • 深圳网站开发哪个公司好医院构建网络平台你怎么准备
  • seo网站关键词优化方式局部改造家装公司
  • 中国农村建设网站网站备案 域名证书
  • 沈阳网站开发培训济南市建设工程招标网官网
  • 长沙高新区建设局网站婚庆公司
  • 广元网站建设wordpress自媒体主题免费下载
  • 自己开公司需要什么流程seo的基本内容
  • 网站开发的方案个人免费开发网站
  • 如需手机网站建设专业网站托管的公司
  • 建站属于什么行业网站搭建制作免费