This commit is contained in:
建喵 2021-12-28 19:51:27 +08:00
parent b31dc23720
commit 8b108f2dd8
54 changed files with 45823 additions and 71 deletions

2
README.md Normal file
View File

@ -0,0 +1,2 @@
# hello-world
Hello world new project template.

12
assets/Scene.meta Normal file
View File

@ -0,0 +1,12 @@
{
"ver": "1.1.2",
"uuid": "29f52784-2fca-467b-92e7-8fd9ef8c57b7",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

View File

@ -58,7 +58,7 @@
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"autoReleaseAssets": false, "autoReleaseAssets": false,
"_id": "34c+2sGxxMS64HqCq1vLfA" "_id": "2d2f792f-a40c-49bb-a189-ed176a246e49"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
@ -78,19 +78,19 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 7 "__id__": 8
}, },
{ {
"__id__": 8 "__id__": 9
} }
], ],
"_prefab": null, "_prefab": null,
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
"r": 255, "r": 252,
"g": 255, "g": 252,
"b": 255, "b": 252,
"a": 255 "a": 255
}, },
"_contentSize": { "_contentSize": {
@ -130,7 +130,7 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "6cFSaUccJNh6noLWCVWZqo" "_id": "a286bbGknJLZpRpxROV6M94"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
@ -192,7 +192,7 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "b7meb/oVxHJrNU8Yv8MrAW" "_id": "c5/6Br055MzKBXcCjb5u1O"
}, },
{ {
"__type__": "cc.Camera", "__type__": "cc.Camera",
@ -228,20 +228,23 @@
}, },
"_renderStages": 1, "_renderStages": 1,
"_alignWithScreen": true, "_alignWithScreen": true,
"_id": "d3UDG/nuxOD4N6iK320dFe" "_id": "1fjyt/7PtGNaat73cXIgI8"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "New WebView", "_name": "WebView",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 2 "__id__": 2
}, },
"_children": [], "_children": [],
"_active": true, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 6 "__id__": 6
},
{
"__id__": 7
} }
], ],
"_prefab": null, "_prefab": null,
@ -290,7 +293,7 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "108pJng+1DmYn6OFCutpXc" "_id": "d8rZibRcJKvZMF2kVvZBh9"
}, },
{ {
"__type__": "cc.WebView", "__type__": "cc.WebView",
@ -300,9 +303,19 @@
"__id__": 5 "__id__": 5
}, },
"_enabled": true, "_enabled": true,
"_url": "https://karolchang.github.io/jm-expense-vue-ts/", "_url": "",
"webviewEvents": [], "webviewEvents": [],
"_id": "32uraq3qhIKInlvdf6lBrq" "_id": "0dhyrwc5lM/oEUOjnLH8Wx"
},
{
"__type__": "e1b90/rohdEk4SdmmEZANaD",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"_id": "darFjTzH1B452j05U2ywfj"
}, },
{ {
"__type__": "cc.Canvas", "__type__": "cc.Canvas",
@ -319,7 +332,7 @@
}, },
"_fitWidth": true, "_fitWidth": true,
"_fitHeight": true, "_fitHeight": true,
"_id": "f8p2kqq2lAyI/MORLxDYGo" "_id": "0dgPOuU9NGKZz0IK/YfKTq"
}, },
{ {
"__type__": "cc.Widget", "__type__": "cc.Widget",
@ -346,6 +359,6 @@
"_isAbsVerticalCenter": true, "_isAbsVerticalCenter": true,
"_originalWidth": 0, "_originalWidth": 0,
"_originalHeight": 0, "_originalHeight": 0,
"_id": "46qfggxFBPirVNeJBNI7jo" "_id": "56i7y6VTBNEZCKvOCJzojM"
} }
] ]

View File

@ -1,6 +1,6 @@
{ {
"ver": "1.2.9", "ver": "1.2.9",
"uuid": "aff4ffa6-4509-4f66-8468-bc2c8a757f94", "uuid": "2d2f792f-a40c-49bb-a189-ed176a246e49",
"asyncLoadAssets": false, "asyncLoadAssets": false,
"autoReleaseAssets": false, "autoReleaseAssets": false,
"subMetas": {} "subMetas": {}

12
assets/Script.meta Normal file
View File

@ -0,0 +1,12 @@
{
"ver": "1.1.2",
"uuid": "4734c20c-0db8-4eb2-92ea-e692f4d70934",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

9
assets/Script/webview.ts Normal file
View File

@ -0,0 +1,9 @@
const { ccclass, property } = cc._decorator;
@ccclass
export default class webview extends cc.Component {
protected onLoad(): void {
this.node.getComponent(cc.WebView).url = `https://karolchang.github.io/jm-expense-vue-ts/?ignore=${Date.now()}`;
this.node.active = true;
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "1.0.8",
"uuid": "e1b90feb-a217-4493-849d-9a611900d683",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

12
assets/Texture.meta Normal file
View File

@ -0,0 +1,12 @@
{
"ver": "1.1.2",
"uuid": "7b81d4e8-ec84-4716-968d-500ac1d78a54",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View File

@ -0,0 +1,36 @@
{
"ver": "2.3.5",
"uuid": "6aa0aa6a-ebee-4155-a088-a687a6aadec4",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 195,
"height": 270,
"platformSettings": {},
"subMetas": {
"HelloWorld": {
"ver": "1.0.4",
"uuid": "31bc895a-c003-4566-a9f3-2e54ae1c17dc",
"rawTextureUuid": "6aa0aa6a-ebee-4155-a088-a687a6aadec4",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 195,
"height": 270,
"rawWidth": 195,
"rawHeight": 270,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 B

View File

@ -0,0 +1,36 @@
{
"ver": "2.3.5",
"uuid": "a8027877-d8d6-4645-97a0-52d4a0123dba",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 2,
"height": 2,
"platformSettings": {},
"subMetas": {
"singleColor": {
"ver": "1.0.4",
"uuid": "410fb916-8721-4663-bab8-34397391ace7",
"rawTextureUuid": "a8027877-d8d6-4645-97a0-52d4a0123dba",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 2,
"height": 2,
"rawWidth": 2,
"rawHeight": 2,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}

View File

@ -0,0 +1,311 @@
//desktop
var isMobile = navigator.userAgent.match(/(iPad)|(iPhone)|(iPod)|(android)|(webOS)/i) != null;
var isiPad = navigator.userAgent.match(/iPad/i) != null;
var isiPhone = navigator.userAgent.match(/iPhone|iPod/i) != null;
//baidu
var isBaidu = navigator.userAgent.match('baidu') != null;
//QQ browser
var isQQ = navigator.userAgent.match('MQQBrowser') != null;
//Saferi Browser
var isFirefox = navigator.userAgent.match('FxiOS') != null;
// UC Browser
var isUC = navigator.userAgent.indexOf("UCBrowser") != -1;
// Chrome 1+
var isChrome = navigator.userAgent.match('CriOS') != null;
//xiaomi
var isXiaomi = navigator.userAgent.match('XiaoMi') != null;
var isLine = navigator.userAgent.match('Line') != null;
// Safari 3.0+ "[object HTMLElementConstructor]"
var isSafari = navigator.userAgent.match('Safari') && !isBaidu && !isFirefox && !isQQ && !isChrome && !isUC && !isXiaomi;
var isAndroid = /android/i.test(navigator.userAgent || navigator.vendor || window.opera);
var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
// iPhone X、iPhone XS
var isIPhoneX = /iphone/gi.test(window.navigator.userAgent) && window.devicePixelRatio && window.devicePixelRatio === 3 && window.screen.width === 375 && window.screen.height === 812;
// iPhone XS Max
var isIPhoneXSMax = /iphone/gi.test(window.navigator.userAgent) && window.devicePixelRatio && window.devicePixelRatio === 3 && window.screen.width === 414 && window.screen.height === 896;
// iPhone XR
var isIPhoneXR = /iphone/gi.test(window.navigator.userAgent) && window.devicePixelRatio && window.devicePixelRatio === 2 && window.screen.width === 414 && window.screen.height === 896;
// iPhone SE
var isIPhoneSE = /iphone/gi.test(window.navigator.userAgent) && window.devicePixelRatio && window.devicePixelRatio === 2 && window.screen.width === 320 && window.screen.height === 568;
/**解析網址參數 */
var requests = GetUrlRequest();
/**放置LOGO圖 */
var a = SetLogo();
function preventDefault(e) {
e = e || window.event;
if (e.preventDefault) {
e.preventDefault();
}
e.returnValue = false;
}
function nopreventDefault(e) {
e = e || window.event;
if (e.preventDefault) {
e.preventDefault();
}
e.returnValue = true;
}
function requestFullScreen() {
let el = window.document.body;
let rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen || el.msRequestFullscreen;
if (typeof rfs != "undefined" && rfs) {
rfs.call(el);
}
}
function cancelFullScreen() {
let el = window.document;
let rfs = el.exitFullscreen || el.mozCancelFullScreen || el.webkitExitFullscreen || el.msExitFullscreen;
if (typeof rfs != "undefined" && rfs) {
rfs.call(el);
}
}
function isiPhoneX() {
var t = window.devicePixelRatio || 1,
e = {
width: window.screen.width * t,
height: window.screen.height * t
};
return iOS && 1125 === e.width && 2436 === e.height;
}
function SetLogo() {
var lan = "zh-ch";
if (requests["language"]) {
lan = requests["language"];
}
var splash = document.getElementById("splash");
if (!requests["logo"]) {
splash.className = "default" + " L " + lan + " L pos";
} else {
splash.className = "default_" + requests["logo"] + " L pos";
}
}
function GetUrlRequest() {
var url = window.location.search;
var theRequest = [];
if (url.indexOf("?") != -1) {
var str = url.substr(1);
var strs = str.split("&");
for (var i = 0; i < strs.length; i++) {
theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
}
}
return theRequest;
}
function CheckWebPageBack() {
if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0)) { // IE
if (history.length > 0) {
window.history.go(-1);
} else {
window.close();
}
} else {
//非IE瀏覽器
if (navigator.userAgent.indexOf('Firefox') >= 0 ||
navigator.userAgent.indexOf('Opera') >= 0 ||
navigator.userAgent.indexOf('Safari') >= 0 ||
navigator.userAgent.indexOf('Chrome') >= 0 ||
navigator.userAgent.indexOf('WebKit') >= 0) {
if (window.history.length > 2) {
window.history.go(-1);
} else {
window.close();
}
} else {
//未知的瀏覽器
if (history.length > 1) {
window.history.go(-1);
} else {
window.close();
}
}
}
}
/**網頁的RESIZE判斷 */
/*window.onresize = function () {
cc.view.setResizeCallback(this.checkGameCanvasWH());
}*/
/**複寫達到功能縮放到一定程度不再縮放(尚未使用此功能) */
function overrideSetDesignResolutionSize(width, height, resolutionPolicy) {
if (!(width > 0 || height > 0)) {
cc.logID(2200);
return;
}
cc.view.setResolutionPolicy(resolutionPolicy);
var policy = cc.view._resolutionPolicy;
policy && policy.preApply(this);
cc.sys.isMobile && cc.view._adjustViewportMeta();
cc.view._orientationChanging = true;
cc.view._resizing || cc.view._initFrameSize();
if (!policy) {
cc.logID(2201);
return;
}
cc.view._originalDesignResolutionSize.width = cc.view._designResolutionSize.width = width;
cc.view._originalDesignResolutionSize.height = cc.view._designResolutionSize.height = height;
var result = policy.apply(cc.view, cc.view._designResolutionSize);
if (result.scale && 2 === result.scale.length) {
cc.view._scaleX = result.scale[0] <= 1 ? result.scale[0] : 1;
cc.view._scaleY = result.scale[1] <= 1 ? result.scale[1] : 1;
}
if (result.viewport) {
result.viewport.width = result.viewport.width <= width ? result.viewport.width : width;
result.viewport.height = result.viewport.height <= height ? result.viewport.height : height;
var vp = cc.view._viewportRect,
vb = cc.view._visibleRect,
rv = result.viewport;
vp.x = rv.x;
vp.y = rv.y;
vp.width = rv.width;
vp.height = rv.height;
vb.x = 0;
vb.y = 0;
vb.width = rv.width / cc.view._scaleX;
vb.height = rv.height / cc.view._scaleY;
}
policy.postApply(cc.view);
cc.winSize.width = cc.view._visibleRect.width;
cc.winSize.height = cc.view._visibleRect.height;
cc.visibleRect && cc.visibleRect.init(cc.view._visibleRect);
cc.renderer.updateCameraViewport();
this.emit("design-resolution-changed");
}
/**改變CANVAS尺寸後要維持2的倍率.不然容易在縮放網頁時出現圖片接縫(顯示卡繪圖因素) */
function checkGameCanvasWH() {
/*if (document.getElementById("GameCanvas").width > 1422) {
document.getElementById("GameCanvas").width = 1422;
document.getElementById("GameCanvas").style.width = "1422px";
}*/
if (document.getElementById("GameCanvas").width % 2 != 0) {
document.getElementById("GameCanvas").width -= 1;
}
/*if (document.getElementById("GameCanvas").height > 800) {
document.getElementById("GameCanvas").height = 800;
document.getElementById("GameCanvas").style.height = "800px";
}*/
if (document.getElementById("GameCanvas").height % 2 != 0) {
document.getElementById("GameCanvas").height -= 1;
}
}
window.addEventListener('load', function () {
if (!iOS && !isAndroid) {
return;
}
if (isiPhoneX()) {
var r = document.querySelector("meta[name=viewport]");
r.setAttribute("content", "width=device-width,user-scalable=no,initial-scale=1, minimum-scale=1,maximum-scale=1,viewport-fit=cover")
}
//SetSwipe();
if (isAndroid) {
document.body.addEventListener('touchmove', function (e) {
e.preventDefault();
}, {
passive: false
});
requestFullScreen();
} else if (iOS) {
/*if (window.addEventListener) {
window.addEventListener('scroll', onScrollEvent, false);
} else {
window.attachEvent('onscroll', onScrollEvent);
}
onScrollEvent();*/
}
//alert(window.navigator.userAgent)
if (isUC) {
alert("亲爱的玩家您好:\n建议您使用chrome或safari浏览器以获得最佳游戏体验。")
}
}, false);
function SetSwipe() {
var lan = "zh-ch";
if (requests["language"]) {
lan = requests["language"];
}
if (isAndroid) {
var fullScreenClick = document.getElementById("FullScreenClick");
fullScreenClick.className = "default " + lan + " pos";
} else if (iOS) {
var fullScreenSwipe = document.getElementById("FullScreenSwipe");
fullScreenSwipe.className = "default " + lan + " pos";
}
}
function isFullScreen() {
if (isLine) {
return true;
}
if (iOS) {
/*if (isPortraitMode()) {
return window.innerHeight > document.documentElement.clientHeight;
} else {
return window.innerHeight >= document.documentElement.clientHeight;
}*/
} else {
var doc = window.document;
var isFullScreen = !(!doc.fullscreenElement && !doc.mozFullScreenElement && !doc.webkitFullscreenElement && !doc.msFullscreenElement);
return isFullScreen;
}
}
function onScrollEvent() {
if (isFullScreen()) {
displayGame();
} else {
displayFinger();
}
setTimeout(function () {
window.scrollTo(0, 0);
window.scroll(0, 0);
if (document.documentElement.scrollTop) {
document.documentElement.scrollTop = 0;
}
if (document.body.scrollTop) {
document.body.scrollTop = 0;
}
}, 200);
}
function displayFinger() {
document.getElementById("ScreenRotation").style.display = "none";
/*if (isAndroid) {
document.getElementById("FullScreenClick").style.display = "block";
} else if (iOS) {
document.getElementById("FullScreenSwipe").style.display = "block";
}*/
}
function displayGame() {
document.getElementById("ScreenRotation").style.display = "none";
if (isAndroid) {
document.getElementById("FullScreenClick").style.display = "none";
} else if (iOS) {
document.getElementById("FullScreenSwipe").style.display = "none";
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,132 @@
(function () {
'use strict';
var splash = document.getElementById('splash');
var progressBar = splash.querySelector('.progress-bar span');
splash.style.display = 'block';
progressBar.style.width = '0%';
function expoOut(t, b, c, d) {
return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
}
var canvas = document.getElementById('GameCanvas');
window.onload = function () {
if (window.__quick_compile_engine__) {
window.__quick_compile_engine__.load(onload);
} else {
onload();
}
};
function onload() {
// socket
// =======================
// Receives a refresh event from the editor, which triggers the reload of the page
var socket = window.io();
socket.on('browser:reload', function () {
window.location.reload();
});
socket.on('browser:confirm-reload', function () {
var r = confirm('Reload?');
if (r) {
window.location.reload();
}
});
// init engine
// =======================
var engineInited = false;
var onStart = function () {
cc.view.enableRetina(true);
cc.view.resizeWithBrowserSize(true);
cc.director.once("EVENT_AFTER_SCENE_READY", function () {
splash.style.display = 'none';
});
cc.game.pause();
// init assets
engineInited = true;
cc.assetManager.loadAny({
url: 'preview-scene.json',
__isNative__: false
}, null, function (finish, totalCount) {
var percent = expoOut(finish, 0, 100, totalCount) / 2;
if (progressBar) {
progressBar.style.width = percent.toFixed(2) + '%';
}
}, function (err, sceneAsset) {
if (err) {
console.error(err.message, err.stack);
return;
}
var scene = sceneAsset.scene;
scene._name = sceneAsset._name;
cc.assetManager.dependUtil._depends.add(scene._id, cc.assetManager.dependUtil._depends.get('preview-scene.json'));
cc.director.runSceneImmediate(scene, function () {
// play game
cc.game.resume();
console.log(scene._name.substring(0,4))
if(scene._name!="Demo" && scene._name.substring(0,4)!="Slot"){
cc.director.once(cc.Director.EVENT_AFTER_SCENE_LAUNCH, function () {
cc.director.emit('EVENT_AFTER_SCENE_READY');
});
}
});
});
// purge
//noinspection JSUnresolvedVariable
_CCSettings = undefined;
};
var option = {
id: canvas,
debugMode: _CCSettings.debug ? cc.debug.DebugMode.INFO : cc.debug.DebugMode.ERROR,
showFPS: _CCSettings.debug,
frameRate: 60,
groupList: _CCSettings.groupList,
collisionMatrix: _CCSettings.collisionMatrix,
};
cc.assetManager.init({
importBase: 'assets/others/import',
nativeBase: 'assets/others/native'
});
let {
RESOURCES,
INTERNAL,
MAIN
} = cc.AssetManager.BuiltinBundleName;
var bundleRoot = [INTERNAL];
_CCSettings.hasResourcesBundle && bundleRoot.push(RESOURCES);
var count = 0;
function cb(err) {
if (err) return console.error(err);
count++;
if (count === bundleRoot.length + 1) {
cc.assetManager.loadBundle(MAIN, function (err) {
if (!err) cc.game.run(option, onStart);
});
}
}
// load plugins
cc.assetManager.loadScript(_CCSettings.jsList.map(function (x) {
return '/plugins/' + x;
}), cb);
// load bundles
for (let i = 0; i < bundleRoot.length; i++) {
cc.assetManager.loadBundle('assets/' + bundleRoot[i], cb);
}
}
})();

View File

@ -0,0 +1,124 @@
html {
-ms-touch-action: none;
}
body, canvas, div {
display: block;
outline: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
-khtml-user-select: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
/* Remove spin of input type number */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
/* display: none; <- Crashes Chrome on hover */
-webkit-appearance: none;
margin: 0; /* <-- Apparently some margin are still there even though it's hidden */
}
body {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
padding: 0;
border: 0;
margin: 0;
cursor: default;
color: #888;
background-color: #000;
text-align: center;
font-family: Helvetica, Verdana, Arial, sans-serif;
display: flex;
flex-direction: column;
/* fix bug: https://github.com/cocos-creator/2d-tasks/issues/791 */
/* overflow cannot be applied in Cocos2dGameContainer,
otherwise child elements will be hidden when Cocos2dGameContainer rotated 90 deg */
overflow: hidden;
}
#Cocos2dGameContainer {
position: absolute;
margin: 0;
left: 0px;
top: 0px;
display: -webkit-box;
-webkit-box-orient: horizontal;
-webkit-box-align: center;
-webkit-box-pack: center;
}
canvas {
background-color: rgba(0, 0, 0, 0);
}
a:link, a:visited {
color: #666;
}
a:active, a:hover {
color: #666;
}
p.header {
font-size: small;
}
p.footer {
font-size: x-small;
}
#splash {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-size: 45%;
}
.progress-bar {
position: absolute;
left: 27.5%;
top: 80%;
height: 3px;
padding: 2px;
width: 45%;
border-radius: 7px;
box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444;
}
.progress-bar span {
display: block;
height: 100%;
border-radius: 3px;
transition: width .4s ease-in-out;
background-color: #3dc5de;
}
.stripes span {
background-size: 30px 30px;
background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%,
transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%,
transparent 75%, transparent);
animation: animate-stripes 1s linear infinite;
}
@keyframes animate-stripes {
0% {background-position: 0 0;} 100% {background-position: 60px 0;}
}

View File

@ -0,0 +1,215 @@
html,
body,
form {
width: 100%;
margin: 0 auto;
padding: 0;
top: 0;
overflow: hidden;
-webkit-overflow-scrolling: touch;
}
#background-img {
position: absolute;
width: 100%;
height: 100%;
-o-object-fit: cover;
object-fit: cover;
top: 0;
bottom: -10%;
left: 0;
right: 0;
}
#Cocos2dGameContainer {
margin: 0 auto;
position: fixed;
left: 0;
top: 0;
display: -webkit-box;
-webkit-box-orient: horizontal;
-webkit-box-align: center;
-webkit-box-pack: center;
-webkit-overflow-scrolling: touch;
z-index: 990;
}
.closeBtn {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/historyBtn.png);
z-index: 1100;
top: 80%;
left: 90%;
position: fixed;
overflow: unset;
width: 40px;
height: 40px;
-webkit-appearance: none;
background-position: center;
background-size: 100%;
background-repeat: no-repeat;
visibility: visible;
border-width: 0;
background-color: rgba(0, 0, 0, 0);
outline: none;
}
.progress-bar {
background-color: #1a1a1a;
position: absolute;
left: 25%;
top: 68%;
height: 15px;
padding: 5px;
width: 50%;
border-radius: 5px;
box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444;
}
/**LOGO*/
#splash.L.default_1 {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/Logo_L_1.png);
}
#splash.L.default {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/Logo_L_en.jpg);
}
#splash.L.zh-ch {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/Logo_L_zh-ch.jpg);
}
#splash.L.zh-tw {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/Logo_L_zh-tw.jpg);
}
/**新增語系圖請加在POS前*/
#splash.L.pos {
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 50%;
background-position-y: 30%;
z-index: 998;
}
/**手機選轉螢幕動畫*/
#ScreenRotation {
margin: 0 auto;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999;
display: none;
}
/**直轉橫*/
#ScreenRotation.PtoL.default {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_PtoL_en.gif);
}
#ScreenRotation.PtoL.zh-ch {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_PtoL_zh-ch.gif);
}
#ScreenRotation.PtoL.zh-tw {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_PtoL_zh-tw.gif);
}
/**新增語系圖請加在POS前*/
#ScreenRotation.PtoL.pos {
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 80%;
}
/**橫轉直*/
#ScreenRotation.LtoP.default {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_LtoP_en.gif);
}
#ScreenRotation.LtoP.zh-ch {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_LtoP_zh-ch.gif);
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 25%;
}
#ScreenRotation.LtoP.zh-tw {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_LtoP_zh-tw.gif);
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 25%;
}
/**新增語系圖請加在POS前*/
#ScreenRotation.LtoP.pos {
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 25%;
}
/**手機點擊螢幕動畫*/
#FullScreenClick {
margin: 0 auto;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999;
display: none;
}
#FullScreenClick.default {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenClick_en.gif);
}
#FullScreenClick.zh-ch {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenClick_zh-ch.gif);
}
#FullScreenClick.zh-tw {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenClick_zh-tw.gif);
}
/**新增語系圖請加在POS前*/
#FullScreenClick.pos {
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 20%;
}
/**手機上滑全螢幕動畫*/
#FullScreenSwipe.default {
margin: 0 auto;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999;
display: none;
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenSwipe_en.gif);
}
#FullScreenSwipe.zh-ch {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenSwipe_zh-ch.gif);
}
#FullScreenSwipe.zh-tw {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenSwipe_zh-tw.gif);
}
/**新增語系圖請加在POS前*/
#FullScreenSwipe.pos {
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 20%;
}

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,76 @@
# ccc-devtools
Cocos Creator 网页调试工具,运行时查看、修改节点树,实时更新节点属性,可视化缓存资源。
## 功能
- 场景节点树实时显示,节点、组件属性实时显示更改
![preview](./screenshots/preview1.gif)
- 可视化缓存资源
![preview](./screenshots/preview2.png)
- 标记场景中节点位置
![preview](./screenshots/preview3.png)
- 输出节点、组件引用到控制台
![preview](./screenshots/preview4.png)
- cc控制台功能扩展
![preview](./screenshots/preview5.png)
## 全局使用
1. 点击 Creator 右上角进入编辑器 resources 目录,再依次进入`static/preview-templates`目录
![t1](./screenshots/t1.png)
2. 根据creator版本将本项目对应分支clone到上面的目录下**如果使用下载压缩包的方式记得把后缀名-branchname去掉**
![t2](./screenshots/t2.png)
3. 打开 `index.jade`,找到 `body` 将中间部分替换为 `include ./ccc-devtools/index.html`**注意用tab键对齐**
![t3](./screenshots/t3.png)
## 项目使用
Cocos Creator 从 v2.2 开始新增了自定义网页预览功能。
1. 重复上面的操作步骤,将修改后的 `preview-templates` 目录拷贝到项目根目录
2. 将 `ccc-devtools/index.html` 里所有引用的资源路径 `app/editor/static/preview-templates/ccc-devtools/...` 替换为 `ccc-devtools/...`
3. 重启 Cocos Creator
## 自定义
- 本项目使用了 vue 和 vuetify可根据 [vuetify 文档](https://vuetifyjs.com/en/getting-started/quick-start/) 对页面进行修改
- 节点、组件显示属性可在 `config.js` 里配置,目前支持 textnumbertextareacolorbool 几种类型
## 需求、更新
https://github.com/potato47/ccc-devtools
如果没有更改源码,可直接在目录下 git pull
论坛讨论地址https://forum.cocos.com/t/creator-20190201/71578
## 贡献指南
- 版本号命名规则 https://semver.org/lang/zh-CN/ ,简单来讲新功能第二位加一修复bug第三位加一
- 如果新增功能请在README中添加预览截图说明
- 记得更新version.json中的版本号
## 前人种树
- https://github.com/vuejs/vue
- https://github.com/vuetifyjs/vuetify

View File

@ -0,0 +1,409 @@
(function () {
'use strict';
// init device resolutions
var devices = [
{ name: 'Apple iPhone 5', width: 320, height: 568, ratio: 2 },
{ name: 'Apple iPhone 6', width: 375, height: 667, ratio: 2 },
{ name: 'Apple iPhone 6 Plus', width: 414, height: 736, ratio: 3 },
{ name: 'Apple iPhone 7', width: 375, height: 667, ratio: 2 },
{ name: 'Apple iPhone 7 Plus', width: 414, height: 736, ratio: 3 },
{ name: 'Apple iPhone X', width: 375, height: 812, ratio: 3 },
{ name: 'Apple iPad', width: 1024, height: 768, ratio: 2 },
{ name: 'Apple iPad Air 2', width: 768, height: 1024, ratio: 2 },
{ name: 'Apple iPad Pro 10.5-inch', width: 834, height: 1112, ratio: 2 },
{ name: 'Apple iPad Pro 12.9-inch', width: 1024, height: 1366, ratio: 2 },
{ name: 'Huawei P9', width: 540, height: 960, ratio: 2 },
{ name: 'Huawei Mate9 Pro', width: 720, height: 1280, ratio: 2 },
{ name: 'Google Nexus 5', width: 360, height: 640, ratio: 3 },
{ name: 'Google Nexus 5X', width: 411, height: 731, ratio: 2.625 },
{ name: 'Google Nexus 6', width: 412, height: 732, ratio: 3.5 },
{ name: 'Google Nexus 7', width: 960, height: 600, ratio: 2 },
];
function setCSSChecked (element, checked) {
if (checked) {
element.classList.add('checked');
}
else {
element.classList.remove('checked');
}
return checked;
}
function refreshPauseBtnState () {
if (cc.game.isPaused()) {
btnPause.style.borderTopRightRadius = '0';
btnPause.style.borderBottomRightRadius = '0';
btnStep.style.borderTopLeftRadius = '0';
btnStep.style.borderBottomLeftRadius = '0';
btnStep.style.display = '';
setCSSChecked(btnPause, true);
}
else {
btnPause.style.borderTopRightRadius = '';
btnPause.style.borderBottomRightRadius = '';
btnStep.style.borderTopLeftRadius = '';
btnStep.style.borderBottomLeftRadius = '';
btnStep.style.display = 'none';
setCSSChecked(btnPause, false);
}
}
var isMobile = function () {
var check = false;
(function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4)))check = true;})(navigator.userAgent||navigator.vendor||window.opera);
return check;
};
// init toolbar
// =======================
var designWidth = _CCSettings.designWidth;
var designHeight = _CCSettings.designHeight;
var rotated = false;
// var paused = false;
var canvas = document.getElementById('GameCanvas');
var btnRotate = document.getElementById('btn-rotate');
var optsDevice = document.getElementById('opts-device');
var btnPause = document.getElementById('btn-pause');
var btnStep = document.getElementById('btn-step');
var optsDebugMode = document.getElementById('opts-debug-mode');
var btnShowFPS = document.getElementById('btn-show-fps');
var inputSetFPS = document.getElementById('input-set-fps');
var btnRecompile = document.getElementById('btn-recompile');
devices.forEach( function ( info, idx ) {
var opt = document.createElement('option');
opt.value = idx+1;
opt.text = info.name;
optsDevice.add( opt, null );
});
// coockie
// =======================
function setCookie (name, value, days) {
days = days || 30; //cookie will be saved for 30 days
var expires = new Date();
expires.setTime(expires.getTime() + days*24*60*60*1000);
document.cookie = name + '='+ encodeURIComponent(value) + ';expires=' + expires.toGMTString();
}
function getCookie (name) {
var arr = document.cookie.match(new RegExp('(^| )' + name + '=([^;]*)(;|$)'));
if(arr !== null) return (arr[2]);
return null;
}
function isFullScreen () {
var toolbar = document.getElementsByClassName('toolbar')[0];
return getComputedStyle(toolbar).display === 'none';
}
function getEmulatedScreenSize () {
var w, h;
var idx = optsDevice.value;
if ( idx === '0' ) {
w = designWidth;
h = designHeight;
}
else {
var info = devices[parseInt(idx) - 1];
w = info.width;
h = info.height;
}
return {
width: rotated ? h : w,
height: rotated ? w : h
};
}
function showSplash () {
var size = isFullScreen() ? document.documentElement.getBoundingClientRect() : getEmulatedScreenSize();
var splash = document.getElementById('splash');
var progressBar = splash.querySelector('.progress-bar span');
splash.style.display = 'block';
progressBar.style.width = '0%';
var div = document.getElementById('GameDiv');
if (div) {
div.style.visibility = 'visible';
}
if ( !isMobile() ) {
// make the splash screen in center
canvas.width = size.width;
canvas.height = size.height;
}
}
function expoOut(t, b, c, d) {
return (t == d) ? b + c : c * (-Math.pow(2, -10 * t / d) + 1) + b;
}
// init options
function initPreviewOptions () {
var defaultDevice = getCookie('device');
var defaultRotate = getCookie('rotate');
var hasDefaultDevice = defaultDevice !== null;
var hasDefaultRotate = defaultRotate !== null;
if (hasDefaultDevice) {
optsDevice.value = parseInt(defaultDevice);
}
if (hasDefaultRotate && defaultRotate === 'true') {
rotated = !rotated;
setCSSChecked(btnRotate, rotated);
}
optsDebugMode.value = getCookie('debugMode') || '1';
setCSSChecked(btnShowFPS, getCookie('showFPS') === 'true');
inputSetFPS.value = '60';
showSplash();
}
initPreviewOptions();
window.onload = function () {
if (window.__quick_compile_engine__) {
window.__quick_compile_engine__.load(onload);
}
else {
onload();
}
};
function onload () {
// socket
// =======================
// jshint camelcase:false
var socket = window.__socket_io__();
socket.on('browser:reload', function () {
window.location.reload();
});
socket.on('browser:confirm-reload', function () {
var r = confirm( 'Reload?' );
if ( r ) {
window.location.reload();
}
});
function updateResolution () {
var size = isFullScreen() ? document.documentElement.getBoundingClientRect() : getEmulatedScreenSize();
var gameDiv = document.getElementById('GameDiv');
gameDiv.style.width = size.width + 'px';
gameDiv.style.height = size.height + 'px';
cc.view.setCanvasSize(size.width, size.height);
}
// init rotate button
btnRotate.addEventListener('click', function () {
rotated = !rotated;
setCSSChecked(btnRotate, rotated);
setCookie('rotate', rotated.toString());
updateResolution();
});
optsDevice.addEventListener( 'change', function () {
var idx = optsDevice.value;
setCookie('device', idx.toString());
updateResolution();
});
// init debug modes
optsDebugMode.addEventListener('change', function (event) {
var value = event.target.value;
setCookie('debugMode', value);
cc.debug._resetDebugSetting(parseInt(value));
});
// init pause button
btnPause.addEventListener('click', function () {
var shouldPause = !cc.game.isPaused();
if (shouldPause) {
cc.game.pause();
}
else {
cc.game.resume();
}
refreshPauseBtnState();
});
// init recompile button
btnRecompile.addEventListener('click', function () {
var url = window.location.href + 'update-db';
var xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function () {
if (xmlHttp.readyState === 4 && xmlHttp.status === 200) {
document.getElementById('recompiling').style.display = 'block';
}
};
xmlHttp.open("GET", url, true); // true for asynchronous
xmlHttp.send(null);
});
// init step button
btnStep.addEventListener('click', function () {
cc.game.step();
});
// init show fps, true by default
btnShowFPS.addEventListener('click', function () {
var show = !cc.debug.isDisplayStats();
cc.debug.setDisplayStats(show);
setCSSChecked(btnShowFPS, show);
setCookie('showFPS', show.toString());
});
// init set fps
inputSetFPS.addEventListener('change', function (event) {
var fps = parseInt(inputSetFPS.value);
if (isNaN(fps)) {
fps = 60;
inputSetFPS.value = fps.toString();
}
cc.game.setFrameRate(fps);
});
// init engine
// =======================
var engineInited = false;
if (isFullScreen()) {
window.addEventListener('resize', updateResolution);
}
var showFPS = getCookie('showFPS');
// FPS is on by default
showFPS = showFPS === null ? true : showFPS === 'true';
var onStart = function () {
// resize canvas
if (!isFullScreen()) {
updateResolution();
}
cc.view.enableRetina(true);
cc.view.resizeWithBrowserSize(true);
// Loading splash scene
var splash = document.getElementById('splash');
var progressBar = splash.querySelector('.progress-bar span');
showSplash();
cc.director.once("EVENT_AFTER_SCENE_READY", function () {
splash.style.display = 'none';
checkEmptyScene();
});
cc.game.pause();
// init assets
engineInited = true;
cc.assetManager.loadAny({url: 'preview-scene.json', __isNative__: false }, null, function (finish, totalCount) {
var percent = expoOut(finish, 0, 100, totalCount) / 2;
if (progressBar) {
progressBar.style.width = percent.toFixed(2) + '%';
}
}, function (err, sceneAsset) {
if (err) {
console.error(err.message, err.stack);
return;
}
var scene = sceneAsset.scene;
scene._name = sceneAsset._name;
// HACK: Change key to uuid from url
cc.assetManager.dependUtil._depends.add(scene._id, cc.assetManager.dependUtil._depends.get('preview-scene.json'));
cc.director.runSceneImmediate(scene, function () {
// play game
cc.game.resume();
if(scene._name!="Demo" && scene._name.substring(0,4)!="Slot"){
cc.director.once(cc.Director.EVENT_AFTER_SCENE_LAUNCH, function () {
cc.director.emit('EVENT_AFTER_SCENE_READY');
});
}
});
});
// purge
//noinspection JSUnresolvedVariable
_CCSettings = undefined;
};
var option = {
id: canvas,
debugMode: parseInt(optsDebugMode.value),
showFPS: showFPS,
frameRate: parseInt(inputSetFPS.value),
groupList: _CCSettings.groupList,
collisionMatrix: _CCSettings.collisionMatrix,
};
cc.assetManager.init({
importBase: 'assets/others/import',
nativeBase: 'assets/others/native'
});
var RESOURCES = cc.AssetManager.BuiltinBundleName.RESOURCES;
var INTERNAL = cc.AssetManager.BuiltinBundleName.INTERNAL;
var MAIN = cc.AssetManager.BuiltinBundleName.MAIN;
var bundleRoot = [INTERNAL];
_CCSettings.hasResourcesBundle && bundleRoot.push(RESOURCES);
var count = 0;
function cb (err) {
if (err) return console.error(err);
count++;
if (count === bundleRoot.length + 1) {
cc.assetManager.loadBundle(MAIN, function (err) {
if (!err) cc.game.run(option, onStart);
});
}
}
// load plugins
cc.assetManager.loadScript(_CCSettings.jsList.map(function (x) { return '/plugins/' + x; }), cb);
// load bundles
for (var i = 0; i < bundleRoot.length; i++) {
cc.assetManager.loadBundle(bundleRoot[i], cb);
}
};
function checkEmptyScene () {
var scene = cc.director.getScene();
if (scene) {
if (scene.children.length > 1) {
return;
}
if (scene.children.length === 1) {
var node = scene.children[0];
if (node.children.length > 0) {
return;
}
if (node._components.length > 1) {
return;
}
if (node._components.length > 0 && !(node._components[0] instanceof cc.Canvas)) {
return;
}
}
}
document.getElementById('bulletin').style.display = 'block';
document.getElementById('sceneIsEmpty').style.display = 'block';
}
})();

