This commit is contained in:
Leo_com
2018-04-27 12:01:06 +08:00
parent 4301d79b27
commit cd5d75f9cf
28 changed files with 22969 additions and 12 deletions

67
PQCode/.gitignore vendored Normal file
View File

@@ -0,0 +1,67 @@
#/////////////////////////////////////////////////////////////////////////////
# Fireball Projects
#/////////////////////////////////////////////////////////////////////////////
library/
temp/
local/
build/
#/////////////////////////////////////////////////////////////////////////////
# Logs and databases
#/////////////////////////////////////////////////////////////////////////////
*.log
*.sql
*.sqlite
#/////////////////////////////////////////////////////////////////////////////
# files for debugger
#/////////////////////////////////////////////////////////////////////////////
*.sln
*.csproj
*.pidb
*.unityproj
*.suo
#/////////////////////////////////////////////////////////////////////////////
# OS generated files
#/////////////////////////////////////////////////////////////////////////////
.DS_Store
ehthumbs.db
Thumbs.db
#/////////////////////////////////////////////////////////////////////////////
# exvim files
#/////////////////////////////////////////////////////////////////////////////
*UnityVS.meta
*.err
*.err.meta
*.exvim
*.exvim.meta
*.vimentry
*.vimentry.meta
*.vimproject
*.vimproject.meta
.vimfiles.*/
.exvim.*/
quick_gen_project_*_autogen.bat
quick_gen_project_*_autogen.bat.meta
quick_gen_project_*_autogen.sh
quick_gen_project_*_autogen.sh.meta
.exvim.app
#/////////////////////////////////////////////////////////////////////////////
# webstorm files
#/////////////////////////////////////////////////////////////////////////////
.idea/
#//////////////////////////
# VS Code
#//////////////////////////
.vscode/

2
PQCode/README.md Normal file
View File

