pixuireactcomponents 1.2.3 → 1.2.32
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
|
+
let __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 (let 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 @@ var __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
|
+
let defaultStyle = {
|
|
47
47
|
width: 200,
|
|
48
48
|
height: 200
|
|
49
49
|
};
|
|
50
|
-
|
|
50
|
+
let OutlineText = /** @class */ (function (_super) {
|
|
51
51
|
__extends(OutlineText, _super);
|
|
52
52
|
function OutlineText(props) {
|
|
53
|
-
|
|
53
|
+
let _this = _super.call(this, props) || this;
|
|
54
54
|
_this.OnLoad = function (e) {
|
|
55
55
|
console.log('!!!!!!!!!!!!!!');
|
|
56
|
-
if (!require) {
|
|
56
|
+
if (!window.require) {
|
|
57
57
|
console.error('need puerts env');
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
let CS = window.require('csharp');
|
|
60
60
|
if (!CS) {
|
|
61
61
|
console.error('need puerts env');
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
let puerts = window.require('puerts');
|
|
65
65
|
console.log('?????');
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
let windowId = window.external.id;
|
|
67
|
+
let handle = e.target.attachment.handle;
|
|
68
|
+
let 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
|
+
let placeholder = attachment.GetMountingGameObject();
|
|
75
|
+
let text = placeholder.AddComponent(puerts.$typeof(CS.UnityEngine.UI.Text));
|
|
76
76
|
_this.text = text;
|
|
77
|
-
|
|
77
|
+
let outline = placeholder.AddComponent(puerts.$typeof(CS.UnityEngine.UI.Outline));
|
|
78
78
|
_this.outline = outline;
|
|
79
79
|
_this.updateOutlineText();
|
|
80
80
|
};
|
|
@@ -86,20 +86,20 @@ var OutlineText = /** @class */ (function (_super) {
|
|
|
86
86
|
};
|
|
87
87
|
OutlineText.prototype.colorRgb = function (colorStr) {
|
|
88
88
|
//十六进制颜色值的正则表达式
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
let reg = /^#([0-9a-fA-f]{0,}|)$/;
|
|
90
|
+
let matchRes = colorStr.toString().toLowerCase().match(reg);
|
|
91
|
+
let 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
|
+
let colorList = new Array();
|
|
96
96
|
while (transColor != '') {
|
|
97
|
-
|
|
97
|
+
let 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
|
+
let r, g, b, a = 1;
|
|
102
|
+
for (let 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 @@ var OutlineText = /** @class */ (function (_super) {
|
|
|
113
113
|
a = colorList[i] / 255;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
|
-
|
|
116
|
+
let CS = window.require('csharp');
|
|
117
117
|
return CS.UnityEngine.Color(r, g, b, a);
|
|
118
118
|
};
|
|
119
119
|
OutlineText.prototype.updateOutlineText = function () {
|
|
120
|
-
|
|
120
|
+
let 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 @@ var 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,
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
.maininterface{
|
|
2
|
+
width:1200px;
|
|
3
|
+
height:682px;
|
|
4
|
+
/* width:100%;
|
|
5
|
+
height:100%; */
|
|
6
|
+
margin: auto;
|
|
7
|
+
/* padding: 0px 36px 36px 36px; */
|
|
8
|
+
/* background-color: grey; */
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
position: relative;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.closeButton{
|
|
14
|
+
width:36px;
|
|
15
|
+
height:36px;
|
|
16
|
+
background-size: contain;
|
|
17
|
+
/* float: left; */
|
|
18
|
+
position: absolute;
|
|
19
|
+
right:0px;
|
|
20
|
+
top:0px;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@keyframes zoom{
|
|
24
|
+
from{
|
|
25
|
+
transform: scale(0)
|
|
26
|
+
}
|
|
27
|
+
80%{
|
|
28
|
+
transform: scale(1.1);
|
|
29
|
+
}
|
|
30
|
+
to{
|
|
31
|
+
transform: scale(1);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@keyframes zoomReverse{
|
|
36
|
+
from{
|
|
37
|
+
transform: scale(0)
|
|
38
|
+
}
|
|
39
|
+
to{
|
|
40
|
+
transform: scale(0);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.groupBack{
|
|
45
|
+
animation-name:zoom;
|
|
46
|
+
animation-timing-function:ease-in-out;
|
|
47
|
+
animation-iteration-count:1;
|
|
48
|
+
animation-duration: 1s;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.groupBackReverse{
|
|
52
|
+
animation-name:zoomReverse;
|
|
53
|
+
animation-timing-function:'';
|
|
54
|
+
animation-iteration-count:'';
|
|
55
|
+
animation-duration:'';
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.isShowToday{
|
|
59
|
+
width:36px;
|
|
60
|
+
height:31px;
|
|
61
|
+
background-size: contain;
|
|
62
|
+
position: absolute;
|
|
63
|
+
right:0px;
|
|
64
|
+
bottom:0px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.jumpButton{
|
|
68
|
+
position: absolute;
|
|
69
|
+
right:50%;
|
|
70
|
+
bottom:10%;
|
|
71
|
+
/* top:80%; */
|
|
72
|
+
transform: translate(50%, -50%);
|
|
73
|
+
}
|
|
74
|
+
.slapImage{
|
|
75
|
+
box-sizing: content-box;
|
|
76
|
+
/* border-width: 5px;
|
|
77
|
+
border-color: black;
|
|
78
|
+
border-style: solid; */
|
|
79
|
+
position: absolute;
|
|
80
|
+
left:50%;
|
|
81
|
+
top:50%;
|
|
82
|
+
transform:translate(-50%,-50%);
|
|
83
|
+
}
|
|
84
|
+
.mask{
|
|
85
|
+
// background:url(images/coupon-logo.gif) no-repeat;
|
|
86
|
+
height:100px;background-color:#fff;
|
|
87
|
+
opacity:0.6;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@keyframes rotate_by_myself{
|
|
91
|
+
from {
|
|
92
|
+
transform: rotate(0deg);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
50% {
|
|
96
|
+
transform: rotate(180deg);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
to {
|
|
100
|
+
transform: rotate(360deg);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.loading_anim{
|
|
105
|
+
animation-name: rotate_by_myself;
|
|
106
|
+
animation-duration: 1.5s;
|
|
107
|
+
animation-timing-function: linear;
|
|
108
|
+
animation-iteration-count: infinite;
|
|
109
|
+
background-position: center;
|
|
110
|
+
background-repeat: no-repeat;
|
|
111
|
+
background-size: 50%;
|
|
112
|
+
}
|