View File

@ -0,0 +1,193 @@
#background-img {
position: absolute;
width: 100%;
height: 100%;
-o-object-fit: cover;
object-fit: cover;
top: 0;
bottom: -10%;
left: 0;
right: 0;
}
.closeBtn {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/historyBtn.png);
z-index: 1100;
top: 80%;
left: 90%;
position: fixed;
overflow: unset;
width: 40px;
height: 40px;
-webkit-appearance: none;
background-position: center;
background-size: 100%;
background-repeat: no-repeat;
visibility: visible;
border-width: 0;
background-color: rgba(0, 0, 0, 0);
outline: none;
}
.progress-bar {
background-color: #1a1a1a;
position: absolute;
left: 25%;
top: 68%;
height: 15px;
padding: 5px;
width: 50%;
border-radius: 5px;
box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444;
}
/**LOGO*/
#splash.L.default_1 {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/Logo_L_1.png);
}
#splash.L.default {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/Logo_L_en.jpg);
}
#splash.L.zh-ch {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/Logo_L_zh-ch.jpg);
}
#splash.L.zh-tw {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/Logo_L_zh-tw.jpg);
}
/**新增語系圖請加在POS前*/
#splash.L.pos {
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 50%;
background-position-y: 30%;
z-index: 998;
}
/**手機選轉螢幕動畫*/
#ScreenRotation {
margin: 0 auto;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999;
display: none;
}
/**直轉橫*/
#ScreenRotation.PtoL.default {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_PtoL_en.gif);
}
#ScreenRotation.PtoL.zh-ch {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_PtoL_zh-ch.gif);
}
#ScreenRotation.PtoL.zh-tw {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_PtoL_zh-tw.gif);
}
/**新增語系圖請加在POS前*/
#ScreenRotation.PtoL.pos {
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 80%;
}
/**橫轉直*/
#ScreenRotation.LtoP.default {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_LtoP_en.gif);
}
#ScreenRotation.LtoP.zh-ch {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_LtoP_zh-ch.gif);
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 25%;
}
#ScreenRotation.LtoP.zh-tw {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/ScreenRotation_LtoP_zh-tw.gif);
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 25%;
}
/**新增語系圖請加在POS前*/
#ScreenRotation.LtoP.pos {
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 25%;
}
/**手機點擊螢幕動畫*/
#FullScreenClick {
margin: 0 auto;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999;
display: none;
}
#FullScreenClick.default {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenClick_en.gif);
}
#FullScreenClick.zh-ch {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenClick_zh-ch.gif);
}
#FullScreenClick.zh-tw {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenClick_zh-tw.gif);
}
/**新增語系圖請加在POS前*/
#FullScreenClick.pos {
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 20%;
}
/**手機上滑全螢幕動畫*/
#FullScreenSwipe.default {
margin: 0 auto;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 999;
display: none;
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenSwipe_en.gif);
}
#FullScreenSwipe.zh-ch {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenSwipe_zh-ch.gif);
}
#FullScreenSwipe.zh-tw {
background: url(http://192.168.7.57/public/bonus_casino/html5/_Web_LocalTest/shared/img/FullScreenSwipe_zh-tw.gif);
}
/**新增語系圖請加在POS前*/
#FullScreenSwipe.pos {
background-repeat: no-repeat;
background-position: center;
background-color: #000;
background-size: 20%;
}

