metin2clean e94957cd33 client
2024-06-01 15:32:17 -05:00

176 lines
3.7 KiB
Python

import app
import uiScriptLocale
from utils import ElementAddBefore, FindElementRef
ROOT = "d:/ymir work/ui/public/"
window = {
"name" : "SystemDialog",
"style" : ("float",),
"x" : (SCREEN_WIDTH - 200) /2,
"y" : (SCREEN_HEIGHT - (318 - 30)) /2,
"width" : 200,
"height" : 318,
"children" :
[
{
"name" : "board",
"type" : "thinboard",
"x" : 0,
"y" : 0,
"width" : 200,
"height" : 318,
"children" :
[
{
"name" : "help_button",
"type" : "button",
"x" : 10,
"y" : 17,
"text" : uiScriptLocale.SYSTEM_HELP,
"default_image" : ROOT + "XLarge_Button_01.sub",
"over_image" : ROOT + "XLarge_Button_02.sub",
"down_image" : ROOT + "XLarge_Button_03.sub",
},
{
"name" : "mall_button",
"type" : "button",
"x" : 10,
"y" : 57,
"text" : uiScriptLocale.SYSTEM_MALL,
"text_color" : 0xffF8BF24,
"default_image" : ROOT + "XLarge_Button_02.sub",
"over_image" : ROOT + "XLarge_Button_02.sub",
"down_image" : ROOT + "XLarge_Button_02.sub",
},
{
"name" : "system_option_button",
"type" : "button",
"x" : 10,
"y" : 87,
"text" : uiScriptLocale.SYSTEMOPTION_TITLE,
"default_image" : ROOT + "XLarge_Button_01.sub",
"over_image" : ROOT + "XLarge_Button_02.sub",
"down_image" : ROOT + "XLarge_Button_03.sub",
},
{
"name" : "game_option_button",
"type" : "button",
"x" : 10,
"y" : 117,
"text" : uiScriptLocale.GAMEOPTION_TITLE,
"default_image" : ROOT + "XLarge_Button_01.sub",
"over_image" : ROOT + "XLarge_Button_02.sub",
"down_image" : ROOT + "XLarge_Button_03.sub",
},
{
"name" : "change_button",
"type" : "button",
"x" : 10,
"y" : 147,
"text" : uiScriptLocale.SYSTEM_CHANGE,
"default_image" : ROOT + "XLarge_Button_01.sub",
"over_image" : ROOT + "XLarge_Button_02.sub",
"down_image" : ROOT + "XLarge_Button_03.sub",
},
{
"name" : "logout_button",
"type" : "button",
"x" : 10,
"y" : 177,
"text" : uiScriptLocale.SYSTEM_LOGOUT,
"default_image" : ROOT + "XLarge_Button_01.sub",
"over_image" : ROOT + "XLarge_Button_02.sub",
"down_image" : ROOT + "XLarge_Button_03.sub",
},
{
"name" : "exit_button",
"type" : "button",
"x" : 10,
"y" : 207,
"text" : uiScriptLocale.SYSTEM_EXIT,
"default_image" : ROOT + "XLarge_Button_01.sub",
"over_image" : ROOT + "XLarge_Button_02.sub",
"down_image" : ROOT + "XLarge_Button_03.sub",
},
{
"name" : "cancel_button",
"type" : "button",
"x" : 10,
"y" : 237,
"text" : uiScriptLocale.CANCEL,
"default_image" : ROOT + "XLarge_Button_01.sub",
"over_image" : ROOT + "XLarge_Button_02.sub",
"down_image" : ROOT + "XLarge_Button_03.sub",
},
],
},
],
}
#############################################################################
MAIN_BOARD = FindElementRef(window["children"], "board")
if app.ENABLE_MOVE_CHANNEL:
ElementAddBefore(MAIN_BOARD["children"], "logout_button",
{
"name" : "movechannel_button",
"type" : "button",
"x" : 10,
"y" : -1,
"text" : uiScriptLocale.SYSTEM_MOVE_CHANNEL,
"default_image" : ROOT + "XLarge_Button_01.sub",
"over_image" : ROOT + "XLarge_Button_02.sub",
"down_image" : ROOT + "XLarge_Button_03.sub",
})
def Recalculate():
global MAIN_BOARD
# incrementor
INIT_Y = 10
def Next():
ret = getattr(Recalculate, "NEXT_Y", INIT_Y)
setattr(Recalculate, "NEXT_Y", ret + 30)
return ret
# update Y of every element
for elem in MAIN_BOARD["children"]:
elem["y"] = Next()
# update height
window["height"] = MAIN_BOARD["height"] = Next() + INIT_Y
Recalculate()