mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 10:02:18 +02:00
#66 Add set_whitelist and set_blacklist functions
This commit is contained in:
@@ -1058,3 +1058,66 @@ embedded_instances {
|
||||
z: 1.0
|
||||
}
|
||||
}
|
||||
embedded_instances {
|
||||
id: "system_whitelist_blacklist"
|
||||
data: "components {\n"
|
||||
" id: \"screen_factory\"\n"
|
||||
" component: \"/monarch/screen_factory.script\"\n"
|
||||
" position {\n"
|
||||
" x: 0.0\n"
|
||||
" y: 0.0\n"
|
||||
" z: 0.0\n"
|
||||
" }\n"
|
||||
" rotation {\n"
|
||||
" x: 0.0\n"
|
||||
" y: 0.0\n"
|
||||
" z: 0.0\n"
|
||||
" w: 1.0\n"
|
||||
" }\n"
|
||||
" properties {\n"
|
||||
" id: \"screen_id\"\n"
|
||||
" value: \"system_whitelist_blacklist\"\n"
|
||||
" type: PROPERTY_TYPE_HASH\n"
|
||||
" }\n"
|
||||
" properties {\n"
|
||||
" id: \"popup\"\n"
|
||||
" value: \"true\"\n"
|
||||
" type: PROPERTY_TYPE_BOOLEAN\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"embedded_components {\n"
|
||||
" id: \"collectionfactory\"\n"
|
||||
" type: \"collectionfactory\"\n"
|
||||
" data: \"prototype: \\\"/example/examples/system/whitelist_blacklist/whitelist_blacklist.collection\\\"\\n"
|
||||
"load_dynamically: false\\n"
|
||||
"\"\n"
|
||||
" position {\n"
|
||||
" x: 0.0\n"
|
||||
" y: 0.0\n"
|
||||
" z: 0.0\n"
|
||||
" }\n"
|
||||
" rotation {\n"
|
||||
" x: 0.0\n"
|
||||
" y: 0.0\n"
|
||||
" z: 0.0\n"
|
||||
" w: 1.0\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
""
|
||||
position {
|
||||
x: 0.0
|
||||
y: 0.0
|
||||
z: 0.0
|
||||
}
|
||||
rotation {
|
||||
x: 0.0
|
||||
y: 0.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
scale3 {
|
||||
x: 1.0
|
||||
y: 1.0
|
||||
z: 1.0
|
||||
}
|
||||
}
|
||||
|
@@ -130,6 +130,7 @@ local function init_lobby(self)
|
||||
|
||||
self.lobby_grid:add(get_title(self, "System"))
|
||||
self.lobby_grid:add(get_button_disabled(self, "Styles"))
|
||||
self.lobby_grid:add(get_button(self, "Whitelist / Blacklist", "system_whitelist_blacklist"))
|
||||
self.lobby_grid:add(get_button_disabled(self, "Custom components"))
|
||||
self.lobby_grid:add(get_button_disabled(self, "Component interests"))
|
||||
self.lobby_grid:add(get_button_disabled(self, "Nested Druids"))
|
||||
|
@@ -0,0 +1,37 @@
|
||||
name: "whitelist_blacklist"
|
||||
scale_along_z: 0
|
||||
embedded_instances {
|
||||
id: "go"
|
||||
data: "components {\n"
|
||||
" id: \"whitelist_blacklist\"\n"
|
||||
" component: \"/example/examples/system/whitelist_blacklist/whitelist_blacklist.gui\"\n"
|
||||
" position {\n"
|
||||
" x: 0.0\n"
|
||||
" y: 0.0\n"
|
||||
" z: 0.0\n"
|
||||
" }\n"
|
||||
" rotation {\n"
|
||||
" x: 0.0\n"
|
||||
" y: 0.0\n"
|
||||
" z: 0.0\n"
|
||||
" w: 1.0\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
""
|
||||
position {
|
||||
x: 0.0
|
||||
y: 0.0
|
||||
z: 0.0
|
||||
}
|
||||
rotation {
|
||||
x: 0.0
|
||||
y: 0.0
|
||||
z: 0.0
|
||||
w: 1.0
|
||||
}
|
||||
scale3 {
|
||||
x: 1.0
|
||||
y: 1.0
|
||||
z: 1.0
|
||||
}
|
||||
}
|
1864
example/examples/system/whitelist_blacklist/whitelist_blacklist.gui
Normal file
1864
example/examples/system/whitelist_blacklist/whitelist_blacklist.gui
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,66 @@
|
||||
local druid = require("druid.druid")
|
||||
|
||||
|
||||
local function click_callback(self)
|
||||
print("Just tap callback")
|
||||
end
|
||||
|
||||
|
||||
function init(self)
|
||||
self.druid_whitelist = druid.new(self)
|
||||
|
||||
-- Whitelist
|
||||
self.button_wl_left = self.druid_whitelist:new_button("button_whitelist_1/button", click_callback)
|
||||
self.button_wl_middle = self.druid_whitelist:new_button("button_whitelist_2/button", click_callback)
|
||||
self.button_wl_right = self.druid_whitelist:new_button("button_whitelist_3/button", click_callback)
|
||||
self.druid_whitelist:set_whitelist(self.button_wl_left)
|
||||
|
||||
|
||||
self.druid_blacklist = druid.new(self)
|
||||
|
||||
-- Blacklist
|
||||
self.button_bl_left = self.druid_blacklist:new_button("button_blacklist_1/button", click_callback)
|
||||
self.button_bl_middle = self.druid_blacklist:new_button("button_blacklist_2/button", click_callback)
|
||||
self.button_bl_right = self.druid_blacklist:new_button("button_blacklist_3/button", click_callback)
|
||||
self.druid_blacklist:set_blacklist(self.button_bl_left)
|
||||
|
||||
|
||||
self.druid_wb = druid.new(self)
|
||||
|
||||
-- Blacklist and Whitelist
|
||||
self.button_wb_left = self.druid_wb:new_button("button_wb_1/button", click_callback)
|
||||
self.button_wb_middle = self.druid_wb:new_button("button_wb_2/button", click_callback)
|
||||
self.button_wb_right = self.druid_wb:new_button("button_wb_3/button", click_callback)
|
||||
self.druid_wb:set_whitelist(self.button_wb_left)
|
||||
self.druid_wb:set_blacklist(self.button_wb_left)
|
||||
end
|
||||
|
||||
|
||||
function final(self)
|
||||
self.druid_whitelist:final()
|
||||
self.druid_blacklist:final()
|
||||
self.druid_wb:final()
|
||||
end
|
||||
|
||||
|
||||
function update(self, dt)
|
||||
self.druid_whitelist:update(dt)
|
||||
self.druid_blacklist:update(dt)
|
||||
self.druid_wb:update(dt)
|
||||
end
|
||||
|
||||
|
||||
function on_message(self, message_id, message, sender)
|
||||
self.druid_whitelist:on_message(message_id, message, sender)
|
||||
self.druid_blacklist:on_message(message_id, message, sender)
|
||||
self.druid_wb:on_message(message_id, message, sender)
|
||||
end
|
||||
|
||||
|
||||
function on_input(self, action_id, action)
|
||||
local result_1 = self.druid_whitelist:on_input(action_id, action)
|
||||
local result_2 = self.druid_blacklist:on_input(action_id, action)
|
||||
local result_3 = self.druid_wb:on_input(action_id, action)
|
||||
|
||||
return result_1 or result_2 or result_3
|
||||
end
|
Reference in New Issue
Block a user