Files
metin2-client/src/platform/ScriptLib/Ava2UICompatScript.inc
T

26 lines
1.0 KiB
C++

// PORT: AVA2 ui.py additions shared by native feature windows; keep base scripts unchanged.
static const char c_szAva2UICompatScript[] = R"PY(# -*- coding: utf-8 -*-
import ui
# AVA2 Button.SetListText / PythonScriptLoader.LoadElementButton text_x branch.
def SetListText(self,text,x=8):
if not self.ButtonText:
textLine=ui.TextLine()
textLine.SetParent(self)
textLine.Show()
self.ButtonText=textLine
self.ButtonText.SetPosition(x,self.GetHeight()/2)
self.ButtonText.SetVerticalAlignCenter()
self.ButtonText.SetHorizontalAlignLeft()
self.ButtonText.SetWindowHorizontalAlignLeft()
self.ButtonText.SetText(text)
ui.Button.SetListText=SetListText
_loadButton=ui.PythonScriptLoader.LoadElementButton
def LoadElementButton(self,window,value,parent):
result=_loadButton(self,window,value,parent)
if 'text' in value and 'text_x' in value and 'text_height' not in value:
window.SetListText(value['text'],value['text_x'])
return result
ui.PythonScriptLoader.LoadElementButton=LoadElementButton
)PY";