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
== UI
[bart] fix massive hotkeys when holding down a key
[bart] tab widgets
[bart] add anchors API
[bart] scrollbar
@ -46,6 +47,8 @@
[bart] reapply anchor styles when adding new childs
[bart] ui text selection
break window anchors when moving
== Client modules
[bart] modules managment interface
[bart] console history, text selection, scrolling

View File

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

View File

@ -19,7 +19,7 @@ OptionCheckBox < CheckBox
MainWindow
id: optionsWindow
title: Options
size: 286 160
size: 286 280
@onEnter: Options.hide()
@onEscape: Options.hide()
@ -41,8 +41,27 @@ MainWindow
text: Classic control
OptionCheckBox
id: showLevelInConsole
text: Show players level in console
id: showInfoMessagesInConsole
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
text: Ok

View File

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

View File

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

View File

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