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

69 lines
1.9 KiB

  1. ChatDressPropItem = ChatDressPropItem or BaseClass(BaseItem)
  2. function ChatDressPropItem:__init(parent_wnd, prefab_asset, layer_name, update_type)
  3. self.base_file = "chatDress"
  4. self.layout_file = "ChatDressPropItem"
  5. if update_type then
  6. self.layout_file = "ChatDressUpdatePropItem"
  7. end
  8. -- self.use_local_view = true
  9. self:Load()
  10. end
  11. function ChatDressPropItem:Load_callback()
  12. self.title,
  13. self.value
  14. -- self.up_value
  15. = GetChildTexts(self.transform, {
  16. "title",
  17. "value"
  18. -- "up/value"
  19. })
  20. -- self.up,
  21. self.bg
  22. = GetChildGameObjects(self.transform, {
  23. -- "up",
  24. "bg"
  25. })
  26. if self.need_refreshData then
  27. self:SetData(self.id, self.now_value, self.color_type)
  28. end
  29. end
  30. function ChatDressPropItem:SetData(id, now_value, color_type)
  31. self.id = id
  32. self.now_value = now_value
  33. --self.hide_index = hide_index or 1
  34. -- self.add = add
  35. self.color_type = color_type
  36. if self.is_loaded then
  37. color_type = color_type or 1
  38. local colorStr = ""
  39. if color_type == 1 then
  40. colorStr = Color(24/255,164/255,38/255)
  41. elseif color_type == 2 then
  42. colorStr = Color(72/255,72/255,72/255)
  43. end
  44. -- self.bg:SetActive(hide_index % 2 ~= 0)
  45. local _, name, _, value = WordManager:GetPropertyInfo(tonumber(id), now_value,nil,nil, Config.ConfigItemAttr.Module.Dress)
  46. self.title.text = name.."+"..value
  47. self.title.color = colorStr
  48. -- self.value.text = value
  49. --if add and add > 0 then
  50. -- self.up:SetActive(true)
  51. -- local _, name2, _, value2 = WordManager:GetPropertyInfo(tonumber(id),add, nil,nil,Config.ConfigItemAttr.Module.Dress)
  52. -- self.up_value.text = value2
  53. --else
  54. -- self.up:SetActive(false)
  55. -- end
  56. else
  57. self.need_refreshData = true
  58. end
  59. end
  60. function ChatDressPropItem:__delete()
  61. end