Skip to content

Commit 0ac956f

Browse files
committed
Merge pull request cocos2d#387 from htlxyz/v3
add getPercent interface to UILoadingBar
2 parents e9030e6 + 46f3581 commit 0ac956f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

quick/framework/cc/ui/UILoadingBar.lua

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,10 @@ end
101101
-- end --
102102

103103
function UILoadingBar:setPercent(percent)
104+
self.percent_ = percent
104105
local rect = cc.rect(self.viewRect_.x, self.viewRect_.y,
105106
self.viewRect_.width, self.viewRect_.height)
106-
local newWidth = rect.width*percent/100
107+
local newWidth = rect.width*self.percent_/100
107108

108109
rect.x = 0
109110
rect.y = 0
@@ -128,6 +129,19 @@ end
128129

129130
-- start --
130131

132+
--------------------------------
133+
-- 得到进度控件的进度
134+
-- @function [parent=#UILoadingBar] getPercent
135+
-- @return number 进度值
136+
137+
-- end --
138+
139+
function UILoadingBar:getPercent()
140+
return self.percent_
141+
end
142+
143+
-- start --
144+
131145
--------------------------------
132146
-- 设置进度控件的方向
133147
-- @function [parent=#UILoadingBar] setDirction

0 commit comments

Comments
 (0)