125 lines
3.5 KiB
GDScript
125 lines
3.5 KiB
GDScript
extends VBoxContainer
|
|
|
|
var gamesize = "Small"
|
|
var targetaudience = "Young"
|
|
var platforms = []
|
|
var genres = []
|
|
var themes = []
|
|
var engine = "Texty"
|
|
|
|
## SETTERS
|
|
func set_game_size(txt):#This effects how long the developement of the game is
|
|
gamesize = txt
|
|
|
|
func set_target_audience(txt):
|
|
targetaudience = txt
|
|
|
|
func set_engine(txt):
|
|
engine = txt
|
|
|
|
## ADD/REMOVE
|
|
func add_platform(txt):
|
|
platforms.append(txt)
|
|
|
|
func remove_platform(txt):
|
|
if(platforms.has(txt)):
|
|
platforms.remove(platforms.find(txt))
|
|
|
|
func add_genre(txt):
|
|
genres.append(txt)
|
|
|
|
func remove_genre(txt):
|
|
if(genres.has(txt)):
|
|
genres.remove(genres.find(txt))
|
|
|
|
func add_theme(txt):
|
|
themes.append(txt)
|
|
|
|
func remove_theme(txt):
|
|
if(themes.has(txt)):
|
|
themes.remove(themes.find(txt))
|
|
|
|
## POPUP MENUS
|
|
func add_menu_to(where,items,amount = 1):#Adds a MenuButton to a Hbox
|
|
for a in amount:
|
|
var butmenu = MenuButton.new()
|
|
butmenu.text = where.name
|
|
if(amount!=1):
|
|
butmenu.text +="# "+str(amount)
|
|
for i in items:
|
|
butmenu.get_popup().add_item(i)
|
|
butmenu.get_popup().connect("id_pressed",self,"popup_menu_change",[butmenu])
|
|
where.add_child(butmenu,true)
|
|
|
|
func popup_menu_change(idx,what):#An item changed on a popup menu
|
|
what.text = what.get_popup().get_item_text(idx)
|
|
var which = what.get_parent().name
|
|
match(which):
|
|
"makenewgame":#I'm going to assume engine as it is the only MenuButton outside a hbox
|
|
set_engine(what.text)
|
|
"platforms":
|
|
add_platform(what.text)
|
|
"genres":
|
|
add_genre(what.text)
|
|
"themes":
|
|
add_theme(what.text)
|
|
|
|
## Game Make
|
|
func register_game():#Sends the idea off to the studio for developement
|
|
var phasetime = 0
|
|
match(gamesize):
|
|
"Small":
|
|
phasetime+= 3
|
|
"Medium":
|
|
phasetime+= 7
|
|
"Large":
|
|
phasetime+= 15
|
|
"AAA":
|
|
phasetime+= 20
|
|
if($gamesize/MMO.pressed == true):
|
|
phasetime += phasetime/2
|
|
get_parent().get_parent().games_in_developement[$gamename.text] = {
|
|
"devstart":[get_parent().month,get_parent().week,get_parent().year],
|
|
"Phase":0,#0=start,1-3 = actual phases, 4 = debug phase/release prep
|
|
"phasetime":phasetime,
|
|
"timer":2,
|
|
"targetaudience":targetaudience,
|
|
"platforms":platforms,
|
|
"genres":genres,
|
|
"themes":themes,
|
|
"engine":engine,
|
|
"Engine":34,
|
|
"Gameplay":33,
|
|
"Story":33,
|
|
"Dialog":34,
|
|
"Level Design":33,
|
|
"AI":33,
|
|
"World Building":34,
|
|
"Graphics":33,
|
|
"Sound":33,
|
|
"Engine_Flags":["ColorTextGraphics"],
|
|
"Game_Tags":[gamesize,targetaudience,platforms,genres,themes,engine]
|
|
}
|
|
get_parent().add_game_dev($gamename.text)
|
|
queue_free()
|
|
|
|
## MAIN
|
|
func _ready():
|
|
var t = $"/root/loader".load_json(ProjectSettings.get("Game/Resources/Themesmod"))
|
|
add_menu_to($themes,t,get_parent().get_parent().themeamount)
|
|
add_menu_to($genres,["Action","Adventure","RPG","Simulation","Strategy"," Casual"],get_parent().get_parent().genreamount)
|
|
add_menu_to($platforms,get_parent().get_parent().platforms,get_parent().get_parent().platforms.size()/2)
|
|
|
|
for i in get_parent().get_parent().engines:
|
|
$engine.get_popup().add_item(i)
|
|
|
|
$gamename.text = "Game #"+str(get_parent().get_parent().games.size()+get_parent().get_parent().games_in_developement.size()+1)
|
|
var connections = [
|
|
$confirm.connect("pressed",self,"register_game"),
|
|
$gamesize/Small.connect("pressed",self,"set_game_size",["Small"]),
|
|
$gamesize/Medium.connect("pressed",self,"set_game_size",["Medium"]),
|
|
$gamesize/Large.connect("pressed",self,"set_game_size",["Large"]),
|
|
$gamesize/TripleA.connect("pressed",self,"set_game_size",["AAA"]),
|
|
$engine.get_popup().connect("id_pressed",self,"popup_menu_change",[$engine])
|
|
]
|
|
print_debug(connections) |