shrink objectives into a stepper, and make steppers good

This commit is contained in:
duncathan 2020-02-28 07:04:44 -06:00
parent 4e1dbd19cf
commit b73c59a7d9
3 changed files with 19 additions and 30 deletions

View file

@ -102,5 +102,11 @@ Contains the index in `items` of the item being displayed.
if self.flow == 'x' then increment() else decrement() end
end)
self:onChange(function (event)
if self.value == "override" then
updateValue()
end
end)
updateValue()
end

View file

@ -23,26 +23,15 @@ function C:loadSettings(puppy, obj, seed)
settings.puppy.value = puppy
if obj == "objBadEnd" or obj == 1 then
settings.bad.value = true
settings.norm.value = false
settings.boss.value = false
settings.best.value = false
settings.objective.index = 1
elseif obj == "objNormalEnd" or obj == 2 then
settings.bad.value = false
settings.norm.value = true
settings.boss.value = false
settings.best.value = false
settings.objective.index = 2
elseif obj == "objAllBosses" or obj == 3 then
settings.bad.value = false
settings.norm.value = false
settings.boss.value = true
settings.best.value = false
settings.objective.index = 4
else
settings.bad.value = false
settings.norm.value = false
settings.boss.value = false
settings.best.value = true
settings.objective.index = 3
end
settings.objective.value = "override"
if seed ~= nil then
settings.customseed.value = seed or ""
@ -65,15 +54,7 @@ layout.go:onPress(function()
Randomizer.customseed = settings.customseed.value:gsub("^%s*(.-)%s*$", "%1") -- trim any leading/trailing whitespace
end
if settings.bad.value then
Randomizer.obj = "objBadEnd"
elseif settings.norm.value then
Randomizer.obj = "objNormalEnd"
elseif settings.boss.value then
Randomizer.obj = "objAllBosses"
else
Randomizer.obj = "objBestEnd"
end
Randomizer.obj = settings.objective.value
Randomizer.puppy = settings.puppy.value
C:setStatus(Randomizer:randomize())

View file

@ -14,16 +14,18 @@ return { style = 'dialog',
},
{
{ type = 'label', text = 'Objective', minheight = 32 },
{ type = 'radio', group = 'objective', text = 'Bad ending', id = 'bad', minheight = 27 },
{ type = 'radio', group = 'objective', text = 'Normal ending', id = 'norm', minheight = 27 },
{ type = 'radio', group = 'objective', text = 'Best ending', id = 'best', value = true, minheight = 27 },
{ type = 'radio', group = 'objective', text = 'All bosses', id = 'boss', minheight = 27 },
{ type = 'stepper', id = 'objective', align = 'center', width = 200,
{ text = "Bad ending", value = "objBadEnd" },
{ text = "Normal ending", value = "objNormalEnd" },
{ text = "Best ending", value = "objBestEnd" },
{ text = "All bosses", value = "objAllBosses"}
},
},
},
{
flow = 'x',
{ type = 'text', id = 'sharecode', width = 350 },
{ type = 'button', style = 'dialogButton', text = "Import Sharecode", id = 'importshare', width = 180 }
{ type = 'button', style = 'dialogButton', text = "Import Sharecode", id = 'importshare', width = 180, align = 'center' }
}
},
{ style = 'dialogFoot',