当前位置: 首页 > 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.jsqmd.com/news/67574/

相关文章:

  • 银行反欺诈day1
  • Hikvision 考勤机数据提取(3)
  • 2025年数控折弯机模具选购参考
  • Hikvision 考勤机数据提取(3)
  • 12306爬取基本车次信息(需下载chromedriver)
  • 微信小程序渗透测试
  • 大数据数仓设计:分层架构与维度建模 - Binge
  • 2025年折弯机上下模实力厂家推荐榜
  • Day14-20251208
  • 遇到的前端ts语法问题记录 - wuzx
  • Flask集成MCP的AI Agent
  • 阅读笔记四
  • 从纯数学到应用AI科学的职业转变
  • 深入解析:OpenAI 新推 GPT-5-Codex-Mini:一款针对开发者的轻量级编码助手
  • rustfs
  • threadDay01
  • 20232404 2025-2026-1 《网络与系统攻防技术》实验八实验报告
  • Python数据可视化全攻略:Matplotlib/Seaborn从入门到实战
  • 2025.12.7 百度之星决赛 2025
  • 日总结 37
  • 深入设计模式
  • 环境配置
  • 工程模拟分析软件 Abaqus 2024 免费下载安装教程(含中文版设置+ 激活步骤)
  • RustFS是国产的吗?有人用吗?深度解析这款新兴对象存储
  • 软件工程学习日志2025.12.8
  • 视频号下载视频思路 - 教程
  • 2025.12.1周总结
  • 小爱帮你拍-使用教程
  • 中国鱼竿十大名单——2025年十大良心鱼竿精选:鱼竿名单第一名到第十名
  • 2025新手买钓鱼竿指南:高性价比品牌推荐,避坑看这篇