@@ -0,0 +1,2 @@
# 生成二维码Demo
如果喜欢上[简书](https://www.jianshu.com/u/33b882c6c780)关注我吧。我会不定时更新Cocos Creator教程与上传demo到github

6
PQCode/assets/Scene.meta Normal file
View File

@@ -0,0 +1,6 @@
{
"ver": "1.0.1",
"uuid": "29f52784-2fca-467b-92e7-8fd9ef8c57b7",
"isGroup": false,
"subMetas": {}
}

View File

@@ -0,0 +1,423 @@
[
{
"__type__": "cc.SceneAsset",
"_name": "",
"_objFlags": 0,
"_rawFiles": null,
"scene": {
"__id__": 1
}
},
{
"__type__": "cc.Scene",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_tag": -1,
"_active": true,
"_components": [],
"_prefab": null,
"_id": "2d2f792f-a40c-49bb-a189-ed176a246e49",
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_cascadeOpacityEnabled": true,
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_localZOrder": 0,
"_globalZOrder": 0,
"_opacityModifyRGB": false,
"groupIndex": 0,
"autoReleaseAssets": false
},
{
"__type__": "cc.Node",
"_name": "Canvas",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
},
{
"__id__": 5
},
{
"__id__": 7
}
],
"_tag": -1,
"_active": true,
"_components": [
{
"__id__": 11
}
],
"_prefab": null,
"_id": "a286bbGknJLZpRpxROV6M94",
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 252,
"g": 252,
"b": 252,
"a": 255
},
"_cascadeOpacityEnabled": true,
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_contentSize": {
"__type__": "cc.Size",
"width": 720,
"height": 1280
},
"_rotationX": 0,
"_rotationY": 0,
"_scaleX": 1,
"_scaleY": 1,
"_position": {
"__type__": "cc.Vec2",
"x": 360,
"y": 640
},
"_skewX": 0,
"_skewY": 0,
"_localZOrder": 0,
"_globalZOrder": 0,
"_opacityModifyRGB": false,
"groupIndex": 0
},
{
"__type__": "cc.Node",
"_name": "bg",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_tag": -1,
"_active": true,
"_components": [
{
"__id__": 4
}
],
"_prefab": null,
"_id": "ca18bU4ykNBKYDgIknP0Vxh",
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 36,
"g": 36,
"b": 36,
"a": 255
},
"_cascadeOpacityEnabled": true,
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_contentSize": {
"__type__": "cc.Size",
"width": 720,
"height": 1280
},
"_rotationX": 0,
"_rotationY": 0,
"_scaleX": 1,
"_scaleY": 1,
"_position": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_skewX": 0,
"_skewY": 0,
"_localZOrder": 0,
"_globalZOrder": 0,
"_opacityModifyRGB": false,
"groupIndex": 0
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
},
"_enabled": true,
"_spriteFrame": {
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_atlas": null
},
{
"__type__": "cc.Node",
"_name": "title",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_tag": -1,
"_active": true,
"_components": [
{
"__id__": 6
}
],
"_prefab": null,
"_id": "746EHuqRxBtK2W5SrSXGYG",
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_cascadeOpacityEnabled": true,
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_contentSize": {
"__type__": "cc.Size",
"width": 120,
"height": 40
},
"_rotationX": 0,
"_rotationY": 0,
"_scaleX": 1,
"_scaleY": 1,
"_position": {
"__type__": "cc.Vec2",
"x": 0,
"y": 299
},
"_skewX": 0,
"_skewY": 0,
"_localZOrder": 0,
"_globalZOrder": 0,
"_opacityModifyRGB": false,
"groupIndex": 0
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"_useOriginalSize": false,
"_actualFontSize": 40,
"_fontSize": 40,
"_lineHeight": 40,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_N$string": "扫一扫",
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0
},
{
"__type__": "cc.Node",
"_name": "qrImage",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 8
}
],
"_tag": -1,
"_active": true,
"_components": [
{
"__id__": 10
}
],
"_prefab": null,
"_id": "edXcLS4LZC/KjeWe858q6s",
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_cascadeOpacityEnabled": true,
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_contentSize": {
"__type__": "cc.Size",
"width": 256,
"height": 256
},
"_rotationX": 0,
"_rotationY": 0,
"_scaleX": 1,
"_scaleY": 1,
"_position": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_skewX": 0,
"_skewY": 0,
"_localZOrder": 0,
"_globalZOrder": 0,
"_opacityModifyRGB": false,
"groupIndex": 0
},
{
"__type__": "cc.Node",
"_name": "qrcode",
"_objFlags": 0,
"_parent": {
"__id__": 7
},
"_children": [],
"_tag": -1,
"_active": true,
"_components": [
{
"__id__": 9
}
],
"_prefab": null,
"_id": "7a33f1MWZlBtLqeuWNRile/",
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_cascadeOpacityEnabled": true,
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_contentSize": {
"__type__": "cc.Size",
"width": 256,
"height": 256
},
"_rotationX": 0,
"_rotationY": 0,
"_scaleX": 1,
"_scaleY": 1,
"_position": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_skewX": 0,
"_skewY": 0,
"_localZOrder": 0,
"_globalZOrder": 0,
"_opacityModifyRGB": false,
"groupIndex": 0
},
{
"__type__": "1f7a3rHCP9Eqrc9ASto5kmk",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 8
},
"_enabled": true
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 7
},
"_enabled": true,
"_spriteFrame": {
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_atlas": null
},
{
"__type__": "cc.Canvas",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_designResolution": {
"__type__": "cc.Size",
"width": 720,
"height": 1280
},
"_fitWidth": false,
"_fitHeight": true
}
]

View File

@@ -0,0 +1,7 @@
{
"ver": "1.0.0",
"uuid": "2d2f792f-a40c-49bb-a189-ed176a246e49",
"asyncLoadAssets": false,
"autoReleaseAssets": false,
"subMetas": {}
}

View File

@@ -0,0 +1,6 @@
{
"ver": "1.0.1",
"uuid": "4734c20c-0db8-4eb2-92ea-e692f4d70934",
"isGroup": false,
"subMetas": {}
}

View File

