This commit is contained in:
靳国强
2021-04-09 14:43:19 +08:00
parent 7924328113
commit a8f9370ba0
131 changed files with 67901 additions and 0 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,90 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Cocos Creator | hello_world</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="stylesheet" type="text/css" href="style-mobile.css"/>
<link rel="icon" href="favicon.ico"/>
</head>
<body>
<canvas id="GameCanvas" oncontextmenu="event.preventDefault()" tabindex="0"></canvas>
<div id="splash">
<div class="progress-bar stripes">
<span style="width: 0%"></span>
</div>
</div>
<script src="src/settings.js" charset="utf-8"></script>
<script src="main.js" charset="utf-8"></script>
<script type="text/javascript">
(function () {
// open web debugger console
if (typeof VConsole !== 'undefined') {
window.vConsole = new VConsole();
}
var debug = window._CCSettings.debug;
var splash = document.getElementById('splash');
splash.style.display = 'block';
function loadScript (moduleName, cb) {
function scriptLoaded () {
document.body.removeChild(domScript);
domScript.removeEventListener('load', scriptLoaded, false);
cb && cb();
};
var domScript = document.createElement('script');
domScript.async = true;
domScript.src = moduleName;
domScript.addEventListener('load', scriptLoaded, false);
document.body.appendChild(domScript);
}
loadScript(debug ? 'cocos2d-js.js' : 'cocos2d-js-min.js', function () {
if (CC_PHYSICS_BUILTIN || CC_PHYSICS_CANNON) {
loadScript(debug ? 'physics.js' : 'physics-min.js', window.boot);
}
else {
window.boot();
}
});
})();
</script>
</body>
</html>

View File

@@ -0,0 +1,200 @@
window.boot = function () {
var settings = window._CCSettings;
window._CCSettings = undefined;
if ( !settings.debug ) {
var uuids = settings.uuids;
var rawAssets = settings.rawAssets;
var assetTypes = settings.assetTypes;
var realRawAssets = settings.rawAssets = {};
for (var mount in rawAssets) {
var entries = rawAssets[mount];
var realEntries = realRawAssets[mount] = {};
for (var id in entries) {
var entry = entries[id];
var type = entry[1];
// retrieve minified raw asset
if (typeof type === 'number') {
entry[1] = assetTypes[type];
}
// retrieve uuid
realEntries[uuids[id] || id] = entry;
}
}
var scenes = settings.scenes;
for (var i = 0; i < scenes.length; ++i) {
var scene = scenes[i];
if (typeof scene.uuid === 'number') {
scene.uuid = uuids[scene.uuid];
}
}
var packedAssets = settings.packedAssets;
for (var packId in packedAssets) {
var packedIds = packedAssets[packId];
for (var j = 0; j < packedIds.length; ++j) {
if (typeof packedIds[j] === 'number') {
packedIds[j] = uuids[packedIds[j]];
}
}
}
var subpackages = settings.subpackages;
for (var subId in subpackages) {
var uuidArray = subpackages[subId].uuids;
if (uuidArray) {
for (var k = 0, l = uuidArray.length; k < l; k++) {
if (typeof uuidArray[k] === 'number') {
uuidArray[k] = uuids[uuidArray[k]];
}
}
}
}
}
function setLoadingDisplay () {
// Loading splash scene
var splash = document.getElementById('splash');
var progressBar = splash.querySelector('.progress-bar span');
cc.loader.onProgress = function (completedCount, totalCount, item) {
var percent = 100 * completedCount / totalCount;
if (progressBar) {
progressBar.style.width = percent.toFixed(2) + '%';
}
};
splash.style.display = 'block';
progressBar.style.width = '0%';
cc.director.once(cc.Director.EVENT_AFTER_SCENE_LAUNCH, function () {
splash.style.display = 'none';
});
}
var onStart = function () {
cc.loader.downloader._subpackages = settings.subpackages;
cc.view.enableRetina(true);
cc.view.resizeWithBrowserSize(true);
if (cc.sys.isBrowser) {
setLoadingDisplay();
}
if (cc.sys.isMobile) {
if (settings.orientation === 'landscape') {
cc.view.setOrientation(cc.macro.ORIENTATION_LANDSCAPE);
}
else if (settings.orientation === 'portrait') {
cc.view.setOrientation(cc.macro.ORIENTATION_PORTRAIT);
}
cc.view.enableAutoFullScreen([
cc.sys.BROWSER_TYPE_BAIDU,
cc.sys.BROWSER_TYPE_BAIDU_APP,
cc.sys.BROWSER_TYPE_WECHAT,
cc.sys.BROWSER_TYPE_MOBILE_QQ,
cc.sys.BROWSER_TYPE_MIUI,
].indexOf(cc.sys.browserType) < 0);
}
// Limit downloading max concurrent task to 2,
// more tasks simultaneously may cause performance draw back on some android system / browsers.
// You can adjust the number based on your own test result, you have to set it before any loading process to take effect.
if (cc.sys.isBrowser && cc.sys.os === cc.sys.OS_ANDROID) {
cc.macro.DOWNLOAD_MAX_CONCURRENT = 2;
}
function loadScene(launchScene) {
cc.director.loadScene(launchScene,
function (err) {
if (!err) {
if (cc.sys.isBrowser) {
// show canvas
var canvas = document.getElementById('GameCanvas');
canvas.style.visibility = '';
var div = document.getElementById('GameDiv');
if (div) {
div.style.backgroundImage = '';
}
}
cc.loader.onProgress = null;
console.log('Success to load scene: ' + launchScene);
}
else if (CC_BUILD) {
setTimeout(function () {
loadScene(launchScene);
}, 1000);
}
}
);
}
var launchScene = settings.launchScene;
// load scene
loadScene(launchScene);
};
// jsList
var jsList = settings.jsList;
var bundledScript = settings.debug ? 'src/project.dev.js' : 'src/project.js';
if (jsList) {
jsList = jsList.map(function (x) {
return 'src/' + x;
});
jsList.push(bundledScript);
}
else {
jsList = [bundledScript];
}
var option = {
id: 'GameCanvas',
scenes: settings.scenes,
debugMode: settings.debug ? cc.debug.DebugMode.INFO : cc.debug.DebugMode.ERROR,
showFPS: settings.debug,
frameRate: 60,
jsList: jsList,
groupList: settings.groupList,
collisionMatrix: settings.collisionMatrix,
};
// init assets
cc.AssetLibrary.init({
libraryPath: 'res/import',
rawAssetsBase: 'res/raw-',
rawAssets: settings.rawAssets,
packedAssets: settings.packedAssets,
md5AssetsMap: settings.md5AssetsMap,
subpackages: settings.subpackages
});
cc.game.run(option, onStart);
};
if (window.jsb) {
var isRuntime = (typeof loadRuntime === 'function');
if (isRuntime) {
require('src/settings.js');
require('src/cocos2d-runtime.js');
if (CC_PHYSICS_BUILTIN || CC_PHYSICS_CANNON) {
require('src/physics.js');
}
require('jsb-adapter/engine/index.js');
}
else {
require('src/settings.js');
require('src/cocos2d-jsb.js');
if (CC_PHYSICS_BUILTIN || CC_PHYSICS_CANNON) {
require('src/physics.js');
}
require('jsb-adapter/jsb-engine.js');
}
cc.macro.CLEANUP_IMAGE_CACHE = true;
window.boot();
}

