diff --git a/cocos/ui/UIButton.cpp b/cocos/ui/UIButton.cpp index f18bd2a39b..9b54a2b440 100644 --- a/cocos/ui/UIButton.cpp +++ b/cocos/ui/UIButton.cpp @@ -260,7 +260,10 @@ void Button::loadTextureNormal(const std::string& normal,TextureResType texType) _normalTextureSize = _buttonNormalRenderer->getContentSize(); updateFlippedX(); updateFlippedY(); - updateRGBAToRenderer(_buttonNormalRenderer); + + _buttonNormalRenderer->setColor(this->getColor()); + _buttonNormalRenderer->setOpacity(this->getOpacity()); + updateContentSizeWithTextureSize(_normalTextureSize); _normalTextureLoaded = true; _normalTextureAdaptDirty = true; @@ -308,7 +311,10 @@ void Button::loadTexturePressed(const std::string& selected,TextureResType texTy _pressedTextureSize = _buttonClickedRenderer->getContentSize(); updateFlippedX(); updateFlippedY(); - updateRGBAToRenderer(_buttonDisableRenderer); + + _buttonDisableRenderer->setColor(this->getColor()); + _buttonDisableRenderer->setOpacity(this->getOpacity()); + _pressedTextureLoaded = true; _pressedTextureAdaptDirty = true; } @@ -355,7 +361,9 @@ void Button::loadTextureDisabled(const std::string& disabled,TextureResType texT _disabledTextureSize = _buttonDisableRenderer->getContentSize(); updateFlippedX(); updateFlippedY(); - updateRGBAToRenderer(_buttonDisableRenderer); + _buttonDisableRenderer->setColor(this->getColor()); + _buttonDisableRenderer->setOpacity(this->getOpacity()); + _disabledTextureLoaded = true; _disabledTextureAdaptDirty = true; } @@ -432,7 +440,7 @@ void Button::onPressStateChangedToNormal() { if (_scale9Enabled) { - updateTextureRGBA(); + updateTexturesRGBA(); } else { @@ -441,6 +449,17 @@ void Button::onPressStateChangedToNormal() } } } + +void Button::updateTexturesRGBA() +{ + _buttonNormalRenderer->setColor(this->getColor()); + _buttonClickedRenderer->setColor(this->getColor()); + _buttonDisableRenderer->setColor(this->getColor()); + + _buttonNormalRenderer->setOpacity(this->getOpacity()); + _buttonClickedRenderer->setOpacity(this->getOpacity()); + _buttonDisableRenderer->setOpacity(this->getOpacity()); +} void Button::onPressStateChangedToPressed() { @@ -732,27 +751,6 @@ std::string Button::getDescription() const { return "Button"; } - -void Button::updateTextureColor() -{ - updateColorToRenderer(_buttonNormalRenderer); - updateColorToRenderer(_buttonClickedRenderer); - updateColorToRenderer(_buttonDisableRenderer); -} - -void Button::updateTextureOpacity() -{ - updateOpacityToRenderer(_buttonNormalRenderer); - updateOpacityToRenderer(_buttonClickedRenderer); - updateOpacityToRenderer(_buttonDisableRenderer); -} - -void Button::updateTextureRGBA() -{ - updateRGBAToRenderer(_buttonNormalRenderer); - updateRGBAToRenderer(_buttonClickedRenderer); - updateRGBAToRenderer(_buttonDisableRenderer); -} Widget* Button::createCloneInstance() { diff --git a/cocos/ui/UIButton.h b/cocos/ui/UIButton.h index 3f4f219bd1..ff12c127df 100644 --- a/cocos/ui/UIButton.h +++ b/cocos/ui/UIButton.h @@ -201,18 +201,22 @@ protected: virtual void onPressStateChangedToPressed() override; virtual void onPressStateChangedToDisabled() override; virtual void onSizeChanged() override; - virtual void updateTextureColor() override; - virtual void updateTextureOpacity() override; - virtual void updateTextureRGBA() override; + virtual void updateFlippedX() override; virtual void updateFlippedY() override; + + void updateTexturesRGBA(); + void normalTextureScaleChangedWithSize(); void pressedTextureScaleChangedWithSize(); void disabledTextureScaleChangedWithSize(); - virtual Widget* createCloneInstance() override; - virtual void copySpecialProperties(Widget* model) override; + virtual void adaptRenderers() override; void updateTitleLocation(); + + virtual Widget* createCloneInstance() override; + virtual void copySpecialProperties(Widget* model) override; + protected: Node* _buttonNormalRenderer; Node* _buttonClickedRenderer; diff --git a/cocos/ui/UICheckBox.cpp b/cocos/ui/UICheckBox.cpp index 5fec8fdc3a..5440da5a3a 100644 --- a/cocos/ui/UICheckBox.cpp +++ b/cocos/ui/UICheckBox.cpp @@ -184,7 +184,9 @@ void CheckBox::loadTextureBackGround(const std::string& backGround,TextureResTyp } updateFlippedX(); updateFlippedY(); - updateRGBAToRenderer(_backGroundBoxRenderer); + _backGroundBoxRenderer->setColor(this->getColor()); + _backGroundBoxRenderer->setOpacity(this->getOpacity()); + updateContentSizeWithTextureSize(_backGroundBoxRenderer->getContentSize()); _backGroundBoxRendererAdaptDirty = true; } @@ -210,7 +212,8 @@ void CheckBox::loadTextureBackGroundSelected(const std::string& backGroundSelect } updateFlippedX(); updateFlippedY(); - updateRGBAToRenderer(_backGroundSelectedBoxRenderer); + _backGroundSelectedBoxRenderer->setColor(this->getColor()); + _backGroundSelectedBoxRenderer->setOpacity(this->getOpacity()); _backGroundSelectedBoxRendererAdaptDirty = true; } @@ -235,7 +238,8 @@ void CheckBox::loadTextureFrontCross(const std::string& cross,TextureResType tex } updateFlippedX(); updateFlippedY(); - updateRGBAToRenderer(_frontCrossRenderer); + _frontCrossRenderer->setColor(this->getColor()); + _frontCrossRenderer->setOpacity(this->getOpacity()); _frontCrossRendererAdaptDirty = true; } @@ -260,7 +264,9 @@ void CheckBox::loadTextureBackGroundDisabled(const std::string& backGroundDisabl } updateFlippedX(); updateFlippedY(); - updateRGBAToRenderer(_backGroundBoxDisabledRenderer); + _backGroundBoxDisabledRenderer->setColor(this->getColor()); + _backGroundBoxDisabledRenderer->setOpacity(this->getOpacity()); + _backGroundBoxDisabledRendererAdaptDirty = true; } @@ -285,7 +291,9 @@ void CheckBox::loadTextureFrontCrossDisabled(const std::string& frontCrossDisabl } updateFlippedX(); updateFlippedY(); - updateRGBAToRenderer(_frontCrossDisabledRenderer); + _frontCrossDisabledRenderer->setColor(this->getColor()); + _frontCrossDisabledRenderer->setOpacity(this->getOpacity()); + _frontCrossDisabledRendererAdaptDirty = true; } @@ -565,33 +573,6 @@ std::string CheckBox::getDescription() const { return "CheckBox"; } - -void CheckBox::updateTextureColor() -{ - updateColorToRenderer(_backGroundBoxRenderer); - updateColorToRenderer(_backGroundSelectedBoxRenderer); - updateColorToRenderer(_frontCrossRenderer); - updateColorToRenderer(_backGroundBoxDisabledRenderer); - updateColorToRenderer(_frontCrossDisabledRenderer); -} - -void CheckBox::updateTextureOpacity() -{ - updateOpacityToRenderer(_backGroundBoxRenderer); - updateOpacityToRenderer(_backGroundSelectedBoxRenderer); - updateOpacityToRenderer(_frontCrossRenderer); - updateOpacityToRenderer(_backGroundBoxDisabledRenderer); - updateOpacityToRenderer(_frontCrossDisabledRenderer); -} - -void CheckBox::updateTextureRGBA() -{ - updateRGBAToRenderer(_backGroundBoxRenderer); - updateRGBAToRenderer(_backGroundSelectedBoxRenderer); - updateRGBAToRenderer(_frontCrossRenderer); - updateRGBAToRenderer(_backGroundBoxDisabledRenderer); - updateRGBAToRenderer(_frontCrossDisabledRenderer); -} Widget* CheckBox::createCloneInstance() { diff --git a/cocos/ui/UICheckBox.h b/cocos/ui/UICheckBox.h index 3192797cf8..05c77d836b 100644 --- a/cocos/ui/UICheckBox.h +++ b/cocos/ui/UICheckBox.h @@ -211,16 +211,16 @@ protected: virtual void releaseUpEvent(); virtual void onSizeChanged() override; - virtual void updateTextureColor() override; - virtual void updateTextureOpacity() override; - virtual void updateTextureRGBA() override; + virtual void updateFlippedX() override; virtual void updateFlippedY() override; + void backGroundTextureScaleChangedWithSize(); void backGroundSelectedTextureScaleChangedWithSize(); void frontCrossTextureScaleChangedWithSize(); void backGroundDisabledTextureScaleChangedWithSize(); void frontCrossDisabledTextureScaleChangedWithSize(); + virtual Widget* createCloneInstance() override; virtual void copySpecialProperties(Widget* model) override; virtual void adaptRenderers() override; diff --git a/cocos/ui/UIImageView.cpp b/cocos/ui/UIImageView.cpp index fec60051ac..95034eeef5 100644 --- a/cocos/ui/UIImageView.cpp +++ b/cocos/ui/UIImageView.cpp @@ -154,7 +154,9 @@ void ImageView::loadTexture(const std::string& fileName, TextureResType texType) _imageTextureSize = _imageRenderer->getContentSize(); updateFlippedX(); updateFlippedY(); - updateRGBAToRenderer(_imageRenderer); + _imageRenderer->setColor(this->getColor()); + _imageRenderer->setOpacity(this->getOpacity()); + updateContentSizeWithTextureSize(_imageTextureSize); _imageRendererAdaptDirty = true; } @@ -321,21 +323,6 @@ std::string ImageView::getDescription() const { return "ImageView"; } - -void ImageView::updateTextureColor() -{ - updateColorToRenderer(_imageRenderer); -} - -void ImageView::updateTextureOpacity() -{ - updateOpacityToRenderer(_imageRenderer); -} - -void ImageView::updateTextureRGBA() -{ - updateRGBAToRenderer(_imageRenderer); -} Widget* ImageView::createCloneInstance() { diff --git a/cocos/ui/UIImageView.h b/cocos/ui/UIImageView.h index 867d1c1394..8afa3514bb 100644 --- a/cocos/ui/UIImageView.h +++ b/cocos/ui/UIImageView.h @@ -118,15 +118,15 @@ CC_CONSTRUCTOR_ACCESS: protected: virtual void initRenderer() override; virtual void onSizeChanged() override; - virtual void updateTextureColor() override; - virtual void updateTextureOpacity() override; - virtual void updateTextureRGBA() override; + virtual void updateFlippedX() override; virtual void updateFlippedY() override; + + virtual void adaptRenderers() override; + void imageTextureScaleChangedWithSize(); virtual Widget* createCloneInstance() override; virtual void copySpecialProperties(Widget* model) override; - virtual void adaptRenderers() override; protected: bool _scale9Enabled; bool _prevIgnoreSize; diff --git a/cocos/ui/UILoadingBar.cpp b/cocos/ui/UILoadingBar.cpp index bff6b1c46a..5dccc11c5b 100644 --- a/cocos/ui/UILoadingBar.cpp +++ b/cocos/ui/UILoadingBar.cpp @@ -123,7 +123,7 @@ LoadingBar::Direction LoadingBar::getDirection()const } - void LoadingBar::loadTexture(const std::string& texture,TextureResType texType) +void LoadingBar::loadTexture(const std::string& texture,TextureResType texType) { if (texture.empty()) { @@ -160,7 +160,9 @@ LoadingBar::Direction LoadingBar::getDirection()const default: break; } - updateRGBAToRenderer(_barRenderer); + _barRenderer->setColor(this->getColor()); + _barRenderer->setOpacity(this->getOpacity()); + _barRendererTextureSize = _barRenderer->getContentSize(); switch (_direction) @@ -358,21 +360,6 @@ std::string LoadingBar::getDescription() const { return "LoadingBar"; } - -void LoadingBar::updateTextureColor() -{ - updateColorToRenderer(_barRenderer); -} - -void LoadingBar::updateTextureOpacity() -{ - updateOpacityToRenderer(_barRenderer); -} - -void LoadingBar::updateTextureRGBA() -{ - updateRGBAToRenderer(_barRenderer); -} Widget* LoadingBar::createCloneInstance() { diff --git a/cocos/ui/UILoadingBar.h b/cocos/ui/UILoadingBar.h index 287e1d2569..1a0d6cbe6a 100644 --- a/cocos/ui/UILoadingBar.h +++ b/cocos/ui/UILoadingBar.h @@ -141,14 +141,14 @@ public: protected: virtual void initRenderer() override; virtual void onSizeChanged() override; - virtual void updateTextureColor() override; - virtual void updateTextureOpacity() override; - virtual void updateTextureRGBA() override; + void setScale9Scale(); void barRendererScaleChangedWithSize(); + + virtual void adaptRenderers() override; + virtual Widget* createCloneInstance() override; virtual void copySpecialProperties(Widget* model) override; - virtual void adaptRenderers() override; protected: Direction _direction; float _percent; diff --git a/cocos/ui/UISlider.cpp b/cocos/ui/UISlider.cpp index 70ebf1cf73..2e8a85961b 100644 --- a/cocos/ui/UISlider.cpp +++ b/cocos/ui/UISlider.cpp @@ -147,7 +147,9 @@ void Slider::loadBarTexture(const std::string& fileName, TextureResType texType) default: break; } - updateRGBAToRenderer(_barRenderer); + _barRenderer->setColor(this->getColor()); + _barRenderer->setOpacity(this->getOpacity()); + _barRendererAdaptDirty = true; _progressBarRendererDirty = true; updateContentSizeWithTextureSize(_barRenderer->getContentSize()); @@ -186,7 +188,10 @@ void Slider::loadProgressBarTexture(const std::string& fileName, TextureResType default: break; } - updateRGBAToRenderer(_progressBarRenderer); + + _progressBarRenderer->setColor(this->getColor()); + _progressBarRenderer->setOpacity(this->getOpacity()); + _progressBarRenderer->setAnchorPoint(Vec2(0.0f, 0.5f)); _progressBarTextureSize = _progressBarRenderer->getContentSize(); _progressBarRendererDirty = true; @@ -308,7 +313,8 @@ void Slider::loadSlidBallTextureNormal(const std::string& normal,TextureResType default: break; } - updateRGBAToRenderer(_slidBallNormalRenderer); + _slidBallNormalRenderer->setColor(this->getColor()); + _slidBallNormalRenderer->setOpacity(this->getOpacity()); } void Slider::loadSlidBallTexturePressed(const std::string& pressed,TextureResType texType) @@ -330,7 +336,8 @@ void Slider::loadSlidBallTexturePressed(const std::string& pressed,TextureResTyp default: break; } - updateRGBAToRenderer(_slidBallPressedRenderer); + _slidBallPressedRenderer->setColor(this->getColor()); + _slidBallPressedRenderer->setOpacity(this->getOpacity()); } void Slider::loadSlidBallTextureDisabled(const std::string& disabled,TextureResType texType) @@ -352,7 +359,8 @@ void Slider::loadSlidBallTexturePressed(const std::string& pressed,TextureResTyp default: break; } - updateRGBAToRenderer(_slidBallDisabledRenderer); + _slidBallDisabledRenderer->setColor(this->getColor()); + _slidBallDisabledRenderer->setOpacity(this->getOpacity()); } void Slider::setPercent(int percent) @@ -582,33 +590,6 @@ std::string Slider::getDescription() const { return "Slider"; } - -void Slider::updateTextureColor() -{ - updateColorToRenderer(_barRenderer); - updateColorToRenderer(_progressBarRenderer); - updateColorToRenderer(_slidBallNormalRenderer); - updateColorToRenderer(_slidBallPressedRenderer); - updateColorToRenderer(_slidBallDisabledRenderer); -} - -void Slider::updateTextureOpacity() -{ - updateOpacityToRenderer(_barRenderer); - updateOpacityToRenderer(_progressBarRenderer); - updateOpacityToRenderer(_slidBallNormalRenderer); - updateOpacityToRenderer(_slidBallPressedRenderer); - updateOpacityToRenderer(_slidBallDisabledRenderer); -} - -void Slider::updateTextureRGBA() -{ - updateRGBAToRenderer(_barRenderer); - updateRGBAToRenderer(_progressBarRenderer); - updateRGBAToRenderer(_slidBallNormalRenderer); - updateRGBAToRenderer(_slidBallPressedRenderer); - updateRGBAToRenderer(_slidBallDisabledRenderer); -} Widget* Slider::createCloneInstance() { diff --git a/cocos/ui/UISlider.h b/cocos/ui/UISlider.h index 441d0af9d5..451cd6ca2c 100644 --- a/cocos/ui/UISlider.h +++ b/cocos/ui/UISlider.h @@ -218,9 +218,7 @@ protected: virtual void onPressStateChangedToPressed() override; virtual void onPressStateChangedToDisabled() override; virtual void onSizeChanged() override; - virtual void updateTextureColor() override; - virtual void updateTextureOpacity() override; - virtual void updateTextureRGBA() override; + void barRendererScaleChangedWithSize(); void progressBarRendererScaleChangedWithSize(); virtual Widget* createCloneInstance() override; diff --git a/cocos/ui/UIText.cpp b/cocos/ui/UIText.cpp index f85cee6558..ac28594f1c 100644 --- a/cocos/ui/UIText.cpp +++ b/cocos/ui/UIText.cpp @@ -324,20 +324,6 @@ std::string Text::getDescription() const return "Label"; } -void Text::updateTextureColor() -{ - updateColorToRenderer(_labelRenderer); -} - -void Text::updateTextureOpacity() -{ - updateOpacityToRenderer(_labelRenderer); -} - -void Text::updateTextureRGBA() -{ - updateRGBAToRenderer(_labelRenderer); -} Widget* Text::createCloneInstance() { diff --git a/cocos/ui/UIText.h b/cocos/ui/UIText.h index f89f1a41dc..f19e8798e3 100644 --- a/cocos/ui/UIText.h +++ b/cocos/ui/UIText.h @@ -172,9 +172,7 @@ protected: virtual void onPressStateChangedToPressed() override; virtual void onPressStateChangedToDisabled() override; virtual void onSizeChanged() override; - virtual void updateTextureColor() override; - virtual void updateTextureOpacity() override; - virtual void updateTextureRGBA() override; + virtual void updateFlippedX() override; virtual void updateFlippedY() override; void labelScaleChangedWithSize(); diff --git a/cocos/ui/UITextAtlas.cpp b/cocos/ui/UITextAtlas.cpp index e0affe1ae0..e7bac16081 100644 --- a/cocos/ui/UITextAtlas.cpp +++ b/cocos/ui/UITextAtlas.cpp @@ -171,21 +171,6 @@ std::string TextAtlas::getDescription() const { return "TextAtlas"; } - -void TextAtlas::updateTextureColor() -{ - updateColorToRenderer(_labelAtlasRenderer); -} - -void TextAtlas::updateTextureOpacity() -{ - updateOpacityToRenderer(_labelAtlasRenderer); -} - -void TextAtlas::updateTextureRGBA() -{ - updateRGBAToRenderer(_labelAtlasRenderer); -} Widget* TextAtlas::createCloneInstance() { diff --git a/cocos/ui/UITextAtlas.h b/cocos/ui/UITextAtlas.h index d11908d722..8058aa4d7d 100644 --- a/cocos/ui/UITextAtlas.h +++ b/cocos/ui/UITextAtlas.h @@ -106,9 +106,7 @@ public: protected: virtual void initRenderer() override; virtual void onSizeChanged() override; - virtual void updateTextureColor() override; - virtual void updateTextureOpacity() override; - virtual void updateTextureRGBA() override; + void labelAtlasScaleChangedWithSize(); virtual Widget* createCloneInstance() override; virtual void copySpecialProperties(Widget* model) override; diff --git a/cocos/ui/UITextBMFont.cpp b/cocos/ui/UITextBMFont.cpp index 4b36afbfda..4e4c7f34a7 100644 --- a/cocos/ui/UITextBMFont.cpp +++ b/cocos/ui/UITextBMFont.cpp @@ -87,7 +87,9 @@ void TextBMFont::setFntFile(const std::string& fileName) } _fntFileName = fileName; _labelBMFontRenderer->setBMFontFilePath(fileName); - updateRGBAToRenderer(_labelBMFontRenderer); + + _labelBMFontRenderer->setColor(this->getColor()); + _labelBMFontRenderer->setOpacity(this->getOpacity()); _fntFileHasInit = true; setString(_stringValue); } @@ -165,21 +167,6 @@ std::string TextBMFont::getDescription() const { return "TextBMFont"; } - -void TextBMFont::updateTextureColor() -{ - updateColorToRenderer(_labelBMFontRenderer); -} - -void TextBMFont::updateTextureOpacity() -{ - updateOpacityToRenderer(_labelBMFontRenderer); -} - -void TextBMFont::updateTextureRGBA() -{ - updateRGBAToRenderer(_labelBMFontRenderer); -} Widget* TextBMFont::createCloneInstance() { diff --git a/cocos/ui/UITextBMFont.h b/cocos/ui/UITextBMFont.h index 246bcee2b1..707f42382c 100644 --- a/cocos/ui/UITextBMFont.h +++ b/cocos/ui/UITextBMFont.h @@ -89,9 +89,7 @@ public: protected: virtual void initRenderer() override; virtual void onSizeChanged() override; - virtual void updateTextureColor() override; - virtual void updateTextureOpacity() override; - virtual void updateTextureRGBA() override; + void labelBMFontScaleChangedWithSize(); virtual Widget* createCloneInstance() override; virtual void copySpecialProperties(Widget* model) override; diff --git a/cocos/ui/UITextField.cpp b/cocos/ui/UITextField.cpp index 49bc100eb3..01fa1b7587 100644 --- a/cocos/ui/UITextField.cpp +++ b/cocos/ui/UITextField.cpp @@ -799,21 +799,6 @@ std::string TextField::getDescription() const { return "TextField"; } - -void TextField::updateTextureColor() -{ - updateColorToRenderer(_textFieldRenderer); -} - -void TextField::updateTextureOpacity() -{ - updateOpacityToRenderer(_textFieldRenderer); -} - -void TextField::updateTextureRGBA() -{ - updateRGBAToRenderer(_textFieldRenderer); -} void TextField::attachWithIME() { diff --git a/cocos/ui/UITextField.h b/cocos/ui/UITextField.h index b27d5d645a..3fde1efa72 100644 --- a/cocos/ui/UITextField.h +++ b/cocos/ui/UITextField.h @@ -197,9 +197,7 @@ protected: void insertTextEvent(); void deleteBackwardEvent(); virtual void onSizeChanged() override; - virtual void updateTextureColor() override; - virtual void updateTextureOpacity() override; - virtual void updateTextureRGBA() override; + void textfieldRendererScaleChangedWithSize(); virtual Widget* createCloneInstance() override; diff --git a/cocos/ui/UIWidget.cpp b/cocos/ui/UIWidget.cpp index eaa8be4d0d..137b88f1e5 100644 --- a/cocos/ui/UIWidget.cpp +++ b/cocos/ui/UIWidget.cpp @@ -157,8 +157,6 @@ _positionPercent(Vec2::ZERO), _reorderWidgetChildDirty(true), _hitted(false), _touchListener(nullptr), -_color(Color3B::WHITE), -_opacity(255), _flippedX(false), _flippedY(false), _focused(false), @@ -212,6 +210,8 @@ bool Widget::init() setBright(true); ignoreContentAdaptWithSize(true); setAnchorPoint(Vec2(0.5f, 0.5f)); + this->setCascadeColorEnabled(true); + this->setCascadeOpacityEnabled(true); return true; } return false; @@ -1075,18 +1075,6 @@ void Widget::copyProperties(Widget *widget) onSizeChanged(); } -void Widget::setColor(const Color3B& color) -{ - _color = color; - updateTextureColor(); -} - -void Widget::setOpacity(GLubyte opacity) -{ - _opacity = opacity; - updateTextureOpacity(); -} - void Widget::setFlippedX(bool flippedX) { _flippedX = flippedX; @@ -1099,21 +1087,6 @@ void Widget::setFlippedY(bool flippedY) updateFlippedY(); } -void Widget::updateColorToRenderer(Node* renderer) -{ - renderer->setColor(_color); -} - -void Widget::updateOpacityToRenderer(Node* renderer) -{ - renderer->setOpacity(_opacity); -} - -void Widget::updateRGBAToRenderer(Node* renderer) -{ - renderer->setColor(_color); - renderer->setOpacity(_opacity); -} /*temp action*/ void Widget::setActionTag(int tag) diff --git a/cocos/ui/UIWidget.h b/cocos/ui/UIWidget.h index 8f08e3ba7c..2f102c3522 100644 --- a/cocos/ui/UIWidget.h +++ b/cocos/ui/UIWidget.h @@ -334,14 +334,6 @@ public: * @return true if the widget is flipped vertically, flase otherwise. */ virtual bool isFlippedY()const{return _flippedY;}; - - virtual void setColor(const Color3B& color) override; - - virtual void setOpacity(GLubyte opacity) override; - - const Color3B& getColor() const override {return _color;}; - - GLubyte getOpacity() const override {return _opacity;}; /** @deprecated Use isFlippedX() instead */ CC_DEPRECATED_ATTRIBUTE bool isFlipX() { return isFlippedX(); }; @@ -649,18 +641,10 @@ protected: virtual void releaseUpEvent(); virtual void cancelUpEvent(); - - virtual void updateTextureColor(){}; - virtual void updateTextureOpacity(){}; - virtual void updateTextureRGBA(){}; + virtual void updateFlippedX(){}; virtual void updateFlippedY(){}; virtual void adaptRenderers(){}; - - - void updateColorToRenderer(Node* renderer); - void updateOpacityToRenderer(Node* renderer); - void updateRGBAToRenderer(Node* renderer); void copyProperties(Widget* model); virtual Widget* createCloneInstance(); @@ -720,8 +704,6 @@ protected: bool _reorderWidgetChildDirty; bool _hitted; EventListenerTouchOneByOne* _touchListener; - Color3B _color; - GLubyte _opacity; bool _flippedX; bool _flippedY; //use map to enble switch back and forth for user layout parameters diff --git a/extensions/GUI/CCControlExtension/CCScale9Sprite.cpp b/extensions/GUI/CCControlExtension/CCScale9Sprite.cpp index 90369fab48..c959fdafcb 100644 --- a/extensions/GUI/CCControlExtension/CCScale9Sprite.cpp +++ b/extensions/GUI/CCControlExtension/CCScale9Sprite.cpp @@ -98,7 +98,8 @@ bool Scale9Sprite::initWithBatchNode(SpriteBatchNode* batchnode, const Rect& rec { this->updateWithBatchNode(batchnode, rect, rotated, capInsets); } - + this->setCascadeColorEnabled(true); + this->setCascadeOpacityEnabled(true); this->setAnchorPoint(Vec2(0.5f, 0.5f)); this->_positionsAreDirty = true;