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

国家城乡与住房建设部网站想建一个网站

国家城乡与住房建设部网站,想建一个网站,杭州游戏软件开发公司,什么是电子商务专业?文章目录 前言0. 通用设置0.1 开启插件0.2 设置Viewport 1. 分场景教程1. 1 在仅使用鼠标控制的场景下Common Activatable StackCommon Activatable Widget 1.2 当焦点落到一个按钮时显示默认确认#xff08;Click/Accept#xff09;按键图标Common Input Action DataBaseInp… 文章目录 前言0. 通用设置0.1 开启插件0.2 设置Viewport 1. 分场景教程1. 1 在仅使用鼠标控制的场景下Common Activatable StackCommon Activatable Widget 1.2 当焦点落到一个按钮时显示默认确认Click/Accept按键图标Common Input Action DataBaseInput DataCommon Input Base Controller Data 1.3 即使焦点没有落到该按钮上也可以使用指定按键触发该按钮并且按钮上会显示按键提示图标(Input Action和Triggering Input Action)1.4 当前UI触发按键提示栏(Common Bound Action Bar) 2. 小结 前言 Common UI给虚幻的UI系统带来了很多新特性这些新特性往往面向不同的使用场景。目前我看到很多的Common UI教程都是把这些特性很笼统地展示一遍这就很容易造成初学者的困惑“我当前做的这些工作到底是为了实现什么”所以本文采用分场景介绍的方式希望能够帮初学者理清一下Common UI的工作逻辑。 0. 通用设置 只要使用Common UI就要做的设置 0.1 开启插件 开启Common UI插件 0.2 设置Viewport Viewport是程序运行时Widget的容器及管理器Common UI从原来的Widget继承树上又派生了新的分支新分支自然需要扩展后的新Viewport(CommonGameViewportClient)去管理。 1. 分场景教程 1. 1 在仅使用鼠标控制的场景下 如果你游戏完全用鼠标控制那么除了上述通用设置以外Common UI中最值得关注的部分就是新增的Common Activatable Widget 以及Common Activatable Stack Common Activatable Widget Common Activatable Stack Common Activatable Stack Common Activatable Stack 顾名思义就是一个栈。UI中的Widget经常会有上下堆叠的状态处于顶层的Widget处于可用状态(Activate)当用键盘或游戏手柄控制的时候它会获得控制焦点而非顶层的Widget会处于不可用状态被置灰或者隐藏。这时候我们往往要自己动手实现一个Stack来管理这些Widget的行为。Common Activatable Stack 就是Common UI为我们内置的这样一个Stack。 当Common Activatable Stack 对Common Activatable Widget进行Push Widget操作时会将原来栈顶的Common Activatable Widget进行DeactivateWidget。当然也可以手动ActivateWidget和DeactivateWidget void UCommonActivatableWidgetContainerBase::SetSwitcherIndex(int32 TargetIndex, bool bInstantTransition /* false*/) {if (MySwitcher MySwitcher-GetActiveWidgetIndex() ! TargetIndex){if (DisplayedWidget){DisplayedWidget-OnDeactivated().RemoveAll(this);if (DisplayedWidget-IsActivated()){DisplayedWidget-DeactivateWidget();}else if (MySwitcher-GetActiveWidgetIndex() ! 0){// The displayed widget has already been deactivated by something other than us, so it should be removed from the container// We still need it to remain briefly though until we transition to the new index - then we can remove this entrys slotbRemoveDisplayedWidgetPostTransition true;}}MySwitcher-TransitionToIndex(TargetIndex, bInstantTransition);} }Common Activatable Widget 只有Common Activatable Widget才可以被Common Activatable Stack 管理在Common Activatable Widget的Activation中设置ActivateWidget和DeactivateWidget时Common Activatable Widget的行为 void UCommonActivatableWidget::NativeOnActivated() {if (ensureMsgf(bIsActive, TEXT([%s] has called NativeOnActivated, but isnt actually activated! Never call this directly - call ActivateWidget()))){if (bSetVisibilityOnActivated){SetVisibility(ActivatedVisibility);UE_LOG(LogCommonUI, Verbose, TEXT([%s] set visibility to [%s] on activation), *GetName(), *StaticEnumESlateVisibility()-GetDisplayValueAsText(ActivatedVisibility).ToString());}if (CommonUI::IsEnhancedInputSupportEnabled() InputMapping){if (const ULocalPlayer* LocalPlayer GetOwningLocalPlayer()){if (UEnhancedInputLocalPlayerSubsystem* InputSystem LocalPlayer-GetSubsystemUEnhancedInputLocalPlayerSubsystem()){InputSystem-AddMappingContext(InputMapping, InputMappingPriority);}}}BP_OnActivated();OnActivated().Broadcast();BP_OnWidgetActivated.Broadcast();} }void UCommonActivatableWidget::NativeOnDeactivated() {if (ensure(!bIsActive)){if (bSetVisibilityOnDeactivated){SetVisibility(DeactivatedVisibility);UE_LOG(LogCommonUI, Verbose, TEXT([%s] set visibility to [%d] on deactivation), *GetName(), *StaticEnumESlateVisibility()-GetDisplayValueAsText(DeactivatedVisibility).ToString());}if (CommonUI::IsEnhancedInputSupportEnabled() InputMapping){if (const ULocalPlayer* LocalPlayer GetOwningLocalPlayer()){if (UEnhancedInputLocalPlayerSubsystem* InputSystem LocalPlayer-GetSubsystemUEnhancedInputLocalPlayerSubsystem()){InputSystem-RemoveMappingContext(InputMapping);}}}// Cancel any holds that were activeClearActiveHoldInputs();BP_OnDeactivated();OnDeactivated().Broadcast();BP_OnWidgetDeactivated.Broadcast();} }关于如何定义一个Common Activatable Widget在《官方项目《内容示例》中Common UI部分笔记 1.1 Activatable Widgets》一文中有较详细的叙述。 1.2 当焦点落到一个按钮时显示默认确认Click/Accept按键图标 上面是仅用鼠标的场景接下来聊的都是主要用键盘或游戏手柄的场景。 当一个按钮获取到控制焦点时按钮上显示默认的确认按键会提升玩家的使用体验。 实现这样的效果需要实现一个派生自UCommonButtonBase的按钮在UCommonButtonBase有一个UCommonActionWidget类型的InputActionWidget,从它的meta中可以看到它是一个BindWidget,也就是说允许我们在蓝图中定义一个同名即名为InputActionWidget的UCommonActionWidget。 UPROPERTY(BlueprintReadOnly, Category Input, meta (BindWidget, OptionalWidget true, AllowPrivateAccess true))TObjectPtrUCommonActionWidget InputActionWidget;在UCommonActionWidget的UpdateActionWidget方法中会从游戏的预设**(Common Input Seetings)**中读取到默认Click按键的图标显示出来这个UpdateActionWidget在很多情况下都会被调用包括按钮的Hover状态。 void UCommonActionWidget::UpdateActionWidget() {if (!IsDesignTime() GetWorld()){const UCommonInputSubsystem* CommonInputSubsystem GetInputSubsystem();if (GetGameInstance() ensure(CommonInputSubsystem) CommonInputSubsystem-ShouldShowInputKeys()){const FCommonInputActionDataBase* InputActionData GetInputActionData();if (InputActionData || (EnhancedInputAction CommonUI::IsEnhancedInputSupportEnabled())){if (bAlwaysHideOverride){SetVisibility(ESlateVisibility::Collapsed);}else{Icon GetIcon();if (Icon.DrawAs ESlateBrushDrawType::NoDrawType){SetVisibility(ESlateVisibility::Collapsed);}else if (MyIcon.IsValid()){MyIcon-SetImage(Icon);if (GetVisibility() ! ESlateVisibility::Collapsed){// The object being passed into SetImage is the same each time so layout is never invalidated// Manually invalidate it here as the dimensions may have changedMyIcon-Invalidate(EInvalidateWidgetReason::Layout);}if (IsHeldAction()){MyProgressImage-SetVisibility(EVisibility::SelfHitTestInvisible);}else{MyProgressImage-SetVisibility(EVisibility::Collapsed);}MyKeyBox-Invalidate(EInvalidateWidget::LayoutAndVolatility);SetVisibility(ESlateVisibility::SelfHitTestInvisible);return;}}}}SetVisibility(ESlateVisibility::Collapsed);} }接下来我们再看看刚才提到的 (Common Input Seetings) Common Input Action DataBase 首先我们要创建一个格式为Common Input Action DataBase的数据表备用这个数据表的作用其实就如同我们在Input或Enhanced Input中配置的按键和Action的映射表 Input Data 再回到Common Input Seetings中新建一个Common UIInput Data类的对象在其中选择刚才创建的数据表并配置如下两个选项 Default Click Action : 默认的按钮确认事件Default Back Action : 默认的返回撤回事件 Common Activatable Widget可以选择是否接受Back Action事件如果勾选Is Back Handler默认情况下接收到Back Action事件该Common Activatable Widget会被Deactivate。 Common Input Base Controller Data 在Common Input Seetings中的Controller Data下面可以就是配置针对各个平台控制器按键图标的地方 1.3 即使焦点没有落到该按钮上也可以使用指定按键触发该按钮并且按钮上会显示按键提示图标(Input Action和Triggering Input Action) 如果UI上的按钮较多或着有些常用按钮距离较远我们常常希望即使控制焦点没有在那个按钮上也能够用键盘或游戏手柄的某个特定按键触发这个按钮这就是Common UI中的Input Action类似快捷键。 实现Input Action的也要基于上面1.2中的若干设置接下来实现Input Action有两种方式 使用名为InputActionWidget的UCommonActionWidget也就是上文中可以接受并显示默认Click事件图标的那个UCommonActionWidget这时只需要在Triggering Input Action中配置触发它的事件即可配置方法和上文中配置默认事件的方法一样。注意Input Action无论是否获得控制焦点均会显示。这说明它就不再显示默认Click图标了。 2. 自定义一个UCommonActionWidget 这时我们需要在构造函数(Construct)或预构造函数(Pre Construct)中将它设置给Triggering Input Action 1.4 当前UI触发按键提示栏(Common Bound Action Bar) 当一个UI有很多按钮都有Input Action触发键的时候我们想在一目了然的地方比如屏幕左下角做一个显示全部或部分触发键图标的提示栏。 这个功能的实现需要用到Common UI为我们提供的Common Bound Action Bar Common Bound Action Bar中的按键图标以及按键功能提示依赖于Action Button Class中提供的Common Bound Action Button类这个类派生自刚才我们使用过的UCommonButtonBase 它们的工作逻辑也是一样的只不过里面又多了一个UCommonTextBlock类型的Text_ActionName和InputActionWidget一样Text_ActionName也是和蓝图绑定的用于显示按键说明文字。 protected:UPROPERTY(BlueprintReadOnly, meta (BindWidget), Category Text Block)TObjectPtrUCommonTextBlock Text_ActionName;如果一个按钮的触发按键想显示在Action Bar中只需要配置其Triggering Input Action并勾选下面的选项即可。 2. 小结 码了这么多字好累
http://www.yutouwan.com/news/206218/