View File

@@ -0,0 +1 @@
[[{"__type__":"cc.SceneAsset","_name":"helloworld1","scene":{"__id__":1},"asyncLoadAssets":null},{"__type__":"cc.Scene","_name":"New Node","_children":[{"__id__":2}],"_anchorPoint":{"__type__":"cc.Vec2"},"_trs":{"__type__":"TypedArray","ctor":"Float64Array","array":[0,0,0,0,0,0,1,1,1,1]},"autoReleaseAssets":false},{"__type__":"cc.Node","_name":"Canvas","_parent":{"__id__":1},"_children":[{"__id__":3},{"__id__":4},{"__id__":5},{"__id__":6},{"__id__":7}],"_components":[{"__type__":"cc.Canvas","node":{"__id__":2}},{"__type__":"cc.Widget","node":{"__id__":2},"_alignFlags":45}],"_color":{"__type__":"cc.Color","r":252,"g":252,"b":252},"_contentSize":{"__type__":"cc.Size","width":960,"height":640},"_trs":{"__type__":"TypedArray","ctor":"Float64Array","array":[480,320,0,0,0,0,1,1,1,1]},"_id":"a286bbGknJLZpRpxROV6M94"},{"__type__":"cc.Node","_name":"Main Camera","_parent":{"__id__":2},"_components":[{"__type__":"cc.Camera","node":{"__id__":3},"_clearFlags":7,"_depth":-1}],"_trs":{"__type__":"TypedArray","ctor":"Float64Array","array":[0,0,260.20003889642146,0,0,0,1,1,1,1]}},{"__type__":"cc.Node","_name":"background","_parent":{"__id__":2},"_components":[{"__type__":"cc.Widget","node":{"__id__":4},"_alignFlags":45,"_originalWidth":200,"_originalHeight":150},{"__type__":"cc.Sprite","node":{"__id__":4},"_materials":[{"__uuid__":"ecpdLyjvZBwrvm+cedCcQy"}],"_spriteFrame":{"__uuid__":"41D7kWhyFGY7q4NDlzkazn"},"_type":1,"_sizeMode":0}],"_color":{"__type__":"cc.Color","r":27,"g":38,"b":46},"_contentSize":{"__type__":"cc.Size","width":960,"height":640},"_trs":{"__type__":"TypedArray","ctor":"Float64Array","array":[0,0,0,0,0,0,1,1,1,1]}},{"__type__":"cc.Node","_name":"cocos","_parent":{"__id__":2},"_components":[{"__type__":"cc.Sprite","node":{"__id__":5},"_materials":[{"__uuid__":"ecpdLyjvZBwrvm+cedCcQy"}],"_spriteFrame":{"__uuid__":"31vIlawANFZqnzLlSuHBfc"}}],"_contentSize":{"__type__":"cc.Size","width":195,"height":270},"_trs":{"__type__":"TypedArray","ctor":"Float64Array","array":[0,50,0,0,0,0,1,1,1,1]}},{"__type__":"cc.Node","_name":"label","_parent":{"__id__":2},"_components":[{"__type__":"cc.Label","node":{"__id__":6},"_materials":[{"__uuid__":"ecpdLyjvZBwrvm+cedCcQy"}],"_useOriginalSize":false,"_string":"场景一","_N$string":"场景一","_fontSize":60,"_lineHeight":60,"_N$horizontalAlign":1,"_N$verticalAlign":1}],"_contentSize":{"__type__":"cc.Size","width":180,"height":75.6},"_trs":{"__type__":"TypedArray","ctor":"Float64Array","array":[0,-180,0,0,0,0,1,1,1,1]}},{"__type__":"cc.Node","_name":"start","_parent":{"__id__":2},"_components":[{"__type__":"cc.Label","node":{"__id__":7},"_materials":[{"__uuid__":"ecpdLyjvZBwrvm+cedCcQy"}],"_useOriginalSize":false,"_string":"游戏已经开始","_N$string":"游戏已经开始","_fontSize":60,"_lineHeight":60,"_N$horizontalAlign":1,"_N$verticalAlign":1}],"_opacity":0,"_contentSize":{"__type__":"cc.Size","width":360,"height":75.6},"_trs":{"__type__":"TypedArray","ctor":"Float64Array","array":[-2.689,228.739,0,0,0,0,1,1,1,1]}}],{"__type__":"cc.SpriteFrame","content":{"name":"HelloWorld","texture":"6aoKpq6+5BVaCIpoemqt7E","rect":[0,0,195,270],"offset":[0,0],"originalSize":[195,270],"capInsets":[0,0,0,0]}},{"__type__":"cc.SpriteFrame","content":{"name":"singleColor","texture":"a8Anh32NZGRZegUtSgEj26","rect":[0,0,2,2],"offset":[0,0],"originalSize":[2,2],"capInsets":[0,0,0,0]}}]

View File

