Improvements in textedit and hotkey manager

* Set textedit's cursor position to the end of text in some situations
* Send hotkey messages to the current channel instead of default channel
* Allow to overwrite sprites using otml and pngs
This commit is contained in:
Eduardo Bart
2013-01-24 18:36:04 -02:00
parent a8fbd6cdfc
commit d5b4e0929f
8 changed files with 38 additions and 17 deletions

View File

@@ -91,6 +91,7 @@ function EnterGame.init()
if port == nil or port == 0 then port = 7171 end
enterGame:getChildById('accountNameTextEdit'):setText(account)
enterGame:getChildById('accountNameTextEdit'):setCursorPos(-1)
enterGame:getChildById('accountPasswordTextEdit'):setText(password)
enterGame:getChildById('serverHostTextEdit'):setText(host)
enterGame:getChildById('serverPortTextEdit'):setText(port)

View File

@@ -223,6 +223,7 @@ end
function setTextEditText(text)
consoleTextEdit:setText(text)
consoleTextEdit:setCursorPos(-1)
end
function openHelp()
@@ -529,7 +530,7 @@ function sendMessage(message, tab)
if chatCommandInitial == chatCommandEnd then
chatCommandPrivateRepeat = false
if chatCommandInitial == "*" then
consoleTextEdit:setText('*'.. chatCommandPrivate .. '* ')
setTextEditText('*'.. chatCommandPrivate .. '* ')
end
message = chatCommandMessage:trim()
chatCommandPrivateReady = true
@@ -615,7 +616,7 @@ function navigateMessageHistory(step)
currentMessageIndex = math.min(math.max(currentMessageIndex + step, 0), numCommands)
if currentMessageIndex > 0 then
local command = messageHistory[numCommands - currentMessageIndex + 1]
consoleTextEdit:setText(command)
setTextEditText(command)
else
consoleTextEdit:clearText()
end

View File

@@ -289,7 +289,7 @@ function call(keyCombo)
local hotKey = hotkeyList[keyCombo]
if hotKey ~= nil and hotKey.itemId == nil and hotKey.value ~= '' then
if hotKey.autoSend then
g_game.talk(hotKey.value)
modules.game_console.sendMessage(hotKey.value)
else
modules.game_console.setTextEditText(hotKey.value)
end