Cocos Creator Editor 第一個編輯器擴展(擴展菜單)


項目路徑\packages\helloEditor\package.json

{
	"name": "hello-editor",
	"version": "0.0.1",
	"description": "一份簡單的擴展包",
	"author": "Cocos Creator",
	"main": "main.js",
	"main-menu": {
		"Tools/Test": {
			"message": "hello-editor:say-hello"
		}
	}
}

name: 擴展包名,只能小寫
Tools/Test: 自定的菜單
message: 擴展包名:函數名
詳細說明:https://docs.cocos.com/creator/manual/zh/extension/your-first-extension.html
package.js更多字段說明:https://docs.cocos.com/creator/manual/zh/extension/reference/package-json-reference.html


項目路徑\packages\helloEditor\main.js

'use strict';

module.exports = {
	load () {
		// 當 package 被正確加載的時候執行
	},

	unload () {
		// 當 package 被正確卸載的時候執行
	},

	messages: {
		'say-hello' () {
			Editor.log('Hello World!');
		}
	},
};


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM