跳到主要内容

版本更新记录

版本更新记录

如果您之前查看过旧版本(0.0.1)的 SDK 指南,请在此部分确认变更内容。


v0.2.0 (2026-06-24) — 当前版本

新功能

  1. 新增统一奖励槽位 API:将奖励视频、横幅、分享统一为单一槽位模型。查询活动槽位进行渲染,用户点击时通过 ShowRewardedAd(slot) 执行。

    TudadaSDK.Instance.GetRewardedAdSlots(
    onSuccess: res =>
    {
    if (res.slots.Length == 0) return;
    var slot = res.slots[0];
    // 默认 video/share 槽位的 slotData 可能为 null — 访问前请判空
    TudadaSDK.Instance.ShowRewardedAd(slot,
    onSuccess: r => { if (r.isEnded) GiveReward(); });
    });
    • 新增:GetRewardedAdSlots(...) / GetRewardedAdSlot(slotId, ...)
    • 新增 ShowRewardedAd(slot) 重载 — 由平台按 action(REWARD_VIDEO/BANNER/SHARE)自动分发
    • 新类型:RewardedAdSlotRewardSlotData
    • 原横幅 API(GetAvailableBannerIds/GetBanner/RunBannerAction)由统一槽位替代(保留以兼容)
  2. 新增支付(Payment) API:新增游戏内商品购买 API。游戏仅通过 productId 购买,支付方式、价格、验证及发放由平台处理。

    TudadaSDK.Instance.payment.GetProducts(
    onSuccess: res => { /* res.products */ },
    onFail: err => Debug.LogError(err.code)); // PaymentFailResult — 通过 code 分支
    • payment.GetProducts() / GetProduct() / Purchase() / GetTransaction()
    • onFailPaymentFailResult(code/errMsg/txnKey/failReason) — 通过 code 分支
    • 通过 JS SDK 向平台往返通信运行 — 可用性与结果由平台判定(不提供支付时为 PAYMENT_UNAVAILABLE
  3. SystemInfoAppBaseInfo 新增 servicePlatform 字段:识别游戏运行于哪个宿主服务("kakaotalk" / "kakaopay" / "house")。

    var info = TudadaSDK.Instance.GetSystemInfoSync();
    Debug.Log(info.servicePlatform); // "kakaotalk" | "kakaopay" | "house"

即将弃用 (Deprecated)

  • CreateRewardedVideoAd / TudadaRewardedVideoAd(旧版) — wx 兼容的旧版实例 API。已由统一 API ShowRewardedAd() 替代,将在下一版本中移除。已添加 [System.Obsolete] 特性(使用时产生编译警告)。

v0.1.6 (2026-05-12)

新功能

  1. 新增 Banner Ad API(槽位模型):新增 API,游戏可按各个槽位获取横幅图片并自行渲染,用户点击时由平台处理对应动作。

    // 1) 获取活动横幅槽位 ID 列表
    TudadaSDK.Instance.GetAvailableBannerIds(
    onSuccess: (result) => Debug.Log("槽位: " + string.Join(",", result.bannerIds))
    );

    // 2) 获取与槽位匹配的横幅数据
    TudadaSDK.Instance.GetBanner("main_menu_top",
    onSuccess: (result) => {
    if (result.banner != null) RenderBanner(result.banner.imageUrl);
    }
    );

    // 3) 用户点击时委托动作(奖励由游戏自行处理)
    TudadaSDK.Instance.RunBannerAction("main_menu_top");
    • bannerId 同时充当游戏定义的槽位名
    • RunBannerAction 仅传递 success/fail 信号 — 奖励发放由游戏自行处理
    • 详细指南:Ad API → Banner Ad
  2. 新增 TudadaSDK.GameAction 动作日志 API(Phase 1):fire-and-forget 方式发送生命周期动作。

    TudadaSDK.Instance.GameAction.Start();
    TudadaSDK.Instance.GameAction.Complete(new GameActionCompleteOption {
    payload = new GameActionPayload { score = 1200, level = 5 }
    });
    TudadaSDK.Instance.GameAction.Exit(new GameActionExitOption {
    payload = new GameActionPayload { reason = "USER_QUIT" }
    });
    • Start(option?) / Complete(option) / Exit(option) — 生命周期动作信号
    • fire-and-forget;下游分发由平台负责
    • 详细指南:GameAction API
  3. Login() 响应新增用户信息凭证字段

    LoginResult 新增 userInfoPayload / userInfoSignature 字段。

    TudadaSDK.Instance.Login(
    onSuccess: (result) => {
    Debug.Log(result.code + " " + result.userId);
    SendToGameServer(result.userInfoPayload, result.userInfoSignature);
    }
    );
  4. GetUserInfo() 响应重塑为 Tudada-fit(破坏性变更)

    GetUserInfoResult 中移除了 wx 兼容的 4 个字段(encryptedData/iv/signature/rawData),改为返回与 Login() 相同的凭证(userInfoPayload/userInfoSignature)。withCredentials 参数也一并移除,签名简化为 GetUserInfo(onSuccess, onFail)

    // before (v0.1.5)
    TudadaSDK.Instance.GetUserInfo(withCredentials: true,
    onSuccess: (result) => {
    // result.encryptedData/iv/signature 仅为 mock
    }
    );

    // after (v0.1.6)
    TudadaSDK.Instance.GetUserInfo(
    onSuccess: (result) => {
    Debug.Log(result.userInfo.nickName);
    SendToGameServer(result.userInfoPayload, result.userInfoSignature);
    }
    );

v0.1.5 (2026-03-30)

新功能

  1. 新增 ShareForReward API: 新增了完成分享后发放奖励的 API。

    TudadaSDK.Instance.ShareForReward(
    url: "https://example.com/share", // 可选
    onSuccess: (result) => {
    if (result.rewarded) Debug.Log("分享完成 — 发放奖励");
    },
    onFail: (error) => Debug.LogError($"分享失败: {error}")
    );
    • ShareForReward(url, onSuccess, onFail): 分享 + 奖励处理
    • 分享处理由平台自动执行

所需文件:

  • Game SDK: tudadaGameSDK.0.1.5.js
  • Unity Client: tudada-unity-client-v0.1.5-hotfix0420.unitypackage

v0.1.4 (2026-03-18)

新功能

  1. 新增 ShowRewardedAd API: 通过一次调用即可完成激励广告的加载到展示全流程。

    TudadaSDK.Instance.ShowRewardedAd("your-ad-unit-id",
    onSuccess: (result) => {
    if (result.isEnded) Debug.Log("观看完成 - 发放奖励");
    },
    onFail: (error) => Debug.LogError($"广告失败: {error.errMsg}")
    );
    • ShowRewardedAd(adUnitId, onSuccess, onFail): 加载 + 展示一体化处理
    • 加载 UI、重试、失败弹窗由平台自动处理
    • CreateRewardedVideoAd 作为旧版保留
  2. 新增 CheckFeature API: 可以预先确认特定 API 在当前平台是否受支持。

    TudadaSDK.Instance.CheckFeature("startAccelerometerSensor",
    onSuccess: (result) => Debug.Log($"支持: {result.apiName}"),
    onFail: (result) => Debug.Log($"不支持: {result.status}")
    );
    • CheckFeature(apiName, onSuccess, onFail): 检查 API 支持情况
    • CheckFeatureStatus: supported, unknown_api, version_required, platform_unsupported, device_unsupported, permission_denied
  3. 新增 LaunchOptions API: 可以查询游戏启动时传递的查询参数及引荐来源信息。

    TudadaLaunchOptions options = TudadaSDK.Instance.GetLaunchOptions();
    Debug.Log("查询JSON: " + options.query);
    • GetLaunchOptions(): 同步查询启动选项
    • query 为 JSON 字符串(需使用第三方 JSON 库解析)

所需文件:

  • Game SDK: tudadaGameSDK.0.1.4.js
  • Unity Client: tudada-unity-client-v0.1.4.unitypackage

v0.1.3 (2026-02-26)

新功能

  1. 新增 Accelerometer API: 添加了 StartAccelerometerSensor()StopAccelerometerSensor()OnAccelerometerChange 事件。

    TudadaSDK.Instance.OnAccelerometerChange += (res) => {
    Debug.Log($"X: {res.x}, Y: {res.y}, Z: {res.z}");
    };

    TudadaSDK.Instance.StartAccelerometerSensor(
    sensitivity: AccelerometerSensitivity.normal,
    onSuccess: (result) => Debug.Log("传感器启动完成")
    );

    TudadaSDK.Instance.StopAccelerometerSensor();
    • 基于 XYZ 轴的加速度数据接收
    • 灵敏度控制: sensitive | normal | insensitive
    • 扁平 API 模式: StartAccelerometerSensor(), StopAccelerometerSensor(), OnAccelerometerChange
    • 支持 Unity Editor 中的 Input.acceleration 模拟

所需文件:

  • Game SDK: tudadaGameSDK.0.1.4.js
  • Unity Client: tudada-unity-client-v0.1.4.unitypackage

v0.1.2 (2026-02-26)

新功能

  1. SystemInfoAppBaseInfo 新增 environment 字段

    添加了表示当前访问环境的字段。

    SystemInfo info = TudadaSDK.Instance.GetSystemInfoSync();
    Debug.Log(info.environment); // "prod" 或 "dev"

    AppBaseInfo appInfo = TudadaSDK.Instance.GetAppBaseInfo();
    Debug.Log(appInfo.environment); // "prod" 或 "dev"
    说明
    "prod"生产环境
    "dev"开发环境

所需文件:

  • Game SDK: tudadaGameSDK.0.1.2.js
  • Unity Client: tudada-unity-client-v0.1.2.unitypackage

v0.1.1 (2026-02-20)

  • 内部改进(无需修改游戏代码)

v0.1.0 (2026-02-06)

新功能

  1. Login 结果新增 userId 字段

    TudadaSDK.Instance.Login(
    onSuccess: (result) => {
    Debug.Log("码: " + result.code); // 已有
    Debug.Log("用户ID: " + result.userId); // 新增
    }
    );
  2. SystemInfo.wifiEnabled 改为返回实际值

    之前为固定值,现在返回实际的 Wi-Fi 启用状态。

变更事项(需要迁移)

  1. 需要更新 Unity Client 包

    需要重新导入 tudada-unity-client-v0.1.0.unitypackage 及以上版本。请删除旧包后导入新包。

  2. CheckSession 回调结果类型变更

    // 0.0.1 — onSuccess中包含了登录信息
    TudadaSDK.Instance.CheckSession(
    onSuccess: (result) => {
    // result中包含code、userId等
    }
    );

    // 0.1.0之后 — onSuccess仅包含一般结果
    TudadaSDK.Instance.CheckSession(
    onSuccess: (result) => {
    // 仅包含result.errMsg
    // 如需登录信息请单独调用Login()
    }
    );

更新步骤

  1. 导入新的 .unitypackage 文件(覆盖现有文件)
  2. 更新 index.html 中的 SDK 脚本版本:
    <script src="tudadaGameSDK.0.1.0.js"></script>
  3. 如果 CheckSession 回调中使用了登录信息,请将其分离到 Login

v0.0.1 (2026-02-02) — 首次发布

首次发布版本。包含以下 API:

  • Auth API (Login, CheckSession, GetUserInfo)
  • Storage API (Set/Get/Remove/Clear Storage + Sync 版本)
  • TudadaStore API (云存储)
  • System API (GetSystemInfoSync, GetWindowInfo, GetDeviceInfo 等)
  • Device API (振动、键盘、剪贴板)
  • Ad API (激励视频广告)
  • Lifecycle API (OnShow, OnHide, ExitMiniProgram, RestartMiniProgram)

Copyright 2026 Tudada. All rights reserved.