Skip to content

Commit

Permalink
属性系统支持复合属性
Browse files Browse the repository at this point in the history
  • Loading branch information
xiyoo0812 committed May 30, 2024
1 parent 08c8ed4 commit 89c62c0
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions server/business/component/attr_component.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ local config_mgr = quanta.get("config_mgr")

local attr_db = config_mgr:get_table("attribute")

local AttrID = quanta.enum("AttrID")
local AttrID = enum("AttrID")
local COMPLEX_ID = 1000

--复合属性定义: { 后缀,类型,是否存库}
Expand Down Expand Up @@ -169,6 +169,10 @@ function AttrComponent:set_attr(attr_id, value, service_id)
self:save_attrs_field(attr_id, value)
else
self:set_attrs_field(attr_id, value)
end
--复合属性
if attr.base then
self:update_attr(attr.base)
end
self:on_attr_changed(attr_id, attr, value, cur_val, service_id)
return true
Expand Down Expand Up @@ -201,11 +205,6 @@ function AttrComponent:on_attr_changed(attr_id, attr, value, oldval, service_id)
event_mgr:notify_frame(self, "on_attr_relay", self.id)
end
end
--复合属性
if attr.base then
self:update_attr(attr.base)
return
end
self:notify_attr(attr_id, value, oldval, attr)
end
end
Expand All @@ -224,7 +223,9 @@ function AttrComponent:update_attr(attr_id)
end
self:set_attrs_field(attr_id, value)
--通知改变
self:notify_attr(attr_id, value, cur_val, self.attrset[attr_id])
if self:is_load_success() then
self:notify_attr(attr_id, value, cur_val, self.attrset[attr_id])
end
end

--属性改变通知
Expand Down

0 comments on commit 89c62c0

Please sign in to comment.