-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCommonlyParts.lua
211 lines (171 loc) · 7.83 KB
/
CommonlyParts.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
CL:Log("加载部件")
--#region 通用函数
function OnCloseBtn(_Handle)
GUI:WndClose(GUI:WndGetParentM(_Handle))
end
function GetBracket(str)
return SetStyleColor("【", "绿") .. str .. SetStyleColor("】", "绿")
end
--#endregion
--#region 窗口
function NewWnd(Parent, Name, Img, PosX, PosY)
return Wnd:Create(Parent, Name, Img, PosX, PosY)
end
function NewMainWnd(Parent, Name, Img, PosX, PosY)
return Wnd:CreateMainWnd(Parent, Name, Img, PosX, PosY)
end
--#endregion
--#region 按钮
---新建按钮控件
---@param Parent Parent
---@param Name string
---@param Img int
---@param PosX int
---@param PosY int
---@return Button
function NewButton(Parent, Name, Img, PosX, PosY)
return Button:Create(Parent, Name, Img, PosX, PosY)
end
---新建关闭按钮控件
---@param Parent Parent
---@param Img int
---@param PosX int
---@param PosY int
---@return Button
function NewClose(Parent, Img, PosX, PosY)
local btn1 = Button:Create(Parent, "CloseBtn", Img, PosX, PosY)
btn1:AddRe(RDWndBaseCL_mouse_lbClick, "OnCloseBtn")
return btn1
end
--#endregion
--#region 物品框
---创建物品框
---@param Parent Parent
---@param Name string
---@param ImgID int?
---@param _PosX int?
---@param _PosY int?
---@param _SizeX int?
---@param _SizeY int?
---@return ItemCtrl
function NewItem(Parent, Name, ImgID, _PosX, _PosY, _SizeX, _SizeY)
return ItemCtrl:Create(Parent, Name, ImgID, _PosX, _PosY, _SizeX, _SizeY)
end
--#endregion
--#region 编辑框
--#region 回调函数
function DoubleLBClick(_Handle)
GUI:EditSetSelectPos(_Handle, 0)
GUI:EditSetCurSorPos(_Handle, 100)
end
function EditChangeStr(_Handle)
CL:Log("" .. GUI:EditGetTextM(_Handle))
end
--#endregion
function NewEdit(Parent, Name, PosX, PosY, SizeX, SizeY)
return Edit:New { Parent = Parent, Name = Name, PosX = PosX, PosY = PosY, SizeX = SizeX, SizeY = SizeY }
end
function NewInput(Parent, Name, PosX, PosY, SizeX, SizeY)
local Img1 = NewImg(Parent, Name, 0, PosX, PosY)
Img1:SetWndSize(SizeX, SizeY)
GUI:ImageSetAroundImage(Img1:GetHandle(), 1900510026, 1900510027, 1900510028, 1900510029, 1900510031, 1900510030,
1900510032, 1900510033, 1900510034)
local edit1 = NewEdit(Img1, "Input", 5, 5, SizeX ~= nil and SizeX - 10 or nil, SizeY ~= nil and SizeY - 10 or nil)
edit1:AddRe(RDWndBaseCL_mouse_lbDbClick, "DoubleLBClick")
edit1:AddRe(RDWnd2DEditCL_str_change, "EditChangeStr")
return { Img1, edit1 }
end
function NewEditStatic(Parent, Name, PosX, PosY, SizeX, SizeY)
return Edit:NewStatic { Parent = Parent, Name = Name, PosX = PosX, PosY = PosY, SizeX = SizeX, SizeY = SizeY }
end
--#endregion
--#region 富文本框
function NewRichEdit(Parent, Name, PosX, PosY, SizeX, SizeY)
return RichEdit:New { Parent = Parent, Name = Name, PosX = PosX, PosY = PosY, SizeX = SizeX, SizeY = SizeY }
end
function NewRichEditStatic(Parent, Name, PosX, PosY, SizeX, SizeY)
return RichEdit:NewStatic { Parent = Parent, Name = Name, PosX = PosX, PosY = PosY, SizeX = SizeX, SizeY = SizeY }
end
--#endregion
--#region 新建图片组件
function NewImg(Parent, Name, Img, PosX, PosY)
return Image:Create(Parent, Name, Img, PosX, PosY)
end
--- 新建标题
function NewImg1(Parent, Name, Img, PosX, PosY)
local Img1 = Image:New { Parent = Parent, Name = "TitleBack" .. ((Name ~= "" or Name ~= nil) and Name or ""), PosX = PosX, PosY = PosY, ImgID = 0 }
local Img1Sub1 = Image:New { Parent = Img1, Name = "111", ImgID = 1650000214, PosY = 5 }
local Img1Sub2 = Image:New { Parent = Img1, Name = "222", ImgID = 1650000218, }
local Img1Sub3 = Image:Create(Img1, "333", Img, 214 / 2, 17)
Img1Sub3.IsCenter = true
local Img1Sub3 = Image:New { Parent = Img1, Name = "444", ImgID = 1650000221, PosX = 136 + 7, PosY = 14 }
Img1Sub3:SetTransfrom(8000, 8000, 0)
local Img1Sub4 = Image:New { Parent = Img1, Name = "555", ImgID = 1650000221, PosX = 6, PosY = 14 }
Img1Sub4:SetTransfrom(8000, 8000, 0)
Img1Sub4:SetFlip(true, false)
local Img1Sub5 = Image:New { Parent = Img1, Name = "666" }
local Img1Sub6 = Image:New { Parent = Img1, Name = "777", ImgID = 1650000342, PosX = 0, PosY = 32 }
Img1Sub6:SetTransfrom(9000, 10000, 0)
return Img1
end
-- 标题背景
function NewImg2(Parent, Name, Img, PosX, PosY, SizeX, SizeY)
local Img1 = Image:Create(Parent, "TitleBackAr" .. ((Name ~= "" or Name ~= nil) and Name or ""), 0, PosX, PosY)
Img1:SetWndSize(SizeX, SizeY)
Img1:SetAroundImageEx(1650100100)
return Img1
end
-- 新建黑白相间列表
function NewImg3(Parent, Name, PosX, PosY, Num)
local wnd1 = Wnd:Create(Parent, Name, 0, PosX, PosY)
for i = 1, Num do
local Img = Image:Create(wnd1, Name .. i, 1650000373, 0, (i - 1) * 52)
end
return wnd1
end
-- 新建标题
function NewImg4(Parent, Name, Img, PosX, PosY)
local Img1 = Image:New { Parent = Parent, Name = "TitleSub" .. ((Name ~= "" or Name ~= nil) and Name or ""), ImgID = Img, PosX = PosX, PosY = PosY }
local Img4Sub1 = Image:New { Parent = Img1, Name = "111", ImgID = 1650000088, PosX = 29, PosY = 0 }
Img4Sub1:SetTransfrom(8000, 8000, 0)
Img4Sub1:SetFlip(true, false)
local Img4Sub2 = Image:New { Parent = Img1, Name = "222", ImgID = 1650000088, PosX = -72, PosY = 0 }
Img4Sub2:SetTransfrom(8000, 8000, 0)
return Img1
end
--- 新建右侧背景
function NewImg5(Parent, Name, Img, PosX, PosY)
local RightImgBack = Image:New { Parent = Parent, Name = "TitleAndBack" .. ((Name ~= "" or Name ~= nil) and Name or ""), PosX = PosX, PosY = PosY, ImgID = 1650000217 }
local Img3Sub1 = Image:New { Parent = RightImgBack, Name = "111", ImgID = 1650000214, PosY = 5 }
local Img3Sub2 = Image:New { Parent = RightImgBack, Name = "222", ImgID = 1650000218, }
local Img3Sub2 = Image:New { Parent = RightImgBack, Name = "333", ImgID = Img, PosX = 111, PosY = 19 }
Img3Sub2.IsCenter = true
local Img3Sub3 = Image:New { Parent = RightImgBack, Name = "444", ImgID = 1650000221, PosX = 136 + 7, PosY = 14 }
Img3Sub3:SetTransfrom(8000, 8000, 0)
local Img3Sub4 = Image:New { Parent = RightImgBack, Name = "555", ImgID = 1650000221, PosX = 6 + 7, PosY = 14 }
Img3Sub4:SetTransfrom(8000, 8000, 0)
Img3Sub4:SetFlip(true, false)
local Img1Sub5 = Image:New { Parent = RightImgBack, Name = "666" }
local Img1Sub6 = Image:New { Parent = RightImgBack, Name = "777", ImgID = 1650000342, PosX = 0, PosY = 32 }
Img1Sub6:SetTransfrom(9000, 10000, 0)
return RightImgBack
end
--- 新建右侧背景
function NewImg6(Parent, Name, Img, PosX, PosY, RectEndX, RectEndY)
local RightImgBack = Image:New { Parent = Parent, Name = "TitleAndBack" .. ((Name ~= "" or Name ~= nil) and Name or ""), PosX = PosX, PosY = PosY, ImgID = 1660300001 }
RightImgBack:SetDrawRect(0, RectEndX or 1, 0, RectEndY or 1)
local Img3Sub1 = Image:New { Parent = RightImgBack, Name = "111", ImgID = 1650000214, PosY = 5 }
local Img3Sub2 = Image:New { Parent = RightImgBack, Name = "222", ImgID = 1650000218, }
local Img3Sub2 = Image:New { Parent = RightImgBack, Name = "333", ImgID = Img, PosX = 111, PosY = 19 }
Img3Sub2.IsCenter = true
local Img3Sub3 = Image:New { Parent = RightImgBack, Name = "444", ImgID = 1650000221, PosX = 136 + 7, PosY = 14 }
Img3Sub3:SetTransfrom(8000, 8000, 0)
local Img3Sub4 = Image:New { Parent = RightImgBack, Name = "555", ImgID = 1650000221, PosX = 6 + 7, PosY = 14 }
Img3Sub4:SetTransfrom(8000, 8000, 0)
Img3Sub4:SetFlip(true, false)
local Img1Sub5 = Image:New { Parent = RightImgBack, Name = "666" }
local Img1Sub6 = Image:New { Parent = RightImgBack, Name = "777", ImgID = 1650000342, PosX = 0, PosY = 32 }
Img1Sub6:SetTransfrom(9000, 10000, 0)
return RightImgBack
end
--#endregion