1.初始化:
WX.InitSDK((jsCode) =>
{
Debug.Log("*** InitSDK success ");
FunGetSysten();
Init1();
});
2.获取系统信息
private void FunGetSysten()
{
Debug.Log("*** GetSystemInfo ");
GetSystemInfoOption getSystemInfoOption = new GetSystemInfoOption();
getSystemInfoOption.success = ((e) =>
{
systemInfo = e;
switch (e.platform)
{
case "android":
weChatSystemType = WeChatSystemType.android;
break;
case "ios":
weChatSystemType = WeChatSystemType.ios;
break;
case "windows":
weChatSystemType = WeChatSystemType.windows;
break;
case "mac":
weChatSystemType = WeChatSystemType.mac;
break;
case "devtools":
weChatSystemType = WeChatSystemType.devtools;
break;
default:
weChatSystemType = WeChatSystemType.other;
break;
}
if (e.platform == "android")
{
}
else
if (e.platform == "ios")
{
weChatSystemType = WeChatSystemType.ios;
}
Debug.Log("*** GetSystemInfo success " + e.platform);
});
getSystemInfoOption.fail = ((e) =>
{
Debug.Log("****** FunGetSysten fail :" + e.errMsg);
});
WX.GetSystemInfo(getSystemInfoOption);
var info = WX.GetSystemInfoSync();
if (info != null)
{
Systen2_top = (float)info.safeArea.top;
Systen2_windowHeight = (float)info.windowHeight;
Systen2_pixelRatio = (float)info.pixelRatio;
}
}
3.获取code
public void Init1(Action action = null)
{
unity 微信小游戏登录(通过code获取openid),充值
于 2024-07-25 11:55:54 首次发布