Code: Select all
init -10 python:
class GuoPlace(object):
def __init__(self, x, y, name, IsActive, country, ID, Port, Capital):
self.x = x
self.y = y
self.name = name
self.IsActive = IsActive
self.country = country
self.ID = ID
self.Port = Port
self.Capital = Capital
class Nation(object):
def __init__(self, name, ID, leader, politicalID, AlignmentID, rulingparty, factionID, stability, warsupport):
self.name = name
self.ID = ID
self.leader = leader
self.politicalID = politicalID
self.AlignmentID = AlignmentID
self.rulingparty = rulingparty
self.factionID = factionID
self.stability = stability
self.warsupport = warsupport
TL_GUO_loc = []
TL_GUO = []
t = 0
while t < 50:
TL_GUO_loc.append(GuoPlace(0,0,"", False, "","", False, False))
TL_GUO.append(Nation("","","","","","","",0,0))
t += 1
TL_GUO_loc[0] = GuoPlace(2819, 2023, "Kwangchow", True, "Republic of China", "ROC", False, False)
TL_GUO_loc[1] = GuoPlace(2888, 2062, "Hong Kong", True, "United Kingdom", "ENG", True, False)
TL_GUO_loc[2] = GuoPlace(2826, 2069, "Macau", True, "Portugese Republic", "POR", True, False)
TL_GUO_loc[3] = GuoPlace(2565, 2167, "Kwang-Chow Wan", True, "French Republic", "FRA", True, False)
TL_GUO_loc[4] = GuoPlace(3436, 1392, "Shanghai", True, "Republic of China (Interntional Settlement)", "CHI",True, False)
TL_GUO_loc[5] = GuoPlace(3262, 1341, "NanKing", True, "Republic of China", "CHI", False, True)
TL_GUO_loc[6] = GuoPlace(4040, 2230, "Peiping", True, "Republic of China", "CHI", False, True)
TL_GUO_loc[7] = GuoPlace(3276, 1805, "Foochow", True, "Republic of China", "CHI", True, False)
TL_GUO_loc[8] = GuoPlace(3450, 1492, "Ning-Po", True, "Republic of China", "CHI", True, False)
TL_GUO_loc[9] = GuoPlace(3042, 1556, "Nan-Kang", True, "Republic of China", "CHI", False, False)
TL_GUO_loc[10] = GuoPlace(3087, 1462, "An-King", True, "Republic of China", "CHI", False, False)
TL_GUO[0] = Nation("Republic of China", "ROC", "Chiang Chie Shih", "Conservative Junta", "Central Government of Kuomintang", "Kuomintang", "Allied Front", 40, 50)
TL_GUO[1] = Nation("People's Liberation Army", "PRC", "Mao Tse-Tung", "Marxist Guerillas", "Chinese Soviet Republic", "Chung-kuo Kung-ch'an-tang", "Allied Front", 30, 30)
TL_GUO[2] = Nation("Empire of Japan", "JAP", "Emperor Hirohito", "Fascist Monarchy", "Co-Prosperity Sphere", "Tohokai", "Co-Properity Sphere", 60, 90)
TL_GUO[3] = Nation("Empire of Manchukuo", "MAN", "Aisin Gioro Pu-Yi", "Fascist Puppet Monarchy", "Co-Prosperity Sphere", "Manchōwkuó Hsiéhehuì", "Co-Prosperity Sphere", 70, 70)
TL_GUO[4] = Nation("Reorganized National Government of the Republic of China", "RNG", "Wang Ching-Wei", "Fascist Puppet State", "Co-Prosperity Sphere", "Left Kuomintang", "Co-Prosperity Sphere", 40, 30)
TL_GUO[5] = Nation("Shaanxi Clique", "SHX", "Yan HsiShan", "Conservative Junta", "Central Government of Kuomintang", "Kuomintang", "Allied Front", 40, 50)
TL_GUO[6] = Nation("Hsi Bei San Ma", "XSM", "Ma Bu Fang", "Conservative Junta", "Central Government of Kuomintang", "Kuomintang", "Allied Front", 40, 50)
TL_GUO[7] = Nation("KwangHsi Clique", "GXC", "Li Tsun-Jen", "Conservative Junta", "Central Government of Kuomintang", "Kuomintang", "Allied Front", 40, 50)
TL_GUO[8] = Nation("Yunnan Clique", "YUN", "Lung Yun", "Conservative Junta", "Central Government of Kuomintang", "Kuomintang", "Allied Front", 40, 50)
I was wondering how would it work if by clicking on a city there would be a screen with this info of the country. I want to know if there is a simple way I can use the country ID's in the city and nation objects so they are "bonded" for a lack of better word. Would it be possible? I've used loops to map my cities in the code below:
Code: Select all
screen guo_map():
key "K_SPACE" action ShowMenu(main_menu)
viewport:
xysize (config.screen_width, config.screen_height)
child_size (4040, 2230)
xinitial 2300
yinitial 500
draggable True
edgescroll (700, 700)
add "maps/GUO_map.png"
for q in TL_GUO_loc:
if q.IsActive:
button:
xpos q.x
ypos q.y
text q.name color "#000000"
action NullAction()
Edit: The sovled Screen Code
This screen code is a skeleton code to test out the code and wallah it worked.
Code: Select all
screen guo(): #Test if you can actually change the variable, call screen and see a diff country. This would be cool.
tag menu
key "K_SPACE" action ShowMenu(main_menu)
key "K_TAB" action ShowMenu(main_menu)
key "K_ESCAPE" action Return()
key "n" action ShowMenu('guo_map')
key "1" action ShowMenu('guo_map')
key "g" action ShowMenu('glossary')
key "p" action ShowMenu('poems')
key "l" action ShowMenu('historical_event_log')
key "2" action ShowMenu('glossary')
key "3" action ShowMenu('poems')
key "4" action ShowMenu('historical_event_log')
window:
style "gm_root"
add "#141414"
viewport:
xysize (config.screen_width, config.screen_height)
child_size (2000, 1100)
draggable True
edgescroll (200, 200)
vbox spacing 25:
for n in TL_GUO:
if n.IsActive:
textbutton n.name:
action SetVariable("nation", n)
text "[nation.name]" xalign 0.5 size 40 font "fonts/eng_moria/MoriaCitadel.ttf"
screen guo_map():
tag menu
key "K_SPACE" action ShowMenu(main_menu)
key "K_TAB" action ShowMenu(main_menu)
key "K_ESCAPE" action Return()
key "5" action ShowMenu ('guo')
key "n" action Return()
key "1" action Return()
key "g" action ShowMenu('glossary')
key "p" action ShowMenu('poems')
key "l" action ShowMenu('historical_event_log')
key "2" action ShowMenu('glossary')
key "3" action ShowMenu('poems')
key "4" action ShowMenu('historical_event_log')
viewport:
xysize (config.screen_width, config.screen_height)
child_size (4040, 2230)
if show_beijing:
xinitial 2300
yinitial 500
else:
xinitial 2300
yinitial 500
draggable True
edgescroll (700, 700)
add "maps/GUO_map.png"
for q in TL_GUO_loc:
if q.IsActive:
for n in TL_GUO:
if n.ID ==q.ID:
$ act = SetVariable('nation', n)
button:
xpos q.x
ypos q.y
text q.name color "#000000" hover_color "#FF0000" size 20
action [act, Show('guo')]