@@ -0,0 +1 @@
{"type":"cc.Texture2D","data":"0,9729,9729,33071,33071,0,0,1|0,9729,9729,33071,33071,0,0,1|0,9729,9729,33071,33071,0,0,1"}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
[{"__type__":"cc.EffectAsset","_name":"builtin-2d-gray-sprite","techniques":[{"passes":[{"blendState":{"targets":[{"blend":true}]},"rasterizerState":{"cullMode":0},"properties":{"texture":{"value":"white","type":29}},"program":"builtin-2d-gray-sprite|vs|fs"}]}],"shaders":[{"hash":4278481454,"glsl3":{"vert":"\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nin vec3 a_position;\nin mediump vec2 a_uv0;\nout mediump vec2 v_uv0;\nin vec4 a_color;\nout vec4 v_color;\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n v_uv0 = a_uv0;\n v_color = a_color;\n}","frag":"\nprecision highp float;\nuniform sampler2D texture;\nin mediump vec2 v_uv0;\nin vec4 v_color;\nvoid main () {\n vec4 color = v_color;\n vec4 texture_tmp = texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n color.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n color.a *= texture_tmp.a;\n #else\n color *= texture_tmp;\n #endif\n float gray = 0.2126*color.r + 0.7152*color.g + 0.0722*color.b;\n gl_FragColor = vec4(gray, gray, gray, color.a);\n}"},"glsl1":{"vert":"\nprecision highp float;\nuniform mat4 cc_matViewProj;\nattribute vec3 a_position;\nattribute mediump vec2 a_uv0;\nvarying mediump vec2 v_uv0;\nattribute vec4 a_color;\nvarying vec4 v_color;\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n v_uv0 = a_uv0;\n v_color = a_color;\n}","frag":"\nprecision highp float;\nuniform sampler2D texture;\nvarying mediump vec2 v_uv0;\nvarying vec4 v_color;\nvoid main () {\n vec4 color = v_color;\n vec4 texture_tmp = texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n color.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n color.a *= texture_tmp.a;\n #else\n color *= texture_tmp;\n #endif\n float gray = 0.2126*color.r + 0.7152*color.g + 0.0722*color.b;\n gl_FragColor = vec4(gray, gray, gray, color.a);\n}"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]}],"samplers":[]},"locals":{"blocks":[],"samplers":[]}},"defines":[{"name":"CC_USE_ALPHA_ATLAS_texture","type":"boolean","defines":[]},{"name":"INPUT_IS_GAMMA","type":"boolean","defines":[]}],"blocks":[],"samplers":[{"name":"texture","type":29,"count":1,"defines":[],"binding":30}],"record":null,"name":"builtin-2d-gray-sprite|vs|fs"}]},{"__type__":"cc.Material","_name":"builtin-2d-gray-sprite","_effectAsset":{"__uuid__":"14TDKXr2NJ6LjvHPops74o"},"_techniqueData":{}}]

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
[{"__type__":"cc.EffectAsset","_name":"builtin-clear-stencil","techniques":[{"passes":[{"blendState":{"targets":[{"blend":true}]},"rasterizerState":{"cullMode":0},"program":"builtin-clear-stencil|vs|fs"}]}],"shaders":[{"hash":2075641479,"glsl3":{"vert":"\nprecision highp float;\nin vec3 a_position;\nvoid main () {\n gl_Position = vec4(a_position, 1);\n}","frag":"\nprecision highp float;\nvoid main () {\n gl_FragColor = vec4(1.0);\n}"},"glsl1":{"vert":"\nprecision highp float;\nattribute vec3 a_position;\nvoid main () {\n gl_Position = vec4(a_position, 1);\n}","frag":"\nprecision highp float;\nvoid main () {\n gl_FragColor = vec4(1.0);\n}"},"builtins":{"globals":{"blocks":[],"samplers":[]},"locals":{"blocks":[],"samplers":[]}},"defines":[],"blocks":[],"samplers":[],"record":null,"name":"builtin-clear-stencil|vs|fs"}]},{"__type__":"cc.Material","_name":"builtin-clear-stencil","_effectAsset":{"__uuid__":"c0BAyVxX9JzZy8EjFrc9DU"},"_techniqueData":{}}]

View File