@@ -0,0 +1,6 @@
{
"ver": "1.0.1",
"uuid": "4865e11a-13e3-4831-b0d5-a17970fcc41a",
"isGroup": false,
"subMetas": {}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "53447054-ffc4-49ea-a72e-0d0659865944",
"isPlugin": true,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,44 @@
cc.Class({
extends: cc.Component,
properties: {
},
// use this for initialization
onLoad() {
this.init('http://forum.cocos.com/t/topic/44304/9');
},
init(url){
var ctx = this.node.addComponent(cc.Graphics);
if (typeof (url) !== 'string') {
console.log('url is not string',url);
return;
}
this.QRCreate(ctx, url);
},
QRCreate(ctx, url) {
var qrcode = new QRCode(-1, QRErrorCorrectLevel.H);
qrcode.addData(url);
qrcode.make();
ctx.fillColor = cc.Color.BLACK;
//块宽高
var tileW = this.node.width / qrcode.getModuleCount();
var tileH = this.node.height / qrcode.getModuleCount();
// draw in the Graphics
for (var row = 0; row < qrcode.getModuleCount(); row++) {
for (var col = 0; col < qrcode.getModuleCount(); col++) {
if (qrcode.isDark(row, col)) {
// ctx.fillColor = cc.Color.BLACK;
var w = (Math.ceil((col + 1) * tileW) - Math.floor(col * tileW));
var h = (Math.ceil((row + 1) * tileW) - Math.floor(row * tileW));
ctx.rect(Math.round(col * tileW), Math.round(row * tileH), w, h);
ctx.fill();
}
}
}
},
});

View File

@@ -0,0 +1,9 @@
{
"ver": "1.0.5",
"uuid": "1f7a3ac7-08ff-44aa-b73d-012b68e649a4",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}

View File

@@ -0,0 +1,6 @@
{
"ver": "1.0.1",
"uuid": "7b81d4e8-ec84-4716-968d-500ac1d78a54",
"isGroup": false,
"subMetas": {}
}

20520
PQCode/creator.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

15
PQCode/jsconfig.json Normal file
View File

@@ -0,0 +1,15 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"experimentalDecorators": true
},
"exclude": [
"node_modules",
".vscode",
"library",
"local",
"settings",
"temp"
]
}

4
PQCode/project.json Normal file
View File

@@ -0,0 +1,4 @@
{
"engine": "cocos2d-html5",
"packages": "packages"
}

View File

@@ -0,0 +1,33 @@
{
"appKey": "",
"appSecret": "",
"encryptJs": true,
"excludeScenes": [],
"includeAnySDK": false,
"includeSDKBox": false,
"inlineSpriteFrames": true,
"inlineSpriteFrames_native": true,
"jailbreakPlatform": false,
"md5Cache": true,
"mergeStartScene": false,
"oauthLoginServer": "",
"optimizeHotUpdate": false,
"orientation": {
"landscapeLeft": true,
"landscapeRight": true,
"portrait": false,
"upsideDown": false
},
"packageName": "org.cocos2d.helloworld",
"privateKey": "",
"renderMode": "0",
"startScene": "2d2f792f-a40c-49bb-a189-ed176a246e49",
"title": "hello_world",
"webOrientation": "auto",
"wechatgame": {
"appid": "wx6ac3f5090a6b99c5",
"orientation": "landscape"
},
"xxteaKey": "5aaeee52-1608-4f",
"zipCompressJs": true
}

View File

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

View File

@@ -0,0 +1,28 @@
{
"collision-matrix": [
[
true
]
],
"excluded-modules": [],
"group-list": [
"default"
],
"start-scene": "current",
"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
},
"cocos-analytics": {
"enable": false,
"appID": "13798",
"appSecret": "959b3ac0037d0f3c2fdce94f8421a9b2"
}
}

BIN
PQCode/template-banner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

5
PQCode/template.json Normal file
View File

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

Binary file not shown.

View File

@@ -0,0 +1,58 @@
<!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="landscape"/>
<meta name="x5-orientation" content="landscape">
<!--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"/>
</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 class="footer">
<p>此项目源码引用于Cocos Creator Demo项目</p>
<p>Power By Cocos Creator</p>
</div>
</div>
<script src="src/settings.js" charset="utf-8"></script>
<script src="main.js" charset="utf-8"></script>
</body>
</html>

View File

