• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Help - changing the direction of expeciencia bar.

soltoreats

New Member
Joined
May 18, 2016
Messages
27
Reaction score
0
hello friends , I would like to know how to do the following. my experience is common bar she carries to right as will getting correct experience.

following example:

QH2AQBh.png


I would like to do the following to use an image that covers it in ball format like to get the following effect more to this need she carries herself up and not right.

following example:

i6GEqWk.png


Follow my archive otui of expecience bar.

ExperienceBar < ProgressBar
id: experienceBar
width: 53
height: 53
background-color: #835915
image-source: img/esfere
anchors.top: parent.top
anchors.left: parent.left
margin-top:17
margin-left:7


thanks for listening!
 
Add new ProgressBar to progrssbar.otui and switch functions that will fill bar from bottom to top.
 
File found.

otc

view code:

ProgressBar < UIProgressBar
height: 16
background-color: red
image-source: /images/ui/progressbar
image-border: 1
font: verdana-11px-rounded
text-offset: 0 2

$!on:
visible: false
margin-top: 0
margin-bottom: 0
height: 0

LifeProgressBar < UIProgressBar
height: 16
background-color: green
border: 1 black
font: verdana-11px-rounded
text-offset: 0 2
margin: 2

ProgressRect < UIProgressRect
anchors.fill: parent
phantom: true
color: white
background-color: #00000088
font: verdana-11px-rounded


.......................................
where changing the functions that will fill low bar up.?
 
all much which of these lines I should modify to achieve reverse loading bar ?

-- @docclass
UIProgressBar = extends(UIWidget, "UIProgressBar")

function UIProgressBar.create()
local progressbar = UIProgressBar.internalCreate()
progressbar:setFocusable(false)
progressbar:setOn(true)
progressbar.min = 0
progressbar.max = 100
progressbar.value = 0
progressbar.bgBorderLeft = 0
progressbar.bgBorderRight = 0
progressbar.bgBorderTop = 0
progressbar.bgBorderBottom = 0
return progressbar
end

function UIProgressBar:setMinimum(minimum)
self.minimum = minimum
if self.value < minimum then
self:setValue(minimum)
end
end

function UIProgressBar:setMaximum(maximum)
self.maximum = maximum
if self.value > maximum then
self:setValue(maximum)
end
end

function UIProgressBar:setValue(value, minimum, maximum)
if minimum then
self:setMinimum(minimum)
end

if maximum then
self:setMaximum(maximum)
end

self.value = math.max(math.min(value, self.maximum), self.minimum)
self:updateBackground()
end

function UIProgressBar:setPercent(percent)
self:setValue(percent, 0, 100)
end

function UIProgressBar:getPercent()
return self.value
end

function UIProgressBar:getPercentPixels()
return (self.maximum - self.minimum) / self:getWidth()
end

function UIProgressBar:getProgress()
if self.minimum == self.maximum then return 1 end
return (self.value - self.minimum) / (self.maximum - self.minimum)
end

function UIProgressBar:updateBackground()
if self:isOn() then
local width = math.round(math.max((self:getProgress() * (self:getWidth() - self.bgBorderLeft - self.bgBorderRight)), 1))
local height = self:getHeight() - self.bgBorderTop - self.bgBorderBottom
local rect = { x = self.bgBorderLeft, y = self.bgBorderTop, width = width, height = height }
self:setBackgroundRect(rect)
end
end

function UIProgressBar:eek:nSetup()
self:updateBackground()
end

function UIProgressBar:eek:nStyleApply(name, node)
for name,value in pairs(node) do
if name == 'background-border-left' then
self.bgBorderLeft = tonumber(value)
elseif name == 'background-border-right' then
self.bgBorderRight = tonumber(value)
elseif name == 'background-border-top' then
self.bgBorderTop = tonumber(value)
elseif name == 'background-border-bottom' then
self.bgBorderBottom = tonumber(value)
elseif name == 'background-border' then
self.bgBorderLeft = tonumber(value)
self.bgBorderRight = tonumber(value)
self.bgBorderTop = tonumber(value)
self.bgBorderBottom = tonumber(value)
end
end
end

function UIProgressBar:eek:nGeometryChange(oldRect, newRect)
if not self:isOn() then
self:setHeight(0)
end
self:updateBackground()
end
 
All of them? As all this code is related to normal progressbar from left > right.
 
Back
Top