plutosdk 0.0.8-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +77 -0
- package/dist/pluto-sdk.js +2 -0
- package/lib/App.d.ts +24 -0
- package/lib/App.js +61 -0
- package/lib/components/BlurMask/index.d.ts +10 -0
- package/lib/components/BlurMask/index.js +14 -0
- package/lib/components/CatAni/index.d.ts +30 -0
- package/lib/components/CatAni/index.js +243 -0
- package/lib/components/GameInfo/index.d.ts +10 -0
- package/lib/components/GameInfo/index.js +17 -0
- package/lib/components/Index/index.d.ts +10 -0
- package/lib/components/Index/index.js +15 -0
- package/lib/components/Login/index.d.ts +10 -0
- package/lib/components/Login/index.js +28 -0
- package/lib/components/NetLoading/index.d.ts +7 -0
- package/lib/components/NetLoading/index.js +12 -0
- package/lib/components/PayButton/index.d.ts +16 -0
- package/lib/components/PayButton/index.js +18 -0
- package/lib/components/PlayButton/index.d.ts +29 -0
- package/lib/components/PlayButton/index.js +56 -0
- package/lib/components/Purchase/index.d.ts +61 -0
- package/lib/components/Purchase/index.js +183 -0
- package/lib/components/ShareButton/index.d.ts +14 -0
- package/lib/components/ShareButton/index.js +29 -0
- package/lib/components/StrokeText/index.d.ts +18 -0
- package/lib/components/StrokeText/index.js +32 -0
- package/lib/components/WalletInfo/index.d.ts +36 -0
- package/lib/components/WalletInfo/index.js +107 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +4 -0
- package/lib/interface.d.ts +42 -0
- package/lib/interface.js +1 -0
- package/lib/main.d.ts +5 -0
- package/lib/main.js +19 -0
- package/lib/sdk.d.ts +46 -0
- package/lib/sdk.js +306 -0
- package/lib/utils/Api.d.ts +32 -0
- package/lib/utils/Api.js +122 -0
- package/lib/utils/Net.d.ts +33 -0
- package/lib/utils/Net.js +94 -0
- package/lib/utils/Platform.d.ts +63 -0
- package/lib/utils/Platform.js +142 -0
- package/lib/utils/User.d.ts +62 -0
- package/lib/utils/User.js +78 -0
- package/lib/utils/Utils.d.ts +10 -0
- package/lib/utils/Utils.js +72 -0
- package/lib/utils/WalletManager.d.ts +52 -0
- package/lib/utils/WalletManager.js +236 -0
- package/lib/utils/config.d.ts +25 -0
- package/lib/utils/config.js +72 -0
- package/lib/utils/constant.d.ts +38 -0
- package/lib/utils/constant.js +43 -0
- package/package.json +51 -0
package/lib/App.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PureComponent } from 'react';
|
|
2
|
+
import { PAGE_ID } from './utils/constant';
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
*/
|
|
6
|
+
export default class App extends PureComponent {
|
|
7
|
+
state: {
|
|
8
|
+
pageId: PAGE_ID;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
componentDidMount(): void;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
* @param _
|
|
21
|
+
* @param pageId
|
|
22
|
+
*/
|
|
23
|
+
onSwitchPage: (_: string, pageId: PAGE_ID) => void;
|
|
24
|
+
}
|
package/lib/App.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { PureComponent } from 'react';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import { styled } from '@mui/material';
|
|
5
|
+
import PubSub from 'pubsub-js';
|
|
6
|
+
import { EVENT_SWITCH_PAGE, PAGE_ID } from './utils/constant';
|
|
7
|
+
import Index from './components/Index';
|
|
8
|
+
import Login from './components/Login';
|
|
9
|
+
import Purchase from './components/Purchase';
|
|
10
|
+
//
|
|
11
|
+
const Layout = styled(Box)(() => ({
|
|
12
|
+
height: '100%',
|
|
13
|
+
width: '100%',
|
|
14
|
+
display: 'flex',
|
|
15
|
+
position: 'fixed',
|
|
16
|
+
zIndex: 999,
|
|
17
|
+
left: 0,
|
|
18
|
+
top: 0
|
|
19
|
+
}));
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export default class App extends PureComponent {
|
|
24
|
+
constructor() {
|
|
25
|
+
super(...arguments);
|
|
26
|
+
//
|
|
27
|
+
this.state = {
|
|
28
|
+
pageId: PAGE_ID.Index
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @param _
|
|
33
|
+
* @param pageId
|
|
34
|
+
*/
|
|
35
|
+
this.onSwitchPage = (_, pageId) => {
|
|
36
|
+
this.setState({ pageId });
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
componentDidMount() {
|
|
43
|
+
PubSub.subscribe(EVENT_SWITCH_PAGE, this.onSwitchPage);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
render() {
|
|
49
|
+
const { pageId } = this.state;
|
|
50
|
+
switch (pageId) {
|
|
51
|
+
case PAGE_ID.Index:
|
|
52
|
+
return (_jsx(Layout, { children: _jsx(Index, {}) }));
|
|
53
|
+
case PAGE_ID.Login:
|
|
54
|
+
return (_jsx(Layout, { children: _jsx(Login, {}) }));
|
|
55
|
+
case PAGE_ID.Purchase:
|
|
56
|
+
return (_jsx(Layout, { children: _jsx(Purchase, {}) }));
|
|
57
|
+
default:
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { PureComponent } from 'react';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
export default class BlurMask extends PureComponent {
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
render() {
|
|
12
|
+
return (_jsx(Box, { sx: { width: '100%', height: '100%', position: 'absolute', left: 0, top: 0, background: 'rgba(0,0,0,0.4)', backgroundSize: "cover", backdropFilter: 'blur(10px)', WebkitBackdropFilter: 'blur(10px)' } }));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PureComponent } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
export default class index extends PureComponent {
|
|
6
|
+
private _frameUrl;
|
|
7
|
+
private _totalFrame;
|
|
8
|
+
private _unmount;
|
|
9
|
+
private _timer;
|
|
10
|
+
state: {
|
|
11
|
+
resLoaded: boolean;
|
|
12
|
+
currentFrame: number;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
*/
|
|
17
|
+
componentDidMount(): void;
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
componentWillUnmount(): void;
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
startAni: () => void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { PureComponent } from 'react';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import { getRes } from '../../utils/Utils';
|
|
5
|
+
//
|
|
6
|
+
const CAT_BALL_FRAME = {
|
|
7
|
+
0: {
|
|
8
|
+
x: 0,
|
|
9
|
+
y: 0
|
|
10
|
+
},
|
|
11
|
+
1: {
|
|
12
|
+
x: -222,
|
|
13
|
+
y: 0
|
|
14
|
+
},
|
|
15
|
+
2: {
|
|
16
|
+
x: -444,
|
|
17
|
+
y: 0
|
|
18
|
+
},
|
|
19
|
+
3: {
|
|
20
|
+
x: -666,
|
|
21
|
+
y: 0
|
|
22
|
+
},
|
|
23
|
+
4: {
|
|
24
|
+
x: -888,
|
|
25
|
+
y: 0
|
|
26
|
+
},
|
|
27
|
+
5: {
|
|
28
|
+
x: 0,
|
|
29
|
+
y: -119
|
|
30
|
+
},
|
|
31
|
+
6: {
|
|
32
|
+
x: -222,
|
|
33
|
+
y: -119
|
|
34
|
+
},
|
|
35
|
+
7: {
|
|
36
|
+
x: -444,
|
|
37
|
+
y: -119
|
|
38
|
+
},
|
|
39
|
+
8: {
|
|
40
|
+
x: -666,
|
|
41
|
+
y: -119
|
|
42
|
+
},
|
|
43
|
+
9: {
|
|
44
|
+
x: -888,
|
|
45
|
+
y: -119
|
|
46
|
+
},
|
|
47
|
+
10: {
|
|
48
|
+
x: 0,
|
|
49
|
+
y: -238
|
|
50
|
+
},
|
|
51
|
+
11: {
|
|
52
|
+
x: -222,
|
|
53
|
+
y: -238
|
|
54
|
+
},
|
|
55
|
+
12: {
|
|
56
|
+
x: -444,
|
|
57
|
+
y: -238
|
|
58
|
+
},
|
|
59
|
+
13: {
|
|
60
|
+
x: -666,
|
|
61
|
+
y: -238
|
|
62
|
+
},
|
|
63
|
+
14: {
|
|
64
|
+
x: -888,
|
|
65
|
+
y: -238
|
|
66
|
+
},
|
|
67
|
+
15: {
|
|
68
|
+
x: 0,
|
|
69
|
+
y: -357
|
|
70
|
+
},
|
|
71
|
+
16: {
|
|
72
|
+
x: -222,
|
|
73
|
+
y: -357
|
|
74
|
+
},
|
|
75
|
+
17: {
|
|
76
|
+
x: -444,
|
|
77
|
+
y: -357
|
|
78
|
+
},
|
|
79
|
+
18: {
|
|
80
|
+
x: -666,
|
|
81
|
+
y: -357
|
|
82
|
+
},
|
|
83
|
+
19: {
|
|
84
|
+
x: -888,
|
|
85
|
+
y: -357
|
|
86
|
+
},
|
|
87
|
+
20: {
|
|
88
|
+
x: 0,
|
|
89
|
+
y: -476
|
|
90
|
+
},
|
|
91
|
+
21: {
|
|
92
|
+
x: 0,
|
|
93
|
+
y: -595
|
|
94
|
+
},
|
|
95
|
+
22: {
|
|
96
|
+
x: 0,
|
|
97
|
+
y: -714
|
|
98
|
+
},
|
|
99
|
+
23: {
|
|
100
|
+
x: 0,
|
|
101
|
+
y: -833
|
|
102
|
+
},
|
|
103
|
+
24: {
|
|
104
|
+
x: -222,
|
|
105
|
+
y: -476
|
|
106
|
+
},
|
|
107
|
+
25: {
|
|
108
|
+
x: -444,
|
|
109
|
+
y: -476
|
|
110
|
+
},
|
|
111
|
+
26: {
|
|
112
|
+
x: -666,
|
|
113
|
+
y: -476
|
|
114
|
+
},
|
|
115
|
+
27: {
|
|
116
|
+
x: -888,
|
|
117
|
+
y: -476
|
|
118
|
+
},
|
|
119
|
+
28: {
|
|
120
|
+
x: -222,
|
|
121
|
+
y: -595
|
|
122
|
+
},
|
|
123
|
+
29: {
|
|
124
|
+
x: -222,
|
|
125
|
+
y: -714
|
|
126
|
+
},
|
|
127
|
+
30: {
|
|
128
|
+
x: -222,
|
|
129
|
+
y: -833
|
|
130
|
+
},
|
|
131
|
+
31: {
|
|
132
|
+
x: -444,
|
|
133
|
+
y: -595
|
|
134
|
+
},
|
|
135
|
+
32: {
|
|
136
|
+
x: -666,
|
|
137
|
+
y: -595
|
|
138
|
+
},
|
|
139
|
+
33: {
|
|
140
|
+
x: -888,
|
|
141
|
+
y: -595
|
|
142
|
+
},
|
|
143
|
+
34: {
|
|
144
|
+
x: -444,
|
|
145
|
+
y: -714
|
|
146
|
+
},
|
|
147
|
+
35: {
|
|
148
|
+
x: -444,
|
|
149
|
+
y: -833
|
|
150
|
+
},
|
|
151
|
+
36: {
|
|
152
|
+
x: -666,
|
|
153
|
+
y: -714
|
|
154
|
+
},
|
|
155
|
+
37: {
|
|
156
|
+
x: -888,
|
|
157
|
+
y: -714
|
|
158
|
+
},
|
|
159
|
+
38: {
|
|
160
|
+
x: -666,
|
|
161
|
+
y: -833
|
|
162
|
+
},
|
|
163
|
+
39: {
|
|
164
|
+
x: -888,
|
|
165
|
+
y: -833
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
*
|
|
170
|
+
*/
|
|
171
|
+
export default class index extends PureComponent {
|
|
172
|
+
constructor() {
|
|
173
|
+
super(...arguments);
|
|
174
|
+
//
|
|
175
|
+
this._frameUrl = `${getRes('cat_ball.png')}`;
|
|
176
|
+
//
|
|
177
|
+
this._totalFrame = Object.keys(CAT_BALL_FRAME).length;
|
|
178
|
+
//
|
|
179
|
+
this._unmount = false;
|
|
180
|
+
//
|
|
181
|
+
this._timer = null;
|
|
182
|
+
//
|
|
183
|
+
this.state = {
|
|
184
|
+
resLoaded: false,
|
|
185
|
+
currentFrame: 0
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
*
|
|
189
|
+
*/
|
|
190
|
+
this.startAni = () => {
|
|
191
|
+
if (this._unmount) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
//
|
|
195
|
+
this._timer = window.setInterval(() => {
|
|
196
|
+
const { currentFrame } = this.state;
|
|
197
|
+
this.setState({
|
|
198
|
+
currentFrame: (currentFrame + 1) % this._totalFrame
|
|
199
|
+
});
|
|
200
|
+
}, 80);
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
*
|
|
205
|
+
*/
|
|
206
|
+
componentDidMount() {
|
|
207
|
+
let image = new Image();
|
|
208
|
+
image.src = this._frameUrl;
|
|
209
|
+
image.onload = () => {
|
|
210
|
+
this.setState({
|
|
211
|
+
resLoaded: true
|
|
212
|
+
});
|
|
213
|
+
this.startAni();
|
|
214
|
+
};
|
|
215
|
+
image.onerror = () => {
|
|
216
|
+
console.log('image onerror');
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
*
|
|
221
|
+
*/
|
|
222
|
+
componentWillUnmount() {
|
|
223
|
+
this._unmount = true;
|
|
224
|
+
if (this._timer) {
|
|
225
|
+
window.clearInterval(this._timer);
|
|
226
|
+
this._timer = null;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
*
|
|
231
|
+
*/
|
|
232
|
+
render() {
|
|
233
|
+
const { resLoaded, currentFrame } = this.state;
|
|
234
|
+
if (!resLoaded) {
|
|
235
|
+
return (_jsx(Box, { sx: { marginLeft: 8, height: 118 } }));
|
|
236
|
+
}
|
|
237
|
+
//
|
|
238
|
+
let pos = CAT_BALL_FRAME[currentFrame] || {};
|
|
239
|
+
let x = `${(pos.x) || 0}px`;
|
|
240
|
+
let y = `${(pos.y) || 0}px`;
|
|
241
|
+
return (_jsx(Box, Object.assign({ sx: { marginLeft: 8, height: 118 } }, { children: _jsx(Box, { sx: { width: 221, height: 118, backgroundImage: `url(${this._frameUrl})`, backgroundPosition: `${x} ${y}`, display: 'inline-block' } }) })));
|
|
242
|
+
}
|
|
243
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { PureComponent } from 'react';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import { Avatar } from '@mui/material';
|
|
5
|
+
import user from '../../utils/User';
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
export default class GameInfo extends PureComponent {
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
render() {
|
|
14
|
+
const { icon, name, describe } = user.gameInfo;
|
|
15
|
+
return (_jsxs(Box, Object.assign({ sx: { paddingBottom: 2 } }, { children: [_jsxs(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center', paddingTop: 2 } }, { children: [_jsx(Avatar, Object.assign({ src: icon, sx: { width: 60, height: 60 }, variant: 'square' }, { children: "G" })), _jsx(Box, Object.assign({ sx: { marginLeft: 1.4, fontSize: 22, fontWeight: 'bold', color: '#7c4b30' } }, { children: name }))] })), _jsx(Box, Object.assign({ sx: { textAlign: 'left', wordWrap: 'break-word', marginTop: 1, fontSize: 14, fontWeight: 800, color: '#ca996e' } }, { children: describe }))] })));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { PureComponent } from 'react';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import { getRes } from '../../utils/Utils';
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export default class index extends PureComponent {
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
render() {
|
|
13
|
+
return (_jsx(Box, { sx: { width: '100%', height: '100%', position: 'relative', backgroundImage: `url(${getRes('bg1.png')})` } }));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { PureComponent } from 'react';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import { styled } from '@mui/material';
|
|
5
|
+
import Zoom from '@mui/material/Zoom';
|
|
6
|
+
import { getRes } from '../../utils/Utils';
|
|
7
|
+
import GameInfo from '../GameInfo';
|
|
8
|
+
import ShareButton from '../ShareButton';
|
|
9
|
+
import PlayButton from '../PlayButton';
|
|
10
|
+
import CatAni from '../CatAni';
|
|
11
|
+
//
|
|
12
|
+
const InfoLayout = styled(Box)(() => ({
|
|
13
|
+
width: '100%',
|
|
14
|
+
maxWidth: 430,
|
|
15
|
+
margin: '0 auto',
|
|
16
|
+
position: 'relative'
|
|
17
|
+
}));
|
|
18
|
+
/**
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export default class Login extends PureComponent {
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
*/
|
|
25
|
+
render() {
|
|
26
|
+
return (_jsxs(Box, Object.assign({ sx: { width: '100%', height: '100%', position: 'relative', backgroundImage: `url(${getRes('bg1.png')})` } }, { children: [_jsx(Box, { sx: { width: '100%', height: '100%', position: 'relative', backgroundImage: `url(${getRes('bg3.png')})` } }), _jsxs(Box, Object.assign({ sx: { width: '100%', top: '6%', textAlign: 'center', position: 'absolute' } }, { children: [_jsx(CatAni, {}), _jsx(Box, Object.assign({ sx: { fontSize: 24, fontWeight: 'bold', color: '#764428' } }, { children: "Catizen" })), _jsx(Box, Object.assign({ sx: { margin: '0 auto', width: 300, textAlign: 'center', wordWrap: 'break-word', fontSize: 18, fontWeight: 'bold', color: '#bc805e' } }, { children: "Where every game leads to an airdrop adventure" }))] })), _jsx(Box, Object.assign({ sx: { width: '100%', bottom: 20, position: 'absolute' } }, { children: _jsx(Zoom, Object.assign({ in: true }, { children: _jsxs(Box, { children: [_jsxs(InfoLayout, { children: [_jsx(Box, { sx: { width: '100%', height: '100%', position: 'absolute', borderImage: `url(${getRes('bg2.png')})`, borderWidth: 40, borderStyle: 'solid', borderImageRepeat: 'repeat', borderImageSlice: '40 fill' } }), _jsxs(Box, Object.assign({ sx: { position: 'relative', paddingTop: 1, paddingRight: 4, paddingBottom: 4, paddingLeft: 4 } }, { children: [_jsx(GameInfo, {}), _jsx(ShareButton, {})] }))] }), _jsx(InfoLayout, Object.assign({ sx: { paddingTop: 2 } }, { children: _jsx(PlayButton, {}) }))] }) })) }))] })));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { PureComponent } from 'react';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export default class index extends PureComponent {
|
|
9
|
+
render() {
|
|
10
|
+
return (_jsx(Box, Object.assign({ sx: { top: 0, right: 0, bottom: 0, left: 0, zIndex: 3, display: 'flex', alignItems: 'center', justifyContent: 'center', position: 'absolute' } }, { children: _jsxs(Box, Object.assign({ sx: { position: 'relative', display: 'flex', alignItems: 'center', justifyContent: 'center' } }, { children: [_jsx(Box, { sx: { width: 120, height: 80, backgroundColor: '#424242', borderRadius: 2, opacity: 0.7 } }), _jsx(Box, Object.assign({ sx: { top: 0, right: 0, bottom: 0, left: 0, display: 'flex', alignItems: 'center', justifyContent: 'center', position: 'absolute', color: '#fff' } }, { children: _jsx(CircularProgress, { color: "inherit" }) }))] })) })));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { MouseEventHandler, PureComponent } from 'react';
|
|
2
|
+
interface IProps {
|
|
3
|
+
content: string;
|
|
4
|
+
icon: string;
|
|
5
|
+
onClick: MouseEventHandler<HTMLButtonElement>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export default class index extends PureComponent<IProps> {
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { PureComponent } from 'react';
|
|
3
|
+
import Box from '@mui/material/Box';
|
|
4
|
+
import Button from '@mui/material/Button';
|
|
5
|
+
import { getRes } from '../../utils/Utils';
|
|
6
|
+
import StrokeText from '../StrokeText';
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export default class index extends PureComponent {
|
|
11
|
+
/**
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
render() {
|
|
15
|
+
const { content, icon, onClick } = this.props;
|
|
16
|
+
return (_jsx(Box, Object.assign({ sx: { height: 50, position: 'relative' } }, { children: _jsxs(Button, Object.assign({ sx: { width: '100%', height: '100%', borderRadius: 3 }, variant: 'contained', onClick: onClick }, { children: [_jsx(Box, { sx: { width: '100%', height: '100%', position: 'absolute', top: 0, borderImage: `url(${getRes('button_2.png')})`, borderWidth: 20, borderStyle: 'solid', borderImageRepeat: 'repeat', borderImageSlice: '20 fill' } }), _jsxs(Box, Object.assign({ sx: { height: '100%', position: 'absolute', top: 0, display: 'flex', alignItems: 'center' } }, { children: [_jsx(Box, { component: 'img', src: icon, sx: { width: 30, height: 30, marginRight: 1 } }), _jsx(StrokeText, { content: content, fontSize: 22, color: '#fff', strokeColor: '#4a7408', strokeWidth: 3 })] }))] })) })));
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { PureComponent } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
5
|
+
export default class PlayButton extends PureComponent {
|
|
6
|
+
state: {
|
|
7
|
+
showPlay: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
componentDidMount(): void;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
componentWillUnmount(): void;
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
render(): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
*/
|
|
24
|
+
onReady: (_: string, ready: boolean) => void;
|
|
25
|
+
/**
|
|
26
|
+
*
|
|
27
|
+
*/
|
|
28
|
+
onClickPlay: () => void;
|
|
29
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { PureComponent } from 'react';
|
|
3
|
+
import Button from '@mui/material/Button';
|
|
4
|
+
import Box from '@mui/material/Box';
|
|
5
|
+
import CircularProgress from '@mui/material/CircularProgress';
|
|
6
|
+
import PubSub from 'pubsub-js';
|
|
7
|
+
import { EVENT_GAME_READY, EVENT_SWITCH_PAGE, PAGE_ID } from '../../utils/constant';
|
|
8
|
+
import { getRes } from '../../utils/Utils';
|
|
9
|
+
import StrokeText from '../StrokeText';
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export default class PlayButton extends PureComponent {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
//
|
|
17
|
+
this.state = {
|
|
18
|
+
showPlay: false
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
this.onReady = (_, ready) => {
|
|
24
|
+
this.setState({ showPlay: ready });
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
this.onClickPlay = () => {
|
|
30
|
+
PubSub.publish(EVENT_SWITCH_PAGE, PAGE_ID.None);
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
*
|
|
35
|
+
*/
|
|
36
|
+
componentDidMount() {
|
|
37
|
+
PubSub.subscribe(EVENT_GAME_READY, this.onReady);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
componentWillUnmount() {
|
|
43
|
+
PubSub.unsubscribe(this.onReady);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
render() {
|
|
49
|
+
const { showPlay } = this.state;
|
|
50
|
+
if (showPlay) {
|
|
51
|
+
return (_jsx(Box, Object.assign({ sx: { height: 50, position: 'relative' } }, { children: _jsx(Box, Object.assign({ sx: { left: 10, right: 10, height: '100%', position: 'absolute' } }, { children: _jsxs(Button, Object.assign({ sx: { width: '100%', height: '100%', borderRadius: 3 }, variant: 'contained', onClick: this.onClickPlay }, { children: [_jsx(Box, { sx: { width: '100%', height: '100%', position: 'absolute', top: 0, borderImage: `url(${getRes('button_1.png')})`, borderWidth: 20, borderStyle: 'solid', borderImageRepeat: 'repeat', borderImageSlice: '20 fill' } }), _jsx(Box, Object.assign({ sx: { height: '100%', position: 'absolute', top: 0, display: 'flex', alignItems: 'center' } }, { children: _jsx(StrokeText, { content: 'Play', fontSize: 22, color: '#fff', strokeColor: '#0e3772', strokeWidth: 3 }) }))] })) })) })));
|
|
52
|
+
}
|
|
53
|
+
//
|
|
54
|
+
return (_jsx(Box, Object.assign({ sx: { height: 50, position: 'relative' } }, { children: _jsxs(Box, Object.assign({ sx: { left: 10, right: 10, height: '100%', position: 'absolute', } }, { children: [_jsx(Box, { sx: { width: '100%', height: '100%', position: 'absolute', top: 0, borderImage: `url(${getRes('button_3.png')})`, borderWidth: 20, borderStyle: 'solid', borderImageRepeat: 'repeat', borderImageSlice: '20 fill' } }), _jsxs(Box, Object.assign({ sx: { width: '100%', height: 46, color: '#fff', display: 'flex', justifyContent: 'center', alignItems: 'center', position: 'absolute' } }, { children: [_jsx(StrokeText, { content: 'Loading', fontSize: 22, color: '#fff', strokeColor: '#505151', strokeWidth: 3 }), _jsx(CircularProgress, { sx: { position: 'absolute', right: 20 }, color: "inherit", size: 28 })] }))] })) })));
|
|
55
|
+
}
|
|
56
|
+
}
|