var Net = Net||{};
Net.tcp = {};
Net.tcp.isConnected = false;//已有连接连上
Net.tcp.tcpIDAva = 1;//用过的ID的最大值
Net.tcp.tcpIDList = [];//TCP ID列表
Net.tcp.connectCount = 3;//同时最多连接个数
Net.tcp.connectList = [];//tcp连接对象池
Net.tcp.connect = function(_id,ws){
	
}
Net.ws_tcp;
Net._SendData = function(_app,_route,_rpc,_data){
	
	var _msg = {};
	_msg.app = _app,
	_msg.route = _route;
	_msg.rpc = _rpc;
	_msg.data = _data;
	if(ConstVal.netType == 0){
		Net.ws_tcp.send(JSON.stringify(_msg));
	}else{
		var putMsg='';
		if(_msg.rpc == RpcList.player_login){putMsg="playerLogin"}
		Func.AjaxHttp2(GameData.Server,_msg,
		function(_msg,state,input_msg){
			console.log(_msg,state,input_msg);
			if (typeof(_msg) == 'string')
		    {
		        _msg = JSON.parse(_msg);
		    }
			if(_msg.route==RouteList.platform||_msg.route==RouteList.agent||_msg.route==RouteList.room){
				if(min_ExitsFunction(Net[_msg.rpc])){
					Net[_msg.rpc](_msg);
				}
			}else{
				Game_Modify._ReceiveData(_msg);
			}
		},function(_msg,state,input_msg){
			if(input_msg == "playerLogin"){
				GameUI.OpenTips("网络状况不好");	
					
			}
			
		},putMsg);
	}

	if(Game_Config.Debugger.isDebugger){
		console.log("发送数据：");
		console.log(_msg);
	}
	
}

Net.submit_error = function(_packet,_msg){
	//提交错误 
	if(GameData.errorMsg != _msg){
		GameData.errorMsg = _msg;
	}else {
		return;
	}
	var msg = {
		app:"youle",
		route:"agent",
		rpc:"submit_error",
		data:{
			packet:_packet,
			msg:_msg,
			playerid:C_Player.playerid,
			agentid:GameData.AgentId,
			gameid:GameData.GameId,
		}
	}
	try{
		Net.ws_tcp.send(JSON.stringify(msg));
	}catch(e){
		
	}
		
}
Net.submit_log = function(_packet,_msg){
	var msg = {
		app:"youle",
		route:"agent",
		rpc:"submit_error",
		data:{
			packet:_packet,
			msg:_msg,
			playerid:C_Player.playerid,
			agentid:GameData.AgentId,
			gameid:GameData.GameId
		}
	}
	console.log(_packet);
	console.log(_msg);
	try{
		Net.ws_tcp.send(JSON.stringify(msg));
	}catch(e){

	}
}