View File

@ -0,0 +1,54 @@
const NEX_CONFIG = {
nodeSchema: {
node2d: {
title: 'Node',
key: 'cc.Node',
rows: [
{ name: 'Name', key: 'name', type: 'text' },
{ name: 'X', key: 'x', type: 'number' },
{ name: 'Y', key: 'y', type: 'number' },
{ name: 'Width', key: 'width', type: 'number' },
{ name: 'Height', key: 'height', type: 'number' },
{ name: 'Angle', key: 'angle', type: 'number' },
{ name: 'ScaleX', key: 'scaleX', type: 'number' },
{ name: 'ScaleY', key: 'scaleY', type: 'number' },
{ name: 'Opacity', key: 'opacity', type: 'number' },
{ name: 'Color', key: 'hex_color', type: 'color' },
{ name: 'Group', key: 'group', type: 'text' },
]
},
node3d: {
title: 'Node',
key: 'cc.Node',
rows: [
// TODO:
]
},
},
componentsSchema: {
'cc.Camera': {
title: 'cc.Camera',
key: 'cc.Camera',
rows: [
{ name: 'Zoom Ratio', key: 'zoomRatio', type: 'number' },
{ name: 'Depth', key: 'depth', type: 'number' },
{ name: 'Bacground Color', key: 'hex_backgroundColor', rawKey: 'backgroundColor', type: 'color' },
{ name: 'Align with Screen', key: 'alignWithScreen', type: 'bool' },
]
},
'cc.Sprite': {
key: 'cc.Sprite',
title: 'cc.Sprite',
rows: []
},
'cc.Label': {
title: 'cc.Label',
key: 'cc.Label',
rows: [
{ name: 'String', key: 'string', type: 'textarea' },
{ name: 'Font Size', key: 'fontSize', type: 'number' },
{ name: 'Line Height', key: 'lineHeight', type: 'number' },
]
}
}
}

