Jump to content

Shop Search System - MouseOverIn/Out Problem


Recommended Posts

  • Active+ Member

Hello. I find items but cannot click on them. I've been struggling with this for days but couldn't figure it out. Anyone have knowledge on this?

 

No syserr.

spacer.png

 

Code:

		# search result screen code
 		self.icon_image = ui.MakeExpandedImageBox(self.slot_base_image, MAIN_PATH + "right_side/{}_slot.tga".format(itemSize), 0, 0)
		self.icon_image.SAFE_SetStringEvent("MOUSE_OVER_IN", self.OnHover)
		self.icon_image.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.OnOut)
		self.icon_image.SAFE_SetStringEvent("MOUSE_CLICK", self.OnMouseLeftButtonDown)
		self.icon_image.SAFE_SetStringEvent("MOUSE_RCLICK", self.OnMouseRightButtonDown)
		self.icon_image.SetWindowHorizontalAlignCenter()
		self.icon_image.SetWindowVerticalAlignCenter()
        
        
        ##ui.py MakeExpandedImageBox():
        def MakeExpandedImageBox(parent, name, x, y):
          image = ExpandedImageBox()
          image.SetParent(parent)
          image.LoadImage(name)
          image.SetPosition(x, y)
          image.Show()
          return image
        

class ImageBox:

Spoiler
class ImageBox(Window):
	def __init__(self, layer = "UI"):
		Window.__init__(self, layer)

		self.name=""
		self.argDict={}
		self.eventDict={}
		self.eventFunc = {"mouse_rclick" : None, "mouse_click" : None, "mouse_over_in" : None, "mouse_over_out" : None}
		self.eventArgs = {"mouse_rclick" : None, "mouse_click" : None, "mouse_over_in" : None, "mouse_over_out" : None}

	def __del__(self):
		Window.__del__(self)
		self.eventFunc = None
		self.eventArgs = None

	def RegisterWindow(self, layer):
		self.hWnd = wndMgr.RegisterImageBox(self, layer)

	def LoadImage(self, imageName):
		self.name=imageName
		wndMgr.LoadImage(self.hWnd, imageName)

		if len(self.eventDict)!=0:
			print "LOAD IMAGE", self, self.eventDict

	def SetAlpha(self, alpha):
		wndMgr.SetDiffuseColor(self.hWnd, 1.0, 1.0, 1.0, alpha)

	def GetWidth(self):
		return wndMgr.GetWidth(self.hWnd)

	def GetHeight(self):
		return wndMgr.GetHeight(self.hWnd)

	def SAFE_SetStringEvent(self, event, func, *args):
		self.eventDict[event]=(__mem_func__(func), args)

	def SetEvent(self, func, *args):
		result = self.eventFunc.has_key(args[0])
		if result:
			self.eventFunc[args[0]] = func
			self.eventArgs[args[0]] = args
		else:
			print "[ERROR] ui.py SetEvent, Can`t Find has_key : %s" % args[0]


	def OnMouseLeftButtonDown(self) :
		if self.eventFunc["mouse_click"] :
			apply(self.eventFunc["mouse_click"], self.eventArgs["mouse_click"])
		else:
			try:
				apply(self.eventDict["MOUSE_CLICK"][0], self.eventDict["MOUSE_CLICK"][1])
			except KeyError:
				pass
	
	def OnMouseRightButtonDown(self) :
		if self.eventFunc["mouse_rclick"] :
			apply(self.eventFunc["mouse_rclick"], self.eventArgs["mouse_rclick"])
		else:
			try:
				apply(self.eventDict["MOUSE_RCLICK"][0], self.eventDict["MOUSE_RCLICK"][1])
			except KeyError:
				pass

	def OnMouseOverIn(self) :
		if self.eventFunc["mouse_over_in"] :
			apply(self.eventFunc["mouse_over_in"], self.eventArgs["mouse_over_in"])
		else:
			try:
				apply(self.eventDict["MOUSE_OVER_IN"][0], self.eventDict["MOUSE_OVER_IN"][1])
			except KeyError:
				pass

	def OnMouseOverOut(self) :
		if self.eventFunc["mouse_over_out"] :
			apply(self.eventFunc["mouse_over_out"], self.eventArgs["mouse_over_out"])
		else :
			try:
				apply(self.eventDict["MOUSE_OVER_OUT"][0], self.eventDict["MOUSE_OVER_OUT"][1])
			except KeyError:
				pass

	if app.ENABLE_PRIVATE_SHOP_SEARCH_SYSTEM:
		def LeftRightReverse(self):
			wndMgr.LeftRightReverseImageBox(self.hWnd)

	def SetCoolTime(self, time, elapsedTime = 0.0):
		wndMgr.SetCoolTimeImageBox(self.hWnd, time, elapsedTime)
	
	def IsInCoolTime(self):
		return wndMgr.IsInCoolTime(self.hWnd)

	def SetStartCoolTime(self, time):
		wndMgr.SetStartCoolTimeImageBox(self.hWnd, time)

 

 

class ExpandedImageBox:

class ExpandedImageBox(ImageBox):
	def __init__(self, layer = "UI"):
		ImageBox.__init__(self, layer)

	def __del__(self):
		ImageBox.__del__(self)

	def RegisterWindow(self, layer):
		self.hWnd = wndMgr.RegisterExpandedImageBox(self, layer)

	def SetScale(self, xScale, yScale):
		wndMgr.SetScale(self.hWnd, xScale, yScale)

	def SetOrigin(self, x, y):
		wndMgr.SetOrigin(self.hWnd, x, y)

	def SetRotation(self, rotation):
		wndMgr.SetRotation(self.hWnd, rotation)

	def SetRenderingMode(self, mode):
		wndMgr.SetRenderingMode(self.hWnd, mode)

	# [0.0, 1.0] ??? ??? ???? ??? ???.
	def SetRenderingRect(self, left, top, right, bottom):
		wndMgr.SetRenderingRect(self.hWnd, left, top, right, bottom)

	def SetPercentage(self, curValue, maxValue):
		if maxValue:
			self.SetRenderingRect(0.0, 0.0, -1.0 + float(curValue) / float(maxValue), 0.0)
		else:
			self.SetRenderingRect(0.0, 0.0, 0.0, 0.0)

	def GetWidth(self):
		return wndMgr.GetWindowWidth(self.hWnd)

	def GetHeight(self):
		return wndMgr.GetWindowHeight(self.hWnd)

	def SetCoolTime(self, time, elapsedTime = 0.0):
		wndMgr.SetCoolTimeImageBox(self.hWnd, time, elapsedTime)
	
	def IsInCoolTime(self):
		return wndMgr.IsInCoolTime(self.hWnd)

	def SetStartCoolTime(self, time):
		wndMgr.SetStartCoolTimeImageBox(self.hWnd, time)

 

Edited by Metin2 Dev
Core X - External 2 Internal
Link to comment
Share on other sites

  • Replies 2
  • 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


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