当前位置: 首页 > 工具软件 > Bearcat > 使用案例 >

idea bearcat 文件模板

贾骏
2023-12-01
/**
 * Created by ${USER} on ${DATE}.
 */

#set($UPPER_NAME = ${NAME.substring(0,1).toUpperCase()} + ${NAME.substring(1)})
#set($id = "this.$id")
#set($init = "this.$init")
#set($ctor = "this.ctor = null")
#set($layer = "11")
#set($scene = "11")
#if($NAME.lastIndexOf("Layer") > 0)
    #set($layer = ${NAME.substring($NAME.lastIndexOf("Layer"))})
#end
#if($NAME.lastIndexOf("Scene") > 0)
    #set($scene = ${NAME.substring($NAME.lastIndexOf("Scene"))})
#end

var $UPPER_NAME = function () {
    $id = "${NAME}";
    $init = "init";
    #if($layer == "Layer" || $scene == "Scene")
    $ctor;
    #end
}

${UPPER_NAME}.prototype.init = function(){
    var self = this;
    #if($layer == "Layer")
        #set($node = $layer)
        this.ctor = cc.${node}.extend({
            ctor: function(){
                this._super();
                return true;
            }
        })
    #end
    #if($scene == "Scene")
        #set($node = $scene)
        this.ctor = cc.${node}.extend({
            ctor: function(){
                this._super();
                return true;
            }
        })
    #end
    
}

#set($rgt = "return new this.ctor();")
#if($layer == "Layer" || $scene == "Scene")
${UPPER_NAME}.prototype.get = function(){
    $rgt
}
#end

bearcat.module($UPPER_NAME, typeof module !== 'undefined' ? module : {});
 类似资料: