加入边缘阈值
This commit is contained in:
27
assets/scripts/common/prefabs/GlowThresholdSliderPrefab.ts
Normal file
27
assets/scripts/common/prefabs/GlowThresholdSliderPrefab.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class GlowThresholdSliderPrefab extends cc.Component {
|
||||
@property(cc.Slider)
|
||||
slider: cc.Slider = null;
|
||||
|
||||
@property(cc.Label)
|
||||
valueLabel: cc.Label = null;
|
||||
|
||||
onEnable() {
|
||||
this.slider.node.on("slide", this._onSliderChanged, this);
|
||||
}
|
||||
|
||||
onDisable() {
|
||||
this.slider.node.off("slide", this._onSliderChanged, this);
|
||||
}
|
||||
|
||||
start() {
|
||||
this._onSliderChanged();
|
||||
}
|
||||
|
||||
private _onSliderChanged() {
|
||||
let realProgress = this.slider.progress * 0.01;
|
||||
this.valueLabel.string = `${(realProgress * 100).toFixed(2)}%`;
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "c5a62981-21fc-466d-a3ed-0b5672a778cf",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
Reference in New Issue
Block a user