//发送创建房间 
Net.Send_create_room = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.create_room,_data);
}
//接收创建房间 
Net.create_room = function(_msg){
	//Logic.CreateRoom(_msg.data);
	Desk.create_room(_msg); 
	GameUI.EndLoad();
	Game_Modify.createRoom(_msg.data.roomtype,_msg.data.infinite);
	if(Game_Modify.onCreateRoom){
		Game_Modify.onCreateRoom(_msg.data);	
	}
		
}
//发送登录请求 
Net.Send_login = function(_data){
	//console.log(returnCitySN);
	if(typeof returnCitySN != "undefined"){
		_data.ip = returnCitySN.cip;
	}
	if(ConstVal.isGameHall){
		if(!GameData.hallLogin){
			return ;
		}
	}
	_data.machineid   = Logic.getMachineId();
	_data.machineroom = Utl.getRoomcode();
	//alert("进入Net.Send_login方法");
	GameUI.StartLoad();
	if(GameData.loginPlayerid){
		var _playerid = Logic.readPlayerId();
		if(_playerid){
			_data.playerid = _playerid;
		}
	}
	GameData.loginList.push(GameData.TcpID);
	//GameData.isChangeServer = false;
	//if(ConstVal.netType == 0){
	GameData.isSendLoginState = true;
	GameData.sendLoginTimes++;
	
	if(!ConstVal.isGameHall){
		if(GameData.sendLoginTimer == null){
			GameData.isSendLoginTimer = setTimeout(function(){
				
				
				GameData.ConnectType = false;
				GameData.disType = true;
				GameData.NetType=1;
				GameUI.StartLoad();
				GameData.isClose = true;
				Net.ws_tcp.close();
				GameData.isCloseTimer = setInterval(function(){
					if(GameData.isClose){
						Net.ws_tcp.close();
					}
				},5000);
			},4000);
		}
	}else{
		/*
		if(GameData.sendLoginTimes >3){
			if(GameData.isSendLoginTimer){
				window.clearTimeout(GameData.isSendLoginTimer);
				GameData.isSendLoginTimer = null;
			}
			GameUI.EndLoad();
			GameUI.OpenKick("网络繁忙，请退出游戏，稍后登录!");
			return;
		}
		if(GameData.sendLoginTimer == null){
			GameData.isSendLoginTimer = setTimeout(function(){
				var data={};
				data.agentid = GameData.AgentId;
				data.openid = C_Player.openid;
				data.gameid = GameData.GameId;
				data.nickname = C_Player.nickname;
				data.avatar = C_Player.avatar;
				data.sex = C_Player.sex;
				data.province = C_Player.province;
				data.unionid=C_Player.unionid;
				data.city = C_Player.city;
				data.version = GameData.versionCode;
				data.channelid = GameData.ChannelId;
				data.marketid = GameData.marketID;
			},4000);
		}
		*/
	}
	//if(GameData.sendLoginTimes>=2){
		//if(GameData.isSendLoginTimer){
			//window.clearTimeout(GameData.isSendLoginTimer);
			//GameData.isSendLoginTimer = null;
		//}
		//if(GameData.isClose){
			//GameData.isClose = false;
			//window.clearTimeout(GameData.isCloseTimer);
		//}
		//if(GameData.sendLoginTimer){
			//window.clearTimeout(GameData.sendLoginTimer);
			//GameData.sendLoginTimer = null;
		//}
		//if(GameData.sendLoginTimer == null){
			//GameData.isSendLoginTimer = setTimeout(function(){
	
	
				//GameData.ConnectType = false;
				//GameData.disType = true;
				//GameData.NetType=1;
				//GameUI.StartLoad();
				//GameData.isClose = true;
				//Net.ws_tcp.close();
				//GameData.isCloseTimer = setInterval(function(){
					//if(GameData.isClose){
						//Net.ws_tcp.close();
					//}
				//},5000);
			//},4000);
		//}
		////GameUI.EndLoad();
		////GameUI.OpenKick("网络繁忙，请退出游戏，稍后登录!");
	//}
	Net._SendData(AppList.app,RouteList.agent,RpcList.player_login,_data);

}
//接收登录 
Net.player_login = function(_msg){
	if(GameData.isSendLoginTimer){
		window.clearTimeout(GameData.isSendLoginTimer);
		GameData.isSendLoginTimer = null;
	}
	GameUI.EndLoad();
	Desk.login(_msg);
	
}

//发送玩家自己进入房间请求
Net.Send_self_join_room = function(_data){
	GameUI.StartLoad();
	GameData.shortCode = _data.roomcode;
	this._SendData(AppList.app,RouteList.agent,RpcList.self_join_room,_data);
}
//接收玩家自己进入房间请求
Net.self_join_room = function(_msg){
	
	Desk.self_join_room(_msg); 
	GameUI.EndLoad();
}

//发送未开局之前房主自己解散房间
Net.Send_self_break_room = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.room,RpcList.self_break_room,_data);
}
//接收未开局之前房主自己解散房间
Net.self_break_room = function(_msg){
	Desk.self_break_room(_msg);
	GameUI.EndLoad();
}

//接收未开局之前他人房主解散房间
Net.other_break_room = function(_msg){
	Desk.other_break_room(_msg);
}
//接收其他玩家加入房间
Net.other_join_room = function(_msg){
	if(Logic.checkRoom()){
		return;
	}
	Desk.other_join_room(_msg);
	GameUI.EndLoad();
}
//发送未开局之前自己退出房间
Net.Send_self_exit_room = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.room,RpcList.self_exit_room,_data);
}
//接收未开局之前自己退出房间
Net.self_exit_room = function(_msg){
	GameUI.closeCheck();
	Desk.self_exit_room(_msg);
	GameUI.EndLoad();
}

