源战役客户端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

81 行
2.5 KiB

  1. PsionicSkillAttrItem = PsionicSkillAttrItem or BaseClass(BaseItem)
  2. local PsionicSkillAttrItem = PsionicSkillAttrItem
  3. function PsionicSkillAttrItem:__init(parent_wnd,prefab_asset,layer_name)
  4. self.base_file = "psionic"
  5. self.layout_file = "PsionicSkillAttrItem"
  6. self.parent_wnd = parent_wnd
  7. self.layer_name = layer_name
  8. self.model = PsionicModel:getInstance()
  9. self:Load()
  10. end
  11. function PsionicSkillAttrItem:Load_callback()
  12. local nodes = {
  13. "arrow:img",
  14. "val_name:tmp",
  15. "val:tmp",
  16. "val_add:tmp",
  17. "effect_con",
  18. }
  19. self:GetChildren(nodes)
  20. self:AddEvents()
  21. if self.need_refreshData then
  22. self:UpdateView()
  23. end
  24. end
  25. -- 需特殊处理隐藏时的特效表现
  26. function PsionicSkillAttrItem:SetVisible(state, force_hide)
  27. BaseItem.SetVisible(self, state, force_hide)
  28. if not state then
  29. self:ClearUIEffect(self.effect_con)
  30. self.showing_effect = false
  31. end
  32. end
  33. function PsionicSkillAttrItem:AddEvents( )
  34. local function play_effect(type)
  35. if type and type == PsionicConst.EffectType.Skill and not self.showing_effect then
  36. local function callback()
  37. self.showing_effect = false
  38. end
  39. self:ClearUIEffect(self.effect_con)
  40. self:AddUIEffect("ui_jinjieshuxing", self.effect_con, self.layer_name, Vector3(-175, 0, 0), 1, false, 0.75, nil, call_back)
  41. self.showing_effect = true
  42. end
  43. end
  44. self:BindEvent(self.model, PsionicConst.PLAY_EFFECT, play_effect)
  45. end
  46. function PsionicSkillAttrItem:UpdateView( )
  47. if self.data then
  48. if self.data.attr_list then -- 判断满级的情况,等级
  49. self.val_name_tmp.text = WordManager:GetProperties(self.data.attr_list.type)
  50. local cur_val = WordManager:GetPropertyValue(self.data.attr_list.type, self.data.attr_list.cur_val)
  51. local next_val = self.data.is_max and "" or "+" .. WordManager:GetPropertyValue(self.data.attr_list.type, self.data.attr_list.next_val - self.data.attr_list.cur_val)
  52. self.val_tmp.text = cur_val
  53. self.val_add_tmp.text = next_val
  54. self.arrow_img.enabled = not self.data.is_max and true or false
  55. end
  56. end
  57. end
  58. function PsionicSkillAttrItem:SetData( data, index )
  59. self.data = data
  60. self.index = index
  61. if self.is_loaded then
  62. self.need_refreshData = false
  63. self:UpdateView()
  64. else
  65. self.need_refreshData = true
  66. end
  67. end
  68. function PsionicSkillAttrItem:__delete( )
  69. end