代码改变世界

cocos2d JS 使用代码判断对象类型

2017-10-15 00:45  罗任德  阅读(615)  评论(0编辑  收藏  举报
changeAtlasScoreString : function (score,tfScore) {
if(tfScore.getDescription() == "LabelAtlas")//判断是否为艺术字
//if(tfScore instanceof ccui.TextAtlas)
return score.toString().replace("-", "/");
else
return score.toString();
},

balanceScore : function(num)//头像分数显示赋值
{
this.score += num;
var score = this.score;
var scoreStr = this.changeAtlasScoreString(score,this.tfScore);
this.tfScore.setString(scoreStr);
},