console options

This commit is contained in:
Eduardo Bart 2012-01-08 21:28:49 -02:00
parent fdc9087870
commit 90900e44a7
6 changed files with 50 additions and 16 deletions

3
TODO
View File

@ -21,6 +21,7 @@
[bart] port to MacOs and iphone [bart] port to MacOs and iphone
== UI == UI
[bart] fix massive hotkeys when holding down a key
[bart] tab widgets [bart] tab widgets
[bart] add anchors API [bart] add anchors API
[bart] scrollbar [bart] scrollbar
@ -46,6 +47,8 @@
[bart] reapply anchor styles when adding new childs [bart] reapply anchor styles when adding new childs
[bart] ui text selection [bart] ui text selection
break window anchors when moving
== Client modules == Client modules
[bart] modules managment interface [bart] modules managment interface
[bart] console history, text selection, scrolling [bart] console history, text selection, scrolling

View File

@ -9,7 +9,13 @@ function Options.init()
showfps = true, showfps = true,
fullscreen = false, fullscreen = false,
classicControl = false, classicControl = false,
showLevelInConsole = false} showStatusMessagesInConsole = true,
showEventMessagesInConsole = true,
showInfoMessagesInConsole = true,
showTimestampsInConsole = true,
showLevelsInConsole = true,
showPrivateMessagesInConsole = true,
}
for k,v in pairs(booleanOptions) do for k,v in pairs(booleanOptions) do
Settings.setDefault(k, v) Settings.setDefault(k, v)

View File

@ -19,7 +19,7 @@ OptionCheckBox < CheckBox
MainWindow MainWindow
id: optionsWindow id: optionsWindow
title: Options title: Options
size: 286 160 size: 286 280
@onEnter: Options.hide() @onEnter: Options.hide()
@onEscape: Options.hide() @onEscape: Options.hide()
@ -41,8 +41,27 @@ MainWindow
text: Classic control text: Classic control
OptionCheckBox OptionCheckBox
id: showLevelInConsole id: showInfoMessagesInConsole
text: Show players level in console text: Show info messages in console
OptionCheckBox
id: showEventMessagesInConsole
text: Show event messages in console
OptionCheckBox
id: showStatusMessagesInConsole
text: Show status messages in console
OptionCheckBox
id: showTimestampsInConsole
text: Show timestamps in console
OptionCheckBox
id: showLevelsInConsole
text: Show levels in console
//OptionCheckBox
// id: showPrivateMessagesInConsole
// text: Show private messages in console
Button Button
text: Ok text: Ok

View File

@ -5,7 +5,7 @@ local SpeakTypes = {
say = { color = '#FFFF00' }, say = { color = '#FFFF00' },
whisper = { color = '#FFFF00' }, whisper = { color = '#FFFF00' },
yell = { color = '#FFFF00' }, yell = { color = '#FFFF00' },
monsterSay = { color = '#FE6500' }, monsterSay = { color = '#FE6500', hideInConsole = false},
npcToPlayer = { color = '#5FF7F7' }, npcToPlayer = { color = '#5FF7F7' },
channelYellow = { color = '#FFFF00' }, channelYellow = { color = '#FFFF00' },
channelWhite = { color = '#FFFFFF' }, channelWhite = { color = '#FFFFFF' },
@ -34,18 +34,22 @@ end
function Console.addText(text, color) function Console.addText(text, color)
color = color or 'white' color = color or 'white'
if Options.showTimestampsInConsole then
text = os.date('%H:%M') .. ' ' .. text
end
local label = createWidget('ConsoleLabel', consoleBuffer) local label = createWidget('ConsoleLabel', consoleBuffer)
label:setText(text) label:setText(text)
label:setForegroundColor(color) label:setForegroundColor(color)
end end
-- hooked events -- hooked events
local function onCreatureSpeak(name, level, speaktypedesc, message) local function onCreatureSpeak(name, level, speaktypedesc, message, channelId, creaturePos)
speaktype = SpeakTypes[speaktypedesc] speaktype = SpeakTypes[speaktypedesc]
if speaktype == nil then return end if speaktype == SpeakTypes.monsterSay then return end
if name then if name then
if Options.showLevelInConsole and level > 0 then if Options.showLevelsInConsole and level > 0 then
message = name .. ' [' .. level .. ']: ' .. message message = name .. ' [' .. level .. ']: ' .. message
else else
message = name .. ': ' .. message message = name .. ': ' .. message

View File

@ -5,12 +5,12 @@ importStyle 'textmessage.otui'
-- private variables -- private variables
local MessageTypes = { local MessageTypes = {
warning = { color = '#F55E5E', showOnConsole = true, windowLocation = 'center' }, warning = { color = '#F55E5E', showOnConsole = true, windowLocation = 'center', consoleOption = 'showInfoMessagesInConsole' },
eventAdvance = { color = '#FFFFFF', showOnConsole = true, windowLocation = 'center' }, eventAdvance = { color = '#FFFFFF', showOnConsole = true, windowLocation = 'center', consoleOption = 'showEventMessagesInConsole' },
eventDefault = { color = '#FFFFFF', showOnConsole = true, windowLocation = 'bottom' }, eventDefault = { color = '#FFFFFF', showOnConsole = true, windowLocation = 'bottom', consoleOption = 'showEventMessagesInConsole' },
eventOrange = { color = '#FE6500', showOnConsole = true, windowLocation = 'bottom' }, eventOrange = { color = '#FE6500', showOnConsole = true, windowLocation = 'bottom', consoleOption = 'showEventMessagesInConsole' },
statusDefault = { color = '#FFFFFF', showOnConsole = true, windowLocation = 'bottom' }, statusDefault = { color = '#FFFFFF', showOnConsole = true, windowLocation = 'bottom', consoleOption = 'showStatusMessagesInConsole' },
infoDescription = { color = '#00EB00', showOnConsole = true, windowLocation = 'center' }, infoDescription = { color = '#00EB00', showOnConsole = true, windowLocation = 'center', consoleOption = 'showInfoMessagesInConsole' },
statusSmall = { color = '#FFFFFF', showOnConsole = false, windowLocation = 'bottom' }, statusSmall = { color = '#FFFFFF', showOnConsole = false, windowLocation = 'bottom' },
consoleOrange = { color = '#FE6500', showOnConsole = true }, consoleOrange = { color = '#FE6500', showOnConsole = true },
consoleBlue = { color = '#9F9DFD', showOnConsole = true }, consoleBlue = { color = '#9F9DFD', showOnConsole = true },
@ -27,7 +27,9 @@ 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.showOnConsole then
-- TODO if msgtype.consoleOption == nil or Options[msgtype.consoleOption] then
Console.addText(msg, msgtype.color)
end
end end
if msgtype.windowLocation then if msgtype.windowLocation then

View File

@ -257,7 +257,7 @@ public:
return tmp; return tmp;
} }
void bound(const TRect<T> &r, bool resize = false) { void bound(const TRect<T> &r) {
if(isNull() || r.isNull()) if(isNull() || r.isNull())
return; return;