pixuireactcomponents 1.2.2 → 1.2.31

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.
Files changed (104) hide show
  1. package/index.d.ts +15 -0
  2. package/index.js +16 -20
  3. package/package.json +9 -9
  4. package/tools/EventDispatcherJs.d.ts +10 -0
  5. package/tools/EventDispatcherJs.js +71 -0
  6. package/tools/Logger.d.ts +6 -0
  7. package/tools/Logger.js +138 -0
  8. package/ui/components/button/Button.d.ts +5 -0
  9. package/ui/components/button/Button.js +37 -0
  10. package/ui/components/carousel/Carousel.d.ts +5 -0
  11. package/ui/components/carousel/Carousel.js +219 -0
  12. package/ui/components/dropdown/Dropdown.d.ts +30 -0
  13. package/ui/components/dropdown/Dropdown.js +92 -0
  14. package/ui/components/dropdown/DropdownOptionUI.d.ts +11 -0
  15. package/ui/components/dropdown/DropdownOptionUI.js +28 -0
  16. package/ui/components/dropdown/DropdownSpreadMainUI.d.ts +9 -0
  17. package/ui/components/dropdown/DropdownSpreadMainUI.js +27 -0
  18. package/ui/components/dropdown/DropdownUnspreadMainUI.d.ts +9 -0
  19. package/ui/components/dropdown/DropdownUnspreadMainUI.js +27 -0
  20. package/ui/components/gradient/GradientText.d.ts +63 -0
  21. package/ui/components/gradient/{GradientText.tsx → GradientText.js} +174 -183
  22. package/ui/components/outlinetext/OutlineText.d.ts +94 -0
  23. package/ui/components/outlinetext/OutlineText.js +168 -0
  24. package/ui/components/progress/Progress.d.ts +34 -0
  25. package/ui/components/progress/Progress.js +142 -0
  26. package/ui/components/slapface/Slapface.d.ts +12 -0
  27. package/ui/components/slapface/Slapface.js +235 -0
  28. package/ui/components/slider/Slider.d.ts +57 -0
  29. package/ui/components/slider/Slider.js +289 -0
  30. package/ui/components/tab/Tab.d.ts +6 -0
  31. package/ui/components/tab/Tab.js +27 -0
  32. package/ui/components/tab/Tabs.d.ts +12 -0
  33. package/ui/components/tab/Tabs.js +54 -0
  34. package/cmdAfterTsBuild.js +0 -8
  35. package/tools/EventDispatcherJs.tsx +0 -74
  36. package/tools/Logger.tsx +0 -161
  37. package/tools/img/logger.png +0 -0
  38. package/tsconfig.json +0 -45
  39. package/ui/components/bulletscreen/BulletItemAnimation.tsx +0 -117
  40. package/ui/components/bulletscreen/BulletScreenAnimation.tsx +0 -278
  41. package/ui/components/bulletscreen/bullet.less +0 -17
  42. package/ui/components/button/Button.tsx +0 -18
  43. package/ui/components/carousel/Carousel.tsx +0 -279
  44. package/ui/components/checkBox/CheckBox.tsx +0 -40
  45. package/ui/components/dropdown/Dropdown.tsx +0 -126
  46. package/ui/components/dropdown/DropdownOptionUI.tsx +0 -14
  47. package/ui/components/dropdown/DropdownSpreadMainUI.tsx +0 -11
  48. package/ui/components/dropdown/DropdownUnspreadMainUI.tsx +0 -11
  49. package/ui/components/outlinetext/OutlineText.tsx +0 -184
  50. package/ui/components/progress/Progress.tsx +0 -174
  51. package/ui/components/slapface/Slapface.tsx +0 -284
  52. package/ui/components/slider/Slider.tsx +0 -366
  53. package/ui/components/tab/Tab.tsx +0 -12
  54. package/ui/components/tab/Tabs.tsx +0 -56
  55. package/ui/components/togglegroup/ToggleGroup.tsx +0 -105
  56. package/ui/components/videoplayer/VideoPlayer.tsx +0 -200
  57. package/ui/components/waterfallcomponent/WaterfallComponent.jsx +0 -687
  58. package/ui/components/waterfallcomponent/less/WaterfallComponent.less +0 -13
  59. package/ui/sample/Images.tsx +0 -60
  60. package/ui/sample/OutlineText/OutlineDemo.tsx +0 -61
  61. package/ui/sample/Slapface/SlapfaceDemo.tsx +0 -30
  62. package/ui/sample/asset/btn_close.png +0 -0
  63. package/ui/sample/asset/changtai_button.jpg +0 -0
  64. package/ui/sample/asset/checkbox0.png +0 -0
  65. package/ui/sample/asset/checkbox1.png +0 -0
  66. package/ui/sample/asset/data_arrow_down.png +0 -0
  67. package/ui/sample/asset/data_arrow_up.png +0 -0
  68. package/ui/sample/asset/dot.png +0 -0
  69. package/ui/sample/asset/inner.png +0 -0
  70. package/ui/sample/asset/item_reddot.png +0 -0
  71. package/ui/sample/asset/loading.png +0 -0
  72. package/ui/sample/asset/money_dropdown.png +0 -0
  73. package/ui/sample/asset/money_dropdownall.png +0 -0
  74. package/ui/sample/asset/outer.png +0 -0
  75. package/ui/sample/asset/slapface_samplepic1.png +0 -0
  76. package/ui/sample/asset/slapface_samplepic2.png +0 -0
  77. package/ui/sample/asset/slapface_samplepic3.png +0 -0
  78. package/ui/sample/asset/slapface_samplepic4.png +0 -0
  79. package/ui/sample/asset/slapface_samplepic5.png +0 -0
  80. package/ui/sample/asset/slapface_samplepic6.png +0 -0
  81. package/ui/sample/asset/tab_choosed.png +0 -0
  82. package/ui/sample/asset/tabs_bg.png +0 -0
  83. package/ui/sample/asset/video_pause.png +0 -0
  84. package/ui/sample/asset/video_play.png +0 -0
  85. package/ui/sample/asset/video_reload.png +0 -0
  86. package/ui/sample/asset/xuanfu_button.jpg +0 -0
  87. package/ui/sample/asset/yaxia_button.jpg +0 -0
  88. package/ui/sample/bulletscreen/BulletDemo.tsx +0 -84
  89. package/ui/sample/button/ButtonDemo.tsx +0 -19
  90. package/ui/sample/carousel/carouselDemo.tsx +0 -52
  91. package/ui/sample/checkBox/checkBoxDemo.tsx +0 -7
  92. package/ui/sample/dropdown/DropdownDemo.tsx +0 -65
  93. package/ui/sample/dropdown/MoneyDropdownOption.tsx +0 -50
  94. package/ui/sample/dropdown/MoneyDropdownSpreadMain.tsx +0 -42
  95. package/ui/sample/dropdown/MoneyDropdownUnspreadMain.tsx +0 -44
  96. package/ui/sample/gradient/GradientDemo.tsx +0 -51
  97. package/ui/sample/less/video.less +0 -144
  98. package/ui/sample/progress/ProgressDemo.tsx +0 -74
  99. package/ui/sample/slider/SliderDemo.tsx +0 -116
  100. package/ui/sample/tab/TabDemo.tsx +0 -67
  101. package/ui/sample/tab/TopTab.tsx +0 -74
  102. package/ui/sample/togglegroup/ToggleGroupDemo.tsx +0 -35
  103. package/ui/sample/videoplayer/VideoPlayerDemo.tsx +0 -57
  104. package/ui/sample/waterfallcomponent/WaterfallComponentDemo.jsx +0 -137
