mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 11:34:54 +02:00
new layout system, new UI state/styles system
This commit is contained in:
@@ -34,26 +34,21 @@ function Console.addLine(text, color)
|
||||
-- create new label
|
||||
|
||||
local label = UILabel.create()
|
||||
label:setStyle('ConsoleLabel')
|
||||
console:insertChild(-2, label)
|
||||
label:setId('consoleLabel' .. numLines)
|
||||
label:setText(text)
|
||||
label:setForegroundColor(color)
|
||||
console:insertChild(3, label)
|
||||
|
||||
local lastLabel = console:getChildByIndex(4)
|
||||
if lastLabel then
|
||||
lastLabel:addAnchor(AnchorBottom, "prev", AnchorTop)
|
||||
end
|
||||
label:setStyle('ConsoleLabel')
|
||||
|
||||
numLines = numLines + 1
|
||||
if numLines > maxLines then
|
||||
local firstLabel = console:getChildByIndex(-1)
|
||||
local firstLabel = console:getChildByIndex(1)
|
||||
firstLabel:destroy()
|
||||
end
|
||||
end
|
||||
|
||||
function Console.create()
|
||||
console = loadUI("/console/console.otui")
|
||||
rootWidget:addChild(console)
|
||||
console = UI.loadAndDisplay("/console/console.otui")
|
||||
console:hide()
|
||||
|
||||
Logger.setOnLog(Console.onLog)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
ConsoleLabel < UILabel
|
||||
font: terminus-14px-bold
|
||||
height: 16
|
||||
anchors.bottom: commandBox.top
|
||||
anchors.bottom: next.top
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
margin.left: 2
|
||||
@@ -14,7 +14,8 @@ RectPanel
|
||||
|
||||
UILabel
|
||||
id: commandSymbolLabel
|
||||
size: 18 20
|
||||
size: 20 16
|
||||
size fixed: true
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
margin.left: 2
|
||||
@@ -23,11 +24,10 @@ RectPanel
|
||||
|
||||
UILineEdit
|
||||
id: commandBox
|
||||
height: 20
|
||||
height: 16
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: prev.right
|
||||
anchors.left: commandSymbolLabel.right
|
||||
anchors.right: parent.right
|
||||
margin.left: 4
|
||||
font: terminus-14px-bold
|
||||
onAction: |
|
||||
function(self)
|
||||
|
Reference in New Issue
Block a user