pixuireactcomponents 1.0.0

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 (44) hide show
  1. package/package.json +11 -0
  2. package/ui/components/bulletscreen/BulletItemAnimation.tsx +117 -0
  3. package/ui/components/bulletscreen/BulletScreenAnimation.tsx +278 -0
  4. package/ui/components/bulletscreen/bullet.less +17 -0
  5. package/ui/components/dropdown/Dropdown.tsx +115 -0
  6. package/ui/components/dropdown/DropdownOptionUI.tsx +13 -0
  7. package/ui/components/dropdown/DropdownSpreadMainUI.tsx +11 -0
  8. package/ui/components/dropdown/DropdownUnspreadMainUI.tsx +11 -0
  9. package/ui/components/progress/Progress.tsx +166 -0
  10. package/ui/components/tab/Tab.tsx +12 -0
  11. package/ui/components/tab/Tabs.tsx +56 -0
  12. package/ui/components/videoplayer/VideoPlayer.tsx +200 -0
  13. package/ui/sample/Images.tsx +34 -0
  14. package/ui/sample/asset/data_arrow_down.png +0 -0
  15. package/ui/sample/asset/data_arrow_up.png +0 -0
  16. package/ui/sample/asset/dot.png +0 -0
  17. package/ui/sample/asset/inner.png +0 -0
  18. package/ui/sample/asset/item_reddot.png +0 -0
  19. package/ui/sample/asset/loading.png +0 -0
  20. package/ui/sample/asset/money_dropdown.png +0 -0
  21. package/ui/sample/asset/money_dropdownall.png +0 -0
  22. package/ui/sample/asset/outer.png +0 -0
  23. package/ui/sample/asset/tab_choosed.png +0 -0
  24. package/ui/sample/asset/tabs_bg.png +0 -0
  25. package/ui/sample/asset/video_pause.png +0 -0
  26. package/ui/sample/asset/video_play.png +0 -0
  27. package/ui/sample/asset/video_reload.png +0 -0
  28. package/ui/sample/bulletscreen/BulletDemo.tsx +86 -0
  29. package/ui/sample/dropdown/DropdownDemo.tsx +65 -0
  30. package/ui/sample/dropdown/MoneyDropdownOption.tsx +49 -0
  31. package/ui/sample/dropdown/MoneyDropdownSpreadMain.tsx +42 -0
  32. package/ui/sample/dropdown/MoneyDropdownUnspreadMain.tsx +44 -0
  33. package/ui/sample/less/video.less +143 -0
  34. package/ui/sample/progress/ProgressDemo.tsx +74 -0
  35. package/ui/sample/tab/TabDemo.tsx +67 -0
  36. package/ui/sample/tab/TopTab.tsx +74 -0
  37. package/ui/sample/videoplayer/VideoPlayerDemo.tsx +57 -0
  38. package/utils/EventDispatcherJs.tsx +74 -0
  39. package/utils/GenerateConstructorAndGeterSeter.js +223 -0
  40. package/utils/Logger.tsx +158 -0
  41. package/utils/MakeImage.js +204 -0
  42. package/utils/img/logger.png +0 -0
  43. package/utils/img/makeImage.png +0 -0
  44. package/utils/utils.md +145 -0
