From 382a12f181f69d3f9bff61f8c6e28538415882ad Mon Sep 17 00:00:00 2001 From: halx99 Date: Sun, 13 Jun 2021 10:05:30 +0800 Subject: [PATCH] Improve progress timer (#375) --- cocos/2d/CCProgressTimer.cpp | 9 +++++++++ cocos/2d/CCProgressTimer.h | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cocos/2d/CCProgressTimer.cpp b/cocos/2d/CCProgressTimer.cpp index 35e7bbba81..e302108500 100644 --- a/cocos/2d/CCProgressTimer.cpp +++ b/cocos/2d/CCProgressTimer.cpp @@ -3,6 +3,7 @@ Copyright (c) 2010 Lam Pham Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2013-2017 Chukong Technologies Inc Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. +Copyright (c) 2021 Bytedance Inc. http://www.cocos2d-x.org @@ -229,6 +230,14 @@ Vec2 ProgressTimer::vertexFromAlphaPoint(Vec2 alpha) return ret; } +void ProgressTimer::updateDisplayedOpacity(uint8_t parentOpacity) +{ + Node::updateDisplayedOpacity(parentOpacity); + + _sprite->updateDisplayedOpacity(_displayedOpacity); + updateProgress(); +} + void ProgressTimer::updateColor() { if (!_sprite) diff --git a/cocos/2d/CCProgressTimer.h b/cocos/2d/CCProgressTimer.h index 54c23c4adb..f59e7866b4 100644 --- a/cocos/2d/CCProgressTimer.h +++ b/cocos/2d/CCProgressTimer.h @@ -3,6 +3,7 @@ Copyright (c) 2010 Lam Pham Copyright (c) 2010-2012 cocos2d-x.org Copyright (c) 2013-2016 Chukong Technologies Inc. Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. +Copyright (c) 2021 Bytedance Inc. http://www.cocos2d-x.org @@ -176,7 +177,8 @@ protected: void updateProgress(); void updateBar(); void updateRadial(); - virtual void updateColor() override; + void updateDisplayedOpacity(uint8_t parentOpacity) override; + void updateColor() override; Vec2 boundaryTexCoord(char index); Type _type = Type::RADIAL;