opengamedevtycoon/Scripts/HUD.gd

75 lines
2.1 KiB
GDScript

extends Control
var week = 1
enum MONTHS {
JAN,FEB,MAR,
APR,MAY,JUN,
JUL,AUG,SEP,
OCT,NOV,DEC
}
var month = 0
var year = 1988
## Research
## DATE
func interval():#Every invterval the game time changes
week = week+1
if(week>4):
week = 1
month += 1
if(month>10):
month = 0
year += 1
$Date.text = str(MONTHS.keys()[month])+"/"+str(year)+"\nWeek:"+str(week)
#Checkoff dev/phase time
for game in get_parent().games_in_developement:
if(get_parent().games_in_developement[game]["timer"]==0):#Time for a new phase
get_parent().games_in_developement[game]["timer"] = -1
if(get_parent().games_in_developement[game]["Phase"]<3):
var phasegui = load("res://GUI/Phase.tscn").instance()
phasegui.get_node("adjust/Title").text = game
phasegui.phase = get_parent().games_in_developement[game]["Phase"]
add_child(phasegui)
else:#Final Phase
if($Gameindev/Hbox.has_node(game)):
$Gameindev/Hbox.get_node(game).ready_for_release()
else:
get_parent().games_in_developement[game]["timer"] -= 1
## Game in Dev bar
func add_game_dev(gamename):#Adds a new game to the developement cycle
var gametab = load("res://GUI/gametab.tscn").instance()
gametab.gamename = gamename
gametab.name = gamename
$Gameindev/Hbox.add_child(gametab,true)
## BOTTOM BAR
#work
func work_pressed(idx):#something for the staff to do.
var sw = $bottonbar/Work.get_popup().get_item_text(idx)
match(sw):
"New Game":
if(!has_node("makenewgame")):
var makenewgame = load("res://GUI/makenewgame.tscn").instance()
add_child(makenewgame)
#research
func research_pressed(idx):#Catch up on the latest fads, tech, and your reputation
var sw = $bottonbar/Research.get_popup().get_item_text(idx)
match(sw):
"Research":
if(!has_node("ResearchList")):
var reee = load("res://GUI/ResearchList.tscn").instance()
add_child(reee)
## MAIN
func _ready():
#connections
var connections = [
$bottonbar/Work.get_popup().connect("id_pressed",self,"work_pressed"),
$bottonbar/Research.get_popup().connect("id_pressed",self,"research_pressed"),
$Date/Timer.connect("timeout",self,"interval")
]
print_debug(connections)