mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
simplify slider and videoplayer event register
This commit is contained in:
@@ -182,11 +182,12 @@ var Slider = cc.Class({
|
||||
|
||||
_handleSliderLogic: function (touch) {
|
||||
this._updateProgress(touch);
|
||||
this._emitSldeEvent();
|
||||
this._emitSlideEvent();
|
||||
},
|
||||
|
||||
_emitSldeEvent: function () {
|
||||
_emitSlideEvent: function () {
|
||||
cc.Component.EventHandler.emitEvents(this.slideEvents, this);
|
||||
this.node.emit('slide', this);
|
||||
},
|
||||
|
||||
_updateProgress: function (touch) {
|
||||
|
||||
@@ -265,30 +265,37 @@ var VideoPlayer = cc.Class({
|
||||
|
||||
onReadyToPlay: function () {
|
||||
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, EventType.READY_TO_PLAY);
|
||||
this.node.emit('ready-to-play', this);
|
||||
},
|
||||
|
||||
onMetaLoaded: function () {
|
||||
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, EventType.META_LOADED);
|
||||
this.node.emit('meta-loaded', this);
|
||||
},
|
||||
|
||||
onClicked: function () {
|
||||
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, EventType.CLICKED);
|
||||
this.node.emit('clicked', this);
|
||||
},
|
||||
|
||||
onPlaying: function(){
|
||||
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, EventType.PLAYING);
|
||||
this.node.emit('playing', this);
|
||||
},
|
||||
|
||||
onPasued: function() {
|
||||
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, EventType.PAUSED);
|
||||
this.node.emit('paused', this);
|
||||
},
|
||||
|
||||
onStopped: function() {
|
||||
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, EventType.STOPPED);
|
||||
this.node.emit('stopped', this);
|
||||
},
|
||||
|
||||
onCompleted: function() {
|
||||
cc.Component.EventHandler.emitEvents(this.videoPlayerEvent, this, EventType.COMPLETED);
|
||||
this.node.emit('completed', this);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user