package/utils/utils.md ADDED
@@ -0,0 +1,145 @@
1
+ # 工具类组件
2
+ ### 1. EventDispatcherJs.tsx
3
+ React里可供使用的事件派发器,类似Pandora Lua里的EventDispatcher。
4
+
5
+ 用法主要就3个接口:
6
+
7
+ * AddEventListener: 添加监听事件
8
+ * DispatchEvent: 分发监听事件
9
+ * RemoveEventListener: 移除监听事件
10
+
11
+ ### 2. Logger.tsx
12
+ React里可供使用的对象(数组)打印器。
13
+
14
+ 直接console.log一个对象时,在游戏引擎中,无法打印出这个对象里的东西。而实际开发时,前后端联调时,需要方便的确认各种对象里的细节。
15
+
16
+ 用法一共3个接口,打印粒度有差异。
17
+
18
+ * ObjectPrinter: 打印一个对象的内部细节,效果如下
19
+ ![](./img/logger.png)
20
+
21
+ * ObjectPrinter2:比上一个打印的信息更多
22
+ * HierarchyPrinter: 采样打印,对数组进行采样,能打印最多的信息
23
+ ### 3.MakeImage.js
24
+ React 里用于一键生成图集文件
25
+ 用法有2个命令:
26
+ * node MakeImage.js create path
27
+ * node MakeImage.js update path
28
+
29
+ (path: 一个文件夹的路径,可以按绝对路径写法,形如:/Users/zhengyanan/Desktop/work_git/LgameVideoGameTest/src/asset/Textures/VideoGame;也可以按相对当前位置的路径,形如../../LgameVideoGameTest/src/asset/Textures/VideoGame。)
30
+
31
+ 第一条命令是创建一个Images.tsx文件,可以直接代码中使用。如图:
32
+ ![](./img/makeImage.png)
33
+
34
+ 第二条命令是更新Images.tsx文件,用于增加图片的时候,更新Images.tsx。如上图所示,创建之后按上面的要求,只能改Images的key值(这个已足够满足需求,因为这个key值,代码中才可能用到)。使用update可以保留这些你的改动,无需重新改代码中的引用。如果没改动的话,那就无所谓,直接重新create即可。
35
+
36
+ ### 4. GenerateConstructorAndGeterSeter.js
37
+ 先定义好类的字段后,一键生成该类的构造函数,getter方法 和 setter方法。
38
+
39
+ 用法只有一个命令:
40
+
41
+ * node GenerateConstructorAndGeterSeter.js xxx.tsx 110
42
+
43
+ 其中,xxx.tsx指的是待生成的类文件;110是选项,3个bit位依次表示是否生成构造函数、setter、getter。
44
+
45
+
46
+ 例如,先定义好类的字段,如下:
47
+
48
+ ```
49
+ class RealTimeMatchInfo{
50
+ bo: number // 赛制bo1, bo3, bo5
51
+ location: string
52
+ round: number // 当前是第几场, 从1开始
53
+ matchId: number
54
+ seasonId: number
55
+ stageId: number
56
+ status: number // 状态 0: 未开始; 1: 进行中; 2: 已结束
57
+ teamA: number // 战队A id
58
+ teamAScore: number // 战队A 获胜的游戏单局数
59
+ teamB: number // 战队B id
60
+ teamBScore: number // 战队B 获胜的游戏单局数
61
+ winTeam: number // 系列赛胜利战队ID
62
+ }
63
+ ```
64
+
65
+ 然后执行 上述命令,即可自动生成构造函数 和 setter方法,生成的结果如下:
66
+
67
+ ```
68
+ class RealTimeMatchInfo{
69
+ bo: number // 赛制bo1, bo3, bo5
70
+ location: string
71
+ round: number // 当前是第几场, 从1开始
72
+ matchId: number
73
+ seasonId: number
74
+ stageId: number
75
+ status: number // 状态 0: 未开始; 1: 进行中; 2: 已结束
76
+ teamA: number // 战队A id
77
+ teamAScore: number // 战队A 获胜的游戏单局数
78
+ teamB: number // 战队B id
79
+ teamBScore: number // 战队B 获胜的游戏单局数
80
+ winTeam: number // 系列赛胜利战队ID
81
+
82
+ constructor(){
83
+ this.bo = -1
84
+ this.location = ""
85
+ this.round = -1
86
+ this.matchId = -1
87
+ this.seasonId = -1
88
+ this.stageId = -1
89
+ this.status = -1
90
+ this.teamA = -1
91
+ this.teamAScore = -1
92
+ this.teamB = -1
93
+ this.teamBScore = -1
94
+ this.winTeam = -1
95
+ }
96
+
97
+ setBo(bo: number){
98
+ this.bo = bo
99
+ }
100
+
101
+ setLocation(location: string){
102
+ this.location = location
103
+ }
104
+
105
+ setRound(round: number){
106
+ this.round = round
107
+ }
108
+
109
+ setMatchId(matchId: number){
110
+ this.matchId = matchId
111
+ }
112
+
113
+ setSeasonId(seasonId: number){
114
+ this.seasonId = seasonId
115
+ }
116
+
117
+ setStageId(stageId: number){
118
+ this.stageId = stageId
119
+ }
120
+
121
+ setStatus(status: number){
122
+ this.status = status
123
+ }
124
+
125
+ setTeamA(teamA: number){
126
+ this.teamA = teamA
127
+ }
128
+
129
+ setTeamAScore(teamAScore: number){
130
+ this.teamAScore = teamAScore
131
+ }
132
+
133
+ setTeamB(teamB: number){
134
+ this.teamB = teamB
135
+ }
136
+
137
+ setTeamBScore(teamBScore: number){
138
+ this.teamBScore = teamBScore
139
+ }
140
+
141
+ setWinTeam(winTeam: number){
142
+ this.winTeam = winTeam
143
+ }
144
+ }
145
+ ```