pixuireactcomponents 1.3.18 → 1.3.20
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/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +1 -4
- package/src/components/react/app/button/Button.d.ts +8 -18
- package/src/components/react/app/button/Button.jsx +28 -71
- package/src/components/react/app/carousel/Carousel.d.ts +29 -1
- package/src/components/react/app/carousel/Carousel.jsx +30 -7
- package/src/components/react/app/checkBox/CheckBox.d.ts +6 -1
- package/src/components/react/base/pixVideo/PixPlaceHolder.d.ts +1 -0
- package/src/components/react/base/pixVideo/PixPlaceHolder.jsx +3 -4
- package/src/components/react/base/pixVideo/PixVideo.d.ts +2 -0
- package/src/components/react/base/pixVideo/PixVideo.jsx +44 -24
- package/src/sample/button/ButtonDemo.d.ts +0 -2
- package/src/sample/button/ButtonDemo.jsx +4 -33
- package/src/sample/carousel/carouselDemo.jsx +2 -2
- package/src/sample/checkBox/checkBoxDemo.jsx +3 -3
- package/src/sample/slider/SliderDemo.d.ts +2 -2
- package/src/sample/slider/SliderDemo.jsx +6 -2
package/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { Checkbox } from "./src/components/react/app/checkBox/CheckBox";
|
|
|
4
4
|
export { Dropdown } from "./src/components/react/app/dropdown/Dropdown";
|
|
5
5
|
export { ImageViewer } from "./src/components/react/app/imageViewer/imageViewer";
|
|
6
6
|
export { Slider } from "./src/components/react/app/slider/Slider";
|
|
7
|
+
export { ToggleGroup } from "./src/components/react/app/togglegroup/ToggleGroup";
|
|
7
8
|
export { GradientText } from "./src/components/react/base/gradient/GradientText";
|
|
8
9
|
export { PVideo } from "./src/components/react/base/pixVideo/PixVideo";
|
|
9
10
|
export { OutlineText } from "./src/components/react/base/outlinetext/OutlineText";
|
package/index.js
CHANGED
|
@@ -5,6 +5,7 @@ export { Checkbox } from './src/components/react/app/checkBox/CheckBox';
|
|
|
5
5
|
export { Dropdown } from './src/components/react/app/dropdown/Dropdown';
|
|
6
6
|
export { ImageViewer } from './src/components/react/app/imageViewer/imageViewer';
|
|
7
7
|
export { Slider } from './src/components/react/app/slider/Slider';
|
|
8
|
+
export { ToggleGroup } from './src/components/react/app/togglegroup/ToggleGroup';
|
|
8
9
|
export { GradientText } from './src/components/react/base/gradient/GradientText';
|
|
9
10
|
export { PVideo } from './src/components/react/base/pixVideo/PixVideo';
|
|
10
11
|
export { OutlineText } from './src/components/react/base/outlinetext/OutlineText';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pixuireactcomponents",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.20",
|
|
4
4
|
"description": "pixui react components",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -9,8 +9,6 @@
|
|
|
9
9
|
"author": "hardenzheng",
|
|
10
10
|
"license": "ISC",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@improbable-eng/grpc-web": "^0.12.0",
|
|
13
|
-
"@tencent/pandora-sdk-utils": "^1.0.0",
|
|
14
12
|
"animate.css": "^3.7.2",
|
|
15
13
|
"babel-plugin-transform-decorators-legacy": "^1.3.5",
|
|
16
14
|
"gamelet-pixui-frame": "0.4.7",
|
|
@@ -19,7 +17,6 @@
|
|
|
19
17
|
"gsap": "^3.2.6",
|
|
20
18
|
"mobx": "^5.10.1",
|
|
21
19
|
"mobx-react": "^6.2.2",
|
|
22
|
-
"pixui-tester": "^1.0.10",
|
|
23
20
|
"preact": "^10.4.0",
|
|
24
21
|
"prebuild-webpack-plugin": "^1.1.1",
|
|
25
22
|
"react-virtualized": "^9.21.2",
|
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
buttonPic: string;
|
|
4
|
-
buttonText: string;
|
|
5
|
-
width: number;
|
|
6
|
-
height: number;
|
|
7
|
-
fontSize: number;
|
|
8
|
-
}
|
|
1
|
+
import { JCSSProperties } from 'lib/preact/src/jsx';
|
|
2
|
+
import { h } from 'preact';
|
|
9
3
|
interface ButtonProps {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export declare class Button extends Component<ButtonProps, any> {
|
|
16
|
-
private btnImg;
|
|
17
|
-
private btnText;
|
|
18
|
-
private buttonStateChange;
|
|
19
|
-
render(props: any): h.JSX.Element;
|
|
4
|
+
text: string;
|
|
5
|
+
normalStyle: JCSSProperties;
|
|
6
|
+
hoverStyle: JCSSProperties;
|
|
7
|
+
pressStyle: JCSSProperties;
|
|
8
|
+
clickEvent: Function;
|
|
20
9
|
}
|
|
10
|
+
export declare let Button: (props: ButtonProps) => h.JSX.Element;
|
|
21
11
|
export {};
|
|
@@ -1,71 +1,28 @@
|
|
|
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
|
-
_this.btnImg.style.height = "".concat(picState.height, "px");
|
|
30
|
-
if (!_this.btnText) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
_this.btnText.textContent = picState.buttonText;
|
|
34
|
-
_this.btnText.style.fontSize = "".concat(picState.fontSize, "px");
|
|
35
|
-
};
|
|
36
|
-
return _this;
|
|
37
|
-
}
|
|
38
|
-
Button.prototype.render = function (props) {
|
|
39
|
-
var _this = this;
|
|
40
|
-
return (<div style={{ alignItems: 'center', justifyContent: 'center' }} onClick={function () {
|
|
41
|
-
var _a;
|
|
42
|
-
if (_this.props.clickEvent) {
|
|
43
|
-
if (_this.props.clickArr) {
|
|
44
|
-
(_a = _this.props).clickEvent.apply(_a, props.clickArr);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
_this.props.clickEvent();
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}} onMouseDown={function () {
|
|
51
|
-
_this.buttonStateChange(_this.props.picPress);
|
|
52
|
-
}} onMouseUp={function () {
|
|
53
|
-
_this.buttonStateChange(_this.props.picHover);
|
|
54
|
-
}} onMouseOver={function () {
|
|
55
|
-
_this.buttonStateChange(_this.props.picHover);
|
|
56
|
-
}} onMouseOut={function () {
|
|
57
|
-
_this.buttonStateChange(_this.props.picNormal);
|
|
58
|
-
}}>
|
|
59
|
-
<img ref={function (img) {
|
|
60
|
-
_this.btnImg = img;
|
|
61
|
-
}} style={{ width: "".concat(props.picNormal.width, "px"), height: "".concat(props.picNormal.height, "px") }} src={this.props.picNormal.buttonPic}></img>
|
|
62
|
-
<div ref={function (text) {
|
|
63
|
-
_this.btnText = text;
|
|
64
|
-
}} style={{ position: 'absolute', fontSize: "".concat(props.picNormal.fontSize, "px") }}>
|
|
65
|
-
{this.props.picNormal.buttonText}
|
|
66
|
-
</div>
|
|
67
|
-
</div>);
|
|
68
|
-
};
|
|
69
|
-
return Button;
|
|
70
|
-
}(Component));
|
|
71
|
-
export { Button };
|
|
1
|
+
import { h } from 'preact';
|
|
2
|
+
import { useState } from 'preact/hooks';
|
|
3
|
+
var ButtonState;
|
|
4
|
+
(function (ButtonState) {
|
|
5
|
+
ButtonState[ButtonState["normal"] = 0] = "normal";
|
|
6
|
+
ButtonState[ButtonState["hover"] = 1] = "hover";
|
|
7
|
+
ButtonState[ButtonState["press"] = 2] = "press";
|
|
8
|
+
})(ButtonState || (ButtonState = {})); //按钮状态
|
|
9
|
+
export var Button = function (props) {
|
|
10
|
+
var _a;
|
|
11
|
+
var buttonState = (_a = useState(ButtonState.normal), _a[0]), setButtonState = _a[1];
|
|
12
|
+
return (<div style={buttonState == ButtonState.normal
|
|
13
|
+
? props.normalStyle
|
|
14
|
+
: buttonState == ButtonState.hover
|
|
15
|
+
? props.hoverStyle
|
|
16
|
+
: props.pressStyle} onMouseDown={function () {
|
|
17
|
+
setButtonState(ButtonState.press);
|
|
18
|
+
}} onMouseUp={function () {
|
|
19
|
+
setButtonState(ButtonState.hover);
|
|
20
|
+
props.clickEvent();
|
|
21
|
+
}} onMouseOver={function () {
|
|
22
|
+
setButtonState(ButtonState.hover);
|
|
23
|
+
}} onMouseOut={function () {
|
|
24
|
+
setButtonState(ButtonState.normal);
|
|
25
|
+
}}>
|
|
26
|
+
{props.text}
|
|
27
|
+
</div>);
|
|
28
|
+
};
|
|
@@ -1,2 +1,30 @@
|
|
|
1
1
|
import { h } from 'preact';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* 轮播组件
|
|
4
|
+
* @param cRef - 组件引用
|
|
5
|
+
* @param children - 轮播元素
|
|
6
|
+
* @param defaultIndex - 默认展示元素的索引,从1开始
|
|
7
|
+
* @param compWidth - 轮播元素宽度
|
|
8
|
+
* @param compHeight - 轮播元素高度
|
|
9
|
+
* @param autoplay - 是否自动轮播
|
|
10
|
+
* @param switchDuration - 自动轮播切换间隔(>1000)
|
|
11
|
+
* @param loop - 是否循环播放
|
|
12
|
+
* @param isVertical - 轮播元素滚动方向
|
|
13
|
+
* @param touchable - 是否允许手势切换
|
|
14
|
+
* @param onSlideChange - 切换元素后的回调函数
|
|
15
|
+
* @param onclickEvent - 点击元素的回调函数
|
|
16
|
+
*/
|
|
17
|
+
export declare function Carousel(props: {
|
|
18
|
+
cRef?: any;
|
|
19
|
+
children?: HTMLElement[];
|
|
20
|
+
defaultIndex?: number;
|
|
21
|
+
compWidth?: number;
|
|
22
|
+
compHeight?: number;
|
|
23
|
+
autoplay?: boolean;
|
|
24
|
+
switchDuration?: number;
|
|
25
|
+
loop?: boolean;
|
|
26
|
+
isVertical?: boolean;
|
|
27
|
+
touchable?: boolean;
|
|
28
|
+
onSlideChange?: Function | null;
|
|
29
|
+
onclickEvent?: Function | null;
|
|
30
|
+
}): h.JSX.Element;
|
|
@@ -45,6 +45,21 @@ import { useState, useEffect, useRef, useMemo, useImperativeHandle } from '../..
|
|
|
45
45
|
// });
|
|
46
46
|
// return isSame;
|
|
47
47
|
// });
|
|
48
|
+
/**
|
|
49
|
+
* 轮播组件
|
|
50
|
+
* @param cRef - 组件引用
|
|
51
|
+
* @param children - 轮播元素
|
|
52
|
+
* @param defaultIndex - 默认展示元素的索引,从1开始
|
|
53
|
+
* @param compWidth - 轮播元素宽度
|
|
54
|
+
* @param compHeight - 轮播元素高度
|
|
55
|
+
* @param autoplay - 是否自动轮播
|
|
56
|
+
* @param switchDuration - 自动轮播切换间隔(>1000)
|
|
57
|
+
* @param loop - 是否循环播放
|
|
58
|
+
* @param isVertical - 轮播元素滚动方向
|
|
59
|
+
* @param touchable - 是否允许手势切换
|
|
60
|
+
* @param onSlideChange - 切换元素后的回调函数
|
|
61
|
+
* @param onclickEvent - 点击元素的回调函数
|
|
62
|
+
*/
|
|
48
63
|
export function Carousel(props) {
|
|
49
64
|
var _a = props.children, children = _a === void 0 ? [] : _a, _b = props.defaultIndex, defaultIndex = _b === void 0 ? 1 : _b, _c = props.compWidth, compWidth = _c === void 0 ? 100 : _c, _d = props.compHeight, compHeight = _d === void 0 ? 100 : _d, _e = props.autoplay, autoplay = _e === void 0 ? true : _e, _f = props.switchDuration, switchDuration = _f === void 0 ? 3000 : _f, _g = props.loop, loop = _g === void 0 ? true : _g, _h = props.isVertical, isVertical = _h === void 0 ? false : _h, _j = props.touchable, touchable = _j === void 0 ? true : _j, _k = props.onSlideChange, onSlideChange = _k === void 0 ? null : _k, _l = props.onclickEvent, onclickEvent = _l === void 0 ? null : _l;
|
|
50
65
|
// console.log('children', children.length);
|
|
@@ -67,7 +82,12 @@ export function Carousel(props) {
|
|
|
67
82
|
var _p = useState([0, 0]), gesteroffset = _p[0], setGesteroffset = _p[1];
|
|
68
83
|
var _q = useState(''), logTex = _q[0], setLogTex = _q[1];
|
|
69
84
|
var offset = useMemo(function () { return -(isVertical ? compHeight : compWidth) * showIndex; }, [showIndex]);
|
|
70
|
-
var itemBoxStyle = {
|
|
85
|
+
var itemBoxStyle = {
|
|
86
|
+
minWidth: compWidth + 'px',
|
|
87
|
+
minHeight: compHeight + 'px',
|
|
88
|
+
maxWidth: compWidth + 'px',
|
|
89
|
+
maxHeight: compHeight + 'px',
|
|
90
|
+
};
|
|
71
91
|
var carouselItems = useMemo(function () {
|
|
72
92
|
var firstChild = children[0];
|
|
73
93
|
var lastChild = children[children.length - 1];
|
|
@@ -175,12 +195,13 @@ export function Carousel(props) {
|
|
|
175
195
|
var gestureMove = function (e) {
|
|
176
196
|
if (!touchable)
|
|
177
197
|
return;
|
|
178
|
-
if (!isMouseDown.current)
|
|
198
|
+
if (!isMouseDown.current || !e || !e.target)
|
|
179
199
|
return;
|
|
180
|
-
var
|
|
181
|
-
var
|
|
182
|
-
var
|
|
183
|
-
var
|
|
200
|
+
var rect = e.target.getBoundingClientRect();
|
|
201
|
+
var l = rect.left;
|
|
202
|
+
var r = rect.right;
|
|
203
|
+
var t = rect.top;
|
|
204
|
+
var b = rect.bottom;
|
|
184
205
|
var x = e.clientX;
|
|
185
206
|
var y = e.clientY;
|
|
186
207
|
setGesteroffset([e.clientX - mouseDownX.current, e.clientY - mouseDownY.current]);
|
|
@@ -218,7 +239,9 @@ export function Carousel(props) {
|
|
|
218
239
|
width: isVertical ? compWidth : compWidth * carouselItems.length + 'px',
|
|
219
240
|
height: isVertical ? compHeight * carouselItems.length : compHeight + 'px',
|
|
220
241
|
transition: "transform ".concat(showTransition ? '0.5s' : '0s', " ease 0s"),
|
|
221
|
-
transform: isVertical
|
|
242
|
+
transform: isVertical
|
|
243
|
+
? "translate(0px, ".concat(offset + gesteroffset[1], "px)")
|
|
244
|
+
: "translate(".concat(offset + gesteroffset[0], "px, 0px)"),
|
|
222
245
|
flexDirection: isVertical ? 'column' : 'row',
|
|
223
246
|
flexShrink: 0,
|
|
224
247
|
}} class="wrapper" onTransitionEnd={handleTransitionEnd}>
|
|
@@ -22,6 +22,7 @@ export declare class PixPlaceHolder<T extends PixPlaceHolderProps> extends Compo
|
|
|
22
22
|
protected attachment: any;
|
|
23
23
|
protected dom: any;
|
|
24
24
|
private timer;
|
|
25
|
+
private com;
|
|
25
26
|
getAttachment: (e: PixPlaceHolderLoadEvent) => any;
|
|
26
27
|
onAttach(attachment: any, windowId: any, handle: any): void;
|
|
27
28
|
onLoad(e: PixPlaceHolderLoadEvent, ...rest: any[]): void;
|
|
@@ -23,19 +23,18 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
23
23
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
24
24
|
};
|
|
25
25
|
import { Component } from 'preact';
|
|
26
|
-
// @ts-ignore
|
|
27
|
-
import { com } from 'csharp';
|
|
28
26
|
var PixPlaceHolder = /** @class */ (function (_super) {
|
|
29
27
|
__extends(PixPlaceHolder, _super);
|
|
30
28
|
function PixPlaceHolder() {
|
|
31
29
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
30
|
+
_this.com = window.require('csharp').com;
|
|
32
31
|
_this.getAttachment = function (e) {
|
|
33
32
|
var _a;
|
|
34
33
|
if (!((_a = e.target) === null || _a === void 0 ? void 0 : _a.attachment)) {
|
|
35
34
|
console.error('[PixSlot][getAttachment]', '无法获取 e.target?.attachment');
|
|
36
35
|
return;
|
|
37
36
|
}
|
|
38
|
-
if (!com) {
|
|
37
|
+
if (!_this.com) {
|
|
39
38
|
console.error('[PixSlot][getAttachment]', '未能成功加载 com');
|
|
40
39
|
return;
|
|
41
40
|
}
|
|
@@ -43,7 +42,7 @@ var PixPlaceHolder = /** @class */ (function (_super) {
|
|
|
43
42
|
// @ts-ignore
|
|
44
43
|
var windowId = external.id;
|
|
45
44
|
var handle = e.target.attachment.handle;
|
|
46
|
-
var attachment = com.tencent.pandora.CSharpInterface.GetSlotAttachmentByHandle(windowId, handle);
|
|
45
|
+
var attachment = _this.com.tencent.pandora.CSharpInterface.GetSlotAttachmentByHandle(windowId, handle);
|
|
47
46
|
if (!attachment) {
|
|
48
47
|
console.error('[PixSlot][getAttachment]', "\u65E0\u6CD5\u83B7\u53D6\u6302\u8F7D\u5BF9\u8C61: GetSlotAttachmentByHandle(".concat(windowId, ", ").concat(handle, ")"));
|
|
49
48
|
return;
|
|
@@ -13,6 +13,8 @@ interface DemoPageProps extends PixPlaceHolderProps {
|
|
|
13
13
|
}
|
|
14
14
|
export declare class PVideo extends PixPlaceHolder<DemoPageProps> {
|
|
15
15
|
videoPlayerInstance: null;
|
|
16
|
+
CS: any;
|
|
17
|
+
puerts: any;
|
|
16
18
|
constructor(props: any);
|
|
17
19
|
onAttach: () => void;
|
|
18
20
|
initVideo: (video: any, parent: any) => void;
|
|
@@ -13,42 +13,62 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
13
13
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
14
|
};
|
|
15
15
|
})();
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
import { UnityEngine, com } from 'csharp';
|
|
18
16
|
import { PixPlaceHolder } from './PixPlaceHolder';
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
var getCSharp = function () {
|
|
18
|
+
if (!window.require) {
|
|
19
|
+
console.error('need puerts env');
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
var CS = window.require('csharp');
|
|
23
|
+
if (!CS) {
|
|
24
|
+
console.error('need puerts env');
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return CS;
|
|
28
|
+
};
|
|
29
|
+
var getPuerts = function () {
|
|
30
|
+
if (!window.require) {
|
|
31
|
+
console.error('need puerts env');
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
var puerts = window.require('puerts');
|
|
35
|
+
if (!puerts) {
|
|
36
|
+
console.error('need puerts env');
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return puerts;
|
|
40
|
+
};
|
|
22
41
|
var PVideo = /** @class */ (function (_super) {
|
|
23
42
|
__extends(PVideo, _super);
|
|
24
43
|
function PVideo(props) {
|
|
25
44
|
var _this = _super.call(this, props) || this;
|
|
26
45
|
_this.videoPlayerInstance = null;
|
|
46
|
+
_this.CS = getCSharp();
|
|
47
|
+
_this.puerts = getPuerts();
|
|
27
48
|
_this.onAttach = function () {
|
|
28
49
|
var placeholder = _this.mountingGameObject;
|
|
29
50
|
console.log("placeholder----- ".concat(placeholder));
|
|
30
51
|
if (placeholder) {
|
|
31
|
-
var video = new UnityEngine.GameObject();
|
|
52
|
+
var video = new _this.CS.UnityEngine.GameObject();
|
|
32
53
|
video.transform.SetParent(placeholder.transform);
|
|
33
|
-
video.AddComponent(
|
|
54
|
+
video.AddComponent(_this.puerts.$typeof(_this.CS.com.tencent.pandora.PVideoImage));
|
|
34
55
|
_this.initVideo(video, placeholder);
|
|
35
56
|
}
|
|
36
57
|
};
|
|
37
58
|
_this.initVideo = function (video, parent) {
|
|
38
|
-
var CSInterface = CS.com.tencent.pandora.CSharpInterface;
|
|
39
|
-
var rectTransform = video.GetComponent(
|
|
40
|
-
var parentTransform = parent.GetComponent(
|
|
59
|
+
var CSInterface = _this.CS.com.tencent.pandora.CSharpInterface;
|
|
60
|
+
var rectTransform = video.GetComponent(_this.puerts.$typeof(_this.CS.UnityEngine.RectTransform));
|
|
61
|
+
var parentTransform = parent.GetComponent(_this.puerts.$typeof(_this.CS.UnityEngine.RectTransform));
|
|
41
62
|
rectTransform.pivot = parentTransform.pivot;
|
|
42
63
|
rectTransform.anchorMax = parentTransform.anchorMax;
|
|
43
64
|
rectTransform.anchorMin = parentTransform.anchorMin;
|
|
44
65
|
rectTransform.sizeDelta = parentTransform.sizeDelta;
|
|
45
66
|
rectTransform.localPosition = parentTransform.localPosition;
|
|
46
|
-
rectTransform.localScale = UnityEngine.Vector3.one;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
video.GetComponent($typeof(com.tencent.pandora.PVideoImage)).material = mat;
|
|
67
|
+
rectTransform.localScale = _this.CS.UnityEngine.Vector3.one;
|
|
68
|
+
rectTransform.localRotation = _this.CS.UnityEngine.Quaternion.identity;
|
|
69
|
+
var shader = _this.CS.UnityEngine.Shader.Find('pandora/pvideo');
|
|
70
|
+
var mat = new _this.CS.UnityEngine.Material(shader);
|
|
71
|
+
video.GetComponent(_this.puerts.$typeof(_this.CS.com.tencent.pandora.PVideoImage)).material = mat;
|
|
52
72
|
var pVideoPlayer = CSInterface.PCreateVideoPlayerInstance(video);
|
|
53
73
|
CSInterface.PSetVideoEventDelegate(pVideoPlayer, function (a, b, c, d, e) {
|
|
54
74
|
//加载完第一帧以后setActive绕过alpha不正确的问题
|
|
@@ -107,7 +127,7 @@ var PVideo = /** @class */ (function (_super) {
|
|
|
107
127
|
_this.loadUrl = function (url, loop) {
|
|
108
128
|
if (loop === void 0) { loop = false; }
|
|
109
129
|
if (_this.videoPlayerInstance) {
|
|
110
|
-
CS.com.tencent.pandora.CSharpInterface.PPlayVideo(_this.videoPlayerInstance, url, loop);
|
|
130
|
+
_this.CS.com.tencent.pandora.CSharpInterface.PPlayVideo(_this.videoPlayerInstance, url, loop);
|
|
111
131
|
}
|
|
112
132
|
else {
|
|
113
133
|
console.error('video not init!');
|
|
@@ -116,7 +136,7 @@ var PVideo = /** @class */ (function (_super) {
|
|
|
116
136
|
//跳转进度,单位是秒
|
|
117
137
|
_this.seek = function (seekTime) {
|
|
118
138
|
if (_this.videoPlayerInstance) {
|
|
119
|
-
CS.com.tencent.pandora.CSharpInterface.PSeek(_this.videoPlayerInstance, seekTime);
|
|
139
|
+
_this.CS.com.tencent.pandora.CSharpInterface.PSeek(_this.videoPlayerInstance, seekTime);
|
|
120
140
|
}
|
|
121
141
|
else {
|
|
122
142
|
console.error('video not init!');
|
|
@@ -124,7 +144,7 @@ var PVideo = /** @class */ (function (_super) {
|
|
|
124
144
|
};
|
|
125
145
|
_this.pause = function () {
|
|
126
146
|
if (_this.videoPlayerInstance) {
|
|
127
|
-
CS.com.tencent.pandora.CSharpInterface.PPauseVideo(_this.videoPlayerInstance);
|
|
147
|
+
_this.CS.com.tencent.pandora.CSharpInterface.PPauseVideo(_this.videoPlayerInstance);
|
|
128
148
|
}
|
|
129
149
|
else {
|
|
130
150
|
console.error('video not init!');
|
|
@@ -132,7 +152,7 @@ var PVideo = /** @class */ (function (_super) {
|
|
|
132
152
|
};
|
|
133
153
|
_this.resume = function () {
|
|
134
154
|
if (_this.videoPlayerInstance) {
|
|
135
|
-
CS.com.tencent.pandora.CSharpInterface.PResumeVideo(_this.videoPlayerInstance);
|
|
155
|
+
_this.CS.com.tencent.pandora.CSharpInterface.PResumeVideo(_this.videoPlayerInstance);
|
|
136
156
|
}
|
|
137
157
|
else {
|
|
138
158
|
console.error('video not init!');
|
|
@@ -140,7 +160,7 @@ var PVideo = /** @class */ (function (_super) {
|
|
|
140
160
|
};
|
|
141
161
|
_this.close = function () {
|
|
142
162
|
if (_this.videoPlayerInstance) {
|
|
143
|
-
CS.com.tencent.pandora.CSharpInterface.PCloseVideo(_this.videoPlayerInstance);
|
|
163
|
+
_this.CS.com.tencent.pandora.CSharpInterface.PCloseVideo(_this.videoPlayerInstance);
|
|
144
164
|
}
|
|
145
165
|
else {
|
|
146
166
|
console.error('video not init!');
|
|
@@ -149,7 +169,7 @@ var PVideo = /** @class */ (function (_super) {
|
|
|
149
169
|
_this.setNextVideo = function (nextUrl, loopPlay) {
|
|
150
170
|
if (loopPlay === void 0) { loopPlay = false; }
|
|
151
171
|
if (_this.videoPlayerInstance) {
|
|
152
|
-
CS.com.tencent.pandora.CSharpInterface.PSetNextVideo(_this.videoPlayerInstance, nextUrl, loopPlay);
|
|
172
|
+
_this.CS.com.tencent.pandora.CSharpInterface.PSetNextVideo(_this.videoPlayerInstance, nextUrl, loopPlay);
|
|
153
173
|
}
|
|
154
174
|
else {
|
|
155
175
|
console.error('video not init!');
|
|
@@ -157,7 +177,7 @@ var PVideo = /** @class */ (function (_super) {
|
|
|
157
177
|
};
|
|
158
178
|
_this.setRate = function (rate) {
|
|
159
179
|
if (_this.videoPlayerInstance) {
|
|
160
|
-
CS.com.tencent.pandora.CSharpInterface.PSetRate(_this.videoPlayerInstance, rate);
|
|
180
|
+
_this.CS.com.tencent.pandora.CSharpInterface.PSetRate(_this.videoPlayerInstance, rate);
|
|
161
181
|
}
|
|
162
182
|
else {
|
|
163
183
|
console.error('video not init!');
|
|
@@ -165,7 +185,7 @@ var PVideo = /** @class */ (function (_super) {
|
|
|
165
185
|
};
|
|
166
186
|
_this.setVolume = function (volume) {
|
|
167
187
|
if (_this.videoPlayerInstance) {
|
|
168
|
-
CS.com.tencent.pandora.CSharpInterface.PSetVolume(_this.videoPlayerInstance, volume);
|
|
188
|
+
_this.CS.com.tencent.pandora.CSharpInterface.PSetVolume(_this.videoPlayerInstance, volume);
|
|
169
189
|
}
|
|
170
190
|
else {
|
|
171
191
|
console.error('video not init!');
|
|
@@ -14,45 +14,16 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
14
14
|
};
|
|
15
15
|
})();
|
|
16
16
|
import { Component } from 'preact';
|
|
17
|
-
import { Images } from '../Images';
|
|
18
17
|
import { Button } from 'src/components/react/app/button/Button';
|
|
19
|
-
var picNormal = {
|
|
20
|
-
buttonPic: Images.checkbox0,
|
|
21
|
-
buttonText: '常态',
|
|
22
|
-
width: 100,
|
|
23
|
-
height: 100,
|
|
24
|
-
fontSize: 20,
|
|
25
|
-
};
|
|
26
|
-
var picPress = {
|
|
27
|
-
buttonPic: Images.checkbox0,
|
|
28
|
-
buttonText: '押下',
|
|
29
|
-
width: 200,
|
|
30
|
-
height: 200,
|
|
31
|
-
fontSize: 30,
|
|
32
|
-
};
|
|
33
|
-
var picHover = {
|
|
34
|
-
buttonPic: Images.checkbox0,
|
|
35
|
-
buttonText: '悬浮',
|
|
36
|
-
width: 150,
|
|
37
|
-
height: 150,
|
|
38
|
-
fontSize: 35,
|
|
39
|
-
};
|
|
40
18
|
var ButtonDemo = /** @class */ (function (_super) {
|
|
41
19
|
__extends(ButtonDemo, _super);
|
|
42
20
|
function ButtonDemo() {
|
|
43
|
-
|
|
44
|
-
_this.clickArr = [1, 2, 3];
|
|
45
|
-
_this.clickEvent = function (arr1, arr2, arr3) {
|
|
46
|
-
console.log('1', arr1);
|
|
47
|
-
console.log('2', arr2);
|
|
48
|
-
console.log('3', arr3);
|
|
49
|
-
};
|
|
50
|
-
return _this;
|
|
21
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
51
22
|
}
|
|
52
23
|
ButtonDemo.prototype.render = function () {
|
|
53
|
-
return (<
|
|
54
|
-
|
|
55
|
-
|
|
24
|
+
return (<Button normalStyle={{ width: '100px', height: '50px', backgroundColor: 'rgba(0,255,0,0.5)', border: '1px solid black' }} hoverStyle={{ width: '100px', height: '50px', backgroundColor: 'rgba(255,0,0,0.5)', border: '1px solid black' }} pressStyle={{ width: '100px', height: '50px', backgroundColor: 'rgba(0,0,255,0.5)', border: '1px solid black' }} clickEvent={function () {
|
|
25
|
+
console.log('clicked');
|
|
26
|
+
}} text={'按钮'}/>);
|
|
56
27
|
};
|
|
57
28
|
return ButtonDemo;
|
|
58
29
|
}(Component));
|
|
@@ -5,12 +5,12 @@ import { Carousel } from 'src/components/react/app/carousel/Carousel';
|
|
|
5
5
|
var CarouselComp = memo(Carousel, function (prev, next) {
|
|
6
6
|
var isSame = true;
|
|
7
7
|
Object.keys(prev).forEach(function (key) {
|
|
8
|
-
if (key === 'children') {
|
|
8
|
+
if (key === 'children' && prev.children && next.children) {
|
|
9
9
|
if (prev.children.length !== next.children.length) {
|
|
10
10
|
isSame = false;
|
|
11
11
|
}
|
|
12
12
|
for (var i = 0; i < prev.children.length; i++) {
|
|
13
|
-
if (prev.children[i]
|
|
13
|
+
if (prev.children[i][key] !== next.children[i][key]) {
|
|
14
14
|
isSame = false;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -13,11 +13,11 @@ var boxCheckedStyle = {
|
|
|
13
13
|
backgroundSize: '100% 100%',
|
|
14
14
|
};
|
|
15
15
|
export function CheckboxDemo() {
|
|
16
|
-
var _a = useState('未选中'),
|
|
16
|
+
var _a = useState('未选中'), showText = _a[0], setShowText = _a[1];
|
|
17
17
|
return (<div>
|
|
18
18
|
<Checkbox defauleSelected={false} selectedChanged={function (b) {
|
|
19
|
-
|
|
19
|
+
setShowText(b ? ' 选中了' : ' 未选中');
|
|
20
20
|
}} selectedNode={<div style={boxCheckedStyle}></div>} notSelectedNode={<div style={boxNormalStyle}></div>}/>
|
|
21
|
-
<div style={{ marginLeft: '10px' }}>{
|
|
21
|
+
<div style={{ marginLeft: '10px' }}>{showText}</div>
|
|
22
22
|
</div>);
|
|
23
23
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component } from 'preact';
|
|
1
|
+
import { Component, h } from 'preact';
|
|
2
2
|
export declare class SliderDemo extends Component<any, {
|
|
3
3
|
percent: number;
|
|
4
4
|
}> {
|
|
@@ -6,5 +6,5 @@ export declare class SliderDemo extends Component<any, {
|
|
|
6
6
|
onDrag: (value: number) => void;
|
|
7
7
|
onDecClick: (value: number) => void;
|
|
8
8
|
onIncClick: (value: number) => void;
|
|
9
|
-
render():
|
|
9
|
+
render(): h.JSX.Element;
|
|
10
10
|
}
|
|
@@ -13,9 +13,13 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
13
13
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
14
|
};
|
|
15
15
|
})();
|
|
16
|
-
import { Component } from 'preact';
|
|
17
|
-
import { Images } from '../Images';
|
|
16
|
+
import { Component, h } from 'preact';
|
|
18
17
|
import { Slider } from 'src/components/react/app/slider/Slider';
|
|
18
|
+
var Images = {
|
|
19
|
+
inner: 'https://game.gtimg.cn/images/gamelet/cp/pxidePreView-slider/inner.png',
|
|
20
|
+
outer: 'https://game.gtimg.cn/images/gamelet/cp/pxidePreView-slider/outer.png',
|
|
21
|
+
dot: 'https://game.gtimg.cn/images/gamelet/cp/pxidePreView-slider/dot.png',
|
|
22
|
+
};
|
|
19
23
|
var SliderWrapperStyle = {
|
|
20
24
|
position: 'absolute',
|
|
21
25
|
width: '376px',
|