//接收未开局之前其他玩家退出房间
Net.other_exit_room = function(_msg){
	if(Logic.checkRoom()){
		return;
	}
	Desk.other_exit_room(_msg);
}
//发送开局之后自己申请解散房间
Net.Send_self_apply_free_room = function(_data){
	//GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.room,RpcList.self_apply_free_room,_data);
}
//接收开局之后自己申请解散房间
Net.self_apply_free_room = function(_msg){
	Desk.self_apply_free_room(_msg);
	GameUI.EndLoad();
	
}
//接收开局之后其他玩家申请解散房间
Net.other_apply_free_room = function(_msg){
	Desk.other_apply_free_room(_msg);
}
//发送自己同意解散房间
Net.Send_self_agree_free_room = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.room,RpcList.self_agree_free_room,_data);
}
//接收自己同意解散房间
Net.self_agree_free_room = function(_msg){
	Desk.self_agree_free_room(_msg);
	GameUI.EndLoad();
}
//接收其他玩家同意解散房间
Net.other_agree_free_room = function(_msg){
	Desk.other_agree_free_room(_msg);
	GameUI.EndLoad();
}
//发送自己拒绝解散房间
Net.Send_self_refuse_free_room = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.room,RpcList.self_refuse_free_room,_data);
}
//接收自己拒绝解散房间
Net.self_refuse_free_room = function(_msg){
	Desk.self_refuse_free_room(_msg);
	GameUI.EndLoad();
}
//接收其他玩家拒绝解散房间
Net.other_refuse_free_room = function(_msg){
	Desk.other_refuse_free_room(_msg);
	GameUI.EndLoad();
}
//接收解散房间
Net.free_room = function(_msg){
	Desk.free_room(_msg);
	GameUI.EndLoad();
}

//发送获取战绩
Net.Send_get_player_grade1 = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.get_player_grade1,_data);
}
//接收获取战绩
Net.get_player_grade1 = function(_msg){
	gameCombat.get_player_grade1(_msg);
	GameUI.EndLoad();
	//Logic.SetCombatInfo(_msg.data);	
	//GameUI.OpenCombat();
	
}
//发送获取战绩2
Net.Send_get_player_grade2 = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.get_player_grade2,_data);
}
//接收获取战绩2
Net.get_player_grade2 = function(_msg){
	gameCombat.get_player_grade2(_msg);
	GameUI.EndLoad();
}

//接收修改房卡
Net.update_roomcard = function(_msg){
	if(typeof _msg.data.change == "undefined"){
		C_Player.UpdateRoomcard(_msg);
	}
}

//接收其他玩家离线
Net.other_offline = function(_msg){
	Desk.other_offline(_msg);
}

//接收其他玩家上线
Net.other_online = function(_msg){
	Desk.other_online(_msg);
}

//发送发送聊天消息
Net.Send_send_text = function(_data){
	this._SendData(AppList.app,RouteList.room,RpcList.send_text,_data);
}
//接收发送聊天消息
Net.send_text = function(_msg){
	Desk.send_text(_msg);
}

//发送获取任务列表
Net.Send_get_player_task = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.get_player_task,_data);
}
//接收获取任务列表
Net.get_player_task = function(_msg){
	Desk.get_player_task(_msg);
	//GameUI.SetTaskInfo(_msg);
	GameUI.EndLoad();
	
}
//发送完成任务
Net.Send_player_finish_task = function(_data){
	this._SendData(AppList.app,RouteList.agent,RpcList.player_finish_task,_data);
}
//接收完成任务
Net.player_finish_task = function(_msg){
	C_Player.player_finish_task(_msg);
}
//发送领取任务奖励
Net.Send_get_task_award = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.get_task_award,_data);
	
}
//接收领取任务奖励
Net.get_task_award = function(_msg){
	C_Player.get_task_award(_msg);
	GameUI.EndLoad();
}
//发送有任务可领取 
Net.Send_can_award = function(_data){
	this._SendData(AppList.app,RouteList.agent,RpcList.refresh_task_state,_data);
}
//接收有任务可领取 
Net.can_award = function(_msg){
	C_Player.can_award(_msg);
}
//接收踢下线
Net.kick_offline = function(_msg){
	Desk.kick_offline(_msg);
}
//发送自己打电话 
Net.Send_call_phone = function(_data){
	this._SendData(AppList.app,RouteList.room,RpcList.call_phone,_data);
}
//接收自己打电话 
Net.call_phone = function(_msg){
	Desk.call_phone(_msg);
}

