mirror of
https://github.com/edubart/otclient.git
synced 2025-11-30 07:26:49 +01:00
move UIWindow to lua
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
MainWindow
|
||||
id: about
|
||||
title: Info
|
||||
text: Info
|
||||
size: 244 221
|
||||
|
||||
FlatPanel
|
||||
|
||||
@@ -10,8 +10,10 @@ local function onCharactersWindowKeyPress(self, keyCode, keyText, keyboardModifi
|
||||
if keyboardModifiers == KeyboardNoModifier then
|
||||
if keyCode == KeyUp or keyCode == KeyTab then
|
||||
characterList:focusPreviousChild(ActiveFocusReason)
|
||||
return true
|
||||
elseif keyCode == KeyDown then
|
||||
characterList:focusNextChild(ActiveFocusReason)
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
@@ -59,7 +61,7 @@ function CharacterList.create(characters, premDays)
|
||||
charactersWindow = displayUI('characterlist.otui')
|
||||
characterList = charactersWindow:getChildById('characterList')
|
||||
local accountStatusLabel = charactersWindow:getChildById('accountStatusLabel')
|
||||
charactersWindow.onKeyPress = onCharactersWindowKeyPress
|
||||
connect(charactersWindow, {onKeyPress = onCharactersWindowKeyPress })
|
||||
|
||||
local focusLabel
|
||||
for i,characterInfo in ipairs(characters) do
|
||||
|
||||
@@ -10,7 +10,7 @@ CharacterListLabel < Label
|
||||
|
||||
MainWindow
|
||||
id: charactersWindow
|
||||
title: Character List
|
||||
text: Character List
|
||||
size: 250 248
|
||||
@onEnter: CharacterList.doLogin()
|
||||
@onEscape: CharacterList.destroy()
|
||||
@@ -23,6 +23,8 @@ MainWindow
|
||||
margin-bottom: 5
|
||||
margin-left: 16
|
||||
margin-right: 16
|
||||
padding: 1
|
||||
focusable: false
|
||||
|
||||
Label
|
||||
id: accountStatusLabel
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
MainWindow
|
||||
id: enterGame
|
||||
title: Enter Game
|
||||
text: Enter Game
|
||||
size: 236 240
|
||||
@onEnter: EnterGame.doLogin()
|
||||
@onEscape: EnterGame.hide()
|
||||
|
||||
@@ -18,7 +18,7 @@ OptionCheckBox < CheckBox
|
||||
|
||||
MainWindow
|
||||
id: optionsWindow
|
||||
title: Options
|
||||
text: Options
|
||||
size: 286 280
|
||||
@onEnter: Options.hide()
|
||||
@onEscape: Options.hide()
|
||||
|
||||
@@ -99,6 +99,21 @@ function tonumber(v)
|
||||
return oldtonumber(v)
|
||||
end
|
||||
|
||||
function signalcall(param, ...)
|
||||
if type(param) == 'function' then
|
||||
return param(...)
|
||||
elseif type(param) == 'table' then
|
||||
for k,v in pairs(param) do
|
||||
if param(...) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
elseif func ~= nil then
|
||||
error('attempt to call a non function value')
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function runscript(file)
|
||||
g_lua.runScript(resolvepath(file, 2))
|
||||
end
|
||||
@@ -3,16 +3,16 @@ Window < UIWindow
|
||||
size: 200 200
|
||||
opacity: 1
|
||||
color: white
|
||||
head-height: 20
|
||||
head-text-align: center
|
||||
text-offset: 0 2
|
||||
text-align: top
|
||||
move-policy: free
|
||||
stackable: true
|
||||
image-source: /core_styles/images/window.png
|
||||
image-border: 4
|
||||
image-border-top: 20
|
||||
|
||||
$pressed:
|
||||
opacity: 0.75
|
||||
//$pressed:
|
||||
// opacity: 0.75
|
||||
|
||||
$disabled:
|
||||
color: #aaaaaa88
|
||||
@@ -20,8 +20,8 @@ Window < UIWindow
|
||||
MiniWindow < UIWindow
|
||||
font: verdana-11px-antialised
|
||||
size: 192 200
|
||||
head-height: 25
|
||||
head-text-align: center
|
||||
text-offset: 0 5
|
||||
text-align: top
|
||||
margin-top: 10
|
||||
margin-left: 6
|
||||
margin-right: 6
|
||||
|
||||
@@ -12,5 +12,6 @@ Module
|
||||
require 'uicombobox'
|
||||
require 'uiprogressbar'
|
||||
require 'uipopupmenu'
|
||||
require 'uiwindow'
|
||||
require 'tooltip/tooltip'
|
||||
require 'messagebox/messagebox'
|
||||
@@ -10,8 +10,9 @@ function MessageBox.create(title, text, flags)
|
||||
setmetatable(box, MessageBox)
|
||||
|
||||
-- create messagebox window
|
||||
local window = displayUI('messagebox.otui', { locked = true })
|
||||
window:setTitle(title)
|
||||
local window = displayUI('messagebox.otui')
|
||||
window:lock()
|
||||
window:setText(title)
|
||||
|
||||
local label = window:getChildById('messageBoxLabel')
|
||||
label:setText(text)
|
||||
|
||||
17
modules/core_widgets/uiwindow.lua
Normal file
17
modules/core_widgets/uiwindow.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
UIWindow = extends(UIWidget)
|
||||
|
||||
function UIWindow.create()
|
||||
local window = UIWindow.internalCreate()
|
||||
window:setTextAlign(AlignTopCenter)
|
||||
return window
|
||||
end
|
||||
|
||||
function UIWindow:onKeyPress(keyCode, keyText, keyboardModifiers)
|
||||
if keyboardModifiers == KeyboardNoModifier then
|
||||
if keyCode == KeyReturn or keyCode == KeyEnter then
|
||||
signalcall(self.onEnter, self)
|
||||
elseif keyCode == KeyEscape then
|
||||
signalcall(self.onEscape, self)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -3,7 +3,7 @@ Color < ColorBox
|
||||
anchors.left: head.right
|
||||
|
||||
Window
|
||||
title: Select Outfit
|
||||
text: Select Outfit
|
||||
size: 550 280
|
||||
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
|
||||
@@ -34,7 +34,7 @@ SkillPercentPanel < ProgressBar
|
||||
|
||||
MiniWindow
|
||||
id: skillWindow
|
||||
title: Skills
|
||||
text: Skills
|
||||
size: 200 310
|
||||
|
||||
Panel
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
MainWindow
|
||||
size: 256 128
|
||||
title: Add to VIP list
|
||||
text: Add to VIP list
|
||||
@onEnter: VipList.addVip()
|
||||
@onEscape: VipList.destroyAddWindow()
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ VipListLabel < GameLabel
|
||||
|
||||
MiniWindow
|
||||
id: vipWindow
|
||||
title: VIP List
|
||||
text: VIP List
|
||||
|
||||
UIWidget
|
||||
id: vipList
|
||||
|
||||
Reference in New Issue
Block a user