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

45 lines
1.3 KiB

  1. goodsTooltipsAttrItem = goodsTooltipsAttrItem or BaseClass(BaseItem)
  2. function goodsTooltipsAttrItem:__init(parent_wnd, prefab_asset, layer_name)
  3. self.base_file = "common"
  4. self.layout_file = "goodsTooltipsAttrItem"
  5. self.layer_name = "Top"
  6. self:Load()
  7. end
  8. function goodsTooltipsAttrItem:Load_callback()
  9. self.name,
  10. self.value
  11. = GetChildTexts(self.transform, {
  12. "name",
  13. "value"
  14. })
  15. self.signImg = self:GetChild("sign"):GetComponent("Image")
  16. self.bg = self:GetChild("bg").gameObject
  17. if self.need_refreshData then
  18. self:SetData(self.id, self.now_value,self.boolBgActive)
  19. end
  20. end
  21. function goodsTooltipsAttrItem:SetData(id, now_value,boolBgActive)
  22. self.id = id
  23. self.now_value = now_value
  24. self.boolBgActive = boolBgActive
  25. if self.is_loaded then
  26. local _, name, _, value = WordManager:GetPropertyInfo(tonumber(id), now_value,nil,nil, Config.ConfigItemAttr.Module.Dress)
  27. self.name.text = name..":"
  28. self.value.text = value
  29. local ab_name,res_name = GameResPath.GetAttrIcon(tonumber(id))
  30. lua_resM:setImageSprite(self, self.signImg, ab_name,res_name,true)
  31. self.bg:SetActive(self.boolBgActive)
  32. else
  33. self.need_refreshData = true
  34. end
  35. end
  36. function goodsTooltipsAttrItem:__delete()
  37. end