主题
Skip to content 


上报流程
由于上报比较独立和赋值,所有接口位于ReportManager
中
但是有三个属性值,上报频率较高,不需要每次都手动传入
LangType
和 GameName
默认根据 \Assets\Resources\ZMYSDKAPPGlobalConfig.json 中的配置来上报
ModeName
通过 ZMYSDKManager.ModeName
来赋值
- 通过接口获取对应的上报数据类:
GetNewReportJsonData
c#
game_start data= ReportManager.I.GetNewReportJsonData<game_start>();
- 赋值上报类里面对应的值
c#
data.mode_level = 12;
- 调用对应上报类的接口
c#
//上报类对应的上报接口,都是固定写法NewReport_上报数据类 具体可以参考NewReportManagerByTools脚本
ReportManager.I.NewReport_game_start(game_Start);
这样就会把game\_start
上报到事件后台。
- 校验上报
每条上报都会触发相关打印:

key
:上报数据类的类名
JsonProperties
:上报赋值的数据组成的 json 字符串
对常规上报的封装
SDK 封装了如下上报
上报模块 | 上报说明 | 上报条目 | 说明 |
---|---|---|---|
玩法类上报 | 玩法首次开始 | start_first | StartMineGame 接口控制 |
玩法开始 | start | ||
玩法进行中 | gaming | ||
模式上报 | 模式开始 | mode_start | StartGameModel 接口控制 |
模式进行中 | mode_gaming | ||
关卡类上报 | 关卡开始 | game_start | NewReportGameStart 接口控制 |
关卡时长 | level_gaming | SDK 自动处理 | |
关卡离开 | game_quit | NewReportGameQuit 接口控制 | |
关卡进度变化 | game_progress | NewReportGameProgress 接口控制 | |
关卡犯规 | game_foul | NewReportGameFoul 接口控制 | |
关卡复活 | game_revive | NewReportGameRevive 接口控制 | |
关卡失败 | game_fail | NewReportGameFail 接口控制 | |
关卡过关 | game_complete | NewReportGameComplete 接口控制 | |
关卡平局 | game_draw | NewReportGameDraw 接口控制 | |
关卡跳过 | game_skip | NewReportGameSkip 接口控制 | |
激励视频上报 | 视频按钮不可用 | video_unable | 由 VideoButton 组件自动上报 |
视频按钮无广告 | video_noAds | ||
视频按钮曝光 | video_show | ||
视频点击 | video_click | ||
视频播放完毕 | video_success | ||
视频播放退出 | video_fail | ||
视频播放开始 | video_play |
WARNING
💡 激励视频上报里面的 mode_level,SDK 会默认自动获取 game_start 关卡开始上报中的 mode_level 属性值,如果想改变激励视频上报中的 mode_level 值,可以调用 ReportManager.mode_Level 来修改
玩法上报
start\_first
、start
上报只需要调用ReportManager.StartMineGame()
方法。
c#
ReportManager.I.StartMineGame();
此接口会自动触发start\_first
和start
,并在后台开启计算器,定时上报gaming
模式上报
c#
ReportManager.I.StartGameModel(“模式名称”);
WARNING
💡 调用了模式上报后,游戏会进入传入的相应游戏模式状态,后续所有涉及到 mode_name 属性都会变成模式上报时设置的值。如果相关的上报涉及到上报游戏模式,必须要设置好相应的模式之后,在进行上报。
调用StartGameModel()
SDK 会自动处理mode\_gaming
的上报
StartGameModel()
参数传入一个非 None 的模式时,SDK 自动开始模式上报;当传入 None 的时候,如果上一个模式非 None,那么会停止上一个非 None 模式的时长上报,所以StartGameModel(None)
也叫做模式结束。
关卡上报
WARNING
💡 关卡上报时,mode_name 和_duration SDK 会自动赋值。游戏研发可以忽略这 2 个字段
game_start 开始游戏
c#
ReportManager.I.NewReportGameStart();
game_quit 离开游戏
NewGameQuit
用于处理中途离开游戏的情况
表示放弃游戏。比如点击暂停,然后点击暂停页面的返回主页
SDK 接口实现:

上报离开游戏

game_progress 游戏进度发生变化
上报游戏进度:
c#
game_progress data = ReportManager.I.GetNewReportJsonData<game_progress>();
data._current_gold++;
ReportManager.I.NewReportGameProgress(data);
game_foul 游戏犯规
c#
game_foul data = ReportManager.I.GetNewReportJsonData<game_foul>();
data.activity_name = "游戏犯规1";
ReportManager.I.NewReportGameFoul(data);
game_revive 游戏复活
c#
game_revive data = ReportManager.I.GetNewReportJsonData<game_revive>();
ReportManager.I.NewReportGameRevive(data);
game_fail 游戏失败
c#
game_fail data = ReportManager.I.GetNewReportJsonData<game_fail>();
ReportManager.I.NewReportGameFail(data);
game_complete 游戏成功
c#
game_complete data = ReportManager.I.GetNewReportJsonData<game_complete>();
ReportManager.I.NewReportGameComplete(data);
game_pause 游戏暂停
c#
game_pause data = ReportManager.I.GetNewReportJsonData<game_pause>();
ReportManager.I.NewReportGamePause(data);
game_continue 游戏继续
只能在关卡暂停和关卡离开后上报,有内部控制
c#
game_continue data = ReportManager.I.GetNewReportJsonData<game_continue>();
ReportManager.I.NewReportGameContinue(data);
其他未封装的上报
在ReportDefineByTools
脚本中,SDK 预置了很多业务相关上报数据类,在NewReportManagerByTools
脚本中预制了对应的上报接口。
对于 SDK 未封装的上报,参考上面的上报流程进行上报即可。
示例:
c#
//上报道具获得
item_get data = ReportManager.I.GetNewReportJsonData<item_get>();
data.item_id = 1001;
data.item_count = 50;
ReportManager.I.NewReport_item_get(data);
自定义上报
也可以使用OnNewEvent
接口进行自定义事件上报
c#
// 自定义上报
ZMYSDKManager.I.SDK.OnNewEvent(key, JsonString);
点我快速对接


