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

CommonUI-学习记录

UE官方教程

CommonUI重要特点

  1. Common UI 本质上来说就是把UI当成栈,你可以push不同的widget到不同的栈上面。然后栈本身又会存到栈里面,显示最上层的栈元素所包含的元素
    image

  2. The Viewport is the base for all input routing in Common UI. When Common UI captures input, it sends it to the Viewport first, which then sends it to whichever root node is drawn on top
    简单的来说,输入只会对进入当前最顶层的Widget。然后输入只会传给目前Focus的那个UI

  3. CommonUI的CommonUIInputData 是全局设置,Click对于CommonButton来说是自动设定,Back是针对当前层的widget而言

  4. 注册WBP级别的内容,其实也就是注册一下Back

void URswWidget_OptionScreen::NativeOnInitialized()
{Super::NativeOnInitialized();if (!ResetAction.IsNull()){ResetActionHandle = RegisterUIActionBinding(FBindUIActionArgs(ResetAction,true,FSimpleDelegate::CreateUObject(this, &ThisClass::OnResetBoundActionTriggered)));}RegisterUIActionBinding(FBindUIActionArgs(ICommonInputModule::GetSettings().GetDefaultBackAction(),true,FSimpleDelegate::CreateUObject(this, &ThisClass::OnBackBoundActionTriggered)));
}

对应于蓝图的这个位置,上面代码就是操作性更强一点
image

  1. 对button注册行为。 这里Click没注册,就是因为 3 里面提到的Click对于button是自动注册的
    // 遍历按钮信息数组,创建按钮, 按钮数量和EConfirmScreenType有关for (const FConfirmScreenButtonInfo& AvailableButtonInfo : InScreenInfoObject->AvailableScreenButtons){FDataTableRowHandle InputActionRowHandle;// ICommonInputModule 可以看下源码,就是去拿配置的默认输入动作switch (AvailableButtonInfo.ConfirmScreenButtonType){case EConfirmScreenButtonType::Cancelled:InputActionRowHandle = ICommonInputModule::GetSettings().GetDefaultBackAction();break;case EConfirmScreenButtonType::Closed:InputActionRowHandle = ICommonInputModule::GetSettings().GetDefaultBackAction();break;default:break;}// Entry理解为一个占住一个位置(停车位),DynamicEntry理解为动态entry数组。每个entry可以放不同类型URswCommonButtonBase* AddedButton = DynamicEntryBox_Buttons->CreateEntry<URswCommonButtonBase>();AddedButton->SetButtonText(AvailableButtonInfo.ButtonTextToDisplay);AddedButton->SetTriggeringInputAction(InputActionRowHandle);AddedButton->OnClicked().AddLambda([ClickedButtonCallback, AvailableButtonInfo, this]() {ClickedButtonCallback(AvailableButtonInfo.ConfirmScreenButtonType);DeactivateWidget();});}
http://www.zskr.cn/news/78106.html

相关文章:

  • 银行反欺诈day1
  • 2025年数控折弯机模具选购参考
  • 微信小程序渗透测试
  • 大数据数仓设计:分层架构与维度建模 - Binge
  • Day14-20251208
  • 遇到的前端ts语法问题记录 - wuzx
  • 从纯数学到应用AI科学的职业转变
  • threadDay01
  • 20232404 2025-2026-1 《网络与系统攻防技术》实验八实验报告
  • 2025.12.7 百度之星决赛 2025
  • Python数据可视化全攻略:Matplotlib/Seaborn从入门到实战
  • 深入设计模式
  • 2025.12.1周总结
  • 小爱帮你拍-使用教程
  • 20232403 2025-2026-1 《网络与系统攻防技术》实验八实验报告
  • 20232421 2025-2026-1 《网络与系统攻防技术》实验八实验报告
  • 20251206 - 并查集 总结
  • 侯捷 C++ 系列课程
  • Flink学习笔记:时间与Watermark
  • 第11章 泛型、trait与生命周期 - 实践
  • ARC 078D
  • CTT 2026 游记
  • 基于奇异值分解的点云配准原理
  • LogFilter Panel: 我做了一个 grafana 中更好用的 VictoriaLogs 日志筛选面板
  • 13.结构型 - 适配器模式 (Adapter Pattern)
  • Tauri 窗口拖拽功能偶尔失效问题修复总结
  • PyTorch推理扩展实战:用Ray Data轻松实现多机多卡并行
  • 2025婴儿车性价比排行榜首选:UPPAbaby MINU V3如何以轻便全能理念重新定义价值标准(附权威认证)
  • Java数组
  • 洛谷 P8189