美文网首页
CocosCreator中,Script模板

CocosCreator中,Script模板

作者: 全新的饭 | 来源:发表于2022-11-02 15:40 被阅读0次
    image.png
    image.png

    FanCustomComponent

    import { _decorator, Component, Node } from 'cc';
    const { ccclass, property } = _decorator;
    
    @ccclass('<%UnderscoreCaseClassName%>')
    export class <%UnderscoreCaseClassName%> extends Component 
    {
        start()
        {
            this.init();
        }
    
        onDestroy()
        { 
            this.myDestroy();
        }
    
        update(deltaTime: number)
        {
            
        }
        
        private init(): void
        {
        
        }
        
        private myDestroy(): void
        { 
    
        }
    }
    
    /**
     * COMMENTS_GENERATE_IGNORE
     * Use "COMMENTS_GENERATE_IGNORE" tag if you do not want later created scripts to contain these comments.
     * 
     * Predefined Variables
     * You can use predefined variables below to setup your scripting preference. For example, whether to use camel case style.
     * 
     * <%UnderscoreCaseClassName%>, class name in underscore format, like 'new_component'
     * <%CamelCaseClassName%>, class name in camel format, like 'NewComponent'
     * <%Author%>, Who create this file
     * <%DateTime%>, when create this file
     * <%FileBasename%>, creating file name with extension
     * <%FileBasenameNoExtension%>, creating file name without extension
     * <%URL%>, url of this file in COCOS ASSET URL format
     * <%ManualUrl%>, url of office help document, like 'https://docs.cocos.com/creator/manual/en/'
     *
     * 
     * Example:
     * 
      @ccclass('<%UnderscoreCaseClassName%>')
      export class <%UnderscoreCaseClassName%> extends Component {
    
        // class member could be defined like this.
        dummy = '';
    
        // Use 'property' decorator if your want the member to be serializable.
        @property
        serializableDummy = 0;
    
        start () {
            // Your initialization goes here.
        }
    
        update (deltaTime: number) {
            // Your update function goes here.
        }
    
      }
     *
     * Learn more about scripting: <%ManualUrl%>scripting/
     * Learn more about CCClass: <%ManualUrl%>scripting/decorator.html
     * Learn more about life-cycle callbacks: <%ManualUrl%>scripting/life-cycle-callbacks.html
     */
    

    相关文章

      网友评论

          本文标题:CocosCreator中,Script模板

          本文链接:https://www.haomeiwen.com/subject/kjpjtdtx.html