@@ -0,0 +1 @@
[{"__type__":"cc.EffectAsset","_name":"builtin-2d-spine","techniques":[{"passes":[{"blendState":{"targets":[{"blend":true}]},"rasterizerState":{"cullMode":0},"properties":{"texture":{"value":"white","type":29},"alphaThreshold":{"value":[0.5],"type":13}},"program":"builtin-2d-spine|vs|fs"}]}],"shaders":[{"hash":3550530479,"glsl3":{"vert":"\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\n#if USE_TINT\n in vec4 a_color0;\n#endif\nin vec2 a_uv0;\nout vec2 v_uv0;\nout vec4 v_light;\n#if USE_TINT\n out vec4 v_dark;\n#endif\nvoid main () {\n mat4 mvp;\n #if CC_USE_MODEL\n mvp = cc_matViewProj * cc_matWorld;\n #else\n mvp = cc_matViewProj;\n #endif\n v_uv0 = a_uv0;\n v_light = a_color;\n #if USE_TINT\n v_dark = a_color0;\n #endif\n gl_Position = mvp * vec4(a_position, 1);\n}","frag":"\nprecision highp float;\nuniform sampler2D texture;\nin vec2 v_uv0;\nin vec4 v_light;\n#if USE_TINT\n in vec4 v_dark;\n#endif\n#if USE_ALPHA_TEST\n uniform ALPHA_TEST {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvoid main () {\n vec4 texColor = vec4(1.0);\n vec4 texture_tmp = texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n texColor.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n texColor.a *= texture_tmp.a;\n #else\n texColor *= texture_tmp;\n #endif\n vec4 finalColor;\n #if USE_TINT\n finalColor.a = v_light.a * texColor.a;\n finalColor.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;\n #else\n finalColor = texColor * v_light;\n #endif\n ALPHA_TEST(finalColor);\n gl_FragColor = finalColor;\n}"},"glsl1":{"vert":"\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\n#if USE_TINT\n attribute vec4 a_color0;\n#endif\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\nvarying vec4 v_light;\n#if USE_TINT\n varying vec4 v_dark;\n#endif\nvoid main () {\n mat4 mvp;\n #if CC_USE_MODEL\n mvp = cc_matViewProj * cc_matWorld;\n #else\n mvp = cc_matViewProj;\n #endif\n v_uv0 = a_uv0;\n v_light = a_color;\n #if USE_TINT\n v_dark = a_color0;\n #endif\n gl_Position = mvp * vec4(a_position, 1);\n}","frag":"\nprecision highp float;\nuniform sampler2D texture;\nvarying vec2 v_uv0;\nvarying vec4 v_light;\n#if USE_TINT\n varying vec4 v_dark;\n#endif\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvoid main () {\n vec4 texColor = vec4(1.0);\n vec4 texture_tmp = texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n texColor.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n texColor.a *= texture_tmp.a;\n #else\n texColor *= texture_tmp;\n #endif\n vec4 finalColor;\n #if USE_TINT\n finalColor.a = v_light.a * texColor.a;\n finalColor.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;\n #else\n finalColor = texColor * v_light;\n #endif\n ALPHA_TEST(finalColor);\n gl_FragColor = finalColor;\n}"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]}],"samplers":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplers":[]}},"defines":[{"name":"USE_TINT","type":"boolean","defines":[]},{"name":"CC_USE_MODEL","type":"boolean","defines":[]},{"name":"USE_ALPHA_TEST","type":"boolean","defines":[]},{"name":"CC_USE_ALPHA_ATLAS_texture","type":"boolean","defines":[]},{"name":"INPUT_IS_GAMMA","type":"boolean","defines":[]}],"blocks":[{"name":"ALPHA_TEST","members":[{"name":"alphaThreshold","type":13,"count":1}],"defines":["USE_ALPHA_TEST"],"binding":0}],"samplers":[{"name":"texture","type":29,"count":1,"defines":[],"binding":30}],"record":null,"name":"builtin-2d-spine|vs|fs"}]},{"__type__":"cc.Material","_name":"builtin-2d-spine","_effectAsset":{"__uuid__":"0ek66qC1NOQLjgYmi04HvX"},"_techniqueData":{}}]

View File

@@ -0,0 +1 @@
[{"__type__":"cc.SpriteFrame","content":{"name":"HelloWorld","texture":"6aoKpq6+5BVaCIpoemqt7E","rect":[0,0,195,270],"offset":[0,0],"originalSize":[195,270],"capInsets":[0,0,0,0]}},{"__type__":"cc.SpriteFrame","content":{"name":"singleColor","texture":"a8Anh32NZGRZegUtSgEj26","rect":[0,0,2,2],"offset":[0,0],"originalSize":[2,2],"capInsets":[0,0,0,0]}},[{"__type__":"cc.SceneAsset","_name":"helloworld2","scene":{"__id__":1},"asyncLoadAssets":null},{"__type__":"cc.Scene","_name":"New Node","_children":[{"__id__":2}],"_anchorPoint":{"__type__":"cc.Vec2"},"_trs":{"__type__":"TypedArray","ctor":"Float64Array","array":[0,0,0,0,0,0,1,1,1,1]},"autoReleaseAssets":false},{"__type__":"cc.Node","_name":"Canvas","_parent":{"__id__":1},"_children":[{"__id__":3},{"__id__":4},{"__id__":5},{"__id__":7},{"__id__":8}],"_components":[{"__type__":"cc.Canvas","node":{"__id__":2},"_fitWidth":true},{"__type__":"cc.Widget","node":{"__id__":2},"_alignFlags":45}],"_color":{"__type__":"cc.Color","r":252,"g":252,"b":252},"_contentSize":{"__type__":"cc.Size","width":960,"height":640},"_trs":{"__type__":"TypedArray","ctor":"Float64Array","array":[480,320,0,0,0,0,1,1,1,1]},"_id":"a286bbGknJLZpRpxROV6M94"},{"__type__":"cc.Node","_name":"Main Camera","_parent":{"__id__":2},"_components":[{"__type__":"cc.Camera","node":{"__id__":3},"_clearFlags":7,"_depth":-1}],"_trs":{"__type__":"TypedArray","ctor":"Float64Array","array":[0,0,260.20003889642146,0,0,0,1,1,1,1]}},{"__type__":"cc.Node","_name":"background","_parent":{"__id__":2},"_components":[{"__type__":"cc.Widget","node":{"__id__":4},"_alignFlags":45,"_originalWidth":200,"_originalHeight":150},{"__type__":"cc.Sprite","node":{"__id__":4},"_materials":[{"__uuid__":"ecpdLyjvZBwrvm+cedCcQy"}],"_spriteFrame":{"__uuid__":"41D7kWhyFGY7q4NDlzkazn"},"_type":1,"_sizeMode":0}],"_color":{"__type__":"cc.Color","r":27,"g":38,"b":46},"_contentSize":{"__type__":"cc.Size","width":960,"height":640},"_trs":{"__type__":"TypedArray","ctor":"Float64Array","array":[0,0,0,0,0,0,1,1,1,1]}},{"__type__":"cc.Node","_name":"cocos","_parent":{"__id__":2},"_children":[{"__id__":6}],"_components":[{"__type__":"280c3rsZJJKnZ9RqbALVwtK","node":{"__id__":5}},{"__type__":"cc.Sprite","node":{"__id__":5},"_materials":[{"__uuid__":"ecpdLyjvZBwrvm+cedCcQy"}],"_spriteFrame":{"__uuid__":"31vIlawANFZqnzLlSuHBfc"}}],"_color":{"__type__":"cc.Color","r":163,"g":169,"b":215},"_contentSize":{"__type__":"cc.Size","width":195,"height":270},"_trs":{"__type__":"TypedArray","ctor":"Float64Array","array":[0,50,0,0,0,0,1,1,1,1]}},{"__type__":"cc.Node","_name":"label copy","_parent":{"__id__":5},"_components":[{"__type__":"cc.Label","node":{"__id__":6},"_materials":[{"__uuid__":"ecpdLyjvZBwrvm+cedCcQy"}],"_useOriginalSize":false,"_string":"点我","_N$string":"点我","_lineHeight":60,"_N$horizontalAlign":1,"_N$verticalAlign":1}],"_contentSize":{"__type__":"cc.Size","width":80,"height":75.6},"_trs":{"__type__":"TypedArray","ctor":"Float64Array","array":[0,-67.446,0,0,0,0,1,1,1,1]}},{"__type__":"cc.Node","_name":"label","_parent":{"__id__":2},"_components":[{"__type__":"280c3rsZJJKnZ9RqbALVwtK","node":{"__id__":7}},{"__type__":"cc.Label","node":{"__id__":7},"_materials":[{"__uuid__":"ecpdLyjvZBwrvm+cedCcQy"}],"_useOriginalSize":false,"_string":"点我","_N$string":"点我","_fontSize":60,"_lineHeight":60,"_N$horizontalAlign":1,"_N$verticalAlign":1}],"_contentSize":{"__type__":"cc.Size","width":120,"height":75.6},"_trs":{"__type__":"TypedArray","ctor":"Float64Array","array":[0,-180,0,0,0,0,1,1,1,1]}},{"__type__":"cc.Node","_name":"start","_parent":{"__id__":2},"_components":[{"__type__":"cc.Label","node":{"__id__":8},"_materials":[{"__uuid__":"ecpdLyjvZBwrvm+cedCcQy"}],"_useOriginalSize":false,"_string":"游戏已经开始","_N$string":"游戏已经开始","_fontSize":60,"_lineHeight":60,"_N$horizontalAlign":1,"_N$verticalAlign":1}],"_opacity":0,"_contentSize":{"__type__":"cc.Size","width":240,"height":75.6},"_trs":{"__type__":"TypedArray","ctor":"Float64Array","array":[-2.689,228.739,0,0,0,0,1,1,1,1]}}]]

View File

@@ -0,0 +1 @@
{"__type__":"cc.EffectAsset","_name":"builtin-2d-sprite","techniques":[{"passes":[{"blendState":{"targets":[{"blend":true}]},"rasterizerState":{"cullMode":0},"properties":{"texture":{"value":"white","type":29},"alphaThreshold":{"value":[0.5],"type":13}},"program":"builtin-2d-sprite|vs|fs"}]}],"shaders":[{"hash":3278106612,"glsl3":{"vert":"\nprecision highp float;\nuniform CCGlobal {\n mat4 cc_matView;\n mat4 cc_matViewInv;\n mat4 cc_matProj;\n mat4 cc_matProjInv;\n mat4 cc_matViewProj;\n mat4 cc_matViewProjInv;\n vec4 cc_cameraPos;\n vec4 cc_time;\n mediump vec4 cc_screenSize;\n mediump vec4 cc_screenScale;\n};\nuniform CCLocal {\n mat4 cc_matWorld;\n mat4 cc_matWorldIT;\n};\nin vec3 a_position;\nin vec4 a_color;\nout vec4 v_color;\n#if USE_TEXTURE\nin vec2 a_uv0;\nout vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}","frag":"\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform ALPHA_TEST {\n float alphaThreshold;\n };\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nin vec4 v_color;\n#if USE_TEXTURE\nin vec2 v_uv0;\nuniform sampler2D texture;\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n vec4 texture_tmp = texture(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n o.a *= texture_tmp.a;\n #else\n o *= texture_tmp;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}"},"glsl1":{"vert":"\nprecision highp float;\nuniform mat4 cc_matViewProj;\nuniform mat4 cc_matWorld;\nattribute vec3 a_position;\nattribute vec4 a_color;\nvarying vec4 v_color;\n#if USE_TEXTURE\nattribute vec2 a_uv0;\nvarying vec2 v_uv0;\n#endif\nvoid main () {\n vec4 pos = vec4(a_position, 1);\n #if CC_USE_MODEL\n pos = cc_matViewProj * cc_matWorld * pos;\n #else\n pos = cc_matViewProj * pos;\n #endif\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n v_color = a_color;\n gl_Position = pos;\n}","frag":"\nprecision highp float;\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\nvarying vec4 v_color;\n#if USE_TEXTURE\nvarying vec2 v_uv0;\nuniform sampler2D texture;\n#endif\nvoid main () {\n vec4 o = vec4(1, 1, 1, 1);\n #if USE_TEXTURE\n vec4 texture_tmp = texture2D(texture, v_uv0);\n #if CC_USE_ALPHA_ATLAS_texture\n texture_tmp.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #if INPUT_IS_GAMMA\n o.rgb *= (texture_tmp.rgb * texture_tmp.rgb);\n o.a *= texture_tmp.a;\n #else\n o *= texture_tmp;\n #endif\n #endif\n o *= v_color;\n ALPHA_TEST(o);\n gl_FragColor = o;\n}"},"builtins":{"globals":{"blocks":[{"name":"CCGlobal","defines":[]}],"samplers":[]},"locals":{"blocks":[{"name":"CCLocal","defines":[]}],"samplers":[]}},"defines":[{"name":"USE_TEXTURE","type":"boolean","defines":[]},{"name":"CC_USE_MODEL","type":"boolean","defines":[]},{"name":"USE_ALPHA_TEST","type":"boolean","defines":[]},{"name":"CC_USE_ALPHA_ATLAS_texture","type":"boolean","defines":["USE_TEXTURE"]},{"name":"INPUT_IS_GAMMA","type":"boolean","defines":["USE_TEXTURE"]}],"blocks":[{"name":"ALPHA_TEST","members":[{"name":"alphaThreshold","type":13,"count":1}],"defines":["USE_ALPHA_TEST"],"binding":0}],"samplers":[{"name":"texture","type":29,"count":1,"defines":["USE_TEXTURE"],"binding":30}],"record":null,"name":"builtin-2d-sprite|vs|fs"}]}

View File

@@ -0,0 +1 @@
{"__type__":"cc.Material","_name":"builtin-2d-base","_effectAsset":{"__uuid__":"28dPjdQWxEQIG3VVl1Qm6T"},"_techniqueData":{}}

View File

@@ -0,0 +1 @@
{"__type__":"cc.Material","_name":"builtin-2d-sprite","_effectAsset":{"__uuid__":"28dPjdQWxEQIG3VVl1Qm6T"},"_techniqueData":{"0":{"defines":{"USE_TEXTURE":true}}}}

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1 @@
window.__require=function e(t,n,o){function c(r,u){if(!n[r]){if(!t[r]){var s=r.split("/");if(s=s[s.length-1],!t[s]){var a="function"==typeof __require&&__require;if(!u&&a)return a(s,!0);if(i)return i(s,!0);throw new Error("Cannot find module '"+r+"'")}r=s}var _=n[r]={exports:{}};t[r][0].call(_.exports,function(e){return c(t[r][1][e]||e)},_,_.exports,e,t,n,o)}return n[r].exports}for(var i="function"==typeof __require&&__require,r=0;r<o.length;r++)c(o[r]);return c}({emitNode:[function(e,t,n){"use strict";cc._RF.push(t,"280c3rsZJJKnZ9RqbALVwtK","emitNode"),cc.Class({extends:cc.Component,properties:{},onLoad:function(){this.node.on(cc.Node.EventType.TOUCH_END,function(e){e.stopPropagation(),window.eventBus&&window.eventBus.emit("WEB_MSG_TYPE.SELECT_NODE",e.currentTarget)},this)}}),cc._RF.pop()},{}],"use_v2.1-2.2.1_cc.Toggle_event":[function(e,t,n){"use strict";cc._RF.push(t,"7cbbeTVFKtH9KRAZoMTPnK7","use_v2.1-2.2.1_cc.Toggle_event"),cc.Toggle&&(cc.Toggle._triggerEventInScript_isChecked=!0),cc._RF.pop()},{}],web2gameSDk:[function(e,t,n){"use strict";cc._RF.push(t,"748bb2K29tIPLQmPiv9vhhz","web2gameSDk"),cc.web2cocosSDK={changeGameByPageIndex:function(e,t){},loadScene:function(e){return new Promise(function(t,n){cc.director.loadScene(e,function(o){o?n(o):t(e)})})},loadGame:function(e,t){},unloadGame:function(){},loadCustomImage:function(e,t){},updateResolution:function(e,t,n){var o=document.getElementById("GameDiv");cc.view.setDesignResolutionSize(e.width,e.height,cc.ResolutionPolicy.FIXED_WIDTH),o.style.width=e.width/t+"px",o.style.height=e.height/t+"px",cc.view.setCanvasSize(e.width/t,e.height/t),console.log(e),n&&n()},setNodeAttribute:function(e){var t=e.node,n=e.attribute,o=e.value;t?(t[n]=o,console.log("\u8bbe\u7f6e\u6210\u529f:"+n)):console.log("\u4e0d\u5b58\u5728\u8282\u70b9")},emitGameEvt:function(e,t){cc.find("Canvas/start").opacity=0,cc.tween(cc.find("Canvas/start")).to(.5,{opacity:255}).start()}},cc._RF.pop()},{}]},{},["emitNode","use_v2.1-2.2.1_cc.Toggle_event","web2gameSDk"]);

View File

@@ -0,0 +1 @@
window._CCSettings={platform:"web-mobile",groupList:["default"],collisionMatrix:[[true]],rawAssets:{assets:{},internal:{"1":["materials/builtin-unlit.mtl",1],"2":["effects/builtin-unlit.effect",0],"3":["effects/builtin-2d-gray-sprite.effect",0],"4":["materials/builtin-2d-gray-sprite.mtl",1],"5":["effects/builtin-3d-trail.effect",0],"6":["materials/builtin-3d-trail.mtl",1],"7":["effects/builtin-clear-stencil.effect",0],"8":["materials/builtin-clear-stencil.mtl",1],"9":["effects/builtin-2d-spine.effect",0],"10":["materials/builtin-2d-spine.mtl",1],"28dPjdQWxEQIG3VVl1Qm6T":["effects/builtin-2d-sprite.effect",0],"6fgBCSDDdPMInvyNlggls2":["materials/builtin-2d-base.mtl",1],"ecpdLyjvZBwrvm+cedCcQy":["materials/builtin-2d-sprite.mtl",1]}},assetTypes:["cc.EffectAsset","cc.Material"],launchScene:"db://assets/Scene/helloworld1.fire",scenes:[{url:"db://assets/Scene/helloworld1.fire",uuid:0},{url:"db://assets/Scene/helloworld2.fire",uuid:13}],packedAssets:{"05dd1dc0e":[0,11,12],"0695875db":["02delMVqdBD70a/HSD99FK","6aoKpq6+5BVaCIpoemqt7E","a8Anh32NZGRZegUtSgEj26"],"079499991":[1,2],"07ce7530a":[3,4],"0a5cba09d":[5,6],"0d669730c":[7,8],"0e4bc3b03":[9,10],"0f7bd1a33":[11,12,13]},md5AssetsMap:{},orientation:"",debug:false,subpackages:{},uuids:["2dL3kvpAxJu6GJ7RdqJG5J","2aKWBXJHxKHLvrBUi2yYZQ","6dkeWRTOBGXICfYQ7JUBnG","14TDKXr2NJ6LjvHPops74o","3ae7efMv1CLq2ilvUY/tQi","2afAA24LNP4YmYiaVLiivs","46bU+b5fROqIXVPG6aZWWK","c0BAyVxX9JzZy8EjFrc9DU","cffgu4qBxEqa150o1DmRAy","0ek66qC1NOQLjgYmi04HvX","7a/QZLET9IDreTiBfRn2PD","31vIlawANFZqnzLlSuHBfc","41D7kWhyFGY7q4NDlzkazn","f9pBfHJ2BEh5dSsr+dUtDN"]};

View File

@@ -0,0 +1,116 @@
body {
cursor: default;
padding: 0;
border: 0;
margin: 0;
text-align: center;
background-color: white;
font-family: Helvetica, Verdana, Arial, sans-serif;
}
body, canvas, div {
outline: 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 */
}
#Cocos2dGameContainer {
position: absolute;
margin: 0;
overflow: hidden;
left: 0px;
top: 0px;
}
canvas {
background-color: rgba(0, 0, 0, 0);
}
a:link, a:visited {
color: #000;
}
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: #171717 url(./splash.png) no-repeat center;
background-size: 350px;
}
.progress-bar {
background-color: #1a1a1a;
position: absolute;
left: 50%;
top: 80%;
height: 5px;
width: 300px;
margin: 0 -150px;
border-radius: 5px;
box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444;
}
.progress-bar span {
display: block;
height: 100%;
border-radius: 5px;
box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset;
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;}
}
h1 {
color: #444;
text-shadow: 3px 3px 15px;
}
#GameDiv {
width: 800px;
height: 450px;
margin: 0 auto;
background: black;
position: relative;
border: 3px solid black;
border-radius: 6px;
box-shadow: 0 5px 40px #333
}

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: #333;
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: #171717 url(./splash.png) no-repeat center;
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,94 @@
/* eslint-disable no-undef */
const GAME_INIT = cb => {
var settings = window._CCSettings
// window._CCSettings = undefined
if (!settings.debug) {
var uuids = settings.uuids
var rawAssets = settings.rawAssets
var assetTypes = settings.assetTypes
var realRawAssets = (settings.rawAssets = {})
for (var mount in rawAssets) {
var entries = rawAssets[mount]
var realEntries = (realRawAssets[mount] = {})
for (var id in entries) {
var entry = entries[id]
var type = entry[1]
// retrieve minified raw asset
if (typeof type === 'number') {
entry[1] = assetTypes[type]
}
// retrieve uuid
realEntries[uuids[id] || id] = entry
}
}
var scenes = settings.scenes
for (var i = 0; i < scenes.length; ++i) {
var scene = scenes[i]
if (typeof scene.uuid === 'number') {
scene.uuid = uuids[scene.uuid]
}
}
var packedAssets = settings.packedAssets
for (var packId in packedAssets) {
var packedIds = packedAssets[packId]
for (var j = 0; j < packedIds.length; ++j) {
if (typeof packedIds[j] === 'number') {
packedIds[j] = uuids[packedIds[j]]
}
}
}
var subpackages = settings.subpackages
for (var subId in subpackages) {
var uuidArray = subpackages[subId].uuids
if (uuidArray) {
for (var k = 0, l = uuidArray.length; k < l; k++) {
if (typeof uuidArray[k] === 'number') {
uuidArray[k] = uuids[uuidArray[k]]
}
}
}
}
}
var jsList = settings.jsList
if (jsList) {
jsList = jsList.map(function (x) {
return './static/cocos-build/web-mobile/src/' + x
})
}
var option = {
id: 'GameCanvas',
scenes: settings.scenes,
debugMode: settings.debug
? cc.debug.DebugMode.INFO
: cc.debug.DebugMode.ERROR,
showFPS: settings.debug,
frameRate: 60,
jsList: jsList,
groupList: settings.groupList,
collisionMatrix: settings.collisionMatrix
}
// init assets
cc.AssetLibrary.init({
libraryPath: './static/cocos-build/web-mobile/res/import',
rawAssetsBase: './static/cocos-build/web-mobile/res/raw-',
rawAssets: settings.rawAssets,
packedAssets: settings.packedAssets,
md5AssetsMap: settings.md5AssetsMap,
subpackages: settings.subpackages
})
cc.game.run(option, () => {
cb && cb()
})
}
export default GAME_INIT