@@ -0,0 +1,234 @@
(function () {
'use strict';
function boot () {
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]];
}
}
}
}
// init engine
var canvas;
if (cc.sys.isBrowser) {
canvas = document.getElementById('GameCanvas');
}
function setLoadingDisplay () {
// Loading splash scene
var splash = document.getElementById('splash');
var progressBar = splash.querySelector('.progress-bar span');
cc.loader.onProgress = function (completedCount, totalCount, item) {
if (totalCount === 1) {
return;
}
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 () {
document.body.removeChild(splash);
});
}
var onStart = function () {
cc.view.resizeWithBrowserSize(true);
if (!false) {
// UC browser on many android devices have performance issue with retina display
if (cc.sys.os !== cc.sys.OS_ANDROID || cc.sys.browserType !== cc.sys.BROWSER_TYPE_UC) {
cc.view.enableRetina(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);
}
// qq, wechat, baidu
cc.view.enableAutoFullScreen(
cc.sys.browserType !== cc.sys.BROWSER_TYPE_BAIDU &&
cc.sys.browserType !== cc.sys.BROWSER_TYPE_WECHAT &&
cc.sys.browserType !== cc.sys.BROWSER_TYPE_MOBILE_QQ
);
}
// Limit downloading max concurrent task to 2,
// more tasks simultaneously may cause performance draw back on some android system / brwosers.
// 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;
}
}
// init assets
cc.AssetLibrary.init({
libraryPath: 'res/import',
rawAssetsBase: 'res/raw-',
rawAssets: settings.rawAssets,
packedAssets: settings.packedAssets,
md5AssetsMap: settings.md5AssetsMap
});
var launchScene = settings.launchScene;
// load scene
cc.director.loadScene(launchScene, null,
function () {
if (cc.sys.isBrowser) {
// show canvas
canvas.style.visibility = '';
var div = document.getElementById('GameDiv');
if (div) {
div.style.backgroundImage = '';
}
}
cc.loader.onProgress = null;
console.log('Success to load scene: ' + 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];
}
// anysdk scripts
if (cc.sys.isNative && cc.sys.isMobile) {
jsList = jsList.concat(['src/anysdk/jsb_anysdk.js', 'src/anysdk/jsb_anysdk_constants.js']);
}
var option = {
//width: width,
//height: height,
id: 'GameCanvas',
scenes: settings.scenes,
debugMode: settings.debug ? cc.DebugMode.INFO : cc.DebugMode.ERROR,
showFPS: !false && settings.debug,
frameRate: 60,
jsList: jsList,
groupList: settings.groupList,
collisionMatrix: settings.collisionMatrix,
renderMode: 0
};
cc.game.run(option, onStart);
}
if (window.jsb) {
require('src/settings.js');
require('src/jsb_polyfill.js');
boot();
}
else if (false) {
require(window._CCSettings.debug ? 'cocos2d-js.js' : 'cocos2d-js-min.js');
var prevPipe = cc.loader.md5Pipe || cc.loader.assetLoader;
cc.loader.insertPipeAfter(prevPipe, wxDownloader);
boot();
}
else if (window.document) {
var splash = document.getElementById('splash');
splash.style.display = 'block';
var cocos2d = document.createElement('script');
cocos2d.async = true;
cocos2d.src = window._CCSettings.debug ? 'cocos2d-js.js' : 'cocos2d-js-min.js';
var engineLoaded = function () {
document.body.removeChild(cocos2d);
cocos2d.removeEventListener('load', engineLoaded, false);
window.eruda && eruda.init() && eruda.get('console').config.set('displayUnenumerable', false);
boot();
};
cocos2d.addEventListener('load', engineLoaded, false);
document.body.appendChild(cocos2d);
}
})();
var str2 = "<span id='tipTxt'class='tip-txt'></span>";
var splash = document.getElementById("splash");
var div2 = document.createElement("div");
div2.innerHTML = str2;
splash.appendChild(div2);
var txtArr = [
"正在加载中",
"马上就好了",
"快到碗里来",
];
var tipTxt = document.getElementById("tipTxt");
tipTxt.addEventListener("webkitAnimationIteration", changeTxt);
tipTxt.addEventListener("animationiteration", changeTxt);
var tempTxt = txtArr.slice();
function changeTxt () {
var i = ~~(Math.random() * tempTxt.length);
while (tempTxt[i] === tipTxt.innerText) {
i = ~~(Math.random() * tempTxt.length);
}
tipTxt.innerText = tempTxt[i];
tempTxt.splice(i, 1);
if (0 === tempTxt.length) {
tempTxt = txtArr.slice();
}
}
changeTxt();

View File

