源战役客户端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1093 lines
44 KiB

  1. HorseEquipInfoTips = HorseEquipInfoTips or BaseClass(EquipToolTips)
  2. HorseEquipInfoTips.ONLY_SHOW = 0 --只展示信息
  3. -- HorseEquipInfoTips.COMPOSE_OFF = 1 --显示熔炼按钮,点击后 熔炼坐骑装备物品
  4. -- HorseEquipInfoTips.OFF_AND_REPLACE = 2 --显示穿戴和脱下按钮
  5. HorseEquipInfoTips.OFF = 1 --穿戴状态 只显示脱下 升级
  6. HorseEquipInfoTips.WEAR = 2 --背包状态 只显示穿戴 熔炼
  7. HorseEquipInfoTips.ALL = 3 --所有的坐骑装备按钮都显示
  8. HorseEquipInfoTips.NONE = 4 --所有按钮都不显示
  9. HorseEquipInfoTips.FORGE = 5 --打造状态 只显示打造按钮
  10. HorseEquipInfoTips.FORGE_GET_NEW = 6 --打造获得新装备 与旧装备的对比
  11. HorseEquipInfoTips.UNKNOWN = 7 --打造 提前显示的打造成功的装备 显示?号
  12. HorseEquipInfoTips.MATERIAL = 8 --打造的材料替换和取出
  13. function HorseEquipInfoTips:__init()
  14. self.base_file = "common"
  15. self.layout_file = "EquipToolTips"
  16. self.layer_name = "Top"
  17. self.use_background = true
  18. self.click_bg_toClose = true
  19. self.close_mode = CloseMode.CloseDestroy
  20. self.destroy_imm = true
  21. self.horseModel = HorseModel:getInstance()
  22. self.goods_vo = nil
  23. self.cell = nil --坐骑装备特殊 需要自己通过配置找到装备可以穿戴的位置
  24. self.load_callback = function ()
  25. self:LoadSuccess()
  26. end
  27. self.open_callback = function ()
  28. self:SetData()
  29. end
  30. self.close_callback = function ()
  31. end
  32. self.destroy_callback = function ()
  33. self:Remove()
  34. end
  35. end
  36. --[[
  37. type_id id
  38. type 穿
  39. basic_attr
  40. attr_list
  41. parm
  42. --]]
  43. function HorseEquipInfoTips:Open(type_id, x, y, goods_vo, type, basic_attr, attr_list, parm)
  44. if not Config.Mountequipattr[type_id] then
  45. print("not horse config attr",type)
  46. self:Close()
  47. return
  48. end
  49. self.type_id = type_id
  50. self.pos_x = x
  51. self.pos_y = y
  52. self.goods_vo = goods_vo
  53. self.open_type = type
  54. self.basic_attr = basic_attr
  55. self.attr_list = attr_list
  56. self.parm = parm
  57. if not self.cell then
  58. self.cell = self.horseModel:GetEquipWearPos(self.type_id)
  59. end
  60. BaseView.Open(self)
  61. end
  62. function HorseEquipInfoTips:LoadSuccess()
  63. self.gameObject:SetActive(false)
  64. self.layout,self.bg,self.career_conta,self.descCon,self.expired_label,
  65. self.icon_con,self.depot_conta,self.star_conta,self.ScrollView,
  66. self.ScrollViewContent,self.ScrollViewViewport,
  67. self.line1,self.line2,
  68. self.line3,self.line4,
  69. self.line5,self.line6,
  70. self.line7,self.line8,
  71. self.line9,self.line10,
  72. self.btn_conta,self.down_arrow,self.sell_conta,
  73. self.compare_conta,self.addNumCon,
  74. self.stone_conta,
  75. self.normal
  76. = GetChildTransforms(self.transform,
  77. {
  78. "layout","layout/normal/bg","layout/normal/career_conta","layout/normal/descCon","layout/normal/expired_label",
  79. "layout/normal/icon_con","layout/normal/depot_conta","layout/normal/star_conta","layout/normal/ScrollView",
  80. "layout/normal/ScrollView/Viewport/Content","layout/normal/ScrollView/Viewport",
  81. "layout/normal/ScrollView/Viewport/Content/line1","layout/normal/ScrollView/Viewport/Content/line2",
  82. "layout/normal/ScrollView/Viewport/Content/line3","layout/normal/ScrollView/Viewport/Content/line4",
  83. "layout/normal/ScrollView/Viewport/Content/line5","layout/normal/ScrollView/Viewport/Content/line6",
  84. "layout/normal/ScrollView/Viewport/Content/line7","layout/normal/ScrollView/Viewport/Content/line8",
  85. "layout/normal/ScrollView/Viewport/Content/line9","layout/normal/ScrollView/Viewport/Content/line10",
  86. "layout/normal/btn_conta","layout/normal/down_arrow","layout/normal/sell_conta",
  87. "layout/compare_conta","layout/normal/btn_conta/buyCon/addNumCon",
  88. "layout/normal/ScrollView/Viewport/Content/stone_conta",
  89. "layout/normal",
  90. })
  91. self.descLabel,self.getWayLabel,self.nameText,
  92. self.step_num,self.composite_score,self.equip_score,
  93. self.career,self.level,self.equip_pos,
  94. self.fight,self.depot_score,self.depot_text,
  95. self.base_name,self.baseName,
  96. self.basePro,self.strengthAdd,
  97. self.add_name,self.addName,
  98. self.addPro,self.wash_name,
  99. self.washName,self.washPro,
  100. self.spirit_name,self.spiritName,
  101. self.spiritPro,self.stone_name,
  102. self.suit_name,self.suitNameList,
  103. self.suitNum,self.suitName,
  104. self.suitPro,self.wake_base_name,
  105. self.wake_baseName,self.wake_basePro,
  106. self.wake_baseAdd,self.wake_stren_name,
  107. self.wake_strenName,self.wake_strenPro,
  108. self.wake_strenAdd,self.wake_suit_name,
  109. self.wake_suitNum,self.wake_suitName,
  110. self.wake_suitPro,self.wake_suitAdd,
  111. self.magic_skill_name,self.magic_skillName,
  112. self.magic_skillLevel,self.price_label,
  113. self.limitText
  114. = GetChildTexts(self.transform,
  115. {
  116. "layout/normal/descCon/descLabel","layout/normal/descCon/getWayLabel","layout/normal/nameText",
  117. "layout/normal/step_num","layout/normal/composite_score","layout/normal/equip_score",
  118. "layout/normal/career_conta/career","layout/normal/level","layout/normal/career_conta/equip_pos",
  119. "layout/normal/fight","layout/normal/depot_conta/depot_score","layout/normal/depot_conta/Text (5)",
  120. "layout/normal/ScrollView/Viewport/Content/line1/Text","layout/normal/ScrollView/Viewport/Content/baseName",
  121. "layout/normal/ScrollView/Viewport/Content/basePro","layout/normal/ScrollView/Viewport/Content/strengthAdd",
  122. "layout/normal/ScrollView/Viewport/Content/line2/Text","layout/normal/ScrollView/Viewport/Content/addName",
  123. "layout/normal/ScrollView/Viewport/Content/addPro","layout/normal/ScrollView/Viewport/Content/line5/Text",
  124. "layout/normal/ScrollView/Viewport/Content/washName","layout/normal/ScrollView/Viewport/Content/washPro",
  125. "layout/normal/ScrollView/Viewport/Content/line6/Text","layout/normal/ScrollView/Viewport/Content/spiritName",
  126. "layout/normal/ScrollView/Viewport/Content/spiritPro","layout/normal/ScrollView/Viewport/Content/line3/Text",
  127. "layout/normal/ScrollView/Viewport/Content/line4/Text","layout/normal/ScrollView/Viewport/Content/suitNameList",
  128. "layout/normal/ScrollView/Viewport/Content/suitNum","layout/normal/ScrollView/Viewport/Content/suitName",
  129. "layout/normal/ScrollView/Viewport/Content/suitPro","layout/normal/ScrollView/Viewport/Content/line7/Text",
  130. "layout/normal/ScrollView/Viewport/Content/wakeBaseName","layout/normal/ScrollView/Viewport/Content/wakeBasePro",
  131. "layout/normal/ScrollView/Viewport/Content/wakeBaseAdd","layout/normal/ScrollView/Viewport/Content/line8/Text",
  132. "layout/normal/ScrollView/Viewport/Content/wakeStrenName","layout/normal/ScrollView/Viewport/Content/wakeStrenPro",
  133. "layout/normal/ScrollView/Viewport/Content/wakeStrenAdd","layout/normal/ScrollView/Viewport/Content/line9/Text",
  134. "layout/normal/ScrollView/Viewport/Content/wakeSuitNum","layout/normal/ScrollView/Viewport/Content/wakeSuitName",
  135. "layout/normal/ScrollView/Viewport/Content/wakeSuitPro","layout/normal/ScrollView/Viewport/Content/wakeSuitAdd",
  136. "layout/normal/ScrollView/Viewport/Content/line10/Text","layout/normal/ScrollView/Viewport/Content/magicSkillName",
  137. "layout/normal/ScrollView/Viewport/Content/magicSkillLevel","layout/normal/sell_conta/price_label",
  138. "layout/normal/btn_conta/buyCon/limitText"
  139. })
  140. self.forgeBtn,
  141. self.upgradeBtn,self.upgradeBtn_dot,
  142. self.smeltBtn,self.smeltBtn_dot,
  143. self.strengthBtn,self.strengthBtn_dot,
  144. self.washBtn,self.wearBtn,
  145. self.insertBtn,self.insertBtn_dot,
  146. self.offBtn,self.decomposeBtn,
  147. self.composeBtn,self.sellBtn,
  148. self.storeBtn,self.takeBtn,
  149. self.exchangeBtn,self.destoryBtn,
  150. self.donateBtn,self.renewBtn,
  151. self.shelvesUpBtn,self.shelvesDownBtn,
  152. self.eatBtn,self.buyCon,
  153. self.buyBtn,self.oneKeyBuyBtn
  154. = GetChildGameObjects(self.transform,
  155. {
  156. "layout/normal/btn_conta/forgeBtn",
  157. "layout/normal/btn_conta/upgradeBtn","layout/normal/btn_conta/upgradeBtn/dot",
  158. "layout/normal/btn_conta/smeltBtn","layout/normal/btn_conta/smeltBtn/dot",
  159. "layout/normal/btn_conta/strengthBtn","layout/normal/btn_conta/strengthBtn/dot",
  160. "layout/normal/btn_conta/washBtn","layout/normal/btn_conta/wearBtn",
  161. "layout/normal/btn_conta/insertBtn","layout/normal/btn_conta/insertBtn/dot",
  162. "layout/normal/btn_conta/offBtn","layout/normal/btn_conta/decomposeBtn",
  163. "layout/normal/btn_conta/composeBtn","layout/normal/btn_conta/sellBtn",
  164. "layout/normal/btn_conta/storeBtn","layout/normal/btn_conta/takeBtn",
  165. "layout/normal/btn_conta/exchangeBtn","layout/normal/btn_conta/destoryBtn",
  166. "layout/normal/btn_conta/donateBtn","layout/normal/btn_conta/renewBtn",
  167. "layout/normal/btn_conta/shelvesUpBtn","layout/normal/btn_conta/shelvesDownBtn",
  168. "layout/normal/btn_conta/eatBtn","layout/normal/btn_conta/buyCon",
  169. "layout/normal/btn_conta/buyCon/buyBtn","layout/normal/btn_conta/oneKeyBuyBtn"
  170. })
  171. self.step_bg,self.sell_icon,self.wear_icon = GetChildImages(self.transform,
  172. {
  173. "layout/normal/setp_bg","layout/normal/sell_conta/icon","layout/normal/wear_icon",
  174. })
  175. self.career_conta_pos = self.career_conta.transform.localPosition
  176. self.depot_conta_pos = self.depot_conta.transform.localPosition
  177. self.btn_list = {self.forgeBtn,
  178. self.upgradeBtn, self.smeltBtn,
  179. self.strengthBtn, self.washBtn, self.wearBtn, self.insertBtn, self.offBtn,
  180. self.decomposeBtn, self.sellBtn, self.storeBtn, self.takeBtn,
  181. self.exchangeBtn, self.destoryBtn, self.donateBtn, self.renewBtn,
  182. self.shelvesUpBtn, self.shelvesDownBtn, self.composeBtn, self.eatBtn, self.buyCon,
  183. self.oneKeyBuyBtn}
  184. self.icon_item = HorseBagIconItem.New(self.icon_con, false, self.layer_name)
  185. self.icon_item:ChangeCountVisible(false)
  186. -- self.addNumComponent = AddNumberComponent.New(self.addNumCon)
  187. -- self.addNumComponent:SetVisibleCalcBtn(false)
  188. self:InitEvent()
  189. self.stageBg,
  190. self.step_num_obj,
  191. self.text1_obj,
  192. self.text2_obj
  193. = GetChildGameObjects(self.transform,
  194. {
  195. "layout/normal/stageBg",
  196. "layout/normal/step_num",
  197. "layout/normal/Text1",
  198. "layout/normal/Text2",
  199. })
  200. self.careerName,
  201. self.addStrengthProp
  202. = GetChildTexts(self.transform,
  203. {
  204. "layout/normal/career_conta/careerName",
  205. "layout/normal/ScrollView/Viewport/Content/addStrengthProp",
  206. })
  207. self.replace_btn_text = self:GetChildTexts({"layout/normal/btn_conta/strengthBtn/Text"})
  208. self.replace_btn_text.text = "替换"
  209. self.careerName.text = "品质:"
  210. self.stageBg:SetActive(false)
  211. self.step_num_obj:SetActive(false)
  212. -- self.text1_obj:SetActive(false)
  213. -- lua_resM:setImageSprite(self, self.offBtn.transform:GetComponent("Image"), "alphaCommon_asset", "tyui_btn_1")
  214. -- lua_resM:setImageSprite(self, self.smeltBtn.transform:GetComponent("Image"), "alphaCommon_asset", "tyui_btn_2")
  215. -- EquipToolTips.LoadSuccess(self)
  216. -- if self.open_type == HorseEquipInfoTips.OFF then --穿戴在身上的就显示升级战力 加 基础属性战力 在背包、熔炼背包、打造背包的就显示基础属性战力
  217. -- if not self.cell then
  218. -- self.cell = self.horseModel:GetEquipWearPos(self.goods_vo.type_id)
  219. -- end
  220. -- self.horseModel:Fire(HorsePetEvent.REQUEST_HORSE_UPGRADE, self.cell)
  221. -- else
  222. -- self:SetCombat(nil, 2)
  223. -- end
  224. -- self.level.gameObject:SetActive(false)
  225. self.text1_obj.transform:GetComponent("Text").text = "部位:"
  226. self.text2_obj.transform:GetComponent("Text").text = "评分:"
  227. -- self.equip_score.gameObject:SetActive(false)
  228. -- self.text2_obj:SetActive(false)
  229. end
  230. function HorseEquipInfoTips:InitEvent()
  231. local function onClickHandler(target)
  232. if target == self.wearBtn then
  233. self.horseModel:Fire(HorsePetEvent.WEAR_HORSE_EQUIP, self.goods_vo.goods_id)
  234. elseif target == self.upgradeBtn then
  235. self.horseModel:Fire(HorsePetEvent.SHOW_UPGRADE_VIEW, true, self.goods_vo)
  236. elseif target == self.smeltBtn then
  237. self:SmeltEquipFunc()
  238. elseif target == self.offBtn then
  239. self.horseModel:Fire(HorsePetEvent.OFF_HORSE_EQUIP, self.goods_vo.goods_id)
  240. elseif target == self.forgeBtn then
  241. local cfg = self.horseModel:GetHorseEquipNewMakeCfg(self.goods_vo.type_id)
  242. if cfg then
  243. self.horseModel:Fire(HorsePetEvent.SHOW_HORSE_FORGE, self.goods_vo, true)
  244. -- self.horseModel:ClearForgeMaterialeVoDic(2, true)
  245. self.horseModel.new_is_forge = false
  246. else
  247. Message.show("此装备无法继续打造")
  248. end
  249. elseif target == self.takeBtn then -- 坐骑打造界面 点击材料 取出
  250. if self.parm then
  251. if self.parm == HorseModel.MATERIAL_ITEM.MATERIAL_1_CANCLE then
  252. self.horseModel:ClearForgeMaterialeVoDic(1, nil, 1)
  253. elseif self.parm == HorseModel.MATERIAL_ITEM.MATERIAL_2_CANCLE then
  254. self.horseModel:ClearForgeMaterialeVoDic(1, nil, 2)
  255. elseif self.parm == HorseModel.EXTRA_ITEM.EXTRA_1_CANCLE then
  256. self.horseModel:ClearForgeMaterialeVoDic(2)
  257. end
  258. end
  259. elseif target == self.strengthBtn then -- 坐骑打造界面 点击材料 替换
  260. if self.parm then
  261. if self.parm == HorseModel.MATERIAL_ITEM.MATERIAL_1_CANCLE then
  262. self.horseModel:Fire(HorsePetEvent.SELECT_MATERIAL_VIEW, 1, true, 1)
  263. elseif self.parm == HorseModel.MATERIAL_ITEM.MATERIAL_2_CANCLE then
  264. self.horseModel:Fire(HorsePetEvent.SELECT_MATERIAL_VIEW, 1, true, 2)
  265. elseif self.parm == HorseModel.EXTRA_ITEM.EXTRA_1_CANCLE then
  266. self.horseModel:Fire(HorsePetEvent.SELECT_MATERIAL_VIEW, 2, true)
  267. end
  268. end
  269. end
  270. self:Close()
  271. end
  272. AddClickEvent(self.wearBtn, onClickHandler, 2)
  273. AddClickEvent(self.upgradeBtn, onClickHandler, 2)
  274. AddClickEvent(self.smeltBtn, onClickHandler, 2)
  275. AddClickEvent(self.offBtn, onClickHandler, 2)
  276. AddClickEvent(self.forgeBtn, onClickHandler, 2)
  277. AddClickEvent(self.takeBtn, onClickHandler, 2)
  278. AddClickEvent(self.strengthBtn, onClickHandler, 2)
  279. --更新装备的战力
  280. local function onUpdateCombat(vo)
  281. -- if vo.goods_id == self.goods_vo.goods_id then
  282. -- self:SetCombat(vo, 1)
  283. self.level_vo = vo
  284. self.composite_score.text = self:GetFightList(self.dynamic, self.equip_basic)
  285. local basic = nil
  286. if self.type_id then
  287. basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(self.type_id)
  288. end
  289. local base_pro = ErlangParser:GetInstance():Parse(basic.base_attrlist)
  290. self:SetProperty(base_pro, 0, basic.equip_type)
  291. self:SetAddProperty(self.dynamic)
  292. self:RefreshPosAndSize(self.dynamic)
  293. if self.open_type == HorseEquipInfoTips.OFF or self.horseModel:CheckIsWearEquipByVo(self.goods_vo) then
  294. if self.cell then
  295. self.upgradeBtn_dot:SetActive(self.horseModel:CheckEquipUpgradeRed(self.cell))
  296. end
  297. end
  298. -- end
  299. end
  300. self.update_equip_combat_id = self.horseModel:Bind(HorsePetEvent.SHOW_HORSE_UPGRADE, onUpdateCombat)
  301. end
  302. function HorseEquipInfoTips:Remove()
  303. if self.icon_item then
  304. self.icon_item:DeleteMe()
  305. self.icon_item = nil
  306. end
  307. if self.compareTips then
  308. self.compareTips:DeleteMe()
  309. self.compareTips = nil
  310. end
  311. self:DeleteArrowTip()
  312. if self.addNumComponent then
  313. if self.change_count_id then
  314. self.addNumComponent:UnBind(self.change_count_id)
  315. self.change_count_id = nil
  316. end
  317. self.addNumComponent:DeleteMe()
  318. self.addNumComponent = nil
  319. end
  320. if self.update_equip_combat_id then
  321. self.horseModel:UnBind(self.update_equip_combat_id)
  322. self.update_equip_combat_id = nil
  323. end
  324. end
  325. function HorseEquipInfoTips:SetData()
  326. if self.type_id == nil --[[or self.goods_vo == nil--]] then return end
  327. if self.open_type == HorseEquipInfoTips.UNKNOWN then
  328. local basic = nil
  329. if self.type_id then
  330. basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(self.type_id)
  331. self.equip_basic = basic
  332. end
  333. if basic then
  334. local cfg = Config.Mountequipattr[self.type_id]
  335. if cfg then
  336. self.composite_score.text = cfg.base_rating
  337. -- self.equip_score.text = cfg.base_rating
  338. self.equip_score.text = "<color=#ffffff>"..cfg.base_rating.."</color>"
  339. -- self.level.text = "<color=#ffffff>"..cfg.base_rating.."</color>"
  340. local base_pro = ErlangParser:GetInstance():Parse(basic.base_attrlist)
  341. self:SetProperty(base_pro, 0, basic.equip_type)
  342. self:SetAddProperty()
  343. self:RefreshPosAndSize(self.dynamic)
  344. end
  345. end
  346. if self.icon_item then
  347. local goods_vo = self.goods_vo
  348. if goods_vo == nil then
  349. local basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(self.type_id)
  350. goods_vo = {type_id = self.type_id, color = basic.color, goods_num = 1, bind = basic.bind}
  351. end
  352. self.icon_item:SetData(goods_vo)
  353. if self.open_type == HorseEquipInfoTips.UNKNOWN and self.horseModel.forge_view then
  354. self.icon_item:SetLockIconActive(true)
  355. end
  356. end
  357. else
  358. if self.goods_vo.goods_id then
  359. local function callback(dynamic)
  360. self.dynamic = dynamic
  361. -- self.equip_score.text = dynamic.rating
  362. -- self.level.text = "<color=#ffffff>"..dynamic.rating.."</color>"
  363. self.equip_score.text = "<color=#ffffff>"..dynamic.rating.."</color>"
  364. if dynamic.equip_extra_attr then
  365. local basic = nil
  366. if self.type_id then
  367. basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(self.type_id)
  368. self.equip_basic = basic
  369. end
  370. if basic then
  371. if self.open_type == HorseEquipInfoTips.OFF or self.horseModel:CheckIsWearEquipByVo(self.goods_vo) then --穿戴在身上的就显示升级战力 加 基础属性战力 在背包、熔炼背包、打造背包的就显示基础属性战力
  372. if not self.cell then
  373. self.cell = self.horseModel:GetEquipWearPos(self.goods_vo.type_id)
  374. end
  375. self.horseModel:Fire(HorsePetEvent.REQUEST_HORSE_UPGRADE, self.cell)
  376. else
  377. -- self:SetCombat(nil, 2)
  378. self.composite_score.text = self:GetFightList(self.dynamic, basic)
  379. local base_pro = ErlangParser:GetInstance():Parse(basic.base_attrlist)
  380. self:SetProperty(base_pro, 0, basic.equip_type)
  381. self:SetAddProperty(dynamic)
  382. self:RefreshPosAndSize(self.dynamic)
  383. end
  384. -- local base_pro = ErlangParser:GetInstance():Parse(basic.base_attrlist)
  385. -- self:SetProperty(base_pro, 0, basic.equip_type)
  386. end
  387. -- self:SetAddProperty(dynamic)
  388. -- self.dynamic = dynamic
  389. -- self:RefreshPosAndSize(self.dynamic)
  390. -- self:SetUnknownView(self.ScrollViewContent, self.addPro.transform, self.add_property_len, self.addStrengthProp)
  391. -- if self.open_type == HorseEquipInfoTips.UNKNOWN then
  392. -- local text_root
  393. -- local text_txt
  394. -- text_root = UiFactory.createChild(self.career_conta, UIType.Label, "expire_label")
  395. -- text_txt = text_root:GetComponent("Text")
  396. -- text_root.transform.pivot = Vector2(0,1)
  397. -- text_root.transform.anchorMin = Vector2(0, 1)
  398. -- text_root.transform.anchorMax = Vector2(0, 1)
  399. -- text_txt.alignment = UnityEngine.TextAnchor.UpperLeft
  400. -- self:SetUnknownView(self.career_conta, self.career.transform, 1, text_txt)
  401. -- text_root = UiFactory.createChild(self.normal, UIType.Label, "expire_label")
  402. -- text_txt = text_root:GetComponent("Text")
  403. -- text_root.transform.pivot = Vector2(0,1)
  404. -- text_root.transform.anchorMin = Vector2(0, 1)
  405. -- text_root.transform.anchorMax = Vector2(0, 1)
  406. -- text_txt.alignment = UnityEngine.TextAnchor.UpperLeft
  407. -- self:SetUnknownView(self.normal, self.composite_score.transform, 1, text_txt, 13)
  408. -- end
  409. end
  410. if self.icon_item then
  411. self.icon_item:SetData(self.goods_vo)
  412. if self.open_type == HorseEquipInfoTips.UNKNOWN then
  413. self.icon_item:SetLockIconActive(true)
  414. end
  415. end
  416. end
  417. GoodsModel:getInstance():GetDynamic(self.goods_vo.goods_id, callback)
  418. end
  419. end
  420. if not self.cell then
  421. self.cell = self.horseModel:GetEquipWearPos(self.type_id)
  422. end
  423. local view_type = 2
  424. if self.open_type == HorseEquipInfoTips.FORGE and self.horseModel.new_is_forge then
  425. if self.horseModel:IsNewGoodsVo(self.goods_vo.goods_id) then
  426. lua_resM:setImageSprite(self, self.wear_icon, "uiComponent_asset", "tsui_dzh")
  427. end
  428. if self.horseModel:GetForgeOldGoodsVo() and self.horseModel:IsNewGoodsVo(self.goods_vo.goods_id) and self.horseModel.has_show_after_forge_tips == false then
  429. self.show_compare_tips = true
  430. self.have_equip_data = self.horseModel:GetForgeOldGoodsVo()
  431. view_type = 1
  432. end
  433. elseif self.open_type == HorseEquipInfoTips.WEAR then
  434. self.show_compare_tips, self.have_equip_data = self.horseModel:ShowCompareTips(self.goods_vo.goods_id, self.cell)
  435. view_type = 2
  436. end
  437. if self.show_compare_tips then
  438. self.compare_conta.gameObject:SetActive(true)
  439. self.compareTips = self.compareTips or HorseEquipCompareTips.New(self.compare_conta, nil, self.layer_name)
  440. self.compareTips:SetData(self.have_equip_data, view_type)
  441. else
  442. self.compare_conta.gameObject:SetActive(false)
  443. end
  444. local cfg = self.horseModel:GetHorseEquipAttrCfg(self.type_id)
  445. if cfg then
  446. local quality_cfg = Config.ConfigQualityName.HorseEquipQualityName[cfg.quality]
  447. if quality_cfg then
  448. self.career.text = quality_cfg.name
  449. end
  450. local basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(self.type_id)
  451. local name = nil
  452. if not self.goods_vo or (self.goods_vo and not self.goods_vo.goods_name) then
  453. name = basic.goods_name
  454. else
  455. name = self.goods_vo and self.goods_vo.goods_name or ""
  456. end
  457. self.nameText.text = "<color="..WordManager.GetGoodsColor(cfg.quality)..">"..name.."</color>"
  458. end
  459. local equip_info = self.horseModel:GetHorseEquipCfg()
  460. if cfg and equip_info then
  461. for k,v in pairs(equip_info) do
  462. if v and v.equip_type and cfg.pos and v.equip_type == cfg.pos then
  463. local str = Trim(v.pos_name)
  464. -- local str_arr = Split(self.goods_vo.goods_name, "·")
  465. -- self.level.text = str_arr[#str_arr]
  466. self.level.text = str
  467. end
  468. end
  469. end
  470. self:SetBtns()
  471. end
  472. function HorseEquipInfoTips:SetCombat(vo, view_type)
  473. if view_type then
  474. if view_type == 1 then --穿戴在身上的
  475. if vo then
  476. if not self.cell then
  477. self.cell = self.horseModel:GetEquipWearPos(self.goods_vo.type_id)
  478. end
  479. local cfg = self.horseModel:GetHorseEquipLvCfg(self.cell, vo.lv)
  480. if cfg then
  481. local grade = self.horseModel:GetHorseEquipAttrCfg(self.goods_vo.type_id).base_rating
  482. self.composite_score.text = cfg.combat + grade
  483. end
  484. end
  485. elseif view_type == 2 then --在背包、熔炼背包、打造背包
  486. self.composite_score.text = self.horseModel:GetHorseEquipAttrCfg(self.goods_vo.type_id).base_rating
  487. end
  488. end
  489. end
  490. function HorseEquipInfoTips:GetFightList(dynamic, basic)
  491. local list = {}
  492. if basic then
  493. --基础属性
  494. local base_pro = ErlangParser:GetInstance():Parse(basic.base_attrlist)
  495. if self.open_type == HorseEquipInfoTips.OFF or self.horseModel:CheckIsWearEquipByVo(self.goods_vo) then --穿戴
  496. --升级
  497. if not self.cell then
  498. self.cell = self.horseModel:GetEquipWearPos(self.goods_vo.type_id)
  499. end
  500. local cfg = self.horseModel:GetHorseEquipLvCfg(self.cell, self.level_vo.lv)
  501. local equip_pro = ErlangParser:GetInstance():Parse(cfg.attr)
  502. for k,v in pairs(base_pro) do
  503. local next_attr = {}
  504. local next_prop = WordManager:GetPropertyValue(tonumber(v[1]),tonumber(v[2]))
  505. for i,j in pairs(equip_pro) do
  506. if tonumber(j[1]) == tonumber(v[1]) then
  507. next_prop = tonumber(next_prop) + tonumber(j[2])
  508. next_attr.attr_id = tonumber(v[1])
  509. next_attr.attr_val = next_prop
  510. local addition_list = self.horseModel.skill_to_attr_addition
  511. if self.cell and addition_list and addition_list[self.cell] then
  512. next_attr.attr_val = next_attr.attr_val + next_attr.attr_val*tonumber(addition_list[self.cell])
  513. end
  514. end
  515. end
  516. table.insert(list, next_attr)
  517. end
  518. else
  519. for i,v in ipairs(base_pro) do
  520. table.insert(list,{attr_id = v[1],attr_val = v[2]})
  521. end
  522. end
  523. end
  524. --极品属性
  525. for i,v in ipairs(dynamic.equip_extra_attr) do
  526. table.insert(list,{attr_id = v.attr_id,attr_val = v.attr_val})
  527. end
  528. local AllProList = {}
  529. local tempList = {}
  530. local mainVo = RoleManager.Instance.mainRoleInfo
  531. for i,v in ipairs(list) do
  532. local cfg = Config.ConfigAttributeAddition[v.attr_id]
  533. if cfg then
  534. local val = v.attr_val * mainVo[cfg.baseAttrVo] / 10000
  535. table.insert(tempList,{attr_id = cfg.baseAttr,attr_val = val})
  536. else
  537. table.insert(AllProList,v)
  538. end
  539. end
  540. for i,v in ipairs(tempList) do
  541. table.insert(AllProList,v)
  542. end
  543. local endList = {}
  544. for i,v in ipairs(AllProList) do
  545. table.insert(endList,{[1] = v.attr_id,[2] = v.attr_val})
  546. end
  547. return GetFighting(endList)
  548. end
  549. --设置基础属性
  550. function HorseEquipInfoTips:SetProperty(base_pro, stren, pos)
  551. local name_str = ""
  552. local pro_str = ""
  553. local stren_str = ""
  554. local prop
  555. local equip_pro
  556. local next_equip_pro
  557. if (self.open_type == HorseEquipInfoTips.OFF or self.horseModel:CheckIsWearEquipByVo(self.goods_vo)) and self.level_vo then
  558. if not self.cell then
  559. self.cell = self.horseModel:GetEquipWearPos(self.goods_vo.type_id)
  560. end
  561. local cfg = self.horseModel:GetHorseEquipLvCfg(self.cell, self.level_vo.lv)
  562. equip_pro = ErlangParser:GetInstance():Parse(cfg.attr)
  563. -- next_equip_pro = ErlangParser:GetInstance():Parse(self.horseModel:GetHorseEquipLvCfg(self.goods_vo.cell, (self.level_vo.lv+1)).attr)
  564. local addition_list = self.horseModel.skill_to_attr_addition
  565. if self.cell and addition_list[self.cell] then
  566. self.base_name.text = "基础属性<color=#4eae1a> [技能加成+"..(tonumber(addition_list[self.cell])*100).."%]</color>"
  567. end
  568. end
  569. for i,v in ipairs(base_pro) do
  570. name_str = name_str .. WordManager:GetProperties(tonumber(v[1]))
  571. prop = WordManager:GetPropertyValue(tonumber(v[1]),tonumber(v[2]))
  572. if equip_pro and #equip_pro > 0 then
  573. for x,y in pairs(equip_pro) do
  574. if y[1] == v[1] then
  575. prop = tonumber(prop) + tonumber(y[2])
  576. stren_str = stren_str.."(强化+"..y[2]..")"
  577. end
  578. end
  579. end
  580. pro_str = pro_str.."+" .. prop--WordManager:GetPropertyValue(tonumber(v[1]),tonumber(v[2]))
  581. if i < #base_pro then
  582. name_str = name_str.."\n"
  583. pro_str = pro_str.."\n"
  584. stren_str = stren_str.."\n"
  585. end
  586. end
  587. self.baseName.text = name_str
  588. self.basePro.text = pro_str
  589. self.strengthAdd.text = "<color="..ColorUtil.GREEN..">"..stren_str.."</color>"
  590. -- if self.open_type == HorseEquipInfoTips.UNKNOWN then
  591. -- self.strengthAdd.gameObject:SetActive(true)
  592. -- else
  593. -- self.strengthAdd.gameObject:SetActive(false)
  594. -- end
  595. local off_y = 0
  596. local line_y = 39
  597. off_y = self.basePro.preferredHeight + 15
  598. SetSizeDelta(self.baseName.transform, self.baseName.transform.sizeDelta.x, off_y)
  599. SetSizeDelta(self.basePro.transform, self.basePro.transform.sizeDelta.x, off_y)
  600. SetSizeDelta(self.strengthAdd.transform, self.strengthAdd.transform.sizeDelta.x, off_y)
  601. -- self:SetUnknownView(self.ScrollViewContent, self.basePro.transform, 2, self.strengthAdd)
  602. end
  603. --设置附加属性
  604. function HorseEquipInfoTips:SetAddProperty(dynamic)
  605. if self.open_type == HorseEquipInfoTips.UNKNOWN then
  606. local cfg = self.horseModel:GetHorseEquipAttrCfg(self.type_id)
  607. local equip_extra_attr = nil
  608. if cfg then
  609. equip_extra_attr = cfg.recommend_attr
  610. equip_extra_attr = ErlangParser:GetInstance():Parse(equip_extra_attr)
  611. end
  612. if equip_extra_attr and #equip_extra_attr > 0 then
  613. local name_str = ""
  614. local pro_str = ""
  615. local recommand = ""
  616. local extra_attr = {}
  617. for k,v in pairs(equip_extra_attr) do
  618. local attr = {}
  619. attr.color = tonumber(v[2][1])
  620. attr.attr_id = tonumber(v[2][2])
  621. if #v[2] == 5 then
  622. attr.type_id = 1
  623. attr.plus_interval = tonumber(v[2][4])
  624. attr.plus_unit = tonumber(v[2][5])
  625. else
  626. attr.type_id = 2
  627. attr.attr_val = tonumber(v[2][3])
  628. end
  629. table.insert(extra_attr, attr)
  630. end
  631. if extra_attr then
  632. local function sort_func(vo1,vo2)
  633. if vo1.color ~= vo2.color then
  634. return vo1.color < vo2.color
  635. end
  636. return vo1.attr_id < vo2.attr_id
  637. end
  638. table.sort(extra_attr,sort_func)
  639. for i,v in ipairs(extra_attr) do
  640. if v.type_id == 1 then
  641. name_str = name_str .. "<color="..WordManager.GetGoodsColor(v.color)..">"..recommand..""..v.plus_interval..""..WordManager:GetProperties(tonumber(v.attr_id)).."</color>"
  642. pro_str = pro_str .."<color="..WordManager.GetGoodsColor(v.color)..">+"..WordManager:GetPropertyValue(tonumber(v.attr_id), tonumber(v.plus_unit)) .. "</color>"
  643. else
  644. name_str = name_str .. "<color=" .. WordManager.GetGoodsColor(v.color) .. ">" ..recommand..WordManager:GetProperties(tonumber(v.attr_id)).."</color>"
  645. pro_str = pro_str .. "<color="..WordManager.GetGoodsColor(v.color)..">+"..WordManager:GetPropertyValue(tonumber(v.attr_id), v.attr_val).."</color>"
  646. end
  647. if i < #extra_attr then
  648. name_str = name_str .. "\n"
  649. pro_str = pro_str .. "\n"
  650. end
  651. end
  652. end
  653. self.addName.text = name_str
  654. self.addPro.text = pro_str
  655. self.line2.gameObject:SetActive(true)
  656. self.addName.gameObject:SetActive(true)
  657. self.addPro.gameObject:SetActive(true)
  658. SetSizeDelta(self.addName.transform, 130, self.addName.preferredHeight + 15)
  659. SetSizeDelta(self.addPro.transform, self.addPro.preferredWidth--[[self.addPro.transform.sizeDelta.x--]], self.addPro.preferredHeight + 15)
  660. SetSizeDelta(self.addStrengthProp.transform, self.addStrengthProp.transform.sizeDelta.x, self.addPro.preferredHeight + 15)
  661. else
  662. self.line2.gameObject:SetActive(false)
  663. self.addName.gameObject:SetActive(false)
  664. self.addPro.gameObject:SetActive(false)
  665. SetSizeDelta(self.addName.transform, 130, self.addName.preferredHeight + 15)
  666. SetSizeDelta(self.addPro.transform, self.addPro.preferredWidth--[[self.addPro.transform.sizeDelta.x--]], self.addPro.preferredHeight + 15)
  667. SetSizeDelta(self.addStrengthProp.transform, self.addStrengthProp.transform.sizeDelta.x, self.addPro.preferredHeight + 15)
  668. end
  669. else
  670. if dynamic and dynamic.equip_extra_attr then
  671. local equip_extra_attr = nil
  672. equip_extra_attr = self.horseModel:SortEquipAttr(dynamic.equip_extra_attr)
  673. local name_str = ""
  674. local pro_str = ""
  675. local recommand = ""
  676. -- self.add_property_len = #equip_extra_attr
  677. if equip_extra_attr then
  678. for i,v in ipairs(equip_extra_attr) do
  679. if v.type_id == 1 then
  680. name_str = name_str .. "<color="..WordManager.GetGoodsColor(v.color)..">"..recommand..""..v.plus_interval..""..WordManager:GetProperties(tonumber(v.attr_id)).."</color>"
  681. pro_str = pro_str .."<color="..WordManager.GetGoodsColor(v.color)..">+"..WordManager:GetPropertyValue(tonumber(v.attr_id), tonumber(v.plus_unit)) .. "</color>"
  682. else
  683. name_str = name_str .. "<color=" .. WordManager.GetGoodsColor(v.color) .. ">" ..recommand..WordManager:GetProperties(tonumber(v.attr_id)).."</color>"
  684. pro_str = pro_str .. "<color="..WordManager.GetGoodsColor(v.color)..">+"..WordManager:GetPropertyValue(tonumber(v.attr_id), v.attr_val).."</color>"
  685. end
  686. if i < #equip_extra_attr then
  687. name_str = name_str .. "\n"
  688. pro_str = pro_str .. "\n"
  689. end
  690. end
  691. self.addName.text = name_str
  692. self.addPro.text = pro_str
  693. self.line2.gameObject:SetActive(true)
  694. self.addName.gameObject:SetActive(true)
  695. self.addPro.gameObject:SetActive(true)
  696. SetSizeDelta(self.addName.transform, 130, self.addName.preferredHeight + 15)
  697. SetSizeDelta(self.addPro.transform, self.addPro.preferredWidth--[[self.addPro.transform.sizeDelta.x--]], self.addPro.preferredHeight + 15)
  698. SetSizeDelta(self.addStrengthProp.transform, self.addStrengthProp.transform.sizeDelta.x, self.addPro.preferredHeight + 15)
  699. end
  700. else
  701. self.line2.gameObject:SetActive(false)
  702. self.addName.gameObject:SetActive(false)
  703. self.addPro.gameObject:SetActive(false)
  704. SetSizeDelta(self.addName.transform, 130, self.addName.preferredHeight + 15)
  705. SetSizeDelta(self.addPro.transform, self.addPro.preferredWidth--[[self.addPro.transform.sizeDelta.x--]], self.addPro.preferredHeight + 15)
  706. SetSizeDelta(self.addStrengthProp.transform, self.addStrengthProp.transform.sizeDelta.x, self.addPro.preferredHeight + 15)
  707. end
  708. end
  709. -- local cfg = self.horseModel:GetHorseEquipAttrCfg(self.goods_vo.type_id)
  710. -- local equip_extra_attr = nil
  711. -- if cfg then
  712. -- equip_extra_attr = cfg.recommend_attr
  713. -- equip_extra_attr = ErlangParser:GetInstance():Parse(equip_extra_attr)
  714. -- end
  715. -- if equip_extra_attr and #equip_extra_attr > 0 then
  716. -- -- if dynamic and dynamic.equip_extra_attr then
  717. -- -- local equip_extra_attr = nil
  718. -- -- equip_extra_attr = self.horseModel:SortEquipAttr(dynamic.equip_extra_attr)
  719. -- local name_str = ""
  720. -- local pro_str = ""
  721. -- local recommand = ""
  722. -- -- self.add_property_len = #equip_extra_attr
  723. -- -- if equip_extra_attr then
  724. -- -- for i,v in ipairs(equip_extra_attr) do
  725. -- -- if v.type_id == 1 then
  726. -- -- name_str = name_str .. "<color="..WordManager.GetGoodsColor(v.color)..">"..recommand.."每"..v.plus_interval.."级"..WordManager:GetProperties(tonumber(v.attr_id)).."</color>"
  727. -- -- pro_str = pro_str .."<color="..WordManager.GetGoodsColor(v.color)..">+"..WordManager:GetPropertyValue(tonumber(v.attr_id), tonumber(v.plus_unit)) .. "</color>"
  728. -- -- else
  729. -- -- name_str = name_str .. "<color=" .. WordManager.GetGoodsColor(v.color) .. ">" ..recommand..WordManager:GetProperties(tonumber(v.attr_id)).."</color>"
  730. -- -- pro_str = pro_str .. "<color="..WordManager.GetGoodsColor(v.color)..">+"..WordManager:GetPropertyValue(tonumber(v.attr_id), v.attr_val).."</color>"
  731. -- -- end
  732. -- -- if i < #equip_extra_attr then
  733. -- -- name_str = name_str .. "\n"
  734. -- -- pro_str = pro_str .. "\n"
  735. -- -- end
  736. -- -- end
  737. -- -- end
  738. -- -- if self.open_type == HorseEquipInfoTips.UNKNOWN then
  739. -- -- name_str = name_str.."\n?????????"
  740. -- -- end
  741. -- local extra_attr = {}
  742. -- for k,v in pairs(equip_extra_attr) do
  743. -- local attr = {}
  744. -- attr.color = tonumber(v[2][1])
  745. -- attr.attr_id = tonumber(v[2][2])
  746. -- if #v[2] == 5 then
  747. -- attr.type_id = 1
  748. -- attr.plus_interval = tonumber(v[2][4])
  749. -- attr.plus_unit = tonumber(v[2][5])
  750. -- else
  751. -- attr.type_id = 2
  752. -- attr.attr_val = tonumber(v[2][3])
  753. -- end
  754. -- table.insert(extra_attr, attr)
  755. -- end
  756. -- if extra_attr then
  757. -- local function sort_func(vo1,vo2)
  758. -- if vo1.color ~= vo2.color then
  759. -- return vo1.color < vo2.color
  760. -- end
  761. -- return vo1.attr_id < vo2.attr_id
  762. -- end
  763. -- table.sort(extra_attr,sort_func)
  764. -- for i,v in ipairs(extra_attr) do
  765. -- if v.type_id == 1 then
  766. -- name_str = name_str .. "<color="..WordManager.GetGoodsColor(v.color)..">"..recommand.."每"..v.plus_interval.."级"..WordManager:GetProperties(tonumber(v.attr_id)).."</color>"
  767. -- pro_str = pro_str .."<color="..WordManager.GetGoodsColor(v.color)..">+"..WordManager:GetPropertyValue(tonumber(v.attr_id), tonumber(v.plus_unit)) .. "</color>"
  768. -- else
  769. -- name_str = name_str .. "<color=" .. WordManager.GetGoodsColor(v.color) .. ">" ..recommand..WordManager:GetProperties(tonumber(v.attr_id)).."</color>"
  770. -- pro_str = pro_str .. "<color="..WordManager.GetGoodsColor(v.color)..">+"..WordManager:GetPropertyValue(tonumber(v.attr_id), v.attr_val).."</color>"
  771. -- end
  772. -- if i < #extra_attr then
  773. -- name_str = name_str .. "\n"
  774. -- pro_str = pro_str .. "\n"
  775. -- end
  776. -- end
  777. -- end
  778. -- self.addName.text = name_str
  779. -- self.addPro.text = pro_str
  780. -- self.line2.gameObject:SetActive(true)
  781. -- self.addName.gameObject:SetActive(true)
  782. -- self.addPro.gameObject:SetActive(true)
  783. -- SetSizeDelta(self.addName.transform, 130, self.addName.preferredHeight + 15)
  784. -- SetSizeDelta(self.addPro.transform, self.addPro.preferredWidth--[[self.addPro.transform.sizeDelta.x--]], self.addPro.preferredHeight + 15)
  785. -- SetSizeDelta(self.addStrengthProp.transform, self.addStrengthProp.transform.sizeDelta.x, self.addPro.preferredHeight + 15)
  786. -- else
  787. -- self.line2.gameObject:SetActive(false)
  788. -- self.addName.gameObject:SetActive(false)
  789. -- self.addPro.gameObject:SetActive(false)
  790. -- SetSizeDelta(self.addName.transform, 130, self.addName.preferredHeight + 15)
  791. -- SetSizeDelta(self.addPro.transform, self.addPro.preferredWidth--[[self.addPro.transform.sizeDelta.x--]], self.addPro.preferredHeight + 15)
  792. -- SetSizeDelta(self.addStrengthProp.transform, self.addStrengthProp.transform.sizeDelta.x, self.addPro.preferredHeight + 15)
  793. -- end
  794. -- -- end
  795. end
  796. -- create_trans 创建物体的节点
  797. -- last_trans 前面的文本位置 后面的文本以前面的位置为齐
  798. -- mask_num 箭头的多少个 和 问号的多少个
  799. -- next_txt 下一个需要设置位置或者大小的物体 这个为text
  800. -- add_trans_y 当需要对last_trans的y轴做增加数值时 可以加
  801. -- function HorseEquipInfoTips:SetUnknownView(create_trans, last_trans, mask_num, next_txt, add_trans_y)
  802. -- if self.open_type == HorseEquipInfoTips.UNKNOWN then
  803. -- if not last_trans or not create_trans then return end
  804. -- local last_trans_pos_x = last_trans.anchoredPosition.x
  805. -- local last_trans_pos_y = last_trans.anchoredPosition.y
  806. -- local last_trans_size_x = last_trans.sizeDelta.x
  807. -- if add_trans_y then
  808. -- last_trans_pos_y = last_trans_pos_y + add_trans_y
  809. -- end
  810. -- local count = mask_num
  811. -- if count >= 1 then
  812. -- local image_root
  813. -- local image_icon
  814. -- for i = 1, count do
  815. -- image_root = UiFactory.createChild(create_trans, UIType.ImageExtend)
  816. -- image_icon = image_root:GetComponent("ImageExtend")
  817. -- image_root.transform.pivot = Vector2(0,1)
  818. -- image_root.transform.anchorMin = Vector2(0, 1)
  819. -- image_root.transform.anchorMax = Vector2(0, 1)
  820. -- SetSizeDelta(image_root.transform, 33, 21)
  821. -- SetAnchoredPosition(image_root.transform, last_trans_pos_x + last_trans_size_x, last_trans_pos_y - ((i - 1) * 21))
  822. -- lua_resM:setImageSprite(self, image_icon, "common_asset", "tyui_jt")
  823. -- end
  824. -- end
  825. -- if next_txt then
  826. -- SetAnchoredPosition(next_txt.transform, last_trans_pos_x + last_trans_size_x + 33, last_trans_pos_y)
  827. -- local mask_txt = "???"
  828. -- if mask_num then
  829. -- while mask_num > 0 do
  830. -- mask_txt = mask_txt.."\n"..mask_txt
  831. -- mask_num = mask_num - 1
  832. -- end
  833. -- end
  834. -- next_txt.text = "<color=#835741>"..mask_txt.."</color>"
  835. -- end
  836. -- end
  837. -- end
  838. --按钮显示
  839. function HorseEquipInfoTips:SetBtns()
  840. for i,v in ipairs(self.btn_list) do
  841. v:SetActive(false)
  842. end
  843. if self.open_type == HorseEquipInfoTips.OFF then
  844. self.offBtn:SetActive(true)
  845. self.upgradeBtn:SetActive(true)
  846. elseif self.open_type == HorseEquipInfoTips.WEAR then
  847. self.wearBtn:SetActive(true)
  848. self.smeltBtn:SetActive(true)
  849. elseif self.open_type == HorseEquipInfoTips.FORGE then
  850. self.forgeBtn:SetActive(true)
  851. elseif self.open_type == HorseEquipInfoTips.ONLY_SHOW then
  852. elseif self.open_type == HorseEquipInfoTips.UNKNOWN then
  853. elseif self.open_type == HorseEquipInfoTips.MATERIAL then
  854. self.takeBtn:SetActive(true)
  855. self.strengthBtn:SetActive(true)
  856. end
  857. self.line3.gameObject:SetActive(false)
  858. self.line4.gameObject:SetActive(false)
  859. self.line5.gameObject:SetActive(false)
  860. self.line6.gameObject:SetActive(false)
  861. self.line7.gameObject:SetActive(false)
  862. self.line8.gameObject:SetActive(false)
  863. self.line9.gameObject:SetActive(false)
  864. self.line10.gameObject:SetActive(false)
  865. self.washName.gameObject:SetActive(false)
  866. self.washPro.gameObject:SetActive(false)
  867. self.spiritName.gameObject:SetActive(false)
  868. self.spiritPro.gameObject:SetActive(false)
  869. self.stone_conta.gameObject:SetActive(false)
  870. self.suitNum.gameObject:SetActive(false)
  871. self.suitName.gameObject:SetActive(false)
  872. self.suitPro.gameObject:SetActive(false)
  873. self.suitNameList.gameObject:SetActive(false)
  874. self.wake_baseName.gameObject:SetActive(false)
  875. self.wake_basePro.gameObject:SetActive(false)
  876. self.wake_baseAdd.gameObject:SetActive(false)
  877. self.wake_strenName.gameObject:SetActive(false)
  878. self.wake_strenPro.gameObject:SetActive(false)
  879. self.wake_strenAdd.gameObject:SetActive(false)
  880. self.wake_suitNum.gameObject:SetActive(false)
  881. self.wake_suitName.gameObject:SetActive(false)
  882. self.wake_suitPro.gameObject:SetActive(false)
  883. self.wake_suitAdd.gameObject:SetActive(false)
  884. self.magic_skillName.gameObject:SetActive(false)
  885. self.magic_skillLevel.gameObject:SetActive(false)
  886. self.expired_label.gameObject:SetActive(false)
  887. self.descCon.gameObject:SetActive(false)
  888. end
  889. function HorseEquipInfoTips:SmeltEquipFunc()
  890. -- if self.goods_vo then
  891. -- local vo = {goods_id = self.goods_vo.goods_id, num = 1}
  892. -- local goods_list = {}
  893. -- table.insert(goods_list, vo)
  894. -- self.horseModel:Fire(HorsePetEvent.HORSE_EQUIP_SMELT, goods_list)
  895. -- end
  896. local list = {}
  897. table.insert(list, self.goods_vo)
  898. self.horseModel:Fire(HorsePetEvent.OPEN_HORSE_SPLIT_TIPS, list)
  899. end
  900. -- function HorseEquipInfoTips:AdjustLayoutPos()
  901. -- if self.pos_x and self.pos_y then
  902. -- local layout_width = self.bg.sizeDelta.x + self.btn_conta.sizeDelta.x
  903. -- local layout_height = self.bg.sizeDelta.y
  904. -- local x,y = ScreenToViewportPoint(self.pos_x,self.pos_y)
  905. -- local iphone_x_offset = math.max(ClientConfig.iphone_x_offset_left,ClientConfig.iphone_x_offset_right)
  906. -- if x + layout_width + 50 + iphone_x_offset * 2 > SrcScreenWidth then
  907. -- x = SrcScreenWidth - layout_width - 90 - iphone_x_offset * 2
  908. -- end
  909. -- if y < layout_height + 50 then
  910. -- y = layout_height + 50
  911. -- end
  912. -- self.layout.anchoredPosition = Vector2(x,y - ScreenHeight)
  913. -- end
  914. -- end
  915. --计算父物体大小
  916. function HorseEquipInfoTips:CalculateSize(dynamic)
  917. local off_y = 0
  918. local line_y = 39
  919. off_y = self.basePro.preferredHeight + 15
  920. off_y = off_y + line_y
  921. local show_add = false
  922. -- if dynamic and dynamic.equip_extra_attr and #dynamic.equip_extra_attr > 0 then
  923. -- show_add = true
  924. -- end
  925. if self.open_type == HorseEquipInfoTips.UNKNOWN then
  926. local cfg = self.horseModel:GetHorseEquipAttrCfg(self.type_id)
  927. local equip_extra_attr = nil
  928. if cfg then
  929. equip_extra_attr = cfg.recommend_attr
  930. equip_extra_attr = ErlangParser:GetInstance():Parse(equip_extra_attr)
  931. end
  932. if equip_extra_attr and #equip_extra_attr > 0 then
  933. show_add = true
  934. end
  935. else
  936. if dynamic and dynamic.equip_extra_attr and #dynamic.equip_extra_attr > 0 then
  937. show_add = true
  938. end
  939. end
  940. if show_add then
  941. off_y = off_y + line_y
  942. off_y = off_y + self.addPro.preferredHeight + 10
  943. -- if self.open_type == HorseEquipInfoTips.UNKNOWN then
  944. -- off_y = off_y + 27
  945. -- end
  946. end
  947. SetSizeDelta(self.ScrollViewContent.transform, self.ScrollViewContent.sizeDelta.x, off_y)
  948. end
  949. --更新各个控件的位置
  950. function HorseEquipInfoTips:RefreshPosAndSize(dynamic)
  951. self.gameObject:SetActive(true)
  952. self:CalculateSize(dynamic)
  953. local off_y = 0
  954. local line_y = 39
  955. off_y = self.basePro.preferredHeight + 15
  956. SetSizeDelta(self.baseName.transform, self.baseName.transform.sizeDelta.x, off_y)
  957. SetSizeDelta(self.basePro.transform, self.basePro.transform.sizeDelta.x, off_y)
  958. SetSizeDelta(self.strengthAdd.transform, self.strengthAdd.transform.sizeDelta.x, off_y)
  959. off_y = off_y + line_y
  960. local show_add = false
  961. -- if dynamic and dynamic.equip_extra_attr and #dynamic.equip_extra_attr > 0 then
  962. -- show_add = true
  963. -- end
  964. if self.open_type == HorseEquipInfoTips.UNKNOWN then
  965. local cfg = self.horseModel:GetHorseEquipAttrCfg(self.type_id)
  966. local equip_extra_attr = nil
  967. if cfg then
  968. equip_extra_attr = cfg.recommend_attr
  969. equip_extra_attr = ErlangParser:GetInstance():Parse(equip_extra_attr)
  970. end
  971. if equip_extra_attr and #equip_extra_attr > 0 then
  972. show_add = true
  973. end
  974. else
  975. if dynamic and dynamic.equip_extra_attr and #dynamic.equip_extra_attr > 0 then
  976. show_add = true
  977. end
  978. end
  979. if show_add then
  980. self.line2.gameObject:SetActive(true)
  981. self.addName.gameObject:SetActive(true)
  982. self.addPro.gameObject:SetActive(true)
  983. self.line2.localPosition = Vector3(0, -off_y, 0)
  984. off_y = off_y + line_y
  985. --显示推荐属性
  986. -- if self.type and self.type == EquipShowTips.EQUIP_RECOMMAND_TARGET then
  987. -- SetSizeDelta(self.addName.transform, 130, self.addName.preferredHeight + 15)
  988. -- SetSizeDelta(self.addPro.transform, self.addPro.transform.sizeDelta.x, self.addPro.preferredHeight + 15)
  989. -- SetLocalPosition(self.addName.transform,self.addName.transform.localPosition.x, -off_y)
  990. -- SetLocalPosition(self.addPro.transform, 160, -off_y)
  991. -- else
  992. SetSizeDelta(self.addName.transform, self.addName.transform.sizeDelta.x, self.addName.preferredHeight + 15)
  993. SetSizeDelta(self.addPro.transform, self.addPro.preferredWidth--[[self.addPro.transform.sizeDelta.x--]], self.addPro.preferredHeight + 15)
  994. SetLocalPosition(self.addName.transform, self.addName.transform.localPosition.x, -off_y)
  995. SetLocalPosition(self.addPro.transform, self.addPro.transform.localPosition.x, -off_y)
  996. -- end
  997. off_y = off_y + self.addPro.preferredHeight + 10
  998. -- if self.open_type == HorseEquipInfoTips.UNKNOWN then
  999. -- off_y = off_y + 27
  1000. -- end
  1001. else
  1002. self.line2.gameObject:SetActive(false)
  1003. self.addName.gameObject:SetActive(false)
  1004. self.addPro.gameObject:SetActive(false)
  1005. end
  1006. SetSizeDelta(self.ScrollViewContent.transform, self.ScrollViewContent.sizeDelta.x, off_y)
  1007. SetSizeDelta(self.ScrollView.transform, self.ScrollView.sizeDelta.x, off_y)
  1008. SetSizeDelta(self.ScrollViewViewport.transform, self.ScrollViewViewport.sizeDelta.x, off_y)
  1009. SetSizeDelta(self.bg.transform, self.bg.sizeDelta.x, off_y - self.ScrollView.localPosition.y + 15 + (self.depot_conta.gameObject.activeSelf and 30 or 0))
  1010. self.btn_conta.anchoredPosition = Vector2(self.btn_conta.anchoredPosition.x, -(self.bg.sizeDelta.y - 100 - 15))
  1011. self.gameObject:SetActive(true)
  1012. end