three三维四人打麻将游戏代码

代码语言:html

所属分类:其他

代码描述:gemini3生成three三维四人打麻将游戏代码

代码标签: gemini 生成 three 三维 四人 打麻将 游戏 代码

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>3D Web Mahjong - Three.js</title>
    <style>
        body { margin: 0; overflow: hidden; background: #222; font-family: "Microsoft YaHei", sans-serif; }
        
        #ui-layer {
            position: absolute;
            top: 0; left: 0; width: 100%; height: 100%;
            pointer-events: none;
            display: flex;
            flex-direction: column;
            justify-content: space-between;
        }

        #info {
            text-align: center;
            color: white;
            padding: 20px;
            text-shadow: 0 2px 4px rgba(0,0,0,0.8);
        }

        h1 { margin: 0; font-size: 24px; color: #e6b422; }
        p { color: #ccc; }

        #controls {
            pointer-events: auto;
            position: absolute;
            bottom: 50px;
            width: 100%;
            text-align: center;
        }

        button {
            background: #2ecc71;
            color: white;
            border: none;
            padding: 10px 30px;
            font-size: 18px;
            border-radius: 30px;
            cursor: pointer;
            box-shadow: 0 5px 15px rgba(0,0,0,0.3);
            transition: transform 0.1s;
        }
        button:hover { transform: scale(1.05); background: #27ae60; }
        button:active { transform: scale(0.95); }

    </style>
</head>
<body>

    <div id="ui-layer">
        <div id="info">
            <h1>3D 四人麻将演示</h1>
            <p>鼠标悬停选牌 | 左键点击出牌 | 拖拽旋转视角</p>
        </div>
        <div id="controls">
            <button onclick="shuffleAndDeal()">洗牌 / 重置</button>
        </div>
    </div>

    <!-- 引入 Three.js -->
    <script type="importmap">
        {
            "imports": {
                "three": "https://unpkg.com/three@0.160.0/build/three.module.js",
                "three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/"
            }
        }
    </script>

    <script type="module">
        import * as THREE from 'three';
        import { OrbitControls } from 'three/addons/controls/OrbitControls.js';

        // ================= 配置常量 =================
        const TILE_WIDTH = 3;
        const TILE_HEIGHT = 4;
        const TILE_DEPTH = 2;
        
        // 麻将 Unicode 字符映射 (简化演示,生成纹理用)
        // 1-9万, 1-9筒, 1-9索, 东南西北白发中
        const TILES_UNICODE = [
            '.........完整代码请登录后点击上方下载按钮下载查看

网友评论0