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 if self.flow == 'x' then increment() else decrement() end
end) end)
self:onChange(function (event)
if self.value == "override" then
updateValue()
end
end)
updateValue() updateValue()
end end

View file

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

View file

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