View File

@@ -0,0 +1,7 @@
/* 改变主题色变量 */
$--color-primary: #f3d031;
/* 改变 icon 字体路径变量,必需 */
$--font-path: '~element-ui/lib/theme-chalk/fonts';
@import "~element-ui/packages/theme-chalk/src/index";

1418
vueTem/static/css/reset.css Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

BIN
vueTem/static/img/head.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@@ -0,0 +1,179 @@
/**
* 实现发布-订阅模式下的消息传输机制,支持命名空间与离线事件
* @param {string} [key] 事件的名称
* @param {function} [fn] 事件的回调
* @param {string} [last] 是否只执行最后一次绑定的消息 last ==“last”时只执行最后一次绑定的消息否则执行之前所有绑定的消息
*
* @example
* 1.常规
* eventBus.on('click',function(a){
* console.log(a) // 输出 :1
* })
* eventBus.emit('click',1)
*
* 2. 先发布后订阅
* eventBus.emit('click',1)
* eventBus.on('click',function(a){
* console.log(a) // 输出 :1
* })
*
* 3.使用命名空间
* eventBus.create('namespace1').on('click',function(a){
* console.log(a) // 输出 :1
* })
* eventBus.create('namespace1').emit('click',1)
*
* auth by guoqiang
* 注意:支持离线事件可能会带来一些副作用,比如意外的某个页面发布了某个消息,这时如果另一个订阅了这个消息,这个消息的回调会立即执行,而且大多请况下,回调的参数会出问题。在逻辑没理清之前不建议先发布再订阅
* 注意:支持离线事件可能会带来一些副作用,比如意外的某个页面发布了某个消息,这时如果另一个订阅了这个消息,这个消息的回调会立即执行,而且大多请况下,回调的参数会出问题。在逻辑没理清之前不建议先发布再订阅
* 注意:支持离线事件可能会带来一些副作用,比如意外的某个页面发布了某个消息,这时如果另一个订阅了这个消息,这个消息的回调会立即执行,而且大多请况下,回调的参数会出问题。在逻辑没理清之前不建议先发布再订阅
*/
(function(window, undefined) {
var _subscribe = null,
_publish = null,
_unsubscribe = null,
_shift = Array.prototype.shift, // 删除数组的第一个 元素,并返回这个元素
_unshift = Array.prototype.unshift, // 在数组的开头添加一个或者多个元素并返回数组新的length值
namespaceCache = {},
_create = null,
each = function(ary, fn) {
var ret = null;
for (var i = 0, len = ary.length; i < len; i++) {
var n = ary[i];
ret = fn.call(n, i, n);
}
return ret;
};
// 订阅消息名称为:'+key+'
_subscribe = function(key, fn, cache) {
if (!cache[key]) {
cache[key] = [];
}
cache[key].push(fn);
};
// 取消订阅(取消全部或者指定消息)
_unsubscribe = function(key, cache, fn) {
if (cache[key]) {
if (fn) {
for (var i = cache[key].length; i >= 0; i--) {
if (cache[key][i] === fn) {
cache[key].splice(i, 1);
}
}
} else {
cache[key] = [];
}
} else if (!key) {
for (var key in cache) {
delete cache[key];
}
} else {
console.log("不存在该消息的监听:" + key);
}
};
// 发布消息
_publish = function() {
var cache = _shift.call(arguments),
key = _shift.call(arguments),
args = arguments,
_self = this,
ret = null,
stack = cache[key];
if (!stack || !stack.length) {
return;
}
return each(stack, function() {
return this.apply(_self, args);
});
};
// 创建命名空间
_create = function(namespace) {
var namespace = namespace || "default";
var cache = {},
offlineStack = {}, // 离线事件,用于先发布后订阅,只执行一次
ret = {
on: function(key, fn, last) {
_subscribe(key, fn, cache);
if (!offlineStack[key]) {
offlineStack[key] = null;
return;
}
if (last === "last") {
// 指定执行离线队列的最后一个函数,执行完成之后删除
offlineStack[key].length && offlineStack[key].pop()(); // [].pop => 删除一个数组中的最后的一个元素,并且返回这个元素
} else {
each(offlineStack[key], function() {
this();
});
}
offlineStack[key] = null;
},
one: function(key, fn, last) {
_unsubscribe(key, cache);
this.on(key, fn, last);
},
off: function(key, fn) {
_unsubscribe(key, cache, fn);
},
emit: function() {
var fn = null,
args = null,
key = _shift.call(arguments),
_self = this;
_unshift.call(arguments, cache, key);
args = arguments;
fn = function() {
return _publish.apply(_self, args);
};
if (offlineStack && offlineStack[key] === undefined) {
offlineStack[key] = [];
return offlineStack[key].push(fn);
}
return fn();
}
};
return namespace
? namespaceCache[namespace]
? namespaceCache[namespace]
: (namespaceCache[namespace] = ret)
: ret;
};
window.eventBus = {
create: _create, // 创建命名空间
one: function(key, fn, last) {
// 订阅消息,只能单一对象订阅
var namespace = "default";
var pubsub = this.create(namespace);
pubsub.one(key, fn, last);
},
on: function(key, fn, last) {
// 订阅消息,可多对象同时订阅
var namespace = "default";
var pubsub = this.create(namespace);
pubsub.on(key, fn, last);
},
off: function(key, fn, namespace) {
// 取消订阅,(取消全部或指定消息)
namespace = "default";
var pubsub = this.create(namespace);
console.trace("");
pubsub.off(key, fn);
},
emit: function(key, fn) {
// 发布消息
var namespace = "default";
var pubsub = this.create(namespace);
pubsub.emit.apply(this, arguments);
}
};
})(window, undefined);

