部分集成的UI系统

// ===== UI菜单层 =====
commands.spawn((
    SceneEntity,
    Node {
        width: Val::Percent(100.0),
        height: Val::Percent(100.0),
        flex_direction: FlexDirection::Row,
        ..default()
    },
    // 使用高Z-index确保UI在Sprite之上
    GlobalZIndex(100),
    children![
        // 左侧菜单区域
        (
            Node {
                position_type: PositionType::Absolute,
                width: Val::Percent(50.0),
                height: Val::Percent(100.0),
                align_items: AlignItems::Start,
                justify_content: JustifyContent::Center,
                flex_direction: FlexDirection::Column,
                padding: UiRect {
                    left: Val::Px(50.0),
                    right: Val::Px(30.0),
                    top: Val::Px(0.0),
                    bottom: Val::Px(70.0),
                },
                row_gap: Val::Px(20.0),
                ..default()
            },
            ElementId("leftbox".to_string()), // 设置元素ID
            children![
                // Logo文本
                (
                    Text::new(logo_text),
                    TextFont {
                        font: assets.load("fonts/SarasaFixedHC-Regular.ttf"),
                        font_size: logo_font_size,
                        ..default()
                    },
                    TextColor(logo_text_color),
                    Node {
                        margin: UiRect {
                            left: Val::Px(20.0),
                            right: Val::Px(0.0),
                            top: Val::Px(0.0),
                            bottom: Val::Px(0.0),
                        },
                        ..default()
                    },
                    GlobalZIndex(110), // 比菜单容器更高
                ),
                // 菜单按钮
                create_button(&assets, "开始游戏", StartGameButton),
                create_button(&assets, "关于", AboutButton),
                create_button(&assets, "帮助", HelpButton),
                create_button(&assets, "退出", ExitGameButton),
            ],
        ),
        // 右侧透明区域(用于保持布局但不遮挡背景)
        (
            Node {
                width: Val::Percent(50.0),
                height: Val::Percent(100.0),
                // 不设置背景,保持透明
                ..default()
            },
        ),
    ],
));