//发送自己挂断电话
Net.Send_hangup_phone = function(_data){
	this._SendData(AppList.app,RouteList.room,RpcList.hangup_phone,_data);
}
//接自己收挂断打电话
Net.hangup_phone = function(_msg){
	Desk.hangup_phone(_msg);
}

//发送房主开局
Net.Send_self_makewar = function(_data){
	//GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.room,RpcList.self_makewar,_data);
}
//接收房主开局
Net.self_makewar = function(_msg){
	Desk.self_makewar(_msg);
	//GameUI.EndLoad();
}
//接收房主开局
Net.other_makewar = function(_msg){
	Desk.makewar(_msg);
}
//自己发送互动
Net.Send_send_gift=function(_data){
	this._SendData(AppList.app,RouteList.room,RpcList.send_gift,_data);
} 
Net.send_gift=function(_msg){
	Desk.send_gift(_msg);
}

//自己发送语音 
Net.Send_send_voice=function(_data){
	this._SendData(AppList.app,RouteList.room,RpcList.send_voice,_data);
}
Net.send_voice=function(_msg){
	Desk.send_voice(_msg);
}

//发送切换至房间服务器 
Net.Send_connect_roomserver=function(_data){
	this._SendData(AppList.app,RouteList.room,RpcList.connect_roomserver,_data);
}
Net.connect_roomserver=function(_msg){

	GameData.ConnectType=true;
	GameData.disType =false;
	GameData.ConnectPack = _msg.data;
	GameData.ConnectRpc = RpcList.connect_roomserver;
	GameData.Server=_msg.data.roomserver;
	//Logic.Connect();	
	Net.ws_tcp.close();
}

//发送切换至大厅服务器 
Net.Send_connect_agentserver=function(_data){
	this._SendData(AppList.app,RouteList.agent,RpcList.connect_agentserver,_data);
}
Net.connect_agentserver=function(_msg){
	if(_msg.data.opt == RpcList.other_break_room || _msg.data.opt == RpcList.free_room){
		GameUI.StartLoad();
	}
	GameData.ConnectType=true;
	GameData.disType =false;
	GameData.ConnectRpc = RpcList.connect_agentserver;
	GameData.ConnectPack = _msg.data;
	GameData.Server=_msg.data.agentserver;
	//Logic.Connect();
	Net.ws_tcp.close();
}
Net.Send_broadcast=function(_data){
	this._SendData(AppList.app,RouteList.agent,RpcList.broadcast,_data);
}
//接收即时信息 
Net.broadcast=function(_msg){
	//
	Desk.broadcast(_msg);
}
//发送互动 
Net.Send_send_phiz=function(_data){
	this._SendData(AppList.app,RouteList.room,RpcList.send_phiz,_data);
}
//接收互动 
Net.send_phiz=function(_msg){
	Desk.send_phiz(_msg);
}
//提交反馈 
Net.Send_submit_opinion=function(_data){
	this._SendData(AppList.app,RouteList.agent,RpcList.submit_opinion,_data);
}
//接收反馈 
Net.submit_opinion=function(_msg){
	Desk.submit_opinion(_msg);
}
//踢出玩家 
Net.Send_kick_server=function(_data){
	this._SendData(AppList.app,RouteList.agent,RpcList.kick_server,_data);
}
Net.kick_server=function(_msg){
	Desk.kick_server(_msg);
}
//获取支付列表 
Net.Send_get_paylist=function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.get_paylist,_data);
}
//接收支付列表 
Net.get_paylist=function(_msg){
	GameData.payList = _msg.data.paylist;
	GameUI.OpenPay();
	GameUI.EndLoad();
}
//支付成功后通知服务器 
Net.Send_pay_succ=function(_data){
	this._SendData(AppList.app,RouteList.agent,RpcList.pay_succ,_data);
}
//提交位置信息 
Net.Send_submit_location=function(_data){
	if(!ConstVal.isGameHall){
		this._SendData(AppList.app,RouteList.agent,RpcList.submit_location,_data);
	}
}
//提交位置信息
Net.submit_location=function(_msg){
	Game.submit_location(_msg);
}
//发送绑定
Net.Send_binding_invitecode=function(_data){
	//GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.binding_invitecode,_data);
}
//接收绑定
Net.binding_invitecode=function(_msg){
	//GameUI.EndLoad();
	C_Player.binding_invitecode(_msg);
}

