Jump to content

Ghost quest panel


Recommended Posts

I have an issue about the quest window panel, if I open one from an npc, I can't click after the teleport if the window is opened at the moment of the teleport. But if I open one from the quest list (left on the screen) it won't get bugged.

 

I create a new quest board, in ui.py.

class QuestBoard(Window):
	CORNER_WIDTH	= 64
	CORNER_HEIGHT	= 64
	LINE_WIDTH		= 64
	LINE_HEIGHT		= 64
	BASE_WIDTH		= 64
	BASE_HEIGHT		= 64
	BOARD_COLOR		= grp.GenerateColor(0.0, 0.0, 0.0, 0.8)

	LT	= 0
	LB	= 1
	RT	= 2
	RB	= 3
	L	= 0
	R	= 1
	T	= 2
	B	= 3

	def __init__(self, layer = "UI"):
		Window.__init__(self, layer)
		
		CornerFileNames = [ "d:/ymir work/ui/pattern/QuestBoard_Corner_"+dir+".png" for dir in ["LeftTop","LeftBottom","RightTop","RightBottom"] ]
		LineFileNames = [ "d:/ymir work/ui/pattern/QuestBoard_Line_"+dir+".png" for dir in ["Left","Right","Top","Bottom"] ]

		self.Corners = []
		for fileName in CornerFileNames:
			Corner = ExpandedImageBox()
			Corner.AddFlag("attach")
			Corner.AddFlag("not_pick")
			Corner.LoadImage(fileName)
			Corner.SetParent(self)
			Corner.SetPosition(0, 0)
			Corner.Show()
			self.Corners.append(Corner)

		self.Lines = []
		for fileName in LineFileNames:
			Line = ExpandedImageBox()
			Line.AddFlag("attach")
			Line.AddFlag("not_pick")
			Line.LoadImage(fileName)
			Line.SetParent(self)
			Line.SetPosition(0, 0)
			Line.Show()
			self.Lines.append(Line)

		Base = ExpandedImageBox()
		Base.SetParent(self)
		Base.AddFlag("not_pick")
		Base.SetPosition(self.CORNER_WIDTH, self.CORNER_HEIGHT)
		baseImage = "d:/ymir work/ui/pattern/QuestBoard_Base.png"
		Base.LoadImage(baseImage)
		Base.Show()
		self.Base = Base
		
		self.Lines[self.L].SetPosition(0, self.CORNER_HEIGHT)
		self.Lines[self.T].SetPosition(self.CORNER_WIDTH, 0)

	def __del__(self):
		Window.__del__(self)

	def SetSize(self, width, height):
		width = max(self.CORNER_WIDTH * 2, width)
		height = max(self.CORNER_HEIGHT * 2, height)
		
		Window.SetSize(self, width, height)

		self.Corners[self.LB].SetPosition(0, height - self.CORNER_HEIGHT)
		self.Corners[self.RT].SetPosition(width - self.CORNER_WIDTH, 0)
		self.Corners[self.RB].SetPosition(width - self.CORNER_WIDTH, height - self.CORNER_HEIGHT)
		
		self.Lines[self.R].SetPosition(width - self.CORNER_WIDTH, self.CORNER_HEIGHT)
		self.Lines[self.B].SetPosition(self.CORNER_HEIGHT, height - self.CORNER_HEIGHT)

		verticalShowingPercentage = float((height - self.CORNER_HEIGHT * 2) - self.LINE_HEIGHT) / self.LINE_HEIGHT
		horizontalShowingPercentage = float((width - self.CORNER_WIDTH * 2) - self.LINE_WIDTH) / self.LINE_WIDTH
		
		self.Lines[self.L].SetRenderingRect(0, 0, 0, verticalShowingPercentage)
		self.Lines[self.R].SetRenderingRect(0, 0, 0, verticalShowingPercentage)
		self.Lines[self.T].SetRenderingRect(0, 0, horizontalShowingPercentage, 0)
		self.Lines[self.B].SetRenderingRect(0, 0, horizontalShowingPercentage, 0)
		
		if self.Base:
			verticalShowingPercentage = float((height - self.CORNER_HEIGHT * 2) - self.BASE_HEIGHT) / self.BASE_HEIGHT
			horizontalShowingPercentage = float((width - self.CORNER_WIDTH * 2) - self.BASE_WIDTH) / self.BASE_WIDTH
			self.Base.SetRenderingRect(0, 0, horizontalShowingPercentage, verticalShowingPercentage)

	def ShowInternal(self):
		self.Base.Show()
		for wnd in self.Lines:
			wnd.Show()
		for wnd in self.Corners:
			wnd.Show()

	def HideInternal(self):
		self.Base.Hide()
		for wnd in self.Lines:
			wnd.Hide()
		for wnd in self.Corners:
			wnd.Hide()
			elif Type == "questboard":
				parent.Children[Index] = QuestBoard()
				parent.Children[Index].SetParent(parent)
				self.LoadElementQuestBoard(parent.Children[Index], ElementValue, parent)

And i create a new file, in uiscript.

window = {
	"name" : "QuestDialog",
	"style" : ("float",),#"movable", 

	"x" : 0,
	"y" : 0,

	"width" : 800,
	"height" : 450,

	"children" :
	(
		{
			"name" : "board",
			"type" : "questboard",
			"style" : ("attach", "ignore_size",),

			"x" : 0,
			"y" : 0,

			"horizontal_align" : "center",
			"vertical_align" : "center",

			#"image" : "locale/de/ui/quest_board.png",

			"width" : 350,
			"height" : 350,
		},
	),
}

Thanks for the helping.

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • 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.