|
|
@ -46,6 +46,7 @@ function MaterialDialog:init(info)
|
|
|
|
widgets.List{
|
|
|
|
widgets.List{
|
|
|
|
view_id = 'list',
|
|
|
|
view_id = 'list',
|
|
|
|
frame = { l = 0, r = 0, t = 6, b = 2 },
|
|
|
|
frame = { l = 0, r = 0, t = 6, b = 2 },
|
|
|
|
|
|
|
|
icon_width = 2,
|
|
|
|
on_submit = self:callback('onSubmitItem'),
|
|
|
|
on_submit = self:callback('onSubmitItem'),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
widgets.EditField{
|
|
|
|
widgets.EditField{
|
|
|
@ -83,12 +84,12 @@ end
|
|
|
|
|
|
|
|
|
|
|
|
function MaterialDialog:initBuiltinMode()
|
|
|
|
function MaterialDialog:initBuiltinMode()
|
|
|
|
local choices = {
|
|
|
|
local choices = {
|
|
|
|
{ text = ' none', mat_type = -1, mat_index = -1 },
|
|
|
|
{ text = 'none', mat_type = -1, mat_index = -1 },
|
|
|
|
{ text = ARROW..' inorganic', key = 'CUSTOM_SHIFT_I',
|
|
|
|
{ icon = ARROW, text = 'inorganic', key = 'CUSTOM_SHIFT_I',
|
|
|
|
cb = self:callback('initInorganicMode') },
|
|
|
|
cb = self:callback('initInorganicMode') },
|
|
|
|
{ text = ARROW..' creature', key = 'CUSTOM_SHIFT_C',
|
|
|
|
{ icon = ARROW, text = 'creature', key = 'CUSTOM_SHIFT_C',
|
|
|
|
cb = self:callback('initCreatureMode')},
|
|
|
|
cb = self:callback('initCreatureMode')},
|
|
|
|
{ text = ARROW..' plant', key = 'CUSTOM_SHIFT_P',
|
|
|
|
{ icon = ARROW, text = 'plant', key = 'CUSTOM_SHIFT_P',
|
|
|
|
cb = self:callback('initPlantMode') },
|
|
|
|
cb = self:callback('initPlantMode') },
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -138,8 +139,8 @@ function MaterialDialog:addObjectChoice(choices, obj, name, typ, index)
|
|
|
|
self:addMaterial(choices, obj.material[0], typ, index, true)
|
|
|
|
self:addMaterial(choices, obj.material[0], typ, index, true)
|
|
|
|
else
|
|
|
|
else
|
|
|
|
table.insert(choices, {
|
|
|
|
table.insert(choices, {
|
|
|
|
text = ARROW..' '..name, mat_type = typ, mat_index = index,
|
|
|
|
icon = ARROW, text = name, mat_type = typ, mat_index = index,
|
|
|
|
ctx = name, obj = obj, cb = self:callback('onSelectObj')
|
|
|
|
obj = obj, cb = self:callback('onSelectObj')
|
|
|
|
})
|
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
@ -147,7 +148,7 @@ end
|
|
|
|
function MaterialDialog:onSelectObj(item)
|
|
|
|
function MaterialDialog:onSelectObj(item)
|
|
|
|
local choices = {}
|
|
|
|
local choices = {}
|
|
|
|
self:addMaterials(choices, item.obj.material, item.mat_type, item.mat_index)
|
|
|
|
self:addMaterials(choices, item.obj.material, item.mat_type, item.mat_index)
|
|
|
|
self:pushContext(item.ctx, choices)
|
|
|
|
self:pushContext(item.text, choices)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function MaterialDialog:addMaterials(choices, vector, tid, index, maxid, field)
|
|
|
|
function MaterialDialog:addMaterials(choices, vector, tid, index, maxid, field)
|
|
|
@ -183,7 +184,7 @@ function MaterialDialog:addMaterial(choices, mat, typ, idx, pfix)
|
|
|
|
key = mat.prefix
|
|
|
|
key = mat.prefix
|
|
|
|
end
|
|
|
|
end
|
|
|
|
table.insert(choices, {
|
|
|
|
table.insert(choices, {
|
|
|
|
text = ' '..name,
|
|
|
|
text = name,
|
|
|
|
search_key = key,
|
|
|
|
search_key = key,
|
|
|
|
material = mat,
|
|
|
|
material = mat,
|
|
|
|
mat_type = typ, mat_index = idx
|
|
|
|
mat_type = typ, mat_index = idx
|
|
|
|