完善Demo
This commit is contained in:
7
assets/scripts/common/prefabs.meta
Normal file
7
assets/scripts/common/prefabs.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"ver": "1.0.1",
|
||||
"uuid": "7f773a6d-12c8-4f78-adab-37534100a08e",
|
||||
"isSubpackage": false,
|
||||
"subpackageName": "",
|
||||
"subMetas": {}
|
||||
}
|
26
assets/scripts/common/prefabs/ColorSliderPrefab.ts
Normal file
26
assets/scripts/common/prefabs/ColorSliderPrefab.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class ColorSliderPrefab 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() {
|
||||
this.valueLabel.string = `${this.slider.progress.toFixed(2)} | ${Math.round(255 * this.slider.progress)}`;
|
||||
}
|
||||
}
|
9
assets/scripts/common/prefabs/ColorSliderPrefab.ts.meta
Normal file
9
assets/scripts/common/prefabs/ColorSliderPrefab.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.0.5",
|
||||
"uuid": "7d52782d-b07b-4a2a-b287-c029c5c1f05f",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
27
assets/scripts/common/prefabs/GlowWidthSliderPrefab.ts
Normal file
27
assets/scripts/common/prefabs/GlowWidthSliderPrefab.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
@ccclass
|
||||
export default class GlowWidthSliderPrefab 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": "a1622cf4-4ad9-4bb4-a027-b751d2ae0bcd",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
Reference in New Issue
Block a user