Skip to content

Commit 08ded06

Browse files
authored
Merge branch 'wechat-miniprogram:main' into Share
2 parents 56f847e + d37a69a commit 08ded06

39 files changed

+4173
-680
lines changed

.config/.vitepress/config.mts

+2-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ export default defineConfig({
141141
{ text: "后端服务指引", link: "/Design/BackendServiceStartup" },
142142
{ text: "网络通信适配", link: "/Design/UsingNetworking" },
143143
{ text: "使用水印保护代码包安全", link: "/Design/wasmWaterMark" },
144-
{ text: "配置构建模板", link: "/Design/BuildTemplate.md" }
144+
{ text: "配置构建模板", link: "/Design/BuildTemplate.md" },
145+
{ text: "实时预览工具", link: "/Design/WechatPreview.md" },
145146
],
146147
},
147148
{

CHANGELOG.md

+25-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,31 @@ SDK安装指引:[微信小游戏Unity、团结引擎转换插件WXSDK](Design/
1111
1. UnityPackage:[下载地址](https://game.weixin.qq.com/cgi-bin/gamewxagwasmsplitwap/getunityplugininfo?download=1)
1212
2. PackageManager(git URL): https://github.com/wechat-miniprogram/minigame-tuanjie-transform-sdk.git
1313

14-
## 2024-11-15 【预发布】
15-
PackageManager(git URL): https://github.com/wechat-miniprogram/minigame-tuanjie-transform-sdk.git#pre-v0.1.23
14+
## 2025-1-8 【预发布】
15+
PackageManager(git URL): https://github.com/wechat-miniprogram/minigame-tuanjie-transform-sdk.git#pre-v0.1.25
16+
17+
## 2024-1-7 【重要更新】
18+
### Feature
19+
* 重要:支持Unity6,仅作为测试版本不建议上线使用
20+
* 普通: OffShareMessageToFriend支持
21+
* 普通:性能深度分析工具版本更新
22+
### Fixed
23+
* 普通: reserveChannelsLive补充回调参数
24+
* 普通: 低基础库版本报错修复
25+
* 普通: BannerAd.OnResize回调报错修复
26+
* 普通: requestMidasPaymentGameItem修复
27+
* 普通: WriteSync接口无法正常返回已写入的字节数
28+
* 普通: ReadSync接口无法正常调用
29+
30+
## 2024-12-18 【重要更新】
31+
### Feature
32+
* 普通: 开放数据域支持screenCanvas
33+
* 普通: 完善screenCanvas.toTempFilePath
34+
* 普通: 低版本WindowInfo适配
35+
* 普通: 调整autoAdaptScreen默认false
36+
* 普通: 首资源包放小游戏分包时,总大小调整为30MB
37+
### Fixed
38+
* 重要: 更改WebGLInput.mobileKeyboardSupport默认属性为 false,该属性导致Unity2022 以上版本 Touch 会多调用一次 MainLoop产生较大性能损耗。请使用微信键盘API或 WXTouchInputOverride支持文本输入框
1639

1740
## 2024-11-14 【普通更新】
1841
### Feature

Demo/API_V2/Assets/API/Report/ReportEvent/ReportEventSO.asset

+1
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ MonoBehaviour:
2828
initialButtonText: "\u4E8B\u4EF6\u4E0A\u62A5"
2929
extraButtonList: []
3030
initialResultList: []
31+
entryOrder: 0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
using UnityEngine;
2+
using UnityEngine.UI;
3+
using UnityEngine.Video;
4+
using WeChatWASM;
5+
6+
public class VideoController : MonoBehaviour
7+
{
8+
public VideoPlayer videoPlayer; // 关联 VideoPlayer 组件
9+
public Button playButton; // 关联播放按钮
10+
public Button pauseButton; // 关联暂停按钮
11+
public string[] videoUrls; // 视频路径
12+
private int currentVideoIndex = 0;
13+
14+
void Start()
15+
{
16+
// 设置视频路径
17+
videoPlayer.url = videoUrls[currentVideoIndex];
18+
19+
// 添加按钮点击事件
20+
playButton.onClick.AddListener(PlayVideo);
21+
pauseButton.onClick.AddListener(PauseVideo);
22+
23+
// 添加视频播放完成事件
24+
videoPlayer.loopPointReached += OnVideoEnd;
25+
26+
}
27+
28+
void PlayVideo()
29+
{
30+
if (videoPlayer.isPaused)
31+
{
32+
videoPlayer.Play(); // 如果视频已暂停,则继续播放
33+
}
34+
}
35+
36+
void PauseVideo()
37+
{
38+
if (videoPlayer.isPlaying)
39+
{
40+
videoPlayer.Pause(); // 暂停视频
41+
}
42+
}
43+
44+
// 视频播放完成时调用的方法
45+
void OnVideoEnd(VideoPlayer vp)
46+
{
47+
WX.ShowModal(new ShowModalOption()
48+
{
49+
title = "提示",
50+
content = "视频播放完成",
51+
showCancel = false,
52+
success = (res) => {
53+
}
54+
});
55+
// 增加当前视频索引
56+
currentVideoIndex++;
57+
58+
// 检查是否还有下一个视频
59+
if (currentVideoIndex < videoUrls.Length)
60+
{
61+
videoPlayer.url = videoUrls[currentVideoIndex]; // 设置下一个视频的 URL
62+
}
63+
else
64+
{
65+
currentVideoIndex = 0; // 如果没有下一个视频,重置索引(可选)
66+
}
67+
videoPlayer.url = videoUrls[currentVideoIndex];
68+
videoPlayer.Play(); // 播放下一个视频
69+
}
70+
}

Demo/API_V2/Assets/API/Video/VideoController.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
using UnityEngine;
2+
using UnityEngine.UI;
3+
using UnityEngine.Video;
4+
5+
public class VideoPlayerSliderController : MonoBehaviour
6+
{
7+
public VideoPlayer m_player;
8+
public Slider m_slider;
9+
public bool m_bMouseUp = true;
10+
void Start()
11+
{
12+
m_slider.onValueChanged.AddListener((float value) =>
13+
{
14+
if (!m_bMouseUp)
15+
{
16+
SliderEvent(value);
17+
}
18+
});
19+
}
20+
21+
private void FixedUpdate()
22+
{
23+
if (m_bMouseUp)
24+
{
25+
m_slider.value = m_player.frame / (m_player.frameCount * 1.0f);
26+
}
27+
}
28+
29+
public void PointerDown()
30+
{
31+
m_player.Pause();
32+
m_bMouseUp = false;
33+
}
34+
35+
public void PointerUp()
36+
{
37+
m_player.Play();
38+
m_bMouseUp = true;
39+
}
40+
41+
public void SliderEvent(float value)
42+
{
43+
m_player.frame = long.Parse((value * m_player.frameCount).ToString("0."));
44+
}
45+
46+
public void PointerClick()
47+
{
48+
// 暂停视频
49+
m_player.Pause();
50+
51+
// 获取点击位置相对于滑动条的比例
52+
RectTransform rt = m_slider.GetComponent<RectTransform>();
53+
Vector2 localPoint;
54+
RectTransformUtility.ScreenPointToLocalPointInRectangle(rt, Input.mousePosition, null, out localPoint);
55+
56+
// 计算点击位置对应的值
57+
float percentage = (localPoint.x - rt.rect.xMin) / rt.rect.width;
58+
percentage = Mathf.Clamp01(percentage);
59+
60+
// 设置视频帧
61+
m_player.frame = long.Parse((percentage * m_player.frameCount).ToString("0."));
62+
// 更新滑动条值
63+
m_slider.value = percentage;
64+
65+
// 继续播放视频
66+
m_player.Play();
67+
}
68+
}

Demo/API_V2/Assets/API/Video/VideoPlayerSliderController.cs.meta

+11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)