All Projects → chexiongsheng → Xuui

chexiongsheng / Xuui

Licence: mit
xLua的mvvm框架,支持ugui,ngui,fairyGUI。。。

Programming Languages

lua
6591 projects

Projects that are alternatives of or similar to Xuui

Knight
Knight is a game framework based on Unity3D engine. It includes a complete assetbundle manager, a c# hotfix module based on ILRuntime, and a UI module based on MVVM, and other basic functions support.
Stars: ✭ 302 (+51.76%)
Mutual labels:  framework, unity, mvvm
Kit
Unity3D开发的工具包集合, 集成常见的开发组件以免于重复造轮子。佛系更新中。。。
Stars: ✭ 123 (-38.19%)
Mutual labels:  framework, unity
Iframework
Simple Unity Framework
Stars: ✭ 110 (-44.72%)
Mutual labels:  framework, unity
Parlour
A package of UI extensions, components and improvements for Unity's UI frameworks.
Stars: ✭ 132 (-33.67%)
Mutual labels:  framework, unity
Unity Experiment Framework
UXF - Framework for creating human behaviour experiments in Unity
Stars: ✭ 81 (-59.3%)
Mutual labels:  framework, unity
Lockstepplatform
Stars: ✭ 84 (-57.79%)
Mutual labels:  framework, unity
Unity Raymarching Framework
A framework to easy implement raymarching in unity. Include lots of hash,noise,fbm,SDF,rotate functions
Stars: ✭ 129 (-35.18%)
Mutual labels:  framework, unity
Bedrock
a plugin framework for winform application
Stars: ✭ 74 (-62.81%)
Mutual labels:  framework, mvvm
Core
CatLib lightweight dependency injection container
Stars: ✭ 148 (-25.63%)
Mutual labels:  framework, unity
Ecs
ECS for Unity with full game state automatic rollbacks
Stars: ✭ 151 (-24.12%)
Mutual labels:  framework, unity
Qframework
Unity3D System Design Architecture
Stars: ✭ 2,326 (+1068.84%)
Mutual labels:  framework, unity
Openmod
OpenMod .NET Plugin Framework
Stars: ✭ 81 (-59.3%)
Mutual labels:  framework, unity
Bdframework.core
[中]Simple! Easy! Powerful Unity3d game workflow! Unity3d framework:c# hotfix(ILRuntime)、asset manager、ui workflow、network debug... and so on
Stars: ✭ 1,196 (+501.01%)
Mutual labels:  framework, unity
Akane
Lightweight native iOS MVVM framework
Stars: ✭ 92 (-53.77%)
Mutual labels:  framework, mvvm
Neutronium
🚀 Build .NET desktop applications using HTML, CSS and javascript.
Stars: ✭ 1,190 (+497.99%)
Mutual labels:  framework, mvvm
Xnode
Unity Node Editor: Lets you view and edit node graphs inside Unity
Stars: ✭ 2,077 (+943.72%)
Mutual labels:  framework, unity
Htframework
Unity HTFramework, a rapid development framework of client to the unity.
Stars: ✭ 179 (-10.05%)
Mutual labels:  framework, unity
Mvvmrecurve
MVVM框架, 这个架构支持RestFul风格的Api和GraphQL,你可以根据自身需求添加recurve-retrofit2-support库(RestFul)或recurve-apollo-support库(GraphQL)实现相应的支持。 该架构同时使用纯Kotlin开发,但是你也可以在Java中使用它。
Stars: ✭ 51 (-74.37%)
Mutual labels:  framework, mvvm
Extosc
extOSC is a tool dedicated to simplify creation of applications in Unity with OSC protocol usage.
Stars: ✭ 69 (-65.33%)
Mutual labels:  framework, unity
Knockout Spa
A mini but full-fledged SPA framework and boilerplate to build SPAs fast and scalable
Stars: ✭ 145 (-27.14%)
Mutual labels:  framework, mvvm

XUUI

基于xLua的轻量级UI框架。

两大核心能力

  • 支持MVVM的单/双向绑定
  • 应用框架:模块加载,模块刷新(reload)、模块间(数据)隔离、模块间可控交互

科普MVVM

  • mvvm框架,支持你在UI上设置一些绑定路径,比如:info.name ,select啥的,然后你在逻辑代码那修改info.name ,所有绑定到info.name的UI组件都会自动发生变化,这是单向绑定。
  • mvvm框架还支持双向绑定:比如输入框绑定到info.name ,那么这个输入框的输入会自动修改info.name ,进而导致所有其它绑定到info.name 的UI组件都会自动发生变化。

特点

  • 可以和任意UI库配合,ugui,ngui,fairyGUI,你自己倒腾的UI库。。。Whatever you want
  • 支持把本框架作为一个mvvm驱动器,纯用C#写逻辑
  • 支持“计算属性”:“计算属性”依赖的各属性发生改变会触发“计算属性”的重计算
  • 可随时绑定View以及解绑定

示例

设置绑定信息

怎么操作?添加添加适配器(继承自MonoBehaviour)到GameObject,可以通过Component/XUUI菜单或者手动到XUUI\Scripts\UGUIAdapter目录找脚本拖放到GameObject,然后设置BindTo属性即可。

Helloworld示例UI节点的绑定信息如下:

  • InputField: info.name
  • Text : message,这是个“计算属性”,计算时用了info.name,当info.name发生变化会触发message重新计算,并自动更新Text。
  • Button : click,这会绑定到一个click command上

代码

public class Helloworld : MonoBehaviour
{
    Context context = null;

    void Start()
    {
        context = new Context(@"
            return {
                data = {
                    info = {
                        name = 'John',
                    },
                },
                computed = {
                    message = function(data)
                        return 'Hello ' .. data.info.name .. '!'
                    end
                },
                commands = {
                    click = function(data)
                        print(data.info.name)
                    end,
                },
            }
        ");

        context.Attach(gameObject);
    }

    void OnDestroy()
    {
        context.Dispose();
    }
}

根据一个lua脚本去new一个Context,该脚本仅简单的返回一个table,该table各字段含义如下:

  • data就是ViewModle(VM)
  • computed中引用到的VM元素,在其依赖的VM元素发生改变会自动重新计算并同步到各个绑定了它(比如上例的message)的节点
  • commands是类似按钮点击事件绑定的响应方法

然后就可以愉快的Attach到某个UI根节点了(可以Attach多个),这个UI跟节点设置了绑定信息的UI元素都会自动同步。

应用框架

Helloworld例子展现的是类似vue.js的能力,实际项目中,更建议以模块的方式来组织程序。XUUI提供的应用框架,能很好的实现模块间隔离,也能提供模块间的可控交互能力。

详细请看《应用框架》以及配套的实例程序。

例子说明

  • Helloworld.unity: 快速入门的例子。
  • MoreComplex.unity: 演示混合使用lua,C#静态函数,C#成员函数作为事件响应,演示怎么监听一个数组的变化并应用到UI元素上。
  • NoLua.unity: 演示不使用lua,把本框架作为一个mvvm驱动器,纯用C#写逻辑。
  • TestDetach.unity: 演示随意地挂载/卸载UI到一个ViewModel上。
  • App.unity: 演示应用框架怎么使用。

怎么支持各种UI

详细请看《如何和任意UI库适配》

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].