You last visited: Today at 06:22
Advertisement
Fehler ;/
Discussion on Fehler ;/ within the Metin2 Private Server forum part of the Metin2 category.
05/06/2015, 11:49
#1
elite*gold: 0
Join Date: Nov 2012
Posts: 31
Received Thanks: 4
Fehler ;/
Guten Tag,
wollte das Craftingsystem
einfügen, nun habe ich leider ein Problem mit meiner root datei. Hier der Fehler:
Ich benutze den Daroo Client. Die Datei wo ich verändert habe sieht so aus:
PHP Code:
import app
import ime
import grp
import snd
import wndMgr
import item
import skill
import locale
# MARK_BUG_FIX
import guild
# END_OF_MARK_BUG_FIX
from _weakref import proxy
BACKGROUND_COLOR = grp . GenerateColor ( 0.0 , 0.0 , 0.0 , 1.0 )
DARK_COLOR = grp . GenerateColor ( 0.2 , 0.2 , 0.2 , 1.0 )
BRIGHT_COLOR = grp . GenerateColor ( 0.7 , 0.7 , 0.7 , 1.0 )
if locale . IsCANADA ():
SELECT_COLOR = grp . GenerateColor ( 0.9 , 0.03 , 0.01 , 0.4 )
else:
SELECT_COLOR = grp . GenerateColor ( 0.0 , 0.0 , 0.5 , 0.3 )
WHITE_COLOR = grp . GenerateColor ( 1.0 , 1.0 , 1.0 , 0.5 )
HALF_WHITE_COLOR = grp . GenerateColor ( 1.0 , 1.0 , 1.0 , 0.2 )
createToolTipWindowDict = {}
def RegisterCandidateWindowClass ( codePage , candidateWindowClass ):
EditLine . candidateWindowClassDict [ codePage ]= candidateWindowClass
def RegisterToolTipWindow ( type , createToolTipWindow ):
createToolTipWindowDict [ type ]= createToolTipWindow
app . SetDefaultFontName ( locale . UI_DEF_FONT )
## Window Manager Event List##
##############################
## "OnMouseLeftButtonDown"
## "OnMouseLeftButtonUp"
## "OnMouseLeftButtonDoubleClick"
## "OnMouseRightButtonDown"
## "OnMouseRightButtonUp"
## "OnMouseRightButtonDoubleClick"
## "OnMouseDrag"
## "OnSetFocus"
## "OnKillFocus"
## "OnMouseOverIn"
## "OnMouseOverOut"
## "OnRender"
## "OnUpdate"
## "OnKeyDown"
## "OnKeyUp"
## "OnTop"
## "OnIMEUpdate" ## IME Only
## "OnIMETab" ## IME Only
## "OnIMEReturn" ## IME Only
##############################
## Window Manager Event List##
class __mem_func__ :
class __noarg_call__ :
def __init__ ( self , cls , obj , func ):
self . cls = cls
self . obj = proxy ( obj )
self . func = proxy ( func )
def __call__ ( self , * arg ):
return self . func ( self . obj )
class __arg_call__ :
def __init__ ( self , cls , obj , func ):
self . cls = cls
self . obj = proxy ( obj )
self . func = proxy ( func )
def __call__ ( self , * arg ):
return self . func ( self . obj , * arg )
def __init__ ( self , mfunc ):
if mfunc . im_func . func_code . co_argcount > 1 :
self . call = __mem_func__ . __arg_call__ ( mfunc . im_class , mfunc . im_self , mfunc . im_func )
else:
self . call = __mem_func__ . __noarg_call__ ( mfunc . im_class , mfunc . im_self , mfunc . im_func )
def __call__ ( self , * arg ):
return self . call (* arg )
class Window (object):
def NoneMethod ( cls ):
pass
NoneMethod = classmethod ( NoneMethod )
def __init__ ( self , layer = "UI" ):
self . hWnd = None
self . parentWindow = 0
self . RegisterWindow ( layer )
self . Hide ()
def __del__ ( self ):
wndMgr . Destroy ( self . hWnd )
def RegisterWindow ( self , layer ):
self . hWnd = wndMgr . Register ( self , layer )
def Destroy ( self ):
pass
def GetWindowHandle ( self ):
return self . hWnd
def AddFlag ( self , style ):
wndMgr . AddFlag ( self . hWnd , style )
def IsRTL ( self ):
return wndMgr . IsRTL ( self . hWnd )
def SetWindowName ( self , Name ):
wndMgr . SetName ( self . hWnd , Name )
def SetParent ( self , parent ):
wndMgr . SetParent ( self . hWnd , parent . hWnd )
def SetParentProxy ( self , parent ):
self . parentWindow = proxy ( parent )
wndMgr . SetParent ( self . hWnd , parent . hWnd )
def GetParentProxy ( self ):
return self . parentWindow
def SetPickAlways ( self ):
wndMgr . SetPickAlways ( self . hWnd )
def SetWindowHorizontalAlignLeft ( self ):
wndMgr . SetWindowHorizontalAlign ( self . hWnd , wndMgr . HORIZONTAL_ALIGN_LEFT )
def SetWindowHorizontalAlignCenter ( self ):
wndMgr . SetWindowHorizontalAlign ( self . hWnd , wndMgr . HORIZONTAL_ALIGN_CENTER )
def SetWindowHorizontalAlignRight ( self ):
wndMgr . SetWindowHorizontalAlign ( self . hWnd , wndMgr . HORIZONTAL_ALIGN_RIGHT )
def SetWindowVerticalAlignTop ( self ):
wndMgr . SetWindowVerticalAlign ( self . hWnd , wndMgr . VERTICAL_ALIGN_TOP )
def SetWindowVerticalAlignCenter ( self ):
wndMgr . SetWindowVerticalAlign ( self . hWnd , wndMgr . VERTICAL_ALIGN_CENTER )
def SetWindowVerticalAlignBottom ( self ):
wndMgr . SetWindowVerticalAlign ( self . hWnd , wndMgr . VERTICAL_ALIGN_BOTTOM )
def SetTop ( self ):
wndMgr . SetTop ( self . hWnd )
def Show ( self ):
wndMgr . Show ( self . hWnd )
def Hide ( self ):
wndMgr . Hide ( self . hWnd )
def Lock ( self ):
wndMgr . Lock ( self . hWnd )
def Unlock ( self ):
wndMgr . Unlock ( self . hWnd )
def IsShow ( self ):
return wndMgr . IsShow ( self . hWnd )
def UpdateRect ( self ):
wndMgr . UpdateRect ( self . hWnd )
def SetSize ( self , width , height ):
wndMgr . SetWindowSize ( self . hWnd , width , height )
def GetWidth ( self ):
return wndMgr . GetWindowWidth ( self . hWnd )
def GetHeight ( self ):
return wndMgr . GetWindowHeight ( self . hWnd )
def GetLocalPosition ( self ):
return wndMgr . GetWindowLocalPosition ( self . hWnd )
def GetGlobalPosition ( self ):
return wndMgr . GetWindowGlobalPosition ( self . hWnd )
def GetMouseLocalPosition ( self ):
return wndMgr . GetMouseLocalPosition ( self . hWnd )
def GetRect ( self ):
return wndMgr . GetWindowRect ( self . hWnd )
def SetPosition ( self , x , y ):
wndMgr . SetWindowPosition ( self . hWnd , x , y )
def SetCenterPosition ( self , x = 0 , y = 0 ):
self . SetPosition (( wndMgr . GetScreenWidth () - self . GetWidth ()) / 2 + x , ( wndMgr . GetScreenHeight () - self . GetHeight ()) / 2 + y )
def IsFocus ( self ):
return wndMgr . IsFocus ( self . hWnd )
def SetFocus ( self ):
wndMgr . SetFocus ( self . hWnd )
def KillFocus ( self ):
wndMgr . KillFocus ( self . hWnd )
def GetChildCount ( self ):
return wndMgr . GetChildCount ( self . hWnd )
def IsIn ( self ):
return wndMgr . IsIn ( self . hWnd )
class ListBoxEx ( Window ):
class Item ( Window ):
def __init__ ( self ):
Window . __init__ ( self )
def __del__ ( self ):
Window . __del__ ( self )
def SetParent ( self , parent ):
Window . SetParent ( self , parent )
self . parent = proxy ( parent )
def OnMouseLeftButtonDown ( self ):
self . parent . SelectItem ( self )
def OnRender ( self ):
if self . parent . GetSelectedItem ()== self :
self . OnSelectedRender ()
def OnSelectedRender ( self ):
x , y = self . GetGlobalPosition ()
grp . SetColor ( grp . GenerateColor ( 0.0 , 0.0 , 0.7 , 0.7 ))
grp . RenderBar ( x , y , self . GetWidth (), self . GetHeight ())
def __init__ ( self ):
Window . __init__ ( self )
self . viewItemCount = 10
self . basePos = 0
self . itemWidth = 100
self . itemHeight = 16
self . itemStep = 20
self . selItem = 0
self . itemList =[]
self . onSelectItemEvent = lambda * arg : None
self . scrollBar = None
self . __UpdateSize ()
def __del__ ( self ):
Window . __del__ ( self )
def __UpdateSize ( self ):
height = self . itemStep * self . __GetViewItemCount ()
self . SetSize ( self . itemWidth , height )
def IsEmpty ( self ):
if len ( self . itemList )== 0 :
return 1
return 0
def SetItemStep ( self , itemStep ):
self . itemStep = itemStep
self . __UpdateSize ()
def SetItemSize ( self , itemWidth , itemHeight ):
self . itemWidth = itemWidth
self . itemHeight = itemHeight
self . __UpdateSize ()
def SetViewItemCount ( self , viewItemCount ):
self . viewItemCount = viewItemCount
def SetSelectEvent ( self , event ):
self . onSelectItemEvent = event
def SetBasePos ( self , basePos ):
for oldItem in self . itemList [ self . basePos : self . basePos + self . viewItemCount ]:
oldItem . Hide ()
self . basePos = basePos
pos = basePos
for newItem in self . itemList [ self . basePos : self . basePos + self . viewItemCount ]:
( x , y )= self . GetItemViewCoord ( pos )
newItem . SetPosition ( x , y )
newItem . Show ()
pos += 1
def GetItemIndex ( self , argItem ):
return self . itemList . index ( argItem )
def GetSelectedItem ( self ):
return self . selItem
def SelectIndex ( self , index ):
if index >= len ( self . itemList ) or index < 0 :
self . selItem = None
return
try:
self . selItem = self . itemList [ index ]
except :
pass
def SelectItem ( self , selItem ):
self . selItem = selItem
self . onSelectItemEvent ( selItem )
def RemoveAllItems ( self ):
self . selItem = None
self . itemList =[]
if self . scrollBar :
self . scrollBar . SetPos ( 0 )
def RemoveItem ( self , delItem ):
if delItem == self . selItem :
self . selItem = None
self . itemList . remove ( delItem )
def AppendItem ( self , newItem ):
newItem . SetParent ( self )
newItem . SetSize ( self . itemWidth , self . itemHeight )
pos = len ( self . itemList )
if self . __IsInViewRange ( pos ):
( x , y )= self . GetItemViewCoord ( pos )
newItem . SetPosition ( x , y )
newItem . Show ()
else:
newItem . Hide ()
self . itemList . append ( newItem )
def SetScrollBar ( self , scrollBar ):
scrollBar . SetScrollEvent ( __mem_func__ ( self . __OnScroll ))
self . scrollBar = scrollBar
def __OnScroll ( self ):
self . SetBasePos ( int ( self . scrollBar . GetPos ()* self . __GetScrollLen ()))
def __GetScrollLen ( self ):
scrollLen = self . __GetItemCount ()- self . __GetViewItemCount ()
if scrollLen < 0 :
return 0
return scrollLen
def __GetViewItemCount ( self ):
return self . viewItemCount
def __GetItemCount ( self ):
return len ( self . itemList )
def GetItemViewCoord ( self , pos ):
return ( 0 , ( pos - self . basePos )* self . itemStep )
def __IsInViewRange ( self , pos ):
if pos < self . basePos :
return 0
if pos >= self . basePos + self . viewItemCount :
return 0
return 1
class CandidateListBox ( ListBoxEx ):
HORIZONTAL_MODE = 0
VERTICAL_MODE = 1
class Item ( ListBoxEx . Item ):
def __init__ ( self , text ):
ListBoxEx . Item . __init__ ( self )
self . textBox = TextLine ()
self . textBox . SetParent ( self )
self . textBox . SetText ( text )
self . textBox . Show ()
def __del__ ( self ):
ListBoxEx . Item . __del__ ( self )
def __init__ ( self , mode = HORIZONTAL_MODE ):
ListBoxEx . __init__ ( self )
self . itemWidth = 32
self . itemHeight = 32
self . mode = mode
def __del__ ( self ):
ListBoxEx . __del__ ( self )
def SetMode ( self , mode ):
self . mode = mode
def AppendItem ( self , newItem ):
ListBoxEx . AppendItem ( self , newItem )
def GetItemViewCoord ( self , pos ):
if self . mode == self . HORIZONTAL_MODE :
return (( pos - self . basePos )* self . itemStep , 0 )
elif self . mode == self . VERTICAL_MODE :
return ( 0 , ( pos - self . basePos )* self . itemStep )
class TextLine ( Window ):
def __init__ ( self ):
Window . __init__ ( self )
self . max = 0
self . SetFontName ( locale . UI_DEF_FONT )
def __del__ ( self ):
Window . __del__ ( self )
def RegisterWindow ( self , layer ):
self . hWnd = wndMgr . RegisterTextLine ( self , layer )
def SetMax ( self , max ):
wndMgr . SetMax ( self . hWnd , max )
def SetLimitWidth ( self , width ):
wndMgr . SetLimitWidth ( self . hWnd , width )
def SetMultiLine ( self ):
wndMgr . SetMultiLine ( self . hWnd , TRUE )
def SetHorizontalAlignArabic ( self ):
wndMgr . SetHorizontalAlign ( self . hWnd , wndMgr . TEXT_HORIZONTAL_ALIGN_ARABIC )
def SetHorizontalAlignLeft ( self ):
wndMgr . SetHorizontalAlign ( self . hWnd , wndMgr . TEXT_HORIZONTAL_ALIGN_LEFT )
def SetHorizontalAlignRight ( self ):
wndMgr . SetHorizontalAlign ( self . hWnd , wndMgr . TEXT_HORIZONTAL_ALIGN_RIGHT )
def SetHorizontalAlignCenter ( self ):
wndMgr . SetHorizontalAlign ( self . hWnd , wndMgr . TEXT_HORIZONTAL_ALIGN_CENTER )
def SetVerticalAlignTop ( self ):
wndMgr . SetVerticalAlign ( self . hWnd , wndMgr . TEXT_VERTICAL_ALIGN_TOP )
def SetVerticalAlignBottom ( self ):
wndMgr . SetVerticalAlign ( self . hWnd , wndMgr . TEXT_VERTICAL_ALIGN_BOTTOM )
def SetVerticalAlignCenter ( self ):
wndMgr . SetVerticalAlign ( self . hWnd , wndMgr . TEXT_VERTICAL_ALIGN_CENTER )
def SetSecret ( self , Value = TRUE ):
wndMgr . SetSecret ( self . hWnd , Value )
def SetOutline ( self , Value = TRUE ):
wndMgr . SetOutline ( self . hWnd , Value )
def SetFeather ( self , value = TRUE ):
wndMgr . SetFeather ( self . hWnd , value )
def SetFontName ( self , fontName ):
wndMgr . SetFontName ( self . hWnd , fontName )
def SetDefaultFontName ( self ):
wndMgr . SetFontName ( self . hWnd , locale . UI_DEF_FONT )
def SetFontColor ( self , red , green , blue ):
wndMgr . SetFontColor ( self . hWnd , red , green , blue )
def SetPackedFontColor ( self , color ):
wndMgr . SetFontColor ( self . hWnd , color )
def SetText ( self , text ):
wndMgr . SetText ( self . hWnd , text )
def GetText ( self ):
return wndMgr . GetText ( self . hWnd )
def GetTextSize ( self ):
return wndMgr . GetTextSize ( self . hWnd )
class EmptyCandidateWindow ( Window ):
def __init__ ( self ):
Window . __init__ ( self )
def __del__ ( self ):
Window . __init__ ( self )
def Load ( self ):
pass
def SetCandidatePosition ( self , x , y , textCount ):
pass
def Clear ( self ):
pass
def Append ( self , text ):
pass
def Refresh ( self ):
pass
def Select ( self ):
pass
class EditLine ( TextLine ):
candidateWindowClassDict = {}
def __init__ ( self ):
TextLine . __init__ ( self )
self . eventReturn = Window . NoneMethod
self . eventEscape = Window . NoneMethod
self . eventTab = None
self . numberMode = FALSE
self . useIME = TRUE
self . bCodePage = FALSE
self . candidateWindowClass = None
self . candidateWindow = None
self . SetCodePage ( app . GetDefaultCodePage ())
self . readingWnd = ReadingWnd ()
self . readingWnd . Hide ()
def __del__ ( self ):
TextLine . __del__ ( self )
self . eventReturn = Window . NoneMethod
self . eventEscape = Window . NoneMethod
self . eventTab = None
def SetCodePage ( self , codePage ):
candidateWindowClass = EditLine . candidateWindowClassDict . get ( codePage , EmptyCandidateWindow )
self . __SetCandidateClass ( candidateWindowClass )
def __SetCandidateClass ( self , candidateWindowClass ):
if self . candidateWindowClass == candidateWindowClass :
return
self . candidateWindowClass = candidateWindowClass
self . candidateWindow = self . candidateWindowClass ()
self . candidateWindow . Load ()
self . candidateWindow . Hide ()
def RegisterWindow ( self , layer ):
self . hWnd = wndMgr . RegisterTextLine ( self , layer )
def SAFE_SetReturnEvent ( self , event ):
self . eventReturn = __mem_func__ ( event )
def SetReturnEvent ( self , event ):
self . eventReturn = event
def SetEscapeEvent ( self , event ):
self . eventEscape = event
def SetTabEvent ( self , event ):
self . eventTab = event
def SetMax ( self , max ):
self . max = max
wndMgr . SetMax ( self . hWnd , self . max )
ime . SetMax ( self . max )
self . SetUserMax ( self . max )
def SetUserMax ( self , max ):
self . userMax = max
ime . SetUserMax ( self . userMax )
def SetNumberMode ( self ):
self . numberMode = TRUE
#def AddExceptKey(self, key):
# ime.AddExceptKey(key)
#def ClearExceptKey(self):
# ime.ClearExceptKey()
def SetIMEFlag ( self , flag ):
self . useIME = flag
def SetText ( self , text ):
wndMgr . SetText ( self . hWnd , text )
if self . IsFocus ():
ime . SetText ( text )
def Enable ( self ):
wndMgr . ShowCursor ( self . hWnd )
def Disable ( self ):
wndMgr . HideCursor ( self . hWnd )
def SetEndPosition ( self ):
ime . MoveEnd ()
def OnSetFocus ( self ):
Text = self . GetText ()
ime . SetText ( Text )
ime . SetMax ( self . max )
ime . SetUserMax ( self . userMax )
ime . SetCursorPosition (- 1 )
if self . numberMode :
ime . SetNumberMode ()
else:
ime . SetStringMode ()
ime . EnableCaptureInput ()
if self . useIME :
ime . EnableIME ()
else:
ime . DisableIME ()
wndMgr . ShowCursor ( self . hWnd , TRUE )
def OnKillFocus ( self ):
self . SetText ( ime . GetText ( self . bCodePage ))
self . OnIMECloseCandidateList ()
self . OnIMECloseReadingWnd ()
ime . DisableIME ()
ime . DisableCaptureInput ()
wndMgr . HideCursor ( self . hWnd )
def OnIMEChangeCodePage ( self ):
self . SetCodePage ( ime . GetCodePage ())
def OnIMEOpenCandidateList ( self ):
self . candidateWindow . Show ()
self . candidateWindow . Clear ()
self . candidateWindow . Refresh ()
gx , gy = self . GetGlobalPosition ()
self . candidateWindow . SetCandidatePosition ( gx , gy , len ( self . GetText ()))
return TRUE
def OnIMECloseCandidateList ( self ):
self . candidateWindow . Hide ()
return TRUE
def OnIMEOpenReadingWnd ( self ):
gx , gy = self . GetGlobalPosition ()
textlen = len ( self . GetText ())- 2
reading = ime . GetReading ()
readinglen = len ( reading )
self . readingWnd . SetReadingPosition ( gx + textlen * 6 - 24 - readinglen * 6 , gy )
self . readingWnd . SetText ( reading )
if ime . GetReadingError () == 0 :
self . readingWnd . SetTextColor ( 0xffffffff )
else:
self . readingWnd . SetTextColor ( 0xffff0000 )
self . readingWnd . SetSize ( readinglen * 6 + 4 , 19 )
self . readingWnd . Show ()
return TRUE
def OnIMECloseReadingWnd ( self ):
self . readingWnd . Hide ()
return TRUE
def OnIMEUpdate ( self ):
snd . PlaySound ( "sound/ui/type.wav" )
TextLine . SetText ( self , ime . GetText ( self . bCodePage ))
def OnIMETab ( self ):
if self . eventTab :
self . eventTab ()
return TRUE
return FALSE
def OnIMEReturn ( self ):
snd . PlaySound ( "sound/ui/click.wav" )
self . eventReturn ()
return TRUE
def OnPressEscapeKey ( self ):
self . eventEscape ()
return TRUE
def OnKeyDown ( self , key ):
if app . DIK_F1 == key :
return FALSE
if app . DIK_F2 == key :
return FALSE
if app . DIK_F3 == key :
return FALSE
if app . DIK_F4 == key :
return FALSE
if app . DIK_LALT == key :
return FALSE
if app . DIK_SYSRQ == key :
return FALSE
if app . DIK_LCONTROL == key :
return FALSE
if app . DIK_V == key :
if app . IsPressed ( app . DIK_LCONTROL ):
ime . PasteTextFromClipBoard ()
return TRUE
def OnKeyUp ( self , key ):
if app . DIK_F1 == key :
return FALSE
if app . DIK_F2 == key :
return FALSE
if app . DIK_F3 == key :
return FALSE
if app . DIK_F4 == key :
return FALSE
if app . DIK_LALT == key :
return FALSE
if app . DIK_SYSRQ == key :
return FALSE
if app . DIK_LCONTROL == key :
return FALSE
return TRUE
def OnIMEKeyDown ( self , key ):
# Left
if app . VK_LEFT == key :
ime . MoveLeft ()
return TRUE
# Right
if app . VK_RIGHT == key :
ime . MoveRight ()
return TRUE
# Home
if app . VK_HOME == key :
ime . MoveHome ()
return TRUE
# End
if app . VK_END == key :
ime . MoveEnd ()
return TRUE
# Delete
if app . VK_DELETE == key :
ime . Delete ()
TextLine . SetText ( self , ime . GetText ( self . bCodePage ))
return TRUE
return TRUE
#def OnMouseLeftButtonDown(self):
# self.SetFocus()
def OnMouseLeftButtonDown ( self ):
if FALSE == self . IsIn ():
return FALSE
self . SetFocus ()
PixelPosition = wndMgr . GetCursorPosition ( self . hWnd )
ime . SetCursorPosition ( PixelPosition )
class MarkBox ( Window ):
def __init__ ( self , layer = "UI" ):
Window . __init__ ( self , layer )
def __del__ ( self ):
Window . __del__ ( self )
def RegisterWindow ( self , layer ):
self . hWnd = wndMgr . RegisterMarkBox ( self , layer )
def Load ( self ):
wndMgr . MarkBox_Load ( self . hWnd )
def SetScale ( self , scale ):
wndMgr . MarkBox_SetScale ( self . hWnd , scale )
def SetIndex ( self , guildID ):
MarkID = guild . GuildIDToMarkID ( guildID )
wndMgr . MarkBox_SetImageFilename ( self . hWnd , guild . GetMarkImageFilenameByMarkID ( MarkID ))
wndMgr . MarkBox_SetIndex ( self . hWnd , guild . GetMarkIndexByMarkID ( MarkID ))
def SetAlpha ( self , alpha ):
wndMgr . MarkBox_SetDiffuseColor ( self . hWnd , 1.0 , 1.0 , 1.0 , alpha )
class ImageBox ( Window ):
def __init__ ( self , layer = "UI" ):
Window . __init__ ( self , layer )
self . eventDict ={}
def __del__ ( self ):
Window . __del__ ( self )
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 OnMouseOverIn ( self ):
try:
self . eventDict [ "MOUSE_OVER_IN" ]()
except KeyError :
pass
def OnMouseOverOut ( self ):
try:
self . eventDict [ "MOUSE_OVER_OUT" ]()
except KeyError :
pass
def SAFE_SetStringEvent ( self , event , func ):
self . eventDict [ event ]= __mem_func__ ( func )
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 )
class AniImageBox ( Window ):
def __init__ ( self , layer = "UI" ):
Window . __init__ ( self , layer )
def __del__ ( self ):
Window . __del__ ( self )
def RegisterWindow ( self , layer ):
self . hWnd = wndMgr . RegisterAniImageBox ( self , layer )
def SetDelay ( self , delay ):
wndMgr . SetDelay ( self . hWnd , delay )
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
class Button ( Window ):
def __init__ ( self , layer = "UI" ):
Window . __init__ ( self , layer )
self . eventFunc = None
self . eventArgs = None
self . ButtonText = None
self . ToolTipText = None
def __del__ ( self ):
Window . __del__ ( self )
self . eventFunc = None
self . eventArgs = None
def RegisterWindow ( self , layer ):
self . hWnd = wndMgr . RegisterButton ( self , layer )
def SetUpVisual ( self , filename ):
wndMgr . SetUpVisual ( self . hWnd , filename )
def SetOverVisual ( self , filename ):
wndMgr . SetOverVisual ( self . hWnd , filename )
def SetDownVisual ( self , filename ):
wndMgr . SetDownVisual ( self . hWnd , filename )
def SetDisableVisual ( self , filename ):
wndMgr . SetDisableVisual ( self . hWnd , filename )
def GetUpVisualFileName ( self ):
return wndMgr . GetUpVisualFileName ( self . hWnd )
def GetOverVisualFileName ( self ):
return wndMgr . GetOverVisualFileName ( self . hWnd )
def GetDownVisualFileName ( self ):
return wndMgr . GetDownVisualFileName ( self . hWnd )
def Flash ( self ):
wndMgr . Flash ( self . hWnd )
def Enable ( self ):
wndMgr . Enable ( self . hWnd )
def Disable ( self ):
wndMgr . Disable ( self . hWnd )
def Down ( self ):
wndMgr . Down ( self . hWnd )
def SetUp ( self ):
wndMgr . SetUp ( self . hWnd )
def SAFE_SetEvent ( self , func , * args ):
self . eventFunc = __mem_func__ ( func )
self . eventArgs = args
def SetEvent ( self , func , * args ):
self . eventFunc = func
self . eventArgs = args
def SetTextColor ( self , color ):
if not self . ButtonText :
return
self . ButtonText . SetPackedFontColor ( color )
def SetText ( self , text , height = 4 ):
if not self . ButtonText :
textLine = TextLine ()
textLine . SetParent ( self )
textLine . SetPosition ( self . GetWidth ()/ 2 , self . GetHeight ()/ 2 )
textLine . SetVerticalAlignCenter ()
textLine . SetHorizontalAlignCenter ()
textLine . Show ()
self . ButtonText = textLine
self . ButtonText . SetText ( text )
def SetFormToolTipText ( self , type , text , x , y ):
if not self . ToolTipText :
toolTip = createToolTipWindowDict [ type ]()
toolTip . SetParent ( self )
toolTip . SetSize ( 0 , 0 )
toolTip . SetHorizontalAlignCenter ()
toolTip . SetOutline ()
toolTip . Hide ()
toolTip . SetPosition ( x + self . GetWidth ()/ 2 , y )
self . ToolTipText = toolTip
self . ToolTipText . SetText ( text )
def SetToolTipWindow ( self , toolTip ):
self . ToolTipText = toolTip
self . ToolTipText . SetParentProxy ( self )
def SetToolTipText ( self , text , x = 0 , y = - 19 ):
self . SetFormToolTipText ( "TEXT" , text , x , y )
def CallEvent ( self ):
snd . PlaySound ( "sound/ui/click.wav" )
if self . eventFunc :
apply ( self . eventFunc , self . eventArgs )
def ShowToolTip ( self ):
if self . ToolTipText :
self . ToolTipText . Show ()
def HideToolTip ( self ):
if self . ToolTipText :
self . ToolTipText . Hide ()
class RadioButton ( Button ):
def __init__ ( self ):
Button . __init__ ( self )
def __del__ ( self ):
Button . __del__ ( self )
def RegisterWindow ( self , layer ):
self . hWnd = wndMgr . RegisterRadioButton ( self , layer )
class ToggleButton ( Button ):
def __init__ ( self ):
Button . __init__ ( self )
self . eventUp = None
self . eventDown = None
def __del__ ( self ):
Button . __del__ ( self )
self . eventUp = None
self . eventDown = None
def SetToggleUpEvent ( self , event ):
self . eventUp = event
def SetToggleDownEvent ( self , event ):
self . eventDown = event
def RegisterWindow ( self , layer ):
self . hWnd = wndMgr . RegisterToggleButton ( self , layer )
def OnToggleUp ( self ):
if self . eventUp :
self . eventUp ()
def OnToggleDown ( self ):
if self . eventDown :
self . eventDown ()
class DragButton ( Button ):
def __init__ ( self ):
Button . __init__ ( self )
self . AddFlag ( "movable" )
self . callbackEnable = TRUE
self . eventMove = lambda : None
def __del__ ( self ):
Button . __del__ ( self )
self . eventMove = lambda : None
def RegisterWindow ( self , layer ):
self . hWnd = wndMgr . RegisterDragButton ( self , layer )
def SetMoveEvent ( self , event ):
self . eventMove = event
def SetRestrictMovementArea ( self , x , y , width , height ):
wndMgr . SetRestrictMovementArea ( self . hWnd , x , y , width , height )
def TurnOnCallBack ( self ):
self . callbackEnable = TRUE
def TurnOffCallBack ( self ):
self . callbackEnable = FALSE
def OnMove ( self ):
if self . callbackEnable :
self . eventMove ()
class NumberLine ( Window ):
def __init__ ( self , layer = "UI" ):
Window . __init__ ( self , layer )
def __del__ ( self ):
Window . __del__ ( self )
def RegisterWindow ( self , layer ):
self . hWnd = wndMgr . RegisterNumberLine ( self , layer )
def SetHorizontalAlignCenter ( self ):
wndMgr . SetNumberHorizontalAlignCenter ( self . hWnd )
def SetHorizontalAlignRight ( self ):
wndMgr . SetNumberHorizontalAlignRight ( self . hWnd )
def SetPath ( self , path ):
wndMgr . SetPath ( self . hWnd , path )
def SetNumber ( self , number ):
wndMgr . SetNumber ( self . hWnd , number )
###################################################################################################
## PythonScript Element
###################################################################################################
class Box ( Window ):
def RegisterWindow ( self , layer ):
self . hWnd = wndMgr . RegisterBox ( self , layer )
def SetColor ( self , color ):
wndMgr . SetColor ( self . hWnd , color )
class Bar ( Window ):
def RegisterWindow ( self , layer ):
self . hWnd = wndMgr . RegisterBar ( self , layer )
def SetColor ( self , color ):
wndMgr . SetColor ( self . hWnd , color )
class Line ( Window ):
def RegisterWindow ( self , layer ):
self . hWnd = wndMgr . RegisterLine ( self , layer )
def SetColor ( self , color ):
wndMgr . SetColor ( self . hWnd , color )
class SlotBar ( Window ):
def __init__ ( self ):
Window . __init__ ( self )
def RegisterWindow ( self , layer ):
self . hWnd = wndMgr . RegisterBar3D ( self , layer )
## Same with SlotBar
class Bar3D ( Window ):
def __init__ ( self ):
Window . __init__ ( self )
def RegisterWindow ( self , layer ):
self . hWnd = wndMgr . RegisterBar3D ( self , layer )
def SetColor ( self , left , right , center ):
wndMgr . SetColor ( self . hWnd , left , right , center )
class SlotWindow ( Window ):
def __init__ ( self ):
Window . __init__ ( self )
self . StartIndex = 0
self . eventSelectEmptySlot = None
self . eventSelectItemSlot = None
self . eventUnselectEmptySlot = None
self . eventUnselectItemSlot = None
self . eventUseSlot = None
self . eventOverInItem = None
self . eventOverOutItem = None
self . eventPressedSlotButton = None
def __del__ ( self ):
Window . __del__ ( self )
self . eventSelectEmptySlot = None
self . eventSelectItemSlot = None
self . eventUnselectEmptySlot = None
self . eventUnselectItemSlot = None
self . eventUseSlot = None
self . eventOverInItem = None
self . eventOverOutItem = None
self . eventPressedSlotButton = None
def RegisterWindow ( self , layer ):
self . hWnd = wndMgr . RegisterSlotWindow ( self , layer )
def SetSlotStyle ( self , style ):
wndMgr . SetSlotStyle ( self . hWnd , style )
def HasSlot ( self , slotIndex ):
return wndMgr . HasSlot ( self . hWnd , slotIndex )
def SetSlotBaseImage ( self , imageFileName , r , g , b , a ):
wndMgr . SetSlotBaseImage ( self . hWnd , imageFileName , r , g , b , a )
def SetCoverButton ( self ,\
slotIndex ,\
upName = "d:/ymir work/ui/public/slot_cover_button_01.sub" ,\
overName = "d:/ymir work/ui/public/slot_cover_button_02.sub" ,\
downName = "d:/ymir work/ui/public/slot_cover_button_03.sub" ,\
disableName = "d:/ymir work/ui/public/slot_cover_button_04.sub" ,\
LeftButtonEnable = FALSE ,\
RightButtonEnable = TRUE ):
wndMgr . SetCoverButton ( self . hWnd , slotIndex , upName , overName , downName , disableName , LeftButtonEnable , RightButtonEnable )
def EnableCoverButton ( self , slotIndex ):
wndMgr . EnableCoverButton ( self . hWnd , slotIndex )
def DisableCoverButton ( self , slotIndex ):
wndMgr . DisableCoverButton ( self . hWnd , slotIndex )
def AppendSlotButton ( self , upName , overName , downName ):
wndMgr . AppendSlotButton ( self . hWnd , upName , overName , downName )
def ShowSlotButton ( self , slotNumber ):
wndMgr . ShowSlotButton ( self . hWnd , slotNumber )
def HideAllSlotButton ( self ):
wndMgr . HideAllSlotButton ( self . hWnd )
def AppendRequirementSignImage ( self , filename ):
wndMgr . AppendRequirementSignImage ( self . hWnd , filename )
def ShowRequirementSign ( self , slotNumber ):
wndMgr . ShowRequirementSign ( self . hWnd , slotNumber )
def HideRequirementSign ( self , slotNumber ):
wndMgr . HideRequirementSign ( self . hWnd , slotNumber )
def ActivateSlot ( self , slotNumber ):
wndMgr . ActivateSlot ( self . hWnd , slotNumber )
def DeactivateSlot ( self , slotNumber ):
wndMgr . DeactivateSlot ( self . hWnd , slotNumber )
def ShowSlotBaseImage ( self , slotNumber ):
wndMgr . ShowSlotBaseImage ( self . hWnd , slotNumber )
def HideSlotBaseImage ( self , slotNumber ):
wndMgr . HideSlotBaseImage ( self . hWnd , slotNumber )
def SAFE_SetButtonEvent ( self , button , state , event ):
if "LEFT" == button :
if "EMPTY" == state :
self . eventSelectEmptySlot = __mem_func__ ( event )
elif "EXIST" == state :
self . eventSelectItemSlot = __mem_func__ ( event )
elif "ALWAYS" == state :
self . eventSelectEmptySlot = __mem_func__ ( event )
self . eventSelectItemSlot = __mem_func__ ( event )
elif "RIGHT" == button :
if "EMPTY" == state :
self . eventUnselectEmptySlot = __mem_func__ ( event )
elif "EXIST" == state :
self . eventUnselectItemSlot = __mem_func__ ( event )
elif "ALWAYS" == state :
self . eventUnselectEmptySlot = __mem_func__ ( event )
self . eventUnselectItemSlot = __mem_func__ ( event )
def SetSelectEmptySlotEvent ( self , empty):
self . eventSelectEmptySlot = empty
def SetSelectItemSlotEvent ( self , item ):
self . eventSelectItemSlot = item
def SetUnselectEmptySlotEvent ( self , empty):
self . eventUnselectEmptySlot = empty
def SetUnselectItemSlotEvent ( self , item ):
self . eventUnselectItemSlot = item
def SetUseSlotEvent ( self , use):
self . eventUseSlot = use
def SetOverInItemEvent ( self , event ):
self . eventOverInItem = event
def SetOverOutItemEvent ( self , event ):
self . eventOverOutItem = event
def SetPressedSlotButtonEvent ( self , event ):
self . eventPressedSlotButton = event
def GetSlotCount ( self ):
return wndMgr . GetSlotCount ( self . hWnd )
def SetUseMode ( self , flag ):
"TRUE일때만 ItemToItem 이 가능한지 보여준다"
wndMgr . SetUseMode ( self . hWnd , flag )
def SetUsableItem ( self , flag ):
"TRUE면 현재 가리킨 아이템이 ItemToItem 적용 가능하다"
wndMgr . SetUsableItem ( self . hWnd , flag )
## Slot
def SetSlotCoolTime ( self , slotIndex , coolTime , elapsedTime = 0.0 ):
wndMgr . SetSlotCoolTime ( self . hWnd , slotIndex , coolTime , elapsedTime )
def LockSlot ( self , slotIndex ):
wndMgr . LockSlot ( self . hWnd , slotIndex )
def UnlockSlot ( self , slotIndex ):
wndMgr . UnlockSlot ( self . hWnd , slotIndex )
def RefreshSlot ( self ):
wndMgr . RefreshSlot ( self . hWnd )
def ClearSlot ( self , slotNumber ):
wndMgr . ClearSlot ( self . hWnd , slotNumber )
def ClearAllSlot ( self ):
wndMgr . ClearAllSlot ( self . hWnd )
def AppendSlot ( self , index , x , y , width , height ):
wndMgr . AppendSlot ( self . hWnd , index , x , y , width , height )
def SetSlot ( self , slotIndex , itemIndex , width , height , icon ):
wndMgr . SetSlot ( self . hWnd , slotIndex , itemIndex , width , height , icon )
def SetSlotCount ( self , slotNumber , count ):
wndMgr . SetSlotCount ( self . hWnd , slotNumber , count )
def SetSlotCountNew ( self , slotNumber , grade , count ):
wndMgr . SetSlotCountNew ( self . hWnd , slotNumber , grade , count )
def SetItemSlot ( self , renderingSlotNumber , ItemIndex , ItemCount = 0 ):
if 0 == ItemIndex or None == ItemIndex :
wndMgr . ClearSlot ( self . hWnd , renderingSlotNumber )
return
item . SelectItem ( ItemIndex )
itemIcon = item . GetIconImage ()
item . SelectItem ( ItemIndex )
( width , height ) = item . GetItemSize ()
wndMgr . SetSlot ( self . hWnd , renderingSlotNumber , ItemIndex , width , height , itemIcon )
wndMgr . SetSlotCount ( self . hWnd , renderingSlotNumber , ItemCount )
def SetSkillSlot ( self , renderingSlotNumber , skillIndex , skillLevel ):
skillIcon = skill . GetIconImage ( skillIndex )
if 0 == skillIcon :
wndMgr . ClearSlot ( self . hWnd , renderingSlotNumber )
return
wndMgr . SetSlot ( self . hWnd , renderingSlotNumber , skillIndex , 1 , 1 , skillIcon )
wndMgr . SetSlotCount ( self . hWnd , renderingSlotNumber , skillLevel )
def SetSkillSlotNew ( self , renderingSlotNumber , skillIndex , skillGrade , skillLevel ):
skillIcon = skill . GetIconImageNew ( skillIndex , skillGrade )
if 0 == skillIcon :
wndMgr . ClearSlot ( self . hWnd , renderingSlotNumber )
return
wndMgr . SetSlot ( self . hWnd , renderingSlotNumber , skillIndex , 1 , 1 , skillIcon )
def SetEmotionSlot ( self , renderingSlotNumber , emotionIndex ):
import player
icon = player . GetEmotionIconImage ( emotionIndex )
if 0 == icon :
wndMgr . ClearSlot ( self . hWnd , renderingSlotNumber )
return
wndMgr . SetSlot ( self . hWnd , renderingSlotNumber , emotionIndex , 1 , 1 , icon )
## Event
def OnSelectEmptySlot ( self , slotNumber ):
if self . eventSelectEmptySlot :
self . eventSelectEmptySlot ( slotNumber )
def OnSelectItemSlot ( self , slotNumber ):
if self . eventSelectItemSlot :
self . eventSelectItemSlot ( slotNumber )
def OnUnselectEmptySlot ( self , slotNumber ):
if self . eventUnselectEmptySlot :
self . eventUnselectEmptySlot ( slotNumber )
def OnUnselectItemSlot ( self , slotNumber ):
if self . eventUnselectItemSlot :
self . eventUnselectItemSlot ( slotNumber )
def OnUseSlot ( self , slotNumber ):
if self . eventUseSlot :
self . eventUseSlot ( slotNumber )
def OnOverInItem ( self , slotNumber ):
if self . eventOverInItem :
self . eventOverInItem ( slotNumber )
def OnOverOutItem ( self ):
if self . eventOverOutItem :
self . eventOverOutItem ()
def OnPressedSlotButton ( self , slotNumber ):
if self . eventPressedSlotButton :
self . eventPressedSlotButton ( slotNumber )
def GetStartIndex ( self ):
return 0
class GridSlotWindow ( SlotWindow ):
def __init__ ( self ):
SlotWindow . __init__ ( self )
self . startIndex = 0
def __del__ ( self ):
SlotWindow . __del__ ( self )
def RegisterWindow ( self , layer ):
self . hWnd = wndMgr . RegisterGridSlotWindow ( self , layer )
def ArrangeSlot ( self , StartIndex , xCount , yCount , xSize , ySize , xBlank , yBlank ):
self . startIndex = StartIndex
wndMgr . ArrangeSlot ( self . hWnd , StartIndex , xCount , yCount , xSize , ySize , xBlank , yBlank )
self . startIndex = StartIndex
def GetStartIndex ( self ):
return self . startIndex
class TitleBar ( Window ):
BLOCK_WIDTH = 32
BLOCK_HEIGHT = 23
def __init__ ( self ):
Window . __init__ ( self )
self . AddFlag ( "attach" )
def __del__ ( self ):
Window . __del__ ( self )
def MakeTitleBar ( self , width , color ):
## 현재 Color는 사용하고 있지 않음
width = max ( 64 , width )
imgLeft = ImageBox ()
imgCenter = ExpandedImageBox ()
imgRight = ImageBox ()
imgLeft . AddFlag ( "not_pick" )
imgCenter . AddFlag ( "not_pick" )
imgRight . AddFlag ( "not_pick" )
imgLeft . SetParent ( self )
imgCenter . SetParent ( self )
imgRight . SetParent ( self )
imgLeft . LoadImage ( "d:/ymir work/ui/pattern/titlebar_left.tga" )
imgCenter . LoadImage ( "d:/ymir work/ui/pattern/titlebar_center.tga" )
imgRight . LoadImage ( "d:/ymir work/ui/pattern/titlebar_right.tga" )
imgLeft . Show ()
imgCenter . Show ()
imgRight . Show ()
btnClose = Button ()
btnClose . SetParent ( self )
btnClose . SetUpVisual ( "d:/ymir work/ui/public/close_button_01.sub" )
btnClose . SetOverVisual ( "d:/ymir work/ui/public/close_button_02.sub" )
btnClose . SetDownVisual ( "d:/ymir work/ui/public/close_button_03.sub" )
btnClose . SetToolTipText ( locale . UI_CLOSE , 0 , - 23 )
btnClose . Show ()
self . imgLeft = imgLeft
self . imgCenter = imgCenter
self . imgRight = imgRight
self . btnClose = btnClose
self . SetWidth ( width )
def SetWidth ( self , width ):
self . imgCenter . SetRenderingRect ( 0.0 , 0.0 , float (( width - self . BLOCK_WIDTH * 2 ) - self . BLOCK_WIDTH ) / self . BLOCK_WIDTH , 0.0 )
self . imgCenter . SetPosition ( self . BLOCK_WIDTH , 0 )
self . imgRight . SetPosition ( width - self . BLOCK_WIDTH , 0 )
self . btnClose . SetPosition ( width - self . btnClose . GetWidth () - 3 , 3 )
self . SetSize ( width , self . BLOCK_HEIGHT )
def SetCloseEvent ( self , event ):
self . btnClose . SetEvent ( event )
class HorizontalBar ( Window ):
BLOCK_WIDTH = 32
BLOCK_HEIGHT = 17
def __init__ ( self ):
Window . __init__ ( self )
self . AddFlag ( "attach" )
def __del__ ( self ):
Window . __del__ ( self )
def Create ( self , width ):
width = max ( 96 , width )
imgLeft = ImageBox ()
imgLeft . SetParent ( self )
imgLeft . AddFlag ( "not_pick" )
imgLeft . LoadImage ( "d:/ymir work/ui/pattern/horizontalbar_left.tga" )
imgLeft . Show ()
imgCenter = ExpandedImageBox ()
imgCenter . SetParent ( self )
imgCenter . AddFlag ( "not_pick" )
imgCenter . LoadImage ( "d:/ymir work/ui/pattern/horizontalbar_center.tga" )
imgCenter . Show ()
imgRight = ImageBox ()
imgRight . SetParent ( self )
imgRight . AddFlag ( "not_pick" )
imgRight . LoadImage ( "d:/ymir work/ui/pattern/horizontalbar_right.tga" )
imgRight . Show ()
self . imgLeft = imgLeft
self . imgCenter = imgCenter
self . imgRight = imgRight
self . SetWidth ( width )
def SetWidth ( self , width ):
self . imgCenter . SetRenderingRect ( 0.0 , 0.0 , float (( width - self . BLOCK_WIDTH * 2 ) - self . BLOCK_WIDTH ) / self . BLOCK_WIDTH , 0.0 )
self . imgCenter . SetPosition ( self . BLOCK_WIDTH , 0 )
self . imgRight . SetPosition ( width - self . BLOCK_WIDTH , 0 )
self . SetSize ( width , self . BLOCK_HEIGHT )
class Gauge ( Window ):
SLOT_WIDTH = 16
SLOT_HEIGHT = 7
GAUGE_TEMPORARY_PLACE = 12
GAUGE_WIDTH = 16
def __init__ ( self ):
Window . __init__ ( self )
self . width = 0
def __del__ ( self ):
Window . __del__ ( self )
def MakeGauge ( self , width , color ):
self . width = max ( 48 , width )
imgSlotLeft = ImageBox ()
imgSlotLeft . SetParent ( self )
imgSlotLeft . LoadImage ( "d:/ymir work/ui/pattern/gauge_slot_left.tga" )
imgSlotLeft . Show ()
imgSlotRight = ImageBox ()
imgSlotRight . SetParent ( self )
imgSlotRight . LoadImage ( "d:/ymir work/ui/pattern/gauge_slot_right.tga" )
imgSlotRight . Show ()
imgSlotRight . SetPosition ( width - self . SLOT_WIDTH , 0 )
imgSlotCenter = ExpandedImageBox ()
imgSlotCenter . SetParent ( self )
imgSlotCenter . LoadImage ( "d:/ymir work/ui/pattern/gauge_slot_center.tga" )
imgSlotCenter . Show ()
imgSlotCenter . SetRenderingRect ( 0.0 , 0.0 , float (( width - self . SLOT_WIDTH * 2 ) - self . SLOT_WIDTH ) / self . SLOT_WIDTH , 0.0 )
imgSlotCenter . SetPosition ( self . SLOT_WIDTH , 0 )
imgGauge = ExpandedImageBox ()
imgGauge . SetParent ( self )
imgGauge . LoadImage ( "d:/ymir work/ui/pattern/gauge_" + color + ".tga" )
imgGauge . Show ()
imgGauge . SetRenderingRect ( 0.0 , 0.0 , 0.0 , 0.0 )
imgGauge . SetPosition ( self . GAUGE_TEMPORARY_PLACE , 0 )
imgSlotLeft . AddFlag ( "attach" )
imgSlotCenter . AddFlag ( "attach" )
imgSlotRight . AddFlag ( "attach" )
self . imgLeft = imgSlotLeft
self . imgCenter = imgSlotCenter
self . imgRight = imgSlotRight
self . imgGauge = imgGauge
self . SetSize ( width , self . SLOT_HEIGHT )
def SetPercentage ( self , curValue , maxValue ):
# PERCENTAGE_MAX_VALUE_ZERO_DIVISION_ERROR
if maxValue > 0.0 :
percentage = min ( 1.0 , float ( curValue )/ float ( maxValue ))
else:
percentage = 0.0
# END_OF_PERCENTAGE_MAX_VALUE_ZERO_DIVISION_ERROR
gaugeSize = - 1.0 + float ( self . width - self . GAUGE_TEMPORARY_PLACE * 2 ) * percentage / self . GAUGE_WIDTH
self . imgGauge . SetRenderingRect ( 0.0 , 0.0 , gaugeSize , 0.0 )
class Board ( Window ):
CORNER_WIDTH = 32
CORNER_HEIGHT = 32
LINE_WIDTH = 128
LINE_HEIGHT = 128
LT = 0
LB = 1
RT = 2
RB = 3
L = 0
R = 1
T = 2
B = 3
def __init__ ( self ):
Window . __init__ ( self )
self . MakeBoard ( "d:/ymir work/ui/pattern/Board_Corner_" , "d:/ymir work/ui/pattern/Board_Line_" )
self . MakeBase ()
def MakeBoard ( self , cornerPath , linePath ):
CornerFileNames = [ cornerPath + dir + ".tga" for dir in ( "LeftTop" , "LeftBottom" , "RightTop" , "RightBottom" , ) ]
LineFileNames = [ linePath + dir + ".tga" for dir in ( "Left" , "Right" , "Top" , "Bottom" , ) ]
"""
CornerFileNames = (
" d :/ ymir work / ui / pattern / Board_Corner_LeftTop . tga ",
" d :/ ymir work / ui / pattern / Board_Corner_LeftBottom . tga ",
" d :/ ymir work / ui / pattern / Board_Corner_RightTop . tga ",
" d :/ ymir work / ui / pattern / Board_Corner_RightBottom . tga ",
)
LineFileNames = (
" d :/ ymir work / ui / pattern / Board_Line_Left . tga ",
" d :/ ymir work / ui / pattern / Board_Line_Right . tga ",
" d :/ ymir work / ui / pattern / Board_Line_Top . tga ",
" d :/ ymir work / ui / pattern / Board_Line_Bottom . tga ",
)
"""
self . Corners = []
for fileName in CornerFileNames :
Corner = ExpandedImageBox ()
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 ( "not_pick" )
Line . LoadImage ( fileName )
Line . SetParent ( self )
Line . SetPosition ( 0 , 0 )
Line . Show ()
self . Lines . append ( Line )
self . Lines [ self . L ]. SetPosition ( 0 , self . CORNER_HEIGHT )
self . Lines [ self . T ]. SetPosition ( self . CORNER_WIDTH , 0 )
def MakeBase ( self ):
self . Base = ExpandedImageBox ()
self . Base . AddFlag ( "not_pick" )
self . Base . LoadImage ( "d:/ymir work/ui/pattern/Board_Base.tga" )
self . Base . SetParent ( self )
self . Base . SetPosition ( self . CORNER_WIDTH , self . CORNER_HEIGHT )
self . Base . Show ()
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 :
self . Base . SetRenderingRect ( 0 , 0 , horizontalShowingPercentage , verticalShowingPercentage )
class BoardWithTitleBar ( Board ):
def __init__ ( self ):
Board . __init__ ( self )
titleBar = TitleBar ()
titleBar . SetParent ( self )
titleBar . MakeTitleBar ( 0 , "red" )
titleBar . SetPosition ( 8 , 7 )
titleBar . Show ()
titleName = TextLine ()
titleName . SetParent ( titleBar )
titleName . SetPosition ( 0 , 4 )
titleName . SetWindowHorizontalAlignCenter ()
titleName . SetHorizontalAlignCenter ()
titleName . Show ()
self . titleBar = titleBar
self . titleName = titleName
self . SetCloseEvent ( self . Hide )
def __del__ ( self ):
Board . __del__ ( self )
self . titleBar = None
self . titleName = None
def SetSize ( self , width , height ):
self . titleBar . SetWidth ( width - 15 )
#self.pickRestrictWindow.SetSize(width, height - 30)
Board . SetSize ( self , width , height )
self . titleName . UpdateRect ()
def SetTitleColor ( self , color ):
self . titleName . SetPackedFontColor ( color )
def SetTitleName ( self , name ):
self . titleName . SetText ( name )
def SetCloseEvent ( self , event ):
self . titleBar . SetCloseEvent ( event )
class ThinBoard ( Window ):
CORNER_WIDTH = 16
CORNER_HEIGHT = 16
LINE_WIDTH = 16
LINE_HEIGHT = 16
BOARD_COLOR = grp . GenerateColor ( 0.0 , 0.0 , 0.0 , 0.51 )
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/ThinBoard_Corner_" + dir + ".tga" for dir in [ "LeftTop" , "LeftBottom" , "RightTop" , "RightBottom" ] ]
LineFileNames = [ "d:/ymir work/ui/pattern/ThinBoard_Line_" + dir + ".tga" 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 = Bar ()
Base . SetParent ( self )
Base . AddFlag ( "attach" )
Base . AddFlag ( "not_pick" )
Base . SetPosition ( self . CORNER_WIDTH , self . CORNER_HEIGHT )
Base . SetColor ( self . BOARD_COLOR )
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 )
self . Base . SetSize ( width - self . CORNER_WIDTH * 2 , height - self . CORNER_HEIGHT * 2 )
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 ()
class ScrollBar ( Window ):
SCROLLBAR_WIDTH = 17
SCROLLBAR_MIDDLE_HEIGHT = 9
SCROLLBAR_BUTTON_WIDTH = 17
SCROLLBAR_BUTTON_HEIGHT = 17
MIDDLE_BAR_POS = 5
MIDDLE_BAR_UPPER_PLACE = 3
MIDDLE_BAR_DOWNER_PLACE = 4
TEMP_SPACE = MIDDLE_BAR_UPPER_PLACE + MIDDLE_BAR_DOWNER_PLACE
class MiddleBar ( DragButton ):
def __init__ ( self ):
DragButton . __init__ ( self )
self . AddFlag ( "movable" )
#self.AddFlag("restrict_x")
def MakeImage ( self ):
top = ImageBox ()
top . SetParent ( self )
top . LoadImage ( "d:/ymir work/ui/pattern/ScrollBar_Top.tga" )
top . SetPosition ( 0 , 0 )
top . AddFlag ( "not_pick" )
top . Show ()
bottom = ImageBox ()
bottom . SetParent ( self )
bottom . LoadImage ( "d:/ymir work/ui/pattern/ScrollBar_Bottom.tga" )
bottom . AddFlag ( "not_pick" )
bottom . Show ()
middle = ExpandedImageBox ()
middle . SetParent ( self )
middle . LoadImage ( "d:/ymir work/ui/pattern/ScrollBar_Middle.tga" )
middle . SetPosition ( 0 , 4 )
middle . AddFlag ( "not_pick" )
middle . Show ()
self . top = top
self . bottom = bottom
self . middle = middle
def SetSize ( self , height ):
height = max ( 12 , height )
DragButton . SetSize ( self , 10 , height )
self . bottom . SetPosition ( 0 , height - 4 )
height -= 4 * 3
self . middle . SetRenderingRect ( 0 , 0 , 0 , float ( height )/ 4.0 )
def __init__ ( self ):
Window . __init__ ( self )
self . pageSize = 1
self . curPos = 0.0
self . eventScroll = lambda * arg : None
self . eventScrollUp = lambda * arg : None
self . eventScrollDown = lambda * arg : None
self . lockFlag = FALSE
self . CreateScrollBar ()
def __del__ ( self ):
Window . __del__ ( self )
def CreateScrollBar ( self ):
barSlot = Bar3D ()
barSlot . SetParent ( self )
barSlot . AddFlag ( "not_pick" )
barSlot . Show ()
middleBar = self . MiddleBar ()
middleBar . SetParent ( self )
middleBar . SetMoveEvent ( __mem_func__ ( self . OnMove ))
middleBar . Show ()
middleBar . MakeImage ()
middleBar . SetSize ( 12 )
upButton = Button ()
upButton . SetParent ( self )
upButton . SetEvent ( __mem_func__ ( self . OnUp ))
upButton . SetUpVisual ( "d:/ymir work/ui/public/scrollbar_up_button_01.sub" )
upButton . SetOverVisual ( "d:/ymir work/ui/public/scrollbar_up_button_02.sub" )
upButton . SetDownVisual ( "d:/ymir work/ui/public/scrollbar_up_button_03.sub" )
upButton . Show ()
downButton = Button ()
downButton . SetParent ( self )
downButton . SetEvent ( __mem_func__ ( self . OnDown ))
downButton . SetUpVisual ( "d:/ymir work/ui/public/scrollbar_down_button_01.sub" )
downButton . SetOverVisual ( "d:/ymir work/ui/public/scrollbar_down_button_02.sub" )
downButton . SetDownVisual ( "d:/ymir work/ui/public/scrollbar_down_button_03.sub" )
downButton . Show ()
self . upButton = upButton
self . downButton = downButton
self . middleBar = middleBar
self . barSlot = barSlot
self . SCROLLBAR_WIDTH = self . upButton . GetWidth ()
self . SCROLLBAR_MIDDLE_HEIGHT = self . middleBar . GetHeight ()
self . SCROLLBAR_BUTTON_WIDTH = self . upButton . GetWidth ()
self . SCROLLBAR_BUTTON_HEIGHT = self . upButton . GetHeight ()
def Destroy ( self ):
self . middleBar = None
self . upButton = None
self . downButton = None
self . eventScroll = lambda * arg : None
self . eventScrollUp = lambda * arg : None
self . eventScrollDown = lambda * arg : None
def SetScrollEvent ( self , event ):
self . eventScroll = event
self . eventScrollUp = event
self . eventScrollDown = event
def SetUpEvent ( self , event ):
self . eventScrollUp = event
def SetDownEvent ( self , event ):
self . eventScrollDown = event
def SetMiddleBarSize ( self , pageScale ):
realHeight = self . GetHeight () - self . SCROLLBAR_BUTTON_HEIGHT * 2
self . SCROLLBAR_MIDDLE_HEIGHT = int ( pageScale * float ( realHeight ))
self . middleBar . SetSize ( self . SCROLLBAR_MIDDLE_HEIGHT )
self . pageSize = ( self . GetHeight () - self . SCROLLBAR_BUTTON_HEIGHT * 2 ) - self . SCROLLBAR_MIDDLE_HEIGHT - ( self . TEMP_SPACE )
def SetScrollBarSize ( self , height ):
self . pageSize = ( height - self . SCROLLBAR_BUTTON_HEIGHT * 2 ) - self . SCROLLBAR_MIDDLE_HEIGHT - ( self . TEMP_SPACE )
self . SetSize ( self . SCROLLBAR_WIDTH , height )
self . upButton . SetPosition ( 0 , 0 )
self . downButton . SetPosition ( 0 , height - self . SCROLLBAR_BUTTON_HEIGHT )
self . middleBar . SetRestrictMovementArea ( self . MIDDLE_BAR_POS , self . SCROLLBAR_BUTTON_HEIGHT + self . MIDDLE_BAR_UPPER_PLACE , self . MIDDLE_BAR_POS + 2 , height - self . SCROLLBAR_BUTTON_HEIGHT * 2 - self . TEMP_SPACE )
self . middleBar . SetPosition ( self . MIDDLE_BAR_POS , 0 )
self . UpdateBarSlot ()
def UpdateBarSlot ( self ):
self . barSlot . SetPosition ( 0 , self . SCROLLBAR_BUTTON_HEIGHT )
self . barSlot . SetSize ( self . GetWidth () - 2 , self . GetHeight () - self . SCROLLBAR_BUTTON_HEIGHT * 2 - 2 )
def GetPos ( self ):
return self . curPos
def SetPos ( self , pos , event = TRUE ):
pos = max ( 0.0 , pos )
pos = min ( 1.0 , pos )
newPos = float ( self . pageSize ) * pos
self . middleBar . SetPosition ( self . MIDDLE_BAR_POS , int ( newPos ) + self . SCROLLBAR_BUTTON_HEIGHT + self . MIDDLE_BAR_UPPER_PLACE )
self . OnMove ( event )
def SetScrollStep ( self , step ):
self . scrollStep = step
def OnUp ( self ):
self . SetPos ( self . curPos - self . scrollStep , FALSE )
self . eventScrollUp ()
def OnDown ( self ):
self . SetPos ( self . curPos + self . scrollStep , FALSE )
self . eventScrollDown (
def OnMove ( self , event = TRUE ):
if self . lockFlag :
return
if 0 == self . pageSize :
return
( xLocal , yLocal ) = self . middleBar . GetLocalPosition ()
self . curPos = float ( yLocal - self . SCROLLBAR_BUTTON_HEIGHT - self . MIDDLE_BAR_UPPER_PLACE ) / float ( self . pageSize )
if event == TRUE :
self . eventScroll ()
def OnMouseLeftButtonDown ( self ):
( xMouseLocalPosition , yMouseLocalPosition ) = self . GetMouseLocalPosition ()
pickedPos = yMouseLocalPosition - self . SCROLLBAR_BUTTON_HEIGHT - self . SCROLLBAR_MIDDLE_HEIGHT / 2
newPos = float ( pickedPos ) / float ( self . pageSize )
self . SetPos ( newPos )
def LockScroll ( self ):
self . lockFlag = TRUE
def UnlockScroll ( self ):
self . lockFlag = FALSE
class ThinScrollBar ( ScrollBar ):
def CreateScrollBar ( self ):
middleBar = self . MiddleBar ()
middleBar . SetParent ( self )
middleBar . SetMoveEvent ( __mem_func__ ( self . OnMove ))
middleBar . Show ()
middleBar . SetUpVisual ( "d:/ymir work/ui/public/scrollbar_thin_middle_button_01.sub" )
middleBar . SetOverVisual ( "d:/ymir work/ui/public/scrollbar_thin_middle_button_02.sub" )
middleBar . SetDownVisual ( "d:/ymir work/ui/public/scrollbar_thin_middle_button_03.sub" )
upButton = Button ()
upButton . SetParent ( self )
upButton . SetUpVisual ( "d:/ymir work/ui/public/scrollbar_thin_up_button_01.sub" )
upButton . SetOverVisual ( "d:/ymir work/ui/public/scrollbar_thin_up_button_02.sub" )
upButton . SetDownVisual ( "d:/ymir work/ui/public/scrollbar_thin_up_button_03.sub" )
upButton . SetEvent ( __mem_func__ ( self . OnUp ))
upButton . Show ()
downButton = Button ()
downButton . SetParent ( self )
downButton . SetUpVisual ( "d:/ymir work/ui/public/scrollbar_thin_down_button_01.sub" )
downButton . SetOverVisual ( "d:/ymir work/ui/public/scrollbar_thin_down_button_02.sub" )
downButton . SetDownVisual ( "d:/ymir work/ui/public/scrollbar_thin_down_button_03.sub" )
downButton . SetEvent ( __mem_func__ ( self . OnDown ))
downButton . Show ()
self . middleBar = middleBar
self . upButton = upButton
self . downButton = downButton
self . SCROLLBAR_WIDTH = self . upButton . GetWidth ()
self . SCROLLBAR_MIDDLE_HEIGHT = self . middleBar . GetHeight ()
self . SCROLLBAR_BUTTON_WIDTH = self . upButton . GetWidth ()
self . SCROLLBAR_BUTTON_HEIGHT = self . upButton . GetHeight ()
self . MIDDLE_BAR_POS = 0
self . MIDDLE_BAR_UPPER_PLACE = 0
self . MIDDLE_BAR_DOWNER_PLACE = 0
self . TEMP_SPACE = 0
def UpdateBarSlot ( self ):
pass
class SmallThinScrollBar ( ScrollBar ):
def CreateScrollBar ( self ):
middleBar = self . MiddleBar ()
middleBar . SetParent ( self )
middleBar . SetMoveEvent ( __mem_func__ ( self . OnMove ))
middleBar . Show ()
middleBar . SetUpVisual ( "d:/ymir work/ui/public/scrollbar_small_thin_middle_button_01.sub" )
middleBar . SetOverVisual ( "d:/ymir work/ui/public/scrollbar_small_thin_middle_button_01.sub" )
middleBar . SetDownVisual ( "d:/ymir work/ui/public/scrollbar_small_thin_middle_button_01.sub" )
upButton = Button ()
upButton . SetParent ( self )
upButton . SetUpVisual ( "d:/ymir work/ui/public/scrollbar_small_thin_up_button_01.sub" )
upButton . SetOverVisual ( "d:/ymir work/ui/public/scrollbar_small_thin_up_button_02.sub" )
upButton . SetDownVisual ( "d:/ymir work/ui/public/scrollbar_small_thin_up_button_03.sub" )
upButton . SetEvent ( __mem_func__ ( self . OnUp ))
upButton . Show ()
downButton = Button ()
downButton . SetParent ( self )
downButton . SetUpVisual ( "d:/ymir work/ui/public/scrollbar_small_thin_down_button_01.sub" )
downButton . SetOverVisual ( "d:/ymir work/ui/public/scrollbar_small_thin_down_button_02.sub" )
downButton . SetDownVisual ( "d:/ymir work/ui/public/scrollbar_small_thin_down_button_03.sub" )
downButton . SetEvent ( __mem_func__ ( self . OnDown ))
downButton . Show ()
self . middleBar = middleBar
self . upButton = upButton
self . downButton = downButton
self . SCROLLBAR_WIDTH = self . upButton . GetWidth ()
self . SCROLLBAR_MIDDLE_HEIGHT = self . middleBar . GetHeight ()
self . SCROLLBAR_BUTTON_WIDTH = self . upButton . GetWidth ()
self . SCROLLBAR_BUTTON_HEIGHT = self . upButton . GetHeight ()
self . MIDDLE_BAR_POS = 0
self . MIDDLE_BAR_UPPER_PLACE = 0
self . MIDDLE_BAR_DOWNER_PLACE = 0
self . TEMP_SPACE = 0
def UpdateBarSlot ( self ):
pass
class SliderBar ( Window ):
def __init__ ( self ):
Window . __init__ ( self )
self . curPos = 1.0
self . pageSize = 1.0
self . eventChange = None
self . __CreateBackGroundImage ()
self . __CreateCursor ()
def __del__ ( self ):
Window . __del__ ( self )
def __CreateBackGroundImage ( self ):
img = ImageBox ()
img . SetParent ( self )
img . LoadImage ( "d:/ymir work/ui/game/windows/sliderbar.sub" )
img . Show ()
self . backGroundImage = img
##
self . SetSize ( self . backGroundImage . GetWidth (), self . backGroundImage . GetHeight ())
def __CreateCursor ( self ):
cursor = DragButton ()
cursor . AddFlag ( "movable" )
cursor . AddFlag ( "restrict_y" )
cursor . SetParent ( self )
cursor . SetMoveEvent ( __mem_func__ ( self . __OnMove ))
cursor . SetUpVisual ( "d:/ymir work/ui/game/windows/sliderbar_cursor.sub" )
cursor . SetOverVisual ( "d:/ymir work/ui/game/windows/sliderbar_cursor.sub" )
cursor . SetDownVisual ( "d:/ymir work/ui/game/windows/sliderbar_cursor.sub" )
cursor . Show ()
self . cursor = cursor
##
self . cursor . SetRestrictMovementArea ( 0 , 0 , self . backGroundImage . GetWidth (), 0 )
self . pageSize = self . backGroundImage . GetWidth () - self . cursor . GetWidth ()
def __OnMove ( self ):
( xLocal , yLocal ) = self . cursor . GetLocalPosition ()
self . curPos = float ( xLocal ) / float ( self . pageSize )
if self . eventChange :
self . eventChange ()
def SetSliderPos ( self , pos ):
self . curPos = pos
self . cursor . SetPosition ( int ( self . pageSize * pos ), 0 )
def GetSliderPos ( self ):
return self . curPos
def SetEvent ( self , event ):
self . eventChange = event
def Enable ( self ):
self . cursor . Show ()
def Disable ( self ):
self . cursor . Hide ()
class ListBox ( Window ):
TEMPORARY_PLACE = 3
def __init__ ( self , layer = "UI" ):
Window . __init__ ( self , layer )
self . overLine = - 1
self . selectedLine = - 1
self . width = 0
self . height = 0
self . stepSize = 17
self . basePos = 0
self . showLineCount = 0
self . itemCenterAlign = TRUE
self . itemList = []
self . keyDict = {}
self . textDict = {}
self . event = lambda * arg : None
def __del__ ( self ):
Window . __del__ ( self )
def SetWidth ( self , width ):
self . SetSize ( width , self . height )
def SetSize ( self , width , height ):
Window . SetSize ( self , width , height )
self . width = width
self . height = height
def SetTextCenterAlign ( self , flag ):
self . itemCenterAlign = flag
def SetBasePos ( self , pos ):
self . basePos = pos
self . _LocateItem ()
def ClearItem ( self ):
self . keyDict = {}
self . textDict = {}
self . itemList = []
self . overLine = - 1
self . selectedLine = - 1
def InsertItem ( self , number , text ):
self . keyDict [ len ( self . itemList )] = number
self . textDict [ len ( self . itemList )] = text
textLine = TextLine ()
textLine . SetParent ( self )
textLine . SetText ( text )
textLine . Show ()
if self . itemCenterAlign :
textLine . SetWindowHorizontalAlignCenter ()
textLine . SetHorizontalAlignCenter ()
self . itemList . append ( textLine )
self . _LocateItem ()
def ChangeItem ( self , number , text ):
for key , value in self . keyDict . items ():
if value == number :
self . textDict [ key ] = text
if number < len ( self . itemList ):
self . itemList [ key ]. SetText ( text )
return
def LocateItem ( self ):
self . _LocateItem ()
def _LocateItem ( self ):
skipCount = self . basePos
yPos = 0
self . showLineCount = 0
for textLine in self . itemList :
textLine . Hide ()
if skipCount > 0 :
skipCount -= 1
continue
textLine . SetPosition ( 0 , yPos + 3 )
yPos += self . stepSize
if yPos <= self . GetHeight ():
self . showLineCount += 1
textLine . Show ()
def ArrangeItem ( self ):
self . SetSize ( self . width , len ( self . itemList ) * self . stepSize )
self . _LocateItem ()
def GetViewItemCount ( self ):
return int ( self . GetHeight () / self . stepSize )
def GetItemCount ( self ):
return len ( self . itemList )
def SetEvent ( self , event ):
self . event = event
def SelectItem ( self , line ):
if not self . keyDict . has_key ( line ):
return
if line == self . selectedLine :
return
self . selectedLine = line
self . event ( self . keyDict . get ( line , 0 ), self . textDict . get ( line , "None" ))
def GetSelectedItem ( self ):
return self . keyDict . get ( self . selectedLine , 0 )
def OnMouseLeftButtonDown ( self ):
if self . overLine < 0 :
return
def OnMouseLeftButtonUp ( self ):
if self . overLine >= 0 :
self . SelectItem ( self . overLine + self . basePos )
def OnUpdate ( self ):
self . overLine = - 1
if self . IsIn ():
x , y = self . GetGlobalPosition ()
height = self . GetHeight ()
xMouse , yMouse = wndMgr . GetMousePosition ()
if yMouse - y < height - 1 :
self . overLine = ( yMouse - y ) / self . stepSize
if self . overLine < 0 :
self . overLine = - 1
if self . overLine >= len ( self . itemList ):
self . overLine = - 1
def OnRender ( self ):
xRender , yRender = self . GetGlobalPosition ()
yRender -= self . TEMPORARY_PLACE
widthRender = self . width
heightRender = self . height + self . TEMPORARY_PLACE * 2
if - 1 != self . overLine :
grp . SetColor ( HALF_WHITE_COLOR )
grp . RenderBar ( xRender + 2 , yRender + self . overLine * self . stepSize + 4 , self . width - 3 , self . stepSize )
if - 1 != self . selectedLine :
if self . selectedLine >= self . basePos :
if self . selectedLine - self . basePos < self . showLineCount :
grp . SetColor ( SELECT_COLOR )
grp . RenderBar ( xRender + 2 , yRender + ( self . selectedLine - self . basePos )* self . stepSize + 4 , self . width - 3 , self . stepSize )
class ListBox2 ( ListBox ):
def __init__ ( self , * args , ** kwargs ):
ListBox . __init__ ( self , * args , ** kwargs )
self . rowCount = 10
self . barWidth = 0
self . colCount = 0
def SetRowCount ( self , rowCount ):
self . rowCount = rowCount
def SetSize ( self , width , height ):
ListBox . SetSize ( self , width , height )
self . _RefreshForm ()
def ClearItem ( self ):
ListBox . ClearItem ( self )
self . _RefreshForm ()
def InsertItem ( self , * args , ** kwargs ):
ListBox . InsertItem ( self , * args , ** kwargs )
self . _RefreshForm ()
def OnUpdate ( self ):
mpos = wndMgr . GetMousePosition ()
self . overLine = self . _CalcPointIndex ( mpos )
def OnRender ( self ):
x , y = self . GetGlobalPosition ()
pos = ( x + 2 , y )
if - 1 != self . overLine :
grp . SetColor ( HALF_WHITE_COLOR )
self . _RenderBar ( pos , self . overLine )
if - 1 != self . selectedLine :
if self . selectedLine >= self . basePos :
if self . selectedLine - self . basePos < self . showLineCount :
grp . SetColor ( SELECT_COLOR )
self . _RenderBar ( pos , self . selectedLine - self . basePos )
def _CalcPointIndex ( self , mpos ):
if self . IsIn ():
px , py = mpos
gx , gy = self . GetGlobalPosition ()
lx , ly = px - gx , py - gy
col = lx / self . barWidth
row = ly / self . stepSize
idx = col * self . rowCount + row
if col >= 0 and col < self . colCount :
if row >= 0 and row < self . rowCount :
if idx >= 0 and idx < len ( self . itemList ):
return idx
return - 1
def _CalcRenderPos ( self , pos , idx ):
x , y = pos
row = idx % self . rowCount
col = idx / self . rowCount
return ( x + col * self . barWidth , y + row * self . stepSize )
def _RenderBar ( self , basePos , idx ):
x , y = self . _CalcRenderPos ( basePos , idx )
grp . RenderBar ( x , y , self . barWidth - 3 , self . stepSize )
def _LocateItem ( self ):
pos = ( 0 , self . TEMPORARY_PLACE )
self . showLineCount = 0
for textLine in self . itemList :
x , y = self . _CalcRenderPos ( pos , self . showLineCount )
textLine . SetPosition ( x , y )
textLine . Show ()
self . showLineCount += 1
def _RefreshForm ( self ):
if len ( self . itemList ) % self . rowCount :
self . colCount = len ( self . itemList ) / self . rowCount + 1
else:
self . colCount = len ( self . itemList ) / self . rowCount
if self . colCount :
self . barWidth = self . width / self . colCount
else:
self . barWidth = self . width
class ComboBox ( Window ):
class ListBoxWithBoard ( ListBox ):
def __init__ ( self , layer ):
ListBox . __init__ ( self , layer )
def OnRender ( self ):
xRender , yRender = self . GetGlobalPosition ()
yRender -= self . TEMPORARY_PLACE
widthRender = self . width
heightRender = self . height + self . TEMPORARY_PLACE * 2
grp . SetColor ( BACKGROUND_COLOR )
grp . RenderBar ( xRender , yRender , widthRender , heightRender )
grp . SetColor ( DARK_COLOR )
grp . RenderLine ( xRender , yRender , widthRender , 0 )
grp . RenderLine ( xRender , yRender , 0 , heightRender )
grp . SetColor ( BRIGHT_COLOR )
grp . RenderLine ( xRender , yRender + heightRender , widthRender , 0 )
grp . RenderLine ( xRender + widthRender , yRender , 0 , heightRender )
ListBox . OnRender ( self )
def __init__ ( self ):
Window . __init__ ( self )
self . x = 0
self . y = 0
self . width = 0
self . height = 0
self . isSelected = FALSE
self . isOver = FALSE
self . isListOpened = FALSE
self . event = lambda * arg : None
self . enable = TRUE
self . textLine = MakeTextLine ( self )
self . textLine . SetText ( locale . UI_ITEM )
self . listBox = self . ListBoxWithBoard ( "TOP_MOST" )
self . listBox . SetPickAlways ()
self . listBox . SetParent ( self )
self . listBox . SetEvent ( __mem_func__ ( self . OnSelectItem ))
self . listBox . Hide ()
def __del__ ( self ):
Window . __del__ ( self )
def Destroy ( self ):
self . textLine = None
self . listBox = None
def SetPosition ( self , x , y ):
Window . SetPosition ( self , x , y )
self . x = x
self . y = y
self . __ArrangeListBox ()
def SetSize ( self , width , height ):
Window . SetSize ( self , width , height )
self . width = width
self . height = height
self . textLine . UpdateRect ()
self . __ArrangeListBox ()
def __ArrangeListBox ( self ):
self . listBox . SetPosition ( 0 , self . height + 5 )
self . listBox . SetWidth ( self . width )
def Enable ( self ):
self . enable = TRUE
def Disable ( self ):
self . enable = FALSE
self . textLine . SetText ( "" )
self . CloseListBox ()
def SetEvent ( self , event ):
self . event = event
def ClearItem ( self ):
self . CloseListBox ()
self . listBox . ClearItem ()
def InsertItem ( self , index , name ):
self . listBox . InsertItem ( index , name )
self . listBox . ArrangeItem ()
def SetCurrentItem ( self , text ):
self . textLine . SetText ( text )
def SelectItem ( self , key ):
self . listBox . SelectItem ( key )
def OnSelectItem ( self , index , name ):
self . CloseListBox ()
self . event ( index )
def CloseListBox ( self ):
self . isListOpened = FALSE
self . listBox . Hide ()
def OnMouseLeftButtonDown ( self ):
if not self . enable :
return
self . isSelected = TRUE
def OnMouseLeftButtonUp ( self ):
if not self . enable :
return
self . isSelected = FALSE
if self . isListOpened :
self . CloseListBox ()
else:
if self . listBox . GetItemCount () > 0 :
self . isListOpened = TRUE
self . listBox . Show ()
self . __ArrangeListBox ()
def OnUpdate ( self ):
if not self . enable :
return
if self . IsIn ():
self . isOver = TRUE
else:
self . isOver = FALSE
def OnRender ( self ):
self . x , self . y = self . GetGlobalPosition ()
xRender = self . x
yRender = self . y
widthRender = self . width
heightRender = self . height
grp . SetColor ( BACKGROUND_COLOR )
grp . RenderBar ( xRender , yRender , widthRender , heightRender )
grp . SetColor ( DARK_COLOR )
grp . RenderLine ( xRender , yRender , widthRender , 0 )
grp . RenderLine ( xRender , yRender , 0 , heightRender )
grp . SetColor ( BRIGHT_COLOR )
grp . RenderLine ( xRender , yRender + heightRender , widthRender , 0 )
grp . RenderLine ( xRender + widthRender , yRender , 0 , heightRender )
if self . isOver :
grp . SetColor ( HALF_WHITE_COLOR )
grp . RenderBar ( xRender + 2 , yRender + 3 , self . width - 3 , heightRender - 5 )
if self . isSelected :
grp . SetColor ( WHITE_COLOR )
grp . RenderBar ( xRender + 2 , yRender + 3 , self . width - 3 , heightRender - 5 )
###################################################################################################
## Python Script Loader
###################################################################################################
class ScriptWindow ( Window ):
def __init__ ( self , layer = "UI" ):
Window . __init__ ( self , layer )
self . Children = []
self . ElementDictionary = {}
def __del__ ( self ):
Window . __del__ ( self )
def ClearDictionary ( self ):
self . Children = []
self . ElementDictionary = {}
def InsertChild ( self , name , child ):
self . ElementDictionary [ name ] = child
def IsChild ( self , name ):
return self . ElementDictionary . has_key ( name )
def GetChild ( self , name ):
return self . ElementDictionary [ name ]
def GetChild2 ( self , name ):
return self . ElementDictionary . get ( name , None )
class PythonScriptLoader (object):
BODY_KEY_LIST = ( "x" , "y" , "width" , "height" )
#####
DEFAULT_KEY_LIST = ( "type" , "x" , "y" , )
WINDOW_KEY_LIST = ( "width" , "height" , )
IMAGE_KEY_LIST = ( "image" , )
EXPANDED_IMAGE_KEY_LIST = ( "image" , )
ANI_IMAGE_KEY_LIST = ( "images" , )
SLOT_KEY_LIST = ( "width" , "height" , "slot" , )
CANDIDATE_LIST_KEY_LIST = ( "item_step" , "item_xsize" , "item_ysize" , )
GRID_TABLE_KEY_LIST = ( "start_index" , "x_count" , "y_count" , "x_step" , "y_step" , )
EDIT_LINE_KEY_LIST = ( "width" , "height" , "input_limit" , )
COMBO_BOX_KEY_LIST = ( "width" , "height" , "item" , )
TITLE_BAR_KEY_LIST = ( "width" , )
HORIZONTAL_BAR_KEY_LIST = ( "width" , )
BOARD_KEY_LIST = ( "width" , "height" , )
BOARD_WITH_TITLEBAR_KEY_LIST = ( "width" , "height" , "title" , )
BOX_KEY_LIST = ( "width" , "height" , )
BAR_KEY_LIST = ( "width" , "height" , )
LINE_KEY_LIST = ( "width" , "height" , )
SLOTBAR_KEY_LIST = ( "width" , "height" , )
GAUGE_KEY_LIST = ( "width" , "color" , )
SCROLLBAR_KEY_LIST = ( "size" , )
LIST_BOX_KEY_LIST = ( "width" , "height" , )
def __init__ ( self ):
self . Clear ()
def Clear ( self ):
self . ScriptDictionary = { "SCREEN_WIDTH" : wndMgr . GetScreenWidth (), "SCREEN_HEIGHT" : wndMgr . GetScreenHeight () }
self . InsertFunction = 0
def LoadScriptFile ( self , window , FileName ):
self . Clear ()
print "===== Load Script File : %s" % ( FileName )
try:
execfile ( FileName , self . ScriptDictionary )
except :
import dbg
import exception
dbg . TraceError ( "Failed to load script file : %s" % ( FileName ))
exception . Abort ( "LoadScriptFile" )
#####
Body = self . ScriptDictionary [ "window" ]
self . CheckKeyList ( "window" , Body , self . BODY_KEY_LIST )
window . ClearDictionary ()
self . InsertFunction = window . InsertChild
window . SetPosition ( int ( Body [ "x" ]), int ( Body [ "y" ]))
window . SetSize ( int ( Body [ "width" ]), int ( Body [ "height" ]))
if TRUE == Body . has_key ( "style" ):
for StyleList in Body [ "style" ]:
window . AddFlag ( StyleList )
self . LoadChildren ( window , Body )
def LoadChildren ( self , parent , dicChildren ):
if FALSE == dicChildren . has_key ( "children" ):
return FALSE
Index = 0
ChildrenList = dicChildren [ "children" ]
parent . Children = range ( len ( ChildrenList ))
for ElementValue in ChildrenList :
try:
Name = ElementValue [ "name" ]
except KeyError :
Name = ElementValue [ "name" ] = "NONAME"
try:
Type = ElementValue [ "type" ]
except KeyError :
Type = ElementValue [ "type" ] = "window"
if FALSE == self . CheckKeyList ( Name , ElementValue , self . DEFAULT_KEY_LIST ):
del parent . Children [ Index ]
continue
if Type == "window" :
parent . Children [ Index ] = ScriptWindow ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementWindow ( parent . Children [ Index ], ElementValue )
elif Type == "button" :
parent . Children [ Index ] = Button ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementButton ( parent . Children [ Index ], ElementValue )
elif Type == "radio_button" :
parent . Children [ Index ] = RadioButton ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementButton ( parent . Children [ Index ], ElementValue )
elif Type == "toggle_button" :
parent . Children [ Index ] = ToggleButton ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementButton ( parent . Children [ Index ], ElementValue )
elif Type == "mark" :
parent . Children [ Index ] = MarkBox ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementMark ( parent . Children [ Index ], ElementValue )
elif Type == "image" :
parent . Children [ Index ] = ImageBox ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementImage ( parent . Children [ Index ], ElementValue )
elif Type == "expanded_image" :
parent . Children [ Index ] = ExpandedImageBox ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementExpandedImage ( parent . Children [ Index ], ElementValue )
elif Type == "ani_image" :
parent . Children [ Index ] = AniImageBox ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementAniImage ( parent . Children [ Index ], ElementValue )
elif Type == "slot" :
parent . Children [ Index ] = SlotWindow ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementSlot ( parent . Children [ Index ], ElementValue )
elif Type == "candidate_list" :
parent . Children [ Index ] = CandidateListBox ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementCandidateList ( parent . Children [ Index ], ElementValue )
elif Type == "grid_table" :
parent . Children [ Index ] = GridSlotWindow ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementGridTable ( parent . Children [ Index ], ElementValue )
elif Type == "text" :
parent . Children [ Index ] = TextLine ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementText ( parent . Children [ Index ], ElementValue )
elif Type == "editline" :
parent . Children [ Index ] = EditLine ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementEditLine ( parent . Children [ Index ], ElementValue )
elif Type == "titlebar" :
parent . Children [ Index ] = TitleBar ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementTitleBar ( parent . Children [ Index ], ElementValue )
elif Type == "horizontalbar" :
parent . Children [ Index ] = HorizontalBar ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementHorizontalBar ( parent . Children [ Index ], ElementValue )
elif Type == "board" :
parent . Children [ Index ] = Board ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementBoard ( parent . Children [ Index ], ElementValue )
elif Type == "board_with_titlebar" :
parent . Children [ Index ] = BoardWithTitleBar ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementBoardWithTitleBar ( parent . Children [ Index ], ElementValue )
elif Type == "thinboard" :
parent . Children [ Index ] = ThinBoard ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementThinBoard ( parent . Children [ Index ], ElementValue )
elif Type == "box" :
parent . Children [ Index ] = Box ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementBox ( parent . Children [ Index ], ElementValue )
elif Type == "bar" :
parent . Children [ Index ] = Bar ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementBar ( parent . Children [ Index ], ElementValue )
elif Type == "line" :
parent . Children [ Index ] = Line ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementLine ( parent . Children [ Index ], ElementValue )
elif Type == "slotbar" :
parent . Children [ Index ] = SlotBar ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementSlotBar ( parent . Children [ Index ], ElementValue )
elif Type == "gauge" :
parent . Children [ Index ] = Gauge ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementGauge ( parent . Children [ Index ], ElementValue )
elif Type == "scrollbar" :
parent . Children [ Index ] = ScrollBar ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementScrollBar ( parent . Children [ Index ], ElementValue )
elif Type == "thin_scrollbar" :
parent . Children [ Index ] = ThinScrollBar ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementScrollBar ( parent . Children [ Index ], ElementValue )
elif Type == "small_thin_scrollbar" :
parent . Children [ Index ] = SmallThinScrollBar ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementScrollBar ( parent . Children [ Index ], ElementValue )
elif Type == "sliderbar" :
parent . Children [ Index ] = SliderBar ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementSliderBar ( parent . Children [ Index ], ElementValue )
elif Type == "listbox" :
parent . Children [ Index ] = ListBox ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementListBox ( parent . Children [ Index ], ElementValue )
elif Type == "listbox2" :
parent . Children [ Index ] = ListBox2 ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementListBox2 ( parent . Children [ Index ], ElementValue )
elif Type == "listboxex" :
parent . Children [ Index ] = ListBoxEx ()
parent . Children [ Index ]. SetParent ( parent )
self . LoadElementListBoxEx ( parent . Children [ Index ], ElementValue )
else:
Index += 1
continue
parent . Children [ Index ]. SetWindowName ( Name )
if 0 != self . InsertFunction :
self . InsertFunction ( Name , parent . Children [ Index ])
if TRUE == ElementValue . has_key ( "style" ):
for StyleList in ElementValue [ "style" ]:
parent . Children [ Index ]. AddFlag ( StyleList )
self . LoadChildren ( parent . Children [ Index ], ElementValue )
Index += 1
def CheckKeyList ( self , name , value , key_list ):
for DataKey in key_list :
if FALSE == value . has_key ( DataKey ):
print "Failed to find data key" , "[" + name + "/" + DataKey + "]"
return FALSE
return TRUE
def LoadDefaultData ( self , window , value ):
if value . has_key ( "horizontal_align" ):
if "center" == value [ "horizontal_align" ]:
window . SetWindowHorizontalAlignCenter ()
elif "right" == value [ "horizontal_align" ]:
window . SetWindowHorizontalAlignRight ()
if value . has_key ( "vertical_align" ):
if "center" == value [ "vertical_align" ]:
window . SetWindowVerticalAlignCenter ()
elif "bottom" == value [ "vertical_align" ]:
window . SetWindowVerticalAlignBottom ()
window . SetPosition ( int ( value [ "x" ]), int ( value [ "y" ]))
window . Show ()
## Window
def LoadElementWindow ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . WINDOW_KEY_LIST ):
return FALSE
self . LoadDefaultData ( window , value )
window . SetSize ( int ( value [ "width" ]), int ( value [ "height" ]))
return TRUE
## Button
def LoadElementButton ( self , window , value ):
if value . has_key ( "width" ) and value . has_key ( "height" ):
window . SetSize ( int ( value [ "width" ]), int ( value [ "height" ]))
if TRUE == value . has_key ( "default_image" ):
window . SetUpVisual ( value [ "default_image" ])
if TRUE == value . has_key ( "over_image" ):
window . SetOverVisual ( value [ "over_image" ])
if TRUE == value . has_key ( "down_image" ):
window . SetDownVisual ( value [ "down_image" ])
if TRUE == value . has_key ( "disable_image" ):
window . SetDisableVisual ( value [ "disable_image" ])
if TRUE == value . has_key ( "text" ):
if TRUE == value . has_key ( "text_height" ):
window . SetText ( value [ "text" ], value [ "text_height" ])
else:
window . SetText ( value [ "text" ])
if value . has_key ( "text_color" ):
window . SetTextColor ( value [ "text_color" ])
if TRUE == value . has_key ( "tooltip_text" ):
if TRUE == value . has_key ( "tooltip_x" ) and TRUE == value . has_key ( "tooltip_y" ):
window . SetToolTipText ( value [ "tooltip_text" ], int ( value [ "tooltip_x" ]), int ( value [ "tooltip_y" ]))
else:
window . SetToolTipText ( value [ "tooltip_text" ])
self . LoadDefaultData ( window , value )
return TRUE
## Mark
def LoadElementMark ( self , window , value ):
#if FALSE == self.CheckKeyList(value["name"], value, self.MARK_KEY_LIST):
# return FALSE
self . LoadDefaultData ( window , value )
return TRUE
## Image
def LoadElementImage ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . IMAGE_KEY_LIST ):
return FALSE
window . LoadImage ( value [ "image" ])
self . LoadDefaultData ( window , value )
return TRUE
## AniImage
def LoadElementAniImage ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . ANI_IMAGE_KEY_LIST ):
return FALSE
if TRUE == value . has_key ( "delay" ):
window . SetDelay ( value [ "delay" ])
for image in value [ "images" ]:
window . AppendImage ( image )
if value . has_key ( "width" ) and value . has_key ( "height" ):
window . SetSize ( value [ "width" ], value [ "height" ])
self . LoadDefaultData ( window , value )
return TRUE
## Expanded Image
def LoadElementExpandedImage ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . EXPANDED_IMAGE_KEY_LIST ):
return FALSE
window . LoadImage ( value [ "image" ])
self . LoadDefaultData ( window , value )
if TRUE == value . has_key ( "x_origin" ) and TRUE == value . has_key ( "y_origin" ):
window . SetOrigin ( float ( value [ "x_origin" ]), float ( value [ "y_origin" ]))
if TRUE == value . has_key ( "x_scale" ) and TRUE == value . has_key ( "y_scale" ):
window . SetScale ( float ( value [ "x_scale" ]), float ( value [ "y_scale" ]))
if TRUE == value . has_key ( "rect" ):
RenderingRect = value [ "rect" ]
window . SetRenderingRect ( RenderingRect [ 0 ], RenderingRect [ 1 ], RenderingRect [ 2 ], RenderingRect [ 3 ])
if TRUE == value . has_key ( "mode" ):
mode = value [ "mode" ]
if "MODULATE" == mode :
window . SetRenderingMode ( wndMgr . RENDERING_MODE_MODULATE )
return TRUE
## Slot
def LoadElementSlot ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . SLOT_KEY_LIST ):
return FALSE
global_x = int ( value [ "x" ])
global_y = int ( value [ "y" ])
global_width = int ( value [ "width" ])
global_height = int ( value [ "height" ])
window . SetPosition ( global_x , global_y )
window . SetSize ( global_width , global_height )
window . Show ()
r = 1.0
g = 1.0
b = 1.0
a = 1.0
if TRUE == value . has_key ( "image_r" ) and \
TRUE == value . has_key ( "image_g" ) and \
TRUE == value . has_key ( "image_b" ) and \
TRUE == value . has_key ( "image_a" ):
r = float ( value [ "image_r" ])
g = float ( value [ "image_g" ])
b = float ( value [ "image_b" ])
a = float ( value [ "image_a" ])
SLOT_ONE_KEY_LIST = ( "index" , "x" , "y" , "width" , "height" )
for slot in value [ "slot" ]:
if TRUE == self . CheckKeyList ( value [ "name" ] + " - one" , slot , SLOT_ONE_KEY_LIST ):
wndMgr . AppendSlot ( window . hWnd ,
int ( slot [ "index" ]),
int ( slot [ "x" ]),
int ( slot [ "y" ]),
int ( slot [ "width" ]),
int ( slot [ "height" ]))
if TRUE == value . has_key ( "image" ):
wndMgr . SetSlotBaseImage ( window . hWnd ,
value [ "image" ],
r , g , b , a )
return TRUE
def LoadElementCandidateList ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . CANDIDATE_LIST_KEY_LIST ):
return FALSE
window . SetPosition ( int ( value [ "x" ]), int ( value [ "y" ]))
window . SetItemSize ( int ( value [ "item_xsize" ]), int ( value [ "item_ysize" ]))
window . SetItemStep ( int ( value [ "item_step" ]))
window . Show ()
return TRUE
## Table
def LoadElementGridTable ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . GRID_TABLE_KEY_LIST ):
return FALSE
xBlank = 0
yBlank = 0
if TRUE == value . has_key ( "x_blank" ):
xBlank = int ( value [ "x_blank" ])
if TRUE == value . has_key ( "y_blank" ):
yBlank = int ( value [ "y_blank" ])
window . SetPosition ( int ( value [ "x" ]), int ( value [ "y" ]))
window . ArrangeSlot ( int ( value [ "start_index" ]),
int ( value [ "x_count" ]),
int ( value [ "y_count" ]),
int ( value [ "x_step" ]),
int ( value [ "y_step" ]),
xBlank ,
yBlank )
if TRUE == value . has_key ( "image" ):
r = 1.0
g = 1.0
b = 1.0
a = 1.0
if TRUE == value . has_key ( "image_r" ) and \
TRUE == value . has_key ( "image_g" ) and \
TRUE == value . has_key ( "image_b" ) and \
TRUE == value . has_key ( "image_a" ):
r = float ( value [ "image_r" ])
g = float ( value [ "image_g" ])
b = float ( value [ "image_b" ])
a = float ( value [ "image_a" ])
wndMgr . SetSlotBaseImage ( window . hWnd , value [ "image" ], r , g , b , a )
if TRUE == value . has_key ( "style" ):
if "select" == value [ "style" ]:
wndMgr . SetSlotStyle ( window . hWnd , wndMgr . SLOT_STYLE_SELECT )
window . Show ()
return TRUE
## Text
def LoadElementText ( self , window , value ):
if value . has_key ( "fontsize" ):
fontSize = value [ "fontsize" ]
if "LARGE" == fontSize :
window . SetFontName ( locale . UI_DEF_FONT_LARGE )
elif value . has_key ( "fontname" ):
fontName = value [ "fontname" ]
window . SetFontName ( fontName )
if value . has_key ( "text_horizontal_align" ):
if "left" == value [ "text_horizontal_align" ]:
window . SetHorizontalAlignLeft ()
elif "center" == value [ "text_horizontal_align" ]:
window . SetHorizontalAlignCenter ()
elif "right" == value [ "text_horizontal_align" ]:
window . SetHorizontalAlignRight ()
elif "arabic" == value [ "text_horizontal_align" ]:
window . SetHorizontalAlignArabic ()
if value . has_key ( "text_vertical_align" ):
if "top" == value [ "text_vertical_align" ]:
window . SetVerticalAlignTop ()
elif "center" == value [ "text_vertical_align" ]:
window . SetVerticalAlignCenter ()
elif "bottom" == value [ "text_vertical_align" ]:
window . SetVerticalAlignBottom ()
if value . has_key ( "all_align" ):
window . SetHorizontalAlignCenter ()
window . SetVerticalAlignCenter ()
window . SetWindowHorizontalAlignCenter ()
window . SetWindowVerticalAlignCenter ()
if value . has_key ( "r" ) and value . has_key ( "g" ) and value . has_key ( "b" ):
window . SetFontColor ( float ( value [ "r" ]), float ( value [ "g" ]), float ( value [ "b" ]))
elif value . has_key ( "color" ):
window . SetPackedFontColor ( value [ "color" ])
else:
window . SetFontColor ( 0.8549 , 0.8549 , 0.8549 )
if value . has_key ( "outline" ):
if value [ "outline" ]:
window . SetOutline ()
if TRUE == value . has_key ( "text" ):
window . SetText ( value [ "text" ])
# FOR_ARABIC_ALIGN
window . SetSize ( int ( value . get ( "width" , 0 )), int ( value . get ( "height" , 0 )))
self . LoadDefaultData ( window , value )
return TRUE
## EditLine
def LoadElementEditLine ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . EDIT_LINE_KEY_LIST ):
return FALSE
self . LoadElementText ( window , value )
if value . has_key ( "secret_flag" ):
window . SetSecret ( value [ "secret_flag" ])
if value . has_key ( "with_codepage" ):
if value [ "with_codepage" ]:
window . bCodePage = TRUE
if value . has_key ( "only_number" ):
if value [ "only_number" ]:
window . SetNumberMode ()
if value . has_key ( "enable_codepage" ):
window . SetIMEFlag ( value [ "enable_codepage" ])
if value . has_key ( "enable_ime" ):
window . SetIMEFlag ( value [ "enable_ime" ])
if value . has_key ( "limit_width" ):
window . SetLimitWidth ( value [ "limit_width" ])
if value . has_key ( "multi_line" ):
if value [ "multi_line" ]:
window . SetMultiLine ()
window . SetMax ( int ( value [ "input_limit" ]))
window . SetSize ( int ( value [ "width" ]), int ( value [ "height" ]))
return TRUE
## TitleBar
def LoadElementTitleBar ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . TITLE_BAR_KEY_LIST ):
return FALSE
window . MakeTitleBar ( int ( value [ "width" ]), value . get ( "color" , "red" ))
self . LoadDefaultData ( window , value )
return TRUE
## HorizontalBar
def LoadElementHorizontalBar ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . HORIZONTAL_BAR_KEY_LIST ):
return FALSE
window . Create ( int ( value [ "width" ]))
self . LoadDefaultData ( window , value )
return TRUE
## Board
def LoadElementBoard ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . BOARD_KEY_LIST ):
return FALSE
window . SetSize ( int ( value [ "width" ]), int ( value [ "height" ]))
self . LoadDefaultData ( window , value )
return TRUE
## Board With TitleBar
def LoadElementBoardWithTitleBar ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . BOARD_WITH_TITLEBAR_KEY_LIST ):
return FALSE
self . LoadDefaultData ( window , value )
window . SetSize ( int ( value [ "width" ]), int ( value [ "height" ]))
window . SetTitleName ( value [ "title" ])
return TRUE
## ThinBoard
def LoadElementThinBoard ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . BOARD_KEY_LIST ):
return FALSE
window . SetSize ( int ( value [ "width" ]), int ( value [ "height" ]))
self . LoadDefaultData ( window , value )
return TRUE
## Box
def LoadElementBox ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . BOX_KEY_LIST ):
return FALSE
self . LoadDefaultData ( window , value )
window . SetSize ( int ( value [ "width" ]), int ( value [ "height" ]))
if TRUE == value . has_key ( "color" ):
window . SetColor ( value [ "color" ])
return TRUE
## Bar
def LoadElementBar ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . BAR_KEY_LIST ):
return FALSE
self . LoadDefaultData ( window , value )
window . SetSize ( int ( value [ "width" ]), int ( value [ "height" ]))
if TRUE == value . has_key ( "color" ):
window . SetColor ( value [ "color" ])
return TRUE
## Line
def LoadElementLine ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . LINE_KEY_LIST ):
return FALSE
self . LoadDefaultData ( window , value )
window . SetSize ( int ( value [ "width" ]), int ( value [ "height" ]))
if TRUE == value . has_key ( "color" ):
window . SetColor ( value [ "color" ])
return TRUE
## Slot
def LoadElementSlotBar ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . SLOTBAR_KEY_LIST ):
return FALSE
self . LoadDefaultData ( window , value )
window . SetSize ( int ( value [ "width" ]), int ( value [ "height" ]))
return TRUE
## Gauge
def LoadElementGauge ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . GAUGE_KEY_LIST ):
return FALSE
self . LoadDefaultData ( window , value )
window . MakeGauge ( value [ "width" ], value [ "color" ])
return TRUE
## ScrollBar
def LoadElementScrollBar ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . SCROLLBAR_KEY_LIST ):
return FALSE
self . LoadDefaultData ( window , value )
window . SetScrollBarSize ( value [ "size" ])
return TRUE
## SliderBar
def LoadElementSliderBar ( self , window , value ):
self . LoadDefaultData ( window , value )
return TRUE
## ListBox
def LoadElementListBox ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . LIST_BOX_KEY_LIST ):
return FALSE
window . SetSize ( value [ "width" ], value [ "height" ])
self . LoadDefaultData ( window , value )
if value . has_key ( "item_align" ):
window . SetTextCenterAlign ( value [ "item_align" ])
return TRUE
## ListBox2
def LoadElementListBox2 ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . LIST_BOX_KEY_LIST ):
return FALSE
window . SetRowCount ( value . get ( "row_count" , 10 )) # 기본 세로 개수 10개
window . SetSize ( value [ "width" ], value [ "height" ])
self . LoadDefaultData ( window , value )
if value . has_key ( "item_align" ):
window . SetTextCenterAlign ( value [ "item_align" ])
return TRUE
def LoadElementListBoxEx ( self , window , value ):
if FALSE == self . CheckKeyList ( value [ "name" ], value , self . LIST_BOX_KEY_LIST ):
return FALSE
window . SetSize ( value [ "width" ], value [ "height" ])
self . LoadDefaultData ( window , value )
if value . has_key ( "itemsize_x" ) and value . has_key ( "itemsize_y" ):
window . SetItemSize ( int ( value [ "itemsize_x" ]), int ( value [ "itemsize_y" ]))
if value . has_key ( "itemstep" ):
window . SetItemStep ( int ( value [ "itemstep" ]))
if value . has_key ( "viewcount" ):
window . SetViewItemCount ( int ( value [ "viewcount" ]))
return TRUE
class ReadingWnd ( Bar ):
def __init__ ( self ):
Bar . __init__ ( self , "TOP_MOST" )
self . __BuildText ()
self . SetSize ( 80 , 19 )
self . Show ()
def __del__ ( self ):
Bar . __del__ ( self )
def __BuildText ( self ):
self . text = TextLine ()
self . text . SetParent ( self )
self . text . SetPosition ( 4 , 3 )
self . text . Show ()
def SetText ( self , text ):
self . text . SetText ( text )
def SetReadingPosition ( self , x , y ):
xPos = x + 2
yPos = y - self . GetHeight () - 2
self . SetPosition ( xPos , yPos )
def SetTextColor ( self , color ):
self . text . SetPackedFontColor ( color )
def MakeSlotBar ( parent , x , y , width , height ):
slotBar = SlotBar ()
slotBar . SetParent ( parent )
slotBar . SetSize ( width , height )
slotBar . SetPosition ( x , y )
slotBar . Show ()
return slotBar
def MakeImageBox ( parent , name , x , y ):
image = ImageBox ()
image . SetParent ( parent )
image . LoadImage ( name )
image . SetPosition ( x , y )
image . Show ()
return image
def MakeTextLine ( parent ):
textLine = TextLine ()
textLine . SetParent ( parent )
textLine . SetWindowHorizontalAlignCenter ()
textLine . SetWindowVerticalAlignCenter ()
textLine . SetHorizontalAlignCenter ()
textLine . SetVerticalAlignCenter ()
textLine . Show ()
return textLine
def MakeButton ( parent , x , y , tooltipText , path , up , over , down ):
button = Button ()
button . SetParent ( parent )
button . SetPosition ( x , y )
button . SetUpVisual ( path + up )
button . SetOverVisual ( path + over )
button . SetDownVisual ( path + down )
button . SetToolTipText ( tooltipText )
button . Show ()
return button
def RenderRoundBox ( x , y , width , height , color ):
grp . SetColor ( color )
grp . RenderLine ( x + 2 , y , width - 3 , 0 )
grp . RenderLine ( x + 2 , y + height , width - 3 , 0 )
grp . RenderLine ( x , y + 2 , 0 , height - 4 )
grp . RenderLine ( x + width , y + 1 , 0 , height - 3 )
grp . RenderLine ( x , y + 2 , 2 , - 2 )
grp . RenderLine ( x , y + height - 2 , 2 , 2 )
grp . RenderLine ( x + width - 2 , y , 2 , 2 )
grp . RenderLine ( x + width - 2 , y + height , 2 , - 2 )
def GenerateColor ( r , g , b ):
r = float ( r ) / 255.0
g = float ( g ) / 255.0
b = float ( b ) / 255.0
return grp . GenerateColor ( r , g , b , 1.0 )
def EnablePaste ( flag ):
ime . EnablePaste ( flag )
def GetHyperlink ():
return wndMgr . GetHyperlink ()
RegisterToolTipWindow ( "TEXT" , TextLine )
Vielen Dank im Vorraus!
05/06/2015, 15:25
#2
elite*gold: 1
Join Date: May 2015
Posts: 39
Received Thanks: 11
Sieht nach einem Tab Fehler aus.
Wahrscheinlich haste du ein Tab zu viel gemacht.
Falls du dieser Fehler immer noch besteht würde ich dir Raten Hilfe von jemanden zu nehmen. Ansonsten kannst du mich auch gerne unter Skype kontaktieren.
Mit freundlichen Grüßen,
Mercy
05/06/2015, 21:18
#3
elite*gold: 250
Join Date: Feb 2011
Posts: 6,010
Received Thanks: 3,406
Die deinerseits angegebene ui.py hat mit dem besagten Fehler nichts am Hut, der eigentliche Fehler sitzt in der game.py, diese bitte stattdessen anhängen.
lg
05/08/2015, 09:00
#4
elite*gold: 0
Join Date: Nov 2012
Posts: 31
Received Thanks: 4
Hier die game.py hoffe ihr könnt mir helfen
import os
import app
import dbg
import grp
import item
import background
import chr
import chrmgr
import player
import snd
import chat
import textTail
import snd
import net
import effect
import wndMgr
import fly
import systemSetting
import quest
import guild
import skill
import messenger
import locale
import constInfo
import exchange
import ime
import ui
import uiCommon
import uiPhaseCurtain
import uiMapNameShower
import uiAffectShower
import uiPlayerGauge
import uiCharacter
import uiTarget
import day
# PRIVATE_SHOP_PRICE_LIST
import uiPrivateShopBuilder
# END_OF_PRIVATE_SHOP_PRICE_LIST
import mouseModule
import consoleModule
import locale
import playerSettingModule
import interfaceModule
import musicInfo
import debugInfo
import stringCommander
from _weakref import proxy
# TEXTTAIL_LIVINGTIME_CONTROL
#if locale.IsJAPAN():
# app.SetTextTailLivingTime(8.0)
# END_OF_TEXTTAIL_LIVINGTIME_CONTROL
# SCREENSHOT_CWDSAVE
SCREENSHOT_CWDSAVE = FALSE
SCREENSHOT_DIR = None
if locale.IsEUROPE():
SCREENSHOT_CWDSAVE = TRUE
if locale.IsCIBN10():
SCREENSHOT_CWDSAVE = FALSE
SCREENSHOT_DIR = "YT2W"
cameraDistance = 1550.0
cameraPitch = 27.0
cameraRotation = 0.0
cameraHeight = 100.0
testAlignment = 0
class GameWindow(ui.ScriptWindow):
canQuestLettersShow = 1
def __init__(self, stream):
ui.ScriptWindow.__init__(self, "GAME")
self.SetWindowName("game")
net.SetPhaseWindow(net.PHASE_WINDOW_GAME, self)
player.SetGameWindow(self)
self.quickSlotPageIndex = 0
self.lastPKModeSendedTime = 0
self.pressNumber = None
self.guildWarQuestionDialog = None
self.interface = None
self.targetBoard = None
self.console = None
self.mapNameShower = None
self.affectShower = None
self.playerGauge = None
day.nacht = 0
day.tag = 0
self.stream=stream
self.interface = interfaceModule.Interface()
self.interface.MakeInterface()
self.interface.ShowDefaultWindows()
self.curtain = uiPhaseCurtain.PhaseCurtain()
self.curtain.speed = 0.03
self.curtain.Hide()
self.targetBoard = uiTarget.TargetBoard()
self.targetBoard.SetWhisperEvent(ui.__mem_func__(s elf.interface.OpenWhisperDialog))
self.targetBoard.Hide()
self.console = consoleModule.ConsoleWindow()
self.console.BindGameClass(self)
self.console.SetConsoleSize(wndMgr.GetScreenWidth( ), 200)
self.console.Hide()
self.mapNameShower = uiMapNameShower.MapNameShower()
self.affectShower = uiAffectShower.AffectShower()
self.playerGauge = uiPlayerGauge.PlayerGauge(self)
self.playerGauge.Hide()
self.__SetQuickSlotMode()
self.__ServerCommand_Build()
self.__ProcessPreservedServerCommand()
def __del__(self):
player.SetGameWindow(0)
net.ClearPhaseWindow(net.PHASE_WINDOW_GAME, self)
ui.ScriptWindow.__del__(self)
def Open(self):
app.SetFrameSkip(1)
self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
self.quickSlotPageIndex = 0
self.PickingCharacterIndex = -1
self.PickingItemIndex = -1
self.consoleEnable = FALSE
self.isShowDebugInfo = FALSE
self.ShowNameFlag = FALSE
self.enableXMasBoom = FALSE
self.startTimeXMasBoom = 0.0
self.indexXMasBoom = 0
global cameraDistance, cameraPitch, cameraRotation, cameraHeight
app.SetCamera(cameraDistance, cameraPitch, cameraRotation, cameraHeight)
constInfo.SET_DEFAULT_CAMERA_MAX_DISTANCE()
constInfo.SET_DEFAULT_CHRNAME_COLOR()
constInfo.SET_DEFAULT_FOG_LEVEL()
constInfo.SET_DEFAULT_CONVERT_EMPIRE_LANGUAGE_ENAB LE()
constInfo.SET_DEFAULT_USE_ITEM_WEAPON_TABLE_ATTACK _BONUS()
constInfo.SET_DEFAULT_USE_SKILL_EFFECT_ENABLE()
# TWO_HANDED_WEAPON_ATTACK_SPEED_UP
constInfo.SET_TWO_HANDED_WEAPON_ATT_SPEED_DECREASE _VALUE()
# END_OF_TWO_HANDED_WEAPON_ATTACK_SPEED_UP
import event
event.SetLeftTimeString(locale.UI_LEFT_TIME)
textTail.EnablePKTitle(constInfo.PVPMODE_ENABLE)
if constInfo.PVPMODE_TEST_ENABLE:
self.testPKMode = ui.TextLine()
self.testPKMode.SetFontName(locale.UI_DEF_FONT)
self.testPKMode.SetPosition(0, 15)
self.testPKMode.SetWindowHorizontalAlignCenter()
self.testPKMode.SetHorizontalAlignCenter()
self.testPKMode.SetFeather()
self.testPKMode.SetOutline()
self.testPKMode.Show()
self.testAlignment = ui.TextLine()
self.testAlignment.SetFontName(locale.UI_DEF_FONT)
self.testAlignment.SetPosition(0, 35)
self.testAlignment.SetWindowHorizontalAlignCenter( )
self.testAlignment.SetHorizontalAlignCenter()
self.testAlignment.SetFeather()
self.testAlignment.SetOutline()
self.testAlignment.Show()
self.__BuildKeyDict()
self.__BuildDebugInfo()
# PRIVATE_SHOP_PRICE_LIST
uiPrivateShopBuilder.Clear()
# END_OF_PRIVATE_SHOP_PRICE_LIST
# UNKNOWN_UPDATE
exchange.InitTrading()
# END_OF_UNKNOWN_UPDATE
if debugInfo.IsDebugMode():
self.ToggleDebugInfo()
## Sound
snd.SetMusicVolume(systemSetting.GetMusicVolume()* net.GetFieldMusicVolume())
snd.SetSoundVolume(systemSetting.GetSoundVolume())
netFieldMusicFileName = net.GetFieldMusicFileName()
if netFieldMusicFileName:
snd.FadeInMusic("BGM/" + netFieldMusicFileName)
elif musicInfo.fieldMusic != "":
snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
self.__SetQuickSlotMode()
self.__SelectQuickPage(self.quickSlotPageIndex)
self.SetFocus()
self.Show()
app.ShowCursor()
net.SendEnterGamePacket()
# START_GAME_ERROR_EXIT
try:
self.StartGame()
except:
import exception
exception.Abort("GameWindow.Open")
# END_OF_START_GAME_ERROR_EXIT
def Close(self):
self.Hide()
global cameraDistance, cameraPitch, cameraRotation, cameraHeight
(cameraDistance, cameraPitch, cameraRotation, cameraHeight) = app.GetCamera()
if musicInfo.fieldMusic != "":
snd.FadeOutMusic("BGM/"+ musicInfo.fieldMusic)
self.onPressKeyDict = None
self.onClickKeyDict = None
chat.Close()
snd.StopAllSound()
grp.InitScreenEffect()
chr.Destroy()
textTail.Clear()
quest.Clear()
background.Destroy()
guild.Destroy()
messenger.Destroy()
skill.ClearSkillData()
wndMgr.Unlock()
mouseModule.mouseController.DeattachObject()
if self.guildWarQuestionDialog:
self.guildWarQuestionDialog.Close()
self.guildNameBoard = None
self.partyRequestQuestionDialog = None
self.partyInviteQuestionDialog = None
self.guildInviteQuestionDialog = None
self.guildWarQuestionDialog = None
self.messengerAddFriendQuestion = None
# UNKNOWN_UPDATE
self.itemDropQuestionDialog = None
# END_OF_UNKNOWN_UPDATE
# QUEST_CONFIRM
self.confirmDialog = None
# END_OF_QUEST_CONFIRM
self.PrintCoord = None
self.FrameRate = None
self.Pitch = None
self.Splat = None
self.TextureNum = None
self.ObjectNum = None
self.ViewDistance = None
self.ClearDictionary()
self.playerGauge = None
self.mapNameShower = None
self.affectShower = None
if self.console:
self.console.BindGameClass(0)
self.console.Close()
self.console=None
if self.targetBoard:
self.targetBoard.Destroy()
self.targetBoard = None
if self.interface:
self.interface.HideAllWindows()
self.interface.Close()
self.interface=None
player.ClearSkillDict()
player.ResetCameraRotation()
self.KillFocus()
app.HideCursor()
print "---------------------------------------------------------------------------- CLOSE GAME WINDOW"
def __BuildKeyDict(self):
onPressKeyDict = {}
##PressKey 는 누르고 있는 동안 계속 적용되는 키이다.
## 숫자 단축키 퀵슬롯에 이용된다.(이후 숫자들도 퀵 슬롯용 예약)
## F12 는 클라 디버그용 키이므로 쓰지 않는 게 좋다.
onPressKeyDict[app.DIK_1] = lambda : self.__PressNumKey(1)
onPressKeyDict[app.DIK_2] = lambda : self.__PressNumKey(2)
onPressKeyDict[app.DIK_3] = lambda : self.__PressNumKey(3)
onPressKeyDict[app.DIK_4] = lambda : self.__PressNumKey(4)
onPressKeyDict[app.DIK_5] = lambda : self.__PressNumKey(5)
onPressKeyDict[app.DIK_6] = lambda : self.__PressNumKey(6)
onPressKeyDict[app.DIK_7] = lambda : self.__PressNumKey(7)
onPressKeyDict[app.DIK_8] = lambda : self.__PressNumKey(8)
onPressKeyDict[app.DIK_9] = lambda : self.__PressNumKey(9)
onPressKeyDict[app.DIK_F1] = lambda : self.__PressQuickSlot(4)
onPressKeyDict[app.DIK_F2] = lambda : self.__PressQuickSlot(5)
onPressKeyDict[app.DIK_F3] = lambda : self.__PressQuickSlot(6)
onPressKeyDict[app.DIK_F4] = lambda : self.__PressQuickSlot(7)
onPressKeyDict[app.DIK_LALT] = lambda : self.ShowName()
onPressKeyDict[app.DIK_LCONTROL] = lambda : self.ShowMouseImage()
onPressKeyDict[app.DIK_SYSRQ] = lambda : self.SaveScreen()
onPressKeyDict[app.DIK_SPACE] = lambda : self.StartAttack()
#캐릭터 이동키
onPressKeyDict[app.DIK_UP] = lambda : self.MoveUp()
onPressKeyDict[app.DIK_DOWN] = lambda : self.MoveDown()
onPressKeyDict[app.DIK_LEFT] = lambda : self.MoveLeft()
onPressKeyDict[app.DIK_RIGHT] = lambda : self.MoveRight()
onPressKeyDict[app.DIK_W] = lambda : self.MoveUp()
onPressKeyDict[app.DIK_S] = lambda : self.MoveDown()
onPressKeyDict[app.DIK_A] = lambda : self.MoveLeft()
onPressKeyDict[app.DIK_D] = lambda : self.MoveRight()
onPressKeyDict[app.DIK_E] = lambda: app.RotateCamera(app.CAMERA_TO_POSITIVE)
onPressKeyDict[app.DIK_R] = lambda: app.ZoomCamera(app.CAMERA_TO_NEGATIVE)
#onPressKeyDict[app.DIK_F] = lambda: app.ZoomCamera(app.CAMERA_TO_POSITIVE)
onPressKeyDict[app.DIK_T] = lambda: app.PitchCamera(app.CAMERA_TO_NEGATIVE)
onPressKeyDict[app.DIK_G] = self.__PressGKey
onPressKeyDict[app.DIK_Q] = self.__PressQKey
onPressKeyDict[app.DIK_NUMPAD9] = lambda: app.MovieResetCamera()
onPressKeyDict[app.DIK_NUMPAD4] = lambda: app.MovieRotateCamera(app.CAMERA_TO_NEGATIVE)
onPressKeyDict[app.DIK_NUMPAD6] = lambda: app.MovieRotateCamera(app.CAMERA_TO_POSITIVE)
onPressKeyDict[app.DIK_PGUP] = lambda: app.MovieZoomCamera(app.CAMERA_TO_NEGATIVE)
onPressKeyDict[app.DIK_PGDN] = lambda: app.MovieZoomCamera(app.CAMERA_TO_POSITIVE)
onPressKeyDict[app.DIK_NUMPAD8] = lambda: app.MoviePitchCamera(app.CAMERA_TO_NEGATIVE)
onPressKeyDict[app.DIK_NUMPAD2] = lambda: app.MoviePitchCamera(app.CAMERA_TO_POSITIVE)
onPressKeyDict[app.DIK_GRAVE] = lambda : self.PickUpItem()
onPressKeyDict[app.DIK_Z] = lambda : self.PickUpItem()
onPressKeyDict[app.DIK_C] = lambda state = "STATUS": self.interface.ToggleCharacterWindow(state)
onPressKeyDict[app.DIK_V] = lambda state = "SKILL": self.interface.ToggleCharacterWindow(state)
#onPressKeyDict[app.DIK_B] = lambda state = "EMOTICON": self.interface.ToggleCharacterWindow(state)
onPressKeyDict[app.DIK_N] = lambda state = "QUEST": self.interface.ToggleCharacterWindow(state)
onPressKeyDict[app.DIK_I] = lambda : self.interface.ToggleInventoryWindow()
onPressKeyDict[app.DIK_M] = lambda : self.interface.PressMKey()
#onPressKeyDict[app.DIK_H] = lambda : self.interface.OpenHelpWindow()
onPressKeyDict[app.DIK_ADD] = lambda : self.interface.MiniMapScaleUp()
onPressKeyDict[app.DIK_SUBTRACT] = lambda : self.interface.MiniMapScaleDown()
onPressKeyDict[app.DIK_L] = lambda : self.interface.ToggleChatLogWindow()
onPressKeyDict[app.DIK_COMMA] = lambda : self.ShowConsole() # "`" key
onPressKeyDict[app.DIK_LSHIFT] = lambda : self.__SetQuickPageMode()
onPressKeyDict[app.DIK_J] = lambda : self.__PressJKey()
onPressKeyDict[app.DIK_H] = lambda : self.__PressHKey()
onPressKeyDict[app.DIK_B] = lambda : self.__PressBKey()
onPressKeyDict[app.DIK_F] = lambda : self.__PressFKey()
# CUBE_TEST
#onPressKeyDict[app.DIK_K] = lambda : self.interface.OpenCubeWindow()
# CUBE_TEST_END
self.onPressKeyDict = onPressKeyDict
onClickKeyDict = {}
onClickKeyDict[app.DIK_UP] = lambda : self.StopUp()
onClickKeyDict[app.DIK_DOWN] = lambda : self.StopDown()
onClickKeyDict[app.DIK_LEFT] = lambda : self.StopLeft()
onClickKeyDict[app.DIK_RIGHT] = lambda : self.StopRight()
onClickKeyDict[app.DIK_SPACE] = lambda : self.EndAttack()
onClickKeyDict[app.DIK_W] = lambda : self.StopUp()
onClickKeyDict[app.DIK_S] = lambda : self.StopDown()
onClickKeyDict[app.DIK_A] = lambda : self.StopLeft()
onClickKeyDict[app.DIK_D] = lambda : self.StopRight()
onClickKeyDict[app.DIK_Q] = lambda: app.RotateCamera(app.CAMERA_STOP)
onClickKeyDict[app.DIK_E] = lambda: app.RotateCamera(app.CAMERA_STOP)
onClickKeyDict[app.DIK_R] = lambda: app.ZoomCamera(app.CAMERA_STOP)
onClickKeyDict[app.DIK_F] = lambda: app.ZoomCamera(app.CAMERA_STOP)
onClickKeyDict[app.DIK_T] = lambda: app.PitchCamera(app.CAMERA_STOP)
onClickKeyDict[app.DIK_G] = lambda: self.__ReleaseGKey()
onClickKeyDict[app.DIK_NUMPAD4] = lambda: app.MovieRotateCamera(app.CAMERA_STOP)
onClickKeyDict[app.DIK_NUMPAD6] = lambda: app.MovieRotateCamera(app.CAMERA_STOP)
onClickKeyDict[app.DIK_PGUP] = lambda: app.MovieZoomCamera(app.CAMERA_STOP)
onClickKeyDict[app.DIK_PGDN] = lambda: app.MovieZoomCamera(app.CAMERA_STOP)
onClickKeyDict[app.DIK_NUMPAD8] = lambda: app.MoviePitchCamera(app.CAMERA_STOP)
onClickKeyDict[app.DIK_NUMPAD2] = lambda: app.MoviePitchCamera(app.CAMERA_STOP)
onClickKeyDict[app.DIK_LALT] = lambda: self.HideName()
onClickKeyDict[app.DIK_LCONTROL] = lambda: self.HideMouseImage()
onClickKeyDict[app.DIK_LSHIFT] = lambda: self.__SetQuickSlotMode()
#if constInfo.PVPMODE_ACCELKEY_ENABLE:
# onClickKeyDict[app.DIK_B] = lambda: self.ChangePKMode()
self.onClickKeyDict=onClickKeyDict
def __PressNumKey(self,num):
if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
if num >= 1 and num <= 9:
if(chrmgr.IsPossibleEmoticon(-1)):
chrmgr.SetEmoticon(-1,int(num)-1)
net.SendEmoticon(int(num)-1)
else:
if num >= 1 and num <= 4:
self.pressNumber(num-1)
def __ClickBKey(self):
if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
return
else:
if constInfo.PVPMODE_ACCELKEY_ENABLE:
self.ChangePKMode()
def __PressJKey(self):
if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
if player.IsMountingHorse():
net.SendChatPacket("/unmount")
else:
#net.SendChatPacket("/user_horse_ride")
if not uiPrivateShopBuilder.IsBuildingPrivateShop():
for i in xrange(player.INVENTORY_PAGE_SIZE):
if player.GetItemIndex(i) in (71114, 71116, 71118, 71120):
net.SendItemUsePacket(i)
break
def __PressHKey(self):
if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
net.SendChatPacket("/user_horse_ride")
else:
self.interface.OpenHelpWindow()
def __PressBKey(self):
if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
net.SendChatPacket("/user_horse_back")
else:
state = "EMOTICON"
self.interface.ToggleCharacterWindow(state)
def __PressFKey(self):
if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
net.SendChatPacket("/user_horse_feed")
else:
app.ZoomCamera(app.CAMERA_TO_POSITIVE)
def __PressGKey(self):
if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
net.SendChatPacket("/ride")
else:
if self.ShowNameFlag:
self.interface.ToggleGuildWindow()
else:
app.PitchCamera(app.CAMERA_TO_POSITIVE)
def __ReleaseGKey(self):
app.PitchCamera(app.CAMERA_STOP)
def __PressQKey(self):
if app.IsPressed(app.DIK_LCONTROL) or app.IsPressed(app.DIK_RCONTROL):
if 0!=self.canQuestLettersShow:
self.interface.HideAllQuestButton()
self.canQuestLettersShow = 0
else:
self.interface.ShowAllQuestButton()
self.canQuestLettersShow = 1
else:
app.RotateCamera(app.CAMERA_TO_NEGATIVE)
def __SetQuickSlotMode(self):
self.pressNumber=ui.__mem_func__(self.__PressQuick Slot)
def __SetQuickPageMode(self):
self.pressNumber=ui.__mem_func__(self.__SelectQuic kPage)
def __PressQuickSlot(self, localSlotIndex):
player.RequestUseLocalQuickSlot(localSlotIndex)
def __SelectQuickPage(self, pageIndex):
self.quickSlotPageIndex = pageIndex
player.SetQuickPage(pageIndex)
def ToggleDebugInfo(self):
self.isShowDebugInfo = not self.isShowDebugInfo
if self.isShowDebugInfo:
self.PrintCoord.Show()
self.FrameRate.Show()
self.Pitch.Show()
self.Splat.Show()
self.TextureNum.Show()
self.ObjectNum.Show()
self.ViewDistance.Show()
else:
self.PrintCoord.Hide()
self.FrameRate.Hide()
self.Pitch.Hide()
self.Splat.Hide()
self.TextureNum.Hide()
self.ObjectNum.Hide()
self.ViewDistance.Hide()
def __BuildDebugInfo(self):
## Character Position Coordinate
self.PrintCoord = ui.TextLine()
self.PrintCoord.SetFontName(locale.UI_DEF_FONT)
self.PrintCoord.SetPosition(wndMgr.GetScreenWidth( ) - 270, 0)
## Frame Rate
self.FrameRate = ui.TextLine()
self.FrameRate.SetFontName(locale.UI_DEF_FONT)
self.FrameRate.SetPosition(wndMgr.GetScreenWidth() - 270, 20)
## Camera Pitch
self.Pitch = ui.TextLine()
self.Pitch.SetFontName(locale.UI_DEF_FONT)
self.Pitch.SetPosition(wndMgr.GetScreenWidth() - 270, 40)
## Splat
self.Splat = ui.TextLine()
self.Splat.SetFontName(locale.UI_DEF_FONT)
self.Splat.SetPosition(wndMgr.GetScreenWidth() - 270, 60)
# TextureNum
self.TextureNum = ui.TextLine()
self.TextureNum.SetFontName(locale.UI_DEF_FONT)
self.TextureNum.SetPosition(wndMgr.GetScreenWidth( ) - 270, 80)
# 오브젝트 그리는 개수
self.ObjectNum = ui.TextLine()
self.ObjectNum.SetFontName(locale.UI_DEF_FONT)
self.ObjectNum.SetPosition(wndMgr.GetScreenWidth() - 270, 100)
# 시야거리
self.ViewDistance = ui.TextLine()
self.ViewDistance.SetFontName(locale.UI_DEF_FONT)
self.ViewDistance.SetPosition(0, 0)
def __NotifyError(self, msg):
chat.AppendChat(chat.CHAT_TYPE_INFO, msg)
def ChangePKMode(self):
if not app.IsPressed(app.DIK_LCONTROL):
return
if player.GetStatus(player.LEVEL)<constInfo.PVPMODE_P ROTECTED_LEVEL:
self.__NotifyError(locale.OPTION_PVPMODE_PROTECT % (constInfo.PVPMODE_PROTECTED_LEVEL))
return
curTime = app.GetTime()
if curTime - self.lastPKModeSendedTime < constInfo.PVPMODE_ACCELKEY_DELAY:
return
self.lastPKModeSendedTime = curTime
curPKMode = player.GetPKMode()
nextPKMode = curPKMode + 1
if nextPKMode == player.PK_MODE_PROTECT:
if 0 == player.GetGuildID():
chat.AppendChat(chat.CHAT_TYPE_INFO, locale.OPTION_PVPMODE_CANNOT_SET_GUILD_MODE)
nextPKMode = 0
else:
nextPKMode = player.PK_MODE_GUILD
elif nextPKMode == player.PK_MODE_MAX_NUM:
nextPKMode = 0
net.SendChatPacket("/PKMode " + str(nextPKMode))
print "/PKMode " + str(nextPKMode)
def OnChangePKMode(self):
self.interface.OnChangePKMode()
try:
self.__NotifyError(locale.OPTION_PVPMODE_MESSAGE_D ICT[player.GetPKMode()])
except KeyError:
print "UNKNOWN PVPMode[%d]" % (player.GetPKMode())
if constInfo.PVPMODE_TEST_ENABLE:
curPKMode = player.GetPKMode()
alignment, grade = chr.testGetPKData()
self.pkModeNameDict = { 0 : "PEACE", 1 : "REVENGE", 2 : "FREE", 3 : "PROTECT", }
self.testPKMode.SetText("Current PK Mode : " + self.pkModeNameDict.get(curPKMode, "UNKNOWN"))
self.testAlignment.SetText("Current Alignment : " + str(alignment) + " (" + locale.TITLE_NAME_LIST[grade] + ")")
################################################## #############################################
################################################## #############################################
## Game Callback Functions
# Start
def StartGame(self):
self.RefreshInventory()
self.RefreshEquipment()
self.RefreshCharacter()
self.RefreshSkill()
# Refresh
def CheckGameButton(self):
if self.interface:
self.interface.CheckGameButton()
def RefreshAlignment(self):
self.interface.RefreshAlignment()
def RefreshStatus(self):
self.CheckGameButton()
if self.interface:
self.interface.RefreshStatus()
if self.playerGauge:
self.playerGauge.RefreshGauge()
def RefreshStamina(self):
self.interface.RefreshStamina()
def RefreshSkill(self):
self.CheckGameButton()
if self.interface:
self.interface.RefreshSkill()
def RefreshQuest(self):
self.interface.RefreshQuest()
def RefreshMessenger(self):
self.interface.RefreshMessenger()
def RefreshGuildInfoPage(self):
self.interface.RefreshGuildInfoPage()
def RefreshGuildBoardPage(self):
self.interface.RefreshGuildBoardPage()
def RefreshGuildMemberPage(self):
self.interface.RefreshGuildMemberPage()
def RefreshGuildMemberPageGradeComboBox(self):
self.interface.RefreshGuildMemberPageGradeComboBox ()
def RefreshGuildSkillPage(self):
self.interface.RefreshGuildSkillPage()
def RefreshGuildGradePage(self):
self.interface.RefreshGuildGradePage()
def RefreshMobile(self):
if self.interface:
self.interface.RefreshMobile()
def OnMobileAuthority(self):
self.interface.OnMobileAuthority()
def OnBlockMode(self, mode):
self.interface.OnBlockMode(mode)
def OpenQuestWindow(self, skin, idx):
self.interface.OpenQuestWindow(skin, idx)
def AskGuildName(self):
guildNameBoard = uiCommon.InputDialog()
guildNameBoard.SetTitle(locale.GUILD_NAME)
guildNameBoard.SetAcceptEvent(ui.__mem_func__(self .ConfirmGuildName))
guildNameBoard.SetCancelEvent(ui.__mem_func__(self .CancelGuildName))
guildNameBoard.Open()
self.guildNameBoard = guildNameBoard
def ConfirmGuildName(self):
guildName = self.guildNameBoard.GetText()
if not guildName:
return
if net.IsInsultIn(guildName):
self.PopupMessage(locale.GUILD_CREATE_ERROR_INSULT _NAME)
return
net.SendAnswerMakeGuildPacket(guildName)
self.guildNameBoard.Close()
self.guildNameBoard = None
return TRUE
def CancelGuildName(self):
self.guildNameBoard.Close()
self.guildNameBoard = None
return TRUE
## Refine
def PopupMessage(self, msg):
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(msg, 0, locale.UI_OK)
def OpenRefineDialog(self, targetItemPos, nextGradeItemVnum, cost, prob, type=0):
self.interface.OpenRefineDialog(targetItemPos, nextGradeItemVnum, cost, prob, type)
def AppendMaterialToRefineDialog(self, vnum, count):
self.interface.AppendMaterialToRefineDialog(vnum, count)
def RunUseSkillEvent(self, slotIndex, coolTime):
self.interface.OnUseSkill(slotIndex, coolTime)
def ClearAffects(self):
self.affectShower.ClearAffects()
def SetAffect(self, affect):
self.affectShower.SetAffect(affect)
def ResetAffect(self, affect):
self.affectShower.ResetAffect(affect)
# UNKNOWN_UPDATE
def BINARY_NEW_AddAffect(self, type, pointIdx, value, duration):
self.affectShower.BINARY_NEW_AddAffect(type, pointIdx, value, duration)
def BINARY_NEW_RemoveAffect(self, type, pointIdx):
self.affectShower.BINARY_NEW_RemoveAffect(type, pointIdx)
# END_OF_UNKNOWN_UPDATE
def ActivateSkillSlot(self, slotIndex):
if self.interface:
self.interface.OnActivateSkill(slotIndex)
def DeactivateSkillSlot(self, slotIndex):
if self.interface:
self.interface.OnDeactivateSkill(slotIndex)
def RefreshEquipment(self):
if self.interface:
self.interface.RefreshInventory()
def RefreshInventory(self):
if self.interface:
self.interface.RefreshInventory()
def RefreshCharacter(self):
if self.interface:
self.interface.RefreshCharacter()
def OnGameOver(self):
self.CloseTargetBoard()
self.OpenRestartDialog()
def OpenRestartDialog(self):
self.interface.OpenRestartDialog()
def ChangeCurrentSkill(self, skillSlotNumber):
self.interface.OnChangeCurrentSkill(skillSlotNumbe r)
## TargetBoard
def SetPCTargetBoard(self, vid, name):
self.targetBoard.Open(vid, name)
def RefreshTargetBoardByVID(self, vid):
self.targetBoard.RefreshByVID(vid)
def RefreshTargetBoardByName(self, name):
self.targetBoard.RefreshByName(name)
def __RefreshTargetBoard(self):
self.targetBoard.Refresh()
def SetHPTargetBoard(self, vid, hpPercentage):
if vid != self.targetBoard.GetTargetVID():
self.targetBoard.ResetTargetBoard()
self.targetBoard.SetEnemyVID(vid)
self.targetBoard.SetHP(hpPercentage)
self.targetBoard.Show()
def CloseTargetBoardIfDifferent(self, vid):
if vid != self.targetBoard.GetTargetVID():
self.targetBoard.Close()
def CloseTargetBoard(self):
self.targetBoard.Close()
## View Equipment
def OpenEquipmentDialog(self, vid):
self.interface.OpenEquipmentDialog(vid)
def SetEquipmentDialogItem(self, vid, slotIndex, vnum, count):
self.interface.SetEquipmentDialogItem(vid, slotIndex, vnum, count)
def SetEquipmentDialogSocket(self, vid, slotIndex, socketIndex, value):
self.interface.SetEquipmentDialogSocket(vid, slotIndex, socketIndex, value)
def SetEquipmentDialogAttr(self, vid, slotIndex, attrIndex, type, value):
self.interface.SetEquipmentDialogAttr(vid, slotIndex, attrIndex, type, value)
# SHOW_LOCAL_MAP_NAME
def ShowMapName(self, mapName, x, y):
if self.mapNameShower:
self.mapNameShower.ShowMapName(mapName, x, y)
if self.interface:
self.interface.SetMapName(mapName)
# END_OF_SHOW_LOCAL_MAP_NAME
def BINARY_OpenAtlasWindow(self):
self.interface.BINARY_OpenAtlasWindow()
## Chat
def OnRecvWhisper(self, mode, name, line):
if mode == chat.WHISPER_TYPE_GM:
self.interface.RegisterGameMasterName(name)
chat.AppendWhisper(mode, name, line)
self.interface.RecvWhisper(name)
def OnRecvWhisperSystemMessage(self, mode, name, line):
chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, line)
self.interface.RecvWhisper(name)
def OnRecvWhisperError(self, mode, name, line):
if locale.WHISPER_ERROR.has_key(mode):
chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, locale.WHISPER_ERROR[mode](name))
else:
chat.AppendWhisper(chat.WHISPER_TYPE_SYSTEM, name, "Whisper Unknown Error(mode=%d, name=%s)" % (mode, name))
self.interface.RecvWhisper(name)
def RecvWhisper(self, name):
self.interface.RecvWhisper(name)
def OnPickMoney(self, money):
chat.AppendChat(chat.CHAT_TYPE_INFO, locale.GAME_PICK_MONEY % (money))
def OnShopError(self, type):
try:
self.PopupMessage(locale.SHOP_ERROR_DICT[type])
except KeyError:
self.PopupMessage(locale.SHOP_ERROR_UNKNOWN % (type))
def OnSafeBoxError(self):
self.PopupMessage(locale.SAFEBOX_ERROR)
def OnFishingSuccess(self, isFish, fishName):
chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, locale.FISHING_SUCCESS(isFish, fishName), 2000)
# ADD_FISHING_MESSAGE
def OnFishingNotifyUnknown(self):
chat.AppendChat(chat.CHAT_TYPE_INFO, locale.FISHING_UNKNOWN)
def OnFishingWrongPlace(self):
chat.AppendChat(chat.CHAT_TYPE_INFO, locale.FISHING_WRONG_PLACE)
# END_OF_ADD_FISHING_MESSAGE
def OnFishingNotify(self, isFish, fishName):
chat.AppendChat(chat.CHAT_TYPE_INFO, locale.FISHING_NOTIFY(isFish, fishName))
def OnFishingFailure(self):
chat.AppendChatWithDelay(chat.CHAT_TYPE_INFO, locale.FISHING_FAILURE, 2000)
def OnCannotPickItem(self):
chat.AppendChat(chat.CHAT_TYPE_INFO, locale.GAME_CANNOT_PICK_ITEM)
# MINING
def OnCannotMining(self):
chat.AppendChat(chat.CHAT_TYPE_INFO, locale.GAME_CANNOT_MINING)
# END_OF_MINING
def OnCannotUseSkill(self, vid, type):
if locale.USE_SKILL_ERROR_TAIL_DICT.has_key(type):
textTail.RegisterInfoTail(vid, locale.USE_SKILL_ERROR_TAIL_DICT[type])
if locale.USE_SKILL_ERROR_CHAT_DICT.has_key(type):
chat.AppendChat(chat.CHAT_TYPE_INFO, locale.USE_SKILL_ERROR_CHAT_DICT[type])
def OnCannotShotError(self, vid, type):
textTail.RegisterInfoTail(vid, locale.SHOT_ERROR_TAIL_DICT.get(type, locale.SHOT_ERROR_UNKNOWN % (type)))
## PointReset
def StartPointReset(self):
self.interface.OpenPointResetDialog()
## Shop
def StartShop(self, vid):
self.interface.OpenShopDialog(vid)
def EndShop(self):
self.interface.CloseShopDialog()
def RefreshShop(self):
self.interface.RefreshShopDialog()
def SetShopSellingPrice(self, Price):
pass
## Exchange
def StartExchange(self):
self.interface.StartExchange()
def EndExchange(self):
self.interface.EndExchange()
def RefreshExchange(self):
self.interface.RefreshExchange()
## Party
def RecvPartyInviteQuestion(self, leaderVID, leaderName):
partyInviteQuestionDialog = uiCommon.QuestionDialog()
partyInviteQuestionDialog.SetText(leaderName + locale.PARTY_DO_YOU_JOIN)
partyInviteQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.AnswerPartyInvite(arg))
partyInviteQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.AnswerPartyInvite(arg))
partyInviteQuestionDialog.Open()
partyInviteQuestionDialog.partyLeaderVID = leaderVID
self.partyInviteQuestionDialog = partyInviteQuestionDialog
def AnswerPartyInvite(self, answer):
if not self.partyInviteQuestionDialog:
return
partyLeaderVID = self.partyInviteQuestionDialog.partyLeaderVID
distance = player.GetCharacterDistance(partyLeaderVID)
if distance < 0.0 or distance > 5000:
answer = FALSE
net.SendPartyInviteAnswerPacket(partyLeaderVID, answer)
self.partyInviteQuestionDialog.Close()
self.partyInviteQuestionDialog = None
def AddPartyMember(self, pid, name):
self.interface.AddPartyMember(pid, name)
def UpdatePartyMemberInfo(self, pid):
self.interface.UpdatePartyMemberInfo(pid)
def RemovePartyMember(self, pid):
self.interface.RemovePartyMember(pid)
self.__RefreshTargetBoard()
def LinkPartyMember(self, pid, vid):
self.interface.LinkPartyMember(pid, vid)
def UnlinkPartyMember(self, pid):
self.interface.UnlinkPartyMember(pid)
def UnlinkAllPartyMember(self):
self.interface.UnlinkAllPartyMember()
def ExitParty(self):
self.interface.ExitParty()
self.RefreshTargetBoardByVID(self.targetBoard.GetT argetVID())
def ChangePartyParameter(self, distributionMode):
self.interface.ChangePartyParameter(distributionMo de)
## Messenger
def OnMessengerAddFriendQuestion(self, name):
messengerAddFriendQuestion = uiCommon.QuestionDialog2()
messengerAddFriendQuestion.SetText1(locale.MESSENG ER_DO_YOU_ACCEPT_ADD_FRIEND_1 % (name))
messengerAddFriendQuestion.SetText2(locale.MESSENG ER_DO_YOU_ACCEPT_ADD_FRIEND_2)
messengerAddFriendQuestion.SetAcceptEvent(ui.__mem _func__(self.OnAcceptAddFriend))
messengerAddFriendQuestion.SetCancelEvent(ui.__mem _func__(self.OnDenyAddFriend))
messengerAddFriendQuestion.Open()
messengerAddFriendQuestion.name = name
self.messengerAddFriendQuestion = messengerAddFriendQuestion
def OnAcceptAddFriend(self):
name = self.messengerAddFriendQuestion.name
net.SendChatPacket("/messenger_auth y " + name)
self.OnCloseAddFriendQuestionDialog()
return TRUE
def OnDenyAddFriend(self):
name = self.messengerAddFriendQuestion.name
net.SendChatPacket("/messenger_auth n " + name)
self.OnCloseAddFriendQuestionDialog()
return TRUE
def OnCloseAddFriendQuestionDialog(self):
self.messengerAddFriendQuestion.Close()
self.messengerAddFriendQuestion = None
return TRUE
## SafeBox
def OpenSafeboxWindow(self, size):
self.interface.OpenSafeboxWindow(size)
def RefreshSafebox(self):
self.interface.RefreshSafebox()
def RefreshSafeboxMoney(self):
self.interface.RefreshSafeboxMoney()
# ITEM_MALL
def OpenMallWindow(self, size):
self.interface.OpenMallWindow(size)
def RefreshMall(self):
self.interface.RefreshMall()
# END_OF_ITEM_MALL
## Guild
def RecvGuildInviteQuestion(self, guildID, guildName):
guildInviteQuestionDialog = uiCommon.QuestionDialog()
guildInviteQuestionDialog.SetText(guildName + locale.GUILD_DO_YOU_JOIN)
guildInviteQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.AnswerGuildInvite(arg))
guildInviteQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.AnswerGuildInvite(arg))
guildInviteQuestionDialog.Open()
guildInviteQuestionDialog.guildID = guildID
self.guildInviteQuestionDialog = guildInviteQuestionDialog
def AnswerGuildInvite(self, answer):
if not self.guildInviteQuestionDialog:
return
guildLeaderVID = self.guildInviteQuestionDialog.guildID
net.SendGuildInviteAnswerPacket(guildLeaderVID, answer)
self.guildInviteQuestionDialog.Close()
self.guildInviteQuestionDialog = None
def DeleteGuild(self):
self.interface.DeleteGuild()
## Clock
def ShowClock(self, second):
self.interface.ShowClock(second)
def HideClock(self):
self.interface.HideClock()
## Emotion
def BINARY_ActEmotion(self, emotionIndex):
if self.interface.wndCharacter:
self.interface.wndCharacter.ActEmotion(emotionInde x)
################################################## #############################################
################################################## #############################################
## Keyboard Functions
def CheckFocus(self):
if FALSE == self.IsFocus():
if TRUE == self.interface.IsOpenChat():
self.interface.ToggleChat()
self.SetFocus()
def SaveScreen(self):
print "save screen"
# SCREENSHOT_CWDSAVE
if SCREENSHOT_CWDSAVE:
if not os.path.exists(os.getcwd()+os.sep+"screenshot"):
os.mkdir(os.getcwd()+os.sep+"screenshot")
(succeeded, name) = grp.SaveScreenShotToPath(os.getcwd()+os.sep+"scree nshot"+os.sep)
elif SCREENSHOT_DIR:
(succeeded, name) = grp.SaveScreenShot(SCREENSHOT_DIR)
else:
(succeeded, name) = grp.SaveScreenShot()
# END_OF_SCREENSHOT_CWDSAVE
if succeeded:
pass
"""
chat.AppendChat(chat.CHAT_TYPE_INFO, name + locale.SCREENSHOT_SAVE1)
chat.AppendChat(chat.CHAT_TYPE_INFO, locale.SCREENSHOT_SAVE2)
"""
else:
chat.AppendChat(chat.CHAT_TYPE_INFO, locale.SCREENSHOT_SAVE_FAILURE)
def ShowConsole(self):
if debugInfo.IsDebugMode() or TRUE == self.consoleEnable:
player.EndKeyWalkingImmediately()
self.console.OpenWindow()
def ShowName(self):
self.ShowNameFlag = TRUE
self.playerGauge.EnableShowAlways()
player.SetQuickPage(self.quickSlotPageIndex+1)
# ADD_ALWAYS_SHOW_NAME
def __IsShowName(self):
if systemSetting.IsAlwaysShowName():
return TRUE
if self.ShowNameFlag:
return TRUE
return FALSE
# END_OF_ADD_ALWAYS_SHOW_NAME
def HideName(self):
self.ShowNameFlag = FALSE
self.playerGauge.DisableShowAlways()
player.SetQuickPage(self.quickSlotPageIndex)
def ShowMouseImage(self):
self.interface.ShowMouseImage()
def HideMouseImage(self):
self.interface.HideMouseImage()
def StartAttack(self):
player.SetAttackKeyState(TRUE)
def EndAttack(self):
player.SetAttackKeyState(FALSE)
def MoveUp(self):
player.SetSingleDIKKeyState(app.DIK_UP, TRUE)
def MoveDown(self):
player.SetSingleDIKKeyState(app.DIK_DOWN, TRUE)
def MoveLeft(self):
player.SetSingleDIKKeyState(app.DIK_LEFT, TRUE)
def MoveRight(self):
player.SetSingleDIKKeyState(app.DIK_RIGHT, TRUE)
def StopUp(self):
player.SetSingleDIKKeyState(app.DIK_UP, FALSE)
def StopDown(self):
player.SetSingleDIKKeyState(app.DIK_DOWN, FALSE)
def StopLeft(self):
player.SetSingleDIKKeyState(app.DIK_LEFT, FALSE)
def StopRight(self):
player.SetSingleDIKKeyState(app.DIK_RIGHT, FALSE)
def PickUpItem(self):
player.PickCloseItem()
################################################## #############################################
################################################## #############################################
## Event Handler
def OnKeyDown(self, key):
if self.interface.wndWeb and self.interface.wndWeb.IsShow():
return
constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(0)
try:
self.onPressKeyDict[key]()
except KeyError:
pass
except:
raise
return TRUE
def OnKeyUp(self, key):
try:
self.onClickKeyDict[key]()
except KeyError:
pass
except:
raise
return TRUE
def OnMouseLeftButtonDown(self):
if self.interface.BUILD_OnMouseLeftButtonDown():
return
if mouseModule.mouseController.isAttached():
self.CheckFocus()
else:
hyperlink = ui.GetHyperlink()
if hyperlink:
return
else:
self.CheckFocus()
player.SetMouseState(player.MBT_LEFT, player.MBS_PRESS);
return TRUE
def OnMouseLeftButtonUp(self):
if self.interface.BUILD_OnMouseLeftButtonUp():
return
if mouseModule.mouseController.isAttached():
attachedType = mouseModule.mouseController.GetAttachedType()
attachedItemIndex = mouseModule.mouseController.GetAttachedItemIndex()
attachedItemSlotPos = mouseModule.mouseController.GetAttachedSlotNumber( )
attachedItemCount = mouseModule.mouseController.GetAttachedItemCount()
## QuickSlot
if player.SLOT_TYPE_QUICK_SLOT == attachedType:
player.RequestDeleteGlobalQuickSlot(attachedItemSl otPos)
## Inventory
elif player.SLOT_TYPE_INVENTORY == attachedType:
if player.ITEM_MONEY == attachedItemIndex:
self.__PutMoney(attachedType, attachedItemCount, self.PickingCharacterIndex)
else:
self.__PutItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, self.PickingCharacterIndex)
mouseModule.mouseController.DeattachObject()
else:
hyperlink = ui.GetHyperlink()
if hyperlink:
if app.IsPressed(app.DIK_LALT):
link = chat.GetLinkFromHyperlink(hyperlink)
ime.PasteString(link)
else:
self.interface.MakeHyperlinkTooltip(hyperlink)
return
else:
player.SetMouseState(player.MBT_LEFT, player.MBS_CLICK)
#player.EndMouseWalking()
return TRUE
def __PutItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount, dstChrID):
if TRUE == chr.HasInstance(self.PickingCharacterIndex) and player.GetMainCharacterIndex() != dstChrID:
if player.IsEquipmentSlot(attachedItemSlotPos):
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(locale.EXCHANGE_FAILU RE_EQUIP_ITEM, 0, locale.UI_OK)
else:
if chr.IsNPC(dstChrID):
net.SendGiveItemPacket(dstChrID, attachedItemSlotPos, attachedItemCount)
else:
net.SendExchangeStartPacket(dstChrID)
net.SendExchangeItemAddPacket(attachedItemSlotPos, 0)
else:
self.__DropItem(attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount)
def __PutMoney(self, attachedType, attachedMoney, dstChrID):
if TRUE == chr.HasInstance(dstChrID) and player.GetMainCharacterIndex() != dstChrID:
net.SendExchangeStartPacket(dstChrID)
net.SendExchangeElkAddPacket(attachedMoney)
else:
self.__DropMoney(attachedType, attachedMoney)
def __DropMoney(self, attachedType, attachedMoney):
# PRIVATESHOP_DISABLE_ITEM_DROP - 개인상점 열고 있는 동안 아이템 버림 방지
if uiPrivateShopBuilder.IsBuildingPrivateShop():
chat.AppendChat(chat.CHAT_TYPE_INFO, locale.DROP_ITEM_FAILURE_PRIVATE_SHOP)
return
# END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
if attachedMoney>=1000:
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(locale.DROP_MONEY_FAI LURE_1000_OVER, 0, locale.UI_OK)
return
itemDropQuestionDialog = uiCommon.QuestionDialog()
itemDropQuestionDialog.SetText(locale.DO_YOU_DROP_ MONEY % (attachedMoney))
itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
itemDropQuestionDialog.Open()
itemDropQuestionDialog.dropType = attachedType
itemDropQuestionDialog.dropCount = attachedMoney
itemDropQuestionDialog.dropNumber = player.ITEM_MONEY
self.itemDropQuestionDialog = itemDropQuestionDialog
def __DropItem(self, attachedType, attachedItemIndex, attachedItemSlotPos, attachedItemCount):
# PRIVATESHOP_DISABLE_ITEM_DROP - 개인상점 열고 있는 동안 아이템 버림 방지
if uiPrivateShopBuilder.IsBuildingPrivateShop():
chat.AppendChat(chat.CHAT_TYPE_INFO, locale.DROP_ITEM_FAILURE_PRIVATE_SHOP)
return
# END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
if player.IsEquipmentSlot(attachedItemSlotPos):
self.stream.popupWindow.Close()
self.stream.popupWindow.Open(locale.DROP_ITEM_FAIL URE_EQUIP_ITEM, 0, locale.UI_OK)
else:
dropItemIndex = player.GetItemIndex(attachedItemSlotPos)
item.SelectItem(dropItemIndex)
dropItemName = item.GetItemName()
## Question Text
questionText = locale.HOW_MANY_ITEM_DO_YOU_DROP(dropItemName, attachedItemCount)
## Dialog
itemDropQuestionDialog = uiCommon.QuestionDialog()
itemDropQuestionDialog.SetText(questionText)
itemDropQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.RequestDropItem(arg))
itemDropQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.RequestDropItem(arg))
itemDropQuestionDialog.Open()
itemDropQuestionDialog.dropType = attachedType
itemDropQuestionDialog.dropNumber = attachedItemSlotPos
itemDropQuestionDialog.dropCount = attachedItemCount
self.itemDropQuestionDialog = itemDropQuestionDialog
constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(1)
def RequestDropItem(self, answer):
if not self.itemDropQuestionDialog:
return
if answer:
dropType = self.itemDropQuestionDialog.dropType
dropCount = self.itemDropQuestionDialog.dropCount
dropNumber = self.itemDropQuestionDialog.dropNumber
if player.SLOT_TYPE_INVENTORY == dropType:
if dropNumber == player.ITEM_MONEY:
net.SendGoldDropPacketNew(dropCount)
snd.PlaySound("sound/ui/money.wav")
else:
# PRIVATESHOP_DISABLE_ITEM_DROP
self.__SendDropItemPacket(dropNumber, dropCount)
# END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
self.itemDropQuestionDialog.Close()
self.itemDropQuestionDialog = None
constInfo.SET_ITEM_DROP_QUESTION_DIALOG_STATUS(0)
# PRIVATESHOP_DISABLE_ITEM_DROP
def __SendDropItemPacket(self, itemVNum, itemCount):
if uiPrivateShopBuilder.IsBuildingPrivateShop():
chat.AppendChat(chat.CHAT_TYPE_INFO, locale.DROP_ITEM_FAILURE_PRIVATE_SHOP)
return
net.SendItemDropPacketNew(itemVNum, itemCount)
# END_OF_PRIVATESHOP_DISABLE_ITEM_DROP
def OnMouseRightButtonDown(self):
self.CheckFocus()
if TRUE == mouseModule.mouseController.isAttached():
mouseModule.mouseController.DeattachObject()
else:
player.SetMouseState(player.MBT_RIGHT, player.MBS_PRESS)
return TRUE
def OnMouseRightButtonUp(self):
if TRUE == mouseModule.mouseController.isAttached():
return TRUE
player.SetMouseState(player.MBT_RIGHT, player.MBS_CLICK)
return TRUE
def OnMouseMiddleButtonDown(self):
player.SetMouseMiddleButtonState(player.MBS_PRESS)
def OnMouseMiddleButtonUp(self):
player.SetMouseMiddleButtonState(player.MBS_CLICK)
def OnUpdate(self):
app.UpdateGame()
if self.mapNameShower.IsShow():
self.mapNameShower.Update()
if self.isShowDebugInfo:
self.UpdateDebugInfo()
if self.enableXMasBoom:
self.__XMasBoom_Update()
self.interface.BUILD_OnUpdate()
self.day_night()
def UpdateDebugInfo(self):
#
# 캐릭터 좌표 및 FPS 출력
(x, y, z) = player.GetMainCharacterPosition()
nUpdateTime = app.GetUpdateTime()
nUpdateFPS = app.GetUpdateFPS()
nRenderFPS = app.GetRenderFPS()
nFaceCount = app.GetFaceCount()
fFaceSpeed = app.GetFaceSpeed()
nST=background.GetRenderShadowTime()
(fAveRT, nCurRT) = app.GetRenderTime()
(iNum, fFogStart, fFogEnd, fFarCilp) = background.GetDistanceSetInfo()
(iPatch, iSplat, fSplatRatio, sTextureNum) = background.GetRenderedSplatNum()
if iPatch == 0:
iPatch = 1
#(dwRenderedThing, dwRenderedCRC) = background.GetRenderedGraphicThingInstanceNum()
self.PrintCoord.SetText("Coordinate: %.2f %.2f %.2f ATM: %d" % (x, y, z, app.GetAvailableTextureMemory()/(1024*1024)))
self.FrameRate.SetText("UFPS: %3d UT: %3d FS %.2f" % (nUpdateFPS, nUpdateTime, fFaceSpeed))
if fAveRT>1.0:
self.Pitch.SetText("RFPS: %3d RT:%.2f(%3d) FC: %d(%.2f) " % (nRenderFPS, fAveRT, nCurRT, nFaceCount, nFaceCount/fAveRT))
self.Splat.SetText("PATCH: %d SPLAT: %d BAD(%.2f)" % (iPatch, iSplat, fSplatRatio))
#self.Pitch.SetText("Pitch: %.2f" % (app.GetCameraPitch())
#self.TextureNum.SetText("TN : %s" % (sTextureNum))
#self.ObjectNum.SetText("GTI : %d, CRC : %d" % (dwRenderedThing, dwRenderedCRC))
self.ViewDistance.SetText("Num : %d, FS : %f, FE : %f, FC : %f" % (iNum, fFogStart, fFogEnd, fFarCilp))
def OnRender(self):
app.RenderGame()
if self.console.Console.collision:
background.RenderCollision()
chr.RenderCollision()
(x, y) = app.GetCursorPosition()
########################
# Picking
########################
textTail.UpdateAllTextTail()
if TRUE == wndMgr.IsPickedWindow(self.hWnd):
self.PickingCharacterIndex = chr.Pick()
if -1 != self.PickingCharacterIndex:
textTail.ShowCharacterTextTail(self.PickingCharact erIndex)
if 0 != self.targetBoard.GetTargetVID():
textTail.ShowCharacterTextTail(self.targetBoard.Ge tTargetVID())
# ADD_ALWAYS_SHOW_NAME
if not self.__IsShowName():
self.PickingItemIndex = item.Pick()
if -1 != self.PickingItemIndex:
textTail.ShowItemTextTail(self.PickingItemIndex)
# END_OF_ADD_ALWAYS_SHOW_NAME
## Show all name in the range
# ADD_ALWAYS_SHOW_NAME
if self.__IsShowName():
textTail.ShowAllTextTail()
self.PickingItemIndex = textTail.Pick(x, y)
# END_OF_ADD_ALWAYS_SHOW_NAME
textTail.UpdateShowingTextTail()
textTail.ArrangeTextTail()
if -1 != self.PickingItemIndex:
textTail.SelectItemName(self.PickingItemIndex)
grp.PopState()
grp.SetInterfaceRenderState()
textTail.Render()
textTail.HideAllTextTail()
def OnPressEscapeKey(self):
if app.TARGET == app.GetCursor():
app.SetCursor(app.NORMAL)
elif TRUE == mouseModule.mouseController.isAttached():
mouseModule.mouseController.DeattachObject()
else:
self.interface.OpenSystemDialog()
return TRUE
def OnIMEReturn(self):
if app.IsPressed(app.DIK_LSHIFT):
self.interface.OpenWhisperDialogWithoutTarget()
else:
self.interface.ToggleChat()
return TRUE
def OnPressExitKey(self):
self.interface.ToggleSystemDialog()
return TRUE
## BINARY CALLBACK
################################################## ####################################
# WEDDING
def BINARY_LoverInfo(self, name, lovePoint):
if self.interface.wndMessenger:
self.interface.wndMessenger.OnAddLover(name, lovePoint)
if self.affectShower:
self.affectShower.SetLoverInfo(name, lovePoint)
def BINARY_UpdateLovePoint(self, lovePoint):
if self.interface.wndMessenger:
self.interface.wndMessenger.OnUpdateLovePoint(love Point)
if self.affectShower:
self.affectShower.OnUpdateLovePoint(lovePoint)
# END_OF_WEDDING
# QUEST_CONFIRM
def BINARY_OnQuestConfirm(self, msg, timeout, pid):
confirmDialog = uiCommon.QuestionDialogWithTimeLimit()
confirmDialog.Open(msg, timeout)
confirmDialog.SetAcceptEvent(lambda answer=TRUE, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide())
confirmDialog.SetCancelEvent(lambda answer=FALSE, pid=pid: net.SendQuestConfirmPacket(answer, pid) or self.confirmDialog.Hide())
self.confirmDialog = confirmDialog
# END_OF_QUEST_CONFIRM
# CUBE
def BINARY_Cube_Open(self):
self.interface.OpenCubeWindow()
def BINARY_Cube_Close(self):
self.interface.CloseCubeWindow()
def BINARY_Cube_Succeed(self, itemVnum, count):
print "큐브 제작 성공"
self.interface.SucceedCubeWork(itemVnum, count)
pass
def BINARY_Cube_Failed(self):
print "큐브 제작 실패"
#self.PopupMessage(locale.CUBE_FAILURE)
pass
# END_OF_CUBE
def BINARY_SetBigMessage(self, message):
self.interface.bigBoard.SetTip(message)
def BINARY_SetTipMessage(self, message):
self.interface.tipBoard.SetTip(message)
def BINARY_AppendNotifyMessage(self, type):
if not type in locale.NOTIFY_MESSAGE:
return
chat.AppendChat(chat.CHAT_TYPE_INFO, locale.NOTIFY_MESSAGE[type])
def BINARY_Guild_EnterGuildArea(self, areaID):
self.interface.BULID_EnterGuildArea(areaID)
def BINARY_Guild_ExitGuildArea(self, areaID):
self.interface.BULID_ExitGuildArea(areaID)
def BINARY_GuildWar_OnSendDeclare(self, guildID):
pass
def BINARY_GuildWar_OnRecvDeclare(self, guildID, warType):
mainCharacterName = player.GetMainCharacterName()
masterName = guild.GetGuildMasterName()
if mainCharacterName == masterName:
self.__GuildWar_OpenAskDialog(guildID, warType)
def BINARY_GuildWar_OnRecvPoint(self, gainGuildID, opponentGuildID, point):
self.interface.OnRecvGuildWarPoint(gainGuildID, opponentGuildID, point)
def BINARY_GuildWar_OnStart(self, guildSelf, guildOpp):
self.interface.OnStartGuildWar(guildSelf, guildOpp)
def BINARY_GuildWar_OnEnd(self, guildSelf, guildOpp):
self.interface.OnEndGuildWar(guildSelf, guildOpp)
def BINARY_BettingGuildWar_SetObserverMode(self, isEnable):
self.interface.BINARY_SetObserverMode(isEnable)
def BINARY_BettingGuildWar_UpdateObserverCount(self, observerCount):
self.interface.wndMiniMap.UpdateObserverCount(obse rverCount)
def __GuildWar_UpdateMemberCount(self, guildID1, memberCount1, guildID2, memberCount2, observerCount):
guildID1 = int(guildID1)
guildID2 = int(guildID2)
memberCount1 = int(memberCount1)
memberCount2 = int(memberCount2)
observerCount = int(observerCount)
self.interface.UpdateMemberCount(guildID1, memberCount1, guildID2, memberCount2)
self.interface.wndMiniMap.UpdateObserverCount(obse rverCount)
def __GuildWar_OpenAskDialog(self, guildID, warType):
guildName = guild.GetGuildName(guildID)
# REMOVED_GUILD_BUG_FIX
if "Noname" == guildName:
return
# END_OF_REMOVED_GUILD_BUG_FIX
import uiGuild
questionDialog = uiGuild.AcceptGuildWarDialog()
questionDialog.SAFE_SetAcceptEvent(self.__GuildWar _OnAccept)
questionDialog.SAFE_SetCancelEvent(self.__GuildWar _OnDecline)
questionDialog.Open(guildName, warType)
self.guildWarQuestionDialog = questionDialog
def __GuildWar_CloseAskDialog(self):
self.guildWarQuestionDialog.Close()
self.guildWarQuestionDialog = None
def __GuildWar_OnAccept(self):
guildName = self.guildWarQuestionDialog.GetGuildName()
net.SendChatPacket("/war " + guildName)
self.__GuildWar_CloseAskDialog()
return 1
def __GuildWar_OnDecline(self):
guildName = self.guildWarQuestionDialog.GetGuildName()
net.SendChatPacket("/nowar " + guildName)
self.__GuildWar_CloseAskDialog()
return 1
## BINARY CALLBACK
################################################## ####################################
def __ServerCommand_Build(self):
serverCommandList={
"ConsoleEnable" : self.__Console_Enable,
"DayMode" : self.__DayMode_Update,
"PRESERVE_DayMode" : self.__PRESERVE_DayMode_Update,
"CloseRestartWindow" : self.__RestartDialog_Close,
"OpenPrivateShop" : self.__PrivateShop_Open,
"PartyHealReady" : self.PartyHealReady,
"ShowMeSafeboxPassword" : self.AskSafeboxPassword,
"CloseSafebox" : self.CommandCloseSafebox,
# ITEM_MALL
"CloseMall" : self.CommandCloseMall,
"ShowMeMallPassword" : self.AskMallPassword,
"item_mall" : self.__ItemMall_Open,
# END_OF_ITEM_MALL
"RefineSuceeded" : self.RefineSuceededMessage,
"RefineFailed" : self.RefineFailedMessage,
"xmas_snow" : self.__XMasSnow_Enable,
"xmas_boom" : self.__XMasBoom_Enable,
"xmas_song" : self.__XMasSong_Enable,
"xmas_tree" : self.__XMasTree_Enable,
"newyear_boom" : self.__XMasBoom_Enable,
"PartyRequest" : self.__PartyRequestQuestion,
"PartyRequestDenied" : self.__PartyRequestDenied,
"horse_state" : self.__Horse_UpdateState,
"hide_horse_state" : self.__Horse_HideState,
"WarUC" : self.__GuildWar_UpdateMemberCount,
"test_server" : self.__EnableTestServerFlag,
"mall" : self.__InGameShop_Show,
# WEDDING
"lover_login" : self.__LoginLover,
"lover_logout" : self.__LogoutLover,
"lover_near" : self.__LoverNear,
"lover_far" : self.__LoverFar,
"lover_divorce" : self.__LoverDivorce,
"PlayMusic" : self.__PlayMusic,
# END_OF_WEDDING
# PRIVATE_SHOP_PRICE_LIST
"MyShopPriceList" : self.__PrivateShop_PriceList,
# END_OF_PRIVATE_SHOP_PRICE_LIST
}
self.serverCommander=stringCommander.Analyzer()
for serverCommandItem in serverCommandList.items():
self.serverCommander.SAFE_RegisterCallBack(
serverCommandItem[0], serverCommandItem[1]
)
def BINARY_ServerCommand_Run(self, line):
#dbg.TraceError(line)
try:
#print " BINARY_ServerCommand_Run", line
return self.serverCommander.Run(line)
except RuntimeError, msg:
dbg.TraceError(msg)
return 0
def __ProcessPreservedServerCommand(self):
try:
command = net.GetPreservedServerCommand()
while command:
print " __ProcessPreservedServerCommand", command
self.serverCommander.Run(command)
command = net.GetPreservedServerCommand()
except RuntimeError, msg:
dbg.TraceError(msg)
return 0
def PartyHealReady(self):
self.interface.PartyHealReady()
def AskSafeboxPassword(self):
self.interface.AskSafeboxPassword()
# ITEM_MALL
def AskMallPassword(self):
self.interface.AskMallPassword()
def __ItemMall_Open(self):
self.interface.OpenItemMall();
def CommandCloseMall(self):
self.interface.CommandCloseMall()
# END_OF_ITEM_MALL
def RefineSuceededMessage(self):
snd.PlaySound("sound/ui/make_soket.wav")
self.PopupMessage(locale.REFINE_SUCCESS)
def RefineFailedMessage(self):
snd.PlaySound("sound/ui/jaeryun_fail.wav")
self.PopupMessage(locale.REFINE_FAILURE)
def CommandCloseSafebox(self):
self.interface.CommandCloseSafebox()
# PRIVATE_SHOP_PRICE_LIST
def __PrivateShop_PriceList(self, itemVNum, itemPrice):
uiPrivateShopBuilder.SetPrivateShopItemPrice(itemV Num, itemPrice)
# END_OF_PRIVATE_SHOP_PRICE_LIST
def __Horse_HideState(self):
self.affectShower.SetHorseState(0, 0, 0)
def __Horse_UpdateState(self, level, health, battery):
self.affectShower.SetHorseState(int(level), int(health), int(battery))
def __IsXMasMap(self):
mapDict = ( "metin2_map_n_flame_01",
"metin2_map_n_desert_01",
"metin2_map_spiderdungeon",
"metin2_map_deviltower1", )
if background.GetCurrentMapName() in mapDict:
return FALSE
return TRUE
def __XMasSnow_Enable(self, mode):
self.__XMasSong_Enable(mode)
if "1"==mode:
if not self.__IsXMasMap():
return
print "XMAS_SNOW ON"
background.EnableSnow(1)
else:
print "XMAS_SNOW OFF"
background.EnableSnow(0)
def __XMasBoom_Enable(self, mode):
if "1"==mode:
if not self.__IsXMasMap():
return
print "XMAS_BOOM ON"
self.__DayMode_Update("dark")
self.enableXMasBoom = TRUE
self.startTimeXMasBoom = app.GetTime()
else:
print "XMAS_BOOM OFF"
self.__DayMode_Update("light")
self.enableXMasBoom = FALSE
def __XMasTree_Enable(self, grade):
print "XMAS_TREE ", grade
background.SetXMasTree(int(grade))
def __XMasSong_Enable(self, mode):
if "1"==mode:
print "XMAS_SONG ON"
XMAS_BGM = "xmas.mp3"
if app.IsExistFile("BGM/" + XMAS_BGM)==1:
if musicInfo.fieldMusic != "":
snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic)
musicInfo.fieldMusic=XMAS_BGM
snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
else:
print "XMAS_SONG OFF"
if musicInfo.fieldMusic != "":
snd.FadeOutMusic("BGM/" + musicInfo.fieldMusic)
musicInfo.fieldMusic=musicInfo.METIN2THEMA
snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
def __RestartDialog_Close(self):
self.interface.CloseRestartDialog()
def __Console_Enable(self):
constInfo.CONSOLE_ENABLE = TRUE
self.consoleEnable = TRUE
app.EnableSpecialCameraMode()
ui.EnablePaste(TRUE)
## PrivateShop
def __PrivateShop_Open(self):
self.interface.OpenPrivateShopInputNameDialog()
def BINARY_PrivateShop_Appear(self, vid, text):
self.interface.AppearPrivateShop(vid, text)
def BINARY_PrivateShop_Disappear(self, vid):
self.interface.DisappearPrivateShop(vid)
## DayMode
def __PRESERVE_DayMode_Update(self, mode):
if "light"==mode:
background.SetEnvironmentData(0)
elif "dark"==mode:
if not self.__IsXMasMap():
return
background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
background.SetEnvironmentData(1)
def __DayMode_Update(self, mode):
if "light"==mode:
self.curtain.SAFE_FadeOut(self.__DayMode_OnComplet eChangeToLight)
elif "dark"==mode:
if not self.__IsXMasMap():
return
self.curtain.SAFE_FadeOut(self.__DayMode_OnComplet eChangeToDark)
def __DayMode_OnCompleteChangeToLight(self):
background.SetEnvironmentData(0)
self.curtain.FadeIn()
def __DayMode_OnCompleteChangeToDark(self):
background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
background.SetEnvironmentData(1)
self.curtain.FadeIn()
## XMasBoom
def __XMasBoom_Update(self):
self.BOOM_DATA_LIST = ( (2, 5), (5, 2), (7, 3), (10, 3), (20, 5) )
if self.indexXMasBoom >= len(self.BOOM_DATA_LIST):
return
boomTime = self.BOOM_DATA_LIST[self.indexXMasBoom][0]
boomCount = self.BOOM_DATA_LIST[self.indexXMasBoom][1]
if app.GetTime() - self.startTimeXMasBoom > boomTime:
self.indexXMasBoom += 1
for i in xrange(boomCount):
self.__XMasBoom_Boom()
def __XMasBoom_Boom(self):
x, y, z = player.GetMainCharacterPosition()
randX = app.GetRandom(-150, 150)
randY = app.GetRandom(-150, 150)
snd.PlaySound3D(x+randX, -y+randY, z, "sound/common/etc/salute.mp3")
def __PartyRequestQuestion(self, vid):
vid = int(vid)
partyRequestQuestionDialog = uiCommon.QuestionDialog()
partyRequestQuestionDialog.SetText(chr.GetNameByVI D(vid) + locale.PARTY_DO_YOU_ACCEPT)
partyRequestQuestionDialog.SetAcceptText(locale.UI _ACCEPT)
partyRequestQuestionDialog.SetCancelText(locale.UI _DENY)
partyRequestQuestionDialog.SetAcceptEvent(lambda arg=TRUE: self.__AnswerPartyRequest(arg))
partyRequestQuestionDialog.SetCancelEvent(lambda arg=FALSE: self.__AnswerPartyRequest(arg))
partyRequestQuestionDialog.Open()
partyRequestQuestionDialog.vid = vid
self.partyRequestQuestionDialog = partyRequestQuestionDialog
def __AnswerPartyRequest(self, answer):
if not self.partyRequestQuestionDialog:
return
vid = self.partyRequestQuestionDialog.vid
if answer:
net.SendChatPacket("/party_request_accept " + str(vid))
else:
net.SendChatPacket("/party_request_deny " + str(vid))
self.partyRequestQuestionDialog.Close()
self.partyRequestQuestionDialog = None
def __PartyRequestDenied(self):
self.PopupMessage(locale.PARTY_REQUEST_DENIED)
def __EnableTestServerFlag(self):
app.EnableTestServerFlag()
def __InGameShop_Show(self, url):
if constInfo.IN_GAME_SHOP_ENABLE:
self.interface.OpenWebWindow(url)
# WEDDING
def __LoginLover(self):
if self.interface.wndMessenger:
self.interface.wndMessenger.OnLoginLover()
def __LogoutLover(self):
if self.interface.wndMessenger:
self.interface.wndMessenger.OnLogoutLover()
if self.affectShower:
self.affectShower.HideLoverState()
def __LoverNear(self):
if self.affectShower:
self.affectShower.ShowLoverState()
def __LoverFar(self):
if self.affectShower:
self.affectShower.HideLoverState()
def __LoverDivorce(self):
if self.interface.wndMessenger:
self.interface.wndMessenger.ClearLoverInfo()
if self.affectShower:
self.affectShower.ClearLoverState()
def __PlayMusic(self, flag, filename):
flag = int(flag)
if flag:
snd.FadeOutAllMusic()
musicInfo.SaveLastPlayFieldMusic()
snd.FadeInMusic("BGM/" + filename)
else:
snd.FadeOutAllMusic()
musicInfo.LoadLastPlayFieldMusic()
snd.FadeInMusic("BGM/" + musicInfo.fieldMusic)
# END_OF_WEDDING
def day_night(self):
import time
localtime = time.strftime("%H")
if day.nacht == 0:
if localtime == "01" or localtime == "02" or localtime == "03" or localtime == "04" or localtime == "05" or localtime == "06" or localtime == "07" or localtime == "00" or localtime == "23" or localtime == "22" or localtime == "21":
background.RegisterEnvironmentData(1, constInfo.ENVIRONMENT_NIGHT)
background.SetEnvironmentData(1)
day.tag = 0
day.nacht = 1
if day.tag == 0:
if localtime == "11" or localtime == "12" or localtime == "13" or localtime == "14" or localtime == "15" or localtime == "16" or localtime == "17":
background.SetEnvironmentData(0)
day.tag = 1
day.nacht = 0
if localtime == "08" or localtime == "09" or localtime == "10" or localtime == "18" or localtime == "19" or localtime == "20":
background.RegisterEnvironmentData(2, constInfo.ENVIRONMENT_EVENING)
background.SetEnvironmentData(2)
day.tag = 1
day.nacht = 0
05/08/2015, 13:38
#5
elite*gold: 0
Join Date: Mar 2015
Posts: 36
Received Thanks: 58
Hey, wenn du möchtest biete ich dir an das du mich in Skype addest. Dann füge ich es dir ein. Das sieht aber Definitiv nach einen TAB Fehler aus.
MfG
Similar Threads
So ein Fehler gibt es nicht, DB alels funzt ingame Fehler -.-
01/19/2012 - Metin2 Private Server - 6 Replies
Hey Com,
ich habe alles gestartet (Hamachi Daroo Files).
Navicat geht, alles funzt nur folgendes:
Wenn ich mich mit falschen Logins einlogge:
Dieser Account existiert nicht.
Wenn ich richtige Daten eingebe:
Fehler beim Verbinden mit dem Server
Infinite Aion: Fehler (1024) Fehler beim initialisieren des Spiels
06/09/2011 - Aion Private Server - 5 Replies
Hi Leute,
ich hab ein Probem mit AION:
jedesmal wenn ich starte, egal ob mit dem NCSoft Launcher oder mit dem Infinite Aion Launcher kommt die Meldung Fehler beim initialisieren des Spiels...
Hab schon alle möglichen Sprachkombinationen durchprobiert, da es überall heißt man soll Region und Sprache beim NCSoft Launcher ändern und dann gehts...
Alles probiert, und siehe da: geändert hat sich nichts... Immer noch der Fehler 1024...
wäre nett, wenn mir da jemand helfen könnte und auch...
Fehler : java.net.socet.exception:connection reset fehler bitte um hilfe
12/21/2010 - Minecraft - 9 Replies
Hab denn java.net.socet.exception:connection reset fehler immer und immer wieder
:(
könnt ihr mir dabei vill helfen? :)
LG DieVerrückteMango =)
All times are GMT +2. The time now is 06:24 .