JSONify Game Options

This commit is contained in:
Mike A. Trethewey
2020-02-19 01:35:41 -08:00
parent c848792c69
commit f2de282249
4 changed files with 148 additions and 129 deletions

View File

@@ -2,7 +2,8 @@ from tkinter import ttk, IntVar, StringVar, Button, Checkbutton, Entry, Frame, L
from functools import partial
import classes.SpriteSelector as spriteSelector
import gui.widgets as widgets
import json
import os
def gameoptions_page(top, parent):
# Game Options
@@ -11,82 +12,24 @@ def gameoptions_page(top, parent):
# Game Options options
self.widgets = {}
myDict = {
## Hints: Useful/Not useful
"hints": {
"type": "checkbox",
"label": {
"text": "Include Helpful Hints"
}
},
## Disable BGM
"nobgm": {
"type": "checkbox",
"label": {
"text": "Disable Music & MSU-1"
}
},
## L/R Quickswap
"quickswap": {
"type": "checkbox",
"label": {
"text": "L/R Quickswapping"
}
}
}
dictWidgets = widgets.make_widgets_from_dict(self, myDict, self)
for key in dictWidgets:
self.widgets[key] = dictWidgets[key]
self.widgets[key].pack(anchor=W)
with open(os.path.join("resources","app","gui","randomize","gameoptions","checkboxes.json")) as checkboxes:
myDict = json.load(checkboxes)
dictWidgets = widgets.make_widgets_from_dict(self, myDict, self)
for key in dictWidgets:
self.widgets[key] = dictWidgets[key]
self.widgets[key].pack(anchor=W)
leftRomOptionsFrame = Frame(self)
rightRomOptionsFrame = Frame(self)
leftRomOptionsFrame.pack(side=LEFT)
rightRomOptionsFrame.pack(side=RIGHT)
myDict = {
## Heart Color
"heartcolor": {
"type": "selectbox",
"label": {
"text": "Heart Color"
},
"packAttrs": {
"label": { "side": LEFT },
"selectbox": { "side": RIGHT }
},
"options": {
"Red": "red",
"Blue": "blue",
"Green": "green",
"Yellow": "yellow",
"Random": "random"
}
},
## Heart Beep speed
"heartbeep": {
"type": "selectbox",
"label": {
"text": "Heart Beep sound rate"
},
"packAttrs": {
"label": { "side": LEFT },
"selectbox": { "side": RIGHT},
"default": "Normal"
},
"options": {
"Double": "double",
"Normal": "normal",
"Half": "half",
"Quarter": "quarter",
"Off": "off"
}
}
}
dictWidgets = widgets.make_widgets_from_dict(self, myDict, leftRomOptionsFrame)
for key in dictWidgets:
self.widgets[key] = dictWidgets[key]
self.widgets[key].pack(anchor=E)
with open(os.path.join("resources","app","gui","randomize","gameoptions","leftRomOptionsFrame.json")) as leftRomOptionsFrameItems:
myDict = json.load(leftRomOptionsFrameItems)
dictWidgets = widgets.make_widgets_from_dict(self, myDict, leftRomOptionsFrame)
for key in dictWidgets:
self.widgets[key] = dictWidgets[key]
self.widgets[key].pack(anchor=E)
## Sprite selection
spriteDialogFrame = Frame(leftRomOptionsFrame)
@@ -114,64 +57,12 @@ def gameoptions_page(top, parent):
spriteSelectButton.pack(side=LEFT)
spriteDialogFrame.pack(anchor=E)
myDict = {
## Menu Speed
"menuspeed": {
"type": "selectbox",
"label": {
"text": "Menu Speed"
},
"packAttrs": {
"label": { "side": LEFT },
"selectbox": { "side": RIGHT },
"default": "Normal"
},
"options": {
"Instant": "instant",
"Quadruple": "quadruple",
"Triple": "triple",
"Double": "double",
"Normal": "normal",
"Half": "half"
}
},
## Overworld Palettes (not Enemizer)
"owpalettes": {
"type": "selectbox",
"label": {
"text": "Overworld Palettes"
},
"packAttrs": {
"label": { "side": LEFT },
"selectbox": { "side": RIGHT }
},
"options": {
"Default": "default",
"Random": "random",
"Blackout": "blackout"
}
},
## Underworld Palettes (not Enemizer)
"uwpalettes": {
"type": "selectbox",
"label": {
"text": "Underworld Palettes"
},
"packAttrs": {
"label": { "side": LEFT },
"selectbox": { "side": RIGHT }
},
"options": {
"Default": "default",
"Random": "random",
"Blackout": "blackout"
}
}
}
dictWidgets = widgets.make_widgets_from_dict(self, myDict, rightRomOptionsFrame)
for key in dictWidgets:
self.widgets[key] = dictWidgets[key]
self.widgets[key].pack(anchor=E)
with open(os.path.join("resources","app","gui","randomize","gameoptions","rightRomOptionsFrame.json")) as rightRomOptionsFrameItems:
myDict = json.load(rightRomOptionsFrameItems)
dictWidgets = widgets.make_widgets_from_dict(self, myDict, rightRomOptionsFrame)
for key in dictWidgets:
self.widgets[key] = dictWidgets[key]
self.widgets[key].pack(anchor=E)
return self

View File

@@ -0,0 +1,20 @@
{
"hints": {
"type": "checkbox",
"label": {
"text": "Include Helpful Hints"
}
},
"nobgm": {
"type": "checkbox",
"label": {
"text": "Disable Music & MSU-1"
}
},
"quickswap": {
"type": "checkbox",
"label": {
"text": "L/R Quickswapping"
}
}
}

View File

@@ -0,0 +1,45 @@
{
"heartcolor": {
"type": "selectbox",
"label": {
"text": "Heart Color"
},
"packAttrs": {
"label": {
"side": "left"
},
"selectbox": {
"side": "right"
}
},
"options": {
"Red": "red",
"Blue": "blue",
"Green": "green",
"Yellow": "yellow",
"Random": "random"
}
},
"heartbeep": {
"type": "selectbox",
"label": {
"text": "Heart Beep sound rate"
},
"packAttrs": {
"label": {
"side": "left"
},
"selectbox": {
"side": "right"
},
"default": "Normal"
},
"options": {
"Double": "double",
"Normal": "normal",
"Half": "half",
"Quarter": "quarter",
"Off": "off"
}
}
}

View File

@@ -0,0 +1,63 @@
{
"menuspeed": {
"type": "selectbox",
"label": {
"text": "Menu Speed"
},
"packAttrs": {
"label": {
"side": "left"
},
"selectbox": {
"side": "right"
},
"default": "Normal"
},
"options": {
"Instant": "instant",
"Quadruple": "quadruple",
"Triple": "triple",
"Double": "double",
"Normal": "normal",
"Half": "half"
}
},
"owpalettes": {
"type": "selectbox",
"label": {
"text": "Overworld Palettes"
},
"packAttrs": {
"label": {
"side": "left"
},
"selectbox": {
"side": "right"
}
},
"options": {
"Default": "default",
"Random": "random",
"Blackout": "blackout"
}
},
"uwpalettes": {
"type": "selectbox",
"label": {
"text": "Underworld Palettes"
},
"packAttrs": {
"label": {
"side": "left"
},
"selectbox": {
"side": "right"
}
},
"options": {
"Default": "default",
"Random": "random",
"Blackout": "blackout"
}
}
}