源战役客户端
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.

491 lines
21 KiB

преди 4 седмици
  1. --[[@------------------------------------------------------------------
  2. @description:Tip
  3. @author:huangcong
  4. ----------------------------------------------------------------------]]
  5. EquipCompareTips = EquipCompareTips or BaseClass(BaseItem)
  6. local EquipCompareTips = EquipCompareTips
  7. function EquipCompareTips:__init(parent_wnd,prefab_asset,layer_name,equip_type)
  8. self.base_file = "common"
  9. self.equip_type = equip_type
  10. if self.equip_type < EquipModel.EquipType.Guard and self.equip_type >= EquipModel.EquipType.Necklace then--首饰
  11. self.layout_file = "EquipToolTips2"
  12. elseif self.equip_type == EquipModel.EquipType.Guard then--守护
  13. self.layout_file = "EquipToolTips2"
  14. else
  15. self.layout_file = "EquipToolTips"
  16. end
  17. self.is_delay_callback = true
  18. self.pos_x = 0
  19. self.pos_y = 0
  20. self.index = 1
  21. self.model = EquipModel:getInstance()
  22. self.btn_list = {}
  23. self.attr_item_list = {}
  24. self.equip_data = nil--装备数据
  25. self.have_zhuoyue = false--是否有卓越
  26. self.have_longyu = false--是否有刻印
  27. self.base_height = 150--基本高度
  28. self.min_height = 375--最低高度
  29. self.have_longyu_height = 687--有刻印的bg最高高度
  30. self.no_longyu_height = 560--无刻印的bg最高高度
  31. self.attr_scroll_height_min = 220
  32. self.attr_scroll_height_max = 403
  33. self:Load()
  34. end
  35. function EquipCompareTips:Load_callback()
  36. local nodes = {
  37. --界面通用部分
  38. "con/attr_scroll","con/equip_name:tmp","con/occupation:tmp","con/use_level:tmp","compare_conta","con/icon_con","con",
  39. "con/attr_scroll/Viewport/attr_con:obj","con/equip_num:txt","con/goods_name:tmp","con/hava_wear:obj","con/duibi:obj:img",
  40. "con/title_bg:img", "con/find_btn:obj","con/di_bg:img","con/goods_color_name:tmp", "con/bg/bgImg:img",
  41. --最终版UI新增节点
  42. "con/equip_num_title:tmp",
  43. --守护饰品特殊节点
  44. "con/guard_name:tmp", "con/guard_occupation:tmp", "con/guard_title_bg:img", "con/roleCon",
  45. "con/ornamentsCon/equip_skill_pro:tmp", "con/ornamentsCon/attrValue:tmp", "con/ornamentsCon/equip_skill_name:tmp",
  46. "con/ornamentsCon/descScroll/Viewport/descCon/descText:tmp", "con/ornamentsCon/proImg:img", "con/ornamentsCon:obj",
  47. "con/ornamentsCon/descScroll/Viewport/descCon/descImg2:obj", "con/ornamentsCon/descScroll/Viewport/descCon/descImg1:obj","con/ornamentsCon/descScroll/Viewport/descCon/descImg3:obj",
  48. "con/ornamentsCon/descScroll:scroll",
  49. }
  50. self:GetChildren(nodes)
  51. lua_resM:setOutsideImageSprite(self,self.bgImg_img,GameResPath.GetViewBigBg("equip_tool_tip_bg"),false)
  52. self.find_btn_obj:SetActive(false)
  53. self.icon_item = AwardItem.New(self.icon_con, false, self.layer_name)
  54. self.icon_item:SetEnableClick(false)
  55. self.icon_item:SetItemSize(78, 78)
  56. self.icon_item:ChangeCountVisible(false)
  57. self:InitEvent()
  58. if self.need_refreshData then
  59. self:SetData(self.data)
  60. end
  61. end
  62. function EquipCompareTips:InitEvent()
  63. -- local function onclick(target)
  64. -- end
  65. -- AddClickEvent(self.unload_btn_obj,onclick)
  66. local function updateOrnamentInfoFunc( vo )
  67. if self.equip_cfg and self.equip_cfg.series == vo.series and self.equip_cfg.equip_type == vo.pos and self.is_wear_equip then
  68. self.lv_exp_info = {vo.lv,vo.exp}
  69. if self.is_loaded and not self._use_delete_method then
  70. self:UpdateOrnamentInfo()
  71. end
  72. end
  73. end
  74. self:BindEvent(self.model,EquipModel.UPDATE_EQUIP_TOOL_TIPS_EXP_LV, updateOrnamentInfoFunc)
  75. end
  76. function EquipCompareTips:__delete( )
  77. cc.ActionManager:getInstance():removeAllActionsFromTarget(self.duibi)
  78. if self.icon_item then
  79. self.icon_item:DeleteMe()
  80. self.icon_item = nil
  81. end
  82. for i,v in ipairs(self.attr_item_list) do
  83. v:DeleteMe()
  84. v = nil
  85. end
  86. self.attr_item_list = {}
  87. end
  88. function EquipCompareTips:SetData(equip_data)
  89. self.equip_data = equip_data or self.equip_data
  90. if not self.equip_data then return end
  91. if self.is_loaded then
  92. self.need_refreshData = false
  93. else
  94. self.need_refreshData = true
  95. return
  96. end
  97. self.con.gameObject:SetActive(true)
  98. self.equip_cfg = self.model:GetEquipmentCfg(self.equip_data.type_id)
  99. self:UpdateInfo()
  100. self:UpdateAttrList()
  101. self:UpdateBgRes()--根据装备会显示不同的背景样式
  102. self:SetDuiBiState(self.duibi_state,self.up)
  103. end
  104. --更新基本信息
  105. function EquipCompareTips:UpdateInfo( )
  106. local is_wear_equip = EquipModel:getInstance():IsWearEquip(self.equip_data.goods_vo.goods_id)
  107. self.is_wear_equip = is_wear_equip
  108. self.hava_wear_obj:SetActive(is_wear_equip)
  109. local stren_data = EquipModel:getInstance():GetBagEquipAwaraItemInfo(self.equip_data.goods_vo)
  110. stren_data.equip_key = "EquipView"
  111. self.stren_data = stren_data
  112. --基本信息
  113. self.icon_item:SetData(self.equip_data.type_id, nil, nil, stren_data, nil,nil,nil,nil,nil,nil,nil,self.equip_data.have_career)
  114. self.use_level_tmp.text = string.format("等级:%s",self.equip_cfg.lv)
  115. local trun_str = "任意代"
  116. if self.equip_cfg.series ~= 99 then
  117. trun_str = ChineseNumber(self.equip_cfg.series)..""
  118. end
  119. -- self.equip_name_tmp.text = string.format("%s%s",trun_str,EquipConst.PosTypeName[self.equip_cfg.equip_type])
  120. local score = self.model:MathEquipScore(self.equip_data.goods_vo,self.equip_cfg.goods_id)
  121. -- self.equip_num_title_tmp.text = self.is_wear_equip and "评分" or ""
  122. -- self.equip_num_txt.text = self.is_wear_equip and score or ""
  123. self.equip_num_title_tmp.text = "评分"
  124. self.equip_num_txt.text = score
  125. end
  126. --更新属性信息
  127. function EquipCompareTips:UpdateAttrInfo( )
  128. self.attr_info = {}
  129. local attr_height = 0
  130. --基础属性
  131. if self.equip_cfg.base_attr and TableSize(self.equip_cfg.base_attr) ~= 0 then
  132. self.attr_info[#self.attr_info + 1] = {EquipToolTips.AttrType.BaseAttr,self.equip_cfg.base_attr}
  133. attr_height = attr_height + EquipToolTipsAttr.Height + #self.equip_cfg.base_attr*EquipToolTipsBaseAttr.Height
  134. end
  135. --高级属性
  136. local zhuoyue_attr = {}
  137. local strengthen_level = 0
  138. local goods_vo_gems_info = {}
  139. local guard_lv_exp_info = {}
  140. local star_evolution_lv = self.equip_cfg.color >= 3 and 1 or 0--星级升星属性等级
  141. local evolution_lv_max = self.model:GetEvoMaxLevel(self.equip_cfg.goods_id)
  142. local name = self.equip_cfg.name--名字要和高级属性的星级挂钩
  143. local empower_lv = 0
  144. if self.equip_cfg.color >= 5 and self.equip_cfg.equip_type ~= EquipModel.EquipType.Guard then--如果装备品质色红色并且不是守护则加一级升品属性
  145. empower_lv = self.equip_cfg.color - 4
  146. end
  147. if self.equip_data.goods_vo then
  148. for k,v in pairs(self.equip_data.goods_vo.other_data or {}) do
  149. if v.type == GoodsModel.GoodsInfoType.EquipEvoLevel and self.equip_cfg.equip_type < EquipModel.EquipType.Necklace then--非首饰读特殊属性
  150. star_evolution_lv = tonumber(v.info)
  151. elseif v.type == GoodsModel.GoodsInfoType.EquipmentLv then
  152. strengthen_level = tonumber(v.info)
  153. elseif v.type == GoodsModel.GoodsInfoType.GemestoneLv then--宝石信息
  154. goods_vo_gems_info = stringtotable(v.info)
  155. elseif v.type == GoodsModel.GoodsInfoType.EquipEmpower then--赋能等级
  156. empower_lv = tonumber(v.info)
  157. elseif v.type == GoodsModel.GoodsInfoType.EquipLvExp then--首饰经验值和等级
  158. guard_lv_exp_info = stringtotable(v.info)
  159. end
  160. end
  161. if self.is_wear_equip then--如果是自己的就去请求
  162. self.model:Fire(EquipModel.REQUEST_CCMD_EVENT,15225,self.equip_cfg.series,self.equip_cfg.equip_type)
  163. else
  164. if guard_lv_exp_info and #guard_lv_exp_info > 0 then
  165. self.lv_exp_info = guard_lv_exp_info[1]
  166. end
  167. end
  168. --升星属性
  169. if star_evolution_lv > 0 then
  170. local evolution_attr_list = {}
  171. local attr_cfg = self.model:GetEquipEvolutionCfg(self.equip_cfg.goods_id,star_evolution_lv)
  172. if attr_cfg then
  173. self.attr_info[#self.attr_info + 1] = {EquipToolTips.AttrType.EvolutionAttr,attr_cfg.attr,evolution_lv_max}
  174. attr_height = attr_height + EquipToolTipsAttr.Height + #attr_cfg.attr*EquipToolTipsBaseAttr.Height
  175. end
  176. end
  177. end
  178. if self.equip_cfg.equip_type >= EquipModel.EquipType.Necklace then--首饰展示预览升星属性
  179. for k,attr_cfg in ipairs(self.equip_cfg.great_attr_list or {}) do
  180. zhuoyue_attr[#zhuoyue_attr + 1] = {[1] = attr_cfg}
  181. end
  182. else
  183. local equip_evo_cfg = self.model:GetEquipEvolutionCfg(self.equip_cfg.goods_id,star_evolution_lv)
  184. if equip_evo_cfg and equip_evo_cfg.great_attr_list then
  185. for i=1,evolution_lv_max do
  186. zhuoyue_attr[#zhuoyue_attr + 1] = {[1] = equip_evo_cfg.great_attr_list[i]}
  187. end
  188. end
  189. end
  190. if self.equip_data.goods_vo and self.equip_data.goods_vo.is_evolution_show then--装备是否是升星下一级展示
  191. zhuoyue_attr[#zhuoyue_attr + 1] = {is_evolution_show = true}
  192. end
  193. if zhuoyue_attr and TableSize(zhuoyue_attr) ~= 0 then
  194. local evolution_lv_max = self.model:GetEvoMaxLevel(self.equip_cfg.goods_id)
  195. self.attr_info[#self.attr_info + 1] = {EquipToolTips.AttrType.ZhuoyueAttr,zhuoyue_attr,evolution_lv_max}
  196. attr_height = attr_height + EquipToolTipsAttr.Height + #zhuoyue_attr*EquipToolTipsBaseAttr.Height
  197. end
  198. --宝石属性
  199. if self.equip_cfg.equip_type ~= EquipModel.EquipType.Guard then
  200. if self.is_wear_equip then
  201. local gems_info = self.model:GetGemstoneSeriesInfo(self.equip_cfg.series,self.equip_cfg.equip_type)
  202. if gems_info and TableSize(gems_info) > 0 then
  203. self.attr_info[#self.attr_info + 1] = {EquipToolTips.AttrType.GemstoneAttr,gems_info}--构造数据
  204. else
  205. self.attr_info[#self.attr_info + 1] = {EquipToolTips.AttrType.GemstoneAttr,{}}--构造数据
  206. end
  207. elseif goods_vo_gems_info and #goods_vo_gems_info > 0 then--如果不是自己身上的就要去物品信息里面找
  208. local gems_info = self.model:GetGemstoneEquipToolTipsInfo(goods_vo_gems_info)
  209. if gems_info and TableSize(gems_info) > 0 then
  210. self.attr_info[#self.attr_info + 1] = {EquipToolTips.AttrType.GemstoneAttr,gems_info}--构造数据
  211. else
  212. self.attr_info[#self.attr_info + 1] = {EquipToolTips.AttrType.GemstoneAttr,{}}--构造数据
  213. end
  214. else
  215. self.attr_info[#self.attr_info + 1] = {EquipToolTips.AttrType.GemstoneAttr,{}}--构造数据
  216. end
  217. end
  218. --刻印属性
  219. if self.is_wear_equip then
  220. local equip_type = self.equip_cfg.equip_type
  221. local info_list = self.model:GetEquipPosInfoList(equip_type)
  222. if info_list and info_list.carve_id and info_list.carve_id ~= 0 then--刻印激活数据
  223. local draconic_cfg = Config.Equipmentcarve[info_list.carve_id]
  224. if draconic_cfg then
  225. self.attr_info[#self.attr_info + 1] = {EquipToolTips.AttrType.DraconicAttr,draconic_cfg}--构造数据
  226. end
  227. end
  228. end
  229. --升品属性
  230. if self.is_wear_equip then--如果是已穿戴就拿自己的
  231. if self.equip_cfg and self.equip_cfg.series ~= 99 then
  232. local server_info = EquipModel:getInstance():GetRedEquipInfo(self.equip_cfg.series,self.equip_cfg.equip_type)
  233. if server_info then
  234. empower_lv = server_info and server_info.lv or 0
  235. end
  236. end
  237. end
  238. if empower_lv > 0 then
  239. local empower_cfg = self.model:GetRedEquipCfg(self.equip_cfg.series,self.equip_cfg.equip_type,empower_lv)
  240. if empower_cfg.attr then
  241. self.attr_info[#self.attr_info + 1] = {EquipToolTips.AttrType.EmpowerAttr,empower_cfg.attr}
  242. attr_height = attr_height + EquipToolTipsAttr.Height + #self.equip_cfg.base_attr*EquipToolTipsBaseAttr.Height
  243. end
  244. local goods_name = GoodsModel:getInstance():getGoodsName(self.equip_cfg.goods_id, false)
  245. if empower_lv == 1 then--红色名字
  246. self.goods_name_tmp.text = self.equip_cfg.equip_type ~= EquipModel.EquipType.Guard and HtmlColorTxt(goods_name, ColorUtil.RED_DARK) or ""
  247. self.guard_name_tmp.text = self.equip_cfg.equip_type == EquipModel.EquipType.Guard and HtmlColorTxt(goods_name, ColorUtil.RED_DARK) or ""
  248. self.goods_color_name_tmp.text = ""
  249. elseif empower_lv == 2 then--粉色名字
  250. self.goods_name_tmp.text = self.equip_cfg.equip_type ~= EquipModel.EquipType.Guard and HtmlColorTxt(goods_name, ColorUtil.PINK_DARK) or ""
  251. self.guard_name_tmp.text = self.equip_cfg.equip_type == EquipModel.EquipType.Guard and HtmlColorTxt(goods_name, ColorUtil.PINK_DARK) or ""
  252. self.goods_color_name_tmp.text = ""
  253. elseif empower_lv == 3 then--红色名字
  254. self.goods_name_tmp.text = ""
  255. self.guard_name_tmp.text = ""
  256. self.goods_color_name_tmp.text = goods_name
  257. end
  258. else
  259. local goods_name = GoodsModel:getInstance():getGoodsName(self.equip_cfg.goods_id, true)
  260. self.goods_name_tmp.text = self.equip_cfg.equip_type ~= EquipModel.EquipType.Guard and goods_name or ""
  261. self.guard_name_tmp.text = self.equip_cfg.equip_type == EquipModel.EquipType.Guard and goods_name or ""
  262. end
  263. self.empower_lv = empower_lv
  264. --套件属性
  265. if self.equip_cfg.equip_type ~= EquipModel.EquipType.Guard then
  266. local suit_cfg_list = self.model:GetEquipmentSuitCfg(self.equip_cfg.series,self.equip_cfg.equip_type >= EquipModel.EquipType.Necklace and 2 or 1)
  267. if suit_cfg_list then
  268. local cur_suit_id_num,suit_equip_pos_list = 0,{}
  269. if self.is_wear_equip then
  270. cur_suit_id_num,suit_equip_pos_list = GoodsModel:getInstance():GetEquipSuitNum(self.equip_cfg.series,self.equip_cfg.equip_type >= EquipModel.EquipType.Necklace and 2 or 1)
  271. elseif self.equip_data and self.equip_data.goods_vo and self.equip_cfg.equip_type < EquipModel.EquipType.Necklace then
  272. cur_suit_id_num = self.equip_data.goods_vo.cur_suit_id_num or cur_suit_id_num
  273. suit_equip_pos_list = self.equip_data.goods_vo.suit_equip_pos_list or suit_equip_pos_list
  274. elseif self.equip_data and self.equip_data.goods_vo and self.equip_cfg.equip_type < EquipModel.EquipType.Necklace then
  275. cur_suit_id_num = self.equip_data.goods_vo.necklace_cur_suit_id_num or necklace_cur_suit_id_num
  276. suit_equip_pos_list = self.equip_data.goods_vo.necklace_suit_equip_pos_list or necklace_suit_equip_pos_list
  277. end
  278. local suit_data = {
  279. is_color_ok = self.equip_cfg.color >= 4,
  280. cur_suit_id_num = cur_suit_id_num,
  281. suit_equip_pos_list = suit_equip_pos_list,
  282. }
  283. self.attr_info[#self.attr_info + 1] = {EquipToolTips.AttrType.SuitAttr,suit_cfg_list,suit_data}--构造数据--true代表是否
  284. attr_height = attr_height + EquipToolTipsAttr.Height + #suit_cfg_list*EquipToolTipsSuitAttr.Height*2 + 45
  285. end
  286. end
  287. local sort_func = function ( a, b )
  288. return a[1] < b[1]
  289. end
  290. table.sort(self.attr_info, sort_func)
  291. self.attr_height = attr_height + 150
  292. self.strengthen_level = strengthen_level--强化等级
  293. local strength_level_cfg = self.model:GetEquipStrengthAttrCfg(self.equip_cfg.goods_id,self.strengthen_level)--强化属性
  294. if strength_level_cfg and strength_level_cfg.attr then
  295. self.strengthen_info = {self.strengthen_level,strength_level_cfg.attr}
  296. end
  297. self.attr_info[1] = {EquipToolTips.AttrType.BaseAttr,self.equip_cfg.base_attr,self.strengthen_info}
  298. -- print("huangcong:EquipToolTips [start:505] 1:", 1)
  299. SetSizeDeltaY(self.attr_con,self.attr_height)
  300. -- print("huangcong:EquipToolTips [start:209] self.attr_info:", self.attr_info)
  301. -- PrintTable(self.attr_info)
  302. -- print("huangcong:EquipToolTips [end]")
  303. end
  304. --更新属性列表
  305. function EquipCompareTips:UpdateAttrList( )
  306. self:UpdateAttrInfo()
  307. for k,v in pairs(self.attr_item_list) do
  308. v:SetVisible(false)
  309. end
  310. local function load_ok( ... )
  311. self.attr_con_obj:SetActive(true)
  312. end
  313. local item_list = self.attr_info
  314. self.attr_con_obj:SetActive(false)
  315. if not item_list or TableSize(item_list) == 0 then return end
  316. local offer_x = 0
  317. local offer_y = 0
  318. local x = 0
  319. local y = 0
  320. for i, v in ipairs(item_list) do
  321. local item = self.attr_item_list[i]
  322. if item == nil then
  323. item = EquipToolTipsAttr.New(self.attr_con,nil,self.layer_name)
  324. item:SetCallBack(load_ok)
  325. self.attr_item_list[i] = item
  326. end
  327. item:SetData(v[2],v[1],v[3],self.equip_cfg,i == #item_list,self.empower_lv)
  328. item:SetVisible(true)
  329. end
  330. end
  331. function EquipCompareTips:SetDuiBiState( bool,up )--设置对比状态
  332. do return end
  333. self.duibi_state = bool
  334. self.up = up
  335. if self.is_loaded then
  336. self:SetDuiBiAction(up)
  337. self.duibi_obj:SetActive(bool)
  338. lua_resM:setImageSprite(self, self.duibi_img, "common_asset", up and "tyui_Arrow_1" or "tyui_Arrow_2",true)
  339. end
  340. end
  341. function EquipCompareTips:SetDuiBiAction( bool )
  342. if bool then
  343. cc.ActionManager:getInstance():removeAllActionsFromTarget(self.duibi)
  344. SetLocalPositionY(self.duibi, -80)
  345. local x, y = self.duibi:GetLocalPosXY()
  346. local action = cc.FloatFadeIn.New(x, y, 0, 10, 0.5, 0.5, self.duibi)
  347. cc.ActionManager:getInstance():addAction(action, self.duibi)
  348. else
  349. SetLocalPositionY(self.duibi, -74)
  350. cc.ActionManager:getInstance():removeAllActionsFromTarget(self.duibi)
  351. end
  352. end
  353. --根据装备不同会显示不同的背景样式
  354. function EquipCompareTips:UpdateBgRes( )
  355. local bg_res = "equip_tool_tip_bg"
  356. local attr_scroll_height = 482
  357. local attr_scroll_pos = {12,-110}
  358. local find_btn_x = 119
  359. local occupation_str = self.model:GetCareerDesc(self.equip_cfg.career) or "全职业可用"--暂时还没定
  360. local goods_vo = GoodsModel:getInstance():GetGoodsBasicByTypeId(self.equip_data.type_id)--这里要等属性计算完了才能知道具体的品质
  361. if not goods_vo then return end
  362. if self.equip_cfg.equip_type < EquipModel.EquipType.Guard and self.equip_cfg.equip_type >= EquipModel.EquipType.Necklace then--首饰
  363. bg_res = "equip_tool_tip_bg2"
  364. attr_scroll_height = 300
  365. self.occupation_tmp.text = occupation_str
  366. lua_resM:setImageSprite(self, self.title_bg_img, "commonTipBg_asset", "ui_com_quality_bg_"..goods_vo.color + self.empower_lv,true)
  367. self:UpdateOrnamentInfo()
  368. self.ornamentsCon_obj:SetActive(true)
  369. elseif self.equip_cfg.equip_type == EquipModel.EquipType.Guard then--守护
  370. bg_res = "equip_tool_tip_bg2"
  371. attr_scroll_height = 130
  372. find_btn_x = 109
  373. attr_scroll_pos = {12,-282}
  374. self.guard_occupation_tmp.text = occupation_str
  375. lua_resM:setImageSprite(self, self.guard_title_bg_img, "commonTipBg_asset", "ui_com_g_quality_bg_"..goods_vo.color + self.empower_lv,true)
  376. self.icon_con.gameObject:SetActive(false)
  377. self.ornamentsCon_obj:SetActive(true)
  378. --更新守护模型
  379. self:UpdateEvilModel()
  380. self:UpdateOrnamentInfo()
  381. else
  382. self.ornamentsCon_obj:SetActive(false)
  383. self.occupation_tmp.text = occupation_str
  384. lua_resM:setImageSprite(self, self.title_bg_img, "commonTipBg_asset", "ui_com_quality_bg_"..goods_vo.color + self.empower_lv,false)
  385. end
  386. lua_resM:setImageSprite(self, self.di_bg_img, "commonTipBg_asset", "ui_com_quality_samll_bg_"..goods_vo.color + self.empower_lv,true)
  387. SetAnchoredPositionX(self.find_btn,find_btn_x)
  388. SetAnchoredPosition(self.attr_scroll,attr_scroll_pos[1],attr_scroll_pos[2])
  389. SetSizeDeltaY(self.attr_scroll,attr_scroll_height)
  390. lua_resM:setOutsideImageSprite(self,self.bgImg_img,GameResPath.GetViewBigBg(bg_res),false)
  391. end
  392. function EquipCompareTips:UpdateOrnamentInfo( )
  393. local lv = 1--这两个从服务端那边拿
  394. local cur_exp = 0--这两个从服务端那边拿
  395. if self.lv_exp_info and self.lv_exp_info[1] then
  396. lv = self.lv_exp_info[1]
  397. cur_exp = self.lv_exp_info[2]
  398. end
  399. local sp_cfg = Config.Equipmentspinfo[self.equip_cfg.series.."@"..self.equip_cfg.equip_type]
  400. if sp_cfg then
  401. self.equip_skill_name_tmp.text = string.format("%s Lv.%s",HtmlColorTxt(Trim(sp_cfg.name), "#66abff"),lv)
  402. if string.find(Trim(sp_cfg.desc), "\\") then
  403. self.descImg2.gameObject:SetActive(true)
  404. SetAnchoredPositionY(self.descImg1,-17)
  405. SetAnchoredPositionY(self.descText,-52)
  406. else
  407. SetAnchoredPositionY(self.descImg1,-28)
  408. SetAnchoredPositionY(self.descText,-63)
  409. self.descImg2.gameObject:SetActive(false)
  410. end
  411. self.descText_tmp.text = ChuanWenManager:getInstance():FormatColorTag2(string.gsub(Trim(sp_cfg.desc), "\\n", "\n"), true)
  412. local attr_cfg = Config.Equipmentspattr[self.equip_cfg.series.."@"..self.equip_cfg.equip_type.."@"..lv]
  413. if attr_cfg then
  414. self.equip_skill_pro_tmp.text = string.format("%s/%s",cur_exp,attr_cfg.next_exp)
  415. self.proImg_img.fillAmount = cur_exp/attr_cfg.next_exp
  416. local attr_info = DeepCopy(stringtotable(attr_cfg.attr))--{{1,40}}
  417. if attr_info then
  418. local attr_name = WordManager:GetProperties(attr_info[1][1])
  419. local attr_value = WordManager:GetPropertyValue(attr_info[1][1],attr_info[1][2])
  420. local cur_attr_str = string.format("%s %s",attr_name,attr_value)
  421. local next_attr_cfg = Config.Equipmentspattr[self.equip_cfg.series.."@"..self.equip_cfg.equip_type.."@"..(lv+1)]
  422. local next_attr_str = "(当前已满级)"
  423. if next_attr_cfg then
  424. local next_attr_info = DeepCopy(stringtotable(next_attr_cfg.attr))--{{1,40}}
  425. local next_attr_name = WordManager:GetProperties(next_attr_info[1][1])
  426. local next_attr_value = WordManager:GetPropertyValue(next_attr_info[1][1],next_attr_info[1][2])
  427. next_attr_str = string.format(" 下级效果 %s %s",next_attr_name,next_attr_value)
  428. end
  429. self.attrValue_tmp.text = cur_attr_str..HtmlColorTxt(next_attr_str, ColorUtil.GREEN_DARK)
  430. end
  431. end
  432. end
  433. end
  434. --更新守护模型
  435. function EquipCompareTips:UpdateEvilModel( )
  436. local basic = GoodsModel:getInstance():GetGoodsBasicByTypeId(self.equip_data.type_id)
  437. if not basic then return end
  438. local evil_id = basic.model_id
  439. local pos_cfg = EquipConst.EvilModelResPos[evil_id]
  440. local scale = 185
  441. local pos = Vector3(0,0,0)
  442. if pos_cfg then
  443. -- scale = pos_cfg.scale
  444. pos = pos_cfg.pos
  445. end
  446. local data = {
  447. clothe_res_id = evil_id,
  448. type = SceneBaseType.Evil,
  449. on_name_list = {"show"},
  450. scale = scale,
  451. position = pos,
  452. layer_name = self.layer_name,
  453. }
  454. lua_resM:SetRoleModel(self,self.roleCon,data)
  455. end