replacing tabs, fixing event hook
This commit is contained in:
parent
710f105675
commit
4563471790
|
@ -20,20 +20,20 @@ local SpeakTypesSettings = {
|
||||||
}
|
}
|
||||||
|
|
||||||
local SpeakTypes = {
|
local SpeakTypes = {
|
||||||
[SpeakSay] = SpeakTypesSettings.say,
|
[SpeakSay] = SpeakTypesSettings.say,
|
||||||
[SpeakWhisper] = SpeakTypesSettings.whisper,
|
[SpeakWhisper] = SpeakTypesSettings.whisper,
|
||||||
[SpeakYell] = SpeakTypesSettings.yell,
|
[SpeakYell] = SpeakTypesSettings.yell,
|
||||||
[SpeakBroadcast] = SpeakTypesSettings.broadcast,
|
[SpeakBroadcast] = SpeakTypesSettings.broadcast,
|
||||||
[SpeakPrivate] = SpeakTypesSettings.private,
|
[SpeakPrivate] = SpeakTypesSettings.private,
|
||||||
[SpeakPrivateRed] = SpeakTypesSettings.privateRed,
|
[SpeakPrivateRed] = SpeakTypesSettings.privateRed,
|
||||||
[SpeakPrivatePlayerToNpc] = SpeakTypesSettings.privatePlayerToNpc,
|
[SpeakPrivatePlayerToNpc] = SpeakTypesSettings.privatePlayerToNpc,
|
||||||
[SpeakPrivateNpcToPlayer] = SpeakTypesSettings.privateNpcToPlayer,
|
[SpeakPrivateNpcToPlayer] = SpeakTypesSettings.privateNpcToPlayer,
|
||||||
[SpeakChannelYellow] = SpeakTypesSettings.channelYellow,
|
[SpeakChannelYellow] = SpeakTypesSettings.channelYellow,
|
||||||
[SpeakChannelWhite] = SpeakTypesSettings.channelWhite,
|
[SpeakChannelWhite] = SpeakTypesSettings.channelWhite,
|
||||||
[SpeakChannelRed] = SpeakTypesSettings.channelRed,
|
[SpeakChannelRed] = SpeakTypesSettings.channelRed,
|
||||||
[SpeakChannelOrange] = SpeakTypesSettings.channelOrange,
|
[SpeakChannelOrange] = SpeakTypesSettings.channelOrange,
|
||||||
[SpeakMonsterSay] = SpeakTypesSettings.monsterSay,
|
[SpeakMonsterSay] = SpeakTypesSettings.monsterSay,
|
||||||
[SpeakMonsterYell] = SpeakTypesSettings.monsterYell,
|
[SpeakMonsterYell] = SpeakTypesSettings.monsterYell,
|
||||||
}
|
}
|
||||||
|
|
||||||
local consolePanel
|
local consolePanel
|
||||||
|
@ -71,15 +71,14 @@ function Console.create()
|
||||||
Hotkeys.bindKeyDown('Enter', Console.sendCurrentMessage, consolePanel)
|
Hotkeys.bindKeyDown('Enter', Console.sendCurrentMessage, consolePanel)
|
||||||
Hotkeys.bindKeyDown('Return', Console.sendCurrentMessage, consolePanel)
|
Hotkeys.bindKeyDown('Return', Console.sendCurrentMessage, consolePanel)
|
||||||
|
|
||||||
--Apply buttom functions after loaded
|
-- apply buttom functions after loaded
|
||||||
consolePanel:getChildById('nextChannelButton').onClick = function() consoleTabBar:selectNextTab() end
|
connect(consolePanel:getChildById('nextChannelButton'), { onClick = function() consoleTabBar:selectNextTab() end } )
|
||||||
consolePanel:getChildById('prevChannelButton').onClick = function() consoleTabBar:selectPrevTab() end
|
connect(consolePanel:getChildById('prevChannelButton'), { onClick = function() consoleTabBar:selectPrevTab() end } )
|
||||||
|
|
||||||
--Tibia Like Hotkeys
|
|
||||||
Hotkeys.bindKeyDown('Ctrl+O', Game.requestChannels)
|
|
||||||
Hotkeys.bindKeyDown('Ctrl+E', Console.removeCurrentTab)
|
|
||||||
|
|
||||||
connect(consoleTabBar, { onTabChange = Console.onTabChange })
|
connect(consoleTabBar, { onTabChange = Console.onTabChange })
|
||||||
|
|
||||||
|
-- tibia like hotkeys
|
||||||
|
Hotkeys.bindKeyDown('Ctrl+O', Game.requestChannels)
|
||||||
|
Hotkeys.bindKeyDown('Ctrl+E', Console.removeCurrentTab)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Console.destroy()
|
function Console.destroy()
|
||||||
|
@ -90,19 +89,19 @@ end
|
||||||
function Console.addTab(name, focus)
|
function Console.addTab(name, focus)
|
||||||
local tab = consoleTabBar:addTab(name)
|
local tab = consoleTabBar:addTab(name)
|
||||||
if focus then
|
if focus then
|
||||||
consoleTabBar:selectTab(tab)
|
consoleTabBar:selectTab(tab)
|
||||||
else
|
else
|
||||||
consoleTabBar:blinkTab(tab)
|
consoleTabBar:blinkTab(tab)
|
||||||
end
|
end
|
||||||
return tab
|
return tab
|
||||||
end
|
end
|
||||||
|
|
||||||
function Console.onTabChange(tabBar, tab)
|
function Console.onTabChange(tabBar, tab)
|
||||||
if tab:getText() == "Default" or tab:getText() == "Server Log" then
|
if tab:getText() == "Default" or tab:getText() == "Server Log" then
|
||||||
consolePanel:getChildById('closeChannelButton'):disable()
|
consolePanel:getChildById('closeChannelButton'):disable()
|
||||||
else
|
else
|
||||||
consolePanel:getChildById('closeChannelButton'):enable()
|
consolePanel:getChildById('closeChannelButton'):enable()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Console.removeCurrentTab()
|
function Console.removeCurrentTab()
|
||||||
|
@ -232,13 +231,13 @@ local function onChannelList(channelList)
|
||||||
local channelListPanel = channelsWindow:getChildById('channelList')
|
local channelListPanel = channelsWindow:getChildById('channelList')
|
||||||
channelsWindow.onEnter = function(self)
|
channelsWindow.onEnter = function(self)
|
||||||
local openPrivateChannelWith = channelsWindow:getChildById('openPrivateChannelWith'):getText()
|
local openPrivateChannelWith = channelsWindow:getChildById('openPrivateChannelWith'):getText()
|
||||||
if openPrivateChannelWith ~= '' then
|
if openPrivateChannelWith ~= '' then
|
||||||
Game.openPrivateChannel(openPrivateChannelWith)
|
Game.openPrivateChannel(openPrivateChannelWith)
|
||||||
else
|
else
|
||||||
local selectedChannelLabel = channelListPanel:getFocusedChild()
|
local selectedChannelLabel = channelListPanel:getFocusedChild()
|
||||||
if not selectedChannelLabel then return end
|
if not selectedChannelLabel then return end
|
||||||
Game.joinChannel(selectedChannelLabel.channelId)
|
Game.joinChannel(selectedChannelLabel.channelId)
|
||||||
end
|
end
|
||||||
channelsWindow:destroy()
|
channelsWindow:destroy()
|
||||||
end
|
end
|
||||||
for k,v in pairs(channelList) do
|
for k,v in pairs(channelList) do
|
||||||
|
@ -258,4 +257,4 @@ connect(Game, { onLogin = Console.create,
|
||||||
onCreatureSpeak = onCreatureSpeak,
|
onCreatureSpeak = onCreatureSpeak,
|
||||||
onChannelList = onChannelList,
|
onChannelList = onChannelList,
|
||||||
onOpenChannel = onOpenChannel,
|
onOpenChannel = onOpenChannel,
|
||||||
onOpenPrivateChannel = onOpenPrivateChannel})
|
onOpenPrivateChannel = onOpenPrivateChannel})
|
Loading…
Reference in New Issue