mirror of
https://forge.apps.education.fr/blender-edutech/ropy.git
synced 2024-01-27 08:23:20 +01:00
Bugfix : Overlay et crédit du store
This commit is contained in:
parent
3bb4b9da48
commit
660efd3c7e
BIN
ropy-35.blend
BIN
ropy-35.blend
Binary file not shown.
75
rp.py
75
rp.py
@ -135,8 +135,6 @@ def terrain_init (cont):
|
||||
# Ajout du Hud
|
||||
scene.active_camera = scene.objects["Camera"]
|
||||
scene.objects['Sun'].setVisible(True,True)
|
||||
# FIXME : bug sur l'Overlay ? pas d'explication -> incorporer tout le Hud dans la caméra
|
||||
scene.addOverlayCollection(scene.cameras['Camera-Hud'], bpy.data.collections['Hud'])
|
||||
|
||||
# Mémorisation des positions par défaut
|
||||
# <worldPosition.x>0.0057830810546875</worldPosition.x>
|
||||
@ -353,9 +351,11 @@ def terrain_speed (obj):
|
||||
# Affichage
|
||||
if obj.name=="Speed_up" and i<5:
|
||||
scene.objects['Commands']['speed']=speed_mode[i+1]
|
||||
print ("Speed_up")
|
||||
scene.objects['Text_speed']['Text']=speed_mode_txt[i+1]
|
||||
if obj.name=="Speed_down" and i>0:
|
||||
scene.objects['Commands']['speed']=speed_mode[i-1]
|
||||
print ("Speed_down")
|
||||
scene.objects['Text_speed']['Text']=speed_mode_txt[i-1]
|
||||
|
||||
##
|
||||
@ -509,13 +509,9 @@ def cmd_init(cont):
|
||||
# Upgrade
|
||||
# Read config (upgrades choisis : data/upgrade/ -> [2][i].text)
|
||||
upgrade_card=("battery", "beacon", "paint", "speed")
|
||||
# scene.objects['Points']['upgrade_nb'] =0
|
||||
for i in range(len(upgrade_card)):
|
||||
if rp_config_tree[2][i].text == "True":
|
||||
scene.objects['Points']['upgrade_'+upgrade_card[i]]=True
|
||||
# scene.objects['Points']['upgrade_nb'] +=1
|
||||
# scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] = True
|
||||
# scene.objects['Points']['upgrade_credit']= scene.objects['Points']['level']- 1 - scene.objects['Points']['upgrade_nb']
|
||||
upgrade_maj()
|
||||
|
||||
# Speed
|
||||
@ -530,12 +526,12 @@ def cmd_init(cont):
|
||||
scene.objects['Text_speed']['Text']=speed_mode_txt[i]
|
||||
|
||||
# Windows
|
||||
windows=("Doc", "Doc_chap-general", "Doc_chap-missions", "Doc_chap-rover", "Doc_chap-python", "About", "Credits", "Task")
|
||||
windows=("Doc", "Doc_chap-general", "Doc_chap-missions", "Doc_chap-rover", "Doc_chap-python", "About", "Credits", "Task-panel")
|
||||
for window in windows:
|
||||
scene.objects[window].setVisible(False,True)
|
||||
rp_doc.init()
|
||||
rp_store.init()
|
||||
scene.objects['Task'].worldPosition = [42.6047, -2.09252, 2.99685] # Panel task
|
||||
scene.objects['Task-panel'].worldPosition = [42.6047, -2.09252, 2.99685] # Panel task
|
||||
|
||||
##
|
||||
# Highlight des commandes
|
||||
@ -1080,11 +1076,7 @@ def tablet_open ():
|
||||
scene.objects['Cmd-text']['Text']= ""
|
||||
|
||||
# Overlay
|
||||
# FIXME : bug sur l'Overlay ? pas d'explication -> incorporer tout le Hud dans la caméra
|
||||
scene.removeOverlayCollection(bpy.data.collections['Hud'])
|
||||
scene.objects['Points'].setVisible(False,True)
|
||||
scene.objects['Commands'].setVisible(False,True)
|
||||
scene.active_camera = scene.objects["Camera-Hud"]
|
||||
scene.active_camera = scene.objects["Camera-Simple"]
|
||||
scene.objects['Camera'].setVisible(False,True)
|
||||
scene.objects['Doc-cmd-colbox'].suspendPhysics (True)
|
||||
|
||||
@ -1104,18 +1096,14 @@ def tablet_close ():
|
||||
config_save()
|
||||
|
||||
# Overlay
|
||||
scene.objects['Points'].setVisible(True,True)
|
||||
scene.objects['Camera'].setVisible(True,True)
|
||||
if scene.objects['Commands']['twins']:
|
||||
scene.objects['Points-Twins'].setVisible(True,True)
|
||||
scene.objects['Points-Twins-text'].setVisible(True,False)
|
||||
else:
|
||||
scene.objects['Points-Twins'].setVisible(False,True)
|
||||
scene.objects['Points-Twins-text'].setVisible(False,False)
|
||||
scene.objects['Commands'].setVisible(True,True)
|
||||
scene.objects['Camera'].setVisible(True,True)
|
||||
scene.active_camera = scene.objects["Camera"]
|
||||
# FIXME : bug sur l'Overlay ? pas d'explication -> incorporer tout le Hud dans la caméra
|
||||
scene.addOverlayCollection(scene.cameras['Camera-Hud'], bpy.data.collections['Hud'])
|
||||
|
||||
# UI : Commands
|
||||
scene.objects['Run-Hl'].setVisible(False,False)
|
||||
@ -1192,9 +1180,9 @@ def task_open ():
|
||||
scene.objects['Task-cmd'].setVisible(False,True)
|
||||
scene.objects['Task-cmd'].suspendPhysics()
|
||||
scene.objects['Task-cmd-Hl'].setVisible(False,True)
|
||||
scene.objects['Task'].setVisible(True,True)
|
||||
scene.objects['Task']['timer'] = 0
|
||||
scene.objects['Task']['anim_open'] = True
|
||||
scene.objects['Task-panel'].setVisible(True,True)
|
||||
scene.objects['Task-panel']['timer'] = 0
|
||||
scene.objects['Task-panel']['anim_open'] = True
|
||||
rp_map.task()
|
||||
|
||||
def task_open_anim():
|
||||
@ -1211,13 +1199,13 @@ def task_open_anim():
|
||||
x1 = 0.201271-x0_cam+x_cam
|
||||
y1 =-25.9416-y0_cam+y_cam
|
||||
z1 = 19.793-z0_cam+z_cam
|
||||
xi = x0+((x1-x0)/resol)*scene.objects['Task']['timer']
|
||||
yi = y0+((y1-y0)/resol)*scene.objects['Task']['timer']
|
||||
zi = z0+((z1-z0)/resol)*scene.objects['Task']['timer']
|
||||
scene.objects['Task'].worldPosition = [xi, yi, zi]
|
||||
scene.objects['Task']['timer']+=1
|
||||
if scene.objects['Task']['timer']== resol:
|
||||
scene.objects['Task']['anim_open'] = False
|
||||
xi = x0+((x1-x0)/resol)*scene.objects['Task-panel']['timer']
|
||||
yi = y0+((y1-y0)/resol)*scene.objects['Task-panel']['timer']
|
||||
zi = z0+((z1-z0)/resol)*scene.objects['Task-panel']['timer']
|
||||
scene.objects['Task-panel'].worldPosition = [xi, yi, zi]
|
||||
scene.objects['Task-panel']['timer']+=1
|
||||
if scene.objects['Task-panel']['timer']== resol:
|
||||
scene.objects['Task-panel']['anim_open'] = False
|
||||
scene.objects['Task_close-cmd'].setVisible(True,True)
|
||||
scene.objects['Task_close-cmd-Hl'].setVisible(False,True)
|
||||
scene.objects['Task_close-cmd'].restorePhysics()
|
||||
@ -1231,8 +1219,8 @@ def task_close ():
|
||||
scene.objects['Task_close-cmd'].setVisible(False,True)
|
||||
scene.objects['Task_close-cmd'].suspendPhysics()
|
||||
scene.objects['Task_close-cmd-Hl'].setVisible(False,True)
|
||||
scene.objects['Task']['timer'] = 0
|
||||
scene.objects['Task']['anim_close'] = True
|
||||
scene.objects['Task-panel']['timer'] = 0
|
||||
scene.objects['Task-panel']['anim_close'] = True
|
||||
|
||||
def task_close_anim():
|
||||
x0_cam=0.005783
|
||||
@ -1248,14 +1236,14 @@ def task_close_anim():
|
||||
x1=0.291678-x0_cam+x_cam
|
||||
y1 =-25.9416-y0_cam+y_cam
|
||||
z1 = 19.793-z0_cam+z_cam
|
||||
xi = x0+((x1-x0)/resol)*scene.objects['Task']['timer']
|
||||
yi = y0+((y1-y0)/resol)*scene.objects['Task']['timer']
|
||||
zi = z0+((z1-z0)/resol)*scene.objects['Task']['timer']
|
||||
scene.objects['Task'].worldPosition = [xi, yi, zi]
|
||||
scene.objects['Task']['timer']+=1
|
||||
if scene.objects['Task']['timer']== resol:
|
||||
scene.objects['Task']['anim_close'] = False
|
||||
scene.objects['Task'].setVisible(False,True)
|
||||
xi = x0+((x1-x0)/resol)*scene.objects['Task-panel']['timer']
|
||||
yi = y0+((y1-y0)/resol)*scene.objects['Task-panel']['timer']
|
||||
zi = z0+((z1-z0)/resol)*scene.objects['Task-panel']['timer']
|
||||
scene.objects['Task-panel'].worldPosition = [xi, yi, zi]
|
||||
scene.objects['Task-panel']['timer']+=1
|
||||
if scene.objects['Task-panel']['timer']== resol:
|
||||
scene.objects['Task-panel']['anim_close'] = False
|
||||
scene.objects['Task-panel'].setVisible(False,True)
|
||||
scene.objects['Task-cmd'].setVisible(True,True)
|
||||
scene.objects['Task-cmd-Hl'].setVisible(False,True)
|
||||
scene.objects['Task-cmd'].restorePhysics()
|
||||
@ -1340,18 +1328,14 @@ def store_close():
|
||||
config_save()
|
||||
|
||||
# Overlay
|
||||
scene.objects['Points'].setVisible(True,True)
|
||||
scene.objects['Camera'].setVisible(True,True)
|
||||
if scene.objects['Commands']['twins']:
|
||||
scene.objects['Points-Twins'].setVisible(True,True)
|
||||
scene.objects['Points-Twins-text'].setVisible(True,False)
|
||||
else:
|
||||
scene.objects['Points-Twins'].setVisible(False,True)
|
||||
scene.objects['Points-Twins-text'].setVisible(False,False)
|
||||
scene.objects['Commands'].setVisible(True,True)
|
||||
scene.objects['Camera'].setVisible(True,True)
|
||||
scene.active_camera = scene.objects["Camera"]
|
||||
# FIXME : bug sur l'Overlay ? pas d'explication -> incorporer tout le Hud dans la caméra
|
||||
scene.addOverlayCollection(scene.cameras['Camera-Hud'], bpy.data.collections['Hud'])
|
||||
|
||||
# UI : Commands
|
||||
scene.objects['Run-Hl'].setVisible(False,False)
|
||||
@ -1523,16 +1507,11 @@ def config_load():
|
||||
|
||||
# Upgrade
|
||||
upgrade_card=("battery", "beacon", "paint", "speed")
|
||||
# scene.objects['Points']['upgrade_nb'] =0
|
||||
for i in range(len(upgrade_card)):
|
||||
if rp_config_tree[2][i].text == "True":
|
||||
scene.objects['Points']['upgrade_'+upgrade_card[i]]=True
|
||||
# scene.objects['Points']['upgrade_nb'] +=1
|
||||
# scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] = True
|
||||
else:
|
||||
scene.objects['Points']['upgrade_'+upgrade_card[i]]=False
|
||||
# scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] = False
|
||||
# scene.objects['Points']['upgrade_credit']= scene.objects['Points']['level']- 1 - scene.objects['Points']['upgrade_nb']
|
||||
upgrade_maj()
|
||||
|
||||
# Speed
|
||||
|
12
rp_about.py
12
rp_about.py
@ -192,11 +192,7 @@ def credits(cont):
|
||||
scene.objects["Credits"]['init_lz']=scene.objects["Credits"].worldPosition.z
|
||||
|
||||
# Overlay
|
||||
# FIXME : bug sur l'Overlay ? pas d'explication -> incorporer tout le Hud dans la caméra
|
||||
scene.removeOverlayCollection(bpy.data.collections['Hud'])
|
||||
scene.objects['Points'].setVisible(False,True)
|
||||
scene.objects['Commands'].setVisible(False,True)
|
||||
scene.active_camera = scene.objects["Camera-Hud"]
|
||||
scene.active_camera = scene.objects["Camera-Simple"]
|
||||
scene.objects['Camera'].setVisible(False,True)
|
||||
scene.objects['Doc-cmd-colbox'].suspendPhysics (True)
|
||||
|
||||
@ -233,18 +229,14 @@ def credits_close(cont):
|
||||
scene.objects['About'].setVisible(True,True)
|
||||
|
||||
# Overlay
|
||||
scene.objects['Points'].setVisible(True,True)
|
||||
scene.objects['Camera'].setVisible(True,True)
|
||||
if scene.objects['Commands']['twins']:
|
||||
scene.objects['Points-Twins'].setVisible(True,True)
|
||||
scene.objects['Points-Twins-text'].setVisible(True,False)
|
||||
else:
|
||||
scene.objects['Points-Twins'].setVisible(False,True)
|
||||
scene.objects['Points-Twins-text'].setVisible(False,False)
|
||||
scene.objects['Commands'].setVisible(True,True)
|
||||
scene.objects['Camera'].setVisible(True,True)
|
||||
scene.active_camera = scene.objects["Camera"]
|
||||
# FIXME : bug sur l'Overlay ? pas d'explication -> incorporer tout le Hud dans la caméra
|
||||
scene.addOverlayCollection(scene.cameras['Camera-Hud'], bpy.data.collections['Hud'])
|
||||
|
||||
# UI : Commands
|
||||
scene.objects['Run-Hl'].setVisible(False,False)
|
||||
|
@ -1,11 +1,11 @@
|
||||
<data>
|
||||
<config>
|
||||
<speed>1.0</speed>
|
||||
<speed>4.0</speed>
|
||||
<sound>False</sound>
|
||||
<cam>
|
||||
<worldPosition.x>0.0057830810546875</worldPosition.x>
|
||||
<worldPosition.y>-39.4045524597168</worldPosition.y>
|
||||
<worldPosition.z>31.101444244384766</worldPosition.z>
|
||||
<worldPosition.x>-4.096211910247803</worldPosition.x>
|
||||
<worldPosition.y>-19.37318992614746</worldPosition.y>
|
||||
<worldPosition.z>14.58687973022461</worldPosition.z>
|
||||
</cam>
|
||||
<screen>
|
||||
<width>1639</width>
|
||||
@ -14,13 +14,13 @@
|
||||
</screen>
|
||||
</config>
|
||||
<mission>
|
||||
<current>1</current>
|
||||
<level>1</level>
|
||||
<current>4</current>
|
||||
<level>5</level>
|
||||
</mission>
|
||||
<upgrade>
|
||||
<battery>False</battery>
|
||||
<beacon>False</beacon>
|
||||
<paint>False</paint>
|
||||
<speed>False</speed>
|
||||
<paint>True</paint>
|
||||
<speed>True</speed>
|
||||
</upgrade>
|
||||
</data>
|
@ -94,7 +94,7 @@ rp_speed_text=" L'amélioration \"Vitesse\" permet de \n changer la vitesse des
|
||||
rp_speed_text=rp_speed_text + " La vitesse est modifiable par codage : \n"
|
||||
rp_speed_text=rp_speed_text + " rp_vitesse(nouvelle_vitesse), où \n la vitesse est une valeur de 0,1 à 10.\n\n La fonction rp_vitesse() retourne la \n vitesse actuelle."
|
||||
rp_speed_store="Permet de modifier\nla vitesse des \ndéplacements."
|
||||
rp_speed_purchased="Je vois ... \n l'efficacité, hein ! \n Vous verrez avec \n ces moteurs,\n c'est autre vie."
|
||||
rp_speed_purchased="Je vois ... \n l'efficacité, hein ! \n Que la vitesse \n soit avec vous !"
|
||||
rp_speed_type="upgrade"
|
||||
card_description.update({"speed-card" : [rp_speed_title, rp_speed_text, rp_speed_store, rp_speed_purchased, rp_speed_type]})
|
||||
|
||||
@ -113,7 +113,7 @@ card_description.update({"paint-card" : [rp_paint_title, rp_paint_text, rp_paint
|
||||
rp_battery_title="Batterie +"
|
||||
rp_battery_text=" L'amélioration \"Batterie +\" permet \n d'augmenter la capacité de la batterie \n du Rover à 200 pas (contre 20 pas). \n\n"
|
||||
rp_battery_text=rp_battery_text + " La fonction rp_batterie() retourne \n la charge actuelle de la batterie \n (valeur de 0 à 100 %)."
|
||||
rp_battery_store="Augmente la capacité \nde la batterie à 200 \nmouvements (contre \n20, plutôt faible ...).\n\n"
|
||||
rp_battery_store="Augmente la capacité \nde la batterie à 200 \nmouvements (contre \n20).\n\n"
|
||||
rp_battery_purchased="Très bon choix ! \n Cette batterie \n vous va comme \n un gant."
|
||||
rp_battery_type="upgrade"
|
||||
card_description.update({"battery-card" : [rp_battery_title, rp_battery_text, rp_battery_store, rp_battery_purchased, rp_battery_type]})
|
||||
@ -123,7 +123,7 @@ rp_beacon_title="Balise +"
|
||||
rp_beacon_text=" L'amélioration \"Balise +\" permet \n d'augmenter le nombre de balises \n pouvant être posées à 200 (contre 20). \n\n"
|
||||
rp_beacon_text=rp_beacon_text + " La fonction rp_balise() retourne \n le nombre de balises dejà posées \n lors du trajet."
|
||||
rp_beacon_store="Porte le nombre de \nbalises transportées\nà 200 (contre 20)."
|
||||
rp_beacon_purchased="Les colis viennent \n tout juste d'être \n livrés. Un vrai sapin de Noël, \nce terrain !"
|
||||
rp_beacon_purchased="Les colis ont été \n livrés. De quoi \n transformer \n ce terrain en \n sapin de Noël !"
|
||||
rp_beacon_type="upgrade"
|
||||
card_description.update({"beacon-card" : [rp_beacon_title, rp_beacon_text, rp_beacon_store, rp_beacon_purchased, rp_beacon_type]})
|
||||
|
||||
|
21
rp_store.py
21
rp_store.py
@ -79,11 +79,7 @@ def open2 (cont):
|
||||
obj.worldPosition.z = 0.19
|
||||
|
||||
# Overlay
|
||||
# FIXME : bug sur l'Overlay ? pas d'explication -> incorporer tout le Hud dans la caméra
|
||||
scene.objects['Terrain']['manip_mode']=8 # Fenêtre modale type Doc
|
||||
scene.removeOverlayCollection(bpy.data.collections['Hud'])
|
||||
scene.objects['Points'].setVisible(False,True)
|
||||
scene.objects['Commands'].setVisible(False,True)
|
||||
scene.active_camera = scene.objects["Camera-Store"]
|
||||
scene.objects['Camera'].setVisible(False,True)
|
||||
|
||||
@ -100,7 +96,7 @@ def open2 (cont):
|
||||
if upgrade_nb == 4 :
|
||||
scene.objects['Bubble-1-text']['Text']="Resalut ! \n Rien de neuf \n pour le moment. \n Il fait beau \n aujourd'hui, non ?"
|
||||
if upgrade_nb < 4 and upgrade_credit ==0:
|
||||
scene.objects['Bubble-1-text']['Text']="Des missions \n tu passeras, \n des crédits \n tu auras !"
|
||||
scene.objects['Bubble-1-text']['Text']="Des missions \n tu passeras, \n des crédits \n tu auras, \n petit scarabé !"
|
||||
|
||||
start = 1
|
||||
end = 20
|
||||
@ -126,11 +122,11 @@ def open2 (cont):
|
||||
for i in range(len(upgrade_card)):
|
||||
if scene.objects['Points']["upgrade_"+upgrade_card[i]]:
|
||||
scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] = True
|
||||
# if scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] == True:
|
||||
scene.objects["Store-"+upgrade_card[i]+"-card"].color = color_store_upgraded
|
||||
scene.objects["Store-"+upgrade_card[i]+"-card-icon"].color = color_store_upgraded
|
||||
scene.objects["Store-"+upgrade_card[i]+"-card-text"].color = color_store_upgraded
|
||||
else:
|
||||
scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] = False
|
||||
scene.objects["Store-"+upgrade_card[i]+"-card"].color = color_store_fct
|
||||
scene.objects["Store-"+upgrade_card[i]+"-card-icon"].color = color_store_fct
|
||||
scene.objects["Store-"+upgrade_card[i]+"-card-text"].color = color_store_fct
|
||||
@ -296,19 +292,10 @@ def upgrade (cont):
|
||||
scene.objects[scene.objects['Store-panel']['page_fct']].color = color_store_upgraded
|
||||
scene.objects[scene.objects['Store-panel']['page_fct']+'-text'].color = color_store_upgraded
|
||||
scene.objects[scene.objects['Store-panel']['page_fct']+'-icon'].color = color_store_upgraded
|
||||
# scene.objects['Points']['upgrade_nb'] +=1
|
||||
# scene.objects['Points']['upgrade_credit']= scene.objects['Points']['level']- 1 - scene.objects['Points']['upgrade_nb']
|
||||
# scene.objects['Store_credits']['Text'] = "Crédits : "+str(scene.objects['Points']['upgrade_credit'])
|
||||
scene.objects['Store_upgrade'].setVisible(False, False)
|
||||
scene.objects['Store_upgrade'].suspendPhysics (True)
|
||||
scene.objects['Bubble-1-text']['Text']=rp_doc.upgrade_talk(name_fct)
|
||||
|
||||
# Mise à jour des améliorations
|
||||
upgrade_card=("battery", "beacon", "paint", "speed")
|
||||
for i in range(len(upgrade_card)):
|
||||
if scene.objects["Store-"+upgrade_card[i]+"-card"]['upgraded'] == True:
|
||||
scene.objects['Points']["upgrade_"+upgrade_card[i]]=True
|
||||
break
|
||||
scene.objects['Points']["upgrade_"+name_fct[6:name_fct.find("-card")]]=True
|
||||
|
||||
# Calcul du crédit disponible
|
||||
upgrade_nb = 0
|
||||
@ -317,7 +304,7 @@ def upgrade (cont):
|
||||
if scene.objects['Points']["upgrade_"+upgrade_card[i]]:
|
||||
upgrade_nb +=1
|
||||
upgrade_credit = scene.objects['Points']['level']- 1 - upgrade_nb # Le level 1 n'apporte pas de crédit
|
||||
scene.objects['Store_credits']['Text'] = "Crédits : "+str(upgrade_nb)
|
||||
scene.objects['Store_credits']['Text'] = "Crédits : "+str(upgrade_credit)
|
||||
|
||||
###############################################################################
|
||||
# Rover
|
||||
|
Loading…
Reference in New Issue
Block a user