luxiaotao1123
2024-02-29 4d5c4b0cd06f865051e9c2e3f662b2292205ba5b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import * as React from 'react'
import * as PIXI from 'pixi.js';
import * as TWEEDLE from 'tweedle.js';
import { Button, message, Modal, Card } from 'antd';
import './index.css'
 
const Map = () => {
    const map = React.useRef();
    const [activeMap, setActiveMap] = React.useState('zone')
 
    React.useEffect(() => {
        const app = new PIXI.Application({
            width: window.innerWidth,
            height: window.innerHeight,
            background: '#1099bb',
            antialias: true,
        })
 
        app.stage.interactive = true;
        app.stage.hitArea = app.screen;
 
        globalThis.__PIXI_APP__ = app;
 
        map.current.appendChild(app.view);
 
        return () => {
            app.destroy(true, true);
        }
    }, []);
 
    console.log(1);
 
    return (
        <>
            <Card
                style={{ width: '100%', height: '100%' }}
                tabList={[
                    {
                        key: 'zone',
                        label: 'zone'
                    }
                ]}
                activeTabKey={activeMap}
                tabBarExtraContent={<Button>更多设置</Button>}
                onTabChange={(key) => {
                    setActiveMap(key);
                }}
                tabProps={{
                    size: 'middle',
                }}
            >
                <div
                    ref={map}
                >
                </div>
            </Card>
 
        </>
    )
}
 
export default Map;