FairyGUI

FairyGUI知识总结:

创建:UIPackage.AddPackage(“demo”);
销毁:view.Dispose();

设置显示层级:panel.SetSortingOrder(1, true);
UIPanel在屏幕上的显示顺序是由他的sortingOrder属性决定的。sortingOrder越大,显示在越前面(越靠近屏幕)。
//对sortingOrder为100的UIPanel按z进行排序,z值越小,显示在越前面。Stage.inst.SortWorldSpacePanelsByZOrder(100);

游戏字体设置:
Resources目录,你只需要直接设置UIConfig.defaultFont=”字体名称”即可,同样,多个字体名称用逗号隔开。例如:
UIConfig.defaultFont=“Droid Sans Fallback, LTHYSZK, Helvetica-Bold, Microsoft YaHei”;
BaseFont font = FontManager.GetFont(“msyh”);
FontManager.RegisterFont(font, “微软雅黑”);
FontManager.RegisterFont(font, “Microsoft YaHei”);

GObject
设置坐标 SetXY、SetPosition或者单独设置x、y。
设置大小 SetSize或者单独设置width、height。SetSize还可以带第三个参数:
//忽略轴心的影响,即在设置了轴心的情况下,改变大小也不会同时改变坐标。aObject.SetSize(100,100,true);
设置大小限制 minWidth、maxWidth、minHeight、maxHei

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
-------------------- FairyGUI Copyright © 2014-2020 FairyGUI.com Version 3.4.0 support@fairygui.com -------------------- FairyGUI is a flexible UI framework for Unity, working with the professional FREE Game UI Editor: FairyGUI Editor. Download the editor from here: http://en.fairygui.com/ -------------------- Get Started -------------------- Run demos in Assets/FairyGUI/Examples/Scenes. The UI project is in Examples-UIProject.zip, unzip it anywhere. Use FairyGUI Editor to open it. Using FairyGUI in Unity: * Place a UIPanel in scene by using editor menu GameObject/FairyGUI/UIPanel. * Or using UIPackage.CreateObject to create UI component dynamically, and then use GRoot.inst.AddChild to show it on screen. ----------------- Version History ----------------- 3.4.0 - NEW: Add multi-display support. - NEW: Add API DynamicFont(name, font). - IMPROVED: Compatibility with 2018.3. - FIXED: Incorrect letter spacing on mobile platform. - FIXED: Same transition hook may be called twice. - FIXED: Exception raised when texture was disposed before object was disposed. 3.3.0 - NEW: Add textfield maxwidth feature. - NEW: Add API to query package dependencies. - IMPROVED: Graphics module refactor. Now it is more convenient to create various shapes(pie, lines, polygon etc) and do mesh deform. Memory usage on building mesh is also dropped. Also supports automatically setup uv for arbitrary quad to avoid seam between 2 triangles. All shaders are updated, don't forget to replace shaders in your project. - IMPROVED: Text-Brighter mechanism is removed, so FairyGUI-Text-Brighter.shader is removed. - IMPROVED: Add support for shrinking multi-line text. - IMPROVED: Improve Lua support. 3.2.0 - NEW: Add DisplayObjectInfo component. Define script symbol FAIRYGUI_TEST to enable it. - FIXED: A virtual list scrolling bug. - FIXED: A BlendMode bug. 3.1.0 - NEW: Draw extra 8 directions instead of 4 directions to archive text outline effect. Toggle option is UIConfig.enhancedTextOutlineEffect. - IMPROVED: Eexecution efficiency optimizations. - IMPROVED: GoWrapper now supports multiple materials. - FIXED: Correct cleanup action for RemovePackage. 3.0.0 From this version, we change package data format to binary. Editor version 3.9.0 with 'binary format' option checked in publish dialog is required to generating this kind of format. Old XML format is not supported anymore. - NEW: Add UIPackage.UnloadAssets and UIPackage.ReloadAssets to allow unload package resources without removing the package. - NEW: Add TransitionActionType.Text and TransitionActionType.Icon. 2.4.0 - NEW: GTween is introduced, DOTween is no longer used inside FairyGUI. - NEW: Transitions now support playing partially and pausing. - IMPROVED: Change the way of registering bitmap font. - FIXED: A GButton pivot issue. - FIXED: Correct text align behavior. 2.3.0 - NEW: Allow loader to load component. - NEW: Add text template feature. - FIXED: Exclude invisible object in FairyBatching. 2.2.0 - NEW: Modify shaders to fit linear color space. - IMPROVED: Improve relation system to handle conditions that anchor is set. - IMPROVED: Eliminate GC in transition. - FIXED: Fixed a bug of unloading bundle in UIPackage. - FIXED: Fixed issue that some blend mode(multiply, screen) works improperly. 2.1.0 - NEW: Add GGraph.DrawRoundRect. - NEW: Add FillType.ScaleNoBorder. - FIXED: Repair potential problems of virtual list. - FIXED: Fixed a bug in handling shared materials. 2.0.0 - NEW: RTL Text rendering support. Define scripting symbols RTL_TEXT_SUPPORT to enabled it. - NEW: Support for setting GObject.data in editor. - NEW: Support for setting selectedIcon of list item in editor. - IMPROVED: Add UIConfig.depthSupportForPaitingMode. - IMPROVED: Set sorting order of popup automatically. - FIXED: Fixed a text layout bug when line spacing is negative. - FIXED: Reset ScrollPane.draggingPane when an active scrollPane is being disposed. - FIXED: Fixed a bug of skew rendering.
在FairyGUI中创建下拉框(ComboBox)时,可以按照以下步骤进行操作: 1. 打开FairyGUI编辑器,并创建一个新的UI页面。 2. 在编辑器的资源列表中,选择一个下拉框组件(ComboBox)并将其拖放到舞台上。 3. 在属性检查器中,可以设置下拉框的大小、位置、默认选项等属性。 4. 右键点击下拉框组件,在弹出的菜单中选择"Edit Items"(编辑项)。 5. 在编辑项界面中,可以添加、删除和编辑下拉框的选项。每个选项由一个文本和一个值组成。你可以设置显示在下拉框中的文本以及对应的值。 6. 在代码中,你可以使用FairyGUI提供的API来操作下拉框。例如,你可以通过`GComboBox`类来获取下拉框实例,并使用`items`属性来设置选项列表,使用`selectedIndex`属性来设置默认选中的索引,使用`value`属性来获取或设置当前选中项的值等。 以下是一个简单的示例代码,展示了如何在FairyGUI中创建和操作下拉框: ```lua local comboBox = UIPackage.CreateObject("包名", "下拉框名") -- 根据实际情况替换"包名"和"下拉框名" comboBox:SetSize(200, 30) comboBox.items = {"选项1", "选项2", "选项3"} comboBox.selectedIndex = 0 comboBox.value = "选项1" comboBox.onChanged:Add(function(context) print("当前选中的值:" .. comboBox.value) end) ``` 在上面的示例中,我们创建了一个名为`comboBox`的下拉框实例。我们设置了三个选项,并将第一个选项作为默认选中项。当选中项发生变化时,会触发`onChanged`事件,并打印当前选中的值。 请注意,上述示例代码是基于Lua语言的FairyGUI API,如果你在其他语言上使用FairyGUI,代码会有所不同。你需要根据具体的开发环境和语言选择相应的API和语法。 希望能对你有所帮助!如果还有其他问题,请随时提问。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值