//接收修改豆豆 
Net.update_bean = function(_msg){
	//C_Player.update_bean(_msg);
	Desk.update_bean(_msg);
}

Net.Send_get_player_invitecode = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.get_player_invitecode,_data);
}
Net.get_player_invitecode = function(_msg){
	GameUI.EndLoad();
	C_Player.setInvitecod(_msg.data.invitecode);
	GameUI.OpenBind();
}

Net.Send_beanroom_surrender = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.room,RpcList.beanroom_surrender,_data);
}
Net.beanroom_surrender = function(_msg){
	GameUI.EndLoad();
	GameUI.closeCheck();
	 if(_msg.data.state==0){
		Game_Modify.onSurrender(_msg);
	 }else{//失败
		 if(_msg.data.showerror==1){
			 GameUI.OpenTips(_msg.data.error);
		 }
	 }
	
}
Net.Send_player_prepare = function(_data){
	this._SendData(AppList.app,RouteList.room,RpcList.player_prepare,_data);
}
Net.player_prepare = function(_msg){
	Desk.player_prepare(_msg);
}
Net.Send_share_room = function(_data){
	this._SendData(AppList.app,RouteList.room,RpcList.share_room,_data);
}
Net.share_room = function(_msg){
	Desk.share_room(_msg);
}
Net.Send_get_share_room = function(_data){
	if(!ConstVal.isGameHall){
		GameUI.StartLoad();
		this._SendData(AppList.app,RouteList.agent,RpcList.get_share_room,_data);
	}

}
Net.get_share_room = function(_msg){
	Desk.get_share_room(_msg);
	GameUI.EndLoad();
}
Net.Send_quick_enter_share_room = function(_data){
	console.log(_data);
	this._SendData(AppList.app,RouteList.agent,RpcList.quick_enter_share_room,_data);
}
Net.show_message = function(_msg){
	GameUI.EndLoad();
	Desk.show_message(_msg);
}
Net.Send_advanced_roomlist = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.advanced_roomlist,_data);

}
Net.advanced_roomlist = function(_msg){
	GameUI.EndLoad();
	Desk.advanced_roomlist(_msg);
}
Net.Send_advanced_createroom = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.advanced_createroom,_data);

}
Net.advanced_createroom = function(_msg){
	GameUI.EndLoad();
	Desk.advanced_createroom(_msg);
}
Net.Send_change_room = function(_data){
	//GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.room,RpcList.change_room,_data);
}
Net.change_seat = function(_msg){
	Desk.change_seat(_msg);
}
//财富榜
Net.Send_get_treasurelist = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.get_treasurelist,_data);
}
//财富榜
Net.get_treasurelist = function(_msg){
	Desk.get_treasurelist(_msg);
	GameUI.EndLoad();
	
}
//设置仓库密码 
Net.Send_set_bankpwd = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.set_bankpwd,_data);
}
Net.set_bankpwd = function(_msg){
	GameUI.EndLoad();
	Desk.set_bankpwd(_msg);
}

//更改仓库星星 
Net.Send_change_star = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.change_star,_data);
}
Net.change_star = function(_msg){
	GameUI.EndLoad();
	Desk.change_star(_msg);
}

//提交手机信息 
Net.Send_submit_phoneinfo = function(_data){
	if(!ConstVal.isGameHall){
		this._SendData(AppList.app,RouteList.agent,RpcList.submit_phoneinfo,_data);
	}
}
Net.submit_phoneinfo = function(_msg){
	//GameData.submitPhoneInfo = true;
	
}
//提交手机信息
Net.Send_update_charm = function(_data){

	this._SendData(AppList.app,RouteList.agent,RpcList.update_charm,_data);
}
Net.update_charm = function(_msg){
	//GameData.submitPhoneInfo = true;
	Desk.update_charm(_msg);

}
Net.Send_setSign = function(_data){

	this._SendData(AppList.app,RouteList.agent,RpcList.setSign,_data);
}
Net.setSign = function(_msg){
	C_Player.setSign(_msg.data.sign);
	//GameUI.setSign(_msg.data.sign);
}
Net.Send_switchRoomList = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.switchRoomList,_data);
}
Net.switchRoomList = function(_msg){
	GameUI.EndLoad();
	Desk.switchRoomList(_msg);
	//GameUI.setSign(_msg.data.sign);
}

