Jump to content
Banner 730x90px boost

[C++]Mail Box Final version


Daemon

Recommended Posts

  • Administrator

[C++]Mail Box Final version - Systemul este full testat fara buguri!

download: https://mega.nz/#!gb5yFIKS!L1zivKH4XduVQfqICiuNgZTmU31nAdoMX-ffpHtO09Y

ui.py

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

		self.eventFunc = {"mouse_click" : None, "mouse_over_in" : None, "mouse_over_out" : None}
		self.eventArgs = {"mouse_click" : None, "mouse_over_in" : None, "mouse_over_out" : None}

		self.eventDict={}

	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 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 OnMouseOverIn(self):
		try:
			self.eventDict["MOUSE_OVER_IN"]()
		except KeyError:
			pass

	def OnMouseOverOut(self):
		try:
			self.eventDict["MOUSE_OVER_OUT"]()
		except KeyError:
			pass

	def OnMouseLeftButtonUp(self) :
		if self.eventFunc["mouse_click"] :
			apply(self.eventFunc["mouse_click"], self.eventArgs["mouse_click"])

	def OnMouseOverIn(self) :
		if self.eventFunc["mouse_over_in"] :
			apply(self.eventFunc["mouse_over_in"], self.eventArgs["mouse_over_in"])
		else:
			try:
				self.eventDict["MOUSE_OVER_IN"]()
			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:
				self.eventDict["MOUSE_OVER_OUT"]()
			except KeyError:
				pass
				
	def SAFE_SetStringEvent(self, event, func):
		self.eventDict[event]=__mem_func__(func)

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

		self.eventFunc = {"mouse_click" : None, "mouse_over_in" : None, "mouse_over_out" : None}
		self.eventArgs = {"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.RegisterAniImageBox(self, layer)

	def SetDelay(self, delay):
		wndMgr.SetDelay(self.hWnd, delay)

	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 OnMouseLeftButtonUp(self) :
		if self.eventFunc["mouse_click"] :
			apply(self.eventFunc["mouse_click"], self.eventArgs["mouse_click"])

	def OnMouseOverIn(self) :
		if self.eventFunc["mouse_over_in"] :
			apply(self.eventFunc["mouse_over_in"], self.eventArgs["mouse_over_in"])

	def OnMouseOverOut(self) :
		if self.eventFunc["mouse_over_out"] :
			apply(self.eventFunc["mouse_over_out"], self.eventArgs["mouse_over_out"])

	def AppendImage(self, filename):
		wndMgr.AppendImage(self.hWnd, filename)

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

	def OnEndFrame(self):
		pass

==========================================================
uiminimap
import uiToolTip

class MiniMap(ui.ScriptWindow):

search:

miniMap.SetScale(2.0)

add bellow:

if app.ENABLE_MAIL_BOX_SYSTEM:
			self.toolTip = uiToolTip.ToolTip(160)
			self.toolTip.HideToolTip()



search:
 

self.tooltipAtlasOpen.SetTooltipPosition(ButtonPosX, ButtonPosY)



add bellow:
 

if app.ENABLE_MAIL_BOX_SYSTEM:
			self.MailBoxButton.SetEvent(ui.__mem_func__(self.OnMouseOverIn), "mouse_over_in")
			self.MailBoxButton.SetEvent(ui.__mem_func__(self.OnMouseOverOut), "mouse_over_out")

search:

def OnUpdate(self):
		import time
		(x, y, z) = player.GetMainCharacterPosition()
		miniMap.Update(x, y)
		
		self.Time.SetText(time.strftime("%H:%M"))
		self.Time2.SetText(time.strftime("%d-%m-%Y"))

ADD BEFORE:

if app.ENABLE_MAIL_BOX_SYSTEM:
		def MailBoxValues(self,c_a,m_a,m_s):
			if c_a > 0:
				self.MailBoxEffect.Show()
			else:
				self.MailBoxEffect.Hide()
				
			self.toolTip.ClearToolTip()
			self.toolTip.SetTitle("Wiadomości otrzymane %d"%c_a)
			self.toolTip.AppendTextLine("Bez załącznika: %d / Z załącznikiem: %d"%(m_s,m_a))

	def OnMouseOverIn(self):
		self.toolTip.ShowToolTip()
		
	def OnMouseOverOut(self):
		self.toolTip.HideToolTip()
Link to comment
Share on other sites

  • 4 months later...

thank you bro

 

I have a question. Should I activate this?
 

Locale_inc

 

//#define USE_TRANSMUTATION_SYSTEM_MAILBOX
//#define USE_WON_SYSTEM_MAILBOX

and

 

service

 

//#define USE_TRANSMUTATION_SYSTEM_MAILBOX
//#define USE_WON_SYSTEM_MAILBOX
//#define USE_ACCE_SYSTEM_MAILBOX

please reply

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...