are lipsuri la button din inventar si ceva in ui.py cu partea de argumentare onmousrebuttonevent SA SCHIMBATI IF DEFURILE CU CE AVETI IN ARHIVA
https://gyazo.com/16564f9f5b61ecdef8d5cabffd85a5f5
UIcharacterwindow.py
#Add
if
app.ENABLE_DETAILS_UI:
import uiCharacterDetails
#Find
def __init__(self):
ui.ScriptWindow.__init__(self)
#Change
def __init__(self):
if app.ENABLE_DETAILS_UI:
self.chDetailsWnd = None
self.isOpenedDetailsWnd = False
ui.ScriptWindow.__init__(self)
#Find
def Show(self):
self.__LoadWindow()
#Add
if app.ENABLE_DETAILS_UI:
self.__InitCharacterDetailsUIButton()
if self.chDetailsWnd and self.isOpenedDetailsWnd:
self.chDetailsWnd.Show()
#Find
self.questLastCountList = []
#Add
if app.ENABLE_DETAILS_UI:
self.MainBoard = self.GetChild("board")
self.ExpandBtn = ui.MakeButton(self.MainBoard, 240, 120, "", "d:/ymir work/ui/game/belt_inventory/", "btn_minimize_normal.tga", "btn_minimize_over.tga", "btn_minimize_down.tga")
self.ExpandBtn.SetEvent(ui.__mem_func__(self.__ClickExpandButton))
self.MinimizeBtn = ui.MakeButton(self.MainBoard, 240, 120, "", "d:/ymir work/ui/game/belt_inventory/", "btn_expand_normal.tga", "btn_expand_over.tga", "btn_expand_down.tga")
self.MinimizeBtn.SetEvent(ui.__mem_func__(self.__ClickMinimizeButton))
#Find
def ActEmotion(self, emotionIndex):
self.__ClickEmotionSlot(emotionIndex)
#Add
if app.ENABLE_DETAILS_UI:
def OnTop(self):
if self.chDetailsWnd:
self.chDetailsWnd.SetTop()
def Hide(self):
if self.chDetailsWnd:
self.isOpenedDetailsWnd = self.chDetailsWnd.IsShow()
self.chDetailsWnd.Close()
wndMgr.Hide(self.hWnd)
def __InitCharacterDetailsUIButton(self):
self.ExpandBtn.Show()
self.MinimizeBtn.Hide()
def __ClickExpandButton(self):
if not self.chDetailsWnd:
self.chDetailsWnd = uiCharacterDetails.CharacterDetailsUI(self)
self.chDetailsWnd.Show()
else:
self.chDetailsWnd.Show()
self.ExpandBtn.Hide()
self.MinimizeBtn.Show()
def __ClickMinimizeButton(self):
self.chDetailsWnd.Hide()
self.MinimizeBtn.Hide()
self.ExpandBtn.Show()
def OnMoveWindow(self, x, y):
if self.chDetailsWnd:
self.chDetailsWnd.AdjustPosition(x, y)
#Find
for titleBarValue in self.titleBarDict.itervalues():
titleBarValue.SetCloseEvent(ui.__mem_func__(self.Hide))
#Change
for titleBarValue in self.titleBarDict.itervalues():
if app.ENABLE_DETAILS_UI:
titleBarValue.SetCloseEvent(ui.__mem_func__(self.Close))
else:
titleBarValue.SetCloseEvent(ui.__mem_func__(self.Hide))
#Find
def Close(self):
if 0 != self.toolTipSkill:
self.toolTipSkill.Hide()
#Add
if app.ENABLE_DETAILS_UI:
if self.chDetailsWnd and self.chDetailsWnd.IsShow():
self.chDetailsWnd.Hide()
UI.PY
class ImageBox(Window):
def __init__(self, layer = "UI"):
Window.__init__(self, layer)
self.eventDict={}
self.argDict={}
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.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 SetDiffuseColor(self, r, g, b, a):
wndMgr.SetDiffuseColor(self.hWnd, r, g, b, a)
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)
self.argDict[event]=args
def SetStringEvent(self, event, func, *args):
self.eventDict[event]=func
self.argDict[event]=args
def DelStringEvent(self, event):
self.eventDict.pop(event, None)
self.argDict.pop(event, None)
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"])
else:
try:
apply(self.eventDict["MOUSE_OVER_IN"], self.argDict["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:
apply(self.eventDict["MOUSE_OVER_OUT"], self.argDict["MOUSE_OVER_OUT"])
except KeyError:
pass