|
@@ -151,9 +151,11 @@ export class GameManager extends Component {
|
|
}
|
|
}
|
|
|
|
|
|
// 请求用户注册/设置地区 stype 1:注册 2:重新设置
|
|
// 请求用户注册/设置地区 stype 1:注册 2:重新设置
|
|
- public static requestUserSetRegion(region_id:number,stype:number,cb) {
|
|
|
|
|
|
+ public static requestUserSetRegion(region_id:number,stype:number,cb, show_loading:boolean=false) {
|
|
|
|
+ if(show_loading) {uiManager.Instance().showLoading()}
|
|
let opt = {'region_id':region_id, 'stype':stype}
|
|
let opt = {'region_id':region_id, 'stype':stype}
|
|
http.post(config.API.user_set_region, opt, (err,d)=>{
|
|
http.post(config.API.user_set_region, opt, (err,d)=>{
|
|
|
|
+ if(show_loading) {uiManager.Instance().hideLoading()}
|
|
let nd = JSON.parse(d)
|
|
let nd = JSON.parse(d)
|
|
if(nd.code === config.status.SUCCESS){
|
|
if(nd.code === config.status.SUCCESS){
|
|
if(cb!=null){
|
|
if(cb!=null){
|
|
@@ -181,15 +183,15 @@ export class GameManager extends Component {
|
|
}
|
|
}
|
|
|
|
|
|
// 请求排行列表
|
|
// 请求排行列表
|
|
- public static requestRankList(region_id:number, cb) {
|
|
|
|
|
|
+ public static requestRankList(region_id:number, cb, show_loading:boolean=false) {
|
|
|
|
+ if(show_loading) {uiManager.Instance().showLoading()}
|
|
http.post(config.API.rankings(region_id),null, (err,d)=>{
|
|
http.post(config.API.rankings(region_id),null, (err,d)=>{
|
|
|
|
+ if(show_loading) {uiManager.Instance().hideLoading()}
|
|
if(!err){
|
|
if(!err){
|
|
let data = JSON.parse(d)
|
|
let data = JSON.parse(d)
|
|
if(data.code===config.status.SUCCESS){
|
|
if(data.code===config.status.SUCCESS){
|
|
// console.log('data=',data.content)
|
|
// console.log('data=',data.content)
|
|
- if(cb!=null) {
|
|
|
|
- cb(data.content)
|
|
|
|
- }
|
|
|
|
|
|
+ cb && cb(data.content)
|
|
}
|
|
}
|
|
} else{
|
|
} else{
|
|
console.log("rankList err",err)
|
|
console.log("rankList err",err)
|
|
@@ -198,9 +200,11 @@ export class GameManager extends Component {
|
|
}
|
|
}
|
|
|
|
|
|
// 背包列表
|
|
// 背包列表
|
|
- public static requestBagList(stype_id:number, cb) {
|
|
|
|
|
|
+ public static requestBagList(stype_id:number, cb, show_loading:boolean=false) {
|
|
|
|
+ if(show_loading) {uiManager.Instance().showLoading()}
|
|
let opt = {'stype_id':stype_id}
|
|
let opt = {'stype_id':stype_id}
|
|
http.post(config.API.bag_list, opt, (err,d)=>{
|
|
http.post(config.API.bag_list, opt, (err,d)=>{
|
|
|
|
+ if(show_loading) {uiManager.Instance().hideLoading()}
|
|
if(!err){
|
|
if(!err){
|
|
let nd = JSON.parse(d)
|
|
let nd = JSON.parse(d)
|
|
if(nd.code === config.status.SUCCESS){
|
|
if(nd.code === config.status.SUCCESS){
|
|
@@ -212,9 +216,11 @@ export class GameManager extends Component {
|
|
}
|
|
}
|
|
|
|
|
|
// 兑换车辆
|
|
// 兑换车辆
|
|
- public static requestExchangeCar(car_id:number, cb) {
|
|
|
|
|
|
+ public static requestExchangeCar(car_id:number, cb, show_loading:boolean=false) {
|
|
|
|
+ if(show_loading) {uiManager.Instance().showLoading()}
|
|
let opt = {'car_id':car_id}
|
|
let opt = {'car_id':car_id}
|
|
http.post(config.API.exchange_car, opt, (err,d)=>{
|
|
http.post(config.API.exchange_car, opt, (err,d)=>{
|
|
|
|
+ if(show_loading) {uiManager.Instance().hideLoading()}
|
|
if(!err){
|
|
if(!err){
|
|
let nd = JSON.parse(d)
|
|
let nd = JSON.parse(d)
|
|
if(nd.code === config.status.SUCCESS){
|
|
if(nd.code === config.status.SUCCESS){
|