相关文章:

  • 防水网站建设浙江省旅游企业网站建设情况
  • 手机网站有免费做的吗?做网站 sql 用哪种
  • 外贸出口建站网站上的广告怎么做
  • 怎么爬虫做网站注册公司材料怎么准备
  • 杭州设计制作网站公司网站建设模板
  • 网站建设前台与后台最新技术wordpress注册邮箱怎么修改
  • 合肥 网站设计wordpress 端口映射
  • 网站备案 自己的服务器家庭装修效果图大全2021图片
  • 个人网站导航模版seo教学网seo
  • 电商网站订烟网站平台建设包括哪些
  • 福安网站开发成都网站建设公司优势
  • 济南网站建设优化网站建设公司怎么推广
  • 网站服务器试用市场推广怎么写
  • 建材网站建设 南宁房产证
  • 专门帮忙做网站的公司河南工程建设信息网查
  • 如何做电影网站资源手机笑话网站源码
  • html网站开发案例网页编辑排版
  • 点样做网站自助建站教程
  • 免费1级做看网站网站设计建设维护
  • 大连网站设计菲尔莱斯哪家公司做网站便宜
  • 长沙企业建网站网站设计科技有限公司
  • 福州服务类网站建设西安it培训机构
  • 山西临汾建设局网站建筑模板规格尺寸
  • 贵阳网站设计报价苏州住建局官网平台
  • 合肥效果好的网站推广网站制作 杭州公司
  • 网站建设先航科技24小时妇科免费问医生
  • 商城网站建设合同书点击一个网站跳转到图片怎么做
  • 淄博市住房和城乡建设厅网站上海哪里做网站好
  • 建设网站需要多少时间襄阳seo公司
  • 网页广告怎么投放吉林网络营销方式优化