questlog module complete
This commit is contained in:
parent
f290d821f1
commit
2f0a151fed
2
TODO
2
TODO
|
@ -3,8 +3,6 @@ game_shaders (with shader manager)
|
|||
game_map (with save/load/options)
|
||||
game_minimap (with all tibia functionality)
|
||||
game_playertrade
|
||||
game_textbooks
|
||||
game_questlog
|
||||
game_ruleviolations
|
||||
|
||||
== NOTABLE FEATURES
|
||||
|
|
|
@ -5,6 +5,18 @@ Label < UILabel
|
|||
$disabled:
|
||||
color: #bbbbbb88
|
||||
|
||||
FlatLabel < UILabel
|
||||
font: verdana-11px-antialised
|
||||
color: #aaaaaa
|
||||
size: 86 20
|
||||
text-offset: 3 3
|
||||
text-margin: 3
|
||||
image-source: /core_styles/styles/images/panel_flat.png
|
||||
image-border: 1
|
||||
|
||||
$disabled:
|
||||
color: #aaaaaa88
|
||||
|
||||
GameLabel < UILabel
|
||||
font: verdana-11px-antialised
|
||||
color: #bbbbbb
|
||||
|
|
|
@ -88,25 +88,11 @@ MiniWindow
|
|||
margin-top: 5
|
||||
&position: {x=65535, y=10, z=0}
|
||||
|
||||
GameLabel
|
||||
id: soul
|
||||
anchors.top: slot9.bottom
|
||||
anchors.bottom: slot8.bottom
|
||||
anchors.left: slot9.left
|
||||
anchors.right: slot9.right
|
||||
margin-top: 5
|
||||
text-align: center
|
||||
image-source: /core_styles/styles/images/panel_flat.png
|
||||
image-border: 1
|
||||
|
||||
GameLabel
|
||||
id: capacity
|
||||
height: 30
|
||||
anchors.top: slot10.bottom
|
||||
anchors.bottom: slot8.bottom
|
||||
anchors.left: slot10.left
|
||||
anchors.right: slot10.right
|
||||
margin-top: 5
|
||||
text-align: center
|
||||
image-source: /core_styles/styles/images/panel_flat.png
|
||||
image-border: 1
|
||||
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
MissionLabel < Label
|
||||
font: verdana-11px-monochrome
|
||||
background-color: alpha
|
||||
text-offset: 2 0
|
||||
focusable: true
|
||||
|
||||
$focus:
|
||||
background-color: #ffffff22
|
||||
color: #ffffff
|
||||
|
||||
QuestLineWindow < MainWindow
|
||||
id: questLineWindow
|
||||
!text: tr('Quest Log')
|
||||
size: 500 400
|
||||
@onEscape: self:destroy()
|
||||
|
||||
TextList
|
||||
id: missionList
|
||||
anchors.fill: parent
|
||||
anchors.bottom: none
|
||||
width: 200
|
||||
height: 200
|
||||
padding: 1
|
||||
focusable: false
|
||||
margin-right: 20
|
||||
vertical-scrollbar: missionListScrollBar
|
||||
|
||||
VerticalScrollBar
|
||||
id: missionListScrollBar
|
||||
anchors.top: missionList.top
|
||||
anchors.bottom: missionList.bottom
|
||||
anchors.left: missionList.right
|
||||
step: 14
|
||||
pixels-scroll: true
|
||||
|
||||
FlatLabel
|
||||
id: missionDescription
|
||||
anchors.top: missionList.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: missionListScrollBar.right
|
||||
anchors.bottom: parent.bottom
|
||||
margin-bottom: 30
|
||||
margin-top: 10
|
||||
text-wrap: true
|
||||
|
||||
Button
|
||||
id: closeButton
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
!text: tr('Close')
|
||||
width: 90
|
||||
@onClick: self:getParent():destroy()
|
|
@ -1,30 +1,87 @@
|
|||
QuestLog = {}
|
||||
|
||||
local questLogButton
|
||||
local questLogWindow
|
||||
local questLineWindow
|
||||
|
||||
-- g_game.requestQuestLog()
|
||||
-- g_game.requestQuestLine(questId)
|
||||
|
||||
local function onGameQuestLog(questList)
|
||||
for i,questEntry in pairs(questList) do
|
||||
local id, name, done = unpack(questEntry)
|
||||
print(id, name, done)
|
||||
local function onGameQuestLog(quests)
|
||||
QuestLog.destroyWindows()
|
||||
|
||||
questLogWindow = createWidget('QuestLogWindow', rootWidget)
|
||||
local questList = questLogWindow:getChildById('questList')
|
||||
|
||||
for i,questEntry in pairs(quests) do
|
||||
local id, name, completed = unpack(questEntry)
|
||||
|
||||
local questLabel = createWidget('QuestLabel', questList)
|
||||
questLabel:setOn(completed)
|
||||
questLabel:setText(name)
|
||||
questLabel.onDoubleClick = function()
|
||||
questLogWindow:hide()
|
||||
g_game.requestQuestLine(id)
|
||||
end
|
||||
end
|
||||
|
||||
questLogWindow.onDestroy = function()
|
||||
questLogWindow = nil
|
||||
end
|
||||
end
|
||||
|
||||
local function onGameQuestLine(questId, questMissions)
|
||||
if questLogWindow then questLogWindow:hide() end
|
||||
if questLineWindow then questLineWindow:destroy() end
|
||||
|
||||
questLineWindow = createWidget('QuestLineWindow', rootWidget)
|
||||
local missionList = questLineWindow:getChildById('missionList')
|
||||
local missionDescription = questLineWindow:getChildById('missionDescription')
|
||||
|
||||
missionList.onChildFocusChange = function(self, focusedChild)
|
||||
if focusedChild == nil then return end
|
||||
missionDescription:setText(focusedChild.description)
|
||||
end
|
||||
|
||||
for i,questMission in pairs(questMissions) do
|
||||
local name, description = unpack(questMission)
|
||||
print(name, description)
|
||||
|
||||
local missionLabel = createWidget('MissionLabel', missionList)
|
||||
missionLabel:setText(name)
|
||||
missionLabel.description = description
|
||||
end
|
||||
|
||||
questLineWindow.onDestroy = function()
|
||||
if questLogWindow then questLogWindow:show() end
|
||||
questLineWindow = nil
|
||||
end
|
||||
end
|
||||
|
||||
function QuestLog.init()
|
||||
importStyle 'questlogwindow.otui'
|
||||
importStyle 'questlinewindow.otui'
|
||||
|
||||
questLogButton = TopMenu.addGameButton('questLogButton', tr('Quest Log'), 'questlog.png', function() g_game.requestQuestLog() end)
|
||||
|
||||
connect(g_game, { onQuestLog = onGameQuestLog })
|
||||
connect(g_game, { onQuestLine= onGameQuestLine })
|
||||
end
|
||||
|
||||
function QuestLog.destroyWindows()
|
||||
if questLogWindow then
|
||||
questLogWindow:destroy()
|
||||
questLogWindow = nil
|
||||
end
|
||||
|
||||
if questLineWindow then
|
||||
questLineWindow:destroy()
|
||||
questLineWindow = nil
|
||||
end
|
||||
end
|
||||
|
||||
function QuestLog.terminate()
|
||||
disconnect(g_game, { onQuestLog = onGameQuestLog })
|
||||
disconnect(g_game, { onQuestLine= onGameQuestLine })
|
||||
|
||||
QuestLog.destroyWindows()
|
||||
end
|
||||
|
|
|
@ -1 +1,51 @@
|
|||
QuestLogWindow < MainWindow
|
||||
QuestLabel < Label
|
||||
font: verdana-11px-monochrome
|
||||
background-color: alpha
|
||||
text-offset: 2 0
|
||||
focusable: true
|
||||
color: #cccccc
|
||||
|
||||
$focus:
|
||||
color: #ffffff
|
||||
|
||||
$on:
|
||||
background-color: #006600
|
||||
$!on:
|
||||
background-color: #660000
|
||||
|
||||
$on focus:
|
||||
background-color: #004400
|
||||
$!on focus:
|
||||
background-color: #440000
|
||||
|
||||
QuestLogWindow < MainWindow
|
||||
id: questLogWindow
|
||||
!text: tr('Quest Log')
|
||||
size: 500 400
|
||||
@onEscape: self:destroy()
|
||||
|
||||
TextList
|
||||
id: questList
|
||||
anchors.fill: parent
|
||||
width: 190
|
||||
padding: 1
|
||||
focusable: false
|
||||
margin-bottom: 30
|
||||
margin-right: 20
|
||||
vertical-scrollbar: questListScrollBar
|
||||
|
||||
VerticalScrollBar
|
||||
id: questListScrollBar
|
||||
anchors.top: questList.top
|
||||
anchors.bottom: questList.bottom
|
||||
anchors.left: questList.right
|
||||
step: 14
|
||||
pixels-scroll: true
|
||||
|
||||
Button
|
||||
id: closeButton
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
!text: tr('Close')
|
||||
width: 90
|
||||
@onClick: self:getParent():destroy()
|
||||
|
|
|
@ -60,7 +60,7 @@ local function onGameEditList(id, doorId, text)
|
|||
textEdit:setMaxLength(8192)
|
||||
textEdit:setText(text)
|
||||
textEdit:setEnabled(true)
|
||||
description:setText(tr('Enter one text per line.'))
|
||||
description:setText(tr('Enter one name per line.'))
|
||||
textWindow:setText(tr('Edit List'))
|
||||
|
||||
okButton.onClick = function()
|
||||
|
|
|
@ -33,7 +33,7 @@ public:
|
|||
static TexturePtr loadPNG(std::stringstream& file);
|
||||
|
||||
private:
|
||||
std::map<std::string, TextureWeakPtr> m_textures;
|
||||
std::unordered_map<std::string, TextureWeakPtr> m_textures;
|
||||
};
|
||||
|
||||
extern TextureManager g_textures;
|
||||
|
|
|
@ -82,7 +82,7 @@ private:
|
|||
Boolean<false> m_hoverUpdateScheduled;
|
||||
bool m_isOnInputEvent;
|
||||
Boolean<false> m_drawDebugBoxes;
|
||||
std::map<std::string, OTMLNodePtr> m_styles;
|
||||
std::unordered_map<std::string, OTMLNodePtr> m_styles;
|
||||
};
|
||||
|
||||
extern UIManager g_ui;
|
||||
|
|
Loading…
Reference in New Issue