FaceExAni.js 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. //m_atlas:cc.SpriteAtlas,
  5. },
  6. Init:function(Hook){
  7. this.m_Hook = Hook;
  8. this.m_SpFaces = this.$('FaceEx@Sprite');
  9. this.m_AniCtrl = this.$('AniNode@AniPrefab');
  10. this.m_AniCtrl.Init(this);
  11. },
  12. PlayAni:function(AniName, EndPos){
  13. this.m_AniName = AniName;
  14. this.m_AniCtrl.node.active = false;
  15. this.m_SpFaces.node.active = true;
  16. //this.m_SpFaces.spriteFrame = this.m_atlas.getSpriteFrame(AniName);
  17. cc.gPreLoader.LoadRes('Image_'+AniName, 'Chat_2', function(AniName){
  18. this.m_SpFaces.spriteFrame = AniName;
  19. }.bind(this));
  20. this.node.runAction(cc.sequence(cc.moveTo(0.2, EndPos), cc.callFunc(this.OnMoveEnd.bind(this))));//
  21. },
  22. OnMoveEnd:function(Tag, AniName){
  23. this.m_AniCtrl.node.active = true;
  24. this.m_SpFaces.node.active = false;
  25. this.m_AniCtrl.PlayAni(this.m_AniName, 1);
  26. },
  27. AniFinish:function(){
  28. this.m_Hook.AniFinish(this);
  29. },
  30. });