纯知识普及贴。
服务端:
元宝商店的定义,是在服务端定义的,而是在客户端通过事件来触发的。客户端的shoptable.txt文件不重要,纵然你的内容是错的,依然不会影响你的游戏与显示,所以,补丁,完全可以放弃这个文件的修改与替换。
我们需要做的,就是在服务端定义元宝商店的八大块,与八大块里面的几小店。如此而已。
Public/Data/Script/event/prizi/yuanbaoshop.lua
内容对应如下:
2012-6-16 19:38:05 上传
每种类型的元宝商店,可以定义15个大类,每个大类下可以有八个条目清单。
15大类:大卖场、宝石商城、珍兽秘籍、南北奇货、形象广场、花舞人间、武功秘籍、打造图、我要更*******
8个条目清单一眼就看出来了,这8个内容定义在服务端shoptable.txt中的,与客户端没有任何的关系。不信你试试看。
其中
1. function x888902_OpenYuanbaoShop(sceneId, selfId, targetId , shopA ,shopB ) 2. 3. local bCheck = x888902_YuanbaoShopCheckOp(sceneId,selfId); 4. 5. ifbCheck > 0 then 6. if shopA > 0 and shopA < 200 andx888902_g_shoplist[shopA][shopB] ~= nil then --200是因为定义了第二个商店 7. iftargetId == -1 then 8. DispatchYuanbaoShopItem( sceneId, selfId,x888902_g_shoplist[shopA][shopB]) 9. else 10. DispatchNpcYuanbaoShopItem( sceneId, selfId,targetId , x888902_g_shoplist[shopA][shopB]) 11. end 12. end 13. end 14. end 复制代码 如此一来,服务端定义完毕,你会觉得为什么会显示不出来?很简单,服务端显示什么东西调用什么资源是在客户端定义的。
现在就要来定义客户端了 客户端:
Interface/yuanbaoshop/yuanbaoshop.lua文件
我自己能理解,但又不知道你们能不能理解。 1. local GOODS_BUTTONS_NUM = 18; 2. local GOODS_BUTTONS = {}; 3. local GOODS_DESCS = {}; 4. local GOOD_BAD = {}; 5. 6. --标签页索引值 7. local ShopTabIdx = { 8. YuanBao = 0, --元宝商店 9. Bind = 1, --绑定元宝商店 10. GiftToken = 2, --返券商店 11. IMDress = 3, 12. } 13.
14. 此线至下一处横线处可以不用管 15. local SHOP_LIST_A = {}; --大类 16. local SHOP_LIST_B = {}; --条目清单 17. local SHOP_SEARCH_LIST ={};--搜索商店条目 18. 19. local SHOP_LIST_A_BIND = {};--绑定元宝商店大类 20. local SHOP_LIST_B_BIND = {};--绑定元宝商店条目清单 21. local SHOP_SEARCH_LIST_BIND ={};--绑定元宝搜索商店 22. 23. local SHOP_LIST_A_GIFTTOKEN = {}; --货币类型下的一级菜单 如 大卖场 宝石商城等 24. local SHOP_LIST_B_GIFTTOKEN = {}; --货币类型下的二级菜单 如 新品上架 等 25. local SHOP_SEARCH_LIST_GIFTTOKEN={}; --搜索菜单 26. 27. local nPageNum = 1; 28. local maxPage = 1; 29. local objCared = -1; 30. local lastA = 0 31. local lastB = 0 32. local lastA_Bind = 0 33. local lastB_Bind = 0 34. local lastSelect = 0 35. local lastSelect_Bind = 0 36. 37. local lastA_GiftToken = 0 38. local lastB_GiftToken = 0 39. local lastSelect_GiftToken = 0 40. 41. local maxChildShop = 8 42. local isCareObj = 0 43. 44. --存储随机排序的索引值 45. local g_tOrderPool = {}; 46. --当前商店的商品数量 47. local g_nTotalNum = 0; 48. 49. local g_changeTabFlag = 0; 50. local g_tabIndex = 0; -- 0表示元宝 --1表示绑定元宝 51. local g_jumpToShopTabIndex = 0;--从炫装商店转跳回其他商店时,用这个来记录转跳到哪个商店 52. 53. localg_YuanbaoShop_Frame_UnifiedXPosition; 54. local g_YuanbaoShop_Frame_UnifiedYPosition; 55. local g_IsEnableFanQuanShop = 1 --关闭返券商店功能的开关,在YuanBaoShop、XuanShop界面中有这个开关,必须保持一致 56. 57. local g_Last_tabIndex = 0; 58. 59. function YuanbaoShop_PreLoad() 60. 61. this:RegisterEvent("OPEN_YUANBAOSHOP"); 62. this:RegisterEvent("PLAYER_ENTERING_WORLD"); 63. this:RegisterEvent("UPDATE_BOOTH"); 64. this:RegisterEvent("OBJECT_CARED_EVENT"); 65. this:RegisterEvent("CLOSE_BOOTH"); 66. this:RegisterEvent("PLAYER_LEAVE_WORLD"); 67. this:RegisterEvent("TOGGLE_YUANBAOSHOP"); 68. this:RegisterEvent("UPDATE_YUANBAO"); 69. this:RegisterEvent("UPDATE_BIND_YUANBAO"); 70. this:RegisterEvent("UPDATE_GIFTTOKEN"); 71. this:RegisterEvent("UI_COMMAND"); 72. this:RegisterEvent("ADJEST_UI_POS") 73. this:RegisterEvent("VIEW_RESOLUTION_CHANGED") 74. end 75. 76. function YuanbaoShop_OnLoad() 77. GOODS_BUTTONS[1] = YuanbaoShop_Item1; 78. GOODS_BUTTONS[2] = YuanbaoShop_Item2; 79. GOODS_BUTTONS[3] = YuanbaoShop_Item3; 80. GOODS_BUTTONS[4] = YuanbaoShop_Item4; 81. GOODS_BUTTONS[5] = YuanbaoShop_Item5; 82. GOODS_BUTTONS[6] = YuanbaoShop_Item6; 83. GOODS_BUTTONS[7] = YuanbaoShop_Item7; 84. GOODS_BUTTONS[8] = YuanbaoShop_Item8; 85. GOODS_BUTTONS[9] = YuanbaoShop_Item9; 86. GOODS_BUTTONS[10]=YuanbaoShop_Item10; 87. GOODS_BUTTONS[11]= YuanbaoShop_Item11; 88. GOODS_BUTTONS[12]= YuanbaoShop_Item12; 89. GOODS_BUTTONS[13]= YuanbaoShop_Item13; 90. GOODS_BUTTONS[14]= YuanbaoShop_Item14; 91. GOODS_BUTTONS[15]= YuanbaoShop_Item15; 92. GOODS_BUTTONS[16]= YuanbaoShop_Item16; 93. GOODS_BUTTONS[17]= YuanbaoShop_Item17; 94. GOODS_BUTTONS[18]= YuanbaoShop_Item18; 95. 96. GOODS_DESCS[1] = YuanbaoShop_ItemInfo1_Text; 97. GOODS_DESCS[2] = YuanbaoShop_ItemInfo2_Text; 98. GOODS_DESCS[3] = YuanbaoShop_ItemInfo3_Text; 99. GOODS_DESCS[4] = YuanbaoShop_ItemInfo4_Text; 100. GOODS_DESCS[5] = YuanbaoShop_ItemInfo5_Text; 101. GOODS_DESCS[6] = YuanbaoShop_ItemInfo6_Text; 102. GOODS_DESCS[7] = YuanbaoShop_ItemInfo7_Text; 103. GOODS_DESCS[8] = YuanbaoShop_ItemInfo8_Text; 104. GOODS_DESCS[9] = YuanbaoShop_ItemInfo9_Text; 105. GOODS_DESCS[10]= YuanbaoShop_ItemInfo10_Text; 106. GOODS_DESCS[11]= YuanbaoShop_ItemInfo11_Text; 107. GOODS_DESCS[12]= YuanbaoShop_ItemInfo12_Text; 108. GOODS_DESCS[13]= YuanbaoShop_ItemInfo13_Text; 109. GOODS_DESCS[14]= YuanbaoShop_ItemInfo14_Text; 110. GOODS_DESCS[15]= YuanbaoShop_ItemInfo15_Text; 111. GOODS_DESCS[16]= YuanbaoShop_ItemInfo16_Text; 112. GOODS_DESCS[17]= YuanbaoShop_ItemInfo17_Text; 113. GOODS_DESCS[18]= YuanbaoShop_ItemInfo18_Text; 114. 115. GOOD_BAD[1] = YuanbaoShop_ItemInfo1_GB; 116. GOOD_BAD[2] = YuanbaoShop_ItemInfo2_GB; 117. GOOD_BAD[3] = YuanbaoShop_ItemInfo3_GB; 118. GOOD_BAD[4] = YuanbaoShop_ItemInfo4_GB; 119. GOOD_BAD[5] = YuanbaoShop_ItemInfo5_GB; 120. GOOD_BAD[6] = YuanbaoShop_ItemInfo6_GB; 121. GOOD_BAD[7] = YuanbaoShop_ItemInfo7_GB; 122. GOOD_BAD[8] = YuanbaoShop_ItemInfo8_GB; 123. GOOD_BAD[9] = YuanbaoShop_ItemInfo9_GB; 124. GOOD_BAD[10]= YuanbaoShop_ItemInfo10_GB; 125. GOOD_BAD[11]= YuanbaoShop_ItemInfo11_GB; 126. GOOD_BAD[12]= YuanbaoShop_ItemInfo12_GB; 127. GOOD_BAD[13]= YuanbaoShop_ItemInfo13_GB; 128. GOOD_BAD[14]= YuanbaoShop_ItemInfo14_GB; 129. GOOD_BAD[15]= YuanbaoShop_ItemInfo15_GB; 130. GOOD_BAD[16]= YuanbaoShop_ItemInfo16_GB; 131. GOOD_BAD[17]= YuanbaoShop_ItemInfo17_GB; 132. GOOD_BAD[18]= YuanbaoShop_ItemInfo18_GB; 133.
134. --大卖场 135. SHOP_LIST_A[1] = {btn = YuanbaoShop_Button1 , shoplist = {}} -- 定义了触发按钮 明白了否? 136. SHOP_LIST_A[1].shoplist[1] = "#{YBSD_081225_019}" ;--对应服务端的x888902_g_shoplist[1] = {188, 189, 208, 216, 215, 217, 218}只能七个 137. SHOP_LIST_A[1].shoplist[2]= "#{YBSD_081225_020}" ;--如上,与客户端对应 138. SHOP_LIST_A[1].shoplist[3] = "神器商店" ; 139. SHOP_LIST_A[1].shoplist[4] = "最新书籍" ; 140. SHOP_LIST_A[1].shoplist[5] = "特色商品" ; 141. SHOP_LIST_A[1].shoplist[6] = "坐骑一店" ; 142. SHOP_LIST_A[1].shoplist[7]= "坐骑二店" ; 143. --SHOP_LIST_A[1].shoplist[8] = "坐骑二店" ; 144. 145. --宝石商城 146. SHOP_LIST_A[2] = {btn = YuanbaoShop_Button2 , shoplist = {}} 147. SHOP_LIST_A[2].shoplist[1] = "#{YBSD_081225_022}" --开启"大理宝石斋"; czf, 2009.07.21 148. SHOP_LIST_A[2].shoplist[2] = "#{YBSD_081225_023}" ; 149. SHOP_LIST_A[2].shoplist[3] = "#{YBSD_081225_024}" ; 150. SHOP_LIST_A[2].shoplist[4] = "#{YBSD_081225_025}" ; 151. SHOP_LIST_A[2].shoplist[5] = "#{YBSD_081225_026}" ; 152. SHOP_LIST_A[2].shoplist[6] = "高级宝石" ; 153. SHOP_LIST_A[2].shoplist[7] = "低级材料" ; 154. SHOP_LIST_A[2].shoplist[8] = "高级材料" ; 155. 156. --珍兽商城 157. SHOP_LIST_A[3] = {btn = YuanbaoShop_Button3 , shoplist = {}} 158. SHOP_LIST_A[3].shoplist[1] = "#{YBSD_081225_027}" ; 159. SHOP_LIST_A[3].shoplist[2] = "#{YBSD_081225_028}" ; 160. SHOP_LIST_A[3].shoplist[3] = "#{YBSD_081225_029}" ; 161. SHOP_LIST_A[3].shoplist[4] = "#{YBSD_081225_030}" ; 162. --南北杂货 163. SHOP_LIST_A[4]= {btn = YuanbaoShop_Button4 , shoplist = {}} 164. SHOP_LIST_A[4].shoplist[1] = "#{YBSD_081225_091}" ; 165. SHOP_LIST_A[4].shoplist[2] = "#{YBSD_081225_031}" ; 166. SHOP_LIST_A[4].shoplist[3] = "#{YBSD_081225_032}" ; 167. 168. --形象广场 169. SHOP_LIST_A[5] = {btn = YuanbaoShop_Button5 , shoplist = {}} 170. SHOP_LIST_A[5].shoplist[1] = "#{YBSD_081225_033}" ; 171. SHOP_LIST_A[5].shoplist[2] = "巴黎时装店" ; 172. SHOP_LIST_A[5].shoplist[3] = "染色时装" ; 173. --SHOP_LIST_A[5].shoplist[3]= "#{YBSD_081225_034}" ; 174. SHOP_LIST_A[5].shoplist[4] = "#{YBSD_081225_035}" ; 175. SHOP_LIST_A[5].shoplist[5] = "#{YBSD_081225_036}" ; 176. SHOP_LIST_A[5].shoplist[6] = "#{YBSD_081225_037}" ; 177. SHOP_LIST_A[5].shoplist[7] = "门派坐骑" ; 178. 179. --花舞人间 180. SHOP_LIST_A[6] = {btn = YuanbaoShop_Button6 , shoplist = {}} 181. SHOP_LIST_A[6].shoplist[1] = "#{YBSD_081225_038}" ; 182. SHOP_LIST_A[6].shoplist[2] = "#{YBSD_081225_039}" ; 183. SHOP_LIST_A[6].shoplist[3] = "#{YBSD_081225_040}" ; 184. SHOP_LIST_A[6].shoplist[4] = "#{YBSD_081225_041}" ; 185. 186. --武功秘籍 187. SHOP_LIST_A[7] = {btn = YuanbaoShop_Button7 , shoplist = {}} 188. SHOP_LIST_A[7].shoplist[1] = "#{YBSD_081225_042}" ; 189. --打造图 190. SHOP_LIST_A[8] = {btn = YuanbaoShop_Button8 , shoplist = {}} 191. SHOP_LIST_A[8].shoplist[1] = "#{YBSD_081225_043}" ; 192. SHOP_LIST_A[8].shoplist[2] = "#{YBSD_081225_044}" ; 193. SHOP_LIST_A[8].shoplist[3] = "#{YBSD_081225_045}" ; 194. SHOP_LIST_A[8].shoplist[4] = "#{YBSD_081225_096}" ; 195. SHOP_LIST_A[8].shoplist[5] = "#{YBSD_081225_046}" ; 196. SHOP_LIST_A[8].shoplist[6] = "#{YBSD_081225_047}" ; 197. SHOP_LIST_A[8].shoplist[7]= "#{YBSD_081225_048}" ; 198. SHOP_LIST_A[8].shoplist[8] = "#{YBSD_081225_049}" ; 199. --二级商店 200. SHOP_LIST_B[1] = YuanbaoShop_Button01 201. SHOP_LIST_B[2] = YuanbaoShop_Button02 202. SHOP_LIST_B[3] = YuanbaoShop_Button03 203. SHOP_LIST_B[4] = YuanbaoShop_Button04 204. SHOP_LIST_B[5] = YuanbaoShop_Button05 205. SHOP_LIST_B[6] = YuanbaoShop_Button06 206. SHOP_LIST_B[7] = YuanbaoShop_Button07 207. SHOP_LIST_B[8] = YuanbaoShop_Button08 208. 209. 210. if lastA ~=nil and lastA > 0 and lastA < 9 then 211. SHOP_LIST_A[lastA].btn:SetCheck(1) 212. end 213. 214. if lastB ~=nil and lastB > 0 and lastB < 9 then 215. SHOP_LIST_B[lastB]:SetCheck(1) 216. end 217. 218. for i =1 ,8do 219. SHOP_LIST_B:Hide() 220. end 221. 222. 223. --我要更强大 224. SHOP_SEARCH_LIST[1] = {} 225. SHOP_SEARCH_LIST[1][1] = "#{YBSD_081225_023}" ; 226. SHOP_SEARCH_LIST[1][2] = "#{YBSD_081225_024}" ; 227. SHOP_SEARCH_LIST[1][3] = "#{YBSD_081225_025}" ; 228. SHOP_SEARCH_LIST[1][4] = "#{YBSD_081225_027}" ; 229. SHOP_SEARCH_LIST[1][5] = "#{YBSD_081225_091}" ; 230. --我要更有魅力 231. SHOP_SEARCH_LIST[2] = {} 232. SHOP_SEARCH_LIST[2][1] = "#{YBSD_081225_037}" ; 233. SHOP_SEARCH_LIST[2][2] = "#{YBSD_XML_1}"--久久时装店 234. SHOP_SEARCH_LIST[2][3] = "#{YBSD_XML_2}"--时尚时装店 235. SHOP_SEARCH_LIST[2][4] = "#{YBSD_081225_034}" ; 236. SHOP_SEARCH_LIST[2][5] = "#{YBSD_081225_035}" ; 237. SHOP_SEARCH_LIST[2][6] = "#{YBSD_081225_036}" ; 238. --我要打造极品装备 239. SHOP_SEARCH_LIST[3] = {} 240. -- SHOP_SEARCH_LIST[3][1] = "#{YBSD_081225_022}" ; 241. SHOP_SEARCH_LIST[3][1] = "#{YBSD_081225_023}" ; 242. SHOP_SEARCH_LIST[3][2] = "#{YBSD_081225_024}" ; 243. SHOP_SEARCH_LIST[3][3]= "#{YBSD_081225_026}" ; 244. SHOP_SEARCH_LIST[3][4] = "#{YBSD_XML_3}" ; 245. SHOP_SEARCH_LIST[3][5] = "#{YBSD_081225_031}" ; 246. --我要打造极品珍兽 247. SHOP_SEARCH_LIST[4] = {} 248. SHOP_SEARCH_LIST[4][1] = "#{YBSD_081225_027}" ; 249. SHOP_SEARCH_LIST[4][2] = "#{YBSD_081225_028}" ; 250. SHOP_SEARCH_LIST[4][3] = "#{YBSD_081225_029}" ; 251. SHOP_SEARCH_LIST[4][4] = "#{YBSD_081225_030}" ; 252. 253. --我要移动的更快 254. SHOP_SEARCH_LIST[5]= {} 255. SHOP_SEARCH_LIST[5][1] = "#{YBSD_081225_037}" ; 256. SHOP_SEARCH_LIST[5][2] = "#{YBSD_081225_032}" ; 257. --我要向别人表白 258. SHOP_SEARCH_LIST[6] = {} 259. SHOP_SEARCH_LIST[6][1] = "#{YBSD_081225_039}" ; 260. SHOP_SEARCH_LIST[6][2] = "#{YBSD_081225_040}" ; 261. SHOP_SEARCH_LIST[6][3] = "#{YBSD_081225_041}" ; 262. SHOP_SEARCH_LIST[6][4] = "#{YBSD_XML_1}"--久久时装店 263. SHOP_SEARCH_LIST[6][5] = "#{YBSD_XML_2}"--时尚时装店 264. SHOP_SEARCH_LIST[6][6]= "#{YBSD_081225_037}" ; 265. --我要学习新技能 266. SHOP_SEARCH_LIST[7] = {} 267. SHOP_SEARCH_LIST[7][1] = "#{YBSD_081225_042}" ; 268. SHOP_SEARCH_LIST[7][2] = "#{YBSD_XML_4}" ; 269. SHOP_SEARCH_LIST[7][3] = "#{YBSD_081225_028}" ; 270. SHOP_SEARCH_LIST[7][4] = "#{YBSD_081225_029}" ; 271. --最近购买 272. SHOP_SEARCH_LIST[8] = {} 273. SHOP_SEARCH_LIST[8][1] = "#{YBSD_xml_XX(01)}" ; 274. 275. 276. --YuanbaoShop_SearchMode:AddTextItem("#{YBSD_081225_055}" ,1) --我要更强大 277. --YuanbaoShop_SearchMode:AddTextItem("#{YBSD_081225_056}" ,2) --"我要更有魅力" 278. --YuanbaoShop_SearchMode:AddTextItem("#{YBSD_081225_057}" ,3) --"我要打造极品装备" 279. --YuanbaoShop_SearchMode:AddTextItem("#{YBSD_081225_058}",4) --"我要打造极品珍兽" 280. --YuanbaoShop_SearchMode:AddTextItem("#{YBSD_081225_059}",5) --"我要移动的更快" 281. --YuanbaoShop_SearchMode:AddTextItem("#{YBSD_081225_060}",6) --"我要向别人表白" 282. --YuanbaoShop_SearchMode:AddTextItem("#{YBSD_081225_061}",7) --"我要学习新技能" 283. --YuanbaoShop_SearchMode:AddTextItem("#{YBSD_xml_XX(02)}",8) --"查看最近购买的商品" 284. 285. 286. -- 绑定元宝商城 --大买场 287. SHOP_LIST_A_BIND[1] = {btn = YuanbaoShop_Button1_Bind ,shoplist = {}} 288. SHOP_LIST_A_BIND[1].shoplist[1]= "雷霆套" ; 289. SHOP_LIST_A_BIND[1].shoplist[2] = "通天套" ; 290. SHOP_LIST_A_BIND[1].shoplist[3] = "星辰套" ; 291. SHOP_LIST_A_BIND[1].shoplist[4] = "超级大杀器" ; 292. SHOP_LIST_A_BIND[1].shoplist[5]= "超强石头" ; 293. SHOP_LIST_A_BIND[1].shoplist[6] = "特色宝宝" ; 294. SHOP_LIST_A_BIND[1].shoplist[7] = "特技-待开放" ; 295. 296. 297. --宝石商城 298. SHOP_LIST_A_BIND[2] = {btn = YuanbaoShop_Button2_Bind , shoplist = {}} 299. --SHOP_LIST_A_BIND[2].shoplist[1] = "#{YBSD_081225_022}" ; 300. --SHOP_LIST_A_BIND[2].shoplist[1] = "#{YBSD_081225_023}" ; 301. --SHOP_LIST_A_BIND[2].shoplist[2] = "#{YBSD_081225_024}" ; 302. --SHOP_LIST_A_BIND[2].shoplist[3] = "#{YBSD_081225_025}" ; 303. SHOP_LIST_A_BIND[2].shoplist[1] = "八级宝石" ; 304. SHOP_LIST_A_BIND[2].shoplist[2] = "顶级宝石" ; 305. --SHOP_LIST_A_BIND[2].shoplist[3] = "高级材料" ; 306. 307. --珍兽商城 308. SHOP_LIST_A_BIND[3] = {btn = YuanbaoShop_Button3_Bind , shoplist = {}} 309. --SHOP_LIST_A_BIND[3].shoplist[1] = "#{YBSD_081225_027}" ; 310. --SHOP_LIST_A_BIND[3].shoplist[2] = "#{YBSD_081225_028}" ; 311. --SHOP_LIST_A_BIND[3].shoplist[3] = "#{YBSD_081225_029}" ; 312. SHOP_LIST_A_BIND[3].shoplist[1]= "拉风宝宝" ; 313. 314. 315. --绝世坐骑 316. SHOP_LIST_A_BIND[4] = {btn = YuanbaoShop_Button4_Bind , shoplist = {}} 317. --SHOP_LIST_A_BIND[4].shoplist[1] = "至尊时装" ; 318. --SHOP_LIST_A_BIND[4].shoplist[2] = "绝世坐骑" ; 319. --SHOP_LIST_A_BIND[4].shoplist[3] = "骑术学习" ; 320. 321. --我要变强 322. SHOP_LIST_A_BIND[5] = {btn = YuanbaoShop_Button5_Bind , shoplist = {}} 323. SHOP_LIST_A_BIND[5].shoplist[1] = "进阶武功" ; 324. --SHOP_LIST_A_BIND[5].shoplist[2] = "终极技能" ; 325. SHOP_LIST_A_BIND[5].shoplist[2] = "暗器武魂" ; 326. SHOP_LIST_A_BIND[5].shoplist[3] = "打架斗殴" ; 327. 328. --花舞人间 329. SHOP_LIST_A_BIND[6] = {btn = YuanbaoShop_Button6_Bind , shoplist = {}} 330. SHOP_LIST_A_BIND[6].shoplist[1] = "传统烟花" ; 331. SHOP_LIST_A_BIND[6].shoplist[2] = "个性烟花" ; 332. SHOP_LIST_A_BIND[6].shoplist[3] = "节日烟花" ; 333. SHOP_LIST_A_BIND[6].shoplist[4]= "场景烟花" ; 334. SHOP_LIST_A_BIND[6].shoplist[5] = "春城百花" ; 335. 336. -- 337. SHOP_LIST_A_BIND[7] = {btn = YuanbaoShop_Button7_Bind , shoplist = {}} 338. SHOP_LIST_A_BIND[7].shoplist[1] = "终极技能" ; 339. 340. -- 341. SHOP_LIST_A_BIND[8] = {btn = YuanbaoShop_Button8_Bind , shoplist = {}} 342. SHOP_LIST_A_BIND[8].shoplist[1] = "#{YBSD_081225_043}" ; 343. SHOP_LIST_A_BIND[8].shoplist[2] = "#{YBSD_081225_044}" ; 344. SHOP_LIST_A_BIND[8].shoplist[3] = "#{YBSD_081225_045}" ; 345. SHOP_LIST_A_BIND[8].shoplist[4] = "#{YBSD_081225_096}" ; 346. SHOP_LIST_A_BIND[8].shoplist[5] = "#{YBSD_081225_046}" ; 347. SHOP_LIST_A_BIND[8].shoplist[6] = "#{YBSD_081225_047}" ; 348. SHOP_LIST_A_BIND[8].shoplist[7] = "#{YBSD_081225_048}" ; 349. SHOP_LIST_A_BIND[8].shoplist[8] = "#{YBSD_081225_049}" ; 350. 351. --二级商店 352. SHOP_LIST_B_BIND[1] = YuanbaoShop_Button01_Bind 353. SHOP_LIST_B_BIND[2] = YuanbaoShop_Button02_Bind 354. SHOP_LIST_B_BIND[3] = YuanbaoShop_Button03_Bind 355. SHOP_LIST_B_BIND[4] = YuanbaoShop_Button04_Bind 356. SHOP_LIST_B_BIND[5] = YuanbaoShop_Button05_Bind 357. SHOP_LIST_B_BIND[6] = YuanbaoShop_Button06_Bind 358. SHOP_LIST_B_BIND[7] = YuanbaoShop_Button07_Bind 359. SHOP_LIST_B_BIND[8] = YuanbaoShop_Button08_Bind 360. 361. 362. iflastA_Bind ~= nil and lastA_Bind > 0 and lastA_Bind < 9 then 363. SHOP_LIST_A_BIND[ lastA_Bind ].btn : SetCheck(1) 364. end 365. 366. iflastB_Bind ~= nil and lastB_Bind > 0 and lastB_Bind < 9 then 367. SHOP_LIST_B_BIND[ lastB_Bind ] : SetCheck(1) 368. end 369. 370. for i =1 ,8do 371. SHOP_LIST_B_BIND:Hide() 372. end 373. 374. -- 375. SHOP_SEARCH_LIST_BIND[1] = {} 376. SHOP_SEARCH_LIST_BIND[1][1] = "BindSearch1" ; 377. SHOP_SEARCH_LIST_BIND[1][2] = "BindSearch1" ; 378. SHOP_SEARCH_LIST_BIND[1][3] = "BindSearch1" ; 379. SHOP_SEARCH_LIST_BIND[1][4] = "BindSearch1" ; 380. SHOP_SEARCH_LIST_BIND[1][5] = "BindSearch1" ; 381. -- 382. SHOP_SEARCH_LIST_BIND[2] = {} 383. SHOP_SEARCH_LIST_BIND[2][1] = "BindSearch1" ; 384. SHOP_SEARCH_LIST_BIND[2][2] = "BindSearch1" ; 385. SHOP_SEARCH_LIST_BIND[2][3] = "BindSearch1" ; 386. SHOP_SEARCH_LIST_BIND[2][4] = "BindSearch1" ; 387. SHOP_SEARCH_LIST_BIND[2][5] = "BindSearch1" ; 388. -- 389. SHOP_SEARCH_LIST_BIND[3] = {} 390. SHOP_SEARCH_LIST_BIND[3][1] = "BindSearch1" ; 391. SHOP_SEARCH_LIST_BIND[3][2] = "BindSearch1" ; 392. SHOP_SEARCH_LIST_BIND[3][3] = "BindSearch1" ; 393. SHOP_SEARCH_LIST_BIND[3][4] = "BindSearch1" ; 394. 395. -- 396. SHOP_SEARCH_LIST_BIND[4] = {} 397. SHOP_SEARCH_LIST_BIND[4][1] = "BindSearch1" ; 398. SHOP_SEARCH_LIST_BIND[4][2] = "BindSearch1" ; 399. SHOP_SEARCH_LIST_BIND[4][3] = "BindSearch1" ; 400. SHOP_SEARCH_LIST_BIND[4][4] = "BindSearch1" ; 401. 402. -- 403. SHOP_SEARCH_LIST_BIND[5] = {} 404. SHOP_SEARCH_LIST_BIND[5][1] = "BindSearch1" ; 405. SHOP_SEARCH_LIST_BIND[5][2] = "BindSearch1" ; 406. -- 407. SHOP_SEARCH_LIST_BIND[6] = {} 408. SHOP_SEARCH_LIST_BIND[6][1] = "BindSearch1" ; 409. SHOP_SEARCH_LIST_BIND[6][2] = "BindSearch1" ; 410. SHOP_SEARCH_LIST_BIND[6][3] = "BindSearch1" ; 411. SHOP_SEARCH_LIST_BIND[6][4] = "BindSearch1" ; 412. SHOP_SEARCH_LIST_BIND[6][5] = "BindSearch1" ; 413. -- 414. SHOP_SEARCH_LIST_BIND[7] = {} 415. SHOP_SEARCH_LIST_BIND[7][1] = "BindSearch1" ; 416. SHOP_SEARCH_LIST_BIND[7][2] = "BindSearch1" ; 417. SHOP_SEARCH_LIST_BIND[7][3] = "BindSearch1" ; 418. 419. 420. YuanbaoShop_SearchMode_Bind:AddTextItem("BindSearch1}" ,1) -- 421. YuanbaoShop_SearchMode_Bind:AddTextItem("BindSearch2}" ,2) --"" 422. YuanbaoShop_SearchMode_Bind:AddTextItem("BindSearch3}" ,3) --"" 423. YuanbaoShop_SearchMode_Bind:AddTextItem("BindSearch4}",4) --"" 424. YuanbaoShop_SearchMode_Bind:AddTextItem("BindSearch5}",5) --"" 425. YuanbaoShop_SearchMode_Bind:AddTextItem("BindSearch6}",6) --"" 426. YuanbaoShop_SearchMode_Bind:AddTextItem("BindSearch7}",7) --"" 427. 428. 429. YuanbaoShop_Bk1_Bind : Hide(); 430. YuanbaoShop_Bk2_Bind : Hide(); 431. YuanbaoShop_SearchMode_Bind : Hide(); 432. YuanbaoShop_Text2_Bind : Hide(); 433. -- 绑定元宝end 复制代码 以上,定义了客户端的商店脚本. 界面定义触发.各位可以参考官方的元宝商店进行理解
Interface/yuanbaoshop/yuanbaoshop.layout.xml 1. <?xml version="1.0"?> 2. <GUILayout> 3. <WindowType="TLBB_MainFrame0" Name="YuanbaoShop_Frame"> 4. <PropertyName="UnifiedSize"Value="{{0.000000,604.000000},{0.000000,458.000000}}"/> 5. <PropertyName="UnifiedPosition"Value="{{0.400000,-200.000000},{0.120000,0.000000}}"/> 6. <Event Name="Hidden"Function="YuanbaoShop_Close();"/> 7. <Window Type="TLBB_DragTitle"Name="YuanbaoShop_DragTitle"> 8. <PropertyName="AbsolutePosition" Value="x:40.000000 y:4.000000"/> 9. <PropertyName="UnifiedSize"Value="{{1.000000,-80.000000},{0.000000,20.000000}" /> 10. <PropertyName="DragTarget" Value="YuanbaoShop_Frame"/> 11. <WindowType="TLBB_SimpleText" Name="YuanbaoShop_Text"> 12. <Property Name="RelativePosition" Value="x:0.000000y:0.000000"/> 13. <Property Name="RelativeSize" Value="w:1.000000h:1.000000"/> 14. <Property Name="Font" Value="YouYuan11.25"/> 15. <Property Name="HorzFormatting" Value="HorzCentred"/> 16. <Property Name="RiseOnClick" Value="False"/> 17. <Property Name="Text" Value="#{YBSD_081225_073}"/> 18. <Property Name="VertFormatting" Value="VertCentred"/> 19. </Window> 20. </Window> 21. <Window Type="TLBB_ButtonHelp"Name="YuanbaoShop_Help"> 22. <PropertyName="UnifiedPosition"Value="{{0.000000,25.000000},{0.000000,7.000000}" /> 23. <PropertyName="AbsoluteSize" Value="w:14.000000 h:14.000000"/> 24. <EventName="Clicked"Function="Helper:GotoHelper("*YuanbaoShop");"/> 25. </Window> 26. <Window Type="TLBB_ButtonClose"Name="YuanbaoShop_Close"> 27. <PropertyName="UnifiedPosition"Value="{{1.000000,-39.000000},{0.000000,7.000000}" /> 28. <PropertyName="AbsoluteSize" Value="w:14.000000 h:14.000000"/> 29. <EventName="Clicked" Function="YuanbaoShop_Close();"/> 30. </Window> 31. <Window Type="DefaultWindow"Name="YuanbaoShop_Background_Frame1"> 32. <PropertyName="UnifiedSize"Value="{{1.000000,-10.000000},{1.000000,-46.000000}}"/> 33. <PropertyName="UnifiedPosition"Value="{{0.000000,5.000000},{0.000000,29.000000}}"/> 34. <WindowType="DefaultWindow" Name="Yuanbao_CheckBox_Frame"> 35. <Property Name="UnifiedPosition"Value="{{0.000000,3.000000},{0.000000,0.000000}" /> 36. <Property Name="UnifiedSize" Value="{{1.000000,-6.000000},{0.000000,24.000000}"/> 37. <Window Type="TLBB_ButtonFenYe2"Name="YuanbaoShop_Yuanbao"> 38. <Property Name="AbsolutePosition"Value="x:0.000000 y:0.000000" /> 39. <Property Name="AbsoluteSize"Value="w:90.000000 h:25.000000" /> 40. <PropertyName="Text" Value="#{YBSD_081225_002}" /> 这是元宝商店 41. <Property Name="CheckMode"Value="1" /> value=0的话就不会显示 42. <Property Name="Selected"Value="True" /> 默认选择的意思 43. <Event Name="MouseLButtonDown"Function="YuanbaoShop_ChangeTabIndex(0);" />定义动作和动作发生时调用函数,定义于yuanbaoshop.lua内 44. </Window> 45. <Window Type="TLBB_ButtonFenYe2"Name="YuanbaoShop_Gongzi">
46. <Property Name="AbsolutePosition"Value="x:90.000000 y:0.000000" /> 47. <Property Name="AbsoluteSize"Value="w:90.000000 h:25.000000" /> 48. <PropertyName="Text" Value="超级商店" /> 49. <Property Name="CheckMode"Value="1" /> 50. <Property Name="Selected"Value="False" /> 51. <PropertyName="Tooltip" Value="来到这里,你才知道锅是铁铸的。" /> 52. <Event Name="MouseLButtonDown"Function="YuanbaoShop_ChangeTabIndex(1);" /> 53. </Window> 54. 这就是添加了一个绑定元宝商店的按钮 55. 56. </Window> 57. 复制代码 OK,基本到此,有不明白的继续交流
|