View File

@ -0,0 +1,266 @@
<link href="ccc-devtools/libs/css/materialdesignicons.min.css" rel="stylesheet"
type="text/css">
<link href="ccc-devtools/libs/css/vuetify.min.css" rel="stylesheet" type="text/css">
<style>
html {
overflow-y: auto;
}
</style>
<v-app id="app">
<v-app-bar app clipped-left color="gray" dense v-if="isShowTop">
<v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
<div id="recompiling"><span>Recompiling...</span></div>
<v-spacer></v-spacer>
<div class="toolbar">
<div class="item">
<select id="opts-device">
<option value="0">Default</option>
</select>
</div>
<div class="item">
<v-btn id="btn-rotate" small height="25"><span style="color: #aaa;">Rotate</span></v-btn>
</div>
<span style="font-size: small;display: none;" class="item">Debug Mode:</span>
<div class="item" style="display: none;">
<select id="opts-debug-mode">
<option value="0">None</option>
<option value="1">Info</option>
<option value="2">Warn</option>
<option value="3">Error</option>
<option value="4">Info For Web Page</option>
<option value="5">Warn For Web Page</option>
<option value="6">Error For Web Page</option>
</select>
</div>
<div class="item">
<v-btn id="btn-show-fps" small height="25"><span style="color: #aaa;">Show FPS</span></v-btn>
</div>
<div class="item">
<span style="font-size: small;color: #aaa;" class="item">FPS:</span><input id="input-set-fps"
type="number" />
</div>
<div style="margin-right: 0px;" class="item">
<v-btn id="btn-pause" small height="25"><span style="color: #aaa;">Pause</span></v-btn>
</div>
<div class="item">
<v-btn id="btn-step" style="display: none;" small height="25">
<span style="color: #aaa;">Step</span>
</v-btn>
</div>
<div class="item">
<v-btn id="btn-recompile" small height="25"><span style="color: #aaa;">Recompile</span></v-btn>
</div>
<v-icon @click="openCocosDocs" small>mdi-cloud-search</v-icon>
<v-icon @click="openCocosForum" small>mdi-forum</v-icon>
<v-icon @click="openCacheDialog" small>mdi-table</v-icon>
<v-icon @click="openGithub" small>mdi-home</v-icon>
</div>
</v-app-bar>
<div v-if="!isShowTop">
<div id="recompiling"><span>Recompiling...</span></div>
<div class="toolbar">
<div class="item">
<select id="opts-device">
<option value="0">Default</option>
</select>
</div>
<div class="item">
<v-btn id="btn-rotate" small height="25"><span style="color: #aaa;">Rotate</span></v-btn>
</div>
<span style="font-size: small;display: none;" class="item">Debug Mode:</span>
<div class="item" style="display: none;">
<select id="opts-debug-mode">
<option value="0">None</option>
<option value="1">Info</option>
<option value="2">Warn</option>
<option value="3">Error</option>
<option value="4">Info For Web Page</option>
<option value="5">Warn For Web Page</option>
<option value="6">Error For Web Page</option>
</select>
</div>
<div class="item">
<v-btn id="btn-show-fps" small height="25"><span style="color: #aaa;">Show FPS</span></v-btn>
</div>
<div class="item">
<span style="font-size: small;color: #aaa;" class="item">FPS:</span><input id="input-set-fps"
type="number" />
</div>
<div style="margin-right: 0px;" class="item">
<v-btn id="btn-pause" small height="25"><span style="color: #aaa;">Pause</span></v-btn>
</div>
<div class="item">
<v-btn id="btn-step" style="display: none;" small height="25">
<span style="color: #aaa;">Step</span>
</v-btn>
</div>
<div class="item">
<v-btn id="btn-recompile" small height="25"><span style="color: #aaa;">Recompile</span></v-btn>
</div>
</div>
</div>
<v-navigation-drawer v-model="drawer" app clipped fixed width="512" v-if="isShowTop">
<v-container style="height: 50%;overflow: auto;">
<v-text-field v-model="treeSearchText" dense label="Search Node or Component" dark flat solo-inverted
hide-details clearable clear-icon="mdi-close-circle-outline"></v-text-field>
<v-treeview :items="treeData" item-key="id" dense activatable :search="treeSearchText"
:active.sync="selectedNodes">
<template v-slot:label="{ item, active }">
<label v-if="item.active" style="color: white;">{{ item.name }}</label>
<label v-else style="color: gray;">{{ item.name }}</label>
</template>
</v-treeview>
</v-container>
<v-container style="border-top: 2px solid darkgray;height: 50%;overflow-y: auto;">
<template v-if="selectedNode">
<!-- Node -->
<table style="width: 100%;color: white;" border="1">
<thead>
<tr>
<th colspan="2" style="text-align: left; padding: 10px;">
<div class="float-left" style="display:inline-flex;">
<v-simple-checkbox v-model="selectedNode.active"></v-simple-checkbox>
<span style="margin-left: 10px;">{{ nodeSchema.title }}</span>
</div>
<div class="float-right">
<v-icon style="margin-left: 10px;margin-right: 10px;" @click="drawNodeRect()">
mdi-adjust</v-icon>
<v-icon @click="outputNodeHandler()">mdi-send</v-icon>
</div>
</th>
</tr>
</thead>
<tbody>
<!-- config.js[node2d] -->
<tr v-for="row in nodeSchema.rows" :key="row.key">
<td style="padding: 10px;width: 40%;">{{ row.name }}</td>
<td style="width: 60%;">
<v-color-picker v-if="row.type == 'color'" class="ma-2" canvas-height="80" width="259"
v-model="selectedNode[row.key]"></v-color-picker>
<v-simple-checkbox v-else-if="row.type == 'bool'" v-model="selectedNode[row.key]"
style="padding: 10px;width: 100%;"></v-simple-checkbox>
<input v-else :type="row.type" v-model="selectedNode[row.key]"
style="padding: 10px;width: 100%;"></input>
</td>
</tr>
</tbody>
</table>
<!-- Components -->
<table v-for="component in componentsSchema" style="width: 100%;color: white;" border="1">
<thead>
<tr>
<th colspan="2" style="text-align: left; padding: 10px;">
<div class="float-left" style="display:inline-flex;">
<v-simple-checkbox v-model="selectedNode[component.key].enabled">
</v-simple-checkbox>
<span style="margin-left: 10px;">{{ component.title }}</span>
</div>
<div class="float-right">
<v-icon @click="outputComponentHandler(component.key)">mdi-send</v-icon>
</div>
</th>
</tr>
</thead>
<tbody>
<tr v-for="row in component.rows" :key="row.key">
<!-- config.js[componentsSchema] -->
<td style="padding: 10px;width: 40%;">{{ row.name }}</td>
<td style="width: 60%;">
<v-color-picker v-if="row.type == 'color'"
class="ma-2"
canvas-height="80" width="259"
v-model="selectedNode[component.key][row.key]">
</v-color-picker>
<textarea v-else-if="row.type == 'textarea'" rows="1"
v-model="selectedNode[component.key][row.key]"
style="padding: 10px;width: 100%;">
</textarea>
<v-simple-checkbox v-else-if="row.type == 'bool'"
v-model="selectedNode[component.key][row.key]"
style="padding: 10px;width: 100%;">
</v-simple-checkbox>
<input v-else-if ="row.type == 'object_number'"
v-model.number="selectedNode[component.key][row.parentKey][row.key]"
style="padding: 10px;width: 100%;"
@input="onSubPropInput( selectedNode[component.key], row)">
</input>
<input v-else :type="row.type"
v-model="selectedNode[component.key][row.key]"
style="padding: 10px;width: 100%;">
</input>
</td>
</tr>
</tbody>
</table>
</template>
</v-container>
</v-navigation-drawer>
<v-content>
<v-container fill-height>
<div id="content" class="content">
<div class="contentWrap">
<div id="GameDiv" class="wrapper">
<div id="background-img"></div>
<canvas id="GameCanvas"></canvas>
<div id="splash">
<div class="progress-bar stripes"><span></span></div>
</div>
<div id="bulletin">
<div id="sceneIsEmpty" class="inner">预览场景中啥都没有,加点什么,或在编辑器中打开其它场景吧</div>
</div>
</div>
</div>
</div>
</v-container>
</v-content>
<v-dialog v-model="cacheDialog" persistent scrollable>
<v-card>
<v-card-title>
{{ cacheTitle }}
<v-spacer></v-spacer>
<v-text-field v-model="cacheSearchText" append-icon="mdi-magnify" label="Search" single-line
hide-details>
</v-text-field>
</v-card-title>
<v-divider></v-divider>
<v-card-text>
<v-data-table :headers="cacheHeaders" :items="cacheData" :search="cacheSearchText" :sort-by="['size']"
:sort-desc="[true]" :footer-props="{
showFirstLastPage: true,
firstIcon: 'mdi-chevron-double-left',
lastIcon: 'mdi-chevron-double-right',
}">
<template v-slot:item.size="{ item }">
{{ item.size == -1 ? '_' : (item.size +'MB') }}
</template>
<template v-slot:item.preview="{ item }">
<div style="height: 60px;display: flex;align-items: center;">
<img :src="window.location.protocol + '//' + window.location.host + '/' + item.preview"
style="max-height: 60px;max-width: 120px;" v-if="item.preview">
<template v-else>_</template>
</div>
</template>
</v-data-table>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-btn color="blue darken-1" text @click="cacheDialog = false">Close</v-btn>
<v-spacer></v-spacer>
<v-switch v-model="cacheOnlyTexture" label="只显示纹理"></v-switch>
</v-card-actions>
</v-card>
</v-dialog>
</v-app>
<script src="ccc-devtools/libs/js/vue.min.js"></script>
<script src="ccc-devtools/libs/js/vuetify.js"></script>
<script src="ccc-devtools/config.js"></script>
<script src="ccc-devtools/libs/js/cc-console-utils.js"></script>
<script src="ccc-devtools/preview.js"></script>

