Cocos Creator 项目基础框架教程

Cocos Creator 项目基础框架教程

cocos_creator_proj_basecocos creator项目基础类库,包括socket, http网络连接,资源加载与管理,ui加载与管理,热更新实现机制,定时器,事件系统,tween动画工具, 音效播放,常用控件如recycle listview,recycle scrollview等项目地址:https://gitcode.com/gh_mirrors/co/cocos_creator_proj_base

1. 项目的目录结构及介绍

cocos-creator-proj-base/
├── assets/
│   ├── scripts/
│   ├── textures/
│   ├── sounds/
│   └── ...
├── library/
├── local/
├── settings/
├── temp/
└── project.json
  • assets/: 存放项目的资源文件,包括脚本、纹理、声音等。
  • library/: 存放项目编译后的资源文件。
  • local/: 存放本地配置文件。
  • settings/: 存放项目设置文件。
  • temp/: 存放临时文件。
  • project.json: 项目的基本配置文件。

2. 项目的启动文件介绍

项目的启动文件通常位于 assets/scripts/ 目录下,例如 Main.tsApp.ts。以下是一个简单的启动文件示例:

import { _decorator, Component, Node } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('Main')
export class Main extends Component {
    start() {
        console.log('项目启动成功!');
    }
}

3. 项目的配置文件介绍

项目的配置文件主要是 project.json,它包含了项目的基本信息和配置。以下是一个简单的 project.json 示例:

{
    "project_type": "javascript",
    "debugMode": 1,
    "showFPS": true,
    "frameRate": 60,
    "id": "example_game",
    "name": "Example Game",
    "version": "0.0.1",
    "packageName": "org.cocos2d.examplegame",
    "orientation": "landscape",
    "webOrientation": "auto",
    "xxteaKey": "example-key",
    "zipCompressJs": true
}
  • project_type: 项目类型,通常为 javascripttypescript
  • debugMode: 调试模式,1 表示开启调试。
  • showFPS: 是否显示 FPS 信息。
  • frameRate: 帧率。
  • id: 项目唯一标识。
  • name: 项目名称。
  • version: 项目版本。
  • packageName: 包名。
  • orientation: 屏幕方向。
  • webOrientation: Web 方向。
  • xxteaKey: XXTEA 加密密钥。
  • zipCompressJs: 是否压缩 JavaScript 文件。

cocos_creator_proj_basecocos creator项目基础类库,包括socket, http网络连接,资源加载与管理,ui加载与管理,热更新实现机制,定时器,事件系统,tween动画工具, 音效播放,常用控件如recycle listview,recycle scrollview等项目地址:https://gitcode.com/gh_mirrors/co/cocos_creator_proj_base

  • 9
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

平淮齐Percy

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值