Net.Send_getInfoByShortCode = function(_data){
	//GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.getInfoByShortCode,_data);
}
Net.getInfoByShortCode = function(_msg){
	GameUI.EndLoad();
	Desk.getInfoByShortCode(_msg);
}
Net.Send_optBanList = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.optBanList,_data);
}
Net.optBanList = function(_msg){
	GameUI.EndLoad();
	Desk.optBanList(_msg);
}
Net.Send_getShortCodeRankList = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.getShortCodeRankList,_data);
}
Net.getShortCodeRankList = function(_msg){
	GameUI.EndLoad();
	Desk.getShortCodeRankList(_msg);
}

Net.Send_setAllCharm = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.setAllCharm,_data);
}
Net.setAllCharm = function(_msg){
	GameUI.EndLoad();
	Desk.setAllCharm(_msg);
}

Net.Send_getVipRankList = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.getVipRankList,_data);
}
Net.getVipRankList = function(_msg){
	GameUI.EndLoad();
	Desk.getVipRankList(_msg);
}

Net.Send_playerBehavior = function(tag){
	//GameUI.StartLoad();
/*
	var _data={};
	_data.agentid = GameData.AgentId;
	_data.gameid = GameData.GameId;
	_data.playerid = C_Player.playerid;
	_data.tag = tag;
	this._SendData(AppList.app,RouteList.agent,RpcList.playerBehavior,_data);
		*/
	var url = "http://test3.1888day.com/api/gamedo/gamedo";
	var cfg = {};
	cfg.url = url;
	cfg.type = "GET";
	cfg.data = "agentid="+GameData.AgentId+"&gameid="+GameData.GameId+"&playerid="+C_Player.playerid+"&tag="+tag;

	cfg.success = playerBehavior_Succ;
	cfg.error = playerBehavior_Fail;
	min_http(cfg);
	
}
var playerBehavior_Succ = function(_msg,state,input_msg){
	console.log("Succ");
	console.log(_msg,state,input_msg);
}
var playerBehavior_Fail = function(_msg,state,input_msg){
	console.log("Fail");
	console.log(_msg,state,input_msg);
}
Net.playerBehavior = function(_msg){
	//GameUI.EndLoad();
	Desk.playerBehavior(_msg);
}
Net.Send_binding_phone = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.binding_phone,_data);
}
Net.binding_phone = function(_msg){
	GameUI.EndLoad();
	Desk.binding_phone(_msg);
}
Net.Send_send_phone_checkcode = function(_data){
	//GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.send_phone_checkcode,_data);
}
Net.send_phone_checkcode = function(_msg){
	//GameUI.EndLoad();
	Desk.send_phone_checkcode(_msg);
}
Net.Send_send_phone_code_wechat = function(_data){
	//GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.send_phone_code_wechat,_data);
}
Net.send_phone_code_wechat = function(_msg){
	//GameUI.EndLoad();
	Desk.send_phone_code_wechat(_msg);
}

Net.Send_setVipForbidSelect = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.setVipForbidSelect,_data);
}
Net.setVipForbidSelect = function(_msg){
	GameUI.EndLoad();
	Desk.setVipForbidSelect(_msg);
}
Net.Send_topup_card = function(_data){
	console.log(_data);
	this._SendData(AppList.app,RouteList.agent,RpcList.topup_card,_data);
}
Net.topup_card = function(_msg){
	Desk.topup_card(_msg);
}
Net.Send_query_player2 = function(_data){
	this._SendData(AppList.app,RouteList.agent,RpcList.query_player2,_data);
}
Net.query_player2 = function(_msg){
	Desk.query_player2(_msg);
}
Net.Send_giveCoin = function(_data){
	this._SendData(AppList.app,RouteList.agent,RpcList.giveCoin,_data);
}
Net.giveCoin = function(_msg){
	Desk.giveCoin(_msg);
}
Net.Send_getPlayerWhiteList = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.getPlayerWhiteList,_data);
}
Net.getPlayerWhiteList = function(_msg){
	GameUI.EndLoad();
	Desk.getPlayerWhiteList(_msg);
}
Net.Send_optWhiteList = function(_data){
	GameUI.StartLoad();
	this._SendData(AppList.app,RouteList.agent,RpcList.optWhiteList,_data);
}
Net.optWhiteList = function(_msg){
	GameUI.EndLoad();
	Desk.optWhiteList(_msg);
}

