Jump to content

[uitooltip]item value Display cannot be centered!


Go to solution Solved by Sherer,

Recommended Posts

  • Premium

Hello, everyone.

I turned on the function of G M to view the item code, which is very convenient to test. You know,

Just to show that there's a little bit of a problem, I just added two lines of code in UI old tip,

Some displays are normal, such as weapons, pets, potions, and skill books

But other cannot be centered, where should I adjust excuse me?

Best wishes, thank you

		if chr.IsGameMaster(player.GetMainCharacterIndex()):
			self.AppendTextLine("[Vnum: %d]" % itemVnum, ToolTip.SPECIAL_POSITIVE_COLOR2)

 

代码显示错误.png

AlignHorizonalCenter centers all associated objects (from self.childrenList).
In case of centering long size TextLines it's better to use AutoAppendTextLine (which tunes the thinboard to the line width).
Consider merging those functions from newer uitooltip (I assume you are currently working on old ui):
 

AlignHorizonalCenter
AutoAppendTextLine
AppendTextLine

 

  • Premium
4 hours ago, Sherer said:

AlignHorizonalCenter centers all associated objects (from self.childrenList).
In case of centering long size TextLines it's better to use AutoAppendTextLine (which tunes the thinboard to the line width).
Consider merging those functions from newer uitooltip (I assume you are currently working on old ui):
 


	def AlignHorizonalCenter(self):
		for child in self.childrenList:
			(x, y)=child.GetLocalPosition()
			child.SetPosition(self.toolTipWidth/2, y)

		self.ResizeToolTip()

	def AutoAppendTextLine(self, text, color = FONT_COLOR, centerAlign = True):
		textLine = ui.TextLine()
		textLine.SetParent(self)
		textLine.SetFontName(self.defFontName)
		textLine.SetPackedFontColor(color)
		textLine.SetText(text)
		textLine.SetOutline()
		textLine.SetFeather(False)
		textLine.Show()

		if centerAlign:
			textLine.SetPosition(self.toolTipWidth/2, self.toolTipHeight)
			textLine.SetHorizontalAlignCenter()

		else:
			textLine.SetPosition(10, self.toolTipHeight)

		self.childrenList.append(textLine)

		(textWidth, textHeight)=textLine.GetTextSize()

		textWidth += 40
		textHeight += 5

		if self.toolTipWidth < textWidth:
			self.toolTipWidth = textWidth

		self.toolTipHeight += textHeight

		return textLine

	def AppendTextLine(self, text, color = FONT_COLOR, centerAlign = True):
		textLine = ui.TextLine()
		textLine.SetParent(self)
		textLine.SetFontName(self.defFontName)
		textLine.SetPackedFontColor(color)
		textLine.SetText(text)
		textLine.SetOutline()
		textLine.SetFeather(False)
		textLine.Show()

		if centerAlign:
			textLine.SetPosition(self.toolTipWidth/2, self.toolTipHeight)
			textLine.SetHorizontalAlignCenter()

		else:
			textLine.SetPosition(10, self.toolTipHeight)

		self.childrenList.append(textLine)

		self.toolTipHeight += self.TEXT_LINE_HEIGHT
		self.ResizeToolTip()

		return textLine

 

		if chr.IsGameMaster(player.GetMainCharacterIndex()):
			self.AutoAppendTextLine("[vnum:%d]" % itemVnum, ToolTip.SPECIAL_POSITIVE_COLOR2)

@Sherer,thank you !

 

 

I try,but can't center

  • Solution

If this problem persist only for couple types you shall jump into the AddItemData function and look out for item.BROKEN_TYPE if-statement.
It may be good point to start from.
If you still won't find any success, share your uitooltip.

  • Love 1

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

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.