2024-12-05 21:14:41 +08:00
|
|
|
|
# cocos js开发
|
|
|
|
|
将`cocos-embed/SoyooFacade.ts`加进项目
|
|
|
|
|
然后注释,调用对应的SoyooFacade对象的方法。
|
|
|
|
|
必须要调用的方法有:
|
|
|
|
|
```
|
|
|
|
|
SoyooFacade.ReportLifeCycle(SoyooLifecyle.Ready)
|
|
|
|
|
SoyooFacade.ReportLifeCycle(SoyooLifecyle.Start)
|
|
|
|
|
SoyooFacade.ReportLifeCycle(SoyooLifecyle.Complete)
|
|
|
|
|
SoyooFacade.InstallGame()
|
|
|
|
|
```
|
|
|
|
|
|
2025-01-07 22:32:42 +08:00
|
|
|
|
# zip文件渠道
|
|
|
|
|
这些渠道的最终产物是一个zip包。
|
|
|
|
|
zip文件的默认打包方式,是根据以下不同渠道操作后,将web-mobile文件打包成zip。
|
|
|
|
|
|
|
|
|
|
## 1. 渠道处理
|
|
|
|
|
### facebook
|
2024-12-05 21:14:41 +08:00
|
|
|
|
把`networks/facebook.js`复制到web-mobile目录下。
|
|
|
|
|
在w`web-mobile/index.html`的"</head>"的上一行添加代码
|
|
|
|
|
```
|
|
|
|
|
<script src="facebook.js" charset="utf-8"></script>
|
|
|
|
|
```
|
|
|
|
|
|
2025-01-07 22:32:42 +08:00
|
|
|
|
### google
|
2024-12-05 21:14:41 +08:00
|
|
|
|
把`networks/google.js`复制到web-mobile目录下。
|
|
|
|
|
在w`web-mobile/index.html`的"</head>"的上一行添加代码
|
|
|
|
|
```
|
|
|
|
|
<meta name="ad.size" content="width=480,height=320">
|
|
|
|
|
<script src="google.js" charset="utf-8"></script>
|
|
|
|
|
```
|
|
|
|
|
|
2025-01-07 22:32:42 +08:00
|
|
|
|
### tiktok
|
2024-12-05 21:14:41 +08:00
|
|
|
|
把`tiktok/tiktok.js`和`tiktok/config.json`复制到web-mobile目录下。
|
|
|
|
|
在w`web-mobile/index.html`的"</head>"的上一行添加代码
|
|
|
|
|
```
|
|
|
|
|
<script src="tiktok.js" charset="utf-8"></script>
|
|
|
|
|
```
|
|
|
|
|
|
2024-12-31 21:08:26 +08:00
|
|
|
|
在<body>里添加
|
|
|
|
|
```
|
|
|
|
|
<script src= "https://sf16-muse-va.ibytedtos.com/obj/union-fe-nc-i18n/playable/sdk/playable-sdk.js"></script>
|
|
|
|
|
```
|
|
|
|
|
|
2025-01-07 22:32:42 +08:00
|
|
|
|
### 2. 打包
|
|
|
|
|
将web-mobile文件内容压缩成zip包。注意,zip包的第一层级需要包含index.html。
|
|
|
|
|
|
|
|
|
|
## vungle
|
|
|
|
|
1. 把networks/mraid_support.js 复制到web-mobile下
|
|
|
|
|
2. 编辑复制的mraid_support.js, 在前几行填入对应的iosUrl和androidUrl
|
|
|
|
|
3. 编辑index.html,在body最后加上
|
|
|
|
|
`js
|
|
|
|
|
<script src="mraid_support.js" charset="utf-8"></script>
|
|
|
|
|
`
|
|
|
|
|
|
2024-12-05 21:14:41 +08:00
|
|
|
|
# 单HTML渠道
|
2025-01-07 22:32:42 +08:00
|
|
|
|
## 1. 环境配置
|
2024-12-05 21:14:41 +08:00
|
|
|
|
需要安装nodejs
|
|
|
|
|
打开soyoo-cocos后,先执行`npm install`安装依赖
|
|
|
|
|
|
2025-01-07 22:32:42 +08:00
|
|
|
|
## 2.预处理html
|
2024-12-05 21:14:41 +08:00
|
|
|
|
0. 把目标目录web-mobile复制到soyoo-cocos目录下。
|
|
|
|
|
1. 删掉index.html里的js代码部分
|
|
|
|
|
2. 在body最后加上
|
2024-12-11 11:38:59 +08:00
|
|
|
|
`
|
2024-12-10 22:42:41 +08:00
|
|
|
|
|
2024-12-11 11:38:59 +08:00
|
|
|
|
<script src="loader-and-starter.js" charset="utf-8"></script>
|
|
|
|
|
<script src="asset-map.js" charset="utf-8"></script>
|
2024-12-10 22:42:41 +08:00
|
|
|
|
|
2024-12-11 11:38:59 +08:00
|
|
|
|
`
|
2024-12-05 21:14:41 +08:00
|
|
|
|
|
2025-01-07 22:32:42 +08:00
|
|
|
|
## 3.渠道处理
|
|
|
|
|
### applovin, unity, liftoff, appier
|
|
|
|
|
1. 把networks/mraid_support.js 复制到web-mobile下
|
|
|
|
|
2. 编辑复制的mraid_support.js, 在前几行填入对应的iosUrl和androidUrl
|
2024-12-05 21:14:41 +08:00
|
|
|
|
3. 编辑index.html,在body最后加上
|
2024-12-10 22:42:41 +08:00
|
|
|
|
`js
|
2025-01-07 22:32:42 +08:00
|
|
|
|
<script src="mraid_support.js" charset="utf-8"></script>
|
2024-12-11 11:38:59 +08:00
|
|
|
|
`
|
2024-12-05 21:14:41 +08:00
|
|
|
|
|
2025-01-07 22:32:42 +08:00
|
|
|
|
### ironsource
|
|
|
|
|
1. 把networks/mraid_support.js 复制到web-mobile下
|
|
|
|
|
2. 编辑复制的mraid_support.js, 在前几行填入对应的iosUrl和androidUrl
|
|
|
|
|
3. 编辑index.html,在body最后加上
|
|
|
|
|
`js
|
|
|
|
|
<script src="mraid.js"></script>
|
|
|
|
|
<script src="mraid_support.js" charset="utf-8"></script>
|
|
|
|
|
`
|
|
|
|
|
|
|
|
|
|
### mintegral
|
2024-12-05 21:14:41 +08:00
|
|
|
|
1. 把networks/mintegral.js 复制到web-mobile下
|
2024-12-09 18:08:19 +08:00
|
|
|
|
2. 编辑index.html,在body最后加上
|
2024-12-11 11:38:59 +08:00
|
|
|
|
`
|
|
|
|
|
<script src="mintegral.js" charset="utf-8"></script>
|
|
|
|
|
`
|
2024-12-05 21:14:41 +08:00
|
|
|
|
|
2024-12-09 18:08:19 +08:00
|
|
|
|
### moloco
|
|
|
|
|
1. 把`networks/moloco.js`复制到web-mobile目录下。
|
|
|
|
|
2. 编辑index.html,在body最后加上
|
2024-12-10 22:42:41 +08:00
|
|
|
|
```js
|
2024-12-09 18:08:19 +08:00
|
|
|
|
<script src="moloco.js" charset="utf-8"></script>
|
|
|
|
|
```
|
|
|
|
|
|
2025-01-07 22:32:42 +08:00
|
|
|
|
|
|
|
|
|
## 4.打包
|
2024-12-05 21:14:41 +08:00
|
|
|
|
执行命令 `node single-html/build.js`
|
2024-12-11 11:38:59 +08:00
|
|
|
|
生成目标文件 `dist/index.html`即为目标文件
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```css
|
|
|
|
|
@media (orientation: landscape) {#splash {background-size: 15% !important;}}
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
<script src="https://cdn.bootcdn.net/ajax/libs/vConsole/3.15.1/vconsole.min.js"></script>
|
|
|
|
|
<script>new VConsole()</script>
|
|
|
|
|
```
|