Changement de police, ajout de l'aide en ligne (pseudo status bar)

This commit is contained in:
Philippe Roy 2022-04-16 05:43:32 +02:00
parent 9915374674
commit 177462d784
4 changed files with 40 additions and 3 deletions

Binary file not shown.

BIN
codetower-22.blend Normal file

Binary file not shown.

33
ct.py
View File

@ -298,7 +298,9 @@ def terrain_run ():
if scene.objects['Terrain']['run'] == True:
scene.objects['Terrain']['run']=False
scene.objects['Pause'].setVisible(False,False)
scene.objects['Pause'].suspendPhysics()
scene.objects['Pause-Hl'].setVisible(False,False)
scene.objects['Run']. restorePhysics()
scene.objects['Run-Hl'].setVisible(True,False)
for obj_i in scene.objects: # Pause des Steerings
if "type_minion" in obj_i.getPropertyNames() and "type_towerminion" not in obj_i.getPropertyNames():
@ -308,12 +310,15 @@ def terrain_run ():
else :
scene.objects['Terrain']['run']=True
scene.objects['Run'].setVisible(False,False)
scene.objects['Run'].suspendPhysics()
scene.objects['Run-Hl'].setVisible(False,False)
scene.objects['Pause']. restorePhysics()
scene.objects['Pause-Hl'].setVisible(True,False)
# Démarrage de la map
if scene.objects['Terrain']['thread_run']==False:
scene.objects['Stop'].setVisible(True,False)
scene.objects['Stop']. restorePhysics()
runpy.run_module('ct_cmd', run_name='stop') # Stop du script utilisateur
ct_map.stop() # Stop du script des vagues
@ -367,9 +372,12 @@ def terrain_stop ():
# Commandes
scene.objects['Pause'].setVisible(False,False)
scene.objects['Pause'].suspendPhysics()
scene.objects['Pause-Hl'].setVisible(False,False)
scene.objects['Run'].setVisible(True,False)
scene.objects['Run']. restorePhysics()
scene.objects['Stop'].setVisible(False,False)
scene.objects['Stop'].suspendPhysics()
scene.objects['Stop-Hl'].setVisible(False,False)
# Fin de la map
@ -436,7 +444,7 @@ def terrain_speed (obj):
speed_mode_txt=["1/4", "1/2", "1", "2","4","10"]
i=speed_mode.index(scene.objects['Terrain']['speed'])
# Affichage
# Affichage
if obj.name=="Speed_up" and i<5:
scene.objects['Terrain']['speed']=speed_mode[i+1]
scene.objects['Text_speed']['Text']=speed_mode_txt[i+1]
@ -503,14 +511,17 @@ def cmd_init():
# UI : Commandes
scene.objects['Run-Hl'].setVisible(False,False)
scene.objects['Pause'].setVisible(False,False)
scene.objects['Pause'].suspendPhysics()
scene.objects['Pause-Hl'].setVisible(False,False)
scene.objects['Stop'].setVisible(False,False)
scene.objects['Stop'].suspendPhysics()
scene.objects['Stop-Hl'].setVisible(False,False)
scene.objects['Construc-Hl'].setVisible(False,False)
scene.objects['About-cmd-Hl'].setVisible(False,False)
scene.objects['About'].setVisible(False,True)
# UI : Texte, ...
scene.objects['Cmd_text'].setVisible(False,False)
scene.objects['Map_text'].setVisible(False,False)
scene.objects['Text_info-1'].setVisible(False,False)
scene.objects['Text_info-2'].setVisible(False,False)
@ -566,8 +577,28 @@ def cmd_hl(cont):
scene.objects['Stop'].setVisible(False,False)
scene.objects['Stop-Hl'].setVisible(True,False)
# Text
text_hl ={"Run":"Run (F5)",
"Stop":"Stop (F6)",
"Pause":"Pause (F5)",
"Construc": "Show tower position",
"Book": "Documentation",
"About-cmd": "About",
"Speed_down": "Speed down (-)",
"Speed_up": "Speed up (+)"}
scene.objects['Cmd_text']['Text']= text_hl[obj.name]
scene.objects['Cmd_text'].setVisible(True,False)
# if scene.objects['Terrain']['run'] == False and obj.name=="Run":
# scene.objects['Cmd_text']['Text']= "Run"
# if scene.objects['Terrain']['run'] == True and obj.name=="Stop":
# scene.objects['Cmd_text']['Text']= "Stop"
# if scene.objects['Terrain']['run'] == True and obj.name=="Pause":
# scene.objects['Cmd_text']['Text']= "Pause"
# Désactivation
if cont.sensors['MO'].status == JUST_RELEASED and (scene.objects['Terrain']['manip_mode']==0 or scene.objects['Terrain']['manip_mode']==9):
scene.objects['Cmd_text'].setVisible(False,False)
if obj.name!="Run" and obj.name!="Pause" and obj.name!="Run-Hl" and obj.name!="Pause-Hl" and obj.name!="Stop" and obj.name!="Stop-Hl" :
scene.objects[obj.name+'-Hl'].setVisible(False,True)
obj.setVisible(True,True)

View File

@ -296,9 +296,9 @@ def ct_build_details(x,y, cat='Archer tower', tower_name="Tower", color=tower_pu
scene.objects['Terrain']['thread_cmd_lock'] = True
# Objets 3D
time.sleep(0.01)
time.sleep(0.02)
tour= scene.addObject('Tower-'+tower_3d, scene.objects['Terrain'])
time.sleep(0.01)
time.sleep(0.02)
tour.color = color
tour.worldPosition=[x,y,0.2]
tour.worldScale=[1,1,1]
@ -694,3 +694,9 @@ def scn_draw(cont):
if len(scene.objects['Terrain']['draw_list'])==0:
scene.objects['Terrain']['draw_process']=False
###############################################################################
# Help
###############################################################################
def help (cont):
obj = cont.owner