Initial commit: Client Doc docs Server Tools

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
ud18010
2026-07-10 10:24:29 +08:00
co-authored by Cursor
commit 7e35d8da31
3374 changed files with 680813 additions and 0 deletions
@@ -0,0 +1,140 @@
/* eslint-disable no-multi-assign */
/* eslint-disable @typescript-eslint/naming-convention */
const { version, SDKVersion, platform, system } = wx.getSystemInfoSync();
const accountInfo = wx.getAccountInfoSync();
const envVersion = accountInfo?.miniProgram?.envVersion;
function compareVersion(v1, v2) {
if (!v1 || !v2) {
return false;
}
return (v1
.split('.')
.map(v => v.padStart(2, '0'))
.join('')
>= v2
.split('.')
.map(v => v.padStart(2, '0'))
.join(''));
}
export const isPc = platform === 'windows' || platform === 'mac';
export const isIOS = platform === 'ios';
export const isAndroid = platform === 'android';
export const isDevtools = platform === 'devtools';
export const isMobile = !isPc && !isDevtools;
export const isDevelop = envVersion === 'develop';
// 是否禁止**开通了高性能模式**的小游戏在不支持的iOS设备上回退成普通模式,回退可能导致无法正常体验游戏
// @ts-ignore
const disableHighPerformanceFallback = $DISABLE_HIGHPERFORMANCE_FALLBACK && isIOS;
// 是否iOS高性能模式
export const isH5Renderer = GameGlobal.isIOSHighPerformanceMode;
// 操作系统版本号
const systemVersionArr = system ? system.split(' ') : [];
const systemVersion = systemVersionArr.length ? systemVersionArr[systemVersionArr.length - 1] : '';
// pc微信版本号不一致,需要>=3.3
const isPcWeChatVersionValid = compareVersion(version, '3.3');
// 支持unity小游戏,需要基础库>=2.14.0,但低版本基础库iOS存在诸多问题,将版本最低版本提高到2.17.0
const isLibVersionValid = compareVersion(SDKVersion, '2.17.0');
// 如果是iOS高性能模式,基础库需要>=2.23.1
const isH5LibVersionValid = compareVersion(SDKVersion, '2.23.1');
// 压缩纹理需要iOS系统版本>=14.0,检测到不支持压缩纹理时会提示升级系统
const isIOSH5SystemVersionValid = compareVersion(systemVersion, '14.0');
// iOS系统版本>=15支持webgl2
const isIOSWebgl2SystemVersionValid = compareVersion(systemVersion, '15.0');
// 是否用了webgl2
const isWebgl2 = () => GameGlobal.managerConfig.contextConfig.contextType === 2;
// 是否支持BufferURL
export const isSupportBufferURL = !isPc
&& (isH5Renderer
? compareVersion(SDKVersion, '2.29.1') && compareVersion(version, '8.0.30')
: typeof wx.createBufferURL === 'function');
// 安卓innerAudio支持playbackRate
export const isSupportPlayBackRate = !isAndroid || compareVersion(version, '8.0.23');
// IOS innerAudio支持复用时再次触发onCanplay
export const isSupportCacheAudio = !isIOS || compareVersion(version, '8.0.31');
// // 安卓旧客户端版本innerAudio偶现会导致闪退,大于等于8.0.38才使用innerAudio减少内存
export const isSupportInnerAudio = compareVersion(version, '8.0.38');
// 检查是否支持brotli压缩,pc基础库>=2.29.2,真机基础库>=2.21.1
// @ts-ignore
const isPcBrotliInvalid = isPc && !compareVersion(SDKVersion, $LOAD_DATA_FROM_SUBPACKAGE ? '2.29.2' : '2.32.3');
const isMobileBrotliInvalid = isMobile && !compareVersion(SDKVersion, '2.21.1');
// @ts-ignore
const isBrotliInvalid = $COMPRESS_DATA_PACKAGE && (isPcBrotliInvalid || isMobileBrotliInvalid);
// 是否能以iOS高性能模式运行
// 请勿修改GameGlobal.canUseH5Renderer赋值!!!
GameGlobal.canUseH5Renderer = isH5Renderer && isH5LibVersionValid;
// iOS高性能模式定期GC
GameGlobal.canUseiOSAutoGC = isH5Renderer && compareVersion(SDKVersion, '2.32.1');
// pc微信版本不满足要求
const isPcInvalid = isPc && !isPcWeChatVersionValid;
// 移动设备基础库版本或客户端版本不支持运行unity小游戏
const isMobileInvalid = isMobile && !isLibVersionValid;
// 基础库/客户端不支持iOS高性能模式
const isIOSH5Invalid = (isH5Renderer && !isH5LibVersionValid) || (!isH5Renderer && disableHighPerformanceFallback);
// 客户端/基础库是否支持VideoDecoder,开发者工具不支持
export const isSupportVideoDecoder = compareVersion(version, '8.0.38') && ((isIOS && compareVersion(SDKVersion, '3.1.1')) || (isAndroid && compareVersion(SDKVersion, '3.0.0'))) && !isDevtools;
// 视情况添加,没用到对应能力就不需要判断
// 是否支持webgl2
const isWebgl2SystemVersionInvalid = () => isIOS && isWebgl2() && !isIOSWebgl2SystemVersionValid;
// IOS高性能模式2.25.3以上基础库需要手动启动webAudio
export const webAudioNeedResume = compareVersion(SDKVersion, '2.25.3') && isH5Renderer;
// 满足iOS高性能条件,但未开通高性能模式
const needToastEnableHpMode = isDevelop && isIOS && isH5LibVersionValid && isIOSH5SystemVersionValid && !isH5Renderer;
/**
* 判断环境是否可使用coverview
* coverview实际需要基础库版本>=2.16.1,但因为移动端要>=2.17.0才能运行,所以移动端基本都支持coverview
*
* @export
* @returns
*/
export function canUseCoverview() {
return isMobile || isDevtools;
}
if (needToastEnableHpMode) {
console.error('此AppID未开通高性能模式\n请前往mp后台-能力地图-开发提效包-高性能模式开通\n可大幅提升游戏运行性能');
// setTimeout(() => {
// wx.showModal({
// title: '[开发版提示]建议',
// content: '此AppID未开通高性能模式\n请前往mp后台-能力地图-开发提效包-高性能模式开通\n可大幅提升游戏运行性能',
// showCancel: false,
// })
// }, 10000);
}
export default () => new Promise((resolve) => {
if (!isDevtools) {
if (isPcInvalid
|| isMobileInvalid
|| isIOSH5Invalid
|| isWebgl2SystemVersionInvalid()
|| isBrotliInvalid) {
let updateWechat = true;
let content = '当前微信版本过低\n请更新微信后进行游戏';
if (isIOS) {
if (!isIOSH5SystemVersionValid || isWebgl2SystemVersionInvalid()) {
content = '当前操作系统版本过低\n请更新iOS系统后进行游戏';
updateWechat = false;
}
}
wx.showModal({
title: '提示',
content,
showCancel: false,
confirmText: updateWechat ? '更新微信' : '确定',
success(res) {
if (res.confirm) {
const showUpdateWechat = updateWechat && typeof wx.createBufferURL === 'function';
if (showUpdateWechat) {
wx.updateWeChatApp();
}
else {
wx.exitMiniProgram({
success: () => { },
});
}
}
},
});
return resolve(false);
}
}
return resolve(true);
});
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9f1e4ac2f6ed7a3478514f2bae33e0b8
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 74d9b23196bd5cd4ba4aff87f672f84a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 99ca7590587edd34185ff4ec04f8e131
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,219 @@
// @ts-nocheck
/* eslint-disable no-prototype-builtins */
/* eslint-disable no-unused-vars */
/* eslint-disable no-undef */
import './weapp-adapter';
import 'texture-config.js';
import unityNamespace from './unity-namespace';
import './$GAME_NAME.wasm.framework.unityweb';
import './unity-sdk/index.js';
import checkVersion from './check-version';
import { launchEventType, scaleMode } from './plugin-config';
import { preloadWxCommonFont } from './unity-sdk/font/index';
function checkUpdate() {
const updateManager = wx.getUpdateManager();
updateManager.onCheckForUpdate(() => {
// 请求完新版本信息的回调
// console.log(res.hasUpdate)
});
updateManager.onUpdateReady(() => {
wx.showModal({
title: '更新提示',
content: '新版本已经准备好,是否重启应用?',
success(res) {
if (res.confirm) {
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
updateManager.applyUpdate();
}
},
});
});
updateManager.onUpdateFailed(() => {
// 新版本下载失败
});
}
if ($NEED_CHECK_UPDATE) {
checkUpdate();
}
const managerConfig = {
DATA_FILE_MD5: '$DATA_MD5',
CODE_FILE_MD5: '$CODE_MD5',
GAME_NAME: '$GAME_NAME',
APPID: '$APP_ID',
DATA_FILE_SIZE: "$DATA_FILE_SIZE",
OPT_DATA_FILE_SIZE: "$OPT_DATA_FILE_SIZE",
DATA_CDN: '$DEPLOY_URL',
// 资源包是否作为小游戏分包加载
loadDataPackageFromSubpackage: $LOAD_DATA_FROM_SUBPACKAGE,
// 资源包放小游戏分包加载时,是否br压缩
compressDataPackage: $COMPRESS_DATA_PACKAGE,
// 需要在网络空闲时预加载的资源,支持如下形式的路径
preloadDataList: [
// 'DATA_CDN/StreamingAssets/WebGL/textures_8d265a9dfd6cb7669cdb8b726f0afb1e',
// '/WebGL/sounds_97cd953f8494c3375312e75a29c34fc2'
'$PRELOAD_LIST',
],
contextConfig: {
contextType: $WEBGL_VERSION, // 1=>webgl1 2=>webgl2 3=>auto
},
};
GameGlobal.managerConfig = managerConfig;
// 版本检查
checkVersion().then((enable) => {
if (enable) {
// eslint-disable-next-line @typescript-eslint/naming-convention
let UnityManager;
try {
// @ts-ignore
UnityManager = requirePlugin('UnityPlugin', {
enableRequireHostModule: true,
customEnv: {
wx,
unityNamespace,
document,
canvas,
},
}).default;
}
catch (error) {
if (error.message.indexOf('not defined') !== -1) {
console.error('!!!插件需要申请才可使用\n请勿使用测试AppID,并登录 https://mp.weixin.qq.com/ 并前往:能力地图-开发提效包-快适配 开通\n阅读文档获取详情:https://github.com/wechat-miniprogram/minigame-unity-webgl-transform/blob/main/Design/Transform.md');
}
}
// JS堆栈能显示更完整
Error.stackTraceLimit = Infinity;
Object.assign(managerConfig, {
// callmain结束后立即隐藏封面视频
hideAfterCallmain: $HIDE_AFTER_CALLMAIN,
loadingPageConfig: {
// 以下是默认值
totalLaunchTime: 15000,
/**
* !!注意:修改设计宽高和缩放模式后,需要修改文字和进度条样式。默认设计尺寸为667*375
*/
designWidth: 0,
designHeight: 0,
scaleMode: scaleMode.default,
// 以下配置的样式,尺寸相对设计宽高
textConfig: {
firstStartText: '首次加载请耐心等待',
downloadingText: ['正在加载资源'],
compilingText: '编译中',
initText: '初始化中',
completeText: '开始游戏',
textDuration: 1500,
// 文字样式
style: {
bottom: 64,
height: 24,
width: 240,
lineHeight: 24,
color: '#ffffff',
fontSize: 12,
},
},
// 进度条样式
barConfig: {
style: {
width: 240,
height: 24,
padding: 2,
bottom: 64,
backgroundColor: '#07C160',
},
},
// 一般不修改,控制icon样式
iconConfig: {
visible: true,
style: {
width: 64,
height: 23,
bottom: 20,
},
},
// 加载页的素材配置
materialConfig: {
// 背景图或背景视频,两者都填时,先展示背景图,视频可播放后,播放视频
backgroundImage: '$BACKGROUND_IMAGE',
backgroundVideo: '$LOADING_VIDEO_URL',
iconImage: 'images/unity_logo.png', // icon图片,一般不更换
},
},
});
GameGlobal.managerConfig = managerConfig;
const gameManager = new UnityManager(managerConfig);
gameManager.onLaunchProgress((e) => {
// interface LaunchEvent {
// type: LaunchEventType;
// data: {
// costTimeMs: number; // 阶段耗时
// runTimeMs: number; // 总耗时
// loadDataPackageFromSubpackage: boolean; // 首包资源是否通过小游戏分包加载
// isVisible: boolean; // 当前是否处于前台,onShow/onHide
// useCodeSplit: boolean; // 是否使用代码分包
// isHighPerformance: boolean; // 是否iOS高性能模式
// needDownloadDataPackage: boolean; // 本次启动是否需要下载资源包
// };
// }
if (e.type === launchEventType.launchPlugin) {
}
if (e.type === launchEventType.loadWasm) {
}
if (e.type === launchEventType.compileWasm) {
}
if (e.type === launchEventType.loadAssets) {
}
if (e.type === launchEventType.readAssets) {
}
if (e.type === launchEventType.prepareGame) {
}
});
gameManager.onModulePrepared(() => {
// eslint-disable-next-line no-restricted-syntax
for (const key in unityNamespace) {
// 动态修改DATA_CDN后,同步修改全局对象
if (!GameGlobal.hasOwnProperty(key) || key === 'DATA_CDN') {
GameGlobal[key] = unityNamespace[key];
}
else {
}
}
managerConfig.DATA_CDN = GameGlobal.DATA_CDN;
gameManager.assetPath = `${(managerConfig.DATA_CDN || '').replace(/\/$/, '')}/Assets`;
preloadWxCommonFont();
});
// 上报初始化信息
const systeminfo = wx.getSystemInfoSync();
const bootinfo = {
renderer: systeminfo.renderer || '',
isH5Plus: GameGlobal.isIOSHighPerformanceModePlus || false,
abi: systeminfo.abi || '',
brand: systeminfo.brand,
model: systeminfo.model,
platform: systeminfo.platform,
system: systeminfo.system,
version: systeminfo.version,
SDKVersion: systeminfo.SDKVersion,
benchmarkLevel: systeminfo.benchmarkLevel,
};
wx.getRealtimeLogManager().info('game starting', bootinfo);
wx.getLogManager({ level: 0 }).info('game starting', bootinfo);
console.info('game starting', bootinfo);
// 默认上报小游戏实时日志与用户反馈日志(所有error日志+小程序框架异常)
wx.onError((result) => {
gameManager.printErr(result.message);
});
gameManager.onLogError = function (err) {
GameGlobal.realtimeLogManager.error(err);
GameGlobal.logmanager.warn(err);
};
// iOS高性能模式定期GC
if (GameGlobal.canUseiOSAutoGC && unityNamespace.iOSAutoGCInterval !== 0) {
setInterval(() => {
wx.triggerGC();
}, unityNamespace.iOSAutoGCInterval);
}
gameManager.startGame();
GameGlobal.manager = gameManager;
}
});
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 74bb09d1fe7cfd64dbb73300232fdcf7
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,53 @@
{
"deviceOrientation": "$ORIENTATION",
"openDataContext": "open-data",
"iOSHighPerformance": true,
"subpackages": [
{
"name": "wasmcode",
"root": "wasmcode/"
},
{
"name": "data-package",
"root": "data-package/"
}
],
"parallelPreloadSubpackages": [
{
"name": "wasmcode"
},
{
"name": "data-package"
}
],
"plugins": {
"UnityPlugin": {
"version": "1.2.31",
"provider": "wxe5a48f1ed5f544b7",
"contexts": [
{
"type": "isolatedContext"
}
]
},
"Layout": {
"version": "1.0.5",
"provider": "wx7a727ff7d940bb3f",
"contexts": [
{
"type": "openDataContext"
}
]
},
"MiniGameChat": {
"version": "latest",
"provider": "wx2ea687f4258401a9",
"contexts": [
{
"type": "isolatedContext"
}
]
}
},
"workers": "workers"
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 7ea580c271cce2d4c8504756657550d9
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0c012a7d1fa38f94e9cbf8375ae74eb6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

@@ -0,0 +1,158 @@
fileFormatVersion: 2
guid: 943c68d5858ac4b4f8ea7653c62e3cb1
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WeixinMiniGame
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@@ -0,0 +1,158 @@
fileFormatVersion: 2
guid: aceb03d49dfdccf408f5545ab10213b3
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WeixinMiniGame
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1c2d677641596ff4b9b084863beeeb96
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 17ed733eade086c40ad4ad50023ce754
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,124 @@
/* eslint-disable no-param-reassign */
import { getCurrTime, promisify } from './utils';
const getFriendCloudStorage = promisify(wx.getFriendCloudStorage);
const getGroupCloudStorage = promisify(wx.getGroupCloudStorage);
const setUserCloudStorage = promisify(wx.setUserCloudStorage);
const getUserInfo = promisify(wx.getUserInfo);
/**
* 获取用户信息
* API文档可见:https://developers.weixin.qq.com/minigame/dev/api/open-api/data/OpenDataContext-wx.getUserInfo.html
*/
export function getSelfData() {
return getUserInfo({
openIdList: ['selfOpenId'],
}).then((res) => res.data[0] || {});
}
let getSelfPromise;
/**
* 将 UserGameData 数据反序列化
* @param { UserGameData } item
* https://developers.weixin.qq.com/minigame/dev/api/open-api/data/UserGameData.html
*/
function getWxGameData(item) {
let source;
try {
source = JSON.parse(item.KVDataList[0].value);
}
catch (e) {
source = {
wxgame: {
score: 0,
update_time: getCurrTime(),
},
};
}
return source.wxgame;
}
/**
* 处理 getFriendCloudStorage 和 getGroupCloudStorage 返回的在玩好友数据
*/
function rankDataFilter(res, selfUserInfo = false) {
const data = (res.data || []).filter((item) => item.KVDataList && item.KVDataList.length);
return data
.map((item) => {
const { score, update_time: updateTime } = getWxGameData(item);
item.score = score;
item.update_time = updateTime;
/**
* 请注意,这里判断是否为自己并不算特别严谨的做法
* 比较严谨的做法是从游戏域将openid传进来,示例为了简化,简单通过 avatarUrl 来判断
*/
if (selfUserInfo && selfUserInfo.avatarUrl === item.avatarUrl) {
item.isSelf = true;
}
return item;
})
// 升序排序
.sort((a, b) => b.score - a.score);
}
/**
* 获取好友排行榜列表
* API文档可见:https://developers.weixin.qq.com/minigame/dev/api/open-api/data/wx.getFriendCloudStorage.html
*/
export function getFriendRankData(key, needMarkSelf = true) {
console.log('[WX OpenData] getFriendRankData with key: ', key);
return getFriendCloudStorage({
keyList: [key],
}).then((res) => {
console.log('[WX OpenData] getFriendRankData success: ', res);
if (needMarkSelf) {
getSelfPromise = getSelfPromise || getSelfData();
return getSelfPromise.then(userInfo => rankDataFilter(res, userInfo));
}
return rankDataFilter(res);
});
}
/**
* 获取群同玩成员的游戏数据。小游戏通过群分享卡片打开的情况下才可以调用。该接口需要用户授权,且只在开放数据域下可用。
* API文档可见: https://developers.weixin.qq.com/minigame/dev/api/open-api/data/wx.getGroupCloudStorage.html
*/
export function getGroupFriendsRankData(shareTicket, key, needMarkSelf = true) {
console.log('[WX OpenData] getGroupFriendsRankData with shareTicket and key: ', shareTicket, key);
return getGroupCloudStorage({
shareTicket,
keyList: [key],
}).then((res) => {
console.log('[WX OpenData] getGroupFriendsRankData success: ', res);
if (needMarkSelf) {
getSelfPromise = getSelfPromise || getSelfData();
return getSelfPromise.then(userInfo => rankDataFilter(res, userInfo));
}
return rankDataFilter(res);
});
}
/**
* 写入用户排行榜数据,value 的值一般只需要为 Object 经过 JSON.stringify 的字符串即可。
* 但排行榜支持展示在游戏中心,因此这里统一用游戏中心需要的数据结构执行上报,需要展示在游戏中心的数据可以经过以下操作:
* mp.weixin.qq.com 的小游戏管理后台“设置 - 游戏 - 排行榜设置”下配置对应的 key 以及相关排行榜属性。
* @param { String } key 排行榜对应的 key
* @param { Number } score 排行榜对应的分数
* @param { Object } extra 除了分数还需要写入的其他字段,不需要不填即可
* @example
* setUserRecord('user_rank', 100, { type: 'coin' })
*/
export function setUserRecord(key, score = 0, extra = {}) {
console.log('[WX OpenData] setUserRecord: ', score);
return setUserCloudStorage({
KVDataList: [
{
key,
value: JSON.stringify({
wxgame: {
score,
// 时间单位:秒
update_time: getCurrTime(),
},
// wxgame下开发者不可自定义其他字段, wxgame同级开发者可自由定义,比如定义一个detail 字段,用于存储取得该分数的中间状态。
...extra,
}),
},
],
}).then((res) => {
console.log('[WX OpenData] setUserRecord success: ', res);
});
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a7ff5471c8130d54aa14ebcfd39591de
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,11 @@
export function getCurrTime() {
return Math.floor(Date.now() / 1000);
}
export function promisify(func) {
return (args = {}) => new Promise((resolve, reject) => {
func(Object.assign(args, {
success: resolve,
fail: reject,
}));
});
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f46f8d9dbc196c14487ad86f0cc0a046
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,149 @@
/* eslint-disable indent */
import { getFriendRankData, getGroupFriendsRankData, setUserRecord } from './data/index';
import getFriendRankXML from './render/tpls/friendRank';
import getFriendRankStyle from './render/styles/friendRank';
import getTipsXML from './render/tpls/tips';
import getTipsStyle from './render/styles/tips';
import { showLoading } from './loading';
const Layout = requirePlugin('Layout').default;
const RANK_KEY = 'user_rank';
const sharedCanvas = wx.getSharedCanvas();
const sharedContext = sharedCanvas.getContext('2d');
// test
setUserRecord(RANK_KEY, Math.ceil(Math.random() * 1000));
const MessageType = {
WX_RENDER: 'WXRender',
WX_DESTROY: 'WXDestroy',
SHOW_FRIENDS_RANK: 'showFriendsRank',
SHOW_GROUP_FRIENDS_RANK: 'showGroupFriendsRank',
SET_USER_RECORD: 'setUserRecord',
};
/**
* 绑定邀请好友事件
* 温馨提示,这里仅仅是示意,请注意修改 shareMessageToFriend 参数
*/
const initShareEvents = () => {
// 绑定邀请
const shareBtnList = Layout.getElementsByClassName('shareToBtn');
shareBtnList
&& shareBtnList.forEach((item) => {
item.on('click', () => {
if (item.dataset.isSelf === 'false') {
wx.shareMessageToFriend({
openId: item.dataset.id,
title: '最强战力排行榜!谁是第一?',
imageUrl: 'https://mmgame.qpic.cn/image/5f9144af9f0e32d50fb878e5256d669fa1ae6fdec77550849bfee137be995d18/0',
});
}
});
});
};
/**
* 初始化开放域,主要是使得 Layout 能够正确处理跨引擎的事件处理
* 如果游戏里面有移动开放数据域对应的 RawImage,也需要抛事件过来执行Layout.updateViewPort
*/
const initOpenDataCanvas = async (data) => {
Layout.updateViewPort({
x: data.x / data.devicePixelRatio,
y: data.y / data.devicePixelRatio,
width: data.width / data.devicePixelRatio,
height: data.height / data.devicePixelRatio,
});
};
// 给定 xml 和 style,渲染至 sharedCanvas
function LayoutWithTplAndStyle(xml, style) {
Layout.clear();
Layout.init(xml, style);
Layout.layout(sharedContext);
console.log(Layout);
}
// 仅仅渲染一些提示,比如数据加载中、当前无授权等
function renderTips(tips = '') {
LayoutWithTplAndStyle(getTipsXML({
tips,
}), getTipsStyle({
width: sharedCanvas.width,
height: sharedCanvas.height,
}));
}
// 将好友排行榜数据渲染在 sharedCanvas
async function renderFriendsRank() {
showLoading();
try {
const data = await getFriendRankData(RANK_KEY);
if (!data.length) {
renderTips('暂无好友数据');
return;
}
LayoutWithTplAndStyle(getFriendRankXML({
data,
}), getFriendRankStyle({
width: sharedCanvas.width,
height: sharedCanvas.height,
}));
initShareEvents();
}
catch (e) {
console.error('renderFriendsRank error', e);
renderTips('请进入设置页允许获取微信朋友信息');
}
}
// 渲染群排行榜
async function renderGroupFriendsRank(shareTicket) {
showLoading();
try {
const data = await getGroupFriendsRankData(shareTicket, RANK_KEY);
if (!data.length) {
renderTips('暂无群同玩好友数据');
return;
}
LayoutWithTplAndStyle(getFriendRankXML({
data,
}), getFriendRankStyle({
width: sharedCanvas.width,
height: sharedCanvas.height,
}));
}
catch (e) {
renderTips('群同玩好友数据加载失败');
}
}
function main() {
wx.onMessage((data) => {
console.log('[WX OpenData] onMessage', data);
if (typeof data === 'string') {
try {
// eslint-disable-next-line no-param-reassign
data = JSON.parse(data);
}
catch (e) {
console.error('[WX OpenData] onMessage data is not a object');
return;
}
}
switch (data.type) {
// 来自 WX Unity SDK 的信息
case MessageType.WX_RENDER:
initOpenDataCanvas(data);
break;
// 来自 WX Unity SDK 的信息
case MessageType.WX_DESTROY:
Layout.clearAll();
break;
// 下面为业务自定义消息
case MessageType.SHOW_FRIENDS_RANK:
renderFriendsRank();
break;
case MessageType.SHOW_GROUP_FRIENDS_RANK:
renderGroupFriendsRank(data.shareTicket);
break;
case MessageType.SET_USER_RECORD:
setUserRecord(RANK_KEY, data.score);
break;
default:
console.error(`[WX OpenData] onMessage type 「${data.type}」 is not supported`);
break;
}
});
}
main();
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 740508847cf9a2b448a63bac4ed82157
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,33 @@
// 通过插件的方式引用 Layout
const Layout = requirePlugin('Layout').default;
let sharedCanvas = wx.getSharedCanvas();
let sharedContext = sharedCanvas.getContext("2d");
const style = {
container: {
width: '100%',
height: '100%',
justifyContent: "center",
alignItems: "center",
},
loading: {
width: 150,
height: 150,
borderRadius: 75,
},
};
const tpl = `
<view id="container">
<image src="open-data/render/image/loading.png" id="loading"></image>
</view>
`;
export function showLoading() {
Layout.clear();
Layout.init(tpl, style);
Layout.layout(sharedContext);
const image = Layout.getElementById('loading');
let degrees = 0;
Layout.ticker.add(() => {
degrees = (degrees + 2) % 360;
image.style.transform = `rotate(${degrees}deg)`;
});
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: de261e4dbfa04b345ab3aa9fc800e78e
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7b97f396e40a59043ade0cad3c48451e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6b6d32f3df44c394494311bb5874cffc
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

@@ -0,0 +1,158 @@
fileFormatVersion: 2
guid: c40574150099f6841bdb2212673b930a
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WeixinMiniGame
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 870 B

@@ -0,0 +1,158 @@
fileFormatVersion: 2
guid: dedd4c88859d7834c92c4f93551fc019
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WeixinMiniGame
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 816 B

@@ -0,0 +1,158 @@
fileFormatVersion: 2
guid: 919c1af97335df3498ea163366534748
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WeixinMiniGame
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

@@ -0,0 +1,158 @@
fileFormatVersion: 2
guid: 45ba4e6111eecc04aabb1069a990b721
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WeixinMiniGame
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

@@ -0,0 +1,158 @@
fileFormatVersion: 2
guid: 5fb2d4564abb2404fa0f5ec9be3df653
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WeixinMiniGame
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 339 B

@@ -0,0 +1,158 @@
fileFormatVersion: 2
guid: 90e370013e953ad4f99eaf820a514a36
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WeixinMiniGame
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

@@ -0,0 +1,158 @@
fileFormatVersion: 2
guid: 43180943d16d7794bb2efb364bda0bfc
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WeixinMiniGame
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

@@ -0,0 +1,158 @@
fileFormatVersion: 2
guid: 65e6e5c41de236e4bad15b5f75601073
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WeixinMiniGame
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

@@ -0,0 +1,158 @@
fileFormatVersion: 2
guid: ff593504e7e793c4c9991671177f68bb
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WeixinMiniGame
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

@@ -0,0 +1,158 @@
fileFormatVersion: 2
guid: 0b973b594c5256443b474ebd353fa469
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WeixinMiniGame
maxTextureSize: 2048
maxPlaceholderSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 078c6b9f7830ebf43b22e2fcfcf5e58f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,141 @@
export default function getStyle(data) {
return {
container: {
width: data.width,
height: data.height,
borderRadius: 12,
paddingLeft: data.width * 0.03,
paddingRight: data.width * 0.03,
},
rankList: {
width: Math.ceil(data.width * 0.94),
height: data.height,
},
list: {
width: Math.ceil(data.width * 0.94),
height: data.height,
},
listItem: {
position: 'relative',
width: Math.ceil(data.width * 0.94),
height: data.height / 2 / 3,
flexDirection: 'row',
alignItems: 'center',
marginTop: 2,
},
rankBg: {
position: 'absolute',
top: 0,
left: 0,
width: Math.ceil(data.width * 0.94),
height: data.height / 2 / 3,
},
rankAvatarBg: {
position: 'absolute',
top: (data.height / 2 / 3) * 0.1,
left: data.width * 0.08,
width: (data.height / 2 / 3) * 0.8,
height: (data.height / 2 / 3) * 0.8,
},
rankAvatar: {
borderRadius: data.width * 0.06,
marginLeft: data.width * 0.08 + (data.height / 2 / 3) * 0.1,
width: (data.height / 2 / 3) * 0.6,
height: (data.height / 2 / 3) * 0.6,
},
rankNameView: {
position: 'relative',
marginLeft: data.width * 0.06,
width: data.width * 0.35,
height: data.height / 2 / 3,
},
rankNameBg: {
position: 'absolute',
top: (data.height / 2 / 3) * 0.14,
left: 0,
width: data.width * 0.35,
height: (data.height / 2 / 3) * 0.4,
},
rankName: {
position: 'absolute',
top: (data.height / 2 / 3) * 0.14,
left: 0,
width: data.width * 0.35,
height: (data.height / 2 / 3) * 0.4,
textAlign: 'center',
lineHeight: (data.height / 2 / 3) * 0.4,
fontSize: data.width * 0.043,
textOverflow: 'ellipsis',
color: '#fff',
},
rankScoreTip: {
position: 'absolute',
bottom: (data.height / 2 / 3) * 0.1,
left: 0,
width: data.width * 0.15,
height: (data.height / 2 / 3) * 0.3,
lineHeight: (data.height / 2 / 3) * 0.3,
fontSize: data.width * 0.042,
color: '#fff',
},
rankScoreVal: {
position: 'absolute',
bottom: (data.height / 2 / 3) * 0.1,
left: data.width * 0.15,
width: data.width * 0.18,
height: (data.height / 2 / 3) * 0.3,
lineHeight: (data.height / 2 / 3) * 0.3,
fontSize: data.width * 0.042,
color: '#fff',
},
shareNameView: {
position: 'relative',
marginLeft: data.width * 0.06,
width: data.width * 0.35,
height: (data.height / 2 / 3) * 0.4,
},
shareNameBg: {
position: 'absolute',
top: 0,
left: 0,
width: data.width * 0.35,
height: (data.height / 2 / 3) * 0.4,
},
shareName: {
position: 'absolute',
top: 0,
left: 0,
width: data.width * 0.35,
height: (data.height / 2 / 3) * 0.4,
textAlign: 'center',
lineHeight: (data.height / 2 / 3) * 0.4,
fontSize: data.width * 0.043,
textOverflow: 'ellipsis',
color: '#fff',
},
shareToBtn: {
position: 'relative',
marginLeft: data.width * 0.08,
width: data.width * 0.21,
height: data.height * 0.16,
},
shareBtnBg: {
position: 'absolute',
right: 0,
top: data.height * 0.16 * 0.25,
width: data.width * 0.21,
height: data.height * 0.16 * 0.5,
},
shareText: {
position: 'absolute',
right: 0,
top: data.height * 0.16 * 0.25,
width: data.width * 0.21,
height: data.height * 0.16 * 0.5,
lineHeight: data.height * 0.16 * 0.5,
textAlign: 'center',
fontSize: data.width * 0.043,
color: '#fff',
},
};
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2b4bc4ec5b53dd44992d46ca7b062ebe
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,18 @@
export default function getStyle(data) {
return {
container: {
flexDirection: 'row',
width: data.width,
height: data.height,
justifyContent: 'center',
alignItems: 'center',
},
tips: {
color: '#000000',
width: data.width,
height: 50,
fontSize: 50,
textAlign: 'center',
},
};
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 047bc94c21d7f7a47a7d0aaac9cdbd91
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ff0b7129cdb35dd4c87671285df5431e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,52 @@
/**
* 下面的内容分成两部分第一部分是一个模板模板的好处是能够有一定的语法
* 坏处是模板引擎一般都依赖 new Function 或者 eval 能力小游戏下面是没有的
* 所以模板的编译需要在外部完成可以将注释内的模板贴到下面的页面内点击 "run"就能够得到编译后的模板函数
* https://wechat-miniprogram.github.io/minigame-canvas-engine/playground.html
* 如果觉得模板引擎使用过于麻烦也可以手动拼接字符串本文件对应函数的目标仅仅是为了创建出 xml 节点数
*/
/*
<view class="container" id="main">
<view class="rankList">
<scrollview class="list" scrollY="true">
{{~it.data :item:index}}
<view class="listItem">
<image src="open-data/render/image/rankBg.png" class="rankBg"></image>
<image class="rankAvatarBg" src="open-data/render/image/rankAvatar.png"></image>
<image class="rankAvatar" src="{{= item.avatarUrl }}"></image>
<view class="rankNameView">
<image class="rankNameBg" src="open-data/render/image/nameBg.png"></image>
<text class="rankName" value="{{=item.nickname}}"></text>
<text class="rankScoreTip" value="战力值:"></text>
<text class="rankScoreVal" value="{{=item.score || 0}}"></text>
</view>
<view class="shareToBtn" data-isSelf="{{= item.isSelf ? true : false}}" data-id="{{= item.openid || ''}}">
<image src="open-data/render/image/{{= item.isSelf ? 'button3':'button2'}}.png" class="shareBtnBg"></image>
<text class="shareText" value="{{= item.isSelf ? '你自己' : '分享'}}"></text>
</view>
</view>
{{~}}
</scrollview>
</view>
</view>
*/
/**
* xml经过doT.js编译出的模板函数
* 因为小游戏不支持new Function模板函数只能外部编译
* 可直接拷贝本函数到小游戏中使用
*/
export default function anonymous(it) {
let out = '<view class="container" id="main"> <view class="rankList"> <scrollview class="list" scrollY="true"> ';
const arr1 = it.data;
if (arr1) {
let item;
let index = -1;
const l1 = arr1.length - 1;
while (index < l1) {
item = arr1[(index += 1)];
out += ` <view class="listItem"> <image src="open-data/render/image/rankBg.png" class="rankBg"></image> <image class="rankAvatarBg" src="open-data/render/image/rankAvatar.png"></image> <image class="rankAvatar" src="${item.avatarUrl}"></image> <view class="rankNameView"> <image class="rankNameBg" src="open-data/render/image/nameBg.png"></image> <text class="rankName" value="${item.nickname}"></text> <text class="rankScoreTip" value="战力值:"></text> <text class="rankScoreVal" value="${item.score || 0}"></text> </view> <view class="shareToBtn" data-isSelf="${!!item.isSelf}" data-id="${item.openid || ''}"> <image src="open-data/render/image/${item.isSelf ? 'button3' : 'button2'}.png" class="shareBtnBg"></image> <text class="shareText" value="${item.isSelf ? '你自己' : '分享'}"></text> </view> </view> `;
}
}
out += ' </scrollview> </view></view>';
return out;
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 7265bed57589cc54185abff38ad560ec
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,23 @@
/**
* 下面的内容分成两部分第一部分是一个模板模板的好处是能够有一定的语法
* 坏处是模板引擎一般都依赖 new Function 或者 eval 能力小游戏下面是没有的
* 所以模板的编译需要在外部完成可以将注释内的模板贴到下面的页面内点击 "run"就能够得到编译后的模板函数
* https://wechat-miniprogram.github.io/minigame-canvas-engine/playground.html
* 如果觉得模板引擎使用过于麻烦也可以手动拼接字符串本文件对应函数的目标仅仅是为了创建出 xml 节点数
*/
/**
<view id="container">
<text class="tips" value="{{= it.tips || '' }}"></text>
</view>
*/
/**
* xml经过doT.js编译出的模板函数
* 因为小游戏不支持new Function模板函数只能外部编译
* 可直接拷贝本函数到小游戏中使用
*/
export default function anonymous(it) {
const out = `<view id="container"> <text class="tips" value="${it.tips || ''}"></text></view>`;
return out;
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d7f3c79b7491fb943bc9ea279fc66cee
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,19 @@
export const launchEventType = {
launchPlugin: 0,
loadWasm: 1,
compileWasm: 2,
loadAssets: 3,
readAssets: 5,
prepareGame: 6, // 初始化引擎
};
// https://docs.egret.com/engine/docs/screenAdaptation/zoomMode
export const scaleMode = {
default: '',
noBorder: 'NO_BORDER',
exactFit: 'EXACT_FIT',
fixedHeight: 'FIXED_HEIGHT',
fixedWidth: 'FIXED_WIDTH',
showAll: 'SHOW_ALL',
fixedNarrow: 'FIXED_NARROW',
fixedWide: 'FIXED_WIDE',
};
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 559e9785a6f656242af006216a85a5ea
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,71 @@
{
"description": "项目配置文件",
"setting": {
"urlCheck": false,
"es6": true,
"enhance": true,
"postcss": true,
"preloadBackgroundData": false,
"minified": true,
"newFeature": true,
"coverView": true,
"nodeModules": false,
"autoAudits": false,
"showShadowRootInWxmlPanel": true,
"scopeDataCheck": false,
"uglifyFileName": false,
"checkInvalidKey": true,
"checkSiteMap": true,
"uploadWithSourceMap": true,
"compileHotReLoad": false,
"useMultiFrameRuntime": true,
"useApiHook": false,
"disableUseStrict": false,
"babelSetting": {
"ignore": ["$GAME_NAME.wasm.framework.unityweb.js"],
"disablePlugins": [],
"outputPath": ""
},
"useIsolateContext": true,
"useCompilerModule": true,
"userConfirmedUseCompilerModuleSwitch": false,
"packNpmManually": false,
"packNpmRelationList": []
},
"compileType": "game",
"libVersion": "3.0.0",
"appid": "$APP_ID",
"projectname": "$PROJECT_NAME",
"simulatorType": "wechat",
"simulatorPluginLibVersion": {},
"packOptions": {
"ignore": [
{
"type": "folder",
"value": ".plugincache"
},
{
"type": "suffix",
"value": ".symbols.unityweb"
}
]
},
"condition": {
"search": {
"current": -1,
"list": []
},
"conversation": {
"current": -1,
"list": []
},
"game": {
"currentL": -1,
"list": []
},
"miniprogram": {
"current": -1,
"list": []
}
}
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e5c80109743a4cc4aab6b6a1c04c0ac0
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,3 @@
GameGlobal.USED_TEXTURE_COMPRESSION = false;
GameGlobal.TEXTURE_PARALLEL_BUNDLE = false;
GameGlobal.TEXTURE_BUNDLES = '';
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 76d561c9df85361418c483bdf21d8f1a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,139 @@
// @ts-nocheck
/* eslint-disable no-unused-vars */
/* eslint-disable no-undef */
const unityNamespace = {
canvas: GameGlobal.canvas,
// cache width
canvas_width: GameGlobal.canvas.width,
// cache height
canvas_height: GameGlobal.canvas.height,
navigator: GameGlobal.navigator,
XMLHttpRequest: GameGlobal.XMLHttpRequest,
// 是否显示耗时的弹框,默认开发版时显示弹出耗时弹框
hideTimeLogModal: true,
// 是否打印详细日志
enableDebugLog: false,
// 自定义bundle中的hash长度
bundleHashLength: $BUNDLE_HASH_LENGTH,
// 单位Bytes, 1MB = 1024 KB = 1024*1024Bytes
releaseMemorySize: $DEFAULT_RELEASE_SIZE,
unityVersion: '$UNITY_VERSION',
// Color Space: Gamma、Linear、Uninitialized(未初始化的颜色空间)
unityColorSpace: '$UNITY_COLORSPACE',
convertPluginVersion: '$PLUGIN_VERSION',
// 拼在StreamingAssets前面的pathDATA_CDN + streamingUrlPrefixPath + StreamingAssets
streamingUrlPrefixPath: '',
// DATA_CDN + dataFileSubPrefix + datafilename
dataFileSubPrefix: '$DATA_FILE_SUB_PREFIX',
// 当前appid扩容后,通过本字段告知插件本地存储最大容量,单位MB
maxStorage: $MAX_STORAGE_SIZE,
// 纹理中的hash长度
texturesHashLength: $TEXTURE_HASH_LENGTH,
// 纹理存放路径
texturesPath: '$TEXTURES_PATH',
// 是否需要缓存纹理,
needCacheTextures: $NEED_CACHE_TEXTURES,
// AssetBundle在内存中的存活时间
ttlAssetBundle: 5,
// 是否显示性能面板
enableProfileStats: $ENABLE_PROFILE_STATS,
// 是否预载微信系统字体
preloadWXFont: $PRELOAD_WXFONT,
// iOS高性能模式定期GC间隔
iOSAutoGCInterval: $IOS_AUTO_GC_INTERVAL,
// 是否使用微信压缩纹理
usedTextureCompression: GameGlobal.USED_TEXTURE_COMPRESSION,
// 是否使用autostreaming
usedAutoStreaming: $USED_AUTO_STREAMING,
// 是否显示渲染日志(dev only)
enableRenderAnalysisLog: $ENABLE_RENDER_ANALYSIS_LOG,
};
// 最佳实践检测配置
unityNamespace.monitorConfig = {
// 显示优化建议弹框
showSuggestModal: $SHOW_SUGGEST_MODAL,
// 是否开启检测(只影响开发版/体验版,线上版本不会检测)
enableMonitor: true,
// 帧率低于此值的帧会被记录,用于分析长耗时帧,做了限帧的游戏应该适当调低
fps: 10,
// 是否一直检测到游戏可交互完成
showResultAfterLaunch: true,
// 仅当showResultAfterLaunch=false时有效, 在引擎初始化完成(即callmain)后多长时间停止检测
monitorDuration: 30000,
};
// 判断是否需要自动缓存的文件,返回true自动缓存;false不自动缓存
unityNamespace.isCacheableFile = function (path) {
// 判定为下载bundle的路径标识符,此路径下的下载,会自动缓存
const cacheableFileIdentifier = [$BUNDLE_PATH_IDENTIFIER];
// 命中路径标识符的情况下,并不是所有文件都有必要缓存,过滤下不需要缓存的文件
const excludeFileIdentifier = [$EXCLUDE_FILE_EXTENSIONS];
if (cacheableFileIdentifier.some(identifier => path.includes(identifier)
&& excludeFileIdentifier.every(excludeIdentifier => !path.includes(excludeIdentifier)))) {
return true;
}
return false;
};
// 是否上报此条网络异常, 返回true则上报, 返回false则忽略
unityNamespace.isReportableHttpError = function (_info) {
// const { url, error } = _info;
return true;
};
// 判断是否是AssetBundle
unityNamespace.isWXAssetBundle = function (path) {
return unityNamespace.WXAssetBundles.has(unityNamespace.PathInFileOS(path));
};
unityNamespace.PathInFileOS = function (path) {
return path.replace(`${wx.env.USER_DATA_PATH}/__GAME_FILE_CACHE`, '');
};
unityNamespace.WXAssetBundles = new Map();
// 清理缓存时是否可被自动清理;返回true可自动清理;返回false不可自动清理
unityNamespace.isErasableFile = function (info) {
// 用于特定AssetBundle的缓存保持
if (unityNamespace.WXAssetBundles.has(info.path)) {
return false;
}
// 达到缓存上限时,不会被自动清理的文件
const inErasableIdentifier = [];
if (inErasableIdentifier.some(identifier => info.path.includes(identifier))) {
return false;
}
return true;
};
const { version, SDKVersion, platform, renderer, system } = wx.getSystemInfoSync();
unityNamespace.version = version;
unityNamespace.SDKVersion = SDKVersion;
unityNamespace.platform = platform;
unityNamespace.renderer = renderer;
unityNamespace.system = system;
unityNamespace.isPc = platform === 'windows' || platform === 'mac';
unityNamespace.isDevtools = platform === 'devtools';
unityNamespace.isMobile = !unityNamespace.isPc && !unityNamespace.isDevtools;
unityNamespace.isH5Renderer = unityNamespace.isMobile && unityNamespace.renderer === 'h5';
unityNamespace.isIOS = platform === 'ios';
unityNamespace.isAndroid = platform === 'android';
GameGlobal.WebAssembly = GameGlobal.WXWebAssembly;
GameGlobal.unityNamespace = GameGlobal.unityNamespace || unityNamespace;
GameGlobal.realtimeLogManager = wx.getRealtimeLogManager();
GameGlobal.logmanager = wx.getLogManager({ level: 0 });
// eslint-disable-next-line no-multi-assign
GameGlobal.onCrash = GameGlobal.unityNamespace.onCrash = function () {
GameGlobal.manager.showAbort();
const sysInfo = wx.getSystemInfoSync();
wx.createFeedbackButton({
type: 'text',
text: '提交反馈',
style: {
left: (sysInfo.screenWidth - 184) / 2,
top: sysInfo.screenHeight / 3 + 140,
width: 184,
height: 40,
lineHeight: 40,
backgroundColor: '#07C160',
color: '#ffffff',
textAlign: 'center',
fontSize: 16,
borderRadius: 4,
},
});
};
export default GameGlobal.unityNamespace;
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 100d1674c55bc084ca99926d787c26f3
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 422d9d75fadbf4c45a66206ca1aed5c1
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,299 @@
import moduleHelper from './module-helper';
import response from './response';
import { formatJsonStr, uid } from './utils';
import { resumeWebAudio } from './audio/utils';
const ads = {};
export default {
WXCreateBannerAd(conf) {
const config = formatJsonStr(conf);
config.style = JSON.parse(config.styleRaw || '{}');
const ad = wx.createBannerAd(config);
const key = uid();
ads[key] = ad;
ad.onError((res) => {
console.error(res);
moduleHelper.send('ADOnErrorCallback', JSON.stringify({
callbackId: key,
errMsg: res.errMsg,
errCode: res.errCode || res.err_code,
}));
});
ad.onLoad(() => {
moduleHelper.send('ADOnLoadCallback', JSON.stringify({
callbackId: key,
errMsg: '',
}));
});
ad.onResize((res) => {
moduleHelper.send('ADOnResizeCallback', JSON.stringify({
callbackId: key,
errMsg: '',
...res,
}));
});
return key;
},
WXCreateFixedBottomMiddleBannerAd(adUnitId, adIntervals, height) {
const info = wx.getSystemInfoSync();
const ad = wx.createBannerAd({
adUnitId,
adIntervals,
style: {
left: 0,
top: info.windowHeight - height,
height,
width: info.windowWidth,
},
});
const key = uid();
ads[key] = ad;
ad.onError((res) => {
console.error(res);
moduleHelper.send('ADOnErrorCallback', JSON.stringify({
callbackId: key,
errMsg: res.errMsg,
errCode: res.errCode || res.err_code,
}));
});
ad.onLoad(() => {
moduleHelper.send('ADOnLoadCallback', JSON.stringify({
callbackId: key,
errMsg: '',
}));
});
const oldWidth = info.windowWidth;
ad.onResize((res) => {
if (Math.abs(res.height - height) > 1 || Math.abs(res.width - oldWidth) > 1) {
ad.style.left = Math.round((info.windowWidth - res.width) / 2);
ad.style.top = Math.round(info.windowHeight - res.height);
}
moduleHelper.send('ADOnResizeCallback', JSON.stringify({
callbackId: key,
errMsg: '',
...res,
}));
});
return key;
},
WXCreateRewardedVideoAd(conf) {
const config = formatJsonStr(conf);
const ad = wx.createRewardedVideoAd(config);
const key = uid();
ads[key] = ad;
if (!config.multiton) {
// 单例模式要处理一下
ad.offLoad();
ad.offError();
ad.offClose();
}
ad.onError((res) => {
console.error(res);
moduleHelper.send('ADOnErrorCallback', JSON.stringify({
callbackId: key,
errMsg: res.errMsg,
errCode: res.errCode || res.err_code,
}));
});
ad.onLoad((res) => {
moduleHelper.send('ADOnLoadCallback', JSON.stringify({
callbackId: key,
errMsg: '',
...res,
}));
});
ad.onClose((res) => {
moduleHelper.send('ADOnVideoCloseCallback', JSON.stringify({
callbackId: key,
errMsg: '',
...res,
}));
setTimeout(() => {
resumeWebAudio();
}, 0);
});
return key;
},
WXCreateInterstitialAd(conf) {
const config = formatJsonStr(conf);
const ad = wx.createInterstitialAd(config);
const key = uid();
ads[key] = ad;
ad.onError((res) => {
console.error(res);
moduleHelper.send('ADOnErrorCallback', JSON.stringify({
callbackId: key,
errMsg: res.errMsg,
errCode: res.errCode || res.err_code,
}));
});
ad.onLoad(() => {
moduleHelper.send('ADOnLoadCallback', JSON.stringify({
callbackId: key,
errMsg: '',
}));
});
ad.onClose(() => {
moduleHelper.send('ADOnCloseCallback', JSON.stringify({
callbackId: key,
errMsg: '',
}));
});
return key;
},
WXCreateCustomAd(conf) {
const config = formatJsonStr(conf);
config.style = JSON.parse(config.styleRaw || '{}');
const ad = wx.createCustomAd(config);
const key = uid();
ads[key] = ad;
ad.onError((res) => {
console.error(res);
moduleHelper.send('ADOnErrorCallback', JSON.stringify({
callbackId: key,
errMsg: res.errMsg,
errCode: res.errCode || res.err_code,
}));
});
ad.onLoad(() => {
moduleHelper.send('ADOnLoadCallback', JSON.stringify({
callbackId: key,
errMsg: '',
}));
});
ad.onClose(() => {
moduleHelper.send('ADOnCloseCallback', JSON.stringify({
callbackId: key,
errMsg: '',
}));
});
ad.onHide(() => {
moduleHelper.send('ADOnHideCallback', JSON.stringify({
callbackId: key,
errMsg: '',
}));
});
return key;
},
WXADStyleChange(id, key, value) {
if (!ads[id]) {
return false;
}
if (typeof ads[id].style === 'undefined') {
return;
}
ads[id].style[key] = value;
},
WXShowAd(id, succ, fail) {
if (!ads[id]) {
return false;
}
ads[id]
.show()
.then(() => {
response.textFormat(succ, {
errMsg: 'show:ok',
});
})
.catch((e) => {
response.textFormat(fail, {
errMsg: e.errMsg || '',
});
});
},
WXShowAd2(id, branchId, branchDim, succ, fail) {
if (!ads[id]) {
return false;
}
ads[id]
.show({ branchId, branchDim })
.then(() => {
response.textFormat(succ, {
errMsg: 'show:ok',
});
})
.catch((e) => {
response.textFormat(fail, {
errMsg: e.errMsg || '',
});
});
},
WXHideAd(id, succ, fail) {
if (!ads[id]) {
return false;
}
if (typeof ads[id].hide === 'undefined') {
return;
}
if (succ || fail) {
const promise = ads[id].hide();
if (promise) {
promise
.then(() => {
response.textFormat(succ, {
errMsg: 'hide:ok',
});
})
.catch((e) => {
response.textFormat(fail, {
errMsg: e.errMsg || '',
});
});
}
else {
response.textFormat(succ, {
errMsg: 'hide:ok',
});
}
}
else {
ads[id].hide();
}
},
WXADGetStyleValue(id, key) {
if (!ads[id]) {
return -1;
}
if (typeof ads[id].style === 'undefined') {
return;
}
return ads[id].style[key];
},
WXADDestroy(id) {
if (!ads[id]) {
return false;
}
ads[id].destroy();
delete ads[id];
},
WXADLoad(id, succ, fail) {
if (!ads[id]) {
return false;
}
if (typeof ads[id].load === 'undefined') {
return;
}
ads[id]
.load()
.then(() => {
response.textFormat(succ, {});
})
.catch((res) => {
moduleHelper.send('ADLoadErrorCallback', JSON.stringify({
callbackId: fail,
...res,
}));
});
},
WXReportShareBehavior(id, conf) {
if (!ads[id]) {
return '{}';
}
if (typeof ads[id].reportShareBehavior === 'undefined') {
return;
}
const config = formatJsonStr(conf);
return JSON.stringify(ads[id].reportShareBehavior(config));
},
};
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e87ffd5c0171de44e8c4159d2e0ae851
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e62e7423705621d4d9944004419857cd
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,51 @@
import { WEBAudio, audios } from './store';
import { resumeWebAudio, mkCacheDir } from './utils';
mkCacheDir();
export default {
WXGetAudioCount() {
return {
innerAudio: Object.keys(audios).length,
webAudio: WEBAudio.bufferSourceNodeLength,
buffer: WEBAudio.audioBufferLength,
};
},
};
const HandleInterruption = {
init() {
let INTERRUPT_LIST = {};
wx.onHide(() => {
Object.keys(audios).forEach((key) => {
if (!audios[key].paused !== false) {
INTERRUPT_LIST[key] = true;
}
});
});
wx.onShow(() => {
Object.keys(audios).forEach((key) => {
if (audios[key].paused !== false && INTERRUPT_LIST[key]) {
audios[key].play();
}
});
INTERRUPT_LIST = {};
});
wx.onAudioInterruptionBegin(() => {
Object.keys(audios).forEach((key) => {
if (!audios[key].paused !== false) {
INTERRUPT_LIST[key] = true;
}
});
});
wx.onAudioInterruptionEnd(() => {
Object.keys(audios).forEach((key) => {
if (audios[key].paused !== false && INTERRUPT_LIST[key]) {
audios[key].play();
}
});
INTERRUPT_LIST = {};
resumeWebAudio();
});
},
};
HandleInterruption.init();
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1346b877eca95bc4e981004851766fa3
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,3 @@
export const INNER_AUDIO_UNDEFINED_MSG = 'InnerAudioContext does not exist!';
export const IGNORE_ERROR_MSG = 'audio is playing, don\'t play again';
export const TEMP_DIR_PATH = `${wx.env.USER_DATA_PATH}/__GAME_FILE_CACHE/audios`;
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 585369bd09f595d4b954f11aad189025
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
import innerAudio from './inner-audio';
import unityAudio from './unity-audio';
import common from './common';
export default {
...innerAudio,
...unityAudio,
...common,
};
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2706efb73cecc9a408b84934894867a3
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,365 @@
import moduleHelper from '../module-helper';
import { isSupportPlayBackRate } from '../../check-version';
import { audios, localAudioMap, downloadingAudioMap } from './store';
import { createInnerAudio, destroyInnerAudio, printErrMsg } from './utils';
import { IGNORE_ERROR_MSG, INNER_AUDIO_UNDEFINED_MSG } from './const';
const funs = {
getFullUrl(v) {
if (!/^https?:\/\//.test(v) && !/^wxfile:\/\//.test(v)) {
const cdnPath = GameGlobal.manager.assetPath;
v = `${cdnPath.replace(/\/$/, '')}/${v.replace(/^\//, '').replace(/^Assets\//, '')}`;
}
return v;
},
downloadAudios(paths) {
const list = paths.split(',');
return Promise.all(list.map((v) => {
const src = funs.getFullUrl(v);
return new Promise((resolve, reject) => {
if (!downloadingAudioMap[src]) {
downloadingAudioMap[src] = [
{
resolve,
reject,
},
];
if (funs.checkLocalFile(src)) {
funs.handleDownloadEnd(src, true);
}
else if (!GameGlobal.unityNamespace.isCacheableFile(src)) {
wx.downloadFile({
url: src,
success(res) {
if (res.statusCode === 200 && res.tempFilePath) {
localAudioMap[src] = res.tempFilePath;
funs.handleDownloadEnd(src, true);
}
else {
funs.handleDownloadEnd(src, false);
}
},
fail(e) {
funs.handleDownloadEnd(src, false);
printErrMsg(e);
},
});
}
else {
const xmlhttp = new GameGlobal.unityNamespace.UnityLoader.UnityCache.XMLHttpRequest();
xmlhttp.open('GET', src, true);
xmlhttp.responseType = 'arraybuffer';
xmlhttp.onsave = () => {
localAudioMap[src] = GameGlobal.manager.getCachePath(src);
funs.handleDownloadEnd(src, true);
};
xmlhttp.onsavefail = () => {
funs.handleDownloadEnd(src, false);
};
xmlhttp.onerror = () => {
funs.handleDownloadEnd(src, false);
};
xmlhttp.send();
}
}
else {
downloadingAudioMap[src].push({
resolve,
reject,
});
}
});
}));
},
handleDownloadEnd(src, succeeded) {
if (!downloadingAudioMap[src]) {
return;
}
while (downloadingAudioMap[src] && downloadingAudioMap[src].length > 0) {
const item = downloadingAudioMap[src].shift();
if (!succeeded) {
item?.reject();
}
else {
item?.resolve('');
}
}
delete downloadingAudioMap[src];
},
// 是否存在本地文件
checkLocalFile(src) {
if (localAudioMap[src]) {
return true;
}
const path = GameGlobal.manager.getCachePath(src);
if (path) {
localAudioMap[src] = path;
return true;
}
return false;
},
// 设置路径
setAudioSrc(audio, getSrc) {
return new Promise((resolve, reject) => {
const src = funs.getFullUrl(getSrc);
// 设置原始路径,后面用此路径作为key值
audio.isLoading = src;
if (funs.checkLocalFile(src)) {
audio.src = localAudioMap[src];
delete audio.isLoading;
funs.handleDownloadEnd(src, true);
resolve(localAudioMap[src]);
}
else if (audio.needDownload) {
funs
.downloadAudios(src)
.then(() => {
if (audio) {
audio.src = localAudioMap[src];
delete audio.isLoading;
resolve(localAudioMap[src]);
}
else {
console.warn('资源已被删除:', src);
reject({
errCode: -1,
errMsg: '资源已被删除',
});
}
})
.catch(() => {
console.warn('资源下载失败:', src);
if (audio) {
audio.src = src;
delete audio.isLoading;
}
reject({
errCode: -1,
errMsg: '资源下载失败',
});
});
}
else {
// 不推荐这样处理,建议优先下载再使用,除非是需要立即播放的长音频文件或一次性播放音频
// console.warn('建议优先下载再使用:', src);
audio.src = src;
delete audio.isLoading;
resolve(src);
}
});
},
};
function checkHasAudio(id) {
if (audios[id]) {
return true;
}
console.error(INNER_AUDIO_UNDEFINED_MSG, id);
return false;
}
export default {
// 创建audio对象
WXCreateInnerAudioContext(src, loop, startTime, autoplay, volume, playbackRate, needDownload) {
const { audio: getAudio, id } = createInnerAudio();
getAudio.needDownload = needDownload;
if (src) {
// 设置原始src
funs.setAudioSrc(getAudio, src).catch((e) => {
moduleHelper.send('OnAudioCallback', JSON.stringify({
callbackId: id,
errMsg: 'onError',
result: JSON.stringify(e),
}));
});
}
if (loop) {
getAudio.loop = true;
}
if (autoplay) {
getAudio.autoplay = true;
}
if (typeof startTime === 'undefined') {
startTime = 0;
}
if (startTime > 0) {
getAudio.startTime = +startTime.toFixed(2);
}
if (typeof volume === 'undefined') {
volume = 1;
}
if (volume !== 1) {
getAudio.volume = +volume.toFixed(2);
}
if (!isSupportPlayBackRate) {
playbackRate = 1;
}
if (typeof playbackRate !== 'undefined' && playbackRate !== 1) {
getAudio.playbackRate = +playbackRate.toFixed(2);
}
return id;
},
WXInnerAudioContextSetBool(id, k, v) {
if (!checkHasAudio(id)) {
return;
}
audios[id][k] = Boolean(+v);
},
WXInnerAudioContextSetString(id, k, v) {
if (!checkHasAudio(id)) {
return;
}
if (k === 'src') {
funs.setAudioSrc(audios[id], v);
}
else if (k === 'needDownload') {
audios[id].needDownload = !!v;
}
else {
audios[id][k] = v;
}
},
WXInnerAudioContextSetFloat(id, k, v) {
if (!checkHasAudio(id)) {
return;
}
audios[id][k] = +v.toFixed(2);
},
WXInnerAudioContextGetFloat(id, k) {
if (!checkHasAudio(id)) {
return 0;
}
return audios[id][k];
},
WXInnerAudioContextGetBool(id, k) {
if (!checkHasAudio(id)) {
return false;
}
return audios[id][k];
},
WXInnerAudioContextPlay(id) {
if (!checkHasAudio(id)) {
return;
}
const url = audios[id].isLoading;
if (url) {
if (downloadingAudioMap[url]) {
downloadingAudioMap[url].push({
resolve: () => {
if (typeof audios[id] !== 'undefined') {
audios[id].play();
}
},
reject: () => { },
});
}
else {
audios[id].src = url;
audios[id].play();
}
}
else {
audios[id].play();
}
},
WXInnerAudioContextPause(id) {
if (!checkHasAudio(id)) {
return;
}
audios[id].pause();
},
WXInnerAudioContextStop(id) {
if (!checkHasAudio(id)) {
return;
}
audios[id].stop();
},
WXInnerAudioContextDestroy(id) {
if (!checkHasAudio(id)) {
return;
}
destroyInnerAudio(id, false);
},
WXInnerAudioContextSeek(id, position) {
if (!checkHasAudio(id)) {
return;
}
audios[id].seek(+position.toFixed(3));
},
WXInnerAudioContextAddListener(id, key) {
if (!checkHasAudio(id)) {
return;
}
if (key === 'onCanplay') {
audios[id][key](() => {
const { duration, buffered, referrerPolicy, volume } = audios[id];
setTimeout(() => {
moduleHelper.send('OnAudioCallback', JSON.stringify({
callbackId: id,
errMsg: key,
}));
}, 0);
});
}
else if (key === 'onError') {
audios[id][key]((e) => {
if (key === 'onError') {
console.error(e);
if (e.errMsg && e.errMsg.indexOf(IGNORE_ERROR_MSG) > -1) {
return;
}
}
moduleHelper.send('OnAudioCallback', JSON.stringify({
callbackId: id,
errMsg: key,
result: JSON.stringify(e),
}));
});
}
else {
audios[id][key](() => {
moduleHelper.send('OnAudioCallback', JSON.stringify({
callbackId: id,
errMsg: key,
}));
});
}
},
WXInnerAudioContextRemoveListener(id, key) {
if (!checkHasAudio(id)) {
return;
}
audios[id][key]();
},
WXPreDownloadAudios(paths, id) {
funs
.downloadAudios(paths)
.then(() => {
moduleHelper.send('WXPreDownloadAudiosCallback', JSON.stringify({
callbackId: id.toString(),
errMsg: '0',
}));
})
.catch(() => {
moduleHelper.send('WXPreDownloadAudiosCallback', JSON.stringify({
callbackId: id.toString(),
errMsg: '1',
}));
});
},
};
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 783d3d4e7ae93344aadefb76a6c5248a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,29 @@
export const WEBAudio = {
audioInstanceIdCounter: 0,
audioInstances: {},
audioContext: null,
audioWebEnabled: 0,
audioCache: [],
lOrientation: {
x: 0,
y: 0,
z: 0,
xUp: 0,
yUp: 0,
zUp: 0,
},
lPosition: { x: 0, y: 0, z: 0 },
audio3DSupport: 0,
audioWebSupport: 0,
bufferSourceNodeLength: 0,
audioBufferLength: 0,
};
export const audios = {};
export const localAudioMap = {};
export const downloadingAudioMap = {};
export const soundVolumeHandler = {};
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 89a6a02588fcb274aaa8ddca052949a0
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a0e0368c963c215469b90cd1924ff6bf
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,74 @@
import { uid } from '../utils';
import { isSupportCacheAudio } from '../../check-version';
import { WEBAudio, audios } from './store';
import { TEMP_DIR_PATH } from './const';
export const resumeWebAudio = () => {
if (WEBAudio.audioContext
&& (WEBAudio.audioContext.state === 'suspended' || WEBAudio.audioContext.state === 'interrupted')) {
WEBAudio.audioContext.resume();
}
};
export const createInnerAudio = () => {
const id = uid();
const audio = (isSupportCacheAudio && WEBAudio.audioCache.length ? WEBAudio.audioCache.shift() : wx.createInnerAudioContext());
if (audio) {
audios[id] = audio;
}
return {
id,
audio,
};
};
export const destroyInnerAudio = (id, useCache) => {
if (!id) {
return;
}
if (!useCache || !isSupportCacheAudio || WEBAudio.audioCache.length > 32) {
audios[id].destroy();
}
else {
['Play', 'Pause', 'Stop', 'Canplay', 'Error', 'Ended', 'Waiting', 'Seeking', 'Seeked', 'TimeUpdate'].forEach((eventName) => {
audios[id][`off${eventName}`]();
});
const state = {
startTime: 0,
obeyMuteSwitch: true,
volume: 1,
autoplay: false,
loop: false,
referrerPolicy: '',
};
Object.keys(state).forEach((key) => {
try {
audios[id][key] = state[key];
}
catch (e) { }
});
audios[id].stop();
const cacheAudio = audios[id];
setTimeout(() => {
WEBAudio.audioCache.push(cacheAudio);
}, 1000);
}
delete audios[id];
};
export const printErrMsg = (msg) => {
GameGlobal.manager.printErr(msg);
};
export function mkCacheDir() {
const fs = wx.getFileSystemManager();
fs.rmdir({
dirPath: TEMP_DIR_PATH,
recursive: true,
complete: () => {
fs.mkdir({
dirPath: TEMP_DIR_PATH,
});
},
});
}
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: e2a44d191d5dc284b82ce97ddb30f888
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,24 @@
import moduleHelper from './module-helper';
import { formatJsonStr } from './utils';
let resolveFn = null;
export default {
WX_OnNeedPrivacyAuthorization() {
const callback = (resolve) => {
resolveFn = resolve;
moduleHelper.send('_OnNeedPrivacyAuthorizationCallback', '{}');
};
wx.onNeedPrivacyAuthorization(callback);
},
WX_PrivacyAuthorizeResolve(conf) {
const config = formatJsonStr(conf);
config.event = config.eventString;
if (resolveFn) {
resolveFn(config);
if (config.event === 'agree' || config.event === 'disagree') {
resolveFn = null;
}
}
},
};
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 9248bb15ec0e0e94c98e921653cdd1b5
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,100 @@
import moduleHelper from './module-helper';
import { formatJsonStr, cacheArrayBuffer, getListObject } from './utils';
const cameraList = {};
const getObject = getListObject(cameraList, 'camera');
export default {
WXCameraCreateCamera(conf, callbackId) {
const obj = wx.createCamera({
...formatJsonStr(conf),
success(res) {
moduleHelper.send('CameraCreateCallback', JSON.stringify({
callbackId,
type: 'success',
res: JSON.stringify(res),
}));
},
fail(res) {
moduleHelper.send('CameraCreateCallback', JSON.stringify({
callbackId,
type: 'fail',
res: JSON.stringify(res),
}));
},
complete(res) {
moduleHelper.send('CameraCreateCallback', JSON.stringify({
callbackId,
type: 'complete',
res: JSON.stringify(res),
}));
},
});
cameraList[callbackId] = obj;
},
WXCameraCloseFrameChange(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.closeFrameChange();
},
WXCameraDestroy(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.destroy();
},
WXCameraListenFrameChange(id) {
const obj = getObject(id);
if (!obj) {
return;
}
obj.listenFrameChange();
},
WXCameraOnAuthCancel(id) {
const obj = getObject(id);
if (!obj) {
return;
}
const callback = (res) => {
const resStr = JSON.stringify({
callbackId: id,
res: JSON.stringify(res),
});
moduleHelper.send('CameraOnAuthCancelCallback', resStr);
};
obj.onAuthCancel(callback);
},
WXCameraOnCameraFrame(id) {
const obj = getObject(id);
if (!obj) {
return;
}
const callback = (res) => {
cacheArrayBuffer(id, res.data);
const resStr = JSON.stringify({
callbackId: id,
res: JSON.stringify({
width: res.width,
height: res.height,
}),
});
moduleHelper.send('CameraOnCameraFrameCallback', resStr);
};
obj.onCameraFrame(callback);
},
WXCameraOnStop(id) {
const obj = getObject(id);
if (!obj) {
return;
}
const callback = (res) => {
const resStr = JSON.stringify({
callbackId: id,
res: JSON.stringify(res),
});
moduleHelper.send('CameraOnStopCallback', resStr);
};
obj.onStop(callback);
},
};
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d47af7e8f9a50f446bf39a0589cae248
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,16 @@
const callbacks = [];
let isTriggered = false;
export default {
addCreatedListener(callback) {
if (isTriggered) {
callback();
}
else {
callbacks.push(callback);
}
},
_triggerCallback() {
isTriggered = true;
callbacks.forEach(v => v());
},
};
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6b3566bc3a916b94cae488c7d177f65c
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,46 @@
import response from './response';
import moduleHelper from './module-helper';
import { formatJsonStr } from './utils';
function getDefaultData(canvas, conf) {
const config = formatJsonStr(conf);
if (typeof config.x === 'undefined') {
config.x = 0;
}
if (typeof config.y === 'undefined') {
config.y = 0;
}
if (typeof config.width === 'undefined' || config.width === 0) {
config.width = canvas.width;
}
if (typeof config.height === 'undefined' || config.height === 0) {
config.height = canvas.height;
}
if (typeof config.destWidth === 'undefined' || config.destWidth === 0) {
config.destWidth = canvas.width;
}
if (typeof config.destHeight === 'undefined' || config.destHeight === 0) {
config.destHeight = canvas.height;
}
return config;
}
export default {
WXToTempFilePathSync(conf) {
return canvas.toTempFilePathSync(getDefaultData(canvas, conf));
},
WXToTempFilePath(conf, s, f, c) {
if (conf) {
canvas.toTempFilePath({
...getDefaultData(canvas, conf),
...response.handleText(s, f, c),
success: (res) => {
moduleHelper.send('ToTempFilePathCallback', JSON.stringify({
callbackId: s,
errMsg: res.errMsg,
errCode: res.errCode || 0,
tempFilePath: res.tempFilePath,
}));
},
});
}
},
};
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0fd6799d2bdb20a4a9bb599faf72c085
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,171 @@
import moduleHelper from './module-helper';
import { formatJsonStr, uid } from './utils';
let MiniGameChat;
let instance;
let onList;
function createMiniGameChat(options, callback) {
try {
if (typeof requirePlugin !== 'undefined') {
if (!MiniGameChat) {
MiniGameChat = requirePlugin('MiniGameChat', {
enableRequireHostModule: true,
customEnv: {
wx,
},
}).default;
}
if (instance) {
return '';
}
instance = new MiniGameChat(options);
if (typeof instance === 'undefined' || typeof instance.on === 'undefined') {
console.error('MiniGameChat create error');
return '';
}
// 等待插件初始化完成
instance.on('ready', () => {
if (!GameGlobal.miniGameChat) {
GameGlobal.miniGameChat = instance;
if (!onList) {
onList = {};
}
Object.keys(onList).forEach((eventType) => {
if (!onList) {
onList = {};
}
Object.values(onList[eventType]).forEach((callback) => {
instance.on(eventType, callback);
});
});
instance.emit('ready');
callback(instance);
}
});
instance.on('error', (err) => {
console.log('插件初始化失败', err);
});
return uid();
}
}
catch (e) {
console.error(e);
return '';
}
}
export default {
WXChatCreate(optionsStr) {
const options = formatJsonStr(optionsStr);
return createMiniGameChat({
x: options.x,
y: options.y,
autoShow: false,
logoUrl: options.logoUrl || '',
movable: options.movable,
enableSnap: options.enableSnap,
scale: options.scale,
}, (instance) => {
instance.on('error', (err) => {
console.error('error', err);
});
});
},
WXChatHide() {
if (!GameGlobal.miniGameChat) {
return;
}
GameGlobal.miniGameChat.hide();
},
WXChatShow(optionsStr) {
if (!GameGlobal.miniGameChat) {
return;
}
const options = formatJsonStr(optionsStr);
GameGlobal.miniGameChat.show({
x: options.x,
y: options.y,
});
},
WXChatClose() {
if (!GameGlobal.miniGameChat) {
return;
}
GameGlobal.miniGameChat.close();
},
WXChatOpen(key) {
if (!GameGlobal.miniGameChat) {
return;
}
GameGlobal.miniGameChat.open(key || '');
},
WXChatSetTabs(keysStr) {
if (!GameGlobal.miniGameChat) {
return;
}
if (!keysStr) {
// eslint-disable-next-line no-param-reassign
keysStr = '[]';
}
const keys = JSON.parse(keysStr);
GameGlobal.miniGameChat.setTabs(keys);
},
WXChatOff(eventType) {
const { miniGameChat } = GameGlobal;
if (!miniGameChat) {
return;
}
if (!miniGameChat || typeof onList === 'undefined' || typeof onList[eventType] === 'undefined') {
return;
}
for (const key in Object.keys(onList[eventType])) {
const callback = onList[eventType][key];
if (callback) {
miniGameChat.off(eventType, callback);
}
}
onList[eventType] = {};
},
WXChatOn(eventType) {
const callbackId = uid();
const callback = (res) => {
let result = '';
if (res) {
result = JSON.stringify(res);
}
const resStr = JSON.stringify({
eventType,
result,
});
moduleHelper.send('OnWXChatCallback', resStr);
};
if (!onList) {
onList = {};
}
if (typeof onList[eventType] === 'undefined') {
onList[eventType] = {};
}
if (onList[eventType]) {
onList[eventType][callbackId] = callback;
const { miniGameChat } = GameGlobal;
if (miniGameChat) {
miniGameChat.on(eventType, callback);
}
return callbackId;
}
return '';
},
WXChatSetSignature(signature) {
const { miniGameChat } = GameGlobal;
if (miniGameChat) {
miniGameChat.setChatSignature({ signature });
}
},
};
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: cadba8d765a1a364f80866476496c3ad
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,37 @@
import response from './response';
import { formatJsonStr } from './utils';
const CloudIDObject = {};
function fixWXCallFunctionData(data) {
for (const key in data) {
if (typeof data[key] === 'object') {
fixWXCallFunctionData(data[key]);
}
else if (typeof data[key] === 'string' && CloudIDObject[data[key]]) {
data[key] = CloudIDObject[data[key]];
}
}
}
export default {
WXCallFunctionInit(conf) {
const config = formatJsonStr(conf);
wx.cloud.init(config);
},
WXCallFunction(name, data, conf, s, f, c) {
const d = JSON.parse(data);
fixWXCallFunctionData(d);
wx.cloud.callFunction({
name,
data: d,
config: conf === '' ? null : JSON.parse(conf),
...response.handlecloudCallFunction(s, f, c),
});
},
WXCloudID(cloudId) {
const res = wx.cloud.CloudID(cloudId);
const r = JSON.stringify(res);
CloudIDObject[r] = res;
return r;
},
};
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: aafccbbbbaa00a447844823407a06c54
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1 @@
export const MODULE_NAME = 'WXSDKManagerHandler';
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 6fde30b28fa0ad841879b969541b8684
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,87 @@
export default {
init() {
this.fixTimer();
},
fixTimer() {
const wm = {};
const privateSetTimeout = window.setTimeout;
let id = 0;
const getId = function () {
id += 1;
if (id > 100000000) {
id = 0;
}
return id;
};
window.setTimeout = function (vCallback, nDelay) {
const aArgs = Array.prototype.slice.call(arguments, 2);
const id = getId();
const t = privateSetTimeout(vCallback instanceof Function
? () => {
vCallback.apply(null, aArgs);
delete wm[id];
}
: vCallback, nDelay);
wm[id] = t;
return id;
};
const privateClearTimeout = window.clearTimeout;
window.clearTimeout = function (id) {
if (id) {
const t = wm[id];
if (t) {
privateClearTimeout(t);
delete wm[id];
}
}
};
const privateSetInterval = window.setInterval;
window.setInterval = function (vCallback, nDelay) {
const aArgs = Array.prototype.slice.call(arguments, 2);
const id = getId();
const t = privateSetInterval(vCallback instanceof Function
? () => {
vCallback.apply(null, aArgs);
}
: vCallback, nDelay);
wm[id] = t;
return id;
};
const privateClearInterval = window.clearInterval;
window.clearInterval = function (id) {
if (id) {
const t = wm[id];
if (t) {
privateClearInterval(t);
delete wm[id];
}
}
};
const privateRequestAnimationFrame = window.requestAnimationFrame;
window.requestAnimationFrame = function (vCallback) {
const id = getId();
const t = privateRequestAnimationFrame(() => {
vCallback(0);
delete wm[id];
});
wm[id] = t;
return id;
};
const privateCancelAnimationFrame = window.cancelAnimationFrame;
window.cancelAnimationFrame = function (id) {
const t = wm[id];
if (t) {
privateCancelAnimationFrame(t);
delete wm[id];
}
};
},
};
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1c23889505c31a94380074a0bc61dd88
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f6215d5ab5ef679498939e01a0e1b7f8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,66 @@
export default function fixCmapTable(arrayBuffer) {
const font = new DataView(arrayBuffer);
const tableCount = font.getUint16(4);
let cmapOffset = 0;
let cmapLength = 0;
let cmapCheckSumOffset = 0;
let cmapCheckSum = 0;
for (let i = 0; i < tableCount; i++) {
const tag = font.getUint32(12 + i * 16);
if (tag === 0x636D6170) {
cmapCheckSumOffset = 12 + i * 16 + 4;
cmapCheckSum = font.getUint32(cmapCheckSumOffset);
cmapOffset = font.getUint32(12 + i * 16 + 8);
cmapLength = font.getUint32(12 + i * 16 + 12);
GameGlobal.manager.Logger.pluginLog(`[font]cmapCheckSubOffset [${cmapCheckSumOffset}], cmapCheckSum [${cmapCheckSum}], cmapOffset [${cmapOffset}], cmapLength [${cmapLength}]`);
}
}
if (cmapOffset === 0) {
GameGlobal.manager.Logger.pluginError('[font]not found cmap');
return false;
}
const cmap = new DataView(arrayBuffer, cmapOffset, cmapLength);
const numTables = cmap.getUint16(2);
let subtableOffset = 4;
let targetSubtableOffset = 0;
for (let i = 0; i < numTables; i++) {
const platformId = cmap.getUint16(subtableOffset);
const encodingId = cmap.getUint16(subtableOffset + 2);
if (platformId === 0 && encodingId === 5) {
if (i === (numTables - 1)) {
targetSubtableOffset = subtableOffset;
GameGlobal.manager.Logger.pluginLog(`[font]targetSubtableOffset ${targetSubtableOffset}`);
}
break;
}
subtableOffset += 8;
}
if (targetSubtableOffset > 0) {
const newCmapView = new DataView(arrayBuffer, cmapOffset, cmapLength - 8);
newCmapView.setUint16(2, numTables - 1);
let sum = 0;
const lengthInUint32 = (newCmapView.byteLength + 3) / 4;
for (let i = 0; i < lengthInUint32; i++) {
sum += newCmapView.getUint32(i);
}
font.setUint32(cmapCheckSumOffset, sum);
return true;
}
GameGlobal.manager.Logger.pluginLog('[font]not found cmap subtable');
return false;
}

Some files were not shown because too many files have changed in this diff Show More