Jump to content
×
×
  • Create New...

Python - Pourcentage de Vie dans le Target


Recommended Posts

  • Bot

Centre de Téléchargement

Télécharger ( Interne )

Bonjour,

 

Tutoriel assez court pour vous apprendre à faire ceci : 03553717FEh.png

Dépackez votre root et ouvrez votre uitarget.py.

 

Cherchez :

def __init__(self):
Vous aurez :
		hpGauge = ui.Gauge()
	hpGauge.SetParent(self)
	hpGauge.MakeGauge(130, "red")
	hpGauge.Hide()
 

Ajoutez :

		hpPercenttxt = ui.TextLine()
	hpPercenttxt.SetParent(self)
	hpPercenttxt.SetPosition(160, 13)
	hpPercenttxt.SetText("")
	hpPercenttxt.Hide()
 

Ce qui donne :

	def __init__(self):
	ui.ThinBoard.__init__(self)

	name = ui.TextLine()
	name.SetParent(self)
	name.SetDefaultFontName()
	name.SetOutline()
	name.Show()

	hpGauge = ui.Gauge()
	hpGauge.SetParent(self)
	hpGauge.MakeGauge(130, "red")
	hpGauge.Hide()

	hpPercenttxt = ui.TextLine()
	hpPercenttxt.SetParent(self)
	hpPercenttxt.SetPosition(160, 13)
	hpPercenttxt.SetText("")
	hpPercenttxt.Hide()

	closeButton = ui.Button()
	closeButton.SetParent(self)
	closeButton.SetUpVisual("d:/ymir work/ui/public/close_button_01.sub")
	closeButton.SetOverVisual("d:/ymir work/ui/public/close_button_02.sub")
	closeButton.SetDownVisual("d:/ymir work/ui/public/close_button_03.sub")
	closeButton.SetPosition(30, 13)
Cherchez :
		self.name = name
	self.hpGauge = hpGauge
Ajoutez  en dessous :
		self.hpPercenttxt = hpPercenttxt
Cherchez :
def Destroy(self):
 

Ajoutez :

self.hpPercenttxt = None
Cherchez :
def ResetTargetBoard(self):
Vous aurez :
self.hpGauge.Hide()
Ajoutez :
self.hpPercenttxt.Hide()
Cherchez :
def SetHP(self, hpPercentage):
Vous aurez :
self.UpdatePosition()
Ajoutez :
			self.hpPercenttxt.SetPosition(200 + 7*self.nameLength-205, 13)
		self.hpPercenttxt.Show()
Enfin, cherchez :
self.hpGauge.SetPercentage(hpPercentage, 100)
Et puis ajoutez :
self.hpPercenttxt.SetText("%d%%" % (hpPercentage))
Vous pouvez repacker, c'est fini !

 

Source : Mt2dev

 

Cordialement, Takuma.

  • J'adore 5

090100logo.png 090149logo-4-bis.png

Link to comment
  • 6 months later...
  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.