@@ -1,36 +1,27 @@
1
- import { Component, createRef, CSSProperties, h } from 'preact';
2
-
3
- export interface GradientTextProps {
4
- style?: CSSProperties;
5
- text?: string;
6
- color?: string;
7
- fontSize?: number;
8
- font?: string;
9
- alignment?: string;
10
- direction?: string;
11
- colorTop?: string;
12
- colorBottom?: string;
13
- colorLeft?: string;
14
- colorRight?: string;
15
- fitRectTransform?: boolean;
16
- richText?: boolean;
17
- alignByGeometry?: boolean;
18
- horizontalOverflow?: string;
19
- verticalOverflow?: string;
20
- bestFit?: boolean;
21
- raycastTarget?: boolean;
22
- fontStyle?: string;
23
- lineSpacing?: number;
24
- }
25
-
26
- export class GradientText extends Component<GradientTextProps, GradientTextProps> {
27
- isPrintLog = false;
28
- textObj = null;
29
- gradientObj = null;
30
- constructor(props) {
31
- super(props);
32
-
33
- this.state = {
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 GradientText = /** @class */ (function (_super) {
18
+ __extends(GradientText, _super);
19
+ function GradientText(props) {
20
+ var _this = _super.call(this, props) || this;
21
+ _this.isPrintLog = false;
22
+ _this.textObj = null;
23
+ _this.gradientObj = null;
24
+ _this.state = {
34
25
  style: props.style,
35
26
  text: props.text,
36
27
  color: props.color,
@@ -52,17 +43,15 @@ export class GradientText extends Component<GradientTextProps, GradientTextProps
52
43
  fontStyle: props.fontStyle,
53
44
  lineSpacing: props.lineSpacing,
54
45
  };
46
+ return _this;
55
47
  }
56
-
57
- componentDidUpdate() {
48
+ GradientText.prototype.componentDidUpdate = function () {
58
49
  console.log('componentDidUpdate');
59
50
  this.updateGradientText();
60
- }
61
-
62
- static getDerivedStateFromProps(props, state) {
51
+ };
52
+ GradientText.getDerivedStateFromProps = function (props, state) {
63
53
  console.log('getDerivedStateFromProps props:' + JSON.stringify(props));
64
54
  console.log('getDerivedStateFromProps old state:' + JSON.stringify(state));
65
-
66
55
  if (props.text !== state.text ||
67
56
  props.color !== state.color ||
68
57
  props.fontSize !== state.fontSize ||
@@ -102,167 +91,162 @@ export class GradientText extends Component<GradientTextProps, GradientTextProps
102
91
  fontStyle: props.fontStyle && props.fontStyle !== state.fontStyle ? props.fontStyle : state.fontStyle,
103
92
  lineSpacing: props.lineSpacing && props.lineSpacing !== state.lineSpacing ? props.lineSpacing : state.lineSpacing,
104
93
  };
105
- } else {
94
+ }
95
+ else {
106
96
  return null;
107
97
  }
108
- }
109
-
110
-
111
- getCSharp() {
112
- if (!(window as any).require) {
98
+ };
99
+ GradientText.prototype.getCSharp = function () {
100
+ if (!window.require) {
113
101
  console.error('need puerts env');
114
102
  return null;
115
103
  }
116
- let CS = (window as any).require('csharp');
104
+ var CS = window.require('csharp');
117
105
  if (!CS) {
118
106
  console.error('need puerts env');
119
107
  return null;
120
108
  }
121
109
  return CS;
122
- }
123
-
124
- onLoad(e) {
110
+ };
111
+ GradientText.prototype.onLoad = function (e) {
125
112
  this.printLog('OnLoad');
126
- const CS = this.getCSharp();
113
+ var CS = this.getCSharp();
127
114
  if (CS == null) {
128
115
  console.error('Get CS error');
129
116
  return;
130
117
  }
131
-
132
- const windowId = (window as any).external.id;
133
- const puerts = (window as any).require('puerts');
134
- const handle = e.target.attachment.handle;
135
-
136
- const attachment = CS.com.tencent.pandora.CSharpInterface.GetSlotAttachmentByHandle(windowId, handle);
118
+ var windowId = window.external.id;
119
+ var puerts = window.require('puerts');
120
+ var handle = e.target.attachment.handle;
121
+ var attachment = CS.com.tencent.pandora.CSharpInterface.GetSlotAttachmentByHandle(windowId, handle);
137
122
  if (!attachment) {
138
- console.error(`can't get relected attachment, handle:${handle}`);
123
+ console.error("can't get relected attachment, handle:".concat(handle));
139
124
  return;
140
125
  }
141
-
142
- const placeholder = attachment.GetMountingGameObject();
126
+ var placeholder = attachment.GetMountingGameObject();
143
127
  this.textObj = placeholder.AddComponent(puerts.$typeof(CS.UnityEngine.UI.Text));
144
128
  this.gradientObj = placeholder.AddComponent(puerts.$typeof(CS.UiEffect.GradientColor));
145
129
  this.updateGradientText();
146
- }
147
-
148
- updateGradientText() {
149
- let textStr = !this.state.text || typeof (this.state.text) != 'string' ? '' : this.state.text;
150
- let color = !this.state.color || typeof (this.state.color) != 'string' ? '#FFFFFFFF' : this.state.color;
151
- let fontSize = !this.state.fontSize || typeof (this.state.fontSize) != 'number' ? 18 : this.state.fontSize;
152
- let font = !this.state.font || typeof (this.state.font) != 'string' ? 'gamefont' : this.state.font;
153
- let alignment = !this.state.alignment || typeof (this.state.alignment) != 'string' ? 'UpperLeft' : this.state.alignment;
154
- let direction = !this.state.direction || typeof (this.state.direction) != 'string' ? 'Both' : this.state.direction;
155
- let colorTop = !this.state.colorTop || typeof (this.state.colorTop) != 'string' ? '#FFFFFFFF' : this.state.colorTop;
156
- let colorBottom = !this.state.colorBottom || typeof (this.state.colorBottom) != 'string' ? '#000000FF' : this.state.colorBottom;
157
- let colorLeft = !this.state.colorLeft || typeof (this.state.colorLeft) != 'string' ? '#FF0000FF' : this.state.colorLeft;
158
- let colorRight = !this.state.colorRight || typeof (this.state.colorRight) != 'string' ? '#0000FFFF' : this.state.colorLeft;
159
- let fitRectTransform = !this.state.fitRectTransform || typeof (this.state.fitRectTransform) != 'boolean' ? false : this.state.fitRectTransform;
160
- let richText = !this.state.richText || typeof (this.state.richText) != 'boolean' ? true : this.state.richText;
161
- let alignByGeometry = !this.state.alignByGeometry || typeof (this.state.alignByGeometry) != 'boolean' ? false : this.state.alignByGeometry;
162
- let horizontalOverflow = !this.state.horizontalOverflow || typeof (this.state.horizontalOverflow) != 'string' ? 'Warp' : this.state.horizontalOverflow;
163
- let verticalOverflow = !this.state.verticalOverflow || typeof (this.state.verticalOverflow) != 'string' ? 'Truncate' : this.state.verticalOverflow;
164
- let bestFit = !this.state.bestFit || typeof (this.state.bestFit) != 'boolean' ? false : this.state.bestFit;
165
- let raycastTarget = !this.state.raycastTarget || typeof (this.state.raycastTarget) != 'boolean' ? true : this.state.raycastTarget;
166
- let fontStyle = !this.state.fontStyle || typeof (this.state.fontStyle) != 'string' ? 'Normal' : this.state.fontStyle;
167
- let lineSpacing = !this.state.lineSpacing || typeof (this.state.lineSpacing) != 'number' ? 1 : this.state.lineSpacing;
168
-
130
+ };
131
+ GradientText.prototype.updateGradientText = function () {
132
+ var textStr = !this.state.text || typeof (this.state.text) != 'string' ? '' : this.state.text;
133
+ var color = !this.state.color || typeof (this.state.color) != 'string' ? '#FFFFFFFF' : this.state.color;
134
+ var fontSize = !this.state.fontSize || typeof (this.state.fontSize) != 'number' ? 18 : this.state.fontSize;
135
+ var font = !this.state.font || typeof (this.state.font) != 'string' ? 'gamefont' : this.state.font;
136
+ var alignment = !this.state.alignment || typeof (this.state.alignment) != 'string' ? 'UpperLeft' : this.state.alignment;
137
+ var direction = !this.state.direction || typeof (this.state.direction) != 'string' ? 'Both' : this.state.direction;
138
+ var colorTop = !this.state.colorTop || typeof (this.state.colorTop) != 'string' ? '#FFFFFFFF' : this.state.colorTop;
139
+ var colorBottom = !this.state.colorBottom || typeof (this.state.colorBottom) != 'string' ? '#000000FF' : this.state.colorBottom;
140
+ var colorLeft = !this.state.colorLeft || typeof (this.state.colorLeft) != 'string' ? '#FF0000FF' : this.state.colorLeft;
141
+ var colorRight = !this.state.colorRight || typeof (this.state.colorRight) != 'string' ? '#0000FFFF' : this.state.colorLeft;
142
+ var fitRectTransform = !this.state.fitRectTransform || typeof (this.state.fitRectTransform) != 'boolean' ? false : this.state.fitRectTransform;
143
+ var richText = !this.state.richText || typeof (this.state.richText) != 'boolean' ? true : this.state.richText;
144
+ var alignByGeometry = !this.state.alignByGeometry || typeof (this.state.alignByGeometry) != 'boolean' ? false : this.state.alignByGeometry;
145
+ var horizontalOverflow = !this.state.horizontalOverflow || typeof (this.state.horizontalOverflow) != 'string' ? 'Warp' : this.state.horizontalOverflow;
146
+ var verticalOverflow = !this.state.verticalOverflow || typeof (this.state.verticalOverflow) != 'string' ? 'Truncate' : this.state.verticalOverflow;
147
+ var bestFit = !this.state.bestFit || typeof (this.state.bestFit) != 'boolean' ? false : this.state.bestFit;
148
+ var raycastTarget = !this.state.raycastTarget || typeof (this.state.raycastTarget) != 'boolean' ? true : this.state.raycastTarget;
149
+ var fontStyle = !this.state.fontStyle || typeof (this.state.fontStyle) != 'string' ? 'Normal' : this.state.fontStyle;
150
+ var lineSpacing = !this.state.lineSpacing || typeof (this.state.lineSpacing) != 'number' ? 1 : this.state.lineSpacing;
169
151
  if (this.textObj) {
170
- (this.textObj as any).text = textStr;
171
- (this.textObj as any).fontSize = fontSize;
172
- (this.textObj as any).font = this.transFont(font);
173
- (this.textObj as any).alignment = this.transAlignment(alignment);
174
- (this.textObj as any).color = this.colorRgb(color);
175
- (this.textObj as any).richText = richText;
176
- (this.textObj as any).alignByGeometry = alignByGeometry;
177
- (this.textObj as any).horizontalOverflow = this.transHorizontalOverflow(horizontalOverflow);
178
- (this.textObj as any).verticalOverflow = this.transVerticalOverflow(verticalOverflow);
179
- (this.textObj as any).bestFit = bestFit;
180
- (this.textObj as any).raycastTarget = raycastTarget;
181
- (this.textObj as any).fontStyle = this.transFontStyle(fontStyle);
182
- (this.textObj as any).lineSpacing = lineSpacing;
183
- } else {
152
+ this.textObj.text = textStr;
153
+ this.textObj.fontSize = fontSize;
154
+ this.textObj.font = this.transFont(font);
155
+ this.textObj.alignment = this.transAlignment(alignment);
156
+ this.textObj.color = this.colorRgb(color);
157
+ this.textObj.richText = richText;
158
+ this.textObj.alignByGeometry = alignByGeometry;
159
+ this.textObj.horizontalOverflow = this.transHorizontalOverflow(horizontalOverflow);
160
+ this.textObj.verticalOverflow = this.transVerticalOverflow(verticalOverflow);
161
+ this.textObj.bestFit = bestFit;
162
+ this.textObj.raycastTarget = raycastTarget;
163
+ this.textObj.fontStyle = this.transFontStyle(fontStyle);
164
+ this.textObj.lineSpacing = lineSpacing;
165
+ }
166
+ else {
184
167
  this.printLog('empty CS.UnityEngine.UI.Text');
185
168
  }
186
-
187
169
  if (this.gradientObj) {
188
- (this.gradientObj as any).direction = this.transDirection(direction);
189
- (this.gradientObj as any).colorTop = this.colorRgb(colorTop);
190
- (this.gradientObj as any).colorBottom = this.colorRgb(colorBottom);
191
- (this.gradientObj as any).colorRight = this.colorRgb(colorRight);
192
- (this.gradientObj as any).colorLeft = this.colorRgb(colorLeft);
193
- (this.gradientObj as any).m_fitRectTransform = fitRectTransform;
194
- } else {
170
+ this.gradientObj.direction = this.transDirection(direction);
171
+ this.gradientObj.colorTop = this.colorRgb(colorTop);
172
+ this.gradientObj.colorBottom = this.colorRgb(colorBottom);
173
+ this.gradientObj.colorRight = this.colorRgb(colorRight);
174
+ this.gradientObj.colorLeft = this.colorRgb(colorLeft);
175
+ this.gradientObj.m_fitRectTransform = fitRectTransform;
176
+ }
177
+ else {
195
178
  this.printLog('empty CS.UiEffect.GradientColor');
196
179
  }
197
- }
198
-
199
- transFont(fontName) {
200
- const CS = this.getCSharp();
180
+ };
181
+ GradientText.prototype.transFont = function (fontName) {
182
+ var CS = this.getCSharp();
201
183
  return CS.com.tencent.pandora.TextPartner.GetFont.Invoke(fontName);
202
- }
203
-
204
- transHorizontalOverflow(str) {
205
- const CS = this.getCSharp();
184
+ };
185
+ GradientText.prototype.transHorizontalOverflow = function (str) {
186
+ var CS = this.getCSharp();
206
187
  if (str == 'Warp') {
207
188
  return CS.UnityEngine.HorizontalWrapMode.Wrap;
208
- } else if (str == 'Overflow') {
189
+ }
190
+ else if (str == 'Overflow') {
209
191
  return CS.UnityEngine.HorizontalWrapMode.Overflow;
210
- } else {
192
+ }
193
+ else {
211
194
  console.error('invaild HorizontalOverflow');
212
195
  return CS.UnityEngine.HorizontalWrapMode.Wrap;
213
196
  }
214
- }
215
-
216
- transVerticalOverflow(str) {
217
- const CS = this.getCSharp();
197
+ };
198
+ GradientText.prototype.transVerticalOverflow = function (str) {
199
+ var CS = this.getCSharp();
218
200
  if (str == 'Truncate') {
219
201
  return CS.UnityEngine.VerticalWrapMode.Truncate;
220
- } else if (str == 'Overflow') {
202
+ }
203
+ else if (str == 'Overflow') {
221
204
  return CS.UnityEngine.VerticalWrapMode.Overflow;
222
- } else {
205
+ }
206
+ else {
223
207
  console.error('invaild VerticalOverflow');
224
208
  return CS.UnityEngine.VerticalWrapMode.Truncate;
225
209
  }
226
- }
227
-
228
- transFontStyle(str) {
229
- const CS = this.getCSharp();
210
+ };
211
+ GradientText.prototype.transFontStyle = function (str) {
212
+ var CS = this.getCSharp();
230
213
  if (str == 'Normal') {
231
214
  return CS.UnityEngine.FontStyle.Normal;
232
- } else if (str == 'Bold') {
215
+ }
216
+ else if (str == 'Bold') {
233
217
  return CS.UnityEngine.FontStyle.Bold;
234
- } else if (str == 'Italic') {
218
+ }
219
+ else if (str == 'Italic') {
235
220
  return CS.UnityEngine.FontStyle.Italic;
236
- } else if (str == 'BoldAndItalic') {
221
+ }
222
+ else if (str == 'BoldAndItalic') {
237
223
  return CS.UnityEngine.FontStyle.BoldAndItalic;
238
- } else {
224
+ }
225
+ else {
239
226
  console.error('invaild FontStyle');
240
227
  return CS.UnityEngine.FontStyle.Normal;
241
228
  }
242
- }
243
-
244
- colorRgb(colorStr) {
245
- this.printLog(`colorList[i]/255[${0 / 255}]`);
246
- this.printLog(`colorStr[${colorStr}]`);
229
+ };
230
+ GradientText.prototype.colorRgb = function (colorStr) {
231
+ this.printLog("colorList[i]/255[".concat(0 / 255, "]"));
232
+ this.printLog("colorStr[".concat(colorStr, "]"));
247
233
  //十六进制颜色值的正则表达式
248
- let reg = /^#([0-9a-fA-f]{0,}|)$/;
249
- let matchRes = colorStr.toString().toLowerCase().match(reg);
250
- let transColor = '';
251
- this.printLog(`matchRes${JSON.stringify(matchRes)}`);
252
-
253
- if (matchRes.length > 0) transColor = matchRes[matchRes.length - 1];
254
- let colorList:number[] = [];
234
+ var reg = /^#([0-9a-fA-f]{0,}|)$/;
235
+ var matchRes = colorStr.toString().toLowerCase().match(reg);
236
+ var transColor = '';
237
+ this.printLog("matchRes".concat(JSON.stringify(matchRes)));
238
+ if (matchRes.length > 0)
239
+ transColor = matchRes[matchRes.length - 1];
240
+ var colorList = [];
255
241
  while (transColor != '') {
256
- let hex = '0x' + transColor.substring(0, 2);
257
- this.printLog(`hex[${hex}]`);
258
- colorList.push(parseInt(hex, 16) as any);
242
+ var hex = '0x' + transColor.substring(0, 2);
243
+ this.printLog("hex[".concat(hex, "]"));
244
+ colorList.push(parseInt(hex, 16));
259
245
  transColor = transColor.substring(2, transColor.length);
260
246
  }
261
-
262
- let r, g, b, a = 1;
263
-
264
- for (let i = 0; i < colorList.length; i++) {
265
- this.printLog(`colorList i[${i}]item[${colorList[i]}]`);
247
+ var r, g, b, a = 1;
248
+ for (var i = 0; i < colorList.length; i++) {
249
+ this.printLog("colorList i[".concat(i, "]item[").concat(colorList[i], "]"));
266
250
  if (i == 0 && colorList[i] != null && colorList[i] != undefined) {
267
251
  r = colorList[i] / 255;
268
252
  }
@@ -276,63 +260,70 @@ export class GradientText extends Component<GradientTextProps, GradientTextProps
276
260
  a = colorList[i] / 255;
277
261
  }
278
262
  }
279
- this.printLog(`New Color r[${r}]g[${g}]b[${b}]a[${a}]`);
280
-
281
- const CS = this.getCSharp();
263
+ this.printLog("New Color r[".concat(r, "]g[").concat(g, "]b[").concat(b, "]a[").concat(a, "]"));
264
+ var CS = this.getCSharp();
282
265
  return CS.UnityEngine.Color(r, g, b, a);
283
- }
284
-
285
- printLog(text) {
266
+ };
267
+ GradientText.prototype.printLog = function (text) {
286
268
  if (this.isPrintLog) {
287
269
  console.log(text);
288
270
  }
289
- }
290
-
291
- transDirection(direction) {
292
- const CS = this.getCSharp();
271
+ };
272
+ GradientText.prototype.transDirection = function (direction) {
273
+ var CS = this.getCSharp();
293
274
  if (direction == 'Both') {
294
275
  return CS.UiEffect.GradientColor.DIRECTION.Both;
295
- } else if (direction == 'Vertical') {
276
+ }
277
+ else if (direction == 'Vertical') {
296
278
  return CS.UiEffect.GradientColor.DIRECTION.Vertical;
297
- } else if (direction == 'Horizontal') {
279
+ }
280
+ else if (direction == 'Horizontal') {
298
281
  return CS.UiEffect.GradientColor.DIRECTION.Horizontal;
299
- } else {
282
+ }
283
+ else {
300
284
  console.error('invaild direction');
301
285
  return CS.UiEffect.GradientColor.DIRECTION.Both;
302
286
  }
303
- }
304
-
305
- transAlignment(alignment) {
306
- const CS = this.getCSharp();
287
+ };
288
+ GradientText.prototype.transAlignment = function (alignment) {
289
+ var CS = this.getCSharp();
307
290
  if (alignment == 'UpperLeft') {
308
291
  return CS.UnityEngine.TextAnchor.UpperLeft;
309
- } else if (alignment == 'UpperCenter') {
292
+ }
293
+ else if (alignment == 'UpperCenter') {
310
294
  return CS.UnityEngine.TextAnchor.UpperCenter;
311
- } else if (alignment == 'UpperRight') {
295
+ }
296
+ else if (alignment == 'UpperRight') {
312
297
  return CS.UnityEngine.TextAnchor.UpperRight;
313
- } else if (alignment == 'MiddleCenter') {
298
+ }
299
+ else if (alignment == 'MiddleCenter') {
314
300
  return CS.UnityEngine.TextAnchor.MiddleCenter;
315
- } else if (alignment == 'MiddleLeft') {
301
+ }
302
+ else if (alignment == 'MiddleLeft') {
316
303
  return CS.UnityEngine.TextAnchor.MiddleLeft;
317
- } else if (alignment == 'MiddleRight') {
304
+ }
305
+ else if (alignment == 'MiddleRight') {
318
306
  return CS.UnityEngine.TextAnchor.MiddleRight;
319
- } else if (alignment == 'LowerLeft') {
307
+ }
308
+ else if (alignment == 'LowerLeft') {
320
309
  return CS.UnityEngine.TextAnchor.LowerLeft;
321
- } else if (alignment == 'LowerCenter') {
310
+ }
311
+ else if (alignment == 'LowerCenter') {
322
312
  return CS.UnityEngine.TextAnchor.LowerCenter;
323
- } else if (alignment == 'LowerRight') {
313
+ }
314
+ else if (alignment == 'LowerRight') {
324
315
  return CS.UnityEngine.TextAnchor.LowerRight;
325
- } else {
316
+ }
317
+ else {
326
318
  console.error('invaild alignment');
327
319
  return CS.UnityEngine.TextAnchor.UpperLeft;
328
320
  }
329
- }
330
-
331
- render(props) {
332
- let style = !props.style ? { width: '200px', height: '200px', backgroundColor: '#FF00FFFF' } : props.style;
321
+ };
322
+ GradientText.prototype.render = function (props) {
323
+ var style = !props.style ? { width: '200px', height: '200px', backgroundColor: '#FF00FFFF' } : props.style;
333
324
  this.printLog('OnRender');
334
- return (
335
- <pixslot style={style} src='pixui://method:placeholder' onLoad={this.onLoad.bind(this)} />
336
- );
337
- }
338
- }
325
+ return (h("pixslot", { style: style, src: 'pixui://method:placeholder', onLoad: this.onLoad.bind(this) }));
326
+ };
327
+ return GradientText;
328
+ }(Component));
329
+ export { GradientText };
@@ -0,0 +1,94 @@
1
+ import { Component, CSSProperties, h } from 'preact';
2
+ export declare enum FontStyle {
3
+ Normal = 0,
4
+ Bold = 1,
5
+ Italic = 2,
6
+ BoldAndItalic = 3
7
+ }
8
+ export 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
+ export declare enum HorizontalWrapMode {
20
+ Wrap = 0,
21
+ Overflow = 1
22
+ }
23
+ export 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: {
39
+ r: number;
40
+ g: number;
41
+ b: number;
42
+ a: number;
43
+ };
44
+ outlineColor: {
45
+ r: number;
46
+ g: number;
47
+ b: number;
48
+ a: number;
49
+ };
50
+ outlineDistance: {
51
+ x: number;
52
+ y: number;
53
+ };
54
+ }
55
+ export declare class OutlineText extends Component<OutlineTextProps, OutlineTextProps> {
56
+ text: any;
57
+ outline: any;
58
+ textColor: any;
59
+ effectColor: any;
60
+ constructor(props: any);
61
+ static defaultProps: {
62
+ style: import("../../lib/preact/src/jsx").JCSSProperties;
63
+ text: string;
64
+ font: string;
65
+ fontStyle: FontStyle;
66
+ fontSize: number;
67
+ lineSpacing: number;
68
+ alignment: TextAnchor;
69
+ alignByGeometry: boolean;
70
+ horizontalOverflow: HorizontalWrapMode;
71
+ verticalOverflow: VerticalWrapMode;
72
+ color: {
73
+ r: number;
74
+ g: number;
75
+ b: number;
76
+ a: number;
77
+ };
78
+ outlineColor: {
79
+ r: number;
80
+ g: number;
81
+ b: number;
82
+ a: number;
83
+ };
84
+ outlineDistance: {
85
+ x: number;
86
+ y: number;
87
+ };
88
+ };
89
+ componentDidUpdate(): void;
90
+ OnLoad: (e: any) => void;
91
+ colorRgb(colorStr: any): any;
92
+ updateOutlineText(): void;
93
+ render(): h.JSX.Element;
94
+ }