Alert.js 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. //Alert.js
  2. cc.Class({
  3. extends: cc.BaseClass,
  4. properties: {
  5. m_btNode:[cc.Node],
  6. m_labText:cc.Label,
  7. },
  8. /*OnShowView:function(){
  9. this.$('NoClick').setContentSize(10000, 10000);
  10. ShowS2N(this.node);
  11. },*/
  12. OnHideView:function(){
  13. //HideN2S(this.node, function(){
  14. if(this) this.OnDestroy();
  15. //}.bind(this));
  16. },
  17. ShowAlert:function(str,style,Func,Hook){
  18. this.m_Hook = Hook;
  19. this.m_callBack = Func;
  20. this.m_labText.string = str;
  21. for(var i in this.m_btNode){
  22. this.m_btNode[i].active = (((1<<i) & style) > 0);
  23. }
  24. },
  25. OnBtClick:function(Tag, Data){
  26. var res = null;
  27. if(Data == '1') res = true;
  28. if(Data == '0') res = false;
  29. if(this.m_callBack != null){
  30. if(this.m_Hook == null){
  31. this.m_callBack(res);
  32. }else{
  33. this.m_Hook[this.m_callBack](res);
  34. }
  35. }
  36. this.HideView();
  37. },
  38. });