pixuireactcomponents 1.1.21 → 1.1.22
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 +5 -5
- package/index.d.ts +15 -15
- package/index.js +16 -16
- package/package.json +11 -11
- package/tools/EventDispatcherJs.d.ts +10 -10
- package/tools/EventDispatcherJs.js +71 -71
- package/tools/Logger.d.ts +6 -6
- package/tools/Logger.js +138 -138
- package/tools/tools.md +21 -21
- package/ui/components/button/Button.d.ts +5 -5
- package/ui/components/button/Button.js +37 -37
- package/ui/components/carousel/Carousel.d.ts +5 -5
- package/ui/components/carousel/Carousel.js +219 -219
- package/ui/components/dropdown/Dropdown.d.ts +30 -30
- package/ui/components/dropdown/Dropdown.js +92 -92
- package/ui/components/dropdown/DropdownOptionUI.d.ts +11 -11
- package/ui/components/dropdown/DropdownOptionUI.js +28 -28
- package/ui/components/dropdown/DropdownSpreadMainUI.d.ts +9 -9
- package/ui/components/dropdown/DropdownSpreadMainUI.js +27 -27
- package/ui/components/dropdown/DropdownUnspreadMainUI.d.ts +9 -9
- package/ui/components/dropdown/DropdownUnspreadMainUI.js +27 -27
- package/ui/components/gradient/GradientText.d.ts +63 -63
- package/ui/components/gradient/GradientText.js +329 -329
- package/ui/components/outlinetext/OutlineText.d.ts +73 -73
- package/ui/components/outlinetext/OutlineText.js +157 -157
- package/ui/components/progress/Progress.d.ts +34 -34
- package/ui/components/progress/Progress.js +142 -142
- package/ui/components/slapface/Slapface.d.ts +12 -12
- package/ui/components/slapface/Slapface.js +224 -227
- package/ui/components/slapface/less/Slapface.less +125 -0
- package/ui/components/slider/Slider.d.ts +57 -57
- package/ui/components/slider/Slider.js +289 -289
- package/ui/components/tab/Tab.d.ts +6 -6
- package/ui/components/tab/Tab.js +27 -27
- package/ui/components/tab/Tabs.d.ts +12 -12
- package/ui/components/tab/Tabs.js +54 -54
- package/ui/ui.md +1 -1
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import { Component, h, CSSProperties } from 'preact';
|
|
2
|
-
declare enum FontStyle {
|
|
3
|
-
Normal = 0,
|
|
4
|
-
Bold = 1,
|
|
5
|
-
Italic = 2,
|
|
6
|
-
BoldAndItalic = 3
|
|
7
|
-
}
|
|
8
|
-
declare enum TextAnchor {
|
|
9
|
-
UpperLeft = 0,
|
|
10
|
-
UpperCenter = 1,
|
|
11
|
-
UpperRight = 2,
|
|
12
|
-
MiddleLeft = 3,
|
|
13
|
-
MiddleCenter = 4,
|
|
14
|
-
MiddleRight = 5,
|
|
15
|
-
LowerLeft = 6,
|
|
16
|
-
LowerCenter = 7,
|
|
17
|
-
LowerRight = 8
|
|
18
|
-
}
|
|
19
|
-
declare enum HorizontalWrapMode {
|
|
20
|
-
Wrap = 0,
|
|
21
|
-
Overflow = 1
|
|
22
|
-
}
|
|
23
|
-
declare enum VerticalWrapMode {
|
|
24
|
-
Truncate = 0,
|
|
25
|
-
Overflow = 1
|
|
26
|
-
}
|
|
27
|
-
export interface OutlineTextProps {
|
|
28
|
-
style?: CSSProperties;
|
|
29
|
-
text?: string;
|
|
30
|
-
font?: string;
|
|
31
|
-
fontStyle?: FontStyle;
|
|
32
|
-
fontSize?: number;
|
|
33
|
-
lineSpacing?: number;
|
|
34
|
-
alignment?: TextAnchor;
|
|
35
|
-
alignByGeometry?: boolean;
|
|
36
|
-
horizontalOverflow?: HorizontalWrapMode;
|
|
37
|
-
verticalOverflow?: VerticalWrapMode;
|
|
38
|
-
color: string;
|
|
39
|
-
outlineColor: string;
|
|
40
|
-
outlineDistance: {
|
|
41
|
-
x: number;
|
|
42
|
-
y: number;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
export declare class OutlineText extends Component<OutlineTextProps, OutlineTextProps> {
|
|
46
|
-
text: any;
|
|
47
|
-
outline: any;
|
|
48
|
-
constructor(props: any);
|
|
49
|
-
static defaultProps: {
|
|
50
|
-
style: import("../../lib/preact/src/jsx").JCSSProperties;
|
|
51
|
-
text: string;
|
|
52
|
-
font: string;
|
|
53
|
-
fontStyle: FontStyle;
|
|
54
|
-
fontSize: number;
|
|
55
|
-
lineSpacing: number;
|
|
56
|
-
alignment: TextAnchor;
|
|
57
|
-
alignByGeometry: boolean;
|
|
58
|
-
horizontalOverflow: HorizontalWrapMode;
|
|
59
|
-
verticalOverflow: VerticalWrapMode;
|
|
60
|
-
color: string;
|
|
61
|
-
outlineColor: string;
|
|
62
|
-
outlineDistance: {
|
|
63
|
-
x: number;
|
|
64
|
-
y: number;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
componentDidUpdate(): void;
|
|
68
|
-
OnLoad: (e: any) => void;
|
|
69
|
-
colorRgb(colorStr: any): any;
|
|
70
|
-
updateOutlineText(): void;
|
|
71
|
-
render(): h.JSX.Element;
|
|
72
|
-
}
|
|
73
|
-
export {};
|
|
1
|
+
import { Component, h, CSSProperties } from 'preact';
|
|
2
|
+
declare enum FontStyle {
|
|
3
|
+
Normal = 0,
|
|
4
|
+
Bold = 1,
|
|
5
|
+
Italic = 2,
|
|
6
|
+
BoldAndItalic = 3
|
|
7
|
+
}
|
|
8
|
+
declare enum TextAnchor {
|
|
9
|
+
UpperLeft = 0,
|
|
10
|
+
UpperCenter = 1,
|
|
11
|
+
UpperRight = 2,
|
|
12
|
+
MiddleLeft = 3,
|
|
13
|
+
MiddleCenter = 4,
|
|
14
|
+
MiddleRight = 5,
|
|
15
|
+
LowerLeft = 6,
|
|
16
|
+
LowerCenter = 7,
|
|
17
|
+
LowerRight = 8
|
|
18
|
+
}
|
|
19
|
+
declare enum HorizontalWrapMode {
|
|
20
|
+
Wrap = 0,
|
|
21
|
+
Overflow = 1
|
|
22
|
+
}
|
|
23
|
+
declare enum VerticalWrapMode {
|
|
24
|
+
Truncate = 0,
|
|
25
|
+
Overflow = 1
|
|
26
|
+
}
|
|
27
|
+
export interface OutlineTextProps {
|
|
28
|
+
style?: CSSProperties;
|
|
29
|
+
text?: string;
|
|
30
|
+
font?: string;
|
|
31
|
+
fontStyle?: FontStyle;
|
|
32
|
+
fontSize?: number;
|
|
33
|
+
lineSpacing?: number;
|
|
34
|
+
alignment?: TextAnchor;
|
|
35
|
+
alignByGeometry?: boolean;
|
|
36
|
+
horizontalOverflow?: HorizontalWrapMode;
|
|
37
|
+
verticalOverflow?: VerticalWrapMode;
|
|
38
|
+
color: string;
|
|
39
|
+
outlineColor: string;
|
|
40
|
+
outlineDistance: {
|
|
41
|
+
x: number;
|
|
42
|
+
y: number;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export declare class OutlineText extends Component<OutlineTextProps, OutlineTextProps> {
|
|
46
|
+
text: any;
|
|
47
|
+
outline: any;
|
|
48
|
+
constructor(props: any);
|
|
49
|
+
static defaultProps: {
|
|
50
|
+
style: import("../../lib/preact/src/jsx").JCSSProperties;
|
|
51
|
+
text: string;
|
|
52
|
+
font: string;
|
|
53
|
+
fontStyle: FontStyle;
|
|
54
|
+
fontSize: number;
|
|
55
|
+
lineSpacing: number;
|
|
56
|
+
alignment: TextAnchor;
|
|
57
|
+
alignByGeometry: boolean;
|
|
58
|
+
horizontalOverflow: HorizontalWrapMode;
|
|
59
|
+
verticalOverflow: VerticalWrapMode;
|
|
60
|
+
color: string;
|
|
61
|
+
outlineColor: string;
|
|
62
|
+
outlineDistance: {
|
|
63
|
+
x: number;
|
|
64
|
+
y: number;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
componentDidUpdate(): void;
|
|
68
|
+
OnLoad: (e: any) => void;
|
|
69
|
+
colorRgb(colorStr: any): any;
|
|
70
|
+
updateOutlineText(): void;
|
|
71
|
+
render(): h.JSX.Element;
|
|
72
|
+
}
|
|
73
|
+
export {};
|
|
@@ -1,157 +1,157 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
if (typeof b !== "function" && b !== null)
|
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
-
extendStatics(d, b);
|
|
12
|
-
function __() { this.constructor = d; }
|
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
16
|
-
import { Component, h } from 'preact';
|
|
17
|
-
var FontStyle;
|
|
18
|
-
(function (FontStyle) {
|
|
19
|
-
FontStyle[FontStyle["Normal"] = 0] = "Normal";
|
|
20
|
-
FontStyle[FontStyle["Bold"] = 1] = "Bold";
|
|
21
|
-
FontStyle[FontStyle["Italic"] = 2] = "Italic";
|
|
22
|
-
FontStyle[FontStyle["BoldAndItalic"] = 3] = "BoldAndItalic";
|
|
23
|
-
})(FontStyle || (FontStyle = {}));
|
|
24
|
-
var TextAnchor;
|
|
25
|
-
(function (TextAnchor) {
|
|
26
|
-
TextAnchor[TextAnchor["UpperLeft"] = 0] = "UpperLeft";
|
|
27
|
-
TextAnchor[TextAnchor["UpperCenter"] = 1] = "UpperCenter";
|
|
28
|
-
TextAnchor[TextAnchor["UpperRight"] = 2] = "UpperRight";
|
|
29
|
-
TextAnchor[TextAnchor["MiddleLeft"] = 3] = "MiddleLeft";
|
|
30
|
-
TextAnchor[TextAnchor["MiddleCenter"] = 4] = "MiddleCenter";
|
|
31
|
-
TextAnchor[TextAnchor["MiddleRight"] = 5] = "MiddleRight";
|
|
32
|
-
TextAnchor[TextAnchor["LowerLeft"] = 6] = "LowerLeft";
|
|
33
|
-
TextAnchor[TextAnchor["LowerCenter"] = 7] = "LowerCenter";
|
|
34
|
-
TextAnchor[TextAnchor["LowerRight"] = 8] = "LowerRight";
|
|
35
|
-
})(TextAnchor || (TextAnchor = {}));
|
|
36
|
-
var HorizontalWrapMode;
|
|
37
|
-
(function (HorizontalWrapMode) {
|
|
38
|
-
HorizontalWrapMode[HorizontalWrapMode["Wrap"] = 0] = "Wrap";
|
|
39
|
-
HorizontalWrapMode[HorizontalWrapMode["Overflow"] = 1] = "Overflow";
|
|
40
|
-
})(HorizontalWrapMode || (HorizontalWrapMode = {}));
|
|
41
|
-
var VerticalWrapMode;
|
|
42
|
-
(function (VerticalWrapMode) {
|
|
43
|
-
VerticalWrapMode[VerticalWrapMode["Truncate"] = 0] = "Truncate";
|
|
44
|
-
VerticalWrapMode[VerticalWrapMode["Overflow"] = 1] = "Overflow";
|
|
45
|
-
})(VerticalWrapMode || (VerticalWrapMode = {}));
|
|
46
|
-
var defaultStyle = {
|
|
47
|
-
width: 200,
|
|
48
|
-
height: 200
|
|
49
|
-
};
|
|
50
|
-
var OutlineText = /** @class */ (function (_super) {
|
|
51
|
-
__extends(OutlineText, _super);
|
|
52
|
-
function OutlineText(props) {
|
|
53
|
-
var _this = _super.call(this, props) || this;
|
|
54
|
-
_this.OnLoad = function (e) {
|
|
55
|
-
console.log('!!!!!!!!!!!!!!');
|
|
56
|
-
if (!require) {
|
|
57
|
-
console.error('need puerts env');
|
|
58
|
-
}
|
|
59
|
-
var CS = window.require('csharp');
|
|
60
|
-
if (!CS) {
|
|
61
|
-
console.error('need puerts env');
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
var puerts = window.require('puerts');
|
|
65
|
-
console.log('?????');
|
|
66
|
-
var windowId = window.external.id;
|
|
67
|
-
var handle = e.target.attachment.handle;
|
|
68
|
-
var attachment = CS.com.tencent.pandora.CSharpInterface.GetSlotAttachmentByHandle(windowId, handle);
|
|
69
|
-
if (!attachment) {
|
|
70
|
-
console.error("can't get relected attachment, handle:".concat(handle));
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
var placeholder = attachment.GetMountingGameObject();
|
|
74
|
-
var text = placeholder.AddComponent(puerts.$typeof(CS.UnityEngine.UI.Text));
|
|
75
|
-
_this.text = text;
|
|
76
|
-
var outline = placeholder.AddComponent(puerts.$typeof(CS.UnityEngine.UI.Outline));
|
|
77
|
-
_this.outline = outline;
|
|
78
|
-
_this.updateOutlineText();
|
|
79
|
-
};
|
|
80
|
-
return _this;
|
|
81
|
-
}
|
|
82
|
-
OutlineText.prototype.componentDidUpdate = function () {
|
|
83
|
-
console.log('componentDidUpdate');
|
|
84
|
-
this.updateOutlineText();
|
|
85
|
-
};
|
|
86
|
-
OutlineText.prototype.colorRgb = function (colorStr) {
|
|
87
|
-
//十六进制颜色值的正则表达式
|
|
88
|
-
var reg = /^#([0-9a-fA-f]{0,}|)$/;
|
|
89
|
-
var matchRes = colorStr.toString().toLowerCase().match(reg);
|
|
90
|
-
var transColor = '';
|
|
91
|
-
if (matchRes.length > 0)
|
|
92
|
-
transColor = matchRes[matchRes.length - 1];
|
|
93
|
-
// eslint-disable-next-line @typescript-eslint/no-array-constructor
|
|
94
|
-
var colorList = new Array();
|
|
95
|
-
while (transColor != '') {
|
|
96
|
-
var hex = '0x' + transColor.substring(0, 2);
|
|
97
|
-
colorList.push(parseInt(hex, 16));
|
|
98
|
-
transColor = transColor.substring(2, transColor.length);
|
|
99
|
-
}
|
|
100
|
-
var r, g, b, a = 1;
|
|
101
|
-
for (var i = 0; i < colorList.length; i++) {
|
|
102
|
-
if (i == 0 && colorList[i] != null && colorList[i] != undefined) {
|
|
103
|
-
r = colorList[i] / 255;
|
|
104
|
-
}
|
|
105
|
-
if (i == 1 && colorList[i] != null && colorList[i] != undefined) {
|
|
106
|
-
g = colorList[i] / 255;
|
|
107
|
-
}
|
|
108
|
-
if (i == 2 && colorList[i] != null && colorList[i] != undefined) {
|
|
109
|
-
b = colorList[i] / 255;
|
|
110
|
-
}
|
|
111
|
-
if (i == 3 && colorList[i] != null && colorList[i] != undefined) {
|
|
112
|
-
a = colorList[i] / 255;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
var CS = window.require('csharp');
|
|
116
|
-
return CS.UnityEngine.Color(r, g, b, a);
|
|
117
|
-
};
|
|
118
|
-
OutlineText.prototype.updateOutlineText = function () {
|
|
119
|
-
var CS = window.require('csharp');
|
|
120
|
-
this.text.text = this.props.text;
|
|
121
|
-
this.text.font = CS.com.tencent.pandora.TextPartner.GetFont.Invoke(this.props.font);
|
|
122
|
-
this.text.fontStyle = this.props.fontStyle;
|
|
123
|
-
this.text.fontSize = this.props.fontSize;
|
|
124
|
-
this.text.lineSpacing = this.props.lineSpacing;
|
|
125
|
-
this.text.alignment = this.props.alignment;
|
|
126
|
-
this.text.alignByGeometry = this.props.alignByGeometry;
|
|
127
|
-
this.text.horizontalOverflow = this.props.horizontalOverflow;
|
|
128
|
-
this.text.verticalOverflow = this.props.verticalOverflow;
|
|
129
|
-
this.text.color = this.colorRgb(this.props.color);
|
|
130
|
-
this.outline.effectColor = this.colorRgb(this.props.outlineColor);
|
|
131
|
-
this.outline.effectDistance = new CS.UnityEngine.Vector2(this.props.outlineDistance.x, this.props.outlineDistance.y);
|
|
132
|
-
};
|
|
133
|
-
OutlineText.prototype.render = function () {
|
|
134
|
-
return (h("div", { style: this.props.style },
|
|
135
|
-
h("pixslot", { style: { width: '100%', height: '100%' }, src: 'pixui://method:placeholder', onLoad: this.OnLoad.bind(this) })));
|
|
136
|
-
};
|
|
137
|
-
OutlineText.defaultProps = {
|
|
138
|
-
style: defaultStyle,
|
|
139
|
-
text: 'NEW TEXT',
|
|
140
|
-
font: 'gamefont',
|
|
141
|
-
fontStyle: FontStyle.Normal,
|
|
142
|
-
fontSize: 14,
|
|
143
|
-
lineSpacing: 1,
|
|
144
|
-
alignment: TextAnchor.UpperLeft,
|
|
145
|
-
alignByGeometry: false,
|
|
146
|
-
horizontalOverflow: HorizontalWrapMode.Wrap,
|
|
147
|
-
verticalOverflow: VerticalWrapMode.Truncate,
|
|
148
|
-
color: '#FFFFFF',
|
|
149
|
-
outlineColor: '#000000',
|
|
150
|
-
outlineDistance: {
|
|
151
|
-
x: 1,
|
|
152
|
-
y: -1
|
|
153
|
-
},
|
|
154
|
-
};
|
|
155
|
-
return OutlineText;
|
|
156
|
-
}(Component));
|
|
157
|
-
export { OutlineText };
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
import { Component, h } from 'preact';
|
|
17
|
+
var FontStyle;
|
|
18
|
+
(function (FontStyle) {
|
|
19
|
+
FontStyle[FontStyle["Normal"] = 0] = "Normal";
|
|
20
|
+
FontStyle[FontStyle["Bold"] = 1] = "Bold";
|
|
21
|
+
FontStyle[FontStyle["Italic"] = 2] = "Italic";
|
|
22
|
+
FontStyle[FontStyle["BoldAndItalic"] = 3] = "BoldAndItalic";
|
|
23
|
+
})(FontStyle || (FontStyle = {}));
|
|
24
|
+
var TextAnchor;
|
|
25
|
+
(function (TextAnchor) {
|
|
26
|
+
TextAnchor[TextAnchor["UpperLeft"] = 0] = "UpperLeft";
|
|
27
|
+
TextAnchor[TextAnchor["UpperCenter"] = 1] = "UpperCenter";
|
|
28
|
+
TextAnchor[TextAnchor["UpperRight"] = 2] = "UpperRight";
|
|
29
|
+
TextAnchor[TextAnchor["MiddleLeft"] = 3] = "MiddleLeft";
|
|
30
|
+
TextAnchor[TextAnchor["MiddleCenter"] = 4] = "MiddleCenter";
|
|
31
|
+
TextAnchor[TextAnchor["MiddleRight"] = 5] = "MiddleRight";
|
|
32
|
+
TextAnchor[TextAnchor["LowerLeft"] = 6] = "LowerLeft";
|
|
33
|
+
TextAnchor[TextAnchor["LowerCenter"] = 7] = "LowerCenter";
|
|
34
|
+
TextAnchor[TextAnchor["LowerRight"] = 8] = "LowerRight";
|
|
35
|
+
})(TextAnchor || (TextAnchor = {}));
|
|
36
|
+
var HorizontalWrapMode;
|
|
37
|
+
(function (HorizontalWrapMode) {
|
|
38
|
+
HorizontalWrapMode[HorizontalWrapMode["Wrap"] = 0] = "Wrap";
|
|
39
|
+
HorizontalWrapMode[HorizontalWrapMode["Overflow"] = 1] = "Overflow";
|
|
40
|
+
})(HorizontalWrapMode || (HorizontalWrapMode = {}));
|
|
41
|
+
var VerticalWrapMode;
|
|
42
|
+
(function (VerticalWrapMode) {
|
|
43
|
+
VerticalWrapMode[VerticalWrapMode["Truncate"] = 0] = "Truncate";
|
|
44
|
+
VerticalWrapMode[VerticalWrapMode["Overflow"] = 1] = "Overflow";
|
|
45
|
+
})(VerticalWrapMode || (VerticalWrapMode = {}));
|
|
46
|
+
var defaultStyle = {
|
|
47
|
+
width: 200,
|
|
48
|
+
height: 200
|
|
49
|
+
};
|
|
50
|
+
var OutlineText = /** @class */ (function (_super) {
|
|
51
|
+
__extends(OutlineText, _super);
|
|
52
|
+
function OutlineText(props) {
|
|
53
|
+
var _this = _super.call(this, props) || this;
|
|
54
|
+
_this.OnLoad = function (e) {
|
|
55
|
+
console.log('!!!!!!!!!!!!!!');
|
|
56
|
+
if (!require) {
|
|
57
|
+
console.error('need puerts env');
|
|
58
|
+
}
|
|
59
|
+
var CS = window.require('csharp');
|
|
60
|
+
if (!CS) {
|
|
61
|
+
console.error('need puerts env');
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
var puerts = window.require('puerts');
|
|
65
|
+
console.log('?????');
|
|
66
|
+
var windowId = window.external.id;
|
|
67
|
+
var handle = e.target.attachment.handle;
|
|
68
|
+
var attachment = CS.com.tencent.pandora.CSharpInterface.GetSlotAttachmentByHandle(windowId, handle);
|
|
69
|
+
if (!attachment) {
|
|
70
|
+
console.error("can't get relected attachment, handle:".concat(handle));
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
var placeholder = attachment.GetMountingGameObject();
|
|
74
|
+
var text = placeholder.AddComponent(puerts.$typeof(CS.UnityEngine.UI.Text));
|
|
75
|
+
_this.text = text;
|
|
76
|
+
var outline = placeholder.AddComponent(puerts.$typeof(CS.UnityEngine.UI.Outline));
|
|
77
|
+
_this.outline = outline;
|
|
78
|
+
_this.updateOutlineText();
|
|
79
|
+
};
|
|
80
|
+
return _this;
|
|
81
|
+
}
|
|
82
|
+
OutlineText.prototype.componentDidUpdate = function () {
|
|
83
|
+
console.log('componentDidUpdate');
|
|
84
|
+
this.updateOutlineText();
|
|
85
|
+
};
|
|
86
|
+
OutlineText.prototype.colorRgb = function (colorStr) {
|
|
87
|
+
//十六进制颜色值的正则表达式
|
|
88
|
+
var reg = /^#([0-9a-fA-f]{0,}|)$/;
|
|
89
|
+
var matchRes = colorStr.toString().toLowerCase().match(reg);
|
|
90
|
+
var transColor = '';
|
|
91
|
+
if (matchRes.length > 0)
|
|
92
|
+
transColor = matchRes[matchRes.length - 1];
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/no-array-constructor
|
|
94
|
+
var colorList = new Array();
|
|
95
|
+
while (transColor != '') {
|
|
96
|
+
var hex = '0x' + transColor.substring(0, 2);
|
|
97
|
+
colorList.push(parseInt(hex, 16));
|
|
98
|
+
transColor = transColor.substring(2, transColor.length);
|
|
99
|
+
}
|
|
100
|
+
var r, g, b, a = 1;
|
|
101
|
+
for (var i = 0; i < colorList.length; i++) {
|
|
102
|
+
if (i == 0 && colorList[i] != null && colorList[i] != undefined) {
|
|
103
|
+
r = colorList[i] / 255;
|
|
104
|
+
}
|
|
105
|
+
if (i == 1 && colorList[i] != null && colorList[i] != undefined) {
|
|
106
|
+
g = colorList[i] / 255;
|
|
107
|
+
}
|
|
108
|
+
if (i == 2 && colorList[i] != null && colorList[i] != undefined) {
|
|
109
|
+
b = colorList[i] / 255;
|
|
110
|
+
}
|
|
111
|
+
if (i == 3 && colorList[i] != null && colorList[i] != undefined) {
|
|
112
|
+
a = colorList[i] / 255;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
var CS = window.require('csharp');
|
|
116
|
+
return CS.UnityEngine.Color(r, g, b, a);
|
|
117
|
+
};
|
|
118
|
+
OutlineText.prototype.updateOutlineText = function () {
|
|
119
|
+
var CS = window.require('csharp');
|
|
120
|
+
this.text.text = this.props.text;
|
|
121
|
+
this.text.font = CS.com.tencent.pandora.TextPartner.GetFont.Invoke(this.props.font);
|
|
122
|
+
this.text.fontStyle = this.props.fontStyle;
|
|
123
|
+
this.text.fontSize = this.props.fontSize;
|
|
124
|
+
this.text.lineSpacing = this.props.lineSpacing;
|
|
125
|
+
this.text.alignment = this.props.alignment;
|
|
126
|
+
this.text.alignByGeometry = this.props.alignByGeometry;
|
|
127
|
+
this.text.horizontalOverflow = this.props.horizontalOverflow;
|
|
128
|
+
this.text.verticalOverflow = this.props.verticalOverflow;
|
|
129
|
+
this.text.color = this.colorRgb(this.props.color);
|
|
130
|
+
this.outline.effectColor = this.colorRgb(this.props.outlineColor);
|
|
131
|
+
this.outline.effectDistance = new CS.UnityEngine.Vector2(this.props.outlineDistance.x, this.props.outlineDistance.y);
|
|
132
|
+
};
|
|
133
|
+
OutlineText.prototype.render = function () {
|
|
134
|
+
return (h("div", { style: this.props.style },
|
|
135
|
+
h("pixslot", { style: { width: '100%', height: '100%' }, src: 'pixui://method:placeholder', onLoad: this.OnLoad.bind(this) })));
|
|
136
|
+
};
|
|
137
|
+
OutlineText.defaultProps = {
|
|
138
|
+
style: defaultStyle,
|
|
139
|
+
text: 'NEW TEXT',
|
|
140
|
+
font: 'gamefont',
|
|
141
|
+
fontStyle: FontStyle.Normal,
|
|
142
|
+
fontSize: 14,
|
|
143
|
+
lineSpacing: 1,
|
|
144
|
+
alignment: TextAnchor.UpperLeft,
|
|
145
|
+
alignByGeometry: false,
|
|
146
|
+
horizontalOverflow: HorizontalWrapMode.Wrap,
|
|
147
|
+
verticalOverflow: VerticalWrapMode.Truncate,
|
|
148
|
+
color: '#FFFFFF',
|
|
149
|
+
outlineColor: '#000000',
|
|
150
|
+
outlineDistance: {
|
|
151
|
+
x: 1,
|
|
152
|
+
y: -1
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
return OutlineText;
|
|
156
|
+
}(Component));
|
|
157
|
+
export { OutlineText };
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { Component, h } from 'preact';
|
|
2
|
-
export interface ProgressProps {
|
|
3
|
-
percent: number;
|
|
4
|
-
wrapperWidth: number;
|
|
5
|
-
wrapperHeight: number;
|
|
6
|
-
height: number;
|
|
7
|
-
dotWidth: number;
|
|
8
|
-
dotHeight: number;
|
|
9
|
-
dotWrapperWidth: number;
|
|
10
|
-
dotWrapperHeight: number;
|
|
11
|
-
outerBg: string;
|
|
12
|
-
innerBg: string;
|
|
13
|
-
dotBg: string;
|
|
14
|
-
onDragStart: Function | null;
|
|
15
|
-
onDrag: Function | null;
|
|
16
|
-
onDragEnd: Function | null;
|
|
17
|
-
}
|
|
18
|
-
export declare class Progress extends Component<ProgressProps, {
|
|
19
|
-
percent: number;
|
|
20
|
-
}> {
|
|
21
|
-
private refWrapper;
|
|
22
|
-
constructor(props: any);
|
|
23
|
-
componentDidMount(): void;
|
|
24
|
-
componentWillReceiveProps(nextProps: any): void;
|
|
25
|
-
onDragStart: (event: any) => void;
|
|
26
|
-
onDrag: (event: any) => void;
|
|
27
|
-
onDragEnd: (event: any) => void;
|
|
28
|
-
computeWrapperStyle: () => void;
|
|
29
|
-
computeOuterStyle: () => void;
|
|
30
|
-
computeInnerStyle: () => void;
|
|
31
|
-
computeDotWrapperStyle: () => void;
|
|
32
|
-
computeDotStyle: () => void;
|
|
33
|
-
render(): h.JSX.Element;
|
|
34
|
-
}
|
|
1
|
+
import { Component, h } from 'preact';
|
|
2
|
+
export interface ProgressProps {
|
|
3
|
+
percent: number;
|
|
4
|
+
wrapperWidth: number;
|
|
5
|
+
wrapperHeight: number;
|
|
6
|
+
height: number;
|
|
7
|
+
dotWidth: number;
|
|
8
|
+
dotHeight: number;
|
|
9
|
+
dotWrapperWidth: number;
|
|
10
|
+
dotWrapperHeight: number;
|
|
11
|
+
outerBg: string;
|
|
12
|
+
innerBg: string;
|
|
13
|
+
dotBg: string;
|
|
14
|
+
onDragStart: Function | null;
|
|
15
|
+
onDrag: Function | null;
|
|
16
|
+
onDragEnd: Function | null;
|
|
17
|
+
}
|
|
18
|
+
export declare class Progress extends Component<ProgressProps, {
|
|
19
|
+
percent: number;
|
|
20
|
+
}> {
|
|
21
|
+
private refWrapper;
|
|
22
|
+
constructor(props: any);
|
|
23
|
+
componentDidMount(): void;
|
|
24
|
+
componentWillReceiveProps(nextProps: any): void;
|
|
25
|
+
onDragStart: (event: any) => void;
|
|
26
|
+
onDrag: (event: any) => void;
|
|
27
|
+
onDragEnd: (event: any) => void;
|
|
28
|
+
computeWrapperStyle: () => void;
|
|
29
|
+
computeOuterStyle: () => void;
|
|
30
|
+
computeInnerStyle: () => void;
|
|
31
|
+
computeDotWrapperStyle: () => void;
|
|
32
|
+
computeDotStyle: () => void;
|
|
33
|
+
render(): h.JSX.Element;
|
|
34
|
+
}
|