Commit 0b7db6f0 authored by 俞嘉婷's avatar 俞嘉婷

feat: 白屏问题

parent 4091657d
import { assetManager, getError } from "cc";
export function initFixed() {
assetManager.downloader.downloadDomImage = function downloadDomImage(
url: string,
options: Record<string, any>,
onComplete: ((err: Error | null, data?: HTMLImageElement | null) => void),
): HTMLImageElement {
const img = new window.Image();
// NOTE: on xiaomi platform, we need to force setting img.crossOrigin as 'anonymous'
if (location.protocol !== "file:") {
// img.crossOrigin = 'anonymous';
}
if(location.hostname == "localhost"){
img.crossOrigin = 'anonymous';
}
function loadCallback(): void {
img.removeEventListener("load", loadCallback);
img.removeEventListener("error", errorCallback);
if (onComplete) { onComplete(null, img); }
}
function errorCallback(): void {
img.removeEventListener("load", loadCallback);
img.removeEventListener("error", errorCallback);
if (onComplete) { onComplete(new Error(getError(4930, url))); }
}
img.addEventListener("load", loadCallback);
img.addEventListener("error", errorCallback);
img.src = url;
return img;
};
const types = [
".png",
".jpg",
".bmp",
".jpeg",
".gif",
".ico",
".tiff",
".webp",
".image",
".pvr",
".pkm",
".astc",
];
types.forEach((type) => {
assetManager.downloader.register(type, assetManager.downloader.downloadDomImage);
});
}
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "cca334f4-8d82-4ac3-bb05-0e67e7630aa4",
"files": [],
"subMetas": {},
"userData": {}
}
......@@ -22,6 +22,7 @@ import { getPreLoadList, preload } from "../Scripts/Utils/LoaderTools";
import { runMainPage } from "../Scripts/Scenes/runMain/runMainPage";
import ShareCenter from "../Scripts/ShareCenter";
import { initWx } from "../Scripts/Utils/Share";
import { initFixed } from "./Fixed";
const { ccclass, property } = _decorator;
......@@ -42,6 +43,8 @@ export class Start extends Component {
async onLoad() {
// game.frameRate = _FPS;
initFixed();
// 预览调试时,显示性能统计面板
if (PREVIEW) {
profiler.showStats();
......
......@@ -106,12 +106,12 @@
}
</style>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1736691204400/src/assets/plugin/zepto.min.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1736691204400/src/assets/plugin/declare-process.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1736691204400/src/assets/plugin/SVGA.Lite.v2.1.1.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1736691204400/src/assets/plugin/jszip.min.v3.10.1.js"></script>
<link rel="stylesheet" type="text/css" href="//yun.duiba.com.cn/db_games/ccc_game/template3d/1736691204400/style.css" />
<link rel="stylesheet" type="text/css" href="//yun.duiba.com.cn/db_games/ccc_game/template3d/1736691204400/custom.css" />
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1737368104075/src/assets/plugin/zepto.min.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1737368104075/src/assets/plugin/declare-process.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1737368104075/src/assets/plugin/SVGA.Lite.v2.1.1.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1737368104075/src/assets/plugin/jszip.min.v3.10.1.js"></script>
<link rel="stylesheet" type="text/css" href="//yun.duiba.com.cn/db_games/ccc_game/template3d/1737368104075/style.css" />
<link rel="stylesheet" type="text/css" href="//yun.duiba.com.cn/db_games/ccc_game/template3d/1737368104075/custom.css" />
<!-- <script src="//yun-duiba-credits-test.duibatest.com.cn/TNGD_GAMES/libs/eruda.min.js"></script>-->
<!-- <script>eruda.init()</script>-->
......@@ -125,20 +125,20 @@
</div>
<!-- Polyfills bundle. -->
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1736691204400/src/polyfills.bundle.js" charset="utf-8"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1737368104075/src/polyfills.bundle.js" charset="utf-8"></script>
<!-- SystemJS support. -->
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1736691204400/src/system.bundle.js" charset="utf-8"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1737368104075/src/system.bundle.js" charset="utf-8"></script>
<script src="https://yun.duiba.com.cn/aurora/assets/03cc8b25df7f900745f5db17effa0eccc2ae724e.js"></script>
<!-- Import map -->
<!--<script src="https://yun.duiba.com.cn/db_games/ccc_game/template3d/1736691204400/src/import-map.json" type="systemjs-importmap" charset="utf-8"></script>-->
<!--<script src="https://yun.duiba.com.cn/db_games/ccc_game/template3d/1737368104075/src/import-map.json" type="systemjs-importmap" charset="utf-8"></script>-->
<script type="systemjs-importmap" charset="utf-8">
{"imports":{"cc":"//yun.duiba.com.cn/db_games/ccc_game/template3d/1736691204400/cocos-js/cc.js"}}
{"imports":{"cc":"//yun.duiba.com.cn/db_games/ccc_game/template3d/1737368104075/cocos-js/cc.js"}}
</script>
<script>
System.import('//yun.duiba.com.cn/db_games/ccc_game/template3d/1736691204400/index.js').catch(function (err) {
System.import('//yun.duiba.com.cn/db_games/ccc_game/template3d/1737368104075/index.js').catch(function (err) {
console.error(err);
})
</script>
......
......@@ -35,7 +35,7 @@
"thumbnail": "https://yun.duiba.com.cn/polaris/thumb.68900332d31453cda9bdf783b9ef7e7042c3c6ac.png"
}
],
"bindCardUrl": "{ \"appUrl\": \"80\", \"weixinUrl\": \"80\"}",
"bindCardUrl": "{ \"appUrl\": \"90\", \"weixinUrl\": \"80\"}",
"appKey": "8888",
"centerUrl": "https://activity.m.duiba.com.cn/customShare/share?id=Did1NTQ4NDc"
}
......
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