implement some chat functionality, but not complete yet
1
BUGS
|
@ -11,3 +11,4 @@ some animated hits are displayed as 2 hits instead of one
|
||||||
numpad on windows doesn't work correctly
|
numpad on windows doesn't work correctly
|
||||||
skulls is rendering outside map bounds
|
skulls is rendering outside map bounds
|
||||||
these are some issues when skill progressbar is 0% or 100%
|
these are some issues when skill progressbar is 0% or 100%
|
||||||
|
paste on x11 platform does not work correctly when doing ctrl+c in google chrome
|
1
TODO
|
@ -65,6 +65,7 @@ Low priority TODO
|
||||||
[bart] reapply anchor styles when adding new childs
|
[bart] reapply anchor styles when adding new childs
|
||||||
[bart] ui text selection
|
[bart] ui text selection
|
||||||
[bart] make set of background/icon/image width alone work
|
[bart] make set of background/icon/image width alone work
|
||||||
|
[bart] check for recursive anchors to print a error and avoid crashes
|
||||||
|
|
||||||
== Client modules
|
== Client modules
|
||||||
[bart] make possible to reload modules
|
[bart] make possible to reload modules
|
||||||
|
|
|
@ -12,6 +12,7 @@ Module
|
||||||
importStyle 'styles/lineedits.otui'
|
importStyle 'styles/lineedits.otui'
|
||||||
importStyle 'styles/checkboxes.otui'
|
importStyle 'styles/checkboxes.otui'
|
||||||
importStyle 'styles/progressbars.otui'
|
importStyle 'styles/progressbars.otui'
|
||||||
|
importStyle 'styles/tabbars.otui'
|
||||||
importStyle 'styles/windows.otui'
|
importStyle 'styles/windows.otui'
|
||||||
importStyle 'styles/listboxes.otui'
|
importStyle 'styles/listboxes.otui'
|
||||||
importStyle 'styles/items.otui'
|
importStyle 'styles/items.otui'
|
||||||
|
|
After Width: | Height: | Size: 271 B |
After Width: | Height: | Size: 285 B |
Before Width: | Height: | Size: 284 B After Width: | Height: | Size: 255 B |
Before Width: | Height: | Size: 286 B After Width: | Height: | Size: 255 B |
Before Width: | Height: | Size: 419 B After Width: | Height: | Size: 266 B |
After Width: | Height: | Size: 415 B |
|
@ -18,3 +18,23 @@ Button < UIButton
|
||||||
color: #f0ad4d88
|
color: #f0ad4d88
|
||||||
image-color: #ffffff88
|
image-color: #ffffff88
|
||||||
|
|
||||||
|
ConsoleButton < UIButton
|
||||||
|
size: 20 20
|
||||||
|
image-source: /core_styles/images/consolebutton.png
|
||||||
|
image-color: white
|
||||||
|
image-clip: 0 0 20 20
|
||||||
|
image-border: 2
|
||||||
|
icon-color: white
|
||||||
|
color: #aaaaaa
|
||||||
|
|
||||||
|
$hover !on:
|
||||||
|
image-clip: 0 20 20 20
|
||||||
|
color: white
|
||||||
|
|
||||||
|
$disabled:
|
||||||
|
image-color: #ffffff66
|
||||||
|
icon-color: #888888
|
||||||
|
|
||||||
|
$on:
|
||||||
|
image-clip: 0 40 20 20
|
||||||
|
color: #80c7f8
|
|
@ -1,5 +1,34 @@
|
||||||
TabBar < UITabBar
|
TabBar < UITabBar
|
||||||
TabBarTabButton < UIButton
|
TabBarPanel < Panel
|
||||||
TabBarCloseButton < UIButton
|
TabBarButton < UIButton
|
||||||
TabBarPrevButton < UIButton
|
size: 20 20
|
||||||
TabBarNextButton < UIButton
|
image-source: /core_styles/images/consolebutton.png
|
||||||
|
image-color: white
|
||||||
|
image-clip: 0 0 20 20
|
||||||
|
image-border: 2
|
||||||
|
icon-color: white
|
||||||
|
color: #aaaaaa
|
||||||
|
anchors.top: parent.top
|
||||||
|
margin-left: 5
|
||||||
|
padding: 5
|
||||||
|
|
||||||
|
$first:
|
||||||
|
anchors.left: parent.left
|
||||||
|
|
||||||
|
$!first:
|
||||||
|
anchors.left: prev.right
|
||||||
|
|
||||||
|
$hover !checked:
|
||||||
|
image-clip: 0 20 20 20
|
||||||
|
color: white
|
||||||
|
|
||||||
|
$disabled:
|
||||||
|
image-color: #ffffff66
|
||||||
|
icon-color: #888888
|
||||||
|
|
||||||
|
$checked:
|
||||||
|
image-clip: 0 40 20 20
|
||||||
|
color: #80c7f8
|
||||||
|
|
||||||
|
$on !checked:
|
||||||
|
color: #F55E5E
|
|
@ -11,6 +11,7 @@ Module
|
||||||
require 'uicheckbox'
|
require 'uicheckbox'
|
||||||
require 'uicombobox'
|
require 'uicombobox'
|
||||||
require 'uiprogressbar'
|
require 'uiprogressbar'
|
||||||
|
require 'uitabbar'
|
||||||
require 'uipopupmenu'
|
require 'uipopupmenu'
|
||||||
require 'uiwindow'
|
require 'uiwindow'
|
||||||
require 'tooltip/tooltip'
|
require 'tooltip/tooltip'
|
||||||
|
|
|
@ -1 +1,84 @@
|
||||||
UITabBar = extends(UIWidget)
|
UITabBar = extends(UIWidget)
|
||||||
|
|
||||||
|
-- private functions
|
||||||
|
local function onTabClick(tabButton)
|
||||||
|
tabButton.tabBar:selectTab(tabButton)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function tabBlink(tabButton)
|
||||||
|
if tabButton.blinking then
|
||||||
|
tabButton:setOn(not tabButton:isOn())
|
||||||
|
scheduleEvent(function() tabBlink(tabButton) end, 300)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- public functions
|
||||||
|
function UITabBar.create()
|
||||||
|
local tabbar = UITabBar.internalCreate()
|
||||||
|
tabbar.tabs = {}
|
||||||
|
return tabbar
|
||||||
|
end
|
||||||
|
|
||||||
|
function UITabBar:setContentWidget(widget)
|
||||||
|
self.contentWidget = widget
|
||||||
|
if #self.tabs > 0 then
|
||||||
|
self.contentWidget:addChild(self.tabs[1].tabPanel)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function UITabBar:addTab(text, panel)
|
||||||
|
if panel == nil then
|
||||||
|
panel = createWidget(self:getStyleName() .. 'Panel')
|
||||||
|
end
|
||||||
|
|
||||||
|
local tabButton = createWidget(self:getStyleName() .. 'Button', self)
|
||||||
|
tabButton.tabPanel = panel
|
||||||
|
tabButton.tabBar = self
|
||||||
|
tabButton:setText(text)
|
||||||
|
tabButton:setWidth(tabButton:getTextSize().width + tabButton:getPaddingLeft() + tabButton:getPaddingRight())
|
||||||
|
connect(tabButton, { onClick = onTabClick })
|
||||||
|
|
||||||
|
table.insert(self.tabs, tabButton)
|
||||||
|
if #self.tabs == 1 then
|
||||||
|
self:selectTab(tabButton)
|
||||||
|
end
|
||||||
|
|
||||||
|
return tabButton
|
||||||
|
end
|
||||||
|
|
||||||
|
function UITabBar:selectTab(tabButton)
|
||||||
|
if self.contentWidget then
|
||||||
|
local selectedWidget = self.contentWidget:getFirstChild()
|
||||||
|
if selectedWidget then
|
||||||
|
self.contentWidget:removeChild(selectedWidget)
|
||||||
|
end
|
||||||
|
self.contentWidget:addChild(tabButton.tabPanel)
|
||||||
|
tabButton.tabPanel:fill('parent')
|
||||||
|
end
|
||||||
|
|
||||||
|
tabButton:setChecked(true)
|
||||||
|
tabButton:setOn(false)
|
||||||
|
tabButton.blinking = false
|
||||||
|
if self.currentTabButton then
|
||||||
|
self.currentTabButton:setChecked(false)
|
||||||
|
end
|
||||||
|
self.currentTabButton = tabButton
|
||||||
|
end
|
||||||
|
|
||||||
|
function UITabBar:blinkTab(tabButton)
|
||||||
|
if not tabButton:isChecked() then
|
||||||
|
tabButton:setOn(true)
|
||||||
|
tabButton.blinking = true
|
||||||
|
tabBlink(tabButton)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function UITabBar:getTabPanel(tabButton)
|
||||||
|
return tabButton.tabPanel
|
||||||
|
end
|
||||||
|
|
||||||
|
function UITabBar:getCurrentTabPanel()
|
||||||
|
if self.currentTabButton then
|
||||||
|
return self.currentTabButton.tabPanel
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
|
@ -13,7 +13,7 @@ UIGame
|
||||||
|
|
||||||
InterfacePanel2
|
InterfacePanel2
|
||||||
id: bottomPanel
|
id: bottomPanel
|
||||||
height: 144
|
height: 170
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: rightPanel.left
|
anchors.right: rightPanel.left
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
|
|
@ -20,11 +20,19 @@ local SpeakTypes = {
|
||||||
|
|
||||||
local consolePanel
|
local consolePanel
|
||||||
local consoleBuffer
|
local consoleBuffer
|
||||||
|
local consoleTabBar
|
||||||
|
local defaultChannelTab
|
||||||
|
local serverLogTab
|
||||||
|
local current
|
||||||
|
|
||||||
-- public functions
|
-- public functions
|
||||||
function Console.create()
|
function Console.create()
|
||||||
consolePanel = displayUI('console.otui', { parent = Game.gameBottomPanel } )
|
consolePanel = displayUI('console.otui', { parent = Game.gameBottomPanel } )
|
||||||
consoleBuffer = consolePanel:getChildById('consoleBuffer')
|
consoleBuffer = consolePanel:getChildById('consoleBuffer')
|
||||||
|
consoleTabBar = consolePanel:getChildById('consoleTabBar')
|
||||||
|
consoleTabBar:setContentWidget(consoleBuffer)
|
||||||
|
defaultChannelTab = consoleTabBar:addTab('Default')
|
||||||
|
serverLogTab = consoleTabBar:addTab('Server Log')
|
||||||
end
|
end
|
||||||
|
|
||||||
function Console.destroy()
|
function Console.destroy()
|
||||||
|
@ -32,16 +40,25 @@ function Console.destroy()
|
||||||
consolePanel = nil
|
consolePanel = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function Console.addText(text, color)
|
function Console.addText(text, color, channelTab)
|
||||||
color = color or 'white'
|
color = color or 'white'
|
||||||
|
|
||||||
if Options.showTimestampsInConsole then
|
if Options.showTimestampsInConsole then
|
||||||
text = os.date('%H:%M') .. ' ' .. text
|
text = os.date('%H:%M') .. ' ' .. text
|
||||||
end
|
end
|
||||||
|
|
||||||
local label = createWidget('ConsoleLabel', consoleBuffer)
|
local label = createWidget('ConsoleLabel', consoleTabBar:getTabPanel(channelTab))
|
||||||
label:setText(text)
|
label:setText(text)
|
||||||
label:setColor(color)
|
label:setColor(color)
|
||||||
|
consoleTabBar:blinkTab(channelTab)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Console.addChannelMessage(text, color, channel)
|
||||||
|
if channel == 'Server Log' then
|
||||||
|
Console.addText(text, color, serverLogTab)
|
||||||
|
elseif channel == 'Default' then
|
||||||
|
Console.addText(text, color, defaultChannelTab)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- hooked events
|
-- hooked events
|
||||||
|
@ -57,7 +74,8 @@ local function onCreatureSpeak(name, level, speaktypedesc, message, channelId, c
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Console.addText(message, speaktype.color)
|
local channelPanel = consoleTabBar:getTabPanel(defaultChannelTab)
|
||||||
|
Console.addText(message, speaktype.color, channelPanel)
|
||||||
end
|
end
|
||||||
|
|
||||||
connect(Game, { onLogin = Console.create,
|
connect(Game, { onLogin = Console.create,
|
||||||
|
|
|
@ -3,48 +3,58 @@ ConsoleLabel < UILabel
|
||||||
height: 14
|
height: 14
|
||||||
color: yellow
|
color: yellow
|
||||||
|
|
||||||
SayModeButton < UIButton
|
ConsoleTabBar < TabBar
|
||||||
size: 26 26
|
ConsoleTabBarPanel < TabBarPanel
|
||||||
icon: /core_styles/icons/say.png
|
layout:
|
||||||
image-source: /core_styles/images/top_button.png
|
type: verticalBox
|
||||||
image-color: white
|
align-bottom: true
|
||||||
image-clip: 0 0 26 26
|
ConsoleTabBarButton < TabBarButton
|
||||||
image-border: 3
|
|
||||||
|
|
||||||
$hover:
|
|
||||||
image-source: /core_styles/images/top_button.png
|
|
||||||
clip: 26 0 26 26
|
|
||||||
border: 3
|
|
||||||
|
|
||||||
$pressed:
|
|
||||||
image-source: /core_styles/images/top_button.png
|
|
||||||
image-clip: 52 0 26 26
|
|
||||||
image-border: 3
|
|
||||||
|
|
||||||
$disabled:
|
|
||||||
image-color: #ffffff66
|
|
||||||
|
|
||||||
Panel
|
Panel
|
||||||
id: consolePanel
|
id: consolePanel
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
|
ConsoleButton
|
||||||
|
id: prevChannelButton
|
||||||
|
icon: /core_styles/icons/leftarrow.png
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.top: parent.top
|
||||||
|
margin-left: 6
|
||||||
|
margin-top: 6
|
||||||
|
enabled: false
|
||||||
|
|
||||||
|
ConsoleTabBar
|
||||||
|
id: consoleTabBar
|
||||||
|
height: 20
|
||||||
|
anchors.left: prev.right
|
||||||
|
anchors.top: prev.top
|
||||||
|
anchors.right: next.left
|
||||||
|
margin-left: 5
|
||||||
|
|
||||||
|
ConsoleButton
|
||||||
|
id: nextChannelButton
|
||||||
|
icon: /core_styles/icons/rightarrow.png
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.top: parent.top
|
||||||
|
margin-right: 5
|
||||||
|
margin-top: 6
|
||||||
|
enabled: false
|
||||||
|
|
||||||
Panel
|
Panel
|
||||||
id: consoleBuffer
|
id: consoleBuffer
|
||||||
anchors.top: parent.top
|
anchors.top: prev.bottom
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.bottom: consoleLineEdit.top
|
anchors.bottom: consoleLineEdit.top
|
||||||
margin-right: 6
|
margin-right: 6
|
||||||
margin-left: 6
|
margin-left: 6
|
||||||
margin-bottom: 2
|
margin-bottom: 4
|
||||||
margin-top: 6
|
margin-top: 4
|
||||||
layout:
|
|
||||||
type: verticalBox
|
|
||||||
align-bottom: true
|
|
||||||
focusable: false
|
focusable: false
|
||||||
|
|
||||||
SayModeButton
|
ConsoleButton
|
||||||
id: sayModeButton
|
id: sayModeButton
|
||||||
|
icon: /core_styles/icons/say.png
|
||||||
size: 20 20
|
size: 20 20
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
|
|
|
@ -5,16 +5,16 @@ importStyle 'textmessage.otui'
|
||||||
|
|
||||||
-- private variables
|
-- private variables
|
||||||
local MessageTypes = {
|
local MessageTypes = {
|
||||||
warning = { color = '#F55E5E', showOnConsole = true, windowLocation = 'center', consoleOption = 'showInfoMessagesInConsole' },
|
consoleRed = { color = '#F55E5E', consoleChannel = 'Server Log' },
|
||||||
eventAdvance = { color = '#FFFFFF', showOnConsole = true, windowLocation = 'center', consoleOption = 'showEventMessagesInConsole' },
|
eventOrange = { color = '#FE6500', consoleChannel = 'Default' , windowLocation = 'center', consoleOption = 'showEventMessagesInConsole' },
|
||||||
eventDefault = { color = '#FFFFFF', showOnConsole = true, windowLocation = 'bottom', consoleOption = 'showEventMessagesInConsole' },
|
consoleOrange = { color = '#FE6500', consoleChannel = 'Default' },
|
||||||
eventOrange = { color = '#FE6500', showOnConsole = true, windowLocation = 'bottom', consoleOption = 'showEventMessagesInConsole' },
|
warning = { color = '#F55E5E', consoleChannel = 'Server Log', windowLocation = 'center' },
|
||||||
statusDefault = { color = '#FFFFFF', showOnConsole = true, windowLocation = 'bottom', consoleOption = 'showStatusMessagesInConsole' },
|
eventAdvance = { color = '#FFFFFF', consoleChannel = 'Server Log', windowLocation = 'center', consoleOption = 'showEventMessagesInConsole' },
|
||||||
infoDescription = { color = '#00EB00', showOnConsole = true, windowLocation = 'center', consoleOption = 'showInfoMessagesInConsole' },
|
eventDefault = { color = '#FFFFFF', consoleChannel = 'Server Log', windowLocation = 'bottom', consoleOption = 'showEventMessagesInConsole' },
|
||||||
statusSmall = { color = '#FFFFFF', showOnConsole = false, windowLocation = 'bottom' },
|
statusDefault = { color = '#FFFFFF', consoleChannel = 'Server Log', windowLocation = 'bottom', consoleOption = 'showStatusMessagesInConsole' },
|
||||||
consoleOrange = { color = '#FE6500', showOnConsole = true },
|
infoDescription = { color = '#00EB00', consoleChannel = 'Server Log', windowLocation = 'center', consoleOption = 'showInfoMessagesInConsole' },
|
||||||
consoleBlue = { color = '#9F9DFD', showOnConsole = true },
|
statusSmall = { color = '#FFFFFF', windowLocation = 'bottom' },
|
||||||
consoleRed = { color = '#F55E5E', showOnConsole = true }
|
consoleBlue = { color = '#9F9DFD', consoleChannel = 'Default' },
|
||||||
}
|
}
|
||||||
|
|
||||||
local bottomLabelWidget
|
local bottomLabelWidget
|
||||||
|
@ -26,9 +26,9 @@ local centerLabelHideEvent
|
||||||
local function displayMessage(msgtype, msg, time)
|
local function displayMessage(msgtype, msg, time)
|
||||||
if not Game.isOnline() then return end
|
if not Game.isOnline() then return end
|
||||||
|
|
||||||
if msgtype.showOnConsole then
|
if msgtype.consoleChannel ~= nil then
|
||||||
if msgtype.consoleOption == nil or Options[msgtype.consoleOption] then
|
if msgtype.consoleOption == nil or Options[msgtype.consoleOption] then
|
||||||
Console.addText(msg, msgtype.color)
|
Console.addChannelMessage(msg, msgtype.color, msgtype.consoleChannel)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include <otclient/ui/uigame.h>
|
#include <otclient/ui/uigame.h>
|
||||||
#include <otclient/core/outfit.h>
|
#include <otclient/core/outfit.h>
|
||||||
|
|
||||||
|
|
||||||
void OTClient::registerLuaFunctions()
|
void OTClient::registerLuaFunctions()
|
||||||
{
|
{
|
||||||
Application::registerLuaFunctions();
|
Application::registerLuaFunctions();
|
||||||
|
|