搭建网站有哪些表白网站怎样做有创意

news/2025/9/24 16:45:12/文章来源:
搭建网站有哪些,表白网站怎样做有创意,阿里大数据官网,建网站需要钱吗p20 首先我们现在有一个多人游戏的系统类MultiplayerSessionsSubsystem 在这个系统内提供了很多会话系统的接口SessionInterface 当现在我们有一些SessionInterfaceDelegates的委托,这个委托的来源是SessionInterface,所以我们使用的委托可以接收到来自SessionInterface的消息(…p20 首先我们现在有一个多人游戏的系统类MultiplayerSessionsSubsystem 在这个系统内提供了很多会话系统的接口SessionInterface 当现在我们有一些SessionInterfaceDelegates的委托,这个委托的来源是SessionInterface,所以我们使用的委托可以接收到来自SessionInterface的消息(回调/Callbacks) 在上节课,我们创建了菜单类MenuClass,调用的是MultiplayerSessionsSubsystem的函数 当我们在菜单类调用MultiplayerSessionsSubsystem的函数的时候,实际上是调用了SessionInterface的接口函数,这个时候SessionInterface就会通过SessionInterfaceDelegates这个委托给MultiplayerSessionsSubsystem发送消息(也就是回调,Callback Responds) 但是这个时候问题出现了,我们没有办法把SessionInterface返回给MultlplayerSubsystem内的消息(也就是CallbackResponds)发送给MenuClass 解决这个问题的方法是创建属于我们自己的委托,用来接受从MultiPlayerSubsystem返回来的消息 理解了含义后就可以开始学习了 Menu.h // Fill out your copyright notice in the Description page of Project Settings. #pragma once #include CoreMinimal.h #include Blueprint/UserWidget.h #include BaseMenu.generated.h /** * */ class UButton; UCLASS() class MULTIPLAYERSESSION_API UBaseMenu : public UUserWidget { GENERATED_BODY() protected: virtual bool Initialize() override; virtual void NativeDestruct() override; /*这里创建用来对应MultiPlayerOnCreateSessionComplete的函数*/ UFUNCTION() void OnCreateSession(bool bWasSuccessful); public: UFUNCTION(BlueprintCallable) void MenuSetup(int SetupNumPublicConnections 4,FString SetupMatchType TEXT(FreeForAll)); void _DebugLog(FColor DisplayColor, const FString DebugMessage); private: //将指针与按钮绑定起来,这里的绑定必须要指针变量名称和UMG的名称完全一样 UPROPERTY(meta(BindWidget)) UButton* HostButton; UPROPERTY(meta(BindWidget)) UButton* JoinButton; UFUNCTION() void HostButtonClicked(); UFUNCTION() void JoinButtonClincked(); UFUNCTION() void MenuTearDown(); class UMultiPlayerSessionSubsystem* MultiPlayerSessionSubsystem; int32 NumPublicConnections{4}; FString MatchType{TEXT(FreeForAll)}; }; .cpp // Fill out your copyright notice in the Description page of Project Settings. #include BaseMenu.h #include MultiPlayerSession/Public/MultiPlayerSessionSubsystem.h #include Components/Button.h bool UBaseMenu::Initialize() { if(!Super::Initialize()) { return false; } if(HostButton) { HostButton-OnClicked.AddDynamic(this,UBaseMenu::HostButtonClicked); } if(JoinButton) { JoinButton-OnClicked.AddDynamic(this,UBaseMenu::JoinButtonClincked); } return true; } void UBaseMenu::NativeDestruct() { Super::NativeDestruct(); } void UBaseMenu::OnCreateSession(bool bWasSuccessful) { if(bWasSuccessful) { _DebugLog(FColor::Green,TEXT(CreateSession Successful)); } UWorld* World GetWorld(); if(World) { World-ServerTravel(/Game/ThirdPerson/Maps/Lobby?listen); } } void UBaseMenu::MenuSetup(int SetupNumPublicConnections ,FString SetupMatchType) { NumPublicConnections SetupNumPublicConnections; MatchType SetupMatchType; AddToViewport(); SetVisibility(ESlateVisibility::Visible); bIsFocusable true; UWorld* World GetWorld(); if(World) { APlayerController* PlayerController World-GetFirstPlayerController(); if(PlayerController) { FInputModeUIOnly InputModeUIOnly; InputModeUIOnly.SetWidgetToFocus(TakeWidget()); InputModeUIOnly.SetLockMouseToViewportBehavior(EMouseLockMode::DoNotLock); PlayerController-SetInputMode(InputModeUIOnly); PlayerController-SetShowMouseCursor(true); } } UGameInstance* GameInstance GetGameInstance(); if(GameInstance) { MultiPlayerSessionSubsystem GameInstance-GetSubsystemUMultiPlayerSessionSubsystem(); } if(MultiPlayerSessionSubsystem) { MultiPlayerSessionSubsystem-MultiPlayerOnCreateSessionComplete.AddDynamic(this,ThisClass::OnCreateSession); } } void UBaseMenu::_DebugLog(FColor DisplayColor, const FString DebugMessage) { if(GEngine) { GEngine-AddOnScreenDebugMessage(-1,15.f,DisplayColor,DebugMessage); } } void UBaseMenu::HostButtonClicked() { if(MultiPlayerSessionSubsystem) { MultiPlayerSessionSubsystem-CreateSession(NumPublicConnections,MatchType); } _DebugLog(FColor::Blue,FString::Printf(TEXT(Create Session Success))); } void UBaseMenu::JoinButtonClincked() { _DebugLog(FColor::Blue,FString::Printf(TEXT(Join Button Click))); } void UBaseMenu::MenuTearDown() { UWorld* World GetWorld(); RemoveFromParent(); APlayerController* PlayerController World-GetFirstPlayerController(); FInputModeGameAndUI InputModeGameAndUI; PlayerController-SetInputMode(InputModeGameAndUI); PlayerController-SetShowMouseCursor(false); } MultiplayerSessionSubsystem.h // Fill out your copyright notice in the Description page of Project Settings. #pragma once #include CoreMinimal.h #include Subsystems/GameInstanceSubsystem.h #include Interfaces/OnlineSessionInterface.h #include MultiPlayerSessionSubsystem.generated.h /** * 这里是我们自定义的委托 */ DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FMultiPlayerOnCreateSessionComplete ,bool, bWasSuccessful); UCLASS() class UMultiPlayerSessionSubsystem : public UGameInstanceSubsystem { GENERATED_BODY() public: UMultiPlayerSessionSubsystem(); /* * 这里是一个句柄,让菜单类可以访问Subsystem */ void CreateSession(int32 NumPublicConnections,FString MatchType); void FindSession(int32 MaxSearchResults); void JoinSession(const FOnlineSessionSearchResult SessionResults); void DestroySession(); void StartSession(); /* * 这是给菜单类做的回调委托 */ FMultiPlayerOnCreateSessionComplete MultiPlayerOnCreateSessionComplete; protected: /* * 这里是委托 */ void CreateSessionComplete(FName SessionName, bool bWasSuccessful); void FindSessionsComplete(bool bWasSuccessful); void JoinSessionComplete(FName SessionName, EOnJoinSessionCompleteResult::Type Result); void DestroySessionComplete(FName SessionName, bool bWasSuccessful); void StartSessionComplete(FName SessionName, bool bWasSuccessful); private: IOnlineSessionPtr OnlineSessionInterface; TSharedPtrFOnlineSessionSettings LastSessionSettings; /* * 添加OnlineSession委托到列表内 * 我们的游玩系统内部回调绑定到这里 * */ FOnCreateSessionCompleteDelegate CreateSessionCompleteDelegate; FDelegateHandle CreateSessionCompleteDelegate_Handle; FOnFindSessionsCompleteDelegate FindSessionsCompleteDelegate; FDelegateHandle FindSessionsCompleteDelegate_Handle; FOnJoinSessionCompleteDelegate JoinSessionCompleteDelegate; FDelegateHandle JoinSessionCompleteDelegate_Handle; FOnDestroySessionCompleteDelegate DestroySessionCompleteDelegate; FDelegateHandle DestroySessionCompleteDelegate_Handle; FOnStartSessionCompleteDelegate StartSessionCompleteDelegate; FDelegateHandle StartSessionCompleteDelegate_Handle; }; .cpp // Fill out your copyright notice in the Description page of Project Settings. #include MultiPlayerSessionSubsystem.h #include OnlineSessionSettings.h #include OnlineSubsystem.h UMultiPlayerSessionSubsystem::UMultiPlayerSessionSubsystem(): CreateSessionCompleteDelegate(FOnCreateSessionCompleteDelegate::CreateUObject(this,ThisClass::CreateSessionComplete)), FindSessionsCompleteDelegate(FOnFindSessionsCompleteDelegate::CreateUObject(this,ThisClass::FindSessionsComplete)), JoinSessionCompleteDelegate(FOnJoinSessionCompleteDelegate::CreateUObject(this,ThisClass::JoinSessionComplete)), DestroySessionCompleteDelegate(FOnDestroySessionCompleteDelegate::CreateUObject(this,ThisClass::DestroySessionComplete)), StartSessionCompleteDelegate(FOnStartSessionCompleteDelegate::CreateUObject(this,ThisClass::StartSessionComplete)) { IOnlineSubsystem* OnlineSubsystem IOnlineSubsystem::Get(); if(OnlineSubsystem) { OnlineSessionInterface OnlineSubsystem-GetSessionInterface(); } } void UMultiPlayerSessionSubsystem::CreateSession(int32 NumPublicConnections, FString MatchType) { if(!OnlineSessionInterface.IsValid()) { return; } auto ExistingSession OnlineSessionInterface-GetNamedSession(NAME_GameSession); if(ExistingSession ! nullptr) { OnlineSessionInterface-DestroySession(NAME_GameSession); } //存放创建委托 CreateSessionCompleteDelegate_Handle OnlineSessionInterface-AddOnCreateSessionCompleteDelegate_Handle(CreateSessionCompleteDelegate); LastSessionSettings MakeShareable(new FOnlineSessionSettings()); LastSessionSettings-bIsLANMatch IOnlineSubsystem::Get()-GetSubsystemName() NULL ? true:false; //最多4人 LastSessionSettings-NumPublicConnections NumPublicConnections; //允许其他玩家加入 LastSessionSettings-bAllowJoinInProgress true; //允许好友加入 LastSessionSettings-bAllowJoinViaPresence true; //线上公开 LastSessionSettings-bShouldAdvertise true; //显示用户状态 LastSessionSettings-bUsesPresence true; //使用第三方平台 LastSessionSettings-bUseLobbiesIfAvailable true; LastSessionSettings-Set(FName(MatchType),MatchType,EOnlineDataAdvertisementType::ViaOnlineServiceAndPing); const ULocalPlayer* LocalPlayer GetWorld()-GetFirstLocalPlayerFromController(); if(OnlineSessionInterface-CreateSession(*LocalPlayer-GetPreferredUniqueNetId(), NAME_GameSession , *LastSessionSettings)) { /*这里是创建失败*/ OnlineSessionInterface-ClearOnCreateSessionCompleteDelegate_Handle(CreateSessionCompleteDelegate_Handle); /*在这里广播*/ MultiPlayerOnCreateSessionComplete.Broadcast(false); } } void UMultiPlayerSessionSubsystem::FindSession(int32 MaxSearchResults) { } void UMultiPlayerSessionSubsystem::JoinSession(const FOnlineSessionSearchResult SessionResults) { } void UMultiPlayerSessionSubsystem::DestroySession() { } void UMultiPlayerSessionSubsystem::StartSession() { } void UMultiPlayerSessionSubsystem::CreateSessionComplete(FName SessionName, bool bWasSuccessful) { /*当成功创建房间的时候,删除创建房间的句柄*/ if(OnlineSessionInterface) { OnlineSessionInterface-ClearOnCreateSessionCompleteDelegate_Handle(CreateSessionCompleteDelegate_Handle); } MultiPlayerOnCreateSessionComplete.Broadcast(bWasSuccessful); } void UMultiPlayerSessionSubsystem::FindSessionsComplete(bool bWasSuccessful) { } void UMultiPlayerSessionSubsystem::JoinSessionComplete(FName SessionName, EOnJoinSessionCompleteResult::Type Result) { } void UMultiPlayerSessionSubsystem::DestroySessionComplete(FName SessionName, bool bWasSuccessful) { } void UMultiPlayerSessionSubsystem::StartSessionComplete(FName SessionName, bool bWasSuccessful) { }

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/915966.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

质数(埃氏筛、欧拉筛)

小赛码/数论 竞赛/数论 质数 一、质数:数字的原子原子是构成物质的基本单位质数是构建整数的基本单元示例: 60 = 2 2 3 5(仅由质数构成) 所有大于1的自然数都可分解为质数的乘积 类比说明:质数如同数学界的乐高…

HarmonyOS数据持久化:Preferences轻量级存储实战

本文将详细介绍HarmonyOS 5(API 12)中的用户首选项(Preferences)数据持久化方案,通过实际代码示例讲解如何实现轻量级键值对数据的存储、读取和管理。1. Preferences核心概念与优势 Preferences是HarmonyOS提供的…

HarmonyOS服务卡片开发:动态卡片与数据绑定实战指南

✨ 一、服务卡片概述与优势 服务卡片是HarmonyOS提供的一种轻量级UI组件,具有以下核心特性:信息前置:将应用关键信息直接展示在桌面、锁屏等位置,用户无需打开应用即可获取重要信息。 交互便捷:支持按钮点击等基础…

【CV】GAN代码解析:base_model.py

【CV】GAN代码解析:base_model.pyPosted on 2025-09-24 16:39 SaTsuki26681534 阅读(0) 评论(0) 收藏 举报import os # 标准库:操作系统相关(本文件中未直接使用) import torch # PyTorch 主库 from pathli…

有理数类的问题回答

1. 与C语言有理数代码相比,该Java类更面向对象的原因 (1)封装性:Java类将有理数的分子numerator和分母denominator设为private,仅通过public方法对外暴露功能,隐藏了内部实现细节;而C语言通常通过结构体直接暴露…

企业网站设计与实现论文移动网站系统

听说这是目录哦 FinalShell连接VMware🌤️解决重连失效FinalShell的使用 免密登录⛈️能量站😚 FinalShell连接VMware🌤️ 保持虚拟机的开机状态,打开FinalShell,如果虚拟机关机或者挂起,连接就会断开。 …

做网站时图片要切片有什么作用可以做砍价链接的网站

车牌识别系统 YOLOv5和LPRNet的车牌识别系统结合了深度学习技术的先进车牌识别解决方案。该系统整合了YOLOv5目标检测框架和LPRNet文本识别模型 1. YOLOv5目标检测框架 YOLO是一种先进的目标检测算法,以其实时性能和高精度闻名。YOLOv5是在前几代基础上进行优化的…

南昌网站建设规划方案传媒公司网站源码php

引人入胜的开篇:想要搞清楚LSTM中的每个公式的每个细节为什么是这样子设计吗?想知道simple RNN是如何一步步的走向了LSTM吗?觉得LSTM的工作机制看不透?恭喜你打开了正确的文章! 前方核弹级高能预警!本文信息…

微信版网站开发用安卓做网站

幸福树,一种寓意美好的观赏型植物,它生长非常迅速,稍不注意就长的非常茂盛。而要想保证幸福树的美貌,跟人的头发一样,我们要给它适当的修剪,那幸福树怎么修剪呢?为了大家能养出美丽的幸福树来&a…

HarmonyOS后台任务调度:JobScheduler与WorkManager实战指南

本文将深入探讨HarmonyOS 5(API 12)中的后台任务调度机制,重点讲解JobScheduler和WorkManager的使用方法、适用场景及最佳实践,帮助开发者实现高效、智能的后台任务管理。1. 后台任务调度概述 HarmonyOS提供了两种…

总线传输的四个阶段

1.申请分配阶段 由需要使用总线的主模块或主设备提出申请,经过总线仲裁机构决定下一个传输周期的总线使用权。也可将此阶段细分为传输请求和总线仲裁两个阶段 2.寻址阶段 获得使用权的主模块,通过总线发出本次要访问…

学校站群框架如何开发插件实现Word图片的批量上传与编辑?

pre { white-space: pre !important; word-wrap: normal !important; overflow-x: auto !important; display: block !important; font-family: "Consolas", "Monaco", "Courier New", …

化妆品公司网站源码wordpress ip锁定插件

在React的类组件中,从组件创建到组件被挂载到页面中,这个过程react存在一系列的生命周期函数,最主要的生命周期函数是componentDidMount、componentDidUpdate、componentWillUnmount 生命周期图例如下 1. componentDidMount组件挂载 如果你…

怎样改网站英文域名保定定兴网站建设

来源:新战略机器人为什么需要协作机器人?协作机器人的兴起意味着传统机器人必然有某种程度的不足,或者无法适应新的市场需求。总结一下,主要有几点:传统机器人部署成本高其实相对来讲,工业机器人本身的价格…

广西工程造价信息网佛山seo优化排名推广

1、先登录服务器创建新目录aaa 2、云盘都快照备份下。后续操作完核实无误了,您根据您需求删除快照就行, 然后登录服务器内执行: fdisk -l sblk blkid ll /aaa 3、执行:(以下命令是进行数据盘做ext4文件系统并挂载…

HarmonyOS事件订阅与通知:后台事件处理

本文将深入探讨HarmonyOS 5(API 12)中的事件订阅与通知机制,重点讲解如何在后台处理事件,实现应用的实时响应和跨设备协同。内容涵盖核心API、实现步骤、实战示例及性能优化建议。1. 事件订阅与通知机制概述 Harmo…

HarmonyOS后台任务管理:短时与长时任务实战指南

本文将深入探讨HarmonyOS 5(API 12)中的后台任务管理机制,详细讲解短时任务和长时任务的适用场景、实现方法、性能优化及最佳实践,帮助开发者构建高效节能的后台任务系统。1. 后台任务概述与分类 HarmonyOS提供了完…

案例分享 | 芯片企业官网优化

案例分享 | 芯片企业官网优化

Kali Linux 2025.3 发布 (Vagrant Nexmon) - 领先的渗透测试发行版

Kali Linux 2025.3 发布 (Vagrant & Nexmon) - 领先的渗透测试发行版Kali Linux 2025.3 发布 (Vagrant & Nexmon) - 领先的渗透测试发行版 The most advanced Penetration Testing Distribution 请访问原文链接…

C语言多线程同步详解:从互斥锁到条件变量

在多线程编程中,线程同步是确保多个线程正确协作的关键技术。当多个线程访问共享资源时,如果没有适当的同步机制,可能会导致数据竞争、死锁等问题。本文将详细介绍C语言中常用的线程同步技术。 为什么需要线程同步?…