View File

@ -0,0 +1,249 @@
<link href="app/editor/static/preview-templates/ccc-devtools/libs/css/materialdesignicons.min.css" rel="stylesheet"
type="text/css">
<link href="app/editor/static/preview-templates/ccc-devtools/libs/css/vuetify.min.css" rel="stylesheet" type="text/css">
<style>
html {
overflow-y: auto;
}
</style>
<v-app id="app">
<v-app-bar app clipped-left color="gray" dense v-if="isShowTop">
<v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
<div id="recompiling"><span>Recompiling...</span></div>
<v-spacer></v-spacer>
<div class="toolbar">
<div class="item">
<select id="opts-device">
<option value="0">Default</option>
</select>
</div>
<div class="item">
<v-btn id="btn-rotate" small height="25"><span style="color: #aaa;">Rotate</span></v-btn>
</div>
<span style="font-size: small;display: none;" class="item">Debug Mode:</span>
<div class="item" style="display: none;">
<select id="opts-debug-mode">
<option value="0">None</option>
<option value="1">Info</option>
<option value="2">Warn</option>
<option value="3">Error</option>
<option value="4">Info For Web Page</option>
<option value="5">Warn For Web Page</option>
<option value="6">Error For Web Page</option>
</select>
</div>
<div class="item">
<v-btn id="btn-show-fps" small height="25"><span style="color: #aaa;">Show FPS</span></v-btn>
</div>
<div class="item">
<span style="font-size: small;color: #aaa;" class="item">FPS:</span><input id="input-set-fps"
type="number" />
</div>
<div style="margin-right: 0px;" class="item">
<v-btn id="btn-pause" small height="25"><span style="color: #aaa;">Pause</span></v-btn>
</div>
<div class="item">
<v-btn id="btn-step" style="display: none;" small height="25">
<span style="color: #aaa;">Step</span>
</v-btn>
</div>
<div class="item">
<v-btn id="btn-recompile" small height="25"><span style="color: #aaa;">Recompile</span></v-btn>
</div>
<v-icon @click="openCocosDocs" small>mdi-cloud-search</v-icon>
<v-icon @click="openCocosForum" small>mdi-forum</v-icon>
<v-icon @click="openCacheDialog" small>mdi-table</v-icon>
<v-icon @click="openGithub" small>mdi-home</v-icon>
</div>
</v-app-bar>
<div v-if="!isShowTop">
<div id="recompiling"><span>Recompiling...</span></div>
<div class="toolbar">
<div class="item">
<select id="opts-device">
<option value="0">Default</option>
</select>
</div>
<div class="item">
<v-btn id="btn-rotate" small height="25"><span style="color: #aaa;">Rotate</span></v-btn>
</div>
<span style="font-size: small;display: none;" class="item">Debug Mode:</span>
<div class="item" style="display: none;">
<select id="opts-debug-mode">
<option value="0">None</option>
<option value="1">Info</option>
<option value="2">Warn</option>
<option value="3">Error</option>
<option value="4">Info For Web Page</option>
<option value="5">Warn For Web Page</option>
<option value="6">Error For Web Page</option>
</select>
</div>
<div class="item">
<v-btn id="btn-show-fps" small height="25"><span style="color: #aaa;">Show FPS</span></v-btn>
</div>
<div class="item">
<span style="font-size: small;color: #aaa;" class="item">FPS:</span><input id="input-set-fps"
type="number" />
</div>
<div style="margin-right: 0px;" class="item">
<v-btn id="btn-pause" small height="25"><span style="color: #aaa;">Pause</span></v-btn>
</div>
<div class="item">
<v-btn id="btn-step" style="display: none;" small height="25">
<span style="color: #aaa;">Step</span>
</v-btn>
</div>
<div class="item">
<v-btn id="btn-recompile" small height="25"><span style="color: #aaa;">Recompile</span></v-btn>
</div>
</div>
</div>
<v-navigation-drawer v-model="drawer" app clipped fixed width="512" v-if="isShowTop">
<v-container style="height: 50%;overflow: auto;">
<v-text-field v-model="treeSearchText" dense label="Search Node or Component" dark flat solo-inverted
hide-details clearable clear-icon="mdi-close-circle-outline"></v-text-field>
<v-treeview :items="treeData" item-key="id" dense activatable :search="treeSearchText"
:active.sync="selectedNodes">
<template v-slot:label="{ item, active }">
<label v-if="item.active" style="color: white;">{{ item.name }}</label>
<label v-else style="color: gray;">{{ item.name }}</label>
</template>
</v-treeview>
</v-container>
<v-container style="border-top: 2px solid darkgray;height: 50%;overflow-y: auto;">
<template v-if="selectedNode">
<!-- Node -->
<table style="width: 100%;color: white;" border="1">
<thead>
<tr>
<th colspan="2" style="text-align: left; padding: 10px;">
<div class="float-left" style="display:inline-flex;">
<v-simple-checkbox v-model="selectedNode.active"></v-simple-checkbox>
<span style="margin-left: 10px;">{{ nodeSchema.title }}</span>
</div>
<div class="float-right">
<v-icon style="margin-left: 10px;margin-right: 10px;" @click="drawNodeRect()">
mdi-adjust</v-icon>
<v-icon @click="outputNodeHandler()">mdi-send</v-icon>
</div>
</th>
</tr>
</thead>
<tbody>
<tr v-for="row in nodeSchema.rows" :key="row.key">
<td style="padding: 10px;width: 40%;">{{ row.name }}</td>
<td style="width: 60%;">
<v-color-picker v-if="row.type == 'color'" class="ma-2" canvas-height="80" width="259"
v-model="selectedNode[row.key]"></v-color-picker>
<v-simple-checkbox v-else-if="row.type == 'bool'" v-model="selectedNode[row.key]"
style="padding: 10px;width: 100%;"></v-simple-checkbox>
<input v-else :type="row.type" v-model="selectedNode[row.key]"
style="padding: 10px;width: 100%;"></input>
</td>
</tr>
</tbody>
</table>
<!-- Components -->
<table v-for="component in componentsSchema" style="width: 100%;color: white;" border="1">
<thead>
<tr>
<th colspan="2" style="text-align: left; padding: 10px;">
<div class="float-left" style="display:inline-flex;">
<v-simple-checkbox v-model="selectedNode[component.key].enabled">
</v-simple-checkbox>
<span style="margin-left: 10px;">{{ component.title }}</span>
</div>
<div class="float-right">
<v-icon @click="outputComponentHandler(component.key)">mdi-send</v-icon>
</div>
</th>
</tr>
</thead>
<tbody>
<tr v-for="row in component.rows" :key="row.key">
<td style="padding: 10px;width: 40%;">{{ row.name }}</td>
<td style="width: 60%;">
<v-color-picker v-if="row.type == 'color'" class="ma-2" canvas-height="80" width="259"
v-model="selectedNode[component.key][row.key]"></v-color-picker>
<textarea v-else-if="row.type == 'textarea'" rows="1"
v-model="selectedNode[component.key][row.key]" style="padding: 10px;width: 100%;">
</textarea>
<v-simple-checkbox v-else-if="row.type == 'bool'"
v-model="selectedNode[component.key][row.key]" style="padding: 10px;width: 100%;">
</v-simple-checkbox>
<input v-else :type="row.type" v-model="selectedNode[component.key][row.key]"
style="padding: 10px;width: 100%;"></input>
</td>
</tr>
</tbody>
</table>
</template>
</v-container>
</v-navigation-drawer>
<v-content>
<v-container fill-height>
<div id="content" class="content">
<div class="contentWrap">
<div id="GameDiv" class="wrapper"><canvas id="GameCanvas"></canvas>
<div id="splash">
<div class="progress-bar stripes"><span></span></div>
</div>
<div id="bulletin">
<div id="sceneIsEmpty" class="inner">预览场景中啥都没有,加点什么,或在编辑器中打开其它场景吧</div>
</div>
</div>
</div>
</div>
</v-container>
</v-content>
<v-dialog v-model="cacheDialog" persistent scrollable>
<v-card>
<v-card-title>
{{ cacheTitle }}
<v-spacer></v-spacer>
<v-text-field v-model="cacheSearchText" append-icon="mdi-magnify" label="Search" single-line
hide-details>
</v-text-field>
</v-card-title>
<v-divider></v-divider>
<v-card-text>
<v-data-table :headers="cacheHeaders" :items="cacheData" :search="cacheSearchText" :sort-by="['size']"
:sort-desc="[true]" :footer-props="{
showFirstLastPage: true,
firstIcon: 'mdi-chevron-double-left',
lastIcon: 'mdi-chevron-double-right',
}">
<template v-slot:item.size="{ item }">
{{ item.size == -1 ? '_' : (item.size +'MB') }}
</template>
<template v-slot:item.preview="{ item }">
<div style="height: 60px;display: flex;align-items: center;">
<img :src="window.location.protocol + '//' + window.location.host + '/' + item.preview"
style="max-height: 60px;max-width: 120px;" v-if="item.preview">
<template v-else>_</template>
</div>
</template>
</v-data-table>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-btn color="blue darken-1" text @click="cacheDialog = false">Close</v-btn>
<v-spacer></v-spacer>
<v-switch v-model="cacheOnlyTexture" label="只显示纹理"></v-switch>
</v-card-actions>
</v-card>
</v-dialog>
</v-app>
<script src="app/editor/static/preview-templates/ccc-devtools/libs/js/vue.min.js"></script>
<script src="app/editor/static/preview-templates/ccc-devtools/libs/js/vuetify.js"></script>
<script src="app/editor/static/preview-templates/ccc-devtools/config.js"></script>
<script src="app/editor/static/preview-templates/ccc-devtools/libs/js/cc-console-utils.js"></script>
<script src="app/editor/static/preview-templates/ccc-devtools/preview.js"></script>

