mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-19 14:52:40 +08:00
@@ -0,0 +1,34 @@
|
||||
require('./web-adapter');
|
||||
|
||||
<% if(polyfillsBundleFile) { %>
|
||||
// Polyfills bundle.
|
||||
require("<%= polyfillsBundleFile %>");
|
||||
<% } %>
|
||||
|
||||
// SystemJS support.
|
||||
window.self = window;
|
||||
require("<%= systemJsBundleFile %>");
|
||||
|
||||
const importMap = require("<%= importMapFile%>").default;
|
||||
System.warmup({
|
||||
importMap,
|
||||
importMapUrl: '<%= importMapFile%>',
|
||||
defaultHandler: (urlNoSchema) => {
|
||||
require('.' + urlNoSchema);
|
||||
},
|
||||
});
|
||||
|
||||
System.import('<%= applicationJs %>').then(({ Application }) => {
|
||||
return new Application();
|
||||
}).then((application) => {
|
||||
return onApplicationCreated(application);
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
function onApplicationCreated(application) {
|
||||
return System.import('cc').then((cc) => {
|
||||
require('./engine-adapter');
|
||||
return application.init(cc);
|
||||
}).then(() => application.start());
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"screenOrientation": "landscape",
|
||||
"networkTimeout": {
|
||||
"request": 5000,
|
||||
"connectSocket": 5000,
|
||||
"download": 500000,
|
||||
"upload": 5000
|
||||
},
|
||||
"showStatusBar": false
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
globalThis.__baiduRequire = require; // FIX: require implementation in browserify conflicts with baidu webpack
|
||||
require('./web-adapter');
|
||||
|
||||
<% if(polyfillsBundleFile) { %>
|
||||
// Polyfills bundle.
|
||||
require("<%= polyfillsBundleFile %>");
|
||||
<% } %>
|
||||
|
||||
// SystemJS support.
|
||||
require("<%= systemJsBundleFile %>");
|
||||
// 这句只有百度需要,因为百度的 webpack 提供了假的 System
|
||||
const System = globalThis.System;
|
||||
|
||||
// Adapt for IOS, swap if opposite
|
||||
if (canvas) {
|
||||
var _w = canvas.width;
|
||||
var _h = canvas.height;
|
||||
if (screen.width < screen.height) {
|
||||
if (canvas.width > canvas.height) {
|
||||
_w = canvas.height;
|
||||
_h = canvas.width;
|
||||
}
|
||||
} else {
|
||||
if (canvas.width < canvas.height) {
|
||||
_w = canvas.height;
|
||||
_h = canvas.width;
|
||||
}
|
||||
}
|
||||
canvas.width = _w;
|
||||
canvas.height = _h;
|
||||
}
|
||||
|
||||
// Adjust initial canvas size
|
||||
if (canvas && window.devicePixelRatio >= 2) {canvas.width *= 2; canvas.height *= 2;}
|
||||
|
||||
const importMap = require("<%= importMapFile%>").default;
|
||||
System.warmup({
|
||||
importMap,
|
||||
importMapUrl: '<%= importMapFile%>',
|
||||
defaultHandler: (urlNoSchema) => {
|
||||
require('.' + urlNoSchema);
|
||||
},
|
||||
});
|
||||
|
||||
System.import('<%= applicationJs %>').then(({ Application }) => {
|
||||
return new Application();
|
||||
}).then((application) => {
|
||||
return onApplicationCreated(application);
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
function onApplicationCreated(application) {
|
||||
return System.import('cc').then((cc) => {
|
||||
require('./engine-adapter');
|
||||
|
||||
// post system info to open data context
|
||||
swan.getOpenDataContext().postMessage({
|
||||
type: 'engine',
|
||||
event: 'systemInfo',
|
||||
systemInfo: swan.getSystemInfoSync(),
|
||||
});
|
||||
|
||||
return application.init(cc);
|
||||
}).then(() => application.start());
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"deviceOrientation": "landscape",
|
||||
"openDataContext": "",
|
||||
"networkTimeout":
|
||||
{
|
||||
"request": 5000,
|
||||
"connectSocket": 5000,
|
||||
"uploadFile": 5000,
|
||||
"downloadFile": 500000
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"appid": "",
|
||||
"compileType": "game",
|
||||
"libVersion": "1.0.0",
|
||||
"bundle":
|
||||
{
|
||||
"exclude": ["node_moudules"],
|
||||
"entry": "game.js",
|
||||
"compilers": [
|
||||
{
|
||||
"type": "babel"
|
||||
}]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
<% if (isUsePhysX) { %>
|
||||
const systemInfo = tt.getSystemInfoSync();
|
||||
// a hack way to load physics provide by bytedance
|
||||
if (tt.getPhysx) {
|
||||
tt.getPhysx({
|
||||
success (physx) {
|
||||
if (!physx) {
|
||||
console.error('can not use native PhysX');
|
||||
} else {
|
||||
console.info('physics plugin load success, version=' + physx.getVersion());
|
||||
GameGlobal.nativePhysX = physx;
|
||||
}
|
||||
loadCC();
|
||||
},
|
||||
fail () {
|
||||
loadCC();
|
||||
}
|
||||
});
|
||||
} else if (systemInfo.platform === 'android' && tt.getLoader && tt.getLoader()) {
|
||||
const appid = "<%= appid %>";
|
||||
const loader = tt.getLoader().loader;
|
||||
loader.load('physics', appid, "token", message => {
|
||||
if (message) {
|
||||
console.error('[tt.loader]:' + message);
|
||||
} else {
|
||||
console.info('[tt.loader]: physics plugin load success, version=' + tt.getPhy().getVersion());
|
||||
GameGlobal.nativePhysX = tt.getPhy();
|
||||
}
|
||||
loadCC();
|
||||
})
|
||||
} else {
|
||||
loadCC();
|
||||
}
|
||||
<% } %>
|
||||
|
||||
<% if (!isUsePhysX) { %>
|
||||
loadCC();
|
||||
<% } %>
|
||||
|
||||
function loadCC() {
|
||||
require('./web-adapter');
|
||||
|
||||
<% if(polyfillsBundleFile) { %>
|
||||
// Polyfills bundle.
|
||||
require("<%= polyfillsBundleFile %>");
|
||||
<% } %>
|
||||
|
||||
// SystemJS support.
|
||||
require("<%= systemJsBundleFile %>");
|
||||
|
||||
// Adapt for IOS, swap if opposite
|
||||
if (canvas){
|
||||
var _w = canvas.width;
|
||||
var _h = canvas.height;
|
||||
if (screen.width < screen.height) {
|
||||
if (canvas.width > canvas.height) {
|
||||
_w = canvas.height;
|
||||
_h = canvas.width;
|
||||
}
|
||||
} else {
|
||||
if (canvas.width < canvas.height) {
|
||||
_w = canvas.height;
|
||||
_h = canvas.width;
|
||||
}
|
||||
}
|
||||
canvas.width = _w;
|
||||
canvas.height = _h;
|
||||
}
|
||||
|
||||
// Adjust initial canvas size
|
||||
if (canvas && window.devicePixelRatio >= 2) {canvas.width *= 2; canvas.height *= 2;}
|
||||
|
||||
const importMap = require("<%= importMapFile%>").default;
|
||||
System.warmup({
|
||||
importMap,
|
||||
importMapUrl: '<%= importMapFile%>',
|
||||
defaultHandler: (urlNoSchema) => {
|
||||
require('.' + urlNoSchema);
|
||||
},
|
||||
handlers: {
|
||||
'plugin:': (urlNoSchema) => {
|
||||
typeof requirePlugin === 'function' ? requirePlugin(urlNoSchema) : require(urlNoSchema);
|
||||
},
|
||||
'project:': (urlNoSchema) => {
|
||||
require(urlNoSchema);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
System.import('<%= applicationJs %>').then(({ Application }) => {
|
||||
return new Application();
|
||||
}).then((application) => {
|
||||
return onApplicationCreated(application);
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
function onApplicationCreated(application) {
|
||||
return System.import('cc').then((cc) => {
|
||||
require('./engine-adapter');
|
||||
return application.init(cc);
|
||||
}).then(() => { return application.start(); });
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"deviceOrientation": "portrait",
|
||||
"showStatusBar": false,
|
||||
"openDataContext": "",
|
||||
"networkTimeout": {
|
||||
"request": 5000,
|
||||
"connectSocket": 5000,
|
||||
"uploadFile": 5000,
|
||||
"downloadFile": 500000
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"setting": {
|
||||
"urlCheck": true,
|
||||
"es6": false,
|
||||
"postcss": true,
|
||||
"minified": true,
|
||||
"newFeature": true
|
||||
},
|
||||
"appid": "testappId",
|
||||
"projectname": ""
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"instant_games": {
|
||||
"orientation": "PORTRAIT",
|
||||
"override_web_orientation": "PORTRAIT",
|
||||
"platform_version": "RICH_GAMEPLAY",
|
||||
"navigation_menu_version": "NAV_FLOATING"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<% if (webDebuggerSrc) { %>
|
||||
<script src="<%=webDebuggerSrc%>"></script>
|
||||
<script type="text/javascript">
|
||||
// open web debugger console
|
||||
window.VConsole && (window.vConsole = new VConsole());
|
||||
</script>
|
||||
<% } %>
|
||||
|
||||
<!-- Import fbinstant -->
|
||||
<!-- <script src="https://connect.facebook.net/en_US/fbinstant.6.3.js"></script> -->
|
||||
<script src="https://www.facebook.com/assets.php/en_US/fbinstant.latest.js"></script>
|
||||
|
||||
<!-- Polyfills bundle. -->
|
||||
<script src="<%= polyfillsBundleFile %>" charset="utf-8"> </script>
|
||||
|
||||
<!-- SystemJS support. -->
|
||||
<script src="<%= systemJsBundleFile %>" charset="utf-8"> </script>
|
||||
|
||||
<!-- Import map -->
|
||||
<script src="<%= importMapFile%>" type="systemjs-importmap" charset="utf-8"> </script>
|
||||
|
||||
<script>
|
||||
System.import('./<%= indexJsName %>').catch(function(err) { console.error(err); })
|
||||
</script>
|
||||
@@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Cocos Creator | <%= projectName %></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,minimal-ui=true"/>
|
||||
|
||||
<!--https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html-->
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="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"/>
|
||||
|
||||
<!--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="<%= cssUrl %>"/>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="GameDiv" cc_exact_fit_screen="true">
|
||||
<div id="Cocos3dGameContainer">
|
||||
<canvas id="GameCanvas" oncontextmenu="event.preventDefault()" tabindex="99"></canvas>
|
||||
</div>
|
||||
</div>
|
||||
<%- include(cocosTemplate, {}) %>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,29 @@
|
||||
import { Application } from '<%= applicationJS %>';
|
||||
|
||||
const canvas = document.getElementById('GameCanvas');
|
||||
const $p = canvas.parentElement;
|
||||
const bcr = $p.getBoundingClientRect();
|
||||
canvas.width = bcr.width;
|
||||
canvas.height = bcr.height;
|
||||
|
||||
function topLevelImport (url) {
|
||||
return System.import(url);
|
||||
}
|
||||
|
||||
const application = new Application();
|
||||
|
||||
FBInstant.initializeAsync().then(function () {
|
||||
FBInstant.setLoadingProgress(10);
|
||||
return topLevelImport('cc');
|
||||
}).then(function (engine) {
|
||||
FBInstant.setLoadingProgress(50);
|
||||
return application.init(engine);
|
||||
}).then(function () {
|
||||
FBInstant.setLoadingProgress(99);
|
||||
return application.start();
|
||||
}).then(function () {
|
||||
FBInstant.setLoadingProgress(100);
|
||||
return FBInstant.startGameAsync();
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
@@ -0,0 +1,61 @@
|
||||
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;
|
||||
}
|
||||
|
||||
canvas {
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
#GameDiv, #Cocos3dGameContainer, #GameCanvas {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
:root {
|
||||
--safe-top: env(safe-area-inset-top);
|
||||
--safe-right: env(safe-area-inset-right);
|
||||
--safe-bottom: env(safe-area-inset-bottom);
|
||||
--safe-left: env(safe-area-inset-left);
|
||||
}
|
||||
+10
File diff suppressed because one or more lines are too long
@@ -0,0 +1,5 @@
|
||||
page {
|
||||
background: #f7f7f7;
|
||||
display: flex;
|
||||
flex: 1;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
$global._onShowCB = null;
|
||||
$global._onHideCB = null;
|
||||
|
||||
// HACK: on some devices my.createCanvas is undefined
|
||||
if (!my.createCanvas) {
|
||||
my.createCanvas = my._createCanvas;
|
||||
}
|
||||
if (!my.createOffscreenCanvas) {
|
||||
my.createOffscreenCanvas = my._createOffscreenCanvas;
|
||||
}
|
||||
|
||||
App({
|
||||
onLaunch: function onLaunch(options) {
|
||||
console.info('App onLaunched');
|
||||
|
||||
$global.__onCanvasCreated = function () {
|
||||
<% if(polyfillsBundleFile) { %>
|
||||
// Polyfills bundle.
|
||||
require('./<%= polyfillsBundleFile %>');
|
||||
<% } %>
|
||||
require('./<%= systemJsBundleFile %>');
|
||||
require('./load-module.js');
|
||||
const importMap = require('./<%= importMapFile %>').default;
|
||||
let System = $global.System;
|
||||
System.warmup({
|
||||
importMap,
|
||||
importMapUrl: 'src/import-map.js',
|
||||
});
|
||||
System.import('./web-adapter.js')
|
||||
.then(() => {
|
||||
return System.import('cc');
|
||||
})
|
||||
.then((cc) => {
|
||||
return System.import('./engine-adapter.js')
|
||||
.then(() => {
|
||||
require('./load-module-plugin.js');
|
||||
return System.import('<%= applicationJs %>')
|
||||
.then(({ Application }) => {
|
||||
const application = new Application();
|
||||
application.init(cc);
|
||||
return application.start();
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
};
|
||||
},
|
||||
onShow: function onShow(options) {
|
||||
$global._onShowCB && $global._onShowCB();
|
||||
},
|
||||
onHide: function onHide(options) {
|
||||
$global._onHideCB && $global._onHideCB();
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"deviceOrientation": "portrait",
|
||||
"pages": [
|
||||
"pages/index/index"
|
||||
],
|
||||
"window": {
|
||||
"defaultTitle": "CocosCreator",
|
||||
"allowsBounceVertical":"NO",
|
||||
"enableMultiAudio":true,
|
||||
"enableAudioAlign":true,
|
||||
"enableSkia":true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"include": [
|
||||
"**/assets/**/*",
|
||||
"**/remote/**/*",
|
||||
"**/src/**/*"
|
||||
],
|
||||
"enableAppxNg": true,
|
||||
"component2": true
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<view class="canvas-element" style="flex-direction:row;display:flex;flex:1;background-color:rgba(0,0,0,1);">
|
||||
<canvas
|
||||
id="GameCanvas"
|
||||
type="webgl"
|
||||
onReady="canvasOnReady"
|
||||
style="width:100%;height:100%;"
|
||||
onTouchStart="onTouchStart"
|
||||
onTouchCancel="onTouchCancel"
|
||||
onTouchEnd="onTouchEnd"
|
||||
onTouchMove="onTouchMove"
|
||||
></canvas>
|
||||
</view>
|
||||
@@ -0,0 +1,47 @@
|
||||
$global._touchstartCB = null;
|
||||
$global._touchcancelCB = null;
|
||||
$global._touchendCB = null;
|
||||
$global._touchmoveCB = null;
|
||||
|
||||
// HACK: on some devices my.createCanvas is undefined
|
||||
if (!my.createCanvas) {
|
||||
my.createCanvas = my._createCanvas;
|
||||
}
|
||||
if (!my.createOffscreenCanvas) {
|
||||
my.createOffscreenCanvas = my._createOffscreenCanvas;
|
||||
}
|
||||
|
||||
Page({
|
||||
onReady () { },
|
||||
onError (err) {
|
||||
console.error('error in page: ', err);
|
||||
},
|
||||
onTouchStart (event) {
|
||||
$global._touchstartCB && $global._touchstartCB(event);
|
||||
},
|
||||
onTouchCancel (event) {
|
||||
$global._touchcancelCB && $global._touchcancelCB(event);
|
||||
},
|
||||
onTouchEnd (event) {
|
||||
$global._touchendCB && $global._touchendCB(event);
|
||||
},
|
||||
onTouchMove (event) {
|
||||
$global._touchmoveCB && $global._touchmoveCB(event);
|
||||
},
|
||||
canvasOnReady () {
|
||||
my.createCanvas({
|
||||
id:'GameCanvas',
|
||||
success(canvas){
|
||||
$global.screencanvas = canvas;
|
||||
if (!canvas.addEventListener) {
|
||||
// fix: undefined addEventListener
|
||||
canvas.addEventListener = function () {}
|
||||
}
|
||||
$global.__onCanvasCreated();
|
||||
},
|
||||
fail (err) {
|
||||
console.error('failed to init on screen canvas', err)
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
{}
|
||||
@@ -0,0 +1,82 @@
|
||||
|
||||
if (!globalThis.window) {
|
||||
globalThis.window = globalThis;
|
||||
}
|
||||
globalThis.self = $global;
|
||||
|
||||
globalThis.__taobaoRequire = (urlNoSchema) => {
|
||||
if (urlNoSchema.startsWith('./')) {
|
||||
urlNoSchema = urlNoSchema.replace('./', '');
|
||||
}
|
||||
require('./' + urlNoSchema);
|
||||
};
|
||||
loadCC();
|
||||
|
||||
function loadCC() {
|
||||
|
||||
require('./web-adapter');
|
||||
|
||||
<% if(polyfillsBundleFile) { %>
|
||||
// Polyfills bundle.
|
||||
require("<%= polyfillsBundleFile %>");
|
||||
<% } %>
|
||||
|
||||
// SystemJS support.
|
||||
require("<%= systemJsBundleFile %>");
|
||||
|
||||
|
||||
// Adapt for IOS, swap if opposite
|
||||
if (canvas){
|
||||
var _w = canvas.width;
|
||||
var _h = canvas.height;
|
||||
if (screen.width < screen.height) {
|
||||
if (canvas.width > canvas.height) {
|
||||
_w = canvas.height;
|
||||
_h = canvas.width;
|
||||
}
|
||||
} else {
|
||||
if (canvas.width < canvas.height) {
|
||||
_w = canvas.height;
|
||||
_h = canvas.width;
|
||||
}
|
||||
}
|
||||
canvas.width = _w;
|
||||
canvas.height = _h;
|
||||
}
|
||||
|
||||
let System = $global.System;
|
||||
globalThis.System = System;
|
||||
const importMap = require("<%= importMapFile%>").default;
|
||||
System.warmup({
|
||||
importMap,
|
||||
importMapUrl: '<%= importMapFile%>',
|
||||
defaultHandler: (urlNoSchema) => {
|
||||
require('.' + urlNoSchema);
|
||||
},
|
||||
handlers: {
|
||||
'plugin:': (urlNoSchema) => {
|
||||
requirePlugin(urlNoSchema);
|
||||
},
|
||||
'project:': (urlNoSchema) => {
|
||||
urlNoSchema = urlNoSchema.replace("//", "");
|
||||
require("./" + urlNoSchema);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
System.import('<%= applicationJs %>').then(({ Application }) => {
|
||||
return new Application();
|
||||
}).then((application) => {
|
||||
return onApplicationCreated(application);
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
function onApplicationCreated(application) {
|
||||
return System.import('cc').then((cc) => {
|
||||
require('./engine-adapter');
|
||||
return application.init(cc);
|
||||
}).then(() => { return application.start(); });
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"deviceOrientation": "portrait",
|
||||
"window": {
|
||||
"allowsBounceVertical": "NO",
|
||||
"transparentTitle": "always",
|
||||
"enableAudioAlign": true,
|
||||
"enableMultiAudio": true
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"miniprogramRoot": "client",
|
||||
"pluginRoot": "widget",
|
||||
"compileType": "minigame",
|
||||
"enableAppxNg": true,
|
||||
"widgetRuntimeVersion": "3.0-vue"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
@@ -0,0 +1,6 @@
|
||||
<% if(polyfillsBundleFile) { %>
|
||||
// Polyfills bundle.
|
||||
require("<%= polyfillsBundleFile %>");
|
||||
<% } %>
|
||||
// SystemJS support.
|
||||
require("<%= systemJsBundleFile %>");
|
||||
@@ -0,0 +1,514 @@
|
||||
const VS_LOGO = `
|
||||
attribute vec4 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
varying vec2 v_TexCoord;
|
||||
void main() {
|
||||
gl_Position = a_Position;
|
||||
v_TexCoord = a_TexCoord;
|
||||
}`;
|
||||
|
||||
const FS_LOGO = `
|
||||
precision mediump float;
|
||||
uniform sampler2D u_Sampler;
|
||||
varying vec2 v_TexCoord;
|
||||
void main() {
|
||||
gl_FragColor = texture2D(u_Sampler, v_TexCoord);
|
||||
}`;
|
||||
|
||||
const VS_BG = `
|
||||
attribute vec4 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
varying vec2 v_TexCoord;
|
||||
void main() {
|
||||
gl_Position = a_Position;
|
||||
v_TexCoord = a_TexCoord;
|
||||
}`;
|
||||
|
||||
const FS_BG = `
|
||||
precision mediump float;
|
||||
uniform sampler2D u_Sampler;
|
||||
uniform float u_flip;
|
||||
varying vec2 v_TexCoord;
|
||||
void main() {
|
||||
vec2 texCoord = v_TexCoord;
|
||||
if(u_flip > 0.5) {
|
||||
texCoord.y = 1.0 - texCoord.y;
|
||||
}
|
||||
gl_FragColor = texture2D(u_Sampler, texCoord);
|
||||
}`;
|
||||
|
||||
const VS_PROGRESSBAR = `
|
||||
precision mediump float;
|
||||
attribute vec4 a_Position;
|
||||
attribute float a_Progress;
|
||||
varying float v_Progress;
|
||||
void main() {
|
||||
gl_Position = a_Position;
|
||||
v_Progress = a_Progress;
|
||||
}`;
|
||||
|
||||
const FS_PROGRESSBAR = `
|
||||
precision mediump float;
|
||||
uniform float u_CurrentProgress;
|
||||
varying float v_Progress;
|
||||
uniform vec4 u_ProgressBarColor;
|
||||
uniform vec4 u_ProgressBackground;
|
||||
void main() {
|
||||
gl_FragColor = v_Progress <= u_CurrentProgress ? u_ProgressBarColor : u_ProgressBackground;
|
||||
}`;
|
||||
|
||||
const options = {
|
||||
alpha: false,
|
||||
antialias: true,
|
||||
depth: true,
|
||||
stencil: true,
|
||||
premultipliedAlpha: false,
|
||||
preserveDrawingBuffer: false,
|
||||
powerPreference: 'default',
|
||||
failIfMajorPerformanceCaveat: false,
|
||||
};
|
||||
|
||||
let gl = null;
|
||||
let image = null;
|
||||
let slogan = null;
|
||||
let bg = null;
|
||||
let program = null;
|
||||
let programBg = null;
|
||||
let programProgress = null;
|
||||
let rafHandle = null;
|
||||
let logoTexture = null;
|
||||
let sloganTexture = null;
|
||||
let bgTexture = null;
|
||||
let vertexBuffer = null;
|
||||
let sloganVertexBuffer = null;
|
||||
let bgVertexBuffer = null;
|
||||
let vertexBufferProgress = null;
|
||||
let progress = 0.0;
|
||||
let progressBarColor = [61 / 255, 197 / 255, 222 / 255, 1];
|
||||
let progressBackground = [100 / 255, 111 / 255, 118 / 255, 1];
|
||||
let afterTick = null;
|
||||
let backgroundFilp = 1.0; // set 0 to not flip
|
||||
let displayRatio = <%= displayRatio%>;
|
||||
let bgColor = [<%= bgColor%>];
|
||||
let useCustomBg = <%= useCustomBg%>;
|
||||
let useLogo = <%= useLogo%>;
|
||||
let useDefaultLogo = <%= useDefaultLogo%>;
|
||||
let logoName = '<%= logoName %>';
|
||||
let bgName = '<%= bgName %>';
|
||||
let fitWidth = <%= fitWidth %>;
|
||||
let fitHeight = <%= fitHeight %>;
|
||||
|
||||
function initShaders(vshader, fshader) {
|
||||
return createProgram(vshader, fshader);
|
||||
}
|
||||
|
||||
function createProgram(vshader, fshader) {
|
||||
var vertexShader = loadShader(gl.VERTEX_SHADER, vshader);
|
||||
var fragmentShader = loadShader(gl.FRAGMENT_SHADER, fshader);
|
||||
var program = gl.createProgram();
|
||||
gl.attachShader(program, vertexShader);
|
||||
gl.attachShader(program, fragmentShader);
|
||||
gl.linkProgram(program);
|
||||
var linked = gl.getProgramParameter(program, gl.LINK_STATUS);
|
||||
if (!linked) {
|
||||
var error = gl.getProgramInfoLog(program);
|
||||
console.log('Failed to link program: ' + error);
|
||||
gl.deleteProgram(program);
|
||||
program = null;
|
||||
}
|
||||
gl.deleteShader(fragmentShader);
|
||||
gl.deleteShader(vertexShader);
|
||||
return program;
|
||||
}
|
||||
|
||||
function loadShader(type, source) {
|
||||
var shader = gl.createShader(type);
|
||||
gl.shaderSource(shader, source);
|
||||
gl.compileShader(shader);
|
||||
var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
|
||||
if (!compiled) {
|
||||
var error = gl.getShaderInfoLog(shader);
|
||||
console.log('Failed to compile shader: ' + error);
|
||||
gl.deleteShader(shader);
|
||||
return null;
|
||||
}
|
||||
return shader;
|
||||
}
|
||||
|
||||
function initVertexBuffer() {
|
||||
const widthRatio = 2 / canvas.width;
|
||||
const heightRatio = 2 / canvas.height;
|
||||
const heightOffset = 0.225;
|
||||
const vertices = new Float32Array([
|
||||
widthRatio,heightRatio + heightOffset, 1.0, 1.0,
|
||||
widthRatio, heightRatio + heightOffset, 1.0, 0.0,
|
||||
-widthRatio, heightRatio + heightOffset, 0.0, 1.0,
|
||||
-widthRatio, heightRatio + heightOffset, 0.0, 0.0,
|
||||
]);
|
||||
vertexBuffer = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
|
||||
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);
|
||||
}
|
||||
|
||||
function initSloganVertexBuffer() {
|
||||
const widthRatio = 2 / canvas.width;
|
||||
const heightRatio = 2 / canvas.height;
|
||||
const vertices = new Float32Array([
|
||||
widthRatio, heightRatio, 1.0, 1.0,
|
||||
widthRatio, heightRatio, 1.0, 0.0,
|
||||
-widthRatio, heightRatio, 0.0, 1.0,
|
||||
-widthRatio, heightRatio, 0.0, 0.0,
|
||||
]);
|
||||
sloganVertexBuffer = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, sloganVertexBuffer);
|
||||
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);
|
||||
}
|
||||
|
||||
function initBgVertexBuffer() {
|
||||
const vertices = new Float32Array([
|
||||
1.0, 1.0, 1.0, 1.0,
|
||||
1.0, 0.0, 1.0, 0.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
0.0, 0.0, 0.0, 0.0,
|
||||
]);
|
||||
bgVertexBuffer = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, bgVertexBuffer);
|
||||
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);
|
||||
}
|
||||
|
||||
function initProgressVertexBuffer() {
|
||||
// the ratio value may be adjusted according to the image pixels
|
||||
const widthRatio = 0.5;
|
||||
const heightRatio = (window.devicePixelRatio >= 2 ? 6 : 3) / canvas.height * 1.35;
|
||||
const heightOffset = -0.8;
|
||||
const vertices = new Float32Array([
|
||||
widthRatio, heightOffset - heightRatio, 1,
|
||||
widthRatio, heightOffset + heightRatio, 1,
|
||||
-widthRatio, heightOffset - heightRatio, 0,
|
||||
-widthRatio, heightOffset + heightRatio, 0,
|
||||
]);
|
||||
vertexBufferProgress = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBufferProgress);
|
||||
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);
|
||||
}
|
||||
|
||||
function updateVertexBuffer() {
|
||||
const heightRatio = 1.0 * 0.185 * displayRatio;
|
||||
const widthRatio = image.width * (canvas.height * 0.185 / image.height) / canvas.width * displayRatio;
|
||||
|
||||
const vertices = new Float32Array([
|
||||
widthRatio, -heightRatio, 1.0, 1.0,
|
||||
widthRatio, heightRatio, 1.0, 0.0,
|
||||
-widthRatio, -heightRatio, 0.0, 1.0,
|
||||
-widthRatio, heightRatio, 0.0, 0.0,
|
||||
]);
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
|
||||
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);
|
||||
}
|
||||
|
||||
function updateSloganVertexBuffer() {
|
||||
// the ratio value may be adjusted according to the image pixels
|
||||
const widthRatio = slogan.width / canvas.width * 0.75;
|
||||
const heightRatio = slogan.height / canvas.height * 0.75;
|
||||
const logoHeightRatio = image.height / canvas.height * 1.35 * displayRatio;
|
||||
const heightOffset = (5/12 + logoHeightRatio * 1/2 + heightRatio * 3/2) * (-2) + 1; // 5/12 is ui design layout for logo
|
||||
const vertices = new Float32Array([
|
||||
widthRatio, heightOffset - heightRatio, 1.0, 1.0,
|
||||
widthRatio, heightOffset + heightRatio, 1.0, 0.0,
|
||||
-widthRatio, heightOffset - heightRatio, 0.0, 1.0,
|
||||
-widthRatio, heightOffset + heightRatio, 0.0, 0.0,
|
||||
]);
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, sloganVertexBuffer);
|
||||
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);
|
||||
}
|
||||
|
||||
function updateBgVertexBuffer() {
|
||||
let widthRatio = 1;
|
||||
let heightRatio = 1;
|
||||
if(fitWidth && !fitHeight) {
|
||||
widthRatio = canvas.width;
|
||||
heightRatio = (canvas.width / bg.width) * bg.height;
|
||||
} else if(!fitWidth && fitHeight) {
|
||||
widthRatio = (canvas.height / bg.height) * bg.width;
|
||||
heightRatio = canvas.height;
|
||||
} else if(fitWidth && fitHeight) {
|
||||
if ((bg.width / bg.height) > (canvas.width / canvas.height)) {
|
||||
widthRatio = canvas.width;
|
||||
heightRatio = (canvas.width / bg.width) * bg.height;
|
||||
} else {
|
||||
widthRatio = (canvas.height / bg.height) * bg.width;
|
||||
heightRatio = canvas.height;
|
||||
}
|
||||
} else if(!fitWidth && !fitHeight) {
|
||||
if ((bg.width / bg.height) > (canvas.width / canvas.height)) {
|
||||
widthRatio = (canvas.height / bg.height) * bg.width;
|
||||
heightRatio = canvas.height;
|
||||
} else {
|
||||
widthRatio = canvas.width;
|
||||
heightRatio = (canvas.width / bg.width) * bg.height;
|
||||
}
|
||||
} else {
|
||||
widthRatio = canvas.width;
|
||||
heightRatio = canvas.height;
|
||||
}
|
||||
widthRatio /= canvas.width;
|
||||
heightRatio /= canvas.height;
|
||||
|
||||
const vertices = new Float32Array([
|
||||
widthRatio, heightRatio, 1.0, 1.0,
|
||||
widthRatio, -heightRatio, 1.0, 0.0,
|
||||
-widthRatio, heightRatio, 0.0, 1.0,
|
||||
-widthRatio, -heightRatio, 0.0, 0.0,
|
||||
]);
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, bgVertexBuffer);
|
||||
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);
|
||||
}
|
||||
|
||||
function loadBackground(bgPath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
bg = new Image();
|
||||
bg.premultiplyAlpha = false;
|
||||
bg.onload = function() {
|
||||
resolve(bg);
|
||||
};
|
||||
bg.onerror = function(err) {
|
||||
reject(err);
|
||||
};
|
||||
bg.src = bgPath.replace('#', '%23');
|
||||
});
|
||||
}
|
||||
|
||||
function loadImage(imgPath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
image = new Image();
|
||||
image.premultiplyAlpha = false;
|
||||
image.onload = function() {
|
||||
resolve(image);
|
||||
};
|
||||
image.onerror = function(err) {
|
||||
reject(err);
|
||||
};
|
||||
image.src = imgPath.replace('#', '%23');
|
||||
});
|
||||
}
|
||||
|
||||
function loadSlogan(sloganPath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
slogan = new Image();
|
||||
slogan.premultiplyAlpha = false;
|
||||
slogan.onload = function() {
|
||||
resolve(slogan);
|
||||
};
|
||||
slogan.onerror = function(err) {
|
||||
reject(err);
|
||||
};
|
||||
slogan.src = sloganPath.replace('#', '%23');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function initLogoTexture() {
|
||||
logoTexture = gl.createTexture();
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, logoTexture);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 2, 2, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255]));
|
||||
}
|
||||
|
||||
function initSloganTexture() {
|
||||
sloganTexture = gl.createTexture();
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, sloganTexture);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 2, 2, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255]));
|
||||
}
|
||||
|
||||
function initBgTexture() {
|
||||
bgTexture = gl.createTexture();
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, bgTexture);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 2, 2, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255]));
|
||||
}
|
||||
|
||||
function updateLogoTexture() {
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, logoTexture);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
|
||||
}
|
||||
|
||||
function updateSloganTexture() {
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, sloganTexture);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, slogan);
|
||||
}
|
||||
|
||||
function updateBgTexture() {
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, bgTexture);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, bg);
|
||||
}
|
||||
|
||||
function drawTexture(gl, program, texture, vertexBuffer, vertexFormatLength) {
|
||||
gl.useProgram(program);
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texture);
|
||||
var uSampler = gl.getUniformLocation(program, 'u_Sampler');
|
||||
gl.uniform1i(uSampler, 0);
|
||||
var uFlip = gl.getUniformLocation(program, 'u_flip');
|
||||
gl.uniform1f(uFlip, backgroundFilp);
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
|
||||
var aPosition = gl.getAttribLocation(program, 'a_Position');
|
||||
gl.enableVertexAttribArray(aPosition);
|
||||
gl.vertexAttribPointer(aPosition, 2, gl.FLOAT, false, vertexFormatLength * 4, 0);
|
||||
var aTexCoord = gl.getAttribLocation(program, 'a_TexCoord');
|
||||
gl.enableVertexAttribArray(aTexCoord);
|
||||
gl.vertexAttribPointer(aTexCoord, 2, gl.FLOAT, false, vertexFormatLength * 4, vertexFormatLength * 2);
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
function drawProgressBar(gl, program, vertexBuffer, vertexFormatLength, progress, progressBarColor, progressBackground) {
|
||||
gl.useProgram(program);
|
||||
var uCurrentProgress = gl.getUniformLocation(program, 'u_CurrentProgress');
|
||||
gl.uniform1f(uCurrentProgress, progress);
|
||||
var uProgressBarColor = gl.getUniformLocation(program, 'u_ProgressBarColor');
|
||||
gl.uniform4fv(uProgressBarColor, progressBarColor);
|
||||
var uProgressBackground = gl.getUniformLocation(program, 'u_ProgressBackground');
|
||||
gl.uniform4fv(uProgressBackground, progressBackground);
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
|
||||
var aPosition = gl.getAttribLocation(program, 'a_Position');
|
||||
gl.enableVertexAttribArray(aPosition);
|
||||
var vertexFormatLength = 4;
|
||||
gl.vertexAttribPointer(aPosition, 2, gl.FLOAT, false, vertexFormatLength * 3, 0);
|
||||
var aProgress = gl.getAttribLocation(program, 'a_Progress');
|
||||
gl.enableVertexAttribArray(aProgress);
|
||||
gl.vertexAttribPointer(aProgress, 1, gl.FLOAT, false, vertexFormatLength * 3, vertexFormatLength * 2);
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
function draw() {
|
||||
gl.enable(gl.BLEND);
|
||||
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
||||
gl.clearColor(bgColor[0], bgColor[1], bgColor[2], bgColor[3]);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
// draw background
|
||||
useCustomBg && drawTexture(gl, programBg, bgTexture, bgVertexBuffer, 4);
|
||||
// draw logo
|
||||
useLogo && drawTexture(gl, program, logoTexture, vertexBuffer, 4);
|
||||
// draw slogan
|
||||
useLogo && useDefaultLogo && drawTexture(gl, program, sloganTexture, sloganVertexBuffer, 4);
|
||||
// draw progress bar
|
||||
drawProgressBar(gl, programProgress, vertexBufferProgress, 3, progress, progressBarColor, progressBackground);
|
||||
}
|
||||
|
||||
function tick() {
|
||||
rafHandle = requestAnimationFrame(() => {
|
||||
draw();
|
||||
tick();
|
||||
if (afterTick) {
|
||||
afterTick();
|
||||
afterTick = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function end() {
|
||||
return setProgress(1).then(() => {
|
||||
cancelAnimationFrame(rafHandle);
|
||||
gl.useProgram(null);
|
||||
gl.bindTexture(gl.TEXTURE_2D, null);
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
||||
useLogo && gl.deleteTexture(logoTexture);
|
||||
useLogo && useDefaultLogo && gl.deleteTexture(sloganTexture);
|
||||
useCustomBg && gl.deleteTexture(bgTexture);
|
||||
gl.deleteBuffer(vertexBuffer);
|
||||
useCustomBg && gl.deleteBuffer(bgVertexBuffer);
|
||||
useLogo && useDefaultLogo && gl.deleteBuffer(sloganVertexBuffer);
|
||||
gl.deleteBuffer(vertexBufferProgress);
|
||||
gl.deleteProgram(program);
|
||||
gl.deleteProgram(programBg);
|
||||
gl.deleteProgram(programProgress);
|
||||
});
|
||||
}
|
||||
|
||||
function setProgress(val) {
|
||||
progress = val;
|
||||
return new Promise((resolve, reject) => {
|
||||
afterTick = () => {
|
||||
resolve();
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function start(alpha, antialias, useWebgl2) {
|
||||
options.alpha = alpha === 'true' ? true : false;
|
||||
options.antialias = antialias === 'false' ? false : true;
|
||||
if (useWebgl2 === 'true') {
|
||||
gl = window.canvas.getContext("webgl2", options);
|
||||
}
|
||||
// TODO: this is a hack method to detect whether WebGL2RenderingContext is supported
|
||||
if (gl) {
|
||||
window.WebGL2RenderingContext = true;
|
||||
} else {
|
||||
window.WebGL2RenderingContext = false;
|
||||
gl = window.canvas.getContext("webgl", options);
|
||||
}
|
||||
initVertexBuffer();
|
||||
useCustomBg && initBgVertexBuffer();
|
||||
useLogo && useDefaultLogo && initSloganVertexBuffer();
|
||||
initProgressVertexBuffer();
|
||||
|
||||
initLogoTexture();
|
||||
useCustomBg && initBgTexture();
|
||||
useLogo && useDefaultLogo && initSloganTexture();
|
||||
|
||||
if (useLogo) {
|
||||
program = initShaders(VS_LOGO, FS_LOGO);
|
||||
}
|
||||
if (useCustomBg) {
|
||||
programBg = initShaders(VS_BG, FS_BG);
|
||||
}
|
||||
programProgress = initShaders(VS_PROGRESSBAR, FS_PROGRESSBAR);
|
||||
tick();
|
||||
|
||||
return Promise.all([
|
||||
//logo should be loaded earlier than slogan
|
||||
useLogo && loadImage(logoName).then(() => {
|
||||
updateVertexBuffer();
|
||||
updateLogoTexture();
|
||||
}).then(() => {
|
||||
return useLogo && useDefaultLogo && loadSlogan('slogan.png').then(() => {
|
||||
updateSloganVertexBuffer();
|
||||
updateSloganTexture();
|
||||
});
|
||||
}),
|
||||
useCustomBg && loadBackground(bgName).then(() => {
|
||||
updateBgVertexBuffer();
|
||||
updateBgTexture();
|
||||
})
|
||||
]).then(() => {
|
||||
return setProgress(0);
|
||||
});
|
||||
}
|
||||
module.exports = { start, end, setProgress };
|
||||
@@ -0,0 +1,80 @@
|
||||
function __initApp () { // init app
|
||||
globalThis.__wxRequire = require; // FIX: require cannot work in separate engine
|
||||
require('./web-adapter');
|
||||
const firstScreen = require('./first-screen');
|
||||
|
||||
<%- include(cocosTemplate, {}) %>
|
||||
|
||||
// Adapt for IOS, swap if opposite
|
||||
const info = wx.getSystemInfoSync();
|
||||
if (canvas){
|
||||
var _w = canvas.width;
|
||||
var _h = canvas.height;
|
||||
if (info.screenWidth < info.screenHeight) {
|
||||
if (canvas.width > canvas.height) {
|
||||
_w = canvas.height;
|
||||
_h = canvas.width;
|
||||
}
|
||||
} else {
|
||||
if (canvas.width < canvas.height) {
|
||||
_w = canvas.height;
|
||||
_h = canvas.width;
|
||||
}
|
||||
}
|
||||
canvas.width = _w;
|
||||
canvas.height = _h;
|
||||
}
|
||||
// Adjust initial canvas size
|
||||
if (canvas && window.devicePixelRatio >= 2) {canvas.width *= info.devicePixelRatio; canvas.height *= info.devicePixelRatio;}
|
||||
|
||||
const importMap = require("<%= importMapFile%>").default;
|
||||
System.warmup({
|
||||
importMap,
|
||||
importMapUrl: '<%= importMapFile%>',
|
||||
defaultHandler: (urlNoSchema) => {
|
||||
require('.' + urlNoSchema);
|
||||
},
|
||||
handlers: {
|
||||
'plugin:': (urlNoSchema) => {
|
||||
requirePlugin(urlNoSchema);
|
||||
},
|
||||
'project:': (urlNoSchema) => {
|
||||
require(urlNoSchema);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
firstScreen.start('<%= alpha %>', '<%= antialias %>', '<%= useWebgl2 %>').then(() => {
|
||||
return System.import('<%= applicationJs %>');
|
||||
}).then((module) => {
|
||||
return firstScreen.setProgress(0.2).then(() => Promise.resolve(module));
|
||||
}).then(({ Application }) => {
|
||||
return new Application();
|
||||
}).then((application) => {
|
||||
return firstScreen.setProgress(0.4).then(() => Promise.resolve(application));
|
||||
}).then((application) => {
|
||||
return onApplicationCreated(application);
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
function onApplicationCreated(application) {
|
||||
return System.import('cc').then((module) => {
|
||||
return firstScreen.setProgress(0.6).then(() => Promise.resolve(module));
|
||||
}).then((cc) => {
|
||||
require('./engine-adapter');
|
||||
return application.init(cc);
|
||||
}).then(() => {
|
||||
return firstScreen.end().then(() => application.start());
|
||||
});
|
||||
}
|
||||
|
||||
} // init app
|
||||
|
||||
// NOTE: on WeChat Android end, we can only get the correct screen size at the second tick of game.
|
||||
var sysInfo = wx.getSystemInfoSync();
|
||||
if (sysInfo.platform.toLocaleLowerCase() === 'android') {
|
||||
GameGlobal.requestAnimationFrame (__initApp);
|
||||
} else {
|
||||
__initApp();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"deviceOrientation": "portrait",
|
||||
"openDataContext": "",
|
||||
"networkTimeout": {
|
||||
"request": 5000,
|
||||
"connectSocket": 5000,
|
||||
"uploadFile": 5000,
|
||||
"downloadFile": 500000
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"_plugin-version": "3.2.2"
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"description": "项目配置文件。",
|
||||
"miniprogramRoot": "./",
|
||||
"setting": {
|
||||
"urlCheck": true,
|
||||
"postcss": true,
|
||||
"minified": true,
|
||||
"newFeature": false,
|
||||
"enhance": true,
|
||||
"useIsolateContext": true
|
||||
},
|
||||
"compileType": "game",
|
||||
"libVersion": "widelyUsed",
|
||||
"appid": "",
|
||||
"projectname": "",
|
||||
"condition": {
|
||||
"search": {
|
||||
"current": -1,
|
||||
"list": []
|
||||
},
|
||||
"conversation": {
|
||||
"current": -1,
|
||||
"list": []
|
||||
},
|
||||
"game": {
|
||||
"currentL": -1,
|
||||
"list": [],
|
||||
"current": -1
|
||||
},
|
||||
"miniprogram": {
|
||||
"current": -1,
|
||||
"list": []
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
Executable
+35
@@ -0,0 +1,35 @@
|
||||
// app.js
|
||||
App({
|
||||
GameGlobal: {
|
||||
screencanvas: undefined,
|
||||
canvas: undefined,
|
||||
System: undefined,
|
||||
Image: undefined,
|
||||
cc: undefined,
|
||||
CocosEngine: undefined,
|
||||
ccwindow: undefined,
|
||||
fsUtils: undefined,
|
||||
document: undefined,
|
||||
requestAnimationFrame: undefined,
|
||||
cancelAnimationFrame: undefined,
|
||||
Image: undefined,
|
||||
ImageBitmap: undefined,
|
||||
XMLHttpRequest: undefined,
|
||||
WebSocket: undefined,
|
||||
DOMParser: undefined,
|
||||
WebAssembly: undefined,
|
||||
WXWebAssembly: undefined,
|
||||
CCWebAssembly: undefined,
|
||||
_touchStart: undefined,
|
||||
_touchMove: undefined,
|
||||
_touchEnd: undefined,
|
||||
_touchCancel: undefined,
|
||||
showInput: false,
|
||||
indexThis: undefined,
|
||||
_onKeyboardInput: undefined,
|
||||
_onKeyboardConfirm: undefined,
|
||||
_onKeyboardComplete: undefined,
|
||||
},
|
||||
onLaunch() {
|
||||
},
|
||||
})
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"pages": [
|
||||
"index"
|
||||
],
|
||||
"window": {
|
||||
"backgroundTextStyle": "light",
|
||||
"navigationBarBackgroundColor": "#fff",
|
||||
"navigationBarTitleText": "CocosCreator",
|
||||
"navigationBarTextStyle": "black",
|
||||
"navigationStyle": "custom",
|
||||
"pageOrientation": "portrait"
|
||||
},
|
||||
"style": "v2",
|
||||
"sitemapLocation": "sitemap.json",
|
||||
"subPackages": []
|
||||
}
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
/**app.wxss**/
|
||||
.container {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
bottom: 0px;
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<% if(polyfillsBundleFile) { %>
|
||||
// Polyfills bundle.
|
||||
require("<%= polyfillsBundleFile %>");
|
||||
<% } %>
|
||||
// SystemJS support.
|
||||
require("<%= systemJsBundleFile %>");
|
||||
@@ -0,0 +1,280 @@
|
||||
// TODO: insert global variable access by build process in Editor
|
||||
const GameGlobal = getApp().GameGlobal;
|
||||
const window = GameGlobal;
|
||||
const requestAnimationFrame = GameGlobal.canvas.requestAnimationFrame;
|
||||
const cancelAnimationFrame = GameGlobal.canvas.cancelAnimationFrame;
|
||||
|
||||
const VS_LOGO = `
|
||||
attribute vec4 a_Position;
|
||||
attribute vec2 a_TexCoord;
|
||||
varying vec2 v_TexCoord;
|
||||
void main() {
|
||||
gl_Position = a_Position;
|
||||
v_TexCoord = a_TexCoord;
|
||||
}`;
|
||||
|
||||
const FS_LOGO = `
|
||||
precision mediump float;
|
||||
uniform sampler2D u_Sampler;
|
||||
varying vec2 v_TexCoord;
|
||||
void main() {
|
||||
gl_FragColor = texture2D(u_Sampler, v_TexCoord);
|
||||
}`;
|
||||
|
||||
const VS_PROGRESSBAR = `
|
||||
precision mediump float;
|
||||
attribute vec4 a_Position;
|
||||
attribute float a_Progress;
|
||||
varying float v_Progress;
|
||||
void main() {
|
||||
gl_Position = a_Position;
|
||||
v_Progress = a_Progress;
|
||||
}`;
|
||||
|
||||
const FS_PROGRESSBAR = `
|
||||
precision mediump float;
|
||||
uniform float u_CurrentProgress;
|
||||
varying float v_Progress;
|
||||
uniform vec4 u_ProgressBarColor;
|
||||
uniform vec4 u_ProgressBackground;
|
||||
void main() {
|
||||
gl_FragColor = v_Progress <= u_CurrentProgress ? u_ProgressBarColor : u_ProgressBackground;
|
||||
}`;
|
||||
|
||||
const options = {
|
||||
alpha: false,
|
||||
antialias: true,
|
||||
depth: true,
|
||||
stencil: true,
|
||||
premultipliedAlpha: false,
|
||||
preserveDrawingBuffer: false,
|
||||
powerPreference: 'default',
|
||||
failIfMajorPerformanceCaveat: false,
|
||||
};
|
||||
|
||||
//NOTE: canvas
|
||||
let canvas = null;
|
||||
let gl = null;
|
||||
let image = null;
|
||||
let program = null;
|
||||
let programProgress = null;
|
||||
let rafHandle = null;
|
||||
let texture = null;
|
||||
let vertexBuffer = null;
|
||||
let vertexBufferProgress = null;
|
||||
let progress = 0.0;
|
||||
let progressBarColor = [61 / 255, 197 / 255, 222 / 255, 1];
|
||||
let progressBackground = [100 / 255, 111 / 255, 118 / 255, 1];
|
||||
let afterTick = null;
|
||||
|
||||
function initShaders(vshader, fshader) {
|
||||
return createProgram(vshader, fshader);
|
||||
}
|
||||
|
||||
function createProgram(vshader, fshader) {
|
||||
var vertexShader = loadShader(gl.VERTEX_SHADER, vshader);
|
||||
var fragmentShader = loadShader(gl.FRAGMENT_SHADER, fshader);
|
||||
var program = gl.createProgram();
|
||||
gl.attachShader(program, vertexShader);
|
||||
gl.attachShader(program, fragmentShader);
|
||||
gl.linkProgram(program);
|
||||
var linked = gl.getProgramParameter(program, gl.LINK_STATUS);
|
||||
if (!linked) {
|
||||
var error = gl.getProgramInfoLog(program);
|
||||
console.log('Failed to link program: ' + error);
|
||||
gl.deleteProgram(program);
|
||||
program = null;
|
||||
}
|
||||
gl.deleteShader(fragmentShader);
|
||||
gl.deleteShader(vertexShader);
|
||||
return program;
|
||||
}
|
||||
|
||||
function loadShader(type, source) {
|
||||
var shader = gl.createShader(type);
|
||||
gl.shaderSource(shader, source);
|
||||
gl.compileShader(shader);
|
||||
var compiled = gl.getShaderParameter(shader, gl.COMPILE_STATUS);
|
||||
if (!compiled) {
|
||||
var error = gl.getShaderInfoLog(shader);
|
||||
console.log('Failed to compile shader: ' + error);
|
||||
gl.deleteShader(shader);
|
||||
return null;
|
||||
}
|
||||
return shader;
|
||||
}
|
||||
|
||||
function initVertexBuffer() {
|
||||
const widthRatio = 2 / canvas.width;
|
||||
const heightRatio = 2 / canvas.height;
|
||||
const vertices = new Float32Array([
|
||||
widthRatio, heightRatio, 1.0, 1.0,
|
||||
widthRatio, heightRatio, 1.0, 0.0,
|
||||
-widthRatio, heightRatio, 0.0, 1.0,
|
||||
-widthRatio, heightRatio, 0.0, 0.0,
|
||||
]);
|
||||
vertexBuffer = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
|
||||
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);
|
||||
}
|
||||
|
||||
function initProgressVertexBuffer() {
|
||||
const widthRatio = 0.405;
|
||||
const heightRatio = (window.devicePixelRatio >= 2 ? 6 : 3) / canvas.height;
|
||||
const heightOffset = -0.25;
|
||||
const vertices = new Float32Array([
|
||||
widthRatio, heightOffset - heightRatio, 1,
|
||||
widthRatio, heightOffset + heightRatio, 1,
|
||||
-widthRatio, heightOffset - heightRatio, 0,
|
||||
-widthRatio, heightOffset + heightRatio, 0,
|
||||
]);
|
||||
vertexBufferProgress = gl.createBuffer();
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBufferProgress);
|
||||
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);
|
||||
}
|
||||
|
||||
function updateVertexBuffer() {
|
||||
const widthRatio = image.width / canvas.width;
|
||||
const heightRatio = image.height / canvas.height;
|
||||
const vertices = new Float32Array([
|
||||
widthRatio, -heightRatio, 1.0, 1.0,
|
||||
widthRatio, heightRatio, 1.0, 0.0,
|
||||
-widthRatio, -heightRatio, 0.0, 1.0,
|
||||
-widthRatio, heightRatio, 0.0, 0.0,
|
||||
]);
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
|
||||
gl.bufferData(gl.ARRAY_BUFFER, vertices, gl.STATIC_DRAW);
|
||||
}
|
||||
|
||||
function loadImage(imgPath) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// TODO:replace?
|
||||
// image = new Image();
|
||||
image = GameGlobal.canvas.createImage();
|
||||
image.premultiplyAlpha = false;
|
||||
image.onload = function() {
|
||||
resolve(image);
|
||||
};
|
||||
image.onerror = function(err) {
|
||||
reject(err);
|
||||
};
|
||||
image.src = imgPath.replace('#', '%23');
|
||||
});
|
||||
}
|
||||
|
||||
function initTexture() {
|
||||
texture = gl.createTexture();
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texture);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 2, 2, 0, gl.RGBA, gl.UNSIGNED_BYTE, new Uint8Array([0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255]));
|
||||
}
|
||||
|
||||
function updateTexture() {
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texture);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
|
||||
}
|
||||
|
||||
function draw() {
|
||||
gl.clearColor(0.0, 0.0, 0.0, 0.0);
|
||||
gl.clear(gl.COLOR_BUFFER_BIT);
|
||||
gl.useProgram(program);
|
||||
gl.activeTexture(gl.TEXTURE0);
|
||||
gl.bindTexture(gl.TEXTURE_2D, texture);
|
||||
var uSampler = gl.getUniformLocation(program, 'u_Sampler');
|
||||
gl.uniform1i(uSampler, 0);
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
|
||||
var vertexFormatLength = 4;
|
||||
var aPosition = gl.getAttribLocation(program, 'a_Position');
|
||||
gl.enableVertexAttribArray(aPosition);
|
||||
gl.vertexAttribPointer(aPosition, 2, gl.FLOAT, false, vertexFormatLength * 4, 0);
|
||||
var aTexCoord = gl.getAttribLocation(program, 'a_TexCoord');
|
||||
gl.enableVertexAttribArray(aTexCoord);
|
||||
gl.vertexAttribPointer(aTexCoord, 2, gl.FLOAT, false, vertexFormatLength * 4, vertexFormatLength * 2);
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||
gl.useProgram(programProgress);
|
||||
var uCurrentProgress = gl.getUniformLocation(programProgress, 'u_CurrentProgress');
|
||||
gl.uniform1f(uCurrentProgress, progress);
|
||||
var uProgressBarColor = gl.getUniformLocation(programProgress, 'u_ProgressBarColor');
|
||||
gl.uniform4fv(uProgressBarColor, progressBarColor);
|
||||
var uProgressBackground = gl.getUniformLocation(programProgress, 'u_ProgressBackground');
|
||||
gl.uniform4fv(uProgressBackground, progressBackground);
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBufferProgress);
|
||||
aPosition = gl.getAttribLocation(programProgress, 'a_Position');
|
||||
gl.enableVertexAttribArray(aPosition);
|
||||
gl.vertexAttribPointer(aPosition, 2, gl.FLOAT, false, vertexFormatLength * 3, 0);
|
||||
var aProgress = gl.getAttribLocation(programProgress, 'a_Progress');
|
||||
gl.enableVertexAttribArray(aProgress);
|
||||
gl.vertexAttribPointer(aProgress, 1, gl.FLOAT, false, vertexFormatLength * 3, vertexFormatLength * 2);
|
||||
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
|
||||
function tick() {
|
||||
rafHandle = requestAnimationFrame(() => {
|
||||
draw();
|
||||
tick();
|
||||
if (afterTick) {
|
||||
afterTick();
|
||||
afterTick = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function end() {
|
||||
return setProgress(1).then(() => {
|
||||
cancelAnimationFrame(rafHandle);
|
||||
gl.useProgram(null);
|
||||
gl.bindTexture(gl.TEXTURE_2D, null);
|
||||
gl.bindBuffer(gl.ARRAY_BUFFER, null);
|
||||
gl.deleteTexture(texture);
|
||||
gl.deleteBuffer(vertexBuffer);
|
||||
gl.deleteBuffer(vertexBufferProgress);
|
||||
gl.deleteProgram(program);
|
||||
gl.deleteProgram(programProgress);
|
||||
});
|
||||
}
|
||||
|
||||
function setProgress(val) {
|
||||
progress = val;
|
||||
return new Promise((resolve, reject) => {
|
||||
afterTick = () => {
|
||||
resolve();
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function start(alpha, antialias, useWebgl2) {
|
||||
options.alpha = alpha === 'true' ? true : false;
|
||||
options.antialias = antialias === 'false' ? false : true;
|
||||
if (useWebgl2 === 'true') {
|
||||
gl = window.canvas.getContext("webgl2", options);
|
||||
}
|
||||
// TODO: this is a hack method to detect whether WebGL2RenderingContext is supported
|
||||
if (gl) {
|
||||
window.WebGL2RenderingContext = true;
|
||||
} else {
|
||||
window.WebGL2RenderingContext = false;
|
||||
gl = window.canvas.getContext("webgl", options);
|
||||
}
|
||||
canvas = window.canvas;
|
||||
initVertexBuffer();
|
||||
initProgressVertexBuffer();
|
||||
initTexture();
|
||||
program = initShaders(VS_LOGO, FS_LOGO);
|
||||
programProgress = initShaders(VS_PROGRESSBAR, FS_PROGRESSBAR);
|
||||
tick();
|
||||
return loadImage('splash.png').then(() => {
|
||||
updateVertexBuffer();
|
||||
updateTexture();
|
||||
return setProgress(0);
|
||||
});
|
||||
}
|
||||
module.exports = { start, end, setProgress };
|
||||
@@ -0,0 +1,100 @@
|
||||
globalThis.__wxRequire = require;
|
||||
var GameGlobal = getApp().GameGlobal;
|
||||
Page({
|
||||
onReady() {
|
||||
GameGlobal.indexThis = this;
|
||||
const query = wx.createSelectorQuery()
|
||||
query.select('#myCanvas').node().exec(async (res) => {
|
||||
const canvas = res[0].node;
|
||||
let width = canvas.width;
|
||||
let height = canvas.height;
|
||||
const adapter = require('./miniapp-adapter');
|
||||
adapter.adapt(canvas, width, height);
|
||||
require('./web-adapter');
|
||||
const firstScreen = require('./first-screen');
|
||||
<%- include(cocosTemplate, {}) %>
|
||||
const loader = require('load-module.js');
|
||||
await loader.loadModules();
|
||||
|
||||
require('./application.js');
|
||||
// Adjust initial canvas size
|
||||
if (canvas && GameGlobal.devicePixelRatio >= 2) {
|
||||
canvas.width *= 2; canvas.height *= 2;
|
||||
}
|
||||
|
||||
const importMap = require("<%= importMapFile%>").default;
|
||||
const System = GameGlobal.System;
|
||||
System.warmup({
|
||||
importMap,
|
||||
importMapUrl: '<%= importMapFile%>',
|
||||
// defaultHandler: (urlNoSchema) => {
|
||||
// require('.' + urlNoSchema);
|
||||
// },
|
||||
// handlers: {
|
||||
// 'plugin:': (urlNoSchema) => {
|
||||
// requirePlugin(urlNoSchema);
|
||||
// },
|
||||
// 'project:': (urlNoSchema) => {
|
||||
// require(urlNoSchema);
|
||||
// },
|
||||
// },
|
||||
});
|
||||
|
||||
firstScreen.start('<%= alpha %>', '<%= antialias %>', '<%= useWebgl2 %>').then(() => {
|
||||
return System.import('<%= applicationJs %>');
|
||||
}).then((module) => {
|
||||
return firstScreen.setProgress(0.2).then(() => Promise.resolve(module));
|
||||
}).then(({ Application }) => {
|
||||
return new Application();
|
||||
}).then((application) => {
|
||||
return firstScreen.setProgress(0.4).then(() => Promise.resolve(application));
|
||||
}).then((application) => {
|
||||
return onApplicationCreated(application);
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
function onApplicationCreated(application) {
|
||||
return System.import('cc').then((module) => {
|
||||
return firstScreen.setProgress(0.6).then(() => Promise.resolve(module));
|
||||
}).then((cc) => {
|
||||
require('./engine-adapter');
|
||||
return application.init(cc);
|
||||
}).then(() => {
|
||||
return firstScreen.end().then(() => application.start());
|
||||
});
|
||||
}
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
onKeyboardInput: function (event) {
|
||||
GameGlobal._onKeyboardInput && GameGlobal._onKeyboardInput(event);
|
||||
},
|
||||
|
||||
onKeyboardConfirm: function (event) {
|
||||
console.log(event.detail.value);
|
||||
GameGlobal._onKeyboardConfirm && GameGlobal._onKeyboardConfirm(event);
|
||||
},
|
||||
|
||||
onKeyboardComplete: function (event) {
|
||||
console.log(event.detail.value);
|
||||
GameGlobal._onKeyboardComplete && GameGlobal._onKeyboardComplete(event);
|
||||
},
|
||||
|
||||
touchStart(event) {
|
||||
GameGlobal._touchStart && GameGlobal._touchStart(event);
|
||||
},
|
||||
|
||||
touchEnd(event) {
|
||||
GameGlobal._touchEnd && GameGlobal._touchEnd(event);
|
||||
},
|
||||
|
||||
touchMove(event) {
|
||||
GameGlobal._touchMove && GameGlobal._touchMove(event);
|
||||
},
|
||||
|
||||
touchCancel(event) {
|
||||
GameGlobal._touchCancel && GameGlobal._touchCancel(event);
|
||||
}
|
||||
})
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"deviceOrientation": "portrait",
|
||||
"openDataContext": "",
|
||||
"networkTimeout": {
|
||||
"request": 5000,
|
||||
"connectSocket": 5000,
|
||||
"uploadFile": 5000,
|
||||
"downloadFile": 500000
|
||||
}
|
||||
}
|
||||
Executable
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"usingComponents": {}
|
||||
}
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
<!--index.wxml-->
|
||||
<view class="container">
|
||||
<view class="weui-cell weui-cell_input">
|
||||
<input class="weui-input"
|
||||
auto-focus
|
||||
bindinput="onKeyboardInput"
|
||||
bindblur="onKeyboardComplete"
|
||||
bindconfirm="onKeyboardConfirm"
|
||||
confirm-type="{{confirmType}}"
|
||||
password="{{isPassword}}"
|
||||
maxLength="{{maxLength}}"
|
||||
wx:if="{{showInput}}"
|
||||
/>
|
||||
</view>
|
||||
<canvas
|
||||
type="webgl"
|
||||
id="myCanvas"
|
||||
bindtouchstart="touchStart"
|
||||
bindtouchmove="touchMove"
|
||||
bindtouchend="touchEnd"
|
||||
bindtouchcancel="touchCancel"
|
||||
></canvas>
|
||||
</view>
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
/**app.wxss**/
|
||||
#myCanvas {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
bottom: 0px;
|
||||
}
|
||||
|
||||
input {
|
||||
color: transparent;
|
||||
text-shadow: 0 0 0 #000;
|
||||
opacity: 0;
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
var GameGlobal = getApp().GameGlobal;
|
||||
exports.adapt = function (canvas, width, height) {
|
||||
GameGlobal.canvas = canvas;
|
||||
GameGlobal.CCWebAssembly = GameGlobal.WXWebAssembly = WXWebAssembly;
|
||||
GameGlobal.requestAnimationFrame = GameGlobal.canvas.requestAnimationFrame || globalThis.setTimeout;
|
||||
GameGlobal.cancelAnimationFrame = GameGlobal.canvas.cancelAnimationFrame || globalThis.setTimeout;
|
||||
GameGlobal.setTimeout = globalThis.setTimeout;
|
||||
GameGlobal.setInterval = globalThis.setInterval;
|
||||
GameGlobal.clearTimeout = globalThis.clearTimeout;
|
||||
GameGlobal.clearInterval = globalThis.clearInterval;
|
||||
|
||||
let isFirstCall = true;
|
||||
|
||||
wx.createCanvas = function () {
|
||||
console.log('wx.createCanvas called');
|
||||
if (isFirstCall) {
|
||||
isFirstCall = false;
|
||||
return canvas;
|
||||
} else {
|
||||
return wx.createOffscreenCanvas({type:"2d", width: width, height: height});
|
||||
}
|
||||
}
|
||||
|
||||
wx.createImage = function () {
|
||||
console.log('wx.creatImage in miniapp-adapter')
|
||||
let image = canvas.createImage();
|
||||
return image;
|
||||
}
|
||||
|
||||
wx.onTouchStart = function (cb) {
|
||||
GameGlobal._touchStart = function (event) {
|
||||
handleTouchEvent(event);
|
||||
cb(event);
|
||||
};
|
||||
};
|
||||
wx.onTouchMove = function (cb) {
|
||||
GameGlobal._touchMove = function (event) {
|
||||
handleTouchEvent(event);
|
||||
cb(event);
|
||||
};
|
||||
};
|
||||
wx.onTouchEnd = function (cb) {
|
||||
GameGlobal._touchEnd = function (event) {
|
||||
handleTouchEvent(event);
|
||||
cb(event);
|
||||
};
|
||||
};
|
||||
wx.onTouchCancel = function (cb) {
|
||||
GameGlobal._touchCancel = function (event) {
|
||||
handleTouchEvent(event);
|
||||
cb(event);
|
||||
};
|
||||
};
|
||||
|
||||
wx.onKeyboardInput = function (cb) {
|
||||
GameGlobal._onKeyboardInput = function (event) {
|
||||
cb(event.detail);
|
||||
};
|
||||
};
|
||||
|
||||
wx.onKeyboardConfirm = function (cb) {
|
||||
GameGlobal._onKeyboardConfirm = function (event) {
|
||||
cb(event.detail);
|
||||
};
|
||||
};
|
||||
|
||||
wx.onKeyboardComplete = function (cb) {
|
||||
GameGlobal._onKeyboardComplete = function (event) {
|
||||
GameGlobal.indexThis.setData({
|
||||
showInput: false,
|
||||
});
|
||||
cb(event.detail);
|
||||
};
|
||||
};
|
||||
|
||||
wx.showKeyboard = function (obj) {
|
||||
GameGlobal.indexThis.setData({
|
||||
showInput: true,
|
||||
isPassword: false,
|
||||
maxLength: obj.maxLength,
|
||||
confirmType: obj.confirmType
|
||||
});
|
||||
};
|
||||
|
||||
function handleTouchEvent (event) {
|
||||
let changedTouches = event.changedTouches;
|
||||
if (changedTouches) {
|
||||
for (let touch of changedTouches) {
|
||||
touch.clientX = touch.x;
|
||||
touch.clientY = touch.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: use wx.onDeviceMotionChange to instead
|
||||
wx.onDeviceOrientationChange = function () {
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"_plugin-version": "3.2.2"
|
||||
}
|
||||
Executable
+53
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"description": "项目配置文件",
|
||||
"packOptions": {
|
||||
"ignore": [],
|
||||
"include": []
|
||||
},
|
||||
"setting": {
|
||||
"ignoreDevUnusedFiles": false,
|
||||
"ignoreUploadUnusedFiles": false,
|
||||
"bundle": false,
|
||||
"userConfirmedBundleSwitch": false,
|
||||
"urlCheck": true,
|
||||
"scopeDataCheck": false,
|
||||
"coverView": true,
|
||||
"es6": true,
|
||||
"postcss": true,
|
||||
"compileHotReLoad": false,
|
||||
"lazyloadPlaceholderEnable": false,
|
||||
"preloadBackgroundData": false,
|
||||
"minified": true,
|
||||
"autoAudits": false,
|
||||
"newFeature": false,
|
||||
"uglifyFileName": false,
|
||||
"uploadWithSourceMap": true,
|
||||
"useIsolateContext": true,
|
||||
"nodeModules": false,
|
||||
"enhance": true,
|
||||
"useMultiFrameRuntime": true,
|
||||
"useApiHook": true,
|
||||
"useApiHostProcess": true,
|
||||
"showShadowRootInWxmlPanel": true,
|
||||
"packNpmManually": false,
|
||||
"enableEngineNative": false,
|
||||
"packNpmRelationList": [],
|
||||
"minifyWXSS": true,
|
||||
"showES6CompileOption": false,
|
||||
"minifyWXML": true,
|
||||
"babelSetting": {
|
||||
"ignore": [],
|
||||
"disablePlugins": [],
|
||||
"outputPath": ""
|
||||
}
|
||||
},
|
||||
"compileType": "miniprogram",
|
||||
"libVersion": "2.19.4",
|
||||
"appid": "wx2c815291f1aa4d1c",
|
||||
"projectname": "miniprogram-92",
|
||||
"condition": {},
|
||||
"editorSetting": {
|
||||
"tabIndent": "insertSpaces",
|
||||
"tabSize": 4
|
||||
}
|
||||
}
|
||||
Executable
+7
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
|
||||
"rules": [{
|
||||
"action": "allow",
|
||||
"page": "*"
|
||||
}]
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
@@ -0,0 +1,8 @@
|
||||
module.exports = function(api) {
|
||||
api.cache(true);
|
||||
return {
|
||||
presets: ["@babel/preset-env"],
|
||||
plugins: ["@babel/plugin-transform-modules-commonjs"],
|
||||
babelrcRoots: [".", "node_modules"]
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDMTCCAhmgAwIBAgIJAMKpjyszxkDpMA0GCSqGSIb3DQEBCwUAMC4xCzAJBgNV
|
||||
BAYTAkNOMQwwCgYDVQQKDANSUEsxETAPBgNVBAMMCFJQS0RlYnVnMCAXDTE3MDQx
|
||||
OTAyMzE0OVoYDzIxMTYwMzI2MDIzMTQ5WjAuMQswCQYDVQQGEwJDTjEMMAoGA1UE
|
||||
CgwDUlBLMREwDwYDVQQDDAhSUEtEZWJ1ZzCCASIwDQYJKoZIhvcNAQEBBQADggEP
|
||||
ADCCAQoCggEBAK3kPd9jzvTctTIA3XNZVv9cHHDbAc6nTBfdZp9mtPOTkXFpvyCb
|
||||
kL0QjOog0+1pv8D7dFeP4ptWXU5CT3ImvaPR+16dAtMRcsxEr5q4zieJzx3O6huL
|
||||
UBa1k+xrzjXpRzkcOysmc8fTxt0tAwbDgJ2AA5TlXLTcVyb7GmJ+hl5CjnhoG5NN
|
||||
LrkqI7S29c1U3uokj8Q7hzaj0TURu/uB5ZIMCLZY9KFDugqaEcvmUyJiD0fuV6sA
|
||||
O/4kpiZUOnhV8/xWpRbMI4WFQsfgLOCV+X9uzUa29D677y//46t/EDSuQTHyBZbl
|
||||
AcNMENkpMWZsH7J/+F19+U0/Hd5bJgneVRkCAwEAAaNQME4wHQYDVR0OBBYEFKDN
|
||||
SZtt47ttOBDQzIchFYyxsg3mMB8GA1UdIwQYMBaAFKDNSZtt47ttOBDQzIchFYyx
|
||||
sg3mMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBABaZctNrn4gLmNf/
|
||||
eNJ3x5CJIPjPwm6j9nwKhtadJ6BF+TIzSkJuHSgxULjW436F37otv94NPzT5PCBF
|
||||
WxgXoqgLqnWwvsaqC4LUEjsZviWW4CB824YDUquEUVGFLE/U5KTZ7Kh1ceyUk4N8
|
||||
+mtkXkanWoBBk0OF24lNrAsNLB63yTLr9HxEe75+kmvxf1qVJUGtaOEWIhiFMiAB
|
||||
5D4w/j2EFWktumjuy5TTwU0zhl52bc8V9SNixM1IaqzNrVPrdjv8viUX548pU3WT
|
||||
xZ5ylDsxhMC1q4BXQVeIY8C0cMEX+WHOmOCvWrkxCkP91pKsSPkuVrWlzrkn8Ojo
|
||||
swP6sBw=
|
||||
-----END CERTIFICATE-----
|
||||
@@ -0,0 +1,28 @@
|
||||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCt5D3fY8703LUy
|
||||
AN1zWVb/XBxw2wHOp0wX3WafZrTzk5Fxab8gm5C9EIzqINPtab/A+3RXj+KbVl1O
|
||||
Qk9yJr2j0ftenQLTEXLMRK+auM4nic8dzuobi1AWtZPsa8416Uc5HDsrJnPH08bd
|
||||
LQMGw4CdgAOU5Vy03Fcm+xpifoZeQo54aBuTTS65KiO0tvXNVN7qJI/EO4c2o9E1
|
||||
Ebv7geWSDAi2WPShQ7oKmhHL5lMiYg9H7lerADv+JKYmVDp4VfP8VqUWzCOFhULH
|
||||
4Czglfl/bs1GtvQ+u+8v/+OrfxA0rkEx8gWW5QHDTBDZKTFmbB+yf/hdfflNPx3e
|
||||
WyYJ3lUZAgMBAAECggEBAJTnCBBdUB+fSs1prjeS/gsmnfgJoY+K9H7PCIxgj3yw
|
||||
FXAvZAmRDKzJGlF2EOOQlTG0YNiGDj6EAtv7rjoKcINyULSg8IU6wLmn61MrAuUa
|
||||
fa+Bujgh4E/B5swhOHAztNhzkzsM70Hi17wXSislh+HWd7qteOgqcbqgdOR4gaj+
|
||||
HUqtcxG3H3hCL3dWugnjLZMtestLKGHSSZvbQNjYM3kKy2LvO8NpxmDE4a+TXygK
|
||||
qhaZjmS/dc/nJBJzOfkzby58RvGbzlJflfW/Uu3/gizj13GFQKWonq1xh630RAhv
|
||||
xX5ySok2aAx/+/SiJSpNXvM09grQuoORSr7D1tm+5rECgYEA3vf0hRfua0XAOu6f
|
||||
pyzNvLRRJ/pEew7XpNPCyS2TuMTd1yvXjGVxQfP46N6x1IM3SRU0zE+LSk80EF7l
|
||||
u1Or7GyCEhabYNe/7P2F8ENP73Do0HwvcI1jGrgr6r9oK0J27Xei+f6Q0bgJOPI2
|
||||
qaLj+V37cOjkNSM1mhTjtDwK8k0CgYEAx6cMrkjHl1+lDIIOc3qAEL3jb3xQveYk
|
||||
WrMF/B+j048k6boU4VvFJAIyQxOxMNxLjw3/9+zXCFJT4WaZK3TMXlg614ASGx3H
|
||||
tKjJM9O07ywwMq1gbutFS4nHCg3L3Os6esL0SPwMdATR3Yh22n5OGI9o+/aURulL
|
||||
GPEXef1Z2/0CgYEAgmwp5LxV4vu+8Pnp+4DSq4ISQr861XyeGTUhKEp3sUm+tgFY
|
||||
KTChakHKpHS3Mqa6bQ5xft08je/8dWL9IHFWDIqAHxKIOsKY6oh1k0/cbyPtmx45
|
||||
Ja4efV+jmMHzrfJH3KnxdCg7D+GFy4CrBtlYXuJhlO81pft9fC6h7yh8ArUCgYBq
|
||||
gvkl5Zftbs4rnRq+iqTVyagTKvwcQzIz3PwdZHfO/rfPpUFMdNv4eN99n3zRN0Vs
|
||||
HSjoiEazntA3GLgwUdBRqLpDi4SdSMbo337vkksdqbJQ5uPiaMuAIBG6kF+pDSkW
|
||||
ovkWErlGD+gySoI10FozihaVDRhPuFgjB0PiBcIxtQKBgGNSzX+Bx5+ux1Qny0Sn
|
||||
SUcBtepLnO8M8wafoGNyehbMnLzfuMbaDiJOdozGlBNHZTtPB3r4AYb8WnltdKW0
|
||||
7i3fk26YZGiMVeUJvewA6/LOBEaqMdwoNwnoptvbR6ehHeE/PPtRtge2cD3bPIM7
|
||||
U9VlWgfgj9Dxfwhslqb9hmyp
|
||||
-----END PRIVATE KEY-----
|
||||
@@ -0,0 +1,39 @@
|
||||
require('./web-adapter');
|
||||
|
||||
<% if(polyfillsBundleFile) { %>
|
||||
// Polyfills bundle.
|
||||
require("<%= polyfillsBundleFile %>");
|
||||
<% } %>
|
||||
|
||||
// SystemJS support.
|
||||
require("<%= systemJsBundleFile %>");
|
||||
|
||||
// hack for Xiaomi havent screen;
|
||||
screen = window.screen;
|
||||
|
||||
// Adjust initial canvas size
|
||||
if (canvas && window.devicePixelRatio >= 2) {canvas.width *= 2; canvas.height *= 2;}
|
||||
|
||||
const importMap = require("./<%= importMapFile%>").default;
|
||||
System.warmup({
|
||||
importMap,
|
||||
importMapUrl: '<%= importMapFile%>',
|
||||
defaultHandler: (urlNoSchema) => {
|
||||
require('.' + urlNoSchema);
|
||||
},
|
||||
});
|
||||
|
||||
System.import('<%= applicationJs %>').then(({ Application }) => {
|
||||
return new Application();
|
||||
}).then((application) => {
|
||||
return onApplicationCreated(application);
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
function onApplicationCreated(application) {
|
||||
return System.import('cc').then((cc) => {
|
||||
require('./engine-adapter');
|
||||
return application.init(cc);
|
||||
}).then(() => application.start());
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"package": "",
|
||||
"name": "",
|
||||
"versionName": "1.0.0",
|
||||
"versionCode": 1201,
|
||||
"minPlatformVersion": 1056,
|
||||
"icon": "/image/icon.png",
|
||||
"orientation": "portrait",
|
||||
"type": "game",
|
||||
"config": {},
|
||||
"display": {},
|
||||
"subpackages": []
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "xiaomi-adapter",
|
||||
"version": "1.0.0",
|
||||
"build-template": "xiaomigame",
|
||||
"scripts": {
|
||||
"build": "quickgame build --cocos-wx-game --include-file-ext .pem,.pkm,.webp,.astc",
|
||||
"build-ignore-res": "quickgame build --cocos-wx-game --include-file-ext .pem,.pkm,.webp,.astc --ignore remote,res",
|
||||
"release": "quickgame release --cocos-wx-game --include-file-ext .pem,.pkm,.webp,.astc",
|
||||
"release-ignore-res": "quickgame release --cocos-wx-game --include-file-ext .pem,.pkm,.webp,.astc --ignore remote,res",
|
||||
"server": "quickgame server",
|
||||
"debug": "quickgame debug"
|
||||
},
|
||||
"babel": {
|
||||
"plugins": [
|
||||
"babel-plugin-transform-remove-strict-mode"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"quickgame-cli": "^0.1.19"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user