Changed scrollbar style, and some other changes:
* Changed the scrollbar style to look a bit nicer. * Fixed a typo in the EventDispatcher class. * Added PlayerStates to player.lua. * Minor tweak to console tab spacing. * Add unbinding key 'Ctrl+Shift+D' in the options.
This commit is contained in:
parent
ca46b5033e
commit
3fa5993177
|
@ -124,6 +124,7 @@ end
|
||||||
function Options.terminate()
|
function Options.terminate()
|
||||||
g_keyboard.unbindKeyDown('Ctrl+D')
|
g_keyboard.unbindKeyDown('Ctrl+D')
|
||||||
g_keyboard.unbindKeyDown('Ctrl+F')
|
g_keyboard.unbindKeyDown('Ctrl+F')
|
||||||
|
g_keyboard.unbindKeyDown('Ctrl+Shift+D')
|
||||||
optionsWindow:destroy()
|
optionsWindow:destroy()
|
||||||
optionsWindow = nil
|
optionsWindow = nil
|
||||||
optionsButton:destroy()
|
optionsButton:destroy()
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
Binary file not shown.
Before Width: | Height: | Size: 638 B After Width: | Height: | Size: 661 B |
|
@ -1,15 +1,16 @@
|
||||||
ScrollBarSlider < UIButton
|
ScrollBarSlider < UIButton
|
||||||
id: sliderButton
|
id: sliderButton
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
size: 13 13
|
size: 13 17
|
||||||
image-source: /images/scrollbar.png
|
image-source: /images/scrollbar.png
|
||||||
image-clip: 0 26 13 13
|
image-clip: 0 26 13 13
|
||||||
image-border: 2
|
image-border: 2
|
||||||
image-color: #ffffffff
|
image-color: #ffffffbb
|
||||||
$hover:
|
$hover:
|
||||||
image-clip: 13 26 13 13
|
image-clip: 13 26 13 13
|
||||||
$pressed:
|
$pressed:
|
||||||
image-clip: 26 26 13 13
|
image-clip: 26 26 13 13
|
||||||
|
image-color: #ffffff99
|
||||||
$disabled:
|
$disabled:
|
||||||
image-color: #ffffff66
|
image-color: #ffffff66
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,15 @@ local function calcValues(self)
|
||||||
return range, pxrange, px, offset, center
|
return range, pxrange, px, offset, center
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function updateValueDisplay(widget)
|
||||||
|
if widget == nil then return end
|
||||||
|
|
||||||
|
if widget:getShowValue() then
|
||||||
|
local symbol = widget:getSymbol()
|
||||||
|
widget:setText(widget:getValue()..(symbol and symbol or ''))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function updateSlider(self)
|
local function updateSlider(self)
|
||||||
local slider = self:getChildById('sliderButton')
|
local slider = self:getChildById('sliderButton')
|
||||||
if slider == nil then return end
|
if slider == nil then return end
|
||||||
|
@ -63,6 +72,7 @@ local function updateSlider(self)
|
||||||
slider:setWidth(px)
|
slider:setWidth(px)
|
||||||
slider:setMarginLeft(offset)
|
slider:setMarginLeft(offset)
|
||||||
end
|
end
|
||||||
|
updateValueDisplay(self)
|
||||||
|
|
||||||
local status = (self.maximum ~= self.minimum)
|
local status = (self.maximum ~= self.minimum)
|
||||||
|
|
||||||
|
@ -96,6 +106,8 @@ function UIScrollBar.create()
|
||||||
scrollbar.step = 1
|
scrollbar.step = 1
|
||||||
scrollbar.orientation = 'vertical'
|
scrollbar.orientation = 'vertical'
|
||||||
scrollbar.pixelsScroll = false
|
scrollbar.pixelsScroll = false
|
||||||
|
scrollbar.showValue = false
|
||||||
|
scrollbar.symbol = nil
|
||||||
return scrollbar
|
return scrollbar
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -105,6 +117,7 @@ function UIScrollBar:onSetup()
|
||||||
g_mouse.bindAutoPress(self:getChildById('decrementButton'), function() self:decrement() end, 300)
|
g_mouse.bindAutoPress(self:getChildById('decrementButton'), function() self:decrement() end, 300)
|
||||||
g_mouse.bindAutoPress(self:getChildById('incrementButton'), function() self:increment() end, 300)
|
g_mouse.bindAutoPress(self:getChildById('incrementButton'), function() self:increment() end, 300)
|
||||||
g_mouse.bindPressMove(self:getChildById('sliderButton'), function(mousePos, mouseMoved) parseSliderPos(self, mousePos, mouseMoved) end)
|
g_mouse.bindPressMove(self:getChildById('sliderButton'), function(mousePos, mouseMoved) parseSliderPos(self, mousePos, mouseMoved) end)
|
||||||
|
|
||||||
updateSlider(self)
|
updateSlider(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -122,6 +135,10 @@ function UIScrollBar:onStyleApply(styleName, styleNode)
|
||||||
self:setValue(value)
|
self:setValue(value)
|
||||||
elseif name == 'pixels-scroll' then
|
elseif name == 'pixels-scroll' then
|
||||||
self.pixelsScroll = true
|
self.pixelsScroll = true
|
||||||
|
elseif name == 'show-value' then
|
||||||
|
self.showValue = true
|
||||||
|
elseif name == 'symbol' then
|
||||||
|
self.symbol = value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -185,7 +202,7 @@ function UIScrollBar:onGeometryChange()
|
||||||
end
|
end
|
||||||
|
|
||||||
function UIScrollBar:onMouseWheel(mousePos, mouseWheel)
|
function UIScrollBar:onMouseWheel(mousePos, mouseWheel)
|
||||||
if mouseWheel == MouseWheelUp then
|
if mouseWheel == MouseWheelDown then
|
||||||
if self.orientation == 'vertical' then
|
if self.orientation == 'vertical' then
|
||||||
self:decrement()
|
self:decrement()
|
||||||
else
|
else
|
||||||
|
@ -206,3 +223,5 @@ function UIScrollBar:getMinimum() return self.minimum end
|
||||||
function UIScrollBar:getValue() return math.round(self.value) end
|
function UIScrollBar:getValue() return math.round(self.value) end
|
||||||
function UIScrollBar:getStep() return self.step end
|
function UIScrollBar:getStep() return self.step end
|
||||||
function UIScrollBar:getOrientation() return self.orientation end
|
function UIScrollBar:getOrientation() return self.orientation end
|
||||||
|
function UIScrollBar:getShowValue() return self.showValue end
|
||||||
|
function UIScrollBar:getSymbol() return self.symbol end
|
|
@ -77,7 +77,7 @@ function init()
|
||||||
consoleContentPanel = consolePanel:getChildById('consoleContentPanel')
|
consoleContentPanel = consolePanel:getChildById('consoleContentPanel')
|
||||||
consoleTabBar = consolePanel:getChildById('consoleTabBar')
|
consoleTabBar = consolePanel:getChildById('consoleTabBar')
|
||||||
consoleTabBar:setContentWidget(consoleContentPanel)
|
consoleTabBar:setContentWidget(consoleContentPanel)
|
||||||
consoleTabBar:setTabSpacing(0)
|
consoleTabBar:setTabSpacing(-1)
|
||||||
channels = {}
|
channels = {}
|
||||||
|
|
||||||
defaultTab = addTab(tr('Default'), true)
|
defaultTab = addTab(tr('Default'), true)
|
||||||
|
|
|
@ -1,5 +1,24 @@
|
||||||
-- @docclass Player
|
-- @docclass Player
|
||||||
|
|
||||||
|
PlayerStates = {
|
||||||
|
None = 0,
|
||||||
|
Poison = 1,
|
||||||
|
Burn = 2,
|
||||||
|
Energy = 4,
|
||||||
|
Drunk = 8,
|
||||||
|
ManaShield = 16,
|
||||||
|
Paralyze = 32,
|
||||||
|
Haste = 64,
|
||||||
|
Swords = 128,
|
||||||
|
Drowning = 256,
|
||||||
|
Freezing = 512,
|
||||||
|
Dazzled = 1024,
|
||||||
|
Cursed = 2048,
|
||||||
|
PartyBuff = 4096,
|
||||||
|
PzBlock = 8192,
|
||||||
|
Pz = 16384
|
||||||
|
}
|
||||||
|
|
||||||
InventorySlotOther = 0
|
InventorySlotOther = 0
|
||||||
InventorySlotHead = 1
|
InventorySlotHead = 1
|
||||||
InventorySlotNeck = 2
|
InventorySlotNeck = 2
|
||||||
|
|
|
@ -45,7 +45,7 @@ void EventDispatcher::poll()
|
||||||
int loops = 0;
|
int loops = 0;
|
||||||
for(int count = 0, max = m_scheduledEventList.size(); count < max && !m_scheduledEventList.empty(); ++count) {
|
for(int count = 0, max = m_scheduledEventList.size(); count < max && !m_scheduledEventList.empty(); ++count) {
|
||||||
ScheduledEventPtr scheduledEvent = m_scheduledEventList.top();
|
ScheduledEventPtr scheduledEvent = m_scheduledEventList.top();
|
||||||
if(scheduledEvent->reamaningTicks() > 0)
|
if(scheduledEvent->remainingTicks() > 0)
|
||||||
break;
|
break;
|
||||||
m_scheduledEventList.pop();
|
m_scheduledEventList.pop();
|
||||||
scheduledEvent->execute();
|
scheduledEvent->execute();
|
||||||
|
|
|
@ -35,7 +35,7 @@ public:
|
||||||
bool nextCycle();
|
bool nextCycle();
|
||||||
|
|
||||||
int ticks() { return m_ticks; }
|
int ticks() { return m_ticks; }
|
||||||
int reamaningTicks() { return m_ticks - g_clock.millis(); }
|
int remainingTicks() { return m_ticks - g_clock.millis(); }
|
||||||
int delay() { return m_delay; }
|
int delay() { return m_delay; }
|
||||||
int cyclesExecuted() { return m_cyclesExecuted; }
|
int cyclesExecuted() { return m_cyclesExecuted; }
|
||||||
int maxCycles() { return m_maxCycles; }
|
int maxCycles() { return m_maxCycles; }
|
||||||
|
|
|
@ -191,7 +191,7 @@ void Application::registerLuaFunctions()
|
||||||
g_lua.registerClass<ScheduledEvent, Event>();
|
g_lua.registerClass<ScheduledEvent, Event>();
|
||||||
g_lua.bindClassMemberFunction<ScheduledEvent>("nextCycle", &ScheduledEvent::nextCycle);
|
g_lua.bindClassMemberFunction<ScheduledEvent>("nextCycle", &ScheduledEvent::nextCycle);
|
||||||
g_lua.bindClassMemberFunction<ScheduledEvent>("ticks", &ScheduledEvent::ticks);
|
g_lua.bindClassMemberFunction<ScheduledEvent>("ticks", &ScheduledEvent::ticks);
|
||||||
g_lua.bindClassMemberFunction<ScheduledEvent>("reamaningTicks", &ScheduledEvent::reamaningTicks);
|
g_lua.bindClassMemberFunction<ScheduledEvent>("remainingTicks", &ScheduledEvent::remainingTicks);
|
||||||
g_lua.bindClassMemberFunction<ScheduledEvent>("delay", &ScheduledEvent::delay);
|
g_lua.bindClassMemberFunction<ScheduledEvent>("delay", &ScheduledEvent::delay);
|
||||||
g_lua.bindClassMemberFunction<ScheduledEvent>("cyclesExecuted", &ScheduledEvent::cyclesExecuted);
|
g_lua.bindClassMemberFunction<ScheduledEvent>("cyclesExecuted", &ScheduledEvent::cyclesExecuted);
|
||||||
g_lua.bindClassMemberFunction<ScheduledEvent>("maxCycles", &ScheduledEvent::maxCycles);
|
g_lua.bindClassMemberFunction<ScheduledEvent>("maxCycles", &ScheduledEvent::maxCycles);
|
||||||
|
|
Loading…
Reference in New Issue