游戏加速

## 游戏加速 路由器目前支持国服游戏加速、网易UU加速。 >w 中继模式不能游戏加速。 导入头文件`#import <H3CMagicKit/H3CGatewayObject+GameBoost.h` #### 一、 国服游戏加速 >w 国服游戏加速功能需要能力集32位支持 #### 1.1 检查游戏加速环境 配置国服游戏加速前,先检查网关是否有其他游戏加速已经开启。 ``` [H3CGatewayObject getGameBoostConfigConditionWithGameEngineId:1 success:^(NSInteger status) { if (status == 0) { // 可以配置国服游戏加速 } else if (status == 1) { [MHToast showToastHUD:@"国服加速已开启,请关闭后再开启当前加速器"]; } else if (status == 2) { [MHToast showToastHUD:@"UU加速器已开启,请关闭后再开启当前加速器"]; } else if (status == 3) { [MHToast showToastHUD:@"帆游加速器已开启,请关闭后再开启当前加速器"]; } } failure:^(H3CError *error) { }]; ``` 参数说明; |参数|描述| |-|-|-| |gameEngineId|需要检查的游戏类型: 1、国服加速 2、网易UU加速器| #### 1.2 获取加速游戏列表 获取正在加速的游戏列表和所有可加速的游戏列表。 ``` [H3CGatewayObject getGuofuGameBoostListWithGetType:2 gameIndex:0 reqCnt:reqCnt success:^(H3CGameBoostAttrModel * _Nonnull gameBoostAttrModel) { } failure:^(H3CError *error) { // 设备正在更新游戏列表 if (error.retCode == 205) { } // 设备正在更新游戏列表 else if (error.retCode == 207) { } // 没有更多数据 else if (error.retCode==110) { } // 加载失败 else { } }]; ``` 参数说明: |字段|描述| |-|-| |getType|获取类型:1、全部列表 2、已经加速列表| |gameIndex| 用于分页的索引,即上次请求最后一条数据的id,默认0 | |reqCnt|获取每页最大数量| rerCode说明: |字段|描述| |-|-| |205|备正在更新游戏列表表| |207| 设备正在更新游戏列表 | |110|没有更多数据| #### 1.3 获取游戏的logo的URL 根据接口1.2中返回的游戏列表,可以拿到游戏id,跟id调用下面接口获取URL加载logo。 ``` NSMutableArray *gameIds = [H3CGameBoostModel gameIdsFromGameList:self.gameList]; [H3CGatewayObject getGuoFuGameBoostLogoListWithGameIds:gameIds success:^(NSDictionary *urlMap) { } failure:^(H3CError *error) { }]; ``` #### 1.4 加速/取消加速游戏 加速/取消加速单个游戏。 ``` // 游戏加速 1关闭 2开启 [MHToast showProgressHUD]; [H3CGatewayObject setGuofuGameBoostWithGameId:[gameIdNumber integerValue] gameSpeedUp:2 success:^(id obj) { [ } failure:^(H3CError *error) { // 设备正在更新游戏列表 if (error.retCode == 205) { } // 游戏列表已更新,加速游戏找不到 if (error.retCode == 207) { [MHToast showToastHUD:@"游戏列表已更新,请重新加载"]; } }]; ``` #### 1.5 批量加速游戏 批量加速游戏,不能批量取消加速。 ``` [H3CGatewayObject setGuofuGameBoostWithGameList:tempArray success:^(id obj) { } failure:^(H3CError *error) { }]; ``` >w 批量加速游戏接口需要能力集46位支持 #### 二、 网易UU游戏加速 导入头文件`#import <H3CMagicKit/H3CGatewayObject+GameBoost.h` >w 网易UU游戏加速功能需要能力集30位支持 #### 1.1 检查游戏加速环境 加载网易UU游戏加速前,先检查网关是否有其他游戏加速已经开启。 ``` [H3CGatewayObject getGameBoostConfigConditionWithGameEngineId:2 success:^(NSInteger status) { if (status == 0) { // 可以配置国服游戏加速 } else if (status == 1) { [MHToast showToastHUD:@"国服加速已开启,请关闭后再开启当前加速器"]; } else if (status == 2) { [MHToast showToastHUD:@"UU加速器已开启,请关闭后再开启当前加速器"]; } else if (status == 3) { [MHToast showToastHUD:@"帆游加速器已开启,请关闭后再开启当前加速器"]; } } failure:^(H3CError *error) { }]; ``` 参数说明; |参数|描述| |-|-|-| |gameEngineId|需要检查的游戏类型: 1、国服加速 2、网易UU加速器| #### 1.2 授权UU加速 UU加速使用webView实现,授权通过可以拿到url,然后用webview加载 ``` [H3CGatewayObject authorizationUUGBoostWithSuccess:^(NSString * _Nonnull UUUrl) { } failure:^(H3CError *error) { }]; ``` #### 三、 能力集 | 能力集序号|能力集属性|描述| |-|-|-| |30| isSupportGameSpeedUpUU | 是否支持网易UU游戏加速功能| |32| isSupportGameSpeedUpGuoFu | 是否支持国服游戏加速功能| |46| isSupportMutiGameBoostSet | 是否支持游戏批量加速| |48| isSupportUUSwitch | 是否支持UU加速插件开关:不支持插件开关的版本,插件默认开启|