@@ -0,0 +1,177 @@
body {
cursor: default;
color: #888;
background-color: #333;
display: -webkit-flex;
display: flex;
-webkit-flex-direction: column;
flex-direction: column;
height: 100%; /* for firefox */
width: 100%;
position: absolute;
padding: 0px;
border: 0px;
margin: 0px;
}
/* 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, 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);
}
canvas {
background-color: rgba(0, 0, 0, 0);
}
#splash {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: #ffda00 url(./splash.png) no-repeat center 35%;
background-size: 65%;
}
.content {
display: -webkit-flex;
display: flex;
-webkit-justify-content: center;
justify-content: center;
-webkit-align-items: center;
align-items: center;
-webkit-flex-direction: column;
flex-direction: column;
-webkit-flex: auto;
flex: auto;
}
.contentWrap {
width: 100%;
overflow: auto;
display: -webkit-flex;
display: flex;
-webkit-align-items: center;
align-items: center;
-webkit-flex-direction: column;
flex-direction: column;
}
#GameDiv {
visibility: hidden;
}
.wrapper {
position: relative;
border: 1px solid #444;
background: #222;
}
@media screen and (max-width: 760px) {
.wrapper {
border: 0px;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
}
}
@keyframes animate-stripes {
0% {background-position: 0 0;} 100% {background-position: 60px 0;}
}
.progress-bar span {
display: block;
height: 100%;
border-radius: 3px;
box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset;
transition: width .4s ease-in-out;
background-color: #34c2e3;
}
.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;}
}
.progress-bar {
position: absolute;
overflow: hidden;
left: 22%;
top: 45%;
height: 7px;
padding: 5px;
width: 54%;
background-color: transparent;
-webkit-border-radius: 8px;
border-radius: 8px;
border: 2px solid #fff;
-webkit-box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444;
box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444;
}
/* 文字fade的动画 */
@keyframes fade {
10% { opacity: 0; }
15% { opacity: 1; }
95% { opacity: 1; }
100% { opacity: 0; }
}
.tip-txt {
width: 100%;
top: 50%;
font-size: 13px;
opacity: 0;
display: block;
position: absolute;
text-align: center;
color: #333;
-webkit-animation: fade 4s linear infinite;
animation: fade 4s linear infinite;
}
.footer {
position: absolute;
bottom: 12px;
width: 100%;
}
.footer p {
margin: 0;
font-size: 12px;
text-align: center;
}

View File

@@ -23,7 +23,7 @@
"renderMode": "0",
"startScene": "2d2f792f-a40c-49bb-a189-ed176a246e49",
"title": "hello_world",
"webOrientation": "auto",
"webOrientation": "landscape",
"wechatgame": {
"appid": "wx6ac3f5090a6b99c5",
"orientation": "landscape"

View File

@@ -866,18 +866,17 @@
"_fitHeight": false
},
{
"__type__": "4896an2Du9KerKmdF65r/u1",
"__type__": "280c3rsZJJKnZ9RqbALVwtK",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"headSprite": {
"__id__": 7
},
"tipLabel": {
"_a": 1,
"label": {
"__id__": 9
}
},
"text": "Hello, World!"
}
]

View File

@@ -1,7 +1,39 @@
// obj.fn();
function func(){
// console.log( this ); // 20 this -> window
// var c=1;
// var b=function(){
// var b=1;
// console.log(this);
// return 1;
// }
// var c=new b();
// console.log(c);
// var d=b();
// console.log(d);
// var f=b;
// console.log(f);
var obj = {
a: 20,
fn: function() {
console.log( this ); // 20 this -> window
}
}
obj.fn();
}
func();
cc.Class({
extends: cc.Component,
properties: {
_a:1,
// _c:this._b+2,
label: {
default: null,
type: cc.Label
@@ -14,6 +46,28 @@ cc.Class({
// use this for initialization
onLoad: function () {
this.label.string = this.text;
var c=2;
var obj = {
a: 20,
c:this,
b: this._a + 10,
fn: function() {
console.log( this );
console.log(c,this.c);
}
}
func();
setTimeout(()=> {
var a = 30;
console.log( this );
})
setTimeout(function() {
var a = 30;
console.log( this );
})
obj.fn();
},
@@ -23,3 +77,4 @@ cc.Class({
},
});

View File

@@ -1,16 +1,16 @@
{
"appKey": "",
"appSecret": "",
"appKey": "EC26512D-0C24-60EB-D924-2A8294F8A877",
"appSecret": "e6713b629221488ae1a4839daba93b9d",
"encryptJs": true,
"excludeScenes": [],
"includeAnySDK": false,
"includeAnySDK": true,
"includeSDKBox": false,
"inlineSpriteFrames": true,
"inlineSpriteFrames_native": true,
"jailbreakPlatform": false,
"md5Cache": true,
"mergeStartScene": false,
"oauthLoginServer": "",
"oauthLoginServer": "http://oauth.anysdk.com/api/User/LoginOauth/ ",
"optimizeHotUpdate": false,
"orientation": {
"landscapeLeft": true,
@@ -19,7 +19,7 @@
"upsideDown": false
},
"packageName": "org.cocos2d.helloworld",
"privateKey": "",
"privateKey": "B960ACE38FFA6501C038354406512CE7",
"renderMode": "0",
"startScene": "2d2f792f-a40c-49bb-a189-ed176a246e49",
"title": "wechatGame_login",