Interface_Info.js 143 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252
  1. // Learn cc.Class:
  2. // - https://docs.cocos.com/creator/manual/en/scripting/class.html
  3. // Learn Attribute:
  4. // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
  5. // Learn life-cycle callbacks:
  6. // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
  7. cc.Class({
  8. extends: require("BasePlayerStates"),
  9. properties: {
  10. //界面_玩家信息
  11. AITArr: { //属性信息列表
  12. default: [],
  13. type: cc.Label,
  14. },
  15. top_right_Sprite: { //装备栏中
  16. default: [],
  17. type: cc.Sprite,
  18. },
  19. Item_Prop: {
  20. default: [],
  21. type: cc.Label,
  22. },
  23. itemsArr_W: { //白
  24. default: [],
  25. type: cc.Prefab,
  26. },
  27. itemsArr_G: { //绿
  28. default: [],
  29. type: cc.Prefab,
  30. },
  31. itemsArr_B: { //蓝
  32. default: [],
  33. type: cc.Prefab,
  34. },
  35. itemsArr_Y: { //黄
  36. default: [],
  37. type: cc.Prefab,
  38. },
  39. itemsArr_R: { //红
  40. default: [],
  41. type: cc.Prefab,
  42. },
  43. item_box: cc.Prefab,
  44. item_Attached: cc.Prefab,
  45. PlayerState: cc.Node,
  46. item_Attached_parent: cc.Node,
  47. Column_Right_Grid: cc.Node,
  48. item_sprite: cc.Sprite,
  49. },
  50. // LIFE-CYCLE CALLBACKS:
  51. onLoad() {
  52. this._super();
  53. this.ItemPool_type1 = new cc.NodePool();
  54. this.ItemPool_type2 = new cc.NodePool();
  55. this.ItemPool_type3 = new cc.NodePool();
  56. this.ItemPool_type4 = new cc.NodePool();
  57. this.ItemPool_type5 = new cc.NodePool();
  58. this.ItemPool_type6 = new cc.NodePool();
  59. this.ItemPool_type7 = new cc.NodePool();
  60. this.ItemPool_type8 = new cc.NodePool();
  61. this.ItemPool_type9 = new cc.NodePool();
  62. this.ItemPool_type10 = new cc.NodePool();
  63. },
  64. start() {
  65. this.init();
  66. this.dataint();
  67. this.UiController = cc.find("Canvas/UiController").getComponent('UiController');
  68. this.Pull_On = cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Btn_Pull_On");
  69. },
  70. update(dt) {
  71. },
  72. init() {
  73. //角色脚本
  74. this.AITArr[0].string = this.name;
  75. this.AITArr[1].string = this.hp;
  76. this.AITArr[2].string = this.endurance;
  77. this.AITArr[3].string = this.damage;
  78. this.AITArr[4].string = this.defense;
  79. this.AITArr[5].string = this.combo_rate;
  80. this.AITArr[6].string = this.crit_rate;
  81. this.AITArr[7].string = this.dodge_endurance;
  82. this.AITArr[8].string = this.defense_hp;
  83. this.AITArr[9].string = this.recover_hp;
  84. this.AITArr[10].string = this.recover_endurance;
  85. // this.controScp = this.playerController.getComponent('PlayerController');
  86. // this.charactortroScp = this.Charactor.getComponent('Charactor');
  87. },
  88. dataint() { //数据初始化
  89. //主属性临时
  90. this.in_hp = 0;
  91. this.in_maxhp = 0; //血量
  92. this.in_endurance = 0;
  93. this.in_maxendurance = 0; //蓝量
  94. this.in_damage = 0; //攻击力
  95. this.in_defense = 0; //防御
  96. this.in_combo_rate = 0; //连击率
  97. this.in_crit_rate = 0; //暴击率
  98. this.in_dodge_endurance = 0; //闪避回蓝
  99. this.in_defense_hp = 0; //格挡回血
  100. this.in_recover_hp = 0; //被动回血1/s
  101. this.in_recover_endurance = 0; //被动回蓝1/s
  102. //附加属性临时
  103. this.in_attached_hp = 0;
  104. this.in_attached_maxhp = 0; //血量
  105. this.in_attached_endurance = 0;
  106. this.in_attached_maxendurance = 0; //蓝量
  107. this.in_attached_damage = 0; //攻击力
  108. this.in_attached_defense = 0; //防御
  109. this.in_attached_combo_rate = 0; //连击率
  110. this.in_attached_crit_rate = 0; //暴击率
  111. this.in_attached_dodge_endurance = 0; //闪避回蓝
  112. this.in_attached_defense_hp = 0; //格挡回血
  113. this.in_attached_recover_hp = 0; //被动回血1/s
  114. this.in_attached_recover_endurance = 0; //被动回蓝1/s
  115. // this.in_block_minus_endurance = 0; //格挡减蓝量
  116. // this.in_block_minus_endurance = 0; //格挡减蓝量
  117. //物品属性临时
  118. this.in_item_type; //物品类型
  119. this.in_gradetype; //物品品级
  120. this.in_item_master_type; //物品主属性类型
  121. this.in_item_master_value; //物品主属性数值
  122. this.in_item_Attached_num; //物品词条数
  123. this.in_item_attached_nameArr = []; //物品词条类型名字数组
  124. this.in_item_Attached_typeArr = []; //物品词条类型数组
  125. this.in_item_attached_valueArr = []; //物品词条数值组
  126. },
  127. creatorgird() {
  128. for (let i = 0; i < this.Column_Right_Grid.childrenCount; i++) {
  129. if (this.Column_Right_Grid.children[i].childrenCount == 0) {
  130. var item_box = cc.instantiate(this.item_box);
  131. this.Column_Right_Grid.children[i].addChild(item_box);
  132. item_box.on(cc.Node.EventType.TOUCH_START, function() {
  133. cc.audioEngine.playEffect(this.UiController.audioArr[0]);
  134. // 加载 Prefab
  135. cc.loader.loadRes("prefab/Result/interface_Box", (err, prefab) => {
  136. cc.find("Canvas/PanelResult").addChild(cc.instantiate(prefab));
  137. });
  138. this.Column_Right_Grid.children[i].removeChild(item_box);
  139. }, this);
  140. return;
  141. }
  142. }
  143. },
  144. /////什么物品,,什么品级 属性类型 数值 附加属性数量 附属性 副属性值
  145. creatorItem(item_type, gradetype, item_master_type, item_master_value, item_Attached_num, item_attached_nameArr, item_Attached_typeArr, item_attached_valueArr) {
  146. for (let j = 0; j < 10; j++) {
  147. if (item_type == j) {
  148. //this.item_name = "左手拳套";
  149. //this.item_grade = 0;
  150. //this.item_master_type = "攻击"; //主属性类型
  151. //白 * (白色装备:主属性1)
  152. if (gradetype == 0) {
  153. for (let i = 0; i < this.Column_Right_Grid.childrenCount; i++) {
  154. if (this.Column_Right_Grid.children[i].childrenCount == 0) {
  155. let item = cc.instantiate(this.itemsArr_W[j]);
  156. this.Column_Right_Grid.children[i].addChild(item);
  157. console.log("坐标:", item.position);
  158. //let item_gird = cc.instantiate(this.itemsArr_W[j]);
  159. item.on(cc.Node.EventType.TOUCH_START, function() {
  160. cc.audioEngine.playEffect(this.UiController.audioArr[0]);
  161. this.item_Attached_parent.removeAllChildren();
  162. if (j == 0) {
  163. cc.loader.loadRes("texture/AvatarProps/left_gloves1", cc.SpriteFrame, (err, spriteFrame) => {
  164. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  165. });
  166. //加载图片
  167. this.Item_Prop[0].string = "左手拳套";
  168. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  169. for (let itn = 0; itn < item_Attached_num; itn++) {
  170. let item_Attached = cc.instantiate(this.item_Attached);
  171. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  172. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  173. this.item_Attached_parent.addChild(item_Attached);
  174. }
  175. this.Pull_On.on("touchstart", () => {
  176. cc.loader.loadRes("texture/AvatarProps/left_gloves1", cc.SpriteFrame, (err, spriteFrame) => {
  177. this.top_right_Sprite[4].spriteFrame = spriteFrame;
  178. });
  179. this.damage -= this.in_damage;
  180. this.damage += item_master_value;
  181. this.in_damage = item_master_value;
  182. for (let it = 0; it < item_Attached_num; it++) {
  183. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  184. }
  185. this.init();
  186. this.Pool_OPe(j, item);
  187. });
  188. }
  189. if (j == 1) {
  190. //加载图片
  191. cc.loader.loadRes("texture/AvatarProps/right_gloves1", cc.SpriteFrame, function(err, spriteFrame) {
  192. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  193. });
  194. this.Item_Prop[0].string = "右手拳套";
  195. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  196. for (let itn = 0; itn < item_Attached_num; itn++) {
  197. let item_Attached = cc.instantiate(this.item_Attached);
  198. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  199. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  200. this.item_Attached_parent.addChild(item_Attached);
  201. }
  202. this.Pull_On.on("touchstart", () => {
  203. cc.loader.loadRes("texture/AvatarProps/right_gloves1", cc.SpriteFrame, (err, spriteFrame) => {
  204. this.top_right_Sprite[5].spriteFrame = spriteFrame;
  205. });
  206. this.combo_rate -= this.in_combo_rate;
  207. this.combo_rate += item_master_value;
  208. this.in_combo_rate = item_master_value;
  209. for (let it = 0; it < item_Attached_num; it++) {
  210. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  211. }
  212. this.init();
  213. this.Pool_OPe(j, item);
  214. });
  215. }
  216. if (j == 2) {
  217. //加载图片
  218. cc.loader.loadRes("texture/AvatarProps/clothes1", cc.SpriteFrame, function(err, spriteFrame) {
  219. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  220. });
  221. this.Item_Prop[0].string = "衣服";
  222. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  223. for (let itn = 0; itn < item_Attached_num; itn++) {
  224. let item_Attached = cc.instantiate(this.item_Attached);
  225. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  226. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  227. this.item_Attached_parent.addChild(item_Attached);
  228. }
  229. this.Pull_On.on("touchstart", () => {
  230. cc.loader.loadRes("texture/AvatarProps/clothes1", cc.SpriteFrame, (err, spriteFrame) => {
  231. this.top_right_Sprite[2].spriteFrame = spriteFrame;
  232. });
  233. this.defense -= this.in_defense;
  234. this.defense += item_master_value;
  235. this.in_defense = item_master_value;
  236. for (let it = 0; it < item_Attached_num; it++) {
  237. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  238. }
  239. this.init();
  240. this.Pool_OPe(j, item);
  241. });
  242. }
  243. if (j == 3) {
  244. //加载图片
  245. cc.loader.loadRes("texture/AvatarProps/trousers1", cc.SpriteFrame, function(err, spriteFrame) {
  246. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  247. });
  248. this.Item_Prop[0].string = "裤子";
  249. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  250. for (let itn = 0; itn < item_Attached_num; itn++) {
  251. let item_Attached = cc.instantiate(this.item_Attached);
  252. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  253. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  254. this.item_Attached_parent.addChild(item_Attached);
  255. }
  256. this.Pull_On.on("touchstart", () => {
  257. cc.loader.loadRes("texture/AvatarProps/trousers1", cc.SpriteFrame, (err, spriteFrame) => {
  258. this.top_right_Sprite[7].spriteFrame = spriteFrame;
  259. });
  260. this.hp -= this.in_hp;
  261. this.maxhp -= this.in_maxhp;
  262. this.hp += item_master_value;
  263. this.maxhp += item_master_value;
  264. this.in_hp = item_master_value;
  265. this.in_maxhp = item_master_value;
  266. for (let it = 0; it < item_Attached_num; it++) {
  267. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  268. }
  269. this.init();
  270. this.Pool_OPe(j, item);
  271. });
  272. }
  273. if (j == 4) {
  274. //加载图片
  275. cc.loader.loadRes("texture/AvatarProps/belt1", cc.SpriteFrame, function(err, spriteFrame) {
  276. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  277. });
  278. this.Item_Prop[0].string = "腰带";
  279. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  280. for (let itn = 0; itn < item_Attached_num; itn++) {
  281. let item_Attached = cc.instantiate(this.item_Attached);
  282. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  283. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  284. this.item_Attached_parent.addChild(item_Attached);
  285. }
  286. this.Pull_On.on("touchstart", () => {
  287. cc.loader.loadRes("texture/AvatarProps/belt1", cc.SpriteFrame, (err, spriteFrame) => {
  288. this.top_right_Sprite[3].spriteFrame = spriteFrame;
  289. });
  290. this.endurance -= this.in_endurance;
  291. this.maxendurance -= this.in_maxendurance;
  292. this.endurance += item_master_value;
  293. this.maxendurance += item_master_value;
  294. this.in_endurance = item_master_value;
  295. this.in_maxendurance = item_master_value;
  296. for (let it = 0; it < item_Attached_num; it++) {
  297. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  298. }
  299. this.init();
  300. this.Pool_OPe(j, item);
  301. });
  302. }
  303. if (j == 5) {
  304. //加载图片
  305. cc.loader.loadRes("texture/AvatarProps/helmet1", cc.SpriteFrame, function(err, spriteFrame) {
  306. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  307. });
  308. this.Item_Prop[0].string = "头盔";
  309. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  310. for (let itn = 0; itn < item_Attached_num; itn++) {
  311. let item_Attached = cc.instantiate(this.item_Attached);
  312. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  313. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  314. this.item_Attached_parent.addChild(item_Attached);
  315. }
  316. this.Pull_On.on("touchstart", () => {
  317. cc.loader.loadRes("texture/AvatarProps/helmet1", cc.SpriteFrame, (err, spriteFrame) => {
  318. this.top_right_Sprite[0].spriteFrame = spriteFrame;
  319. });
  320. this.defense_hp -= this.in_defense_hp;
  321. this.defense_hp += item_master_value;
  322. this.in_defense_hp = item_master_value;
  323. for (let it = 0; it < item_Attached_num; it++) {
  324. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  325. }
  326. this.init();
  327. this.Pool_OPe(j, item);
  328. });
  329. }
  330. if (j == 6) {
  331. //加载图片
  332. cc.loader.loadRes("texture/AvatarProps/necklace1", cc.SpriteFrame, function(err, spriteFrame) {
  333. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  334. });
  335. this.Item_Prop[0].string = "项链";
  336. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  337. for (let itn = 0; itn < item_Attached_num; itn++) {
  338. let item_Attached = cc.instantiate(this.item_Attached);
  339. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  340. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  341. this.item_Attached_parent.addChild(item_Attached);
  342. }
  343. this.Pull_On.on("touchstart", () => {
  344. cc.loader.loadRes("texture/AvatarProps/necklace1", cc.SpriteFrame, (err, spriteFrame) => {
  345. this.top_right_Sprite[1].spriteFrame = spriteFrame;
  346. });
  347. this.crit_rate -= this.in_crit_rate;
  348. this.crit_rate += item_master_value;
  349. this.in_crit_rate = item_master_value;
  350. for (let it = 0; it < item_Attached_num; it++) {
  351. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  352. }
  353. this.init();
  354. this.Pool_OPe(j, item);
  355. });
  356. }
  357. if (j == 7) {
  358. //加载图片
  359. cc.loader.loadRes("texture/AvatarProps/shoe1", cc.SpriteFrame, function(err, spriteFrame) {
  360. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  361. });
  362. this.Item_Prop[0].string = "鞋子";
  363. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  364. for (let itn = 0; itn < item_Attached_num; itn++) {
  365. let item_Attached = cc.instantiate(this.item_Attached);
  366. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  367. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  368. this.item_Attached_parent.addChild(item_Attached);
  369. }
  370. this.Pull_On.on("touchstart", () => {
  371. cc.loader.loadRes("texture/AvatarProps/shoe1", cc.SpriteFrame, (err, spriteFrame) => {
  372. this.top_right_Sprite[8].spriteFrame = spriteFrame;
  373. });
  374. this.dodge_endurance -= this.in_dodge_endurance;
  375. this.dodge_endurance += item_master_value;
  376. this.in_dodge_endurance = item_master_value;
  377. for (let it = 0; it < item_Attached_num; it++) {
  378. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  379. }
  380. this.init();
  381. this.Pool_OPe(j, item);
  382. });
  383. }
  384. if (j == 8) {
  385. //加载图片
  386. cc.loader.loadRes("texture/AvatarProps/wristsupport1", cc.SpriteFrame, function(err, spriteFrame) {
  387. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  388. });
  389. this.Item_Prop[0].string = "手套";
  390. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  391. for (let itn = 0; itn < item_Attached_num; itn++) {
  392. let item_Attached = cc.instantiate(this.item_Attached);
  393. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  394. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  395. this.item_Attached_parent.addChild(item_Attached);
  396. }
  397. this.Pull_On.on("touchstart", () => {
  398. cc.loader.loadRes("texture/AvatarProps/wristsupport1", cc.SpriteFrame, (err, spriteFrame) => {
  399. this.top_right_Sprite[6].spriteFrame = spriteFrame;
  400. });
  401. this.recover_endurance -= this.in_recover_endurance;
  402. this.recover_endurance += item_master_value;
  403. this.in_recover_endurance = item_master_value;
  404. for (let it = 0; it < item_Attached_num; it++) {
  405. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  406. }
  407. this.init();
  408. this.Pool_OPe(j, item);
  409. });
  410. }
  411. if (j == 9) {
  412. //加载图片
  413. cc.loader.loadRes("texture/AvatarProps/kneecap1", cc.SpriteFrame, function(err, spriteFrame) {
  414. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  415. });
  416. this.Item_Prop[0].string = "护膝";
  417. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  418. for (let itn = 0; itn < item_Attached_num; itn++) {
  419. let item_Attached = cc.instantiate(this.item_Attached);
  420. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  421. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  422. this.item_Attached_parent.addChild(item_Attached);
  423. }
  424. this.Pull_On.on("touchstart", () => {
  425. cc.loader.loadRes("texture/AvatarProps/kneecap1", cc.SpriteFrame, (err, spriteFrame) => {
  426. this.top_right_Sprite[9].spriteFrame = spriteFrame;
  427. });
  428. this.recover_hp -= this.in_recover_hp;
  429. this.recover_hp += item_master_value;
  430. this.in_recover_hp = item_master_value;
  431. for (let it = 0; it < item_Attached_num; it++) {
  432. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  433. }
  434. this.init();
  435. this.Pool_OPe(j, item);
  436. });
  437. }
  438. }, this);
  439. return;
  440. }
  441. }
  442. }
  443. //* (绿色装备:主属性随机1-2,随机一条副属性1-1)
  444. //绿 主属性值随机1-2 随机副属性条数 副属性随机属性 副属性随机属性值
  445. if (gradetype == 1) {
  446. for (let i = 0; i < this.Column_Right_Grid.childrenCount; i++) {
  447. if (this.Column_Right_Grid.children[i].childrenCount == 0) {
  448. let item = cc.instantiate(this.itemsArr_G[j]);
  449. this.Column_Right_Grid.children[i].addChild(item);
  450. item.on(cc.Node.EventType.TOUCH_START, function() {
  451. cc.audioEngine.playEffect(this.UiController.audioArr[0]);
  452. this.item_Attached_parent.removeAllChildren();
  453. if (j == 0) {
  454. //加载图片
  455. cc.loader.loadRes("texture/AvatarProps/left_gloves2", cc.SpriteFrame, function(err, spriteFrame) {
  456. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  457. });
  458. this.Item_Prop[0].string = "左手拳套";
  459. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  460. for (let itn = 0; itn < item_Attached_num; itn++) {
  461. let item_Attached = cc.instantiate(this.item_Attached)
  462. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  463. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  464. this.item_Attached_parent.addChild(item_Attached);
  465. }
  466. this.Pull_On.on("touchstart", () => {
  467. cc.loader.loadRes("texture/AvatarProps/left_gloves2", cc.SpriteFrame, (err, spriteFrame) => {
  468. this.top_right_Sprite[4].spriteFrame = spriteFrame;
  469. });
  470. this.damage -= this.in_damage;
  471. this.damage += item_master_value;
  472. this.in_damage = item_master_value;
  473. for (let it = 0; it < item_Attached_num; it++) {
  474. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  475. }
  476. this.init();
  477. this.Pool_OPe(j, item);
  478. });
  479. }
  480. if (j == 1) {
  481. this.Pull_On.on("touchstart", () => {
  482. cc.loader.loadRes("texture/AvatarProps/right_gloves2", cc.SpriteFrame, (err, spriteFrame) => {
  483. this.top_right_Sprite[5].spriteFrame = spriteFrame;
  484. });
  485. });
  486. //加载图片
  487. cc.loader.loadRes("texture/AvatarProps/right_gloves2", cc.SpriteFrame, function(err, spriteFrame) {
  488. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  489. });
  490. this.Item_Prop[0].string = "右手拳套";
  491. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  492. for (let itn = 0; itn < item_Attached_num; itn++) {
  493. let item_Attached = cc.instantiate(this.item_Attached)
  494. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  495. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  496. this.item_Attached_parent.addChild(item_Attached);
  497. }
  498. this.Pull_On.on("touchstart", () => {
  499. cc.loader.loadRes("texture/AvatarProps/right_gloves2", cc.SpriteFrame, (err, spriteFrame) => {
  500. this.top_right_Sprite[5].spriteFrame = spriteFrame;
  501. });
  502. this.combo_rate -= this.in_combo_rate;
  503. this.combo_rate += item_master_value;
  504. this.in_combo_rate = item_master_value;
  505. for (let it = 0; it < item_Attached_num; it++) {
  506. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  507. }
  508. this.init();
  509. this.Pool_OPe(j, item);
  510. });
  511. }
  512. if (j == 2) {
  513. this.Pull_On.on("touchstart", () => {
  514. cc.loader.loadRes("texture/AvatarProps/clothes2", cc.SpriteFrame, (err, spriteFrame) => {
  515. this.top_right_Sprite[2].spriteFrame = spriteFrame;
  516. });
  517. });
  518. //加载图片
  519. cc.loader.loadRes("texture/AvatarProps/clothes2", cc.SpriteFrame, function(err, spriteFrame) {
  520. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  521. });
  522. this.Item_Prop[0].string = "衣服";
  523. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  524. for (let itn = 0; itn < item_Attached_num; itn++) {
  525. let item_Attached = cc.instantiate(this.item_Attached)
  526. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  527. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  528. this.item_Attached_parent.addChild(item_Attached);
  529. }
  530. this.Pull_On.on("touchstart", () => {
  531. cc.loader.loadRes("texture/AvatarProps/clothes2", cc.SpriteFrame, (err, spriteFrame) => {
  532. this.top_right_Sprite[2].spriteFrame = spriteFrame;
  533. });
  534. this.defense -= this.in_defense;
  535. this.defense += item_master_value;
  536. this.in_defense = item_master_value;
  537. for (let it = 0; it < item_Attached_num; it++) {
  538. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  539. }
  540. this.init();
  541. this.Pool_OPe(j, item);
  542. });
  543. }
  544. if (j == 3) {
  545. this.Pull_On.on("touchstart", () => {
  546. cc.loader.loadRes("texture/AvatarProps/trousers2", cc.SpriteFrame, (err, spriteFrame) => {
  547. this.top_right_Sprite[7].spriteFrame = spriteFrame;
  548. });
  549. });
  550. //加载图片
  551. cc.loader.loadRes("texture/AvatarProps/trousers2", cc.SpriteFrame, function(err, spriteFrame) {
  552. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  553. });
  554. this.Item_Prop[0].string = "裤子";
  555. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  556. for (let itn = 0; itn < item_Attached_num; itn++) {
  557. let item_Attached = cc.instantiate(this.item_Attached)
  558. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  559. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  560. this.item_Attached_parent.addChild(item_Attached);
  561. }
  562. this.Pull_On.on("touchstart", () => {
  563. cc.loader.loadRes("texture/AvatarProps/trousers2", cc.SpriteFrame, (err, spriteFrame) => {
  564. this.top_right_Sprite[7].spriteFrame = spriteFrame;
  565. });
  566. this.hp -= this.in_hp;
  567. this.maxhp -= this.in_maxhp;
  568. this.hp += item_master_value;
  569. this.maxhp += item_master_value;
  570. this.in_hp = item_master_value;
  571. this.in_maxhp = item_master_value;
  572. for (let it = 0; it < item_Attached_num; it++) {
  573. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  574. }
  575. this.init();
  576. this.Pool_OPe(j, item);
  577. });
  578. }
  579. if (j == 4) {
  580. this.Pull_On.on("touchstart", () => {
  581. cc.loader.loadRes("texture/AvatarProps/belt2", cc.SpriteFrame, (err, spriteFrame) => {
  582. this.top_right_Sprite[3].spriteFrame = spriteFrame;
  583. });
  584. });
  585. //加载图片
  586. cc.loader.loadRes("texture/AvatarProps/belt2", cc.SpriteFrame, function(err, spriteFrame) {
  587. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  588. });
  589. this.Item_Prop[0].string = "腰带";
  590. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  591. for (let itn = 0; itn < item_Attached_num; itn++) {
  592. let item_Attached = cc.instantiate(this.item_Attached)
  593. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  594. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  595. this.item_Attached_parent.addChild(item_Attached);
  596. }
  597. this.Pull_On.on("touchstart", () => {
  598. cc.loader.loadRes("texture/AvatarProps/belt2", cc.SpriteFrame, (err, spriteFrame) => {
  599. this.top_right_Sprite[3].spriteFrame = spriteFrame;
  600. });
  601. this.endurance -= this.in_endurance;
  602. this.maxendurance -= this.in_maxendurance;
  603. this.endurance += item_master_value;
  604. this.maxendurance += item_master_value;
  605. this.in_endurance = item_master_value;
  606. this.in_maxendurance = item_master_value;
  607. for (let it = 0; it < item_Attached_num; it++) {
  608. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  609. }
  610. this.init();
  611. this.Pool_OPe(j, item);
  612. });
  613. }
  614. if (j == 5) {
  615. this.Pull_On.on("touchstart", () => {
  616. cc.loader.loadRes("texture/AvatarProps/helmet2", cc.SpriteFrame, (err, spriteFrame) => {
  617. this.top_right_Sprite[0].spriteFrame = spriteFrame;
  618. });
  619. });
  620. //加载图片
  621. cc.loader.loadRes("texture/AvatarProps/helmet2", cc.SpriteFrame, function(err, spriteFrame) {
  622. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  623. });
  624. this.Item_Prop[0].string = "头盔";
  625. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  626. for (let itn = 0; itn < item_Attached_num; itn++) {
  627. let item_Attached = cc.instantiate(this.item_Attached)
  628. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  629. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  630. this.item_Attached_parent.addChild(item_Attached);
  631. }
  632. this.Pull_On.on("touchstart", () => {
  633. cc.loader.loadRes("texture/AvatarProps/helmet2", cc.SpriteFrame, (err, spriteFrame) => {
  634. this.top_right_Sprite[0].spriteFrame = spriteFrame;
  635. });
  636. this.defense_hp -= this.in_defense_hp;
  637. this.defense_hp += item_master_value;
  638. this.in_defense_hp = item_master_value;
  639. for (let it = 0; it < item_Attached_num; it++) {
  640. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  641. }
  642. this.init();
  643. this.Pool_OPe(j, item);
  644. });
  645. }
  646. if (j == 6) {
  647. this.Pull_On.on("touchstart", () => {
  648. cc.loader.loadRes("texture/AvatarProps/necklace2", cc.SpriteFrame, (err, spriteFrame) => {
  649. this.top_right_Sprite[1].spriteFrame = spriteFrame;
  650. });
  651. });
  652. //加载图片
  653. cc.loader.loadRes("texture/AvatarProps/necklace2", cc.SpriteFrame, function(err, spriteFrame) {
  654. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  655. });
  656. this.Item_Prop[0].string = "项链";
  657. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  658. for (let itn = 0; itn < item_Attached_num; itn++) {
  659. let item_Attached = cc.instantiate(this.item_Attached)
  660. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  661. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  662. this.item_Attached_parent.addChild(item_Attached);
  663. }
  664. this.Pull_On.on("touchstart", () => {
  665. cc.loader.loadRes("texture/AvatarProps/necklace2", cc.SpriteFrame, (err, spriteFrame) => {
  666. this.top_right_Sprite[1].spriteFrame = spriteFrame;
  667. });
  668. this.crit_rate -= this.in_crit_rate;
  669. this.crit_rate += item_master_value;
  670. this.in_crit_rate = item_master_value;
  671. for (let it = 0; it < item_Attached_num; it++) {
  672. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  673. }
  674. this.init();
  675. this.Pool_OPe(j, item);
  676. });
  677. }
  678. if (j == 7) {
  679. this.Pull_On.on("touchstart", () => {
  680. cc.loader.loadRes("texture/AvatarProps/shoe2", cc.SpriteFrame, (err, spriteFrame) => {
  681. this.top_right_Sprite[8].spriteFrame = spriteFrame;
  682. });
  683. });
  684. //加载图片
  685. cc.loader.loadRes("texture/AvatarProps/shoe2", cc.SpriteFrame, function(err, spriteFrame) {
  686. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  687. });
  688. this.Item_Prop[0].string = "鞋子";
  689. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  690. for (let itn = 0; itn < item_Attached_num; itn++) {
  691. let item_Attached = cc.instantiate(this.item_Attached)
  692. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  693. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  694. this.item_Attached_parent.addChild(item_Attached);
  695. }
  696. this.Pull_On.on("touchstart", () => {
  697. cc.loader.loadRes("texture/AvatarProps/shoe2", cc.SpriteFrame, (err, spriteFrame) => {
  698. this.top_right_Sprite[8].spriteFrame = spriteFrame;
  699. });
  700. this.dodge_endurance -= this.in_dodge_endurance;
  701. this.dodge_endurance += item_master_value;
  702. this.in_dodge_endurance = item_master_value;
  703. for (let it = 0; it < item_Attached_num; it++) {
  704. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  705. }
  706. this.init();
  707. this.Pool_OPe(j, item);
  708. });
  709. }
  710. if (j == 8) {
  711. this.Pull_On.on("touchstart", () => {
  712. cc.loader.loadRes("texture/AvatarProps/wristsupport2", cc.SpriteFrame, (err, spriteFrame) => {
  713. this.top_right_Sprite[6].spriteFrame = spriteFrame;
  714. });
  715. });
  716. //加载图片
  717. cc.loader.loadRes("texture/AvatarProps/wristsupport2", cc.SpriteFrame, function(err, spriteFrame) {
  718. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  719. });
  720. this.Item_Prop[0].string = "手套";
  721. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  722. for (let itn = 0; itn < item_Attached_num; itn++) {
  723. let item_Attached = cc.instantiate(this.item_Attached)
  724. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  725. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  726. this.item_Attached_parent.addChild(item_Attached);
  727. }
  728. this.Pull_On.on("touchstart", () => {
  729. cc.loader.loadRes("texture/AvatarProps/wristsupport2", cc.SpriteFrame, (err, spriteFrame) => {
  730. this.top_right_Sprite[6].spriteFrame = spriteFrame;
  731. });
  732. this.recover_endurance -= this.in_recover_endurance;
  733. this.recover_endurance += item_master_value;
  734. this.in_recover_endurance = item_master_value;
  735. for (let it = 0; it < item_Attached_num; it++) {
  736. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  737. }
  738. this.init();
  739. this.Pool_OPe(j, item);
  740. });
  741. }
  742. if (j == 9) {
  743. this.Pull_On.on("touchstart", () => {
  744. cc.loader.loadRes("texture/AvatarProps/kneecap2", cc.SpriteFrame, (err, spriteFrame) => {
  745. this.top_right_Sprite[9].spriteFrame = spriteFrame;
  746. });
  747. });
  748. //加载图片
  749. cc.loader.loadRes("texture/AvatarProps/kneecap2", cc.SpriteFrame, function(err, spriteFrame) {
  750. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  751. });
  752. this.Item_Prop[0].string = "护膝";
  753. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  754. for (let itn = 0; itn < item_Attached_num; itn++) {
  755. let item_Attached = cc.instantiate(this.item_Attached)
  756. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  757. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  758. this.item_Attached_parent.addChild(item_Attached);
  759. }
  760. this.Pull_On.on("touchstart", () => {
  761. cc.loader.loadRes("texture/AvatarProps/kneecap2", cc.SpriteFrame, (err, spriteFrame) => {
  762. this.top_right_Sprite[9].spriteFrame = spriteFrame;
  763. });
  764. this.recover_hp -= this.in_recover_hp;
  765. this.recover_hp += item_master_value;
  766. this.in_recover_hp = item_master_value;
  767. for (let it = 0; it < item_Attached_num; it++) {
  768. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  769. }
  770. this.init();
  771. this.Pool_OPe(j, item);
  772. });
  773. }
  774. }, this);
  775. return;
  776. }
  777. }
  778. }
  779. //蓝* (蓝色装备:主属性随机1-3,随机一条副属性1-2)
  780. if (gradetype == 2) {
  781. for (let i = 0; i < this.Column_Right_Grid.childrenCount; i++) {
  782. if (this.Column_Right_Grid.children[i].childrenCount == 0) {
  783. let item = cc.instantiate(this.itemsArr_B[j]);
  784. this.Column_Right_Grid.children[i].addChild(item);
  785. item.on(cc.Node.EventType.TOUCH_START, function() {
  786. cc.audioEngine.playEffect(this.UiController.audioArr[0]);
  787. this.item_Attached_parent.removeAllChildren();
  788. if (j == 0) {
  789. this.Pull_On.on("touchstart", () => {
  790. cc.loader.loadRes("texture/AvatarProps/left_gloves3", cc.SpriteFrame, (err, spriteFrame) => {
  791. this.top_right_Sprite[4].spriteFrame = spriteFrame;
  792. });
  793. });
  794. //加载图片
  795. cc.loader.loadRes("texture/AvatarProps/left_gloves3", cc.SpriteFrame, function(err, spriteFrame) {
  796. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  797. });
  798. this.Item_Prop[0].string = "左手拳套";
  799. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  800. for (let itn = 0; itn < item_Attached_num; itn++) {
  801. let item_Attached = cc.instantiate(this.item_Attached)
  802. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  803. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  804. this.item_Attached_parent.addChild(item_Attached);
  805. }
  806. this.Pull_On.on("touchstart", () => {
  807. cc.loader.loadRes("texture/AvatarProps/left_gloves3", cc.SpriteFrame, (err, spriteFrame) => {
  808. this.top_right_Sprite[4].spriteFrame = spriteFrame;
  809. });
  810. this.damage -= this.in_damage;
  811. this.damage += item_master_value;
  812. this.in_damage = item_master_value;
  813. for (let it = 0; it < item_Attached_num; it++) {
  814. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  815. }
  816. this.init();
  817. this.Pool_OPe(j, item);
  818. });
  819. }
  820. if (j == 1) {
  821. this.Pull_On.on("touchstart", () => {
  822. cc.loader.loadRes("texture/AvatarProps/right_gloves3", cc.SpriteFrame, (err, spriteFrame) => {
  823. this.top_right_Sprite[5].spriteFrame = spriteFrame;
  824. });
  825. });
  826. //加载图片
  827. cc.loader.loadRes("texture/AvatarProps/right_gloves3", cc.SpriteFrame, function(err, spriteFrame) {
  828. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  829. });
  830. this.Item_Prop[0].string = "右手拳套";
  831. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  832. for (let itn = 0; itn < item_Attached_num; itn++) {
  833. let item_Attached = cc.instantiate(this.item_Attached)
  834. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  835. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  836. this.item_Attached_parent.addChild(item_Attached);
  837. }
  838. this.Pull_On.on("touchstart", () => {
  839. cc.loader.loadRes("texture/AvatarProps/right_gloves3", cc.SpriteFrame, (err, spriteFrame) => {
  840. this.top_right_Sprite[5].spriteFrame = spriteFrame;
  841. });
  842. this.combo_rate -= this.in_combo_rate;
  843. this.combo_rate += item_master_value;
  844. this.in_combo_rate = item_master_value;
  845. for (let it = 0; it < item_Attached_num; it++) {
  846. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  847. }
  848. this.init();
  849. this.Pool_OPe(j, item);
  850. });
  851. }
  852. if (j == 2) {
  853. this.Pull_On.on("touchstart", () => {
  854. cc.loader.loadRes("texture/AvatarProps/clothes3", cc.SpriteFrame, (err, spriteFrame) => {
  855. this.top_right_Sprite[2].spriteFrame = spriteFrame;
  856. });
  857. });
  858. //加载图片
  859. cc.loader.loadRes("texture/AvatarProps/clothes3", cc.SpriteFrame, function(err, spriteFrame) {
  860. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  861. });
  862. this.Item_Prop[0].string = "衣服";
  863. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  864. for (let itn = 0; itn < item_Attached_num; itn++) {
  865. let item_Attached = cc.instantiate(this.item_Attached)
  866. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  867. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  868. this.item_Attached_parent.addChild(item_Attached);
  869. }
  870. this.Pull_On.on("touchstart", () => {
  871. cc.loader.loadRes("texture/AvatarProps/clothes3", cc.SpriteFrame, (err, spriteFrame) => {
  872. this.top_right_Sprite[2].spriteFrame = spriteFrame;
  873. });
  874. this.defense -= this.in_defense;
  875. this.defense += item_master_value;
  876. this.in_defense = item_master_value;
  877. for (let it = 0; it < item_Attached_num; it++) {
  878. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  879. }
  880. this.init();
  881. this.Pool_OPe(j, item);
  882. });
  883. }
  884. if (j == 3) {
  885. this.Pull_On.on("touchstart", () => {
  886. cc.loader.loadRes("texture/AvatarProps/trousers3", cc.SpriteFrame, (err, spriteFrame) => {
  887. this.top_right_Sprite[7].spriteFrame = spriteFrame;
  888. });
  889. });
  890. //加载图片
  891. cc.loader.loadRes("texture/AvatarProps/trousers3", cc.SpriteFrame, function(err, spriteFrame) {
  892. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  893. });
  894. this.Item_Prop[0].string = "裤子";
  895. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  896. for (let itn = 0; itn < item_Attached_num; itn++) {
  897. let item_Attached = cc.instantiate(this.item_Attached)
  898. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  899. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  900. this.item_Attached_parent.addChild(item_Attached);
  901. }
  902. this.Pull_On.on("touchstart", () => {
  903. cc.loader.loadRes("texture/AvatarProps/trousers3", cc.SpriteFrame, (err, spriteFrame) => {
  904. this.top_right_Sprite[7].spriteFrame = spriteFrame;
  905. });
  906. this.hp -= this.in_hp;
  907. this.maxhp -= this.in_maxhp;
  908. this.hp += item_master_value;
  909. this.maxhp += item_master_value;
  910. this.in_hp = item_master_value;
  911. this.in_maxhp = item_master_value;
  912. for (let it = 0; it < item_Attached_num; it++) {
  913. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  914. }
  915. this.init();
  916. this.Pool_OPe(j, item);
  917. });
  918. }
  919. if (j == 4) {
  920. this.Pull_On.on("touchstart", () => {
  921. cc.loader.loadRes("texture/AvatarProps/belt3", cc.SpriteFrame, (err, spriteFrame) => {
  922. this.top_right_Sprite[3].spriteFrame = spriteFrame;
  923. });
  924. });
  925. //加载图片
  926. cc.loader.loadRes("texture/AvatarProps/belt3", cc.SpriteFrame, function(err, spriteFrame) {
  927. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  928. });
  929. this.Item_Prop[0].string = "腰带";
  930. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  931. for (let itn = 0; itn < item_Attached_num; itn++) {
  932. let item_Attached = cc.instantiate(this.item_Attached)
  933. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  934. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  935. this.item_Attached_parent.addChild(item_Attached);
  936. }
  937. this.Pull_On.on("touchstart", () => {
  938. cc.loader.loadRes("texture/AvatarProps/belt3", cc.SpriteFrame, (err, spriteFrame) => {
  939. this.top_right_Sprite[3].spriteFrame = spriteFrame;
  940. });
  941. this.endurance -= this.in_endurance;
  942. this.maxendurance -= this.in_maxendurance;
  943. this.endurance += item_master_value;
  944. this.maxendurance += item_master_value;
  945. this.in_endurance = item_master_value;
  946. this.in_maxendurance = item_master_value;
  947. for (let it = 0; it < item_Attached_num; it++) {
  948. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  949. }
  950. this.init();
  951. this.Pool_OPe(j, item);
  952. });
  953. }
  954. if (j == 5) {
  955. this.Pull_On.on("touchstart", () => {
  956. cc.loader.loadRes("texture/AvatarProps/helmet3", cc.SpriteFrame, (err, spriteFrame) => {
  957. this.top_right_Sprite[0].spriteFrame = spriteFrame;
  958. });
  959. });
  960. //加载图片
  961. cc.loader.loadRes("texture/AvatarProps/helmet3", cc.SpriteFrame, function(err, spriteFrame) {
  962. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  963. });
  964. this.Item_Prop[0].string = "头盔";
  965. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  966. for (let itn = 0; itn < item_Attached_num; itn++) {
  967. let item_Attached = cc.instantiate(this.item_Attached)
  968. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  969. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  970. this.item_Attached_parent.addChild(item_Attached);
  971. }
  972. this.Pull_On.on("touchstart", () => {
  973. cc.loader.loadRes("texture/AvatarProps/helmet3", cc.SpriteFrame, (err, spriteFrame) => {
  974. this.top_right_Sprite[0].spriteFrame = spriteFrame;
  975. });
  976. this.defense_hp -= this.in_defense_hp;
  977. this.defense_hp += item_master_value;
  978. this.in_defense_hp = item_master_value;
  979. for (let it = 0; it < item_Attached_num; it++) {
  980. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  981. }
  982. this.init();
  983. this.Pool_OPe(j, item);
  984. });
  985. }
  986. if (j == 6) {
  987. this.Pull_On.on("touchstart", () => {
  988. cc.loader.loadRes("texture/AvatarProps/necklace3", cc.SpriteFrame, (err, spriteFrame) => {
  989. this.top_right_Sprite[1].spriteFrame = spriteFrame;
  990. });
  991. });
  992. //加载图片
  993. cc.loader.loadRes("texture/AvatarProps/necklace3", cc.SpriteFrame, function(err, spriteFrame) {
  994. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  995. });
  996. this.Item_Prop[0].string = "项链";
  997. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  998. for (let itn = 0; itn < item_Attached_num; itn++) {
  999. let item_Attached = cc.instantiate(this.item_Attached)
  1000. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1001. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1002. this.item_Attached_parent.addChild(item_Attached);
  1003. }
  1004. this.Pull_On.on("touchstart", () => {
  1005. cc.loader.loadRes("texture/AvatarProps/necklace3", cc.SpriteFrame, (err, spriteFrame) => {
  1006. this.top_right_Sprite[1].spriteFrame = spriteFrame;
  1007. });
  1008. this.crit_rate -= this.in_crit_rate;
  1009. this.crit_rate += item_master_value;
  1010. this.in_crit_rate = item_master_value;
  1011. for (let it = 0; it < item_Attached_num; it++) {
  1012. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1013. }
  1014. this.init();
  1015. this.Pool_OPe(j, item);
  1016. });
  1017. }
  1018. if (j == 7) {
  1019. this.Pull_On.on("touchstart", () => {
  1020. cc.loader.loadRes("texture/AvatarProps/shoe3", cc.SpriteFrame, (err, spriteFrame) => {
  1021. this.top_right_Sprite[8].spriteFrame = spriteFrame;
  1022. });
  1023. });
  1024. //加载图片
  1025. cc.loader.loadRes("texture/AvatarProps/shoe3", cc.SpriteFrame, function(err, spriteFrame) {
  1026. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1027. });
  1028. this.Item_Prop[0].string = "鞋子";
  1029. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1030. for (let itn = 0; itn < item_Attached_num; itn++) {
  1031. let item_Attached = cc.instantiate(this.item_Attached)
  1032. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1033. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1034. this.item_Attached_parent.addChild(item_Attached);
  1035. }
  1036. this.Pull_On.on("touchstart", () => {
  1037. cc.loader.loadRes("texture/AvatarProps/shoe3", cc.SpriteFrame, (err, spriteFrame) => {
  1038. this.top_right_Sprite[8].spriteFrame = spriteFrame;
  1039. });
  1040. this.dodge_endurance -= this.in_dodge_endurance;
  1041. this.dodge_endurance += item_master_value;
  1042. this.in_dodge_endurance = item_master_value;
  1043. for (let it = 0; it < item_Attached_num; it++) {
  1044. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1045. }
  1046. this.init();
  1047. this.Pool_OPe(j, item);
  1048. });
  1049. }
  1050. if (j == 8) {
  1051. this.Pull_On.on("touchstart", () => {
  1052. cc.loader.loadRes("texture/AvatarProps/wristsupport3", cc.SpriteFrame, (err, spriteFrame) => {
  1053. this.top_right_Sprite[6].spriteFrame = spriteFrame;
  1054. });
  1055. });
  1056. //加载图片
  1057. cc.loader.loadRes("texture/AvatarProps/wristsupport3", cc.SpriteFrame, function(err, spriteFrame) {
  1058. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1059. });
  1060. this.Item_Prop[0].string = "手套";
  1061. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1062. for (let itn = 0; itn < item_Attached_num; itn++) {
  1063. let item_Attached = cc.instantiate(this.item_Attached)
  1064. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1065. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1066. this.item_Attached_parent.addChild(item_Attached);
  1067. }
  1068. this.Pull_On.on("touchstart", () => {
  1069. cc.loader.loadRes("texture/AvatarProps/wristsupport3", cc.SpriteFrame, (err, spriteFrame) => {
  1070. this.top_right_Sprite[6].spriteFrame = spriteFrame;
  1071. });
  1072. this.recover_endurance -= this.in_recover_endurance;
  1073. this.recover_endurance += item_master_value;
  1074. this.in_recover_endurance = item_master_value;
  1075. for (let it = 0; it < item_Attached_num; it++) {
  1076. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1077. }
  1078. this.init();
  1079. this.Pool_OPe(j, item);
  1080. });
  1081. }
  1082. if (j == 9) {
  1083. this.Pull_On.on("touchstart", () => {
  1084. cc.loader.loadRes("texture/AvatarProps/kneecap3", cc.SpriteFrame, (err, spriteFrame) => {
  1085. this.top_right_Sprite[9].spriteFrame = spriteFrame;
  1086. });
  1087. });
  1088. //加载图片
  1089. cc.loader.loadRes("texture/AvatarProps/kneecap3", cc.SpriteFrame, function(err, spriteFrame) {
  1090. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1091. });
  1092. this.Item_Prop[0].string = "护膝";
  1093. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1094. for (let itn = 0; itn < item_Attached_num; itn++) {
  1095. let item_Attached = cc.instantiate(this.item_Attached)
  1096. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1097. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1098. this.item_Attached_parent.addChild(item_Attached);
  1099. }
  1100. this.Pull_On.on("touchstart", () => {
  1101. cc.loader.loadRes("texture/AvatarProps/kneecap3", cc.SpriteFrame, (err, spriteFrame) => {
  1102. this.top_right_Sprite[9].spriteFrame = spriteFrame;
  1103. });
  1104. this.recover_hp -= this.in_recover_hp;
  1105. this.recover_hp += item_master_value;
  1106. this.in_recover_hp = item_master_value;
  1107. for (let it = 0; it < item_Attached_num; it++) {
  1108. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1109. }
  1110. this.init();
  1111. this.Pool_OPe(j, item);
  1112. });
  1113. }
  1114. }, this);
  1115. return;
  1116. }
  1117. }
  1118. }
  1119. //黄 * (黄色装备:主属性随机1-4,随机两条副属性1-3)
  1120. if (gradetype == 3) {
  1121. for (let i = 0; i < this.Column_Right_Grid.childrenCount; i++) {
  1122. if (this.Column_Right_Grid.children[i].childrenCount == 0) {
  1123. let item = cc.instantiate(this.itemsArr_Y[j]);
  1124. this.Column_Right_Grid.children[i].addChild(item);
  1125. item.on(cc.Node.EventType.TOUCH_START, function() {
  1126. cc.audioEngine.playEffect(this.UiController.audioArr[0]);
  1127. this.item_Attached_parent.removeAllChildren();
  1128. if (j == 0) {
  1129. this.Pull_On.on("touchstart", () => {
  1130. cc.loader.loadRes("texture/AvatarProps/left_gloves4", cc.SpriteFrame, (err, spriteFrame) => {
  1131. this.top_right_Sprite[4].spriteFrame = spriteFrame;
  1132. });
  1133. });
  1134. //加载图片
  1135. cc.loader.loadRes("texture/AvatarProps/left_gloves4", cc.SpriteFrame, function(err, spriteFrame) {
  1136. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1137. });
  1138. this.Item_Prop[0].string = "左手拳套";
  1139. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1140. for (let itn = 0; itn < item_Attached_num; itn++) {
  1141. let item_Attached = cc.instantiate(this.item_Attached)
  1142. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1143. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1144. this.item_Attached_parent.addChild(item_Attached);
  1145. }
  1146. this.Pull_On.on("touchstart", () => {
  1147. cc.loader.loadRes("texture/AvatarProps/left_gloves4", cc.SpriteFrame, (err, spriteFrame) => {
  1148. this.top_right_Sprite[4].spriteFrame = spriteFrame;
  1149. });
  1150. this.damage -= this.in_damage;
  1151. this.damage += item_master_value;
  1152. this.in_damage = item_master_value;
  1153. for (let it = 0; it < item_Attached_num; it++) {
  1154. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1155. }
  1156. this.init();
  1157. this.Pool_OPe(j, item);
  1158. });
  1159. }
  1160. if (j == 1) {
  1161. this.Pull_On.on("touchstart", () => {
  1162. cc.loader.loadRes("texture/AvatarProps/right_gloves4", cc.SpriteFrame, (err, spriteFrame) => {
  1163. this.top_right_Sprite[5].spriteFrame = spriteFrame;
  1164. });
  1165. });
  1166. //加载图片
  1167. cc.loader.loadRes("texture/AvatarProps/right_gloves4", cc.SpriteFrame, function(err, spriteFrame) {
  1168. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1169. });
  1170. this.Item_Prop[0].string = "右手拳套";
  1171. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1172. for (let itn = 0; itn < item_Attached_num; itn++) {
  1173. let item_Attached = cc.instantiate(this.item_Attached)
  1174. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1175. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1176. this.item_Attached_parent.addChild(item_Attached);
  1177. }
  1178. this.Pull_On.on("touchstart", () => {
  1179. cc.loader.loadRes("texture/AvatarProps/right_gloves4", cc.SpriteFrame, (err, spriteFrame) => {
  1180. this.top_right_Sprite[5].spriteFrame = spriteFrame;
  1181. });
  1182. this.combo_rate -= this.in_combo_rate;
  1183. this.combo_rate += item_master_value;
  1184. this.in_combo_rate = item_master_value;
  1185. for (let it = 0; it < item_Attached_num; it++) {
  1186. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1187. }
  1188. this.init();
  1189. this.Pool_OPe(j, item);
  1190. });
  1191. }
  1192. if (j == 2) {
  1193. this.Pull_On.on("touchstart", () => {
  1194. cc.loader.loadRes("texture/AvatarProps/clothes4", cc.SpriteFrame, (err, spriteFrame) => {
  1195. this.top_right_Sprite[2].spriteFrame = spriteFrame;
  1196. });
  1197. });
  1198. //加载图片
  1199. cc.loader.loadRes("texture/AvatarProps/clothes4", cc.SpriteFrame, function(err, spriteFrame) {
  1200. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1201. });
  1202. this.Item_Prop[0].string = "衣服";
  1203. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1204. for (let itn = 0; itn < item_Attached_num; itn++) {
  1205. let item_Attached = cc.instantiate(this.item_Attached)
  1206. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1207. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1208. this.item_Attached_parent.addChild(item_Attached);
  1209. }
  1210. this.Pull_On.on("touchstart", () => {
  1211. cc.loader.loadRes("texture/AvatarProps/clothes4", cc.SpriteFrame, (err, spriteFrame) => {
  1212. this.top_right_Sprite[2].spriteFrame = spriteFrame;
  1213. });
  1214. this.defense -= this.in_defense;
  1215. this.defense += item_master_value;
  1216. this.in_defense = item_master_value;
  1217. for (let it = 0; it < item_Attached_num; it++) {
  1218. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1219. }
  1220. this.init();
  1221. this.Pool_OPe(j, item);
  1222. });
  1223. }
  1224. if (j == 3) {
  1225. this.Pull_On.on("touchstart", () => {
  1226. cc.loader.loadRes("texture/AvatarProps/trousers4", cc.SpriteFrame, (err, spriteFrame) => {
  1227. this.top_right_Sprite[7].spriteFrame = spriteFrame;
  1228. });
  1229. });
  1230. //加载图片
  1231. cc.loader.loadRes("texture/AvatarProps/trousers4", cc.SpriteFrame, function(err, spriteFrame) {
  1232. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1233. });
  1234. this.Item_Prop[0].string = "裤子";
  1235. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1236. for (let itn = 0; itn < item_Attached_num; itn++) {
  1237. let item_Attached = cc.instantiate(this.item_Attached)
  1238. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1239. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1240. this.item_Attached_parent.addChild(item_Attached);
  1241. }
  1242. this.Pull_On.on("touchstart", () => {
  1243. cc.loader.loadRes("texture/AvatarProps/trousers4", cc.SpriteFrame, (err, spriteFrame) => {
  1244. this.top_right_Sprite[7].spriteFrame = spriteFrame;
  1245. });
  1246. this.hp -= this.in_hp;
  1247. this.maxhp -= this.in_maxhp;
  1248. this.hp += item_master_value;
  1249. this.maxhp += item_master_value;
  1250. this.in_hp = item_master_value;
  1251. this.in_maxhp = item_master_value;
  1252. for (let it = 0; it < item_Attached_num; it++) {
  1253. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1254. }
  1255. this.init();
  1256. this.Pool_OPe(j, item);
  1257. });
  1258. }
  1259. if (j == 4) {
  1260. this.Pull_On.on("touchstart", () => {
  1261. cc.loader.loadRes("texture/AvatarProps/belt4", cc.SpriteFrame, (err, spriteFrame) => {
  1262. this.top_right_Sprite[3].spriteFrame = spriteFrame;
  1263. });
  1264. });
  1265. //加载图片
  1266. cc.loader.loadRes("texture/AvatarProps/belt4", cc.SpriteFrame, function(err, spriteFrame) {
  1267. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1268. });
  1269. this.Item_Prop[0].string = "腰带";
  1270. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1271. for (let itn = 0; itn < item_Attached_num; itn++) {
  1272. let item_Attached = cc.instantiate(this.item_Attached)
  1273. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1274. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1275. this.item_Attached_parent.addChild(item_Attached);
  1276. }
  1277. this.Pull_On.on("touchstart", () => {
  1278. cc.loader.loadRes("texture/AvatarProps/belt4", cc.SpriteFrame, (err, spriteFrame) => {
  1279. this.top_right_Sprite[3].spriteFrame = spriteFrame;
  1280. });
  1281. this.endurance -= this.in_endurance;
  1282. this.maxendurance -= this.in_maxendurance;
  1283. this.endurance += item_master_value;
  1284. this.maxendurance += item_master_value;
  1285. this.in_endurance = item_master_value;
  1286. this.in_maxendurance = item_master_value;
  1287. for (let it = 0; it < item_Attached_num; it++) {
  1288. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1289. }
  1290. this.init();
  1291. this.Pool_OPe(j, item);
  1292. });
  1293. }
  1294. if (j == 5) {
  1295. this.Pull_On.on("touchstart", () => {
  1296. cc.loader.loadRes("texture/AvatarProps/helmet4", cc.SpriteFrame, (err, spriteFrame) => {
  1297. this.top_right_Sprite[0].spriteFrame = spriteFrame;
  1298. });
  1299. });
  1300. //加载图片
  1301. cc.loader.loadRes("texture/AvatarProps/helmet4", cc.SpriteFrame, function(err, spriteFrame) {
  1302. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1303. });
  1304. this.Item_Prop[0].string = "头盔";
  1305. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1306. for (let itn = 0; itn < item_Attached_num; itn++) {
  1307. let item_Attached = cc.instantiate(this.item_Attached)
  1308. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1309. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1310. this.item_Attached_parent.addChild(item_Attached);
  1311. }
  1312. this.Pull_On.on("touchstart", () => {
  1313. cc.loader.loadRes("texture/AvatarProps/helmet4", cc.SpriteFrame, (err, spriteFrame) => {
  1314. this.top_right_Sprite[0].spriteFrame = spriteFrame;
  1315. });
  1316. this.defense_hp -= this.in_defense_hp;
  1317. this.defense_hp += item_master_value;
  1318. this.in_defense_hp = item_master_value;
  1319. for (let it = 0; it < item_Attached_num; it++) {
  1320. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1321. }
  1322. this.init();
  1323. this.Pool_OPe(j, item);
  1324. });
  1325. }
  1326. if (j == 6) {
  1327. this.Pull_On.on("touchstart", () => {
  1328. cc.loader.loadRes("texture/AvatarProps/necklace4", cc.SpriteFrame, (err, spriteFrame) => {
  1329. this.top_right_Sprite[1].spriteFrame = spriteFrame;
  1330. });
  1331. });
  1332. //加载图片
  1333. cc.loader.loadRes("texture/AvatarProps/necklace4", cc.SpriteFrame, function(err, spriteFrame) {
  1334. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1335. });
  1336. this.Item_Prop[0].string = "项链";
  1337. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1338. for (let itn = 0; itn < item_Attached_num; itn++) {
  1339. let item_Attached = cc.instantiate(this.item_Attached)
  1340. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1341. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1342. this.item_Attached_parent.addChild(item_Attached);
  1343. }
  1344. this.Pull_On.on("touchstart", () => {
  1345. cc.loader.loadRes("texture/AvatarProps/necklace4", cc.SpriteFrame, (err, spriteFrame) => {
  1346. this.top_right_Sprite[1].spriteFrame = spriteFrame;
  1347. });
  1348. this.crit_rate -= this.in_crit_rate;
  1349. this.crit_rate += item_master_value;
  1350. this.in_crit_rate = item_master_value;
  1351. for (let it = 0; it < item_Attached_num; it++) {
  1352. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1353. }
  1354. this.init();
  1355. this.Pool_OPe(j, item);
  1356. });
  1357. }
  1358. if (j == 7) {
  1359. this.Pull_On.on("touchstart", () => {
  1360. cc.loader.loadRes("texture/AvatarProps/shoe4", cc.SpriteFrame, (err, spriteFrame) => {
  1361. this.top_right_Sprite[8].spriteFrame = spriteFrame;
  1362. });
  1363. });
  1364. //加载图片
  1365. cc.loader.loadRes("texture/AvatarProps/shoe4", cc.SpriteFrame, function(err, spriteFrame) {
  1366. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1367. });
  1368. this.Item_Prop[0].string = "鞋子";
  1369. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1370. for (let itn = 0; itn < item_Attached_num; itn++) {
  1371. let item_Attached = cc.instantiate(this.item_Attached)
  1372. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1373. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1374. this.item_Attached_parent.addChild(item_Attached);
  1375. }
  1376. this.Pull_On.on("touchstart", () => {
  1377. cc.loader.loadRes("texture/AvatarProps/shoe4", cc.SpriteFrame, (err, spriteFrame) => {
  1378. this.top_right_Sprite[8].spriteFrame = spriteFrame;
  1379. });
  1380. this.dodge_endurance -= this.in_dodge_endurance;
  1381. this.dodge_endurance += item_master_value;
  1382. this.in_dodge_endurance = item_master_value;
  1383. for (let it = 0; it < item_Attached_num; it++) {
  1384. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1385. }
  1386. this.init();
  1387. this.Pool_OPe(j, item);
  1388. });
  1389. }
  1390. if (j == 8) {
  1391. this.Pull_On.on("touchstart", () => {
  1392. cc.loader.loadRes("texture/AvatarProps/wristsupport4", cc.SpriteFrame, (err, spriteFrame) => {
  1393. this.top_right_Sprite[6].spriteFrame = spriteFrame;
  1394. });
  1395. });
  1396. //加载图片
  1397. cc.loader.loadRes("texture/AvatarProps/wristsupport4", cc.SpriteFrame, function(err, spriteFrame) {
  1398. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1399. });
  1400. this.Item_Prop[0].string = "手套";
  1401. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1402. for (let itn = 0; itn < item_Attached_num; itn++) {
  1403. let item_Attached = cc.instantiate(this.item_Attached)
  1404. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1405. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1406. this.item_Attached_parent.addChild(item_Attached);
  1407. }
  1408. this.Pull_On.on("touchstart", () => {
  1409. cc.loader.loadRes("texture/AvatarProps/wristsupport4", cc.SpriteFrame, (err, spriteFrame) => {
  1410. this.top_right_Sprite[6].spriteFrame = spriteFrame;
  1411. });
  1412. this.recover_endurance -= this.in_recover_endurance;
  1413. this.recover_endurance += item_master_value;
  1414. this.in_recover_endurance = item_master_value;
  1415. for (let it = 0; it < item_Attached_num; it++) {
  1416. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1417. }
  1418. this.init();
  1419. this.Pool_OPe(j, item);
  1420. });
  1421. }
  1422. if (j == 9) {
  1423. this.Pull_On.on("touchstart", () => {
  1424. cc.loader.loadRes("texture/AvatarProps/kneecap4", cc.SpriteFrame, (err, spriteFrame) => {
  1425. this.top_right_Sprite[9].spriteFrame = spriteFrame;
  1426. });
  1427. });
  1428. //加载图片
  1429. cc.loader.loadRes("texture/AvatarProps/kneecap4", cc.SpriteFrame, function(err, spriteFrame) {
  1430. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1431. });
  1432. this.Item_Prop[0].string = "护膝";
  1433. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1434. for (let itn = 0; itn < item_Attached_num; itn++) {
  1435. let item_Attached = cc.instantiate(this.item_Attached)
  1436. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1437. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1438. this.item_Attached_parent.addChild(item_Attached);
  1439. }
  1440. this.Pull_On.on("touchstart", () => {
  1441. cc.loader.loadRes("texture/AvatarProps/kneecap4", cc.SpriteFrame, (err, spriteFrame) => {
  1442. this.top_right_Sprite[9].spriteFrame = spriteFrame;
  1443. });
  1444. this.recover_hp -= this.in_recover_hp;
  1445. this.recover_hp += item_master_value;
  1446. this.in_recover_hp = item_master_value;
  1447. for (let it = 0; it < item_Attached_num; it++) {
  1448. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1449. }
  1450. this.init();
  1451. this.Pool_OPe(j, item);
  1452. });
  1453. }
  1454. }, this);
  1455. return;
  1456. }
  1457. }
  1458. }
  1459. //红 * (红色装备:主属性随机1-5,随机三条副属性1-4)
  1460. if (gradetype == 4) {
  1461. for (let i = 0; i < this.Column_Right_Grid.childrenCount; i++) {
  1462. if (this.Column_Right_Grid.children[i].childrenCount == 0) {
  1463. let item = cc.instantiate(this.itemsArr_R[j]);
  1464. this.Column_Right_Grid.children[i].addChild(item);
  1465. item.on(cc.Node.EventType.TOUCH_START, function() {
  1466. cc.audioEngine.playEffect(this.UiController.audioArr[0]);
  1467. this.item_Attached_parent.removeAllChildren();
  1468. if (j == 0) {
  1469. this.Pull_On.on("touchstart", () => {
  1470. cc.loader.loadRes("texture/AvatarProps/left_gloves4", cc.SpriteFrame, (err, spriteFrame) => {
  1471. this.top_right_Sprite[4].spriteFrame = spriteFrame;
  1472. });
  1473. });
  1474. //加载图片
  1475. cc.loader.loadRes("texture/AvatarProps/left_gloves5", cc.SpriteFrame, function(err, spriteFrame) {
  1476. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1477. });
  1478. this.Item_Prop[0].string = "左手拳套";
  1479. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1480. for (let itn = 0; itn < item_Attached_num; itn++) {
  1481. let item_Attached = cc.instantiate(this.item_Attached)
  1482. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1483. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1484. this.item_Attached_parent.addChild(item_Attached);
  1485. }
  1486. this.Pull_On.on("touchstart", () => {
  1487. cc.loader.loadRes("texture/AvatarProps/left_gloves5", cc.SpriteFrame, (err, spriteFrame) => {
  1488. this.top_right_Sprite[4].spriteFrame = spriteFrame;
  1489. });
  1490. this.damage -= this.in_damage;
  1491. this.damage += item_master_value;
  1492. this.in_damage = item_master_value;
  1493. for (let it = 0; it < item_Attached_num; it++) {
  1494. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1495. }
  1496. this.init();
  1497. this.Pool_OPe(j, item);
  1498. });
  1499. }
  1500. if (j == 1) {
  1501. this.Pull_On.on("touchstart", () => {
  1502. cc.loader.loadRes("texture/AvatarProps/right_gloves5", cc.SpriteFrame, (err, spriteFrame) => {
  1503. this.top_right_Sprite[5].spriteFrame = spriteFrame;
  1504. });
  1505. });
  1506. //加载图片
  1507. cc.loader.loadRes("texture/AvatarProps/right_gloves5", cc.SpriteFrame, function(err, spriteFrame) {
  1508. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1509. });
  1510. this.Item_Prop[0].string = "右手拳套";
  1511. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1512. for (let itn = 0; itn < item_Attached_num; itn++) {
  1513. let item_Attached = cc.instantiate(this.item_Attached)
  1514. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1515. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1516. this.item_Attached_parent.addChild(item_Attached);
  1517. }
  1518. this.Pull_On.on("touchstart", () => {
  1519. cc.loader.loadRes("texture/AvatarProps/right_gloves5", cc.SpriteFrame, (err, spriteFrame) => {
  1520. this.top_right_Sprite[5].spriteFrame = spriteFrame;
  1521. });
  1522. this.combo_rate -= this.in_combo_rate;
  1523. this.combo_rate += item_master_value;
  1524. this.in_combo_rate = item_master_value;
  1525. for (let it = 0; it < item_Attached_num; it++) {
  1526. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1527. }
  1528. this.init();
  1529. this.Pool_OPe(j, item);
  1530. });
  1531. }
  1532. if (j == 2) {
  1533. this.Pull_On.on("touchstart", () => {
  1534. cc.loader.loadRes("texture/AvatarProps/clothes5", cc.SpriteFrame, (err, spriteFrame) => {
  1535. this.top_right_Sprite[2].spriteFrame = spriteFrame;
  1536. });
  1537. });
  1538. //加载图片
  1539. cc.loader.loadRes("texture/AvatarProps/clothes5", cc.SpriteFrame, function(err, spriteFrame) {
  1540. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1541. });
  1542. this.Item_Prop[0].string = "衣服";
  1543. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1544. for (let itn = 0; itn < item_Attached_num; itn++) {
  1545. let item_Attached = cc.instantiate(this.item_Attached)
  1546. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1547. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1548. this.item_Attached_parent.addChild(item_Attached);
  1549. }
  1550. this.Pull_On.on("touchstart", () => {
  1551. cc.loader.loadRes("texture/AvatarProps/clothes5", cc.SpriteFrame, (err, spriteFrame) => {
  1552. this.top_right_Sprite[2].spriteFrame = spriteFrame;
  1553. });
  1554. this.defense -= this.in_defense;
  1555. this.defense += item_master_value;
  1556. this.in_defense = item_master_value;
  1557. for (let it = 0; it < item_Attached_num; it++) {
  1558. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1559. }
  1560. this.init();
  1561. this.Pool_OPe(j, item);
  1562. });
  1563. }
  1564. if (j == 3) {
  1565. this.Pull_On.on("touchstart", () => {
  1566. cc.loader.loadRes("texture/AvatarProps/trousers5", cc.SpriteFrame, (err, spriteFrame) => {
  1567. this.top_right_Sprite[7].spriteFrame = spriteFrame;
  1568. });
  1569. });
  1570. //加载图片
  1571. cc.loader.loadRes("texture/AvatarProps/trousers5", cc.SpriteFrame, function(err, spriteFrame) {
  1572. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1573. });
  1574. this.Item_Prop[0].string = "裤子";
  1575. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1576. for (let itn = 0; itn < item_Attached_num; itn++) {
  1577. let item_Attached = cc.instantiate(this.item_Attached)
  1578. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1579. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1580. this.item_Attached_parent.addChild(item_Attached);
  1581. }
  1582. this.Pull_On.on("touchstart", () => {
  1583. cc.loader.loadRes("texture/AvatarProps/trousers5", cc.SpriteFrame, (err, spriteFrame) => {
  1584. this.top_right_Sprite[7].spriteFrame = spriteFrame;
  1585. });
  1586. this.hp -= this.in_hp;
  1587. this.maxhp -= this.in_maxhp;
  1588. this.hp += item_master_value;
  1589. this.maxhp += item_master_value;
  1590. this.in_hp = item_master_value;
  1591. this.in_maxhp = item_master_value;
  1592. for (let it = 0; it < item_Attached_num; it++) {
  1593. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1594. }
  1595. this.init();
  1596. this.Pool_OPe(j, item);
  1597. });
  1598. }
  1599. if (j == 4) {
  1600. this.Pull_On.on("touchstart", () => {
  1601. cc.loader.loadRes("texture/AvatarProps/belt5", cc.SpriteFrame, (err, spriteFrame) => {
  1602. this.top_right_Sprite[3].spriteFrame = spriteFrame;
  1603. });
  1604. });
  1605. //加载图片
  1606. cc.loader.loadRes("texture/AvatarProps/belt5", cc.SpriteFrame, function(err, spriteFrame) {
  1607. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1608. });
  1609. this.Item_Prop[0].string = "腰带";
  1610. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1611. for (let itn = 0; itn < item_Attached_num; itn++) {
  1612. let item_Attached = cc.instantiate(this.item_Attached)
  1613. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1614. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1615. this.item_Attached_parent.addChild(item_Attached);
  1616. }
  1617. this.Pull_On.on("touchstart", () => {
  1618. cc.loader.loadRes("texture/AvatarProps/belt5", cc.SpriteFrame, (err, spriteFrame) => {
  1619. this.top_right_Sprite[3].spriteFrame = spriteFrame;
  1620. });
  1621. this.endurance -= this.in_endurance;
  1622. this.maxendurance -= this.in_maxendurance;
  1623. this.endurance += item_master_value;
  1624. this.maxendurance += item_master_value;
  1625. this.in_endurance = item_master_value;
  1626. this.in_maxendurance = item_master_value;
  1627. for (let it = 0; it < item_Attached_num; it++) {
  1628. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1629. }
  1630. this.init();
  1631. this.Pool_OPe(j, item);
  1632. });
  1633. }
  1634. if (j == 5) {
  1635. this.Pull_On.on("touchstart", () => {
  1636. cc.loader.loadRes("texture/AvatarProps/helmet5", cc.SpriteFrame, (err, spriteFrame) => {
  1637. this.top_right_Sprite[0].spriteFrame = spriteFrame;
  1638. });
  1639. });
  1640. //加载图片
  1641. cc.loader.loadRes("texture/AvatarProps/helmet5", cc.SpriteFrame, function(err, spriteFrame) {
  1642. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1643. });
  1644. this.Item_Prop[0].string = "头盔";
  1645. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1646. for (let itn = 0; itn < item_Attached_num; itn++) {
  1647. let item_Attached = cc.instantiate(this.item_Attached)
  1648. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1649. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1650. this.item_Attached_parent.addChild(item_Attached);
  1651. }
  1652. this.Pull_On.on("touchstart", () => {
  1653. cc.loader.loadRes("texture/AvatarProps/helmet5", cc.SpriteFrame, (err, spriteFrame) => {
  1654. this.top_right_Sprite[0].spriteFrame = spriteFrame;
  1655. });
  1656. this.defense_hp -= this.in_defense_hp;
  1657. this.defense_hp += item_master_value;
  1658. this.in_defense_hp = item_master_value;
  1659. for (let it = 0; it < item_Attached_num; it++) {
  1660. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1661. }
  1662. this.init();
  1663. this.Pool_OPe(j, item);
  1664. });
  1665. }
  1666. if (j == 6) {
  1667. this.Pull_On.on("touchstart", () => {
  1668. cc.loader.loadRes("texture/AvatarProps/necklace5", cc.SpriteFrame, (err, spriteFrame) => {
  1669. this.top_right_Sprite[1].spriteFrame = spriteFrame;
  1670. });
  1671. });
  1672. //加载图片
  1673. cc.loader.loadRes("texture/AvatarProps/necklace5", cc.SpriteFrame, function(err, spriteFrame) {
  1674. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1675. });
  1676. this.Item_Prop[0].string = "项链";
  1677. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1678. for (let itn = 0; itn < item_Attached_num; itn++) {
  1679. let item_Attached = cc.instantiate(this.item_Attached)
  1680. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1681. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1682. this.item_Attached_parent.addChild(item_Attached);
  1683. }
  1684. this.Pull_On.on("touchstart", () => {
  1685. cc.loader.loadRes("texture/AvatarProps/necklace5", cc.SpriteFrame, (err, spriteFrame) => {
  1686. this.top_right_Sprite[1].spriteFrame = spriteFrame;
  1687. });
  1688. this.crit_rate -= this.in_crit_rate;
  1689. this.crit_rate += item_master_value;
  1690. this.in_crit_rate = item_master_value;
  1691. for (let it = 0; it < item_Attached_num; it++) {
  1692. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1693. }
  1694. this.init();
  1695. this.Pool_OPe(j, item);
  1696. });
  1697. }
  1698. if (j == 7) {
  1699. this.Pull_On.on("touchstart", () => {
  1700. cc.loader.loadRes("texture/AvatarProps/shoe5", cc.SpriteFrame, (err, spriteFrame) => {
  1701. this.top_right_Sprite[8].spriteFrame = spriteFrame;
  1702. });
  1703. });
  1704. //加载图片
  1705. cc.loader.loadRes("texture/AvatarProps/shoe5", cc.SpriteFrame, function(err, spriteFrame) {
  1706. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1707. });
  1708. this.Item_Prop[0].string = "鞋子";
  1709. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1710. for (let itn = 0; itn < item_Attached_num; itn++) {
  1711. let item_Attached = cc.instantiate(this.item_Attached)
  1712. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1713. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1714. this.item_Attached_parent.addChild(item_Attached);
  1715. }
  1716. this.Pull_On.on("touchstart", () => {
  1717. cc.loader.loadRes("texture/AvatarProps/shoe5", cc.SpriteFrame, (err, spriteFrame) => {
  1718. this.top_right_Sprite[8].spriteFrame = spriteFrame;
  1719. });
  1720. this.dodge_endurance -= this.in_dodge_endurance;
  1721. this.dodge_endurance += item_master_value;
  1722. this.in_dodge_endurance = item_master_value;
  1723. for (let it = 0; it < item_Attached_num; it++) {
  1724. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1725. }
  1726. this.init();
  1727. this.Pool_OPe(j, item);
  1728. });
  1729. }
  1730. if (j == 8) {
  1731. this.Pull_On.on("touchstart", () => {
  1732. cc.loader.loadRes("texture/AvatarProps/wristsupport5", cc.SpriteFrame, (err, spriteFrame) => {
  1733. this.top_right_Sprite[6].spriteFrame = spriteFrame;
  1734. });
  1735. });
  1736. //加载图片
  1737. cc.loader.loadRes("texture/AvatarProps/wristsupport5", cc.SpriteFrame, function(err, spriteFrame) {
  1738. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1739. });
  1740. this.Item_Prop[0].string = "手套";
  1741. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1742. for (let itn = 0; itn < item_Attached_num; itn++) {
  1743. let item_Attached = cc.instantiate(this.item_Attached)
  1744. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1745. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1746. this.item_Attached_parent.addChild(item_Attached);
  1747. }
  1748. this.Pull_On.on("touchstart", () => {
  1749. cc.loader.loadRes("texture/AvatarProps/wristsupport5", cc.SpriteFrame, (err, spriteFrame) => {
  1750. this.top_right_Sprite[6].spriteFrame = spriteFrame;
  1751. });
  1752. this.recover_endurance -= this.in_recover_endurance;
  1753. this.recover_endurance += item_master_value;
  1754. this.in_recover_endurance = item_master_value;
  1755. for (let it = 0; it < item_Attached_num; it++) {
  1756. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1757. }
  1758. this.init();
  1759. this.Pool_OPe(j, item);
  1760. });
  1761. }
  1762. if (j == 9) {
  1763. this.Pull_On.on("touchstart", () => {
  1764. cc.loader.loadRes("texture/AvatarProps/kneecap5", cc.SpriteFrame, (err, spriteFrame) => {
  1765. this.top_right_Sprite[9].spriteFrame = spriteFrame;
  1766. });
  1767. });
  1768. //加载图片
  1769. cc.loader.loadRes("texture/AvatarProps/kneecap5", cc.SpriteFrame, function(err, spriteFrame) {
  1770. cc.find("Canvas/Interface_Info/Panel_Middle/Bg/Column_Left/Item_Bg/Item").getComponent(cc.Sprite).spriteFrame = spriteFrame;
  1771. });
  1772. this.Item_Prop[0].string = "护膝";
  1773. this.Item_Prop[1].string = item_master_type + "+" + item_master_value;
  1774. for (let itn = 0; itn < item_Attached_num; itn++) {
  1775. let item_Attached = cc.instantiate(this.item_Attached)
  1776. let item_Attached_Label = item_attached_nameArr[itn] + "+" + item_attached_valueArr[itn];
  1777. item_Attached.getComponent(cc.Label).string = item_Attached_Label;
  1778. this.item_Attached_parent.addChild(item_Attached);
  1779. }
  1780. this.Pull_On.on("touchstart", () => {
  1781. cc.loader.loadRes("texture/AvatarProps/kneecap51", cc.SpriteFrame, (err, spriteFrame) => {
  1782. this.top_right_Sprite[9].spriteFrame = spriteFrame;
  1783. });
  1784. this.recover_hp -= this.in_recover_hp;
  1785. this.recover_hp += item_master_value;
  1786. this.in_recover_hp = item_master_value;
  1787. for (let it = 0; it < item_Attached_num; it++) {
  1788. this.AddAttribute(item_Attached_typeArr[it], item_attached_valueArr[it]);
  1789. }
  1790. this.init();
  1791. this.Pool_OPe(j, item);
  1792. });
  1793. }
  1794. }, this);
  1795. return;
  1796. }
  1797. }
  1798. }
  1799. }
  1800. }
  1801. },
  1802. //添加属性
  1803. AddAttribute(Attached_type, Attached_value) {
  1804. if (Attached_type == 0) { //攻击
  1805. this.damage -= this.in_attached_damage;
  1806. this.damage += Attached_value;
  1807. this.in_attached_damage = Attached_value;
  1808. }
  1809. if (Attached_type == 1) { //连击率
  1810. this.combo_rate -= this.in_attached_combo_rate;
  1811. this.combo_rate += Attached_value;
  1812. this.in_attached_combo_rate = Attached_value;
  1813. }
  1814. if (Attached_type == 2) { //防御
  1815. this.defense -= this.in_attached_defense;
  1816. this.defense += Attached_value;
  1817. this.in_attached_defense = Attached_value;
  1818. }
  1819. if (Attached_type == 3) { //血量
  1820. this.hp -= this.in_attached_hp;
  1821. this.hp += Attached_value;
  1822. this.in_attached_hp = Attached_value;
  1823. this.maxhp -= this.in_attached_maxhp;
  1824. this.maxhp += Attached_value;
  1825. this.in_attached_maxhp = Attached_value;
  1826. }
  1827. if (Attached_type == 4) { //蓝量
  1828. this.endurance -= this.in_attached_endurance;
  1829. this.endurance += Attached_value;
  1830. this.in_attached_endurance = Attached_value;
  1831. this.maxendurance -= this.in_attached_maxendurance;
  1832. this.maxendurance += Attached_value;
  1833. this.in_attached_maxendurance = Attached_value;
  1834. }
  1835. if (Attached_type == 5) { //格挡回血量
  1836. this.defense_hp -= this.in_attached_defense_hp;
  1837. this.defense_hp += Attached_value;
  1838. this.in_attached_defense_hp = Attached_value;
  1839. }
  1840. if (Attached_type == 6) { //暴击率
  1841. this.crit_rate -= this.in_attached_crit_rate;
  1842. this.crit_rate += Attached_value;
  1843. this.in_attached_crit_rate = Attached_value;
  1844. }
  1845. if (Attached_type == 7) { //闪避回蓝量
  1846. this.dodge_endurance -= this.in_attached_dodge_endurance;
  1847. this.dodge_endurance += Attached_value;
  1848. this.in_attached_dodge_endurance = Attached_value;
  1849. }
  1850. if (Attached_type == 8) { //被动回蓝
  1851. this.recover_endurance -= this.in_attached_recover_endurance;
  1852. this.recover_endurance += Attached_value;
  1853. this.in_attached_recover_endurance = Attached_value;
  1854. }
  1855. if (Attached_type == 9) { //被动回血
  1856. this.recover_hp -= this.in_attached_recover_hp;
  1857. this.recover_hp += Attached_value;
  1858. this.in_attached_recover_hp = Attached_value;
  1859. }
  1860. },
  1861. //装备
  1862. InEquipment() {
  1863. for (let i = 0; i < this.Column_Right_Grid.childrenCount; i++) {
  1864. if (this.Column_Right_Grid.children[i].childrenCount == 0) {
  1865. }
  1866. }
  1867. },
  1868. Pool_OPe(type, node) {
  1869. if (type = 0) {
  1870. if (this.ItemPool_type1.size() <= 0) {
  1871. this.ItemPool_type1.put(node);
  1872. } else {
  1873. let In_item;
  1874. let In_prarent;
  1875. In_item = this.ItemPool_type1.get();
  1876. this.ItemPool_type1.put(node);
  1877. for (let i = 0; i < this.Column_Right_Grid.childrenCount; i++) {
  1878. if (this.Column_Right_Grid.children[i].childrenCount == 0) {
  1879. In_prarent = this.Column_Right_Grid.children[i];
  1880. }
  1881. }
  1882. In_item.parent = In_prarent;
  1883. }
  1884. }
  1885. if (type = 1) {
  1886. if (this.ItemPool_type2.size() <= 0) {
  1887. this.ItemPool_type2.put(node);
  1888. } else {
  1889. let In_item;
  1890. let In_prarent;
  1891. In_item = this.ItemPool_type2.get();
  1892. this.ItemPool_type2.put(node);
  1893. for (let i = 0; i < this.Column_Right_Grid.childrenCount; i++) {
  1894. if (this.Column_Right_Grid.children[i].childrenCount == 0) {
  1895. In_prarent = this.Column_Right_Grid.children[i];
  1896. }
  1897. }
  1898. In_item.parent = In_prarent;
  1899. }
  1900. }
  1901. if (type = 2) {
  1902. if (this.ItemPool_type3.size() <= 0) {
  1903. this.ItemPool_type3.put(node);
  1904. } else {
  1905. let In_item;
  1906. let In_prarent;
  1907. In_item = this.ItemPool_type3.get();
  1908. this.ItemPool_type3.put(node);
  1909. for (let i = 0; i < this.Column_Right_Grid.childrenCount; i++) {
  1910. if (this.Column_Right_Grid.children[i].childrenCount == 0) {
  1911. In_prarent = this.Column_Right_Grid.children[i];
  1912. }
  1913. }
  1914. In_item.parent = In_prarent;
  1915. }
  1916. }
  1917. if (type = 3) {
  1918. if (this.ItemPool_type4.size() <= 0) {
  1919. this.ItemPool_type4.put(node);
  1920. } else {
  1921. let In_item;
  1922. let In_prarent;
  1923. In_item = this.ItemPool_type4.get();
  1924. this.ItemPool_type4.put(node);
  1925. for (let i = 0; i < this.Column_Right_Grid.childrenCount; i++) {
  1926. if (this.Column_Right_Grid.children[i].childrenCount == 0) {
  1927. In_prarent = this.Column_Right_Grid.children[i];
  1928. }
  1929. }
  1930. In_item.parent = In_prarent;
  1931. }
  1932. }
  1933. if (type = 4) {
  1934. if (this.ItemPool_type5.size() <= 0) {
  1935. this.ItemPool_type5.put(node);
  1936. } else {
  1937. let In_item;
  1938. let In_prarent;
  1939. In_item = this.ItemPool_type5.get();
  1940. this.ItemPool_type5.put(node);
  1941. for (let i = 0; i < this.Column_Right_Grid.childrenCount; i++) {
  1942. if (this.Column_Right_Grid.children[i].childrenCount == 0) {
  1943. In_prarent = this.Column_Right_Grid.children[i];
  1944. }
  1945. }
  1946. In_item.parent = In_prarent;
  1947. }
  1948. }
  1949. if (type = 5) {
  1950. if (this.ItemPool_type6.size() <= 0) {
  1951. this.ItemPool_type6.put(node);
  1952. } else {
  1953. let In_item;
  1954. let In_prarent;
  1955. In_item = this.ItemPool_type6.get();
  1956. this.ItemPool_type6.put(node);
  1957. for (let i = 0; i < this.Column_Right_Grid.childrenCount; i++) {
  1958. if (this.Column_Right_Grid.children[i].childrenCount == 0) {
  1959. In_prarent = this.Column_Right_Grid.children[i];
  1960. }
  1961. }
  1962. In_item.parent = In_prarent;
  1963. }
  1964. }
  1965. if (type = 6) {
  1966. if (this.ItemPool_type7.size() <= 0) {
  1967. this.ItemPool_type7.put(node);
  1968. } else {
  1969. let In_item;
  1970. let In_prarent;
  1971. In_item = this.ItemPool_type7.get();
  1972. this.ItemPool_type7.put(node);
  1973. for (let i = 0; i < this.Column_Right_Grid.childrenCount; i++) {
  1974. if (this.Column_Right_Grid.children[i].childrenCount == 0) {
  1975. In_prarent = this.Column_Right_Grid.children[i];
  1976. }
  1977. }
  1978. In_item.parent = In_prarent;
  1979. }
  1980. }
  1981. if (type = 7) {
  1982. if (this.ItemPool_type8.size() <= 0) {
  1983. this.ItemPool_type8.put(node);
  1984. } else {
  1985. let In_item;
  1986. let In_prarent;
  1987. In_item = this.ItemPool_type8.get();
  1988. this.ItemPool_type8.put(node);
  1989. for (let i = 0; i < this.Column_Right_Grid.childrenCount; i++) {
  1990. if (this.Column_Right_Grid.children[i].childrenCount == 0) {
  1991. In_prarent = this.Column_Right_Grid.children[i];
  1992. }
  1993. }
  1994. In_item.parent = In_prarent;
  1995. }
  1996. }
  1997. if (type = 8) {
  1998. if (this.ItemPool_type9.size() <= 0) {
  1999. this.ItemPool_type9.put(node);
  2000. } else {
  2001. let In_item;
  2002. let In_prarent;
  2003. In_item = this.ItemPool_type9.get();
  2004. this.ItemPool_type9.put(node);
  2005. for (let i = 0; i < this.Column_Right_Grid.childrenCount; i++) {
  2006. if (this.Column_Right_Grid.children[i].childrenCount == 0) {
  2007. In_prarent = this.Column_Right_Grid.children[i];
  2008. }
  2009. }
  2010. In_item.parent = In_prarent;
  2011. }
  2012. }
  2013. if (type = 9) {
  2014. if (this.ItemPool_type10.size() <= 0) {
  2015. this.ItemPool_type10.put(node);
  2016. } else {
  2017. let In_item;
  2018. let In_prarent;
  2019. In_item = this.ItemPool_type10.get();
  2020. this.ItemPool_type10.put(node);
  2021. for (let i = 0; i < this.Column_Right_Grid.childrenCount; i++) {
  2022. if (this.Column_Right_Grid.children[i].childrenCount == 0) {
  2023. In_prarent = this.Column_Right_Grid.children[i];
  2024. }
  2025. }
  2026. In_item.parent = In_prarent;
  2027. }
  2028. }
  2029. },
  2030. });