View File

@ -0,0 +1,336 @@
/* cyrillic-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff22) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff22) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff22) format('woff2');
unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff22) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff22) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
src: local('Roboto Thin'), local('Roboto-Thin'), url(../fonts/googlefonts-base.woff2format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
src: local('Roboto Light'), local('Roboto-Light'), url(../fonts/googlefonts-base.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2format('woff2');
unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
src: local('Roboto'), local('Roboto-Regular'), url(../fonts/googlefonts-base.woff2rmat('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 500;
src: local('Roboto Medium'), local('Roboto-Medium'), url(../fonts/googlefonts-base.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
src: local('Roboto Bold'), local('Roboto-Bold'), url(../fonts/googlefonts-base.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 900;
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 900;
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 900;
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 900;
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 900;
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 900;
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2f2) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 900;
src: local('Roboto Black'), local('Roboto-Black'), url(../fonts/googlefonts-base.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,165 @@
const initConsoleUtil = function () {
if (cc.tree) return;
cc.tree = function (key) {
let index = key || 0;
let treeNode = function (node) {
let nameStyle =
`color: ${node.parent === null || node.activeInHierarchy ? 'green' : 'grey'}; font-size: 14px;font-weight:bold`;
let propStyle =
`color: black; background: lightgrey;margin-left: 5px;border-radius:3px;padding: 0 3px;font-size: 10px;font-weight:bold`;
let indexStyle =
`color: orange; background: black;margin-left: 5px;border-radius:3px;padding:0 3px;fonrt-size: 10px;font-weight:bold;`
let nameValue = `%c${node.name}`;
let propValue =
`%c${node.x.toFixed(0) + ',' + node.y.toFixed(0) + ',' + node.width.toFixed(0) + ',' + node.height.toFixed(0) + ',' + node.scale.toFixed(1)}`
let indexValue = `%c${index++}`;
if (node.childrenCount > 0) {
console.groupCollapsed(nameValue + propValue + indexValue, nameStyle,
propStyle, indexStyle);
for (let i = 0; i < node.childrenCount; i++) {
treeNode(node.children[i]);
}
console.groupEnd();
} else {
console.log(nameValue + propValue + indexValue, nameStyle, propStyle,
indexStyle);
}
}
if (key) {
let node = cc.cat(key);
index = node['tempIndex'];
treeNode(node);
} else {
let scene = cc.director.getScene();
treeNode(scene);
}
return '属性依次为x,y,width,height,scale.使用cc.cat(id)查看详细属性.';
}
cc.cat = function (key) {
let index = 0;
let target;
let sortId = function (node) {
if (target) return;
if (cc.js.isNumber(key)) {
if (key === index++) {
target = node;
return;
}
} else {
if (key.toLowerCase() === node.name.toLowerCase()) {
target = node;
return;
} else {
index++;
}
}
if (node.childrenCount > 0) {
for (let i = 0; i < node.childrenCount; i++) {
sortId(node.children[i]);
}
}
}
let scene = cc.director.getScene();
sortId(scene);
target['tempIndex'] = cc.js.isNumber(key) ? key : index;
return target;
}
cc.list = function (key) {
let targets = [];
let step = function (node) {
if (node.name.toLowerCase().indexOf(key.toLowerCase()) > -1) {
targets.push(node);
}
if (node.childrenCount > 0) {
for (let i = 0; i < node.childrenCount; i++) {
step(node.children[i]);
}
}
}
let scene = cc.director.getScene();
step(scene);
if (targets.length === 1) {
return targets[0];
} else {
return targets;
}
}
cc.where = function (key) {
let target = key.name ? key : cc.cat(key);
if (!target) {
return null;
}
let rect = target.getBoundingBoxToWorld();
let bgNode = new cc.Node();
let graphics = bgNode.addComponent(cc.Graphics);
let scene = cc.director.getScene();
scene.addChild(bgNode);
bgNode.position = rect.center;
bgNode.group = target.group;
bgNode.zIndex = cc.macro.MAX_ZINDEX;
let isZeroSize = rect.width === 0 || rect.height === 0;
if (isZeroSize) {
graphics.circle(0, 0, 100);
graphics.fillColor = cc.Color.GREEN;
graphics.fill();
} else {
bgNode.width = rect.width;
bgNode.height = rect.height;
graphics.rect(-bgNode.width / 2, -bgNode.height / 2, bgNode.width, bgNode.height);
graphics.fillColor = new cc.Color().fromHEX('#E91E6390');
graphics.fill();
}
setTimeout(() => {
if (cc.isValid(bgNode)) {
bgNode.destroy();
}
}, 2000);
return target;
}
cc.cache = function () {
let rawCacheData = cc.assetManager.assets._map;
let cacheData = [];
let totalTextureSize = 0;
for (let k in rawCacheData) {
let item = rawCacheData[k];
if (item.type !== 'js' && item.type !== 'json') {
let itemName = '_';
let preview = '';
let content = item.__classname__;
let formatSize = -1;
if (item.type === 'png' || item.type === 'jpg') {
let texture = rawCacheData[k.replace('.' + item.type, '.json')];
if (texture && texture._owner && texture._owner._name) {
itemName = texture._owner._name;
preview = texture.content.url;
}
} else {
if (item.name) {
itemName = item.name;
} else if (item._owner) {
itemName = (item._owner && item._owner.name) || '_';
}
if (content === 'cc.Texture2D') {
preview = item.nativeUrl;
let textureSize = item.width * item.height * ((item._native === '.jpg' ? 3 : 4) / 1024 / 1024);
totalTextureSize += textureSize;
// sizeStr = textureSize.toFixed(3) + 'M';
formatSize = Math.round(textureSize * 1000) / 1000;
} else if (content === 'cc.SpriteFrame') {
preview = item._texture.nativeUrl;
}
}
cacheData.push({
queueId: item.queueId,
type: content,
name: itemName,
preview: preview,
id: item._uuid,
size: formatSize
});
}
}
let cacheTitle = `缓存 [文件总数:${cacheData.length}][纹理缓存:${totalTextureSize.toFixed(2) + 'M'}]`;
return [cacheData, cacheTitle];
}
}

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,192 @@
const app = new Vue({
el: '#app',
vuetify: new Vuetify({
theme: { dark: true }
}),
data: {
isShowTop: true,
drawer: false,
cacheDialog: false,
cacheTitle: '',
cacheHeaders: [
{ text: 'Type', value: 'type' },
{ text: 'Name', value: 'name' },
{ text: 'Preivew', value: 'preview' },
{ text: 'ID', value: 'id' },
{ text: 'Size', value: 'size' },
],
cacheRawData: [],
cacheData: [],
cacheSearchText: null,
cacheOnlyTexture: true,
treeData: [],
selectedNodes: [],
intervalId: -1,
treeSearchText: null,
nodeSchema: {},
componentsSchema: [],
},
created() {
if (window.innerHeight === window.outerHeight) { // 手机端chrome device模式
this.isShowTop = false;
}
this.waitCCInit().then(() => {
if (this.isShowTop) {
this.startUpdateTree();
}
initConsoleUtil();
});
},
watch: {
cacheOnlyTexture() {
this.updateCacheData();
}
},
computed: {
treeFilter() {
return (item, search, textKey) => item[textKey].indexOf(search) > -1;
},
selectedNode() {
if (!this.selectedNodes.length) return undefined
let node = getNodeById(this.selectedNodes[0]);
if (node) {
if (!node.hex_color) {
cc.js.getset(node, 'hex_color', () => {
return '#' + node.color.toHEX('#rrggbb');
}, (hex) => {
node.color = new cc.Color().fromHEX(hex);
}, false, true);
}
let superPreLoad = node._onPreDestroy;
node._onPreDestroy = () => {
superPreLoad.apply(node);
if (this.selectedNodes.length > 0 && this.selectedNodes[0] === node._id) {
this.selectedNodes.pop();
}
}
this.nodeSchema = NEX_CONFIG.nodeSchema.node2d;
let componentsSchema = [];
for (let component of node._components) {
let schema = NEX_CONFIG.componentsSchema[component.__classname__];
if (schema) {
node[schema.key] = node.getComponent(schema.key);
for (let i = 0; i < schema.rows.length; i++) {
if (schema.rows[i].type === 'color') {
if (!node[schema.key][schema.rows[i].key]) {
cc.js.getset(node[schema.key], schema.rows[i].key, () => {
return '#' + node.getComponent(schema.key)[schema.rows[i].rawKey].toHEX('#rrggbb');
}, (hex) => {
node.getComponent(schema.key)[schema.rows[i].rawKey] = new cc.Color().fromHEX(hex);
}, false, true);
}
}
}
} else {
schema = {
title: component.__classname__,
key: component.__classname__
};
node[schema.key] = node.getComponent(schema.key);
}
componentsSchema.push(schema);
}
this.componentsSchema = componentsSchema;
}
return node;
},
},
methods: {
waitCCInit() {
return new Promise((resolve, reject) => {
let id = setInterval(() => {
if (window.cc) {
resolve();
clearInterval(id);
}
}, 500);
});
},
refreshTree: function () {
if (!this.$data.drawer || !window.cc || !cc.director.getScene() || !cc.director.getScene().children) return;
this.$data.treeData = getChildren(cc.director.getScene());
},
startUpdateTree: function () {
this.$data.intervalId = setInterval(() => {
this.refreshTree();
}, 200);
},
stopUpdateTree: function () {
clearInterval(this.$data.intervalId);
},
outputNodeHandler(id) {
let i = 1;
while (window['temp' + i] !== undefined) {
i++;
}
window['temp' + i] = this.selectedNode;
console.log('temp' + i);
console.log(window['temp' + i]);
},
outputComponentHandler(component) {
let i = 1;
while (window['temp' + i] !== undefined) {
i++;
}
window['temp' + i] = this.selectedNode.getComponent(component);
console.log('temp' + i);
console.log(window['temp' + i]);
},
drawNodeRect() {
cc.where(this.selectedNode);
},
updateCacheData() {
if (this.$data.cacheOnlyTexture) {
this.$data.cacheData = this.$data.cacheRawData.filter(item => item.type === 'cc.Texture2D');
} else {
this.$data.cacheData = this.$data.cacheRawData;
}
},
openCacheDialog() {
[this.$data.cacheRawData, this.$data.cacheTitle] = cc.cache();
this.updateCacheData();
this.$data.cacheDialog = true;
},
openGithub() {
window.open('https://github.com/potato47/ccc-devtools');
},
openCocosForum() {
window.open('https://forum.cocos.com/');
},
openCocosDocs() {
window.open('https://docs.cocos.com/');
}
}
});
function getChildren(node) {
return node.children.map(child => {
let children = (child.children && child.children.length > 0) ? getChildren(child) : [];
return { id: child._id, name: child.name, active: child.activeInHierarchy, children };
});
}
function getNodeById(id) {
let target;
const search = function (node) {
if (node._id === id) {
target = node;
return;
}
if (node.childrenCount) {
for (let i = 0; i < node.childrenCount; i++) {
if (!target) {
search(node.children[i]);
}
}
}
}
const scene = cc.director.getScene();
search(scene);
return target;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

View File

@ -0,0 +1,6 @@
{
"name": "ccc-devtools",
"version": "2d-v2.4",
"author": "Next",
"repo": "https://github.com/potato47/ccc-devtools.git"
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -0,0 +1,43 @@
html
head
meta(charset='utf-8')
title=title
meta(name='viewport' content='width=device-width,user-scalable=no,initial-scale=1, minimum-scale=1,maximum-scale=1')
meta(name='apple-mobile-web-app-capable' content='yes')
meta(name='full-screen' content='yes')
meta(name='screen-orientation' content='portrait')
meta(name='x5-fullscreen' content='true')
meta(name='360-fullscreen' content='true')
meta(name='renderer' content='webkit')
meta(name='force-rendering' content='webkit')
meta(http-equiv='X-UA-Compatible' content='IE=edge,chrome=1')
link(rel='stylesheet' href='app/editor/static/preview-templates/style.css')
link(rel='stylesheet' href='ccc-devtools/catan_style.css')
block head
body
include ccc-devtools/index.html
script(type='text/javascript' charset='utf-8' src='settings.js')
script(type='text/javascript' charset='utf-8' src='preview-scripts/__quick_compile__.js')
script(type='text/javascript' charset='utf-8' src='ccc-devtools/catan_boot.js')
script(type='text/javascript' charset='utf-8' src='build-templates_dist/index.js')
script(type='text/javascript' charset='utf-8' src='build-templates_dist/platform.js')
script(type='text/javascript' charset='utf-8' src='/socket.io/socket.io.js')
script(type='text/javascript').
window.__socket_io__ = window.io;
window.CC_PHYSICS_CANNON = #{enableCannonPhysics};
window.CC_PHYSICS_BUILTIN = #{enableBuiltinPhysics};
if enableDebugger
script(type='text/javascript' charset='utf-8' src='app/node_modules/vconsole/dist/vconsole.min.js')
script(type='text/javascript' charset='utf-8' src='app/engine/bin/' + cocos2d)
if enableDebugger
script(type='text/javascript').
vConsole = new VConsole();

View File

@ -0,0 +1,87 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Cocos Creator</title>
<!--http://www.html5rocks.com/en/mobile/mobifying/-->
<meta name="viewport"
content="width=device-width,user-scalable=no,initial-scale=1, minimum-scale=1,maximum-scale=1" />
<!--https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html-->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="format-detection" content="telephone=no">
<!-- force webkit on 360 -->
<meta name="renderer" content="webkit" />
<meta name="force-rendering" content="webkit" />
<!-- force edge on IE -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="msapplication-tap-highlight" content="no">
<!-- force full screen on some browser -->
<meta name="full-screen" content="yes" />
<meta name="x5-fullscreen" content="true" />
<meta name="360-fullscreen" content="true" />
<!-- force screen orientation on some browser -->
<meta name="screen-orientation" content="" />
<meta name="x5-orientation" content="">
<!--fix fireball/issues/3568 -->
<!--<meta name="browsermode" content="application">-->
<meta name="x5-page-mode" content="app">
<!--<link rel="apple-touch-icon" href=".png" />-->
<!--<link rel="apple-touch-icon-precomposed" href=".png" />-->
<!--自定義-->
<link rel="icon" href="favicon.ico">
</head>
<body>
<div id="background-img"></div>
<div ccc-devtools="ccc-devtools/index.html"></div>
<canvas id="GameCanvas" oncontextmenu="event.preventDefault()" tabindex="0"></canvas>
<div id="splash">
<div class="progress-bar stripes">
<span style="width: 0%"></span>
</div>
</div>
<!--自定義-->
<link href="catan/style-mobile.css" rel="stylesheet" type="text/css" />
<link href="catan/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="catan/boot.js"></script>
<script type="text/javascript" src="build-templates_dist/index.js"></script>
<script type="text/javascript" src="build-templates_dist/platform.js"></script>
<!--COCOS-->
<script type="text/javascript" charset="utf-8" src="settings.js"></script>
<script type="text/javascript" charset="utf-8" src="/socket.io/socket.io.js"></script>
<script type="text/javascript" charset="utf-8" src="app/engine/bin/cocos2d-js-for-preview.js"></script>
<script type="text/javascript" charset="utf-8" src="preview-scripts/__quick_compile__.js"></script>
<script type="text/javascript" charset="utf-8" src="app/node_modules/vconsole/dist/vconsole.min.js"></script>
<!--vConsole-->
<script type="text/javascript">
let url = window.location.search;
let request = [];
if (url.indexOf("?") != -1) {
let str = url.substr(1);
let strs = str.split("&");
for (let i = 0; i < strs.length; i++) {
request[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
}
}
let vConsole = request["vConsole"];
if (vConsole) {
vConsole = new VConsole();
}
</script>
</body>
</html>

View File

@ -1,8 +1,8 @@
{ {
"engine": "cocos-creator-js", "engine": "cocos2d-html5",
"packages": "packages", "packages": "packages",
"name": "Test",
"id": "31044334-3315-45da-915f-9e90889a0246",
"version": "2.4.4", "version": "2.4.4",
"name": "Test_2_4_4_20211222_JMKeepAccounts",
"id": "029a16fe-3726-4807-91c6-20ddd7eb4a86",
"isNew": false "isNew": false
} }

View File

@ -1,55 +1,13 @@
{ {
"title": "JM_KA",
"packageName": "org.cocos2d.demo",
"startScene": "aff4ffa6-4509-4f66-8468-bc2c8a757f94",
"excludeScenes": [], "excludeScenes": [],
"orientation": { "orientation": {
"landscapeLeft": false, "landscapeLeft": true,
"landscapeRight": false, "landscapeRight": true,
"portrait": true, "portrait": false,
"upsideDown": false "upsideDown": false
}, },
"webOrientation": "auto", "packageName": "org.cocos2d.helloworld",
"inlineSpriteFrames": true, "startScene": "2d2f792f-a40c-49bb-a189-ed176a246e49",
"inlineSpriteFrames_native": true, "title": "hello_world",
"mainCompressionType": "default", "webOrientation": "auto"
"mainIsRemote": false,
"optimizeHotUpdate": false,
"md5Cache": true,
"nativeMd5Cache": false,
"encryptJs": true,
"xxteaKey": "a010552a-faa1-45",
"zipCompressJs": true,
"fb-instant-games": {},
"android": {
"REMOTE_SERVER_ROOT": "",
"packageName": "org.cocos2d.demo"
},
"ios": {
"REMOTE_SERVER_ROOT": "",
"ios_enable_jit": true,
"packageName": "com.jianmiau.jmka"
},
"mac": {
"REMOTE_SERVER_ROOT": "",
"height": 720,
"packageName": "org.cocos2d.demo",
"width": 1280
},
"win32": {
"REMOTE_SERVER_ROOT": "",
"height": 720,
"width": 1280
},
"android-instant": {
"REMOTE_SERVER_ROOT": "",
"host": "",
"packageName": "org.cocos2d.demo",
"pathPattern": "",
"recordPath": "",
"scheme": "https",
"skipRecord": false
},
"appBundle": false,
"agreements": {}
} }

View File

@ -0,0 +1,7 @@
{
"excludeScenes": [],
"packageName": "org.cocos2d.helloworld",
"platform": "web-mobile",
"startScene": "2d2f792f-a40c-49bb-a189-ed176a246e49",
"title": "HelloWorld"
}

View File

@ -1,3 +1,35 @@
{ {
"last-module-event-record-time": 1640221316944 "collision-matrix": [
[
true
]
],
"excluded-modules": [],
"group-list": [
"default"
],
"start-scene": "2d2f792f-a40c-49bb-a189-ed176a246e49",
"design-resolution-width": 960,
"design-resolution-height": 640,
"fit-width": false,
"fit-height": true,
"use-project-simulator-setting": false,
"simulator-orientation": false,
"use-customize-simulator": false,
"simulator-resolution": {
"width": 960,
"height": 640
},
"last-module-event-record-time": 0,
"assets-sort-type": "name",
"facebook": {
"enable": false,
"appID": "",
"live": {
"enable": false
},
"audience": {
"enable": false
}
}
} }

BIN
template-banner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

5
template.json Normal file
View File

@ -0,0 +1,5 @@
{
"name": "TEMPLATES.helloworld-ts.name",
"desc": "TEMPLATES.helloworld-ts.desc",
"banner": "template-banner.png"
}