pixuireactcomponents 1.2.32 → 1.2.33
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/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
2
|
var extendStatics = function (d, b) {
|
|
3
3
|
extendStatics = Object.setPrototypeOf ||
|
|
4
4
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
6
|
return extendStatics(d, b);
|
|
7
7
|
};
|
|
8
8
|
return function (d, b) {
|
|
9
|
-
if (typeof b !==
|
|
10
|
-
throw new TypeError(
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
11
|
extendStatics(d, b);
|
|
12
12
|
function __() { this.constructor = d; }
|
|
13
13
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
@@ -16,65 +16,65 @@ let __extends = (this && this.__extends) || (function () {
|
|
|
16
16
|
import { Component, h } from 'preact';
|
|
17
17
|
export var FontStyle;
|
|
18
18
|
(function (FontStyle) {
|
|
19
|
-
FontStyle[FontStyle[
|
|
20
|
-
FontStyle[FontStyle[
|
|
21
|
-
FontStyle[FontStyle[
|
|
22
|
-
FontStyle[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
23
|
})(FontStyle || (FontStyle = {}));
|
|
24
24
|
export var TextAnchor;
|
|
25
25
|
(function (TextAnchor) {
|
|
26
|
-
TextAnchor[TextAnchor[
|
|
27
|
-
TextAnchor[TextAnchor[
|
|
28
|
-
TextAnchor[TextAnchor[
|
|
29
|
-
TextAnchor[TextAnchor[
|
|
30
|
-
TextAnchor[TextAnchor[
|
|
31
|
-
TextAnchor[TextAnchor[
|
|
32
|
-
TextAnchor[TextAnchor[
|
|
33
|
-
TextAnchor[TextAnchor[
|
|
34
|
-
TextAnchor[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
35
|
})(TextAnchor || (TextAnchor = {}));
|
|
36
36
|
export var HorizontalWrapMode;
|
|
37
37
|
(function (HorizontalWrapMode) {
|
|
38
|
-
HorizontalWrapMode[HorizontalWrapMode[
|
|
39
|
-
HorizontalWrapMode[HorizontalWrapMode[
|
|
38
|
+
HorizontalWrapMode[HorizontalWrapMode["Wrap"] = 0] = "Wrap";
|
|
39
|
+
HorizontalWrapMode[HorizontalWrapMode["Overflow"] = 1] = "Overflow";
|
|
40
40
|
})(HorizontalWrapMode || (HorizontalWrapMode = {}));
|
|
41
41
|
export var VerticalWrapMode;
|
|
42
42
|
(function (VerticalWrapMode) {
|
|
43
|
-
VerticalWrapMode[VerticalWrapMode[
|
|
44
|
-
VerticalWrapMode[VerticalWrapMode[
|
|
43
|
+
VerticalWrapMode[VerticalWrapMode["Truncate"] = 0] = "Truncate";
|
|
44
|
+
VerticalWrapMode[VerticalWrapMode["Overflow"] = 1] = "Overflow";
|
|
45
45
|
})(VerticalWrapMode || (VerticalWrapMode = {}));
|
|
46
|
-
|
|
46
|
+
var defaultStyle = {
|
|
47
47
|
width: 200,
|
|
48
48
|
height: 200
|
|
49
49
|
};
|
|
50
|
-
|
|
50
|
+
var OutlineText = /** @class */ (function (_super) {
|
|
51
51
|
__extends(OutlineText, _super);
|
|
52
52
|
function OutlineText(props) {
|
|
53
|
-
|
|
53
|
+
var _this = _super.call(this, props) || this;
|
|
54
54
|
_this.OnLoad = function (e) {
|
|
55
55
|
console.log('!!!!!!!!!!!!!!');
|
|
56
56
|
if (!window.require) {
|
|
57
57
|
console.error('need puerts env');
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
var CS = window.require('csharp');
|
|
60
60
|
if (!CS) {
|
|
61
61
|
console.error('need puerts env');
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
var puerts = window.require('puerts');
|
|
65
65
|
console.log('?????');
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
69
|
if (!attachment) {
|
|
70
70
|
console.error("can't get relected attachment, handle:".concat(handle));
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
73
|
console.log('windowId:' + windowId.toString() + ' handle:' + handle.toString());
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
var placeholder = attachment.GetMountingGameObject();
|
|
75
|
+
var text = placeholder.AddComponent(puerts.$typeof(CS.UnityEngine.UI.Text));
|
|
76
76
|
_this.text = text;
|
|
77
|
-
|
|
77
|
+
var outline = placeholder.AddComponent(puerts.$typeof(CS.UnityEngine.UI.Outline));
|
|
78
78
|
_this.outline = outline;
|
|
79
79
|
_this.updateOutlineText();
|
|
80
80
|
};
|
|
@@ -86,20 +86,20 @@ let OutlineText = /** @class */ (function (_super) {
|
|
|
86
86
|
};
|
|
87
87
|
OutlineText.prototype.colorRgb = function (colorStr) {
|
|
88
88
|
//十六进制颜色值的正则表达式
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
var reg = /^#([0-9a-fA-f]{0,}|)$/;
|
|
90
|
+
var matchRes = colorStr.toString().toLowerCase().match(reg);
|
|
91
|
+
var transColor = '';
|
|
92
92
|
if (matchRes.length > 0)
|
|
93
93
|
transColor = matchRes[matchRes.length - 1];
|
|
94
94
|
// eslint-disable-next-line @typescript-eslint/no-array-constructor
|
|
95
|
-
|
|
95
|
+
var colorList = new Array();
|
|
96
96
|
while (transColor != '') {
|
|
97
|
-
|
|
97
|
+
var hex = '0x' + transColor.substring(0, 2);
|
|
98
98
|
colorList.push(parseInt(hex, 16));
|
|
99
99
|
transColor = transColor.substring(2, transColor.length);
|
|
100
100
|
}
|
|
101
|
-
|
|
102
|
-
for (
|
|
101
|
+
var r, g, b, a = 1;
|
|
102
|
+
for (var i = 0; i < colorList.length; i++) {
|
|
103
103
|
if (i == 0 && colorList[i] != null && colorList[i] != undefined) {
|
|
104
104
|
r = colorList[i] / 255;
|
|
105
105
|
}
|
|
@@ -113,11 +113,11 @@ let OutlineText = /** @class */ (function (_super) {
|
|
|
113
113
|
a = colorList[i] / 255;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
|
|
116
|
+
var CS = window.require('csharp');
|
|
117
117
|
return CS.UnityEngine.Color(r, g, b, a);
|
|
118
118
|
};
|
|
119
119
|
OutlineText.prototype.updateOutlineText = function () {
|
|
120
|
-
|
|
120
|
+
var CS = window.require('csharp');
|
|
121
121
|
this.text.text = this.props.text;
|
|
122
122
|
this.text.font = CS.com.tencent.pandora.TextPartner.GetFont.Invoke(this.props.font);
|
|
123
123
|
this.text.fontStyle = this.props.fontStyle;
|
|
@@ -132,8 +132,8 @@ let OutlineText = /** @class */ (function (_super) {
|
|
|
132
132
|
this.outline.effectDistance = new CS.UnityEngine.Vector2(this.props.outlineDistance.x, this.props.outlineDistance.y);
|
|
133
133
|
};
|
|
134
134
|
OutlineText.prototype.render = function () {
|
|
135
|
-
return (h(
|
|
136
|
-
h(
|
|
135
|
+
return (h("div", { style: this.props.style },
|
|
136
|
+
h("pixslot", { style: { width: '100%', height: '100%' }, src: 'pixui://method:placeholder', onLoad: this.OnLoad.bind(this) })));
|
|
137
137
|
};
|
|
138
138
|
OutlineText.defaultProps = {
|
|
139
139
|
style: defaultStyle,
|
|
@@ -26,7 +26,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
26
26
|
};
|
|
27
27
|
import { h, Component } from "preact";
|
|
28
28
|
//@ts-ignore
|
|
29
|
-
import SlapfaceLess from "./
|
|
29
|
+
import SlapfaceLess from "./Slapface.less";
|
|
30
30
|
//默认配置项
|
|
31
31
|
var settingsitems = {
|
|
32
32
|
ani_switch_type: 1,
|
|
@@ -198,7 +198,7 @@ var Group = /** @class */ (function (_super) {
|
|
|
198
198
|
return (h("div", { style: { width: '100%', height: '100%', alignItems: 'center', justifyContent: 'center', position: 'absolute' } },
|
|
199
199
|
h("div", { onClick: function () { if (_this.props.settingsitems.is_mask == false)
|
|
200
200
|
return; _this.closeClick(); }, style: { position: "absolute", width: "100%", height: "100%" } }),
|
|
201
|
-
h("div", { ref: function (div) { _this.picBack = div; }, onAnimationEnd: function () { setTimeout(function () { _this.picBack.className = SlapfaceLess.groupBackReverse; }, 0); } },
|
|
201
|
+
h("div", { ref: function (div) { _this.picBack = div; }, style: { position: "absolute" }, onAnimationEnd: function () { setTimeout(function () { _this.picBack.className = SlapfaceLess.groupBackReverse; }, 0); } },
|
|
202
202
|
h("img", { src: this.groupArr[this.state.curIndex].picture, style: { visibility: this.elseDisplay, width: this.groupArr[this.state.curIndex].width, height: this.groupArr[this.state.curIndex].height }, onLoad: function () { var curIndex = _this.state.curIndex; if (!_this.groupArr[curIndex].isLoadDone) {
|
|
203
203
|
_this.groupArr[curIndex].isLoadDone = true;
|
|
204
204
|
_this.loadDisplay = "hidden";
|
|
@@ -142,8 +142,8 @@ var Slider = /** @class */ (function (_super) {
|
|
|
142
142
|
_this.setState({
|
|
143
143
|
percent: _this.state.percent - 1
|
|
144
144
|
}, function () {
|
|
145
|
-
if (_this.props.
|
|
146
|
-
_this.props.
|
|
145
|
+
if (_this.props.onDecClick) {
|
|
146
|
+
_this.props.onDecClick(_this.state.percent);
|
|
147
147
|
}
|
|
148
148
|
});
|
|
149
149
|
}
|