Minecraft Flex UI

作者:rebot | 分类:模组

价格:0 墨喵币 下载量:0 点赞:0 版本 0.0.1
本资源为搬运资源,原资源地址: https://modrinth.com/mod/minecraft-flex-ui
资源信息

Minecraft 版本: 1.19 1.19.1 1.19.2 1.19.3

平台: fabric

标签: library utility

资源介绍

Minecraft Flex UI

For ordinary players do not download the mod

In most cases the module is used by other module developers and is included in their mod Jar package

Description

Based on facebook open source Yoga layout engine implements the Minecraft GUI framework based on the Flex layout.

A subset of the Flex standard is implemented on top of Yoga and most of the CSS properties are implemented as well.

The design concept of MVC is adopted to realize the one-way and two-way data binding.

Developers can design and implement complex UI interfaces on top of this, and this project can be used as Yoga engine embedded in the game as a non-exhaustive reference implementation of the game layout engine.

Example

example

public class WidgetTestScreen extends WidgetScreen {
    protected StringBuilderObservable text = new StringBuilderObservable();

    public WidgetTestScreen() {
        super(Text.of("test"));
    }

    @Override
    public void widget(ScreenWidget root) {
        root.flexDirection.set(WidgetFlexDirection.Row)
                .justifyContent.set(WidgetJustify.Center)
                .alignItems.set(WidgetAlign.Center)
                .child(new BoxWidget()
                        .background.set(RectDrawable.LIGHT_PANEL)
                        .child(new LabelWidget()
                                .text.binding(text.computed((StringBuilderObservable text) -> Text.of(text.getString())))
                                .margin(WidgetEdge.All, 4))
                        .child(new TextBoxWidget()
                                .text.binding(text))
                        .child(new ButtonWidget()
                                .click.on((mouse) -> close())
                                .child(new LabelWidget()
                                        .text.set(Text.of("取消"))))
                );
    }
}

Data Binding

By default all bindings from non-computed binding sources are bi-directional bindings.

Setting values for computed binding sources is ignored

But most components will only operate one-way on bound values

下载太慢?试试 墨喵加速站,支持 Modrinth 和外网直链高速下载! 用的人越多,下载的越快!
下载与版本
评论(0)
登录 后发表评论。

暂无评论,抢个沙发吧~

举报此资源

请登录后举报

🔥 相关推荐
Expanded Mace Enchantings

价格:0 墨喵币
下载量:0

查看详情
Furnaces Revival

价格:0 墨喵币
下载量:0

查看详情
RPG: Better Elderguardian Lite

价格:0 墨喵币
下载量:0

查看详情
Plants vs Zombie:Minecraft Warfare | PvZ

价格:0 墨喵币
下载量:0

查看详情