diff --git a/Design/AndroidProfile.md b/Design/AndroidProfile.md index d6efa177..6fa1e83e 100644 --- a/Design/AndroidProfile.md +++ b/Design/AndroidProfile.md @@ -35,7 +35,7 @@ - 2.1 通过webgl导出目录下的symbols文件对照映射 - 2.2 通过[替换脚本](https://github.com/wechat-miniprogram/minigame-unity-webgl-transform/blob/main/tools/update_v8_wasm_profile.py)对cpuprofile进行自动映射到真实函数。使用方式:python update_v8_wasm_profile.py $cpuprofile $symbol 3. 如希望能从游戏启动立即抓取profile,请在game.js末尾代码稍作修改: - ``` + ```js const gl = GameGlobal.canvas.getContext('webgl') gl.clear(gl.COLOR_BUFFER_BIT); setTimeout(() => { diff --git a/Design/BackendServiceStartup.md b/Design/BackendServiceStartup.md index c407458b..2066b139 100644 --- a/Design/BackendServiceStartup.md +++ b/Design/BackendServiceStartup.md @@ -71,7 +71,7 @@ exports.main = async (event, context) => { 修改 config.json,增加对 openapi.security.msgSecCheck 的声明,如没有用到 openapi 则无需修改 config.json: -``` +```json "permissions": { "openapi": [ "security.msgSecCheck" diff --git a/Design/FirstSceneOptimization.md b/Design/FirstSceneOptimization.md index 18a96dfd..8c050267 100644 --- a/Design/FirstSceneOptimization.md +++ b/Design/FirstSceneOptimization.md @@ -42,7 +42,7 @@ ## CallMain Profile分析 1.改造小游戏代码 因为安卓采集Profile文件需要手动控制,而CallMain会在码包下载编译完成和首包资源下载完成后就执行,为了录制启动阶段完整的Profile,需要保证Profile的录制开始之后才真正执行游戏开始逻辑,找到项目的game.js文件,改造最后几行即可: -``` +```js // gameManager.startGame(); wx.onTouchStart((result) => { diff --git a/Design/HowToDebug.md b/Design/HowToDebug.md index 1280363f..21fffb71 100644 --- a/Design/HowToDebug.md +++ b/Design/HowToDebug.md @@ -29,7 +29,7 @@ 1. 已验证Unity版本:2018.3/2018.4LTS、2019.2/2019.4LTS 安装时选择WebGL组件 2. 如果你用的是Big Sur版本的Mac系统,并且Unity 版本小于 2019.4.14, 则需另外安装 [python3](https://www.python.org/downloads/),并安装brotli 命令如下 -``` +```sh python3 -m pip install brotli ``` diff --git a/Design/InputAdaptation.md b/Design/InputAdaptation.md index a8ccafa6..c2679dbb 100644 --- a/Design/InputAdaptation.md +++ b/Design/InputAdaptation.md @@ -9,7 +9,7 @@ 详细示例请参考[API Demo](https://github.com/wechat-miniprogram/minigame-unity-webgl-transform/tree/main/Demo/API) 以UGUI的Input组件为例,需要给Input 绑定以下脚本: -``` +```csharp using UnityEngine; using System.Collections; using WeChatWASM; diff --git a/Design/WX_SDK.md b/Design/WX_SDK.md index 82a81826..081aad81 100644 --- a/Design/WX_SDK.md +++ b/Design/WX_SDK.md @@ -10,7 +10,7 @@ API可以直接看`WX.cs`这个文件,里面有`详细注释说明`。 本Unity的SDK的API大体与[官网](https://developers.weixin.qq.com/minigame/dev/guide/)的JS版本API类似,使用时可以参考之。 如JS版的banner广告的调用如下: -``` +```js var bannerAd = wx.createBannerAd({ adUnitId: "xxxx", adIntervals: 30, @@ -29,7 +29,7 @@ API可以直接看`WX.cs`这个文件,里面有`详细注释说明`。 }); ``` 而对于Unity版的调用如下: -``` +```csharp var bannerAd = WX.CreateBannerAd(new WXCreateBannerAdParam() { @@ -64,7 +64,7 @@ API可以直接看`WX.cs`这个文件,里面有`详细注释说明`。 1. 只保留game.js前面import部分,其余删除,即不运行游戏逻辑。 2. 增加以下代码: -``` +```js const gl = GameGlobal.canvas.getContext('webgl') gl.clear(gl.COLOR_BUFFER_BIT); ``` diff --git a/Design/fixScreen.md b/Design/fixScreen.md index 2777bd74..db00a22a 100644 --- a/Design/fixScreen.md +++ b/Design/fixScreen.md @@ -11,7 +11,7 @@ var info = WX.GetWindowInfo(); float py = (float)info.safeArea.top / (float)info.windowHeight; // Rootrect初始时设置其Anchor,使其与父节点一样大,也就是屏幕的大小 // 调整屏幕移到刘海屏下面, -Rootrect.anchorMin = new Vector2((float)info.safeArea.left / (float)info.windowWidth, -(float)info.safeArea.top / (float)info.windowHeight ); +Rootrect.anchorMin = new Vector2((float)info.safeArea.left / (float)info.windowWidth, -(float)info.safeArea.top / (float)info.windowHeight); // 重新计算缩放,让高度占满刘海屏以下的区域 cs.referenceResolution = new Vector2(cs.referenceResolution.x, cs.referenceResolution.y * (1.0f+py)); ``` diff --git a/Design/video.md b/Design/video.md index e37b1325..e688dfec 100644 --- a/Design/video.md +++ b/Design/video.md @@ -1,4 +1,4 @@ -# 视频设计 +# 视频设计规范 *建议启动视频内带有团队宣传logo动画,游戏logo动画,带有吸引力的游戏玩法视频* ---