mirror of
https://github.com/edubart/otclient.git
synced 2025-10-14 19:44:54 +02:00
Text selection in chat
* Remove fancy stuff from background * Improve text windows * More improvements to textedit
This commit is contained in:
@@ -9,68 +9,6 @@ Panel
|
||||
anchors.bottom: parent.bottom
|
||||
margin-top: 1
|
||||
focusable: false
|
||||
@onSetup: |
|
||||
scheduleEvent(function()
|
||||
local count = 0
|
||||
cycleEvent(function()
|
||||
if count > 360 then return end
|
||||
self:setRotation(count)
|
||||
count = count + 5
|
||||
end, 10)
|
||||
end, 10)
|
||||
|
||||
UIParticles
|
||||
anchors.fill: parent
|
||||
effect: background-effect
|
||||
reference-pos: 0.5 0.25
|
||||
|
||||
Label
|
||||
text: :O Just For Fun LOL ^.^
|
||||
font: sans-bold-16px
|
||||
color: black
|
||||
background: #ffffff60
|
||||
anchors.top: parent.top
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
margin-left: 10
|
||||
margin-top: 40
|
||||
height: 24
|
||||
rotation: -15
|
||||
@onSetup: |
|
||||
local count = 0
|
||||
cycleEvent(function()
|
||||
local text = ':O Just For Fun LOL ^.^'
|
||||
self:setText(string.sub(text, 0, count))
|
||||
if count > #text + 10 then count = 0 end
|
||||
count = count + 1
|
||||
end, 100)
|
||||
|
||||
Label
|
||||
text: PLEASE REMOVE THAT SHIT!
|
||||
font: sans-bold-16px
|
||||
color: black
|
||||
background: #ffffff60
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
margin-left: 10
|
||||
margin-bottom: 40
|
||||
height: 24
|
||||
rotation: 15
|
||||
visible: false
|
||||
@onSetup: scheduleEvent(function() self:show() end, 4000)
|
||||
|
||||
Label
|
||||
text: WTF IS WRONG WITH THIS BACKGROUND?
|
||||
font: sans-bold-16px
|
||||
color: pink
|
||||
background: #ffffff99
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
margin-left: 10
|
||||
margin-top: 80
|
||||
height: 24
|
||||
rotation: 10
|
||||
visible: false
|
||||
@onSetup: scheduleEvent(function() self:show() end, 8000)
|
||||
|
||||
UILabel
|
||||
id: clientVersionLabel
|
||||
|
@@ -87,6 +87,22 @@ function init()
|
||||
consoleTabBar:setTabSpacing(-1)
|
||||
channels = {}
|
||||
|
||||
consolePanel.onKeyPress = function(self, keyCode, keyboardModifiers)
|
||||
if not (keyboardModifiers == KeyboardCtrlModifier and keyCode == KeyC) then return false end
|
||||
|
||||
local tab = consoleTabBar:getCurrentTab()
|
||||
if not tab then return false end
|
||||
|
||||
local consoleBuffer = tab.tabPanel:getChildById('consoleBuffer')
|
||||
if not consoleBuffer then return false end
|
||||
|
||||
local consoleLabel = consoleBuffer:getFocusedChild()
|
||||
if not consoleLabel or not consoleLabel:hasSelection() then return false end
|
||||
|
||||
g_window.setClipboardText(consoleLabel:getSelection())
|
||||
return true
|
||||
end
|
||||
|
||||
defaultTab = addTab(tr('Default'), true)
|
||||
serverTab = addTab(tr('Server Log'), false)
|
||||
|
||||
@@ -355,16 +371,16 @@ function addTabText(text, speaktype, tab, creatureName)
|
||||
local panel = consoleTabBar:getTabPanel(tab)
|
||||
local consoleBuffer = panel:getChildById('consoleBuffer')
|
||||
local label = g_ui.createWidget('ConsoleLabel', consoleBuffer)
|
||||
label:setId('consoleLabel' .. panel:getChildCount())
|
||||
label:setId('consoleLabel' .. consoleBuffer:getChildCount())
|
||||
label:setText(text)
|
||||
label:setColor(speaktype.color)
|
||||
consoleTabBar:blinkTab(tab)
|
||||
|
||||
-- Overlay for consoleBuffer which shows highlighted words only
|
||||
local consoleBufferHighlight = panel:getChildById('consoleBufferHighlight')
|
||||
local labelHighlight = g_ui.createWidget('ConsoleLabel', consoleBufferHighlight)
|
||||
local labelHighlight = g_ui.createWidget('ConsolePhantomLabel', consoleBufferHighlight)
|
||||
|
||||
labelHighlight:setId('consoleLabel' .. panel:getChildCount())
|
||||
labelHighlight:setId('consoleLabel' .. consoleBufferHighlight:getChildCount())
|
||||
labelHighlight:setColor("#1f9ffe")
|
||||
|
||||
local player = g_game.getLocalPlayer()
|
||||
|
@@ -1,10 +1,22 @@
|
||||
ConsoleLabel < UILabel
|
||||
ConsoleLabel < UITextEdit
|
||||
font: verdana-11px-antialised
|
||||
height: 14
|
||||
color: yellow
|
||||
margin-left: 2
|
||||
text-wrap: true
|
||||
text-auto-resize: true
|
||||
selection-color: #111416
|
||||
selection-background-color: #999999
|
||||
|
||||
ConsolePhantomLabel < UILabel
|
||||
font: verdana-11px-antialised
|
||||
height: 14
|
||||
color: yellow
|
||||
margin-left: 2
|
||||
text-wrap: true
|
||||
text-auto-resize: true
|
||||
selection-color: #111416
|
||||
selection-background-color: #999999
|
||||
|
||||
ConsoleTabBar < TabBar
|
||||
ConsoleTabBarPanel < TabBarPanel
|
||||
@@ -168,3 +180,4 @@ Panel
|
||||
margin-left: 6
|
||||
margin-bottom: 6
|
||||
shift-navigation: true
|
||||
max-length: 255
|
||||
|
@@ -40,7 +40,6 @@ function onGameEditText(id, itemId, maxLength, text, writter, time)
|
||||
textEdit:setText(text)
|
||||
textEdit:setEditable(writeable)
|
||||
textEdit:setCursorVisible(writeable)
|
||||
textEdit:wrapText()
|
||||
|
||||
local desc = ''
|
||||
if #writter > 0 then
|
||||
|
@@ -25,6 +25,7 @@ TextWindow < MainWindow
|
||||
anchors.right: textScroll.left
|
||||
anchors.bottom: textScroll.bottom
|
||||
vertical-scrollbar: textScroll
|
||||
text-wrap: true
|
||||
|
||||
VerticalScrollBar
|
||||
id: textScroll
|
||||
|
Reference in New Issue
Block a user