141
vueTem/static/js/common.js Normal file
View File

@@ -0,0 +1,141 @@
// import { rootPath } from '../../src/api/apiConfig'
import axios from 'axios'
import { Message, Notification } from 'element-ui'
/**
* post请求
* @DateTime 2018-4-10
* @param {[string]} url [地址]
* @param {[object]} data [数据]
* @param {{object}} options 这个参数供扩展使用,暂时没有加
*/
export const post = (url, data, options = { }) => {
if (!url) {
console.log(new Error('地址是必须的'))
return false
}
return axios(Object.assign({
method: 'POST',
url: url,
data: data
}, options)).then(res => {
return Promise.resolve(res)
}, res => {
return Promise.reject(res)
})
}
/**
* get请求
* @DateTime 2018-4-10
* @param {[string]} url [地址]
* @param {[object]} data [数据]
*/
export const get = (url, data) => {
if (!url) {
console.log(new Error('地址是必须的'))
return false
}
// const baseUrl = rootPath + url
return axios({
method: 'GET',
url: url,
data: data
}).then(res => {
return Promise.resolve(res)
}, res => {
return Promise.reject(res)
})
}
/**
* 中部的alert
* @DateTime 2018-4-10
* @param {[string]} msg [要提示的信息]
*/
export const msgbox = {
success (msg) {
Message({
message: msg,
type: 'success'
})
},
warning (msg) {
Message({
message: msg,
type: 'warning'
})
},
error (msg) {
Message({
message: msg,
type: 'error'
})
}
}
/**
* 右上角提示框
* @DateTime 2018-4-10
* @param {[string]} msg [要提示的信息]
*/
export const notice = {
success (msg) {
Notification({
title: '成功',
message: msg,
type: 'success'
})
},
warning (msg) {
Notification({
title: '警告',
message: msg,
type: 'warning'
})
},
error (msg) {
Notification({
title: '错误',
message: msg,
type: 'error'
// duration: 0
})
}
}
/**
* 时间戳转为格式化时间
* @DateTime 2018-4-10
* @param {[date]} timestamp [时间戳]
* @param {[string]} formats [时间格式]
*/
export const formatDate = (timestamp, formats) => {
/*
formats格式包括
1. Y-M-D
2. Y-M-D h:m:s
3. Y年M月D日
4. Y年M月D日 h时m分
5. Y年M月D日 h时m分s秒
示例console.log(formatDate(1500305226034, 'Y年M月D日 h:m:s')) ==> 2017年07月17日 23:27:06
*/
formats = formats || 'Y-M-D'
var myDate = timestamp ? new Date(timestamp) : new Date()
var year = myDate.getFullYear()
var month = formatDigit(myDate.getMonth() + 1)
var day = formatDigit(myDate.getDate())
var hour = formatDigit(myDate.getHours())
var minute = formatDigit(myDate.getMinutes())
var second = formatDigit(myDate.getSeconds())
return formats.replace(/Y|M|D|h|m|s/g, function (matches) {
return ({
Y: year,
M: month,
D: day,
h: hour,
m: minute,
s: second
})[matches]
})
// 小于10补0
function formatDigit (n) {
return n.toString().replace(/^(\d)$/, '0$1')
}
}