GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - northWolf/FairyGUI_GenCode_Lua: FairyGUI.v2020 编辑器插件,用于生成 Lua UI绑定代码。

BranchesTags
Open more actions menu

Latest commit

 

History

6 Commits
6 Commits

Folders and files

NameName
Last commit message
Last commit date
FairyGUI_GenCode_Lua
FairyGUI_GenCode_Lua
 
 
LICENSE
LICENSE
 
 
README.en.md
README.en.md
 
 
README.md
README.md
 
 

Repository files navigation

FairyGUI_GenCode_Lua

介绍

FairyGUI.v2020 编辑器插件,用于生成 Lua UI绑定代码。

安装教程

克隆本项目到 FairyGUI 工程的 plugins 目录中,刷新 FairyGUI 编辑器插件窗口或重启编辑器。

使用说明

  1. 本项目理论上适用使用 Lua 作为UI逻辑的游戏引擎,但只在 Unity 引擎下进行了测试。
  2. 使用本插件前,需要先熟悉编辑器发布代码的功能,并开启发布代码。
  3. 使用 编辑器—项目设置—自定义属性 为插件功能赋值。
local customPropKeys = {
    key_gen_lua = { name = "key_gen_lua", default_value = "true" },
    key_lua_file_extension_name = { name = "key_lua_file_extension_name", default_value = "lua" },
    key_lua_path_root = { name = "key_lua_path_root", default_value = "UIGenCode/" },
    key_wrapper_namespace = { name = "key_wrapper_namespace", default_value = "" },
}
  • key_gen_lua 是否生成Lua代码,默认为值 true
  • key_lua_file_extension_name Lua文件的扩展名,默认值为 lua
  • key_lua_path_root 生成文件相对于Lua执行根路径的相对路径,默认值为 UIGenCode/
  • key_wrapper_namespace 框架层 FairyGUI 导出代码的命名空间,默认值为 CS.FairyGUI
  1. 生成文件是根据模板文件 component_template.txt 和 binder_template.txt 生成,以 $XXX 作为占位符,可以在此基础上继续自定义扩展。
  2. 使用生成文件示例:
	require("UIGenCode.init");
	UI_DemoComponent:CreateInstance();
    GRoot.inst:AddChild(UI_DemoComponent.__ui);
	UI_DemoComponent.m_btn_login.onClick:Add(function()
        print("btn clicked");
    end);
  • 绑定类是自动调用绑定方法的,只需要引入一次 init.lua 文件即可。
  • 为了使用方便,生成的组件类都是全局名称,这一点需要注意。如果不需要生成全局名称,则修改插件源码。
  • 组件实例默认赋值为 __ui 对象,为了防止被组件子级覆盖,使用了双下划线命名。
  • 不要手动修改生成文件,以免被下一次生成覆盖,更好的办法是修改插件源码和模板文件。
  1. 本项目参考了官方的 GenCode 插件,作为补充,提供Lua生成作为一个选项。

About

FairyGUI.v2020 编辑器插件,用于生成 Lua UI绑定代码。

Resources

Readme
MIT license
Activity

Stars

42 stars

Watchers

2 watching

Forks

14 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.