Steam https://partner.steamgames.com/doc/home
1.打开可执行文件闪退后有重新打开,日志打印:[Steamworks.NET] Shutting down because RestartAppIfNecessary returned true. Steam will restart the application.
可执行文件没有通过Steam启动,如果不是将通过Steam启动
2.Steam小额交易 https://partner.steamgames.com/doc/features/microtransactions/implementation
需要设置MicroTxnAuthorizationResponse_t回调;包含参数:
m_unAppID (uint32) 此小额交易的 App ID。m_ulOrderID (uint64) 小额交易的订单 ID。m_bAuthorized (uint8 ) 用户授权了此交易(1),还是未授权此交易(0)?
m_unAppID (uint32) 此小额交易的 App ID。m_ulOrderID (uint64) 小额交易的订单 ID。m_bAuthorized (uint8 ) 用户授权了此交易(1),还是未授权此交易(0)?
该回调启用Steam的游戏内叠加面板 可以使用GameOverlayActivated_t回调来判断叠加面板的激活状态。
关于玩家所处国家/地区和货币类型,需要使用 ISteamMicroTxn/GetUserInfo web API 进行获取(服务器发起访问)。
关于测试:使用沙盒进行测试时通过以下URl进行传送 “https://partner.steam-api.com/ISteamMicroTxnSandbox/*” ;
相关参考:
WeGame https://developer.wegame.com/developer/game-wiki/help/doc/getting-started-overview/zh_CN
1.接入WeGame后使用编辑器启用包文件报错 : wegame RailNeedRestartAppForCheckingEnvironment return true!
WeGame Developer文件夹在C盘的根目录下,放到二级目录后可以解决,在桌面上也不会有该报错。
2.防沉迷接入
需要监听rail_anti_addiction_define.h文件中的RailCustomizeAntiAddictionActions中的回调事件。
具体注册方式:
RailCallBackHelper.Instance.RegisterCallback(RAILEventID.kRailEventAntiAddictionCustomizeAntiAddictionActions,方法);已JSON格式返回数据,具体结果为 RailCustomizeAntiAddictionActions结构体中的anti_addiction_actions ,
JSON数据格式:
{
"actions": [
{
"action": {
"type": { "id": 1, "name": "kRailAntiAddictionActionShowTips" },
"title": "游戏温馨提示",
"content": "根据国家防沉迷通知的相关要求和腾讯最新强化的防沉迷策略,由于您是未成年人,
仅能在周五、周六、周日及法定节假日20时至21时进入游戏。",
"display_duration_seconds": 60
}
},
{
"action": {
"type": { "id": 2, "name": "kRailAntiAddictionActionHalt" }
}
}
]
}
可以使用 Newtonsoft.Json 将 JSON转化C#类
首先定义JSON对应的C#数据结构:如果变量名与对应的JSON变量名一致则不需要添加 :“[JsonProperty("对应Json名")]”
/// <summary>
/// 防沉迷数据结构
/// </summary>
internal class AddictionActions
{
[JsonProperty("actions")]
public Action[] Actions = new Action[2];
public class Action
{
[JsonProperty("action")]
public ActionInfo ActionInfo = null;
}
public class ActionInfo
{
[JsonProperty("type")]
public TypeParamInfo TypeInfo = new TypeParamInfo();
[JsonProperty("title")]
public string Title = "";
[JsonProperty("content")]
public string Content = "";
[JsonProperty("display_duration_seconds")]
public int DisplayDurationSeconds = 0;
public class TypeParamInfo
{
[JsonProperty("id")]
public int Id = 0;
[JsonProperty("name")]
public string Name = "";
}
}
}
使用反序列化方法把json转换为C#类
AddictionActions actions = JsonConvert.DeserializeObject<AddictionActions>(addictionActions.anti_addiction_actions);后续根据具体数据进行操作。
对于返回的Json数据说明:
有两种类型:单纯进行防沉迷提示: kRailAntiAddictionActionShowTips ; 阻止进入游戏:kRailAntiAddictionActionHalt
当两种类型都被返回时不仅需要在游戏中绘制防沉迷弹框提示,在玩家关闭防沉迷弹框提示时,需要自动保存游戏进度并立即退出游戏。
仅返回 kRailAntiAddictionActionShowTips 类型时 仅仅需要在游戏中绘制一个防沉迷弹框提示。
防沉迷调试:
调试游戏防沉迷时长的入口位于WeGame开发者版本客户端的系统设置对话框 -->Debug --> 取消勾选:“跳过当前账户的防沉迷检查” --> 配置GameID -->触发防沉迷。
3.内购 只对于多人联机游戏
1.在游戏内购买时需要向服务器发送请求通过服务器WebAPI获取order_id(数据类型string);
2.使用获取到的order_id调用AsyncShowPaymentWindow接口弹出支付面板。
rail_api.RailFactory().RailInGameStorePurchaseHelper().AsyncShowPaymentWindow (“WeGameOrderId”, rail_api.RailFactory().RailPlayer().GetRailID().id_);3.支付界面的显示和关闭可以通过RailInGameStorePurchasePayWindowDisplayed和RailInGameStorePurchasePayWindowClosed事件感知,支付结果可以通过RailInGameStorePurchaseResult事件感知。result 为0表示成功;1010001表示失败;2表示结束(在支付成功后点击面板确定)
充值决策:(此接口为虚拟充值接口,正式环境下需要屏蔽)
对于支付防沉迷 需要游戏服务器在下单前向WeGame服务器发送 充值决策请求: POST https://api.rail.tgp.qq.com/web/in_game_purchase/order/judge_pay HTTP/1.1
客户端根据请求结果进行界面显示。
注意:
- 解析JSON数据的顺序为先判断result.error_code是否为0,如果非0则说明请求失败,可以弹框提示玩家充值失败;
- 在result.error_code为0的前提下,判断data.ret是否为0,如果非0则说明中控返回错误信息,可以弹框提示玩家充值失败;
- 在data.ret为0的前提下,判断data.instructions数组是否为空,为空说明没有需要指定的指令,可以直接给玩家账号进行充值;
- 如果data.instructions数组不为空,说明有需要执行的指令,此时判断data.instructions.type字段;
- 如果data.instructions.type为1,则需要弹框提示data.instructions.msg返回的内容,当玩家关闭弹框时可以给玩家充值;如果data.instructions.type为7,则需要弹框提示玩家,并禁止玩家充值。
1. 成年玩家或者未成年玩家第一次充值
"result":{
"error_code":0,
"error_message":"success"
},
"data":{
"context":"caa09d68-1afc-49c6-b44a-ee3dafd98da6",
"duration":0,
"guestDuration":0,
"instructions":[
],
"msg":"success",
"ret":0,
"traceId":"HP1705993862CIIUISWXLYUOWZFLCL"
}
2. 未成年玩家进行累计充值
"result":{
"error_code":0,
"error_message":"success"
},
"data":{
"context":"caa09d68-1afc-49c6-b44a-ee3dafd98da6",
"duration":0,
"guestDuration":0,
"instructions":[
{
"type": 1,
"title": "温馨提示",
"msg": "亲爱的用户:根据腾讯未成年人健康上网保护计划,由于您未满18周岁,你本月已经充值超过200元,本月充值金额不允许超过400元。",
"modal": 0,
"ruleName":"pay_8_3"
}
],
"msg":"success",
"ret":0,
"traceId":"HP1705993862CIIUISWXLYUOWZFLCL"
}
3. 未成年玩家超出充值限额
"result":{
"error_code":0,
"error_message":"success"
},
"data":{
"context":"caa09d68-1afc-49c6-b44a-ee3dafd98da6",
"duration":0,
"guestDuration":0,
"instructions":[
{
"type": 7,
"title": "温馨提示",
"msg": "亲爱的用户:根据腾讯未成年人健康上网保护计划,由于您未满18周岁,您本月充值不能超过400元。",
"modal": 1,
"ruleName":"pay_8_9"
}
],
"msg":"success",
"ret":0,
"traceId":"HP1705993862CIIUISWXLYUOWZFLCL"
}

京公网安备 11010502036488号