Commit f9542e93 authored by wildfirecode13's avatar wildfirecode13

1

parent 232ff81b
...@@ -311,7 +311,7 @@ export namespace RES { ...@@ -311,7 +311,7 @@ export namespace RES {
let mark = true; let mark = true;
for (var i = 0; i < countAll; i++) { for (var i = 0; i < countAll; i++) {
let resName = arr[i]['url']; let resName = arr[i]['url'];
getResAsync(resName, (res, str) => { getResAsync("https:"+resName, (res, str) => {
//标记失败,如果有一项资源加载失败,标记下 //标记失败,如果有一项资源加载失败,标记下
if (!res) mark = false if (!res) mark = false
if (++count == countAll) callback(mark); if (++count == countAll) callback(mark);
......
...@@ -75,6 +75,7 @@ export class Main { ...@@ -75,6 +75,7 @@ export class Main {
// RES.loadSkinConfig(SkinJson); // RES.loadSkinConfig(SkinJson);
//加载通用资源 //加载通用资源
// await RES.loadGroup("common"); // await RES.loadGroup("common");
await RES.loadSparkAssets(resCanvasList); await RES.loadSparkAssets(resCanvasList);
console.log("通用资源加载完成") console.log("通用资源加载完成")
//打开开始场景 //打开开始场景
......
{ {
"pages": ["pages/pagecanvas/pagecanvas", "pages/pagemycanvaspage/pagemycanvaspage"], "pages": ["pages/pagecanvas/pagecanvas"],
"window": { "window": {
"enableSkia": "true", "enableSkia": "true",
"allowsBounceVertical":"NO" "allowsBounceVertical":"NO"
......
...@@ -128,10 +128,13 @@ var RES; ...@@ -128,10 +128,13 @@ var RES;
} }
var p = new Promise(function (resolve, reject) { var p = new Promise(function (resolve, reject) {
loadResList(function (s) { loadResList(function (s) {
console.log("恶趣味群翁群")
if (s) { if (s) {
console.lo('res')
resolve(); resolve();
} }
else { else {
console.lo('rej')
reject(); reject();
} }
}, list); }, list);
...@@ -173,8 +176,10 @@ var RES; ...@@ -173,8 +176,10 @@ var RES;
RES.loadGroup = loadGroup; RES.loadGroup = loadGroup;
function getResAsync(str, comFun, thisObj) { function getResAsync(str, comFun, thisObj) {
var type = str.substring(str.lastIndexOf(".") + 1, str.length); var type = str.substring(str.lastIndexOf(".") + 1, str.length);
console.log("奥术大师多"+str)
if (type == "png" || type == "jpg") { if (type == "png" || type == "jpg") {
if (FYGE.TextureCache[str]) { if (FYGE.TextureCache[str]) {
console.log("奥术大师多"+str)
comFun && comFun.call(thisObj, FYGE.TextureCache[str], str); comFun && comFun.call(thisObj, FYGE.TextureCache[str], str);
new Promise(function (r) { new Promise(function (r) {
r(FYGE.TextureCache[str]); r(FYGE.TextureCache[str]);
...@@ -183,13 +188,16 @@ var RES; ...@@ -183,13 +188,16 @@ var RES;
else { else {
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
FYGE.GlobalLoader.loadImage(function (s, image) { FYGE.GlobalLoader.loadImage(function (s, image) {
// console.log("asdasdasdqqqq"+str,s)
if (s) { if (s) {
FYGE.Texture.addToCache(FYGE.Texture.from(image), str); FYGE.Texture.addToCache(FYGE.Texture.from(image), str);
comFun && comFun.call(thisObj, FYGE.TextureCache[str], str); comFun && comFun.call(thisObj, FYGE.TextureCache[str], str);
console.log("asdasdasdqqqq"+str,s)
resolve(FYGE.TextureCache[str]); resolve(FYGE.TextureCache[str]);
} }
else { else {
comFun && comFun.call(thisObj, null, str); comFun && comFun.call(thisObj, null, str);
console.log("zxczxczxc"+str,s)
reject(); reject();
} }
}, str); }, str);
...@@ -260,11 +268,17 @@ var RES; ...@@ -260,11 +268,17 @@ var RES;
var mark = true; var mark = true;
for (var i = 0; i < countAll; i++) { for (var i = 0; i < countAll; i++) {
var resName = arr[i]['url']; var resName = arr[i]['url'];
getResAsync(resName, function (res, str) { console.log(resName)
getResAsync("https:"+resName, function (res, str) {
console.log("asdasdasdas",res)
if (!res) if (!res)
mark = false; mark = false;
if (++count == countAll) if (++count == countAll){
callback(mark); console.log("玩儿若:asasdd")
callback(mark);
}
console.log("玩儿若:"+count,countAll)
}, this); }, this);
} }
} }
...@@ -1261,6 +1275,7 @@ var Main = (function () { ...@@ -1261,6 +1275,7 @@ var Main = (function () {
case 0: case 0:
layers_1.layers.init(this.stage); layers_1.layers.init(this.stage);
console.log("初始化层级完成"); console.log("初始化层级完成");
console.log("resCanvasList_1.default:",resCanvasList_1.default)
return [4, RES_1.RES.loadSparkAssets(resCanvasList_1.default)]; return [4, RES_1.RES.loadSparkAssets(resCanvasList_1.default)];
case 1: case 1:
_a.sent(); _a.sent();
......
.mycanvaspage {
top: 0rpx;
left: 0rpx;
width: 750rpx;
height: 1624rpx;
display: block;
position: absolute;
}
.mycanvaspage .canvas {
width: 300rpx;
height: 300rpx;
opacity: 1;
display: block;
left: 0rpx;
top: 0rpx;
position: absolute;
}
<view class="mycanvaspage">
<view>
<canvas id="canvas" type="2d" class="canvas" disable-scroll="true" onTouchStart="onMouseEvent" onTouchMove="onMouseEvent" onTouchEnd="onMouseEvent" onReady="onCanvasReady"></canvas>
</view>
</view>
\ No newline at end of file
'use strict';
import resList from '../../resconfig/resList'; //import API from '../../api';
Page({
data: {},
onLoad(props) {
this.setData(this.data || {
resList: resList
});
}
});
\ No newline at end of file
{
"usingComponents": {}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment