restore old modules

* partially restore vip, battle, healthbar, skills and inventory modules
* more fixes on UIWidgets
* implement UIMiniWindow close/minimize functionality
* allow drag and drop miniwindows beteween game panels
This commit is contained in:
Eduardo Bart
2012-03-28 11:10:21 -03:00
parent e2ea267703
commit 8d14d9bc99
34 changed files with 301 additions and 196 deletions

View File

@@ -14,10 +14,11 @@ Module
- game_console
- game_outfit
- game_healthbar
- game_skills
- game_inventory
//- game_combatcontrols
//- game_skills
//- game_viplist
- game_combatcontrols
- game_battle
- game_viplist
//- game_hotkeys
@onLoad: |

View File

@@ -1,6 +1,7 @@
GameSidePanel < UIMiniWindowContainer
image-source: images/sidepanel.png
image-border: 4
padding: 4
GameBottomPanel < Panel
image-source: images/bottompanel.png
@@ -33,7 +34,7 @@ UIWidget
GameSidePanel
id: gameLeftPanel
width: 0
width: 190
layout: verticalBox
anchors.left: parent.left
anchors.top: parent.top
@@ -66,6 +67,7 @@ UIWidget
anchors.bottom: parent.bottom
relative-margin: right
margin-right: 190
enabled: false
@canUpdateMargin: function(self, newMargin) return math.max(math.min(newMargin, self:getParent():getWidth() - 300), 150) end
@onGeometryChange: function(self) self:setMarginRight(math.min(math.max(self:getParent():getWidth() - 300, 150), self:getMarginRight())) end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 551 B

After

Width:  |  Height:  |  Size: 626 B

View File

@@ -1,23 +1,22 @@
MiniWindow < UIMiniWindow
font: verdana-11px-antialised
//icon: /core_styles/icons/login.png
icon-rect: 4 4 16 16
width: 192
height: 200
text-offset: 26 5
text-align: topLeft
margin-top: 2
margin-left: 6
margin-right: 6
margin-bottom: 2
move-policy: free updated
image-source: /game/images/miniwindow.png
image-border: 4
image-border-top: 23
image-border-left: 23
image-border-bottom: 4
focusable: false
&minimizedHeight: 24
$on:
height: 24
image-border-bottom: 1
image-border-bottom: 2
UIButton
id: closeButton
@@ -27,13 +26,13 @@ MiniWindow < UIMiniWindow
margin-right: 5
size: 14 14
image-source: /game/images/miniwindowbuttons.png
image-clip: 14 0 14 14
image-clip: 28 0 14 14
$hover:
image-clip: 14 14 14 14
image-clip: 28 14 14 14
$pressed:
image-clip: 14 28 14 14
image-clip: 28 28 14 14
UIButton
id: minimizeButton
@@ -50,6 +49,15 @@ MiniWindow < UIMiniWindow
$pressed:
image-clip: 0 28 14 14
$on:
image-clip: 14 0 14 14
$on hover:
image-clip: 14 14 14 14
$on pressed:
image-clip: 14 28 14 14
VerticalScrollBar
id: miniwindowScrollBar
anchors.top: parent.top
@@ -67,14 +75,16 @@ MiniWindow < UIMiniWindow
anchors.left: parent.left
anchors.right: parent.right
height: 3
minimum: 70
minimum: 64
background: #ffffff88
MiniWindowContents < ScrollablePanel
id: contentsPanel
anchors.fill: parent
margin-right: 14
padding: 25 8 3 8
padding: 25 6 6 6
vertical-scrollbar: miniwindowScrollBar
BorderlessGameWindow < UIWindow
focusable: false
margin: 2

View File

@@ -27,7 +27,7 @@ end
function UIItem:onDrop(widget, mousePos)
if self:isVirtual() then return false end
if not widget or not widget.currentDragThing then return true end
if not widget or not widget.currentDragThing then return false end
local pos = self.position
local count = widget.currentDragThing:getCount()

View File

@@ -2,10 +2,16 @@ UIMiniWindow = extends(UIWindow)
function UIMiniWindow.create()
local miniwindow = UIMiniWindow.internalCreate()
miniwindow:setFocusable(false)
return miniwindow
end
function UIMiniWindow:onSetup()
addEvent(function()
self:getChildById('closeButton').onClick = function() signalcall(self.onClose, self) end
self:getChildById('minimizeButton').onClick = function() signalcall(self.onMinimize, self) end
end)
end
function UIMiniWindow:onDragEnter(mousePos)
local parent = self:getParent()
if not parent then return false end
@@ -19,9 +25,19 @@ function UIMiniWindow:onDragEnter(mousePos)
local oldPos = self:getPosition()
self.movingReference = { x = mousePos.x - oldPos.x, y = mousePos.y - oldPos.y }
self:setPosition(oldPos)
self.free = true
return true
end
function UIMiniWindow:onMousePress()
local parent = self:getParent()
if not parent then return false end
if parent:getClassName() ~= 'UIMiniWindowContainer' then
self:raise()
return true
end
end
function UIMiniWindow:onDragLeave(droppedWidget, mousePos)
-- TODO: drop on other interfaces
end
@@ -35,3 +51,25 @@ function UIMiniWindow:onFocusChange(focused)
end
end
function UIMiniWindow:onClose()
end
function UIMiniWindow:onMinimize()
if self:isOn() then
self:setOn(false)
self:getChildById('contentsPanel'):show()
self:getChildById('miniwindowScrollBar'):show()
self:getChildById('bottomResizeBorder'):show()
self:getChildById('minimizeButton'):setOn(false)
self:setHeight(self.savedHeight)
else
self.savedHeight = self:getHeight()
self:setHeight(self.minimizedHeight)
self:setOn(true)
self:getChildById('contentsPanel'):hide()
self:getChildById('miniwindowScrollBar'):hide()
self:getChildById('bottomResizeBorder'):hide()
self:getChildById('minimizeButton'):setOn(true)
end
end

View File

@@ -8,7 +8,8 @@ function UIMiniWindowContainer.create()
end
function UIMiniWindowContainer:onDrop(widget, mousePos)
print 'drop'
widget:setParent(self)
return true
end
function UIMiniWindowContainer:getClassName()