
var Game_Modify = Game_Modify||{};//子游戏可能会修改的模块 
Game_Modify.combat={
	maxPlayerCount:5,
	pageOnelimitStrLen:8,//战绩页一昵称最大长度 
	pageOneDoc:false, 
	pageTwolimitStrLen:16,//战绩页二昵称最大长度
	pageTwoDoc:false,
};

Game_Modify.roomDes = "";
Game_Modify.game_config={//游戏配置默认值 
	
};
Game_Modify.Type_1 = [
	{id:0,des:"10局(房卡X1)",roomcard:1,type:1},
	{id:1,des:"20局(房卡X2)",roomcard:2,type:2}
];
Game_Modify.Type_2 = [
	{id:0,des:"房主扣卡",type:1},
	{id:1,des:"每人扣卡",type:2}
];

Game_Modify.CreateRoomData = {//发送创建房间数据roomtype 
	//Roomcard:0,
	Type_1:0,
	Type_2:0,
	//增加房间类型时在下面添加 
};
Game_Modify.utlmousedown = function(gameid, spid, downx, downy, no1, no2, no3, no4, no5, no6){
		
}
Game_Modify.utlmousedown_nomove = function(gameid, spid, downx, downy, timelong, no1, no2, no3, no4, no5){
	switch(spid){
		
	}
}
Game_Modify.mouseup=function(gameid,  spid_down,  downx,  downy,  spid_up,  upx,  upy,  timelong,  no1,  no2){
	if(spid_down==spid_up){
		switch(spid_up){
			case 25://????				
				var data={};
				data.agentid = GameData.AgentId;
				data.playerid = C_Player.playerid;
				data.gameid = GameData.GameId;
				//data.roomtype = [[1,[1,2,3]],[1,[1,2]],[1,[1,2,3]],[1,[1,2,3,4,5]],[1,[1,2]],[[0,0,0,0,0],[1,5,3],[100,10000,0.01,1,500,0.02]]];
				data.roomtype = [1,1,1,1,1,[1,5,3]];
				Net.Send_create_room(data);
				break;
			case 150://???????
				GameUI.OpenHelp();
				break;
		}
		if(spid_up>=20&&spid_up<=21){//
			Game_Modify.CreateRoomData.Type_1 = spid_up-20;

		}
		if(spid_up>=139&&spid_up<=140){
			Game_Modify.CreateRoomData.Type_2 = spid_up-139;

		}
		
	
	}
}
Game_Modify.utlmousemove = function(gameid, spid, downx, downy, movex,movey ,timelong,offmovex, offmovey, no1){
	
}
Game_Modify.utlgamemydrawbegin = function(gameid, spid, times, timelong, no2, no3, no4, no5, no6, no7){

	
}
Game_Modify.gamemydraw = function(gameid, spid, times, timelong, no2, no3, no4, no5, no6, no7){
	switch(spid){
		//勾选状态的钩钩是画上去的（如果需要改动勾选图片的尺寸、绘画时的参数自己调整） 
		//------------------- begin -------------- 
		case 248://协议勾选
			if(GameData.ProtocolIndex){
				ifast_mydrawbmp(spid,4,5,5,40,40,0,0,40,40);
			}
			break;
		case 139://创建房间时的勾选 
			if(Game_Modify.CreateRoomData.Type_2 == 0){
				ifast_mydrawbmp(spid,4,2,2,40,40,0,0,40,40);
			}
			break;
		case 140://创建房间时的勾选
			if(Game_Modify.CreateRoomData.Type_2 == 1){
				ifast_mydrawbmp(spid,4,2,2,40,40,0,0,40,40);
			}
			break;
		case 20://创建房间时的勾选
			if(Game_Modify.CreateRoomData.Type_1 == 0){
				ifast_mydrawbmp(spid,4,2,2,40,40,0,0,40,40);
			}
			break;
		case 21://创建房间时的勾选
			if(Game_Modify.CreateRoomData.Type_1 == 1){
				ifast_mydrawbmp(spid,4,2,2,40,40,0,0,40,40);
			}
			break;

		
		//------------------- end ------------------
		
	}
}
Game_Modify.OpenCreateRoom=function(){
	Utl.playSound(Game_Config.ClickButton.src_2);
	var roomty = Utl.getRoomtype();
	if(roomty){
		Game_Modify.CreateRoomData.Type_1 = roomty[0]-1;
		Game_Modify.CreateRoomData.Type_2 = roomty[1]-1;
	}else{
		Game_Modify.CreateRoomData.Type_1 = 0;
		Game_Modify.CreateRoomData.Type_2 = 0;
	}
	set_self(672,7,Game_Modify.Type_1[0].des,0,0);
	set_self(673,7,Game_Modify.Type_1[1].des,0,0);
	set_self(674,7,Game_Modify.Type_2[0].des,0,0);
	set_self(675,7,Game_Modify.Type_2[1].des,0,0);
	
	set_group(4,37,1,0,0);
}
Game_Modify.CloseCreateRoom=function(){
	set_group(4,37,0,0,0);
}
Game_Modify.setRoomDes = function(roomcode,asetcount,roomtype){
	Game_Modify.roomDes = "描述:"+roomcode+"("+asetcount+"局)";
} 
//-----------------新版战绩---------------------------
var gameCombat={};
gameCombat.combatData = {
	page:0,//当前处于第几页战绩	0我的战绩1第二页战绩
	pageOneIndex:0,//选中的第二页的第几栏
	pageTwoIndex:0,//选中的第二页的第几栏
	type:0,
	gradeIdx1:0,
	gradeIdx2:0, 
};
gameCombat.combatPageOneConfig = {
	fSpid:63,
	bgSpid:64,
	splitSpid:86,
	btnSpid:51,
	txt1Spid:65,
	txt2Spid:66,
	txt3Spid:67,
	bgTag:1,
	splitTag:500,
	btnTag:1000,
	txt1Tag:1500,
	txt2Tag:3000,
	txt3Tag:4500,

	clip_x:64,
	clip_y:114,
	clip_h:515,
	clip_w:1175,

	txt1Width:10,
	txt2Width:10,
	txt3Width:10,

	splitPosition:[338,74],
	btnPosition:[1065,0],
	txt1Position:[[35,15],[35,60],[35,105]],//x,y
	txt2Position:[[130,15],[130,60],[130,105]],//x,y
	txt3Position5:[[400,45],[540,45],[680,45],[820,45],[960,45]],//[居中点,y]
	txt3Position10:[[400,10],[540,10],[680,10],[820,10],[960,10],
					[400,80],[540,80],[680,80],[820,80],[960,80]],//[居中点,y]
	nickNameLimit5:8,
	nickNameLimit10:8,
	nsSpace:30,//昵称积分间隔

	bgSpace:167,//背景间隔


};
gameCombat.combatPageTwoConfig = {
	fSpid:87,
	bgSpid:88,
	splitSpid:91,
	btnSpid:54,
	txt1Spid:89,
	//txt2Spid:66,
	txt3Spid:90,
	bgTag:1,
	splitTag:500,
	btnTag:1000,
	txt1Tag:1500,
	txt2Tag:3000,
	txt3Tag:4500,

	clip_x:64,
	clip_y:114,
	clip_h:515,
	clip_w:1175,

	txt1Width:10,
	txt2Width:10,
	txt3Width:10,

	splitPosition:[338,74],
	btnPosition:[1065,0],
	txt1Position:[[90,50],[35,60],[35,105]],//x,y
	txt2Position:[[130,15],[130,60],[130,105]],//x,y
	txt3Position5:[[400,45],[540,45],[680,45],[820,45],[960,45]],//[居中点,y]
	txt3Position10:[[400,10],[540,10],[680,10],[820,10],[960,10],
					[400,80],[540,80],[680,80],[820,80],[960,80]],//[居中点,y]
	nickNameLimit5:2,
	nickNameLimit10:2,
	nsSpace:30,//昵称积分间隔

	bgSpace:167,//背景间隔


};
gameCombat.combatPageOneData = {
	slide:false,
	bgTag:0,
	btnTag:0,
	txt1Tag:0,
	txt2Tag:0,
	txt3Tag:0,
	splitTag:0,
};
gameCombat.combatPageTwoData = {
	slide:false,
	bgTag:0,
	btnTag:0,
	txt1Tag:0,
	txt2Tag:0,
	txt3Tag:0,
	splitTag:0,
};
gameCombat.utlani_doend=function(id,sx,count,allend){
	
}
gameCombat.utlmousedown = function(gameid, spid, downx, downy, no1, no2, no3, no4, no5, no6){
	switch(spid){
		case gameCombat.combatPageOneConfig.fSpid:
			gameCombat.combatPageOneData.slide = false;
			break;
		case gameCombat.combatPageTwoConfig.fSpid:
			gameCombat.combatPageTwoData.slide = false;
			break;
	}
}
gameCombat.utlmouseup=function(gameid,  spid_down,  downx,  downy,  spid_up,  upx,  upy,  timelong,  no1,  no2){
	if(spid_down == gameCombat.combatPageOneConfig.fSpid){
		var pos = get_self(spid_down,19,0,0,0);
		var sh = get_self(spid_down,21,0,0,0);
		if(sh <= gameCombat.combatPageOneConfig.clip_h){
			play_ani(1,spid_down,19,pos,gameCombat.combatPageOneConfig.clip_y,0,ifast_abs(gameCombat.combatPageOneConfig.clip_y - pos),0,0,0,1,0,0,0);
		}else{
			if(pos > gameCombat.combatPageOneConfig.clip_y){
				play_ani(1,spid_down,19,pos,gameCombat.combatPageOneConfig.clip_y,0,ifast_abs(gameCombat.combatPageOneConfig.clip_y - pos),0,0,0,1,0,0,0);
			}else{
				var ppos = gameCombat.combatPageOneConfig.clip_y + gameCombat.combatPageOneConfig.clip_h - sh;
				if(pos < ppos){
					play_ani(1,spid_down,19,pos,ppos,0,ifast_abs(ppos - pos),0,0,0,1,0,0,0);
				}
			}
		}
	}
	if(spid_down == gameCombat.combatPageTwoConfig.fSpid){
		var pos = get_self(spid_down,19,0,0,0);
		var sh = get_self(spid_down,21,0,0,0);
		if(sh <= gameCombat.combatPageTwoConfig.clip_h){
			play_ani(1,spid_down,19,pos,gameCombat.combatPageTwoConfig.clip_y,0,ifast_abs(gameCombat.combatPageTwoConfig.clip_y - pos),0,0,0,1,0,0,0);
		}else{
			if(pos > gameCombat.combatPageTwoConfig.clip_y){
				play_ani(1,spid_down,19,pos,gameCombat.combatPageTwoConfig.clip_y,0,ifast_abs(gameCombat.combatPageTwoConfig.clip_y - pos),0,0,0,1,0,0,0);
			}else{
				var ppos = gameCombat.combatPageTwoConfig.clip_y + gameCombat.combatPageTwoConfig.clip_h - sh;
				if(pos < ppos){
					play_ani(1,spid_down,19,pos,ppos,0,ifast_abs(ppos - pos),0,0,0,1,0,0,0);
				}
			}
		}
	}
	if(spid_down==spid_up){
		switch(spid_up){
			case 13://发送战绩请求

				break;
			case gameCombat.combatPageOneConfig.fSpid://战绩页一
				if(!gameCombat.combatPageOneData.slide){
					var up_id = ifast_check_add(spid_up,upx,upy);

					if(up_id>=gameCombat.combatPageOneConfig.btnTag&&up_id<=gameCombat.combatPageOneConfig.txt1Tag){
						//console.log(up_id - gameCombat.combatPageOneConfig.btnTag);
						gameCombat.newGoCombatPageTwo(up_id - gameCombat.combatPageOneConfig.btnTag);
					}
				}
			break;
			case gameCombat.combatPageTwoConfig.fSpid://战绩页二
				if(!gameCombat.combatPageTwoData.slide){
					var up_id = ifast_check_add(spid_up,upx,upy);
					//console.log(up_id);
					if(up_id>=gameCombat.combatPageTwoConfig.btnTag&&up_id<=gameCombat.combatPageTwoConfig.txt1Tag){
						console.log(up_id - gameCombat.combatPageTwoConfig.btnTag);//选中的是第几小局0开始
						gameCombat.combatData.pageTwoIndex = up_id - gameCombat.combatPageTwoConfig.btnTag;
						gameCombat.newGoCombatPageThree(gameCombat.combatData.pageOneIndex,gameCombat.combatData.pageTwoIndex);
					}
				}
				break;
			case 49:
			case 61:
			{
				gameCombat.closeNewCombat();
			}
				break;
			case 55://战绩返回
				if(gameCombat.combatData.page == 0){
					gameCombat.closeNewCombat();
				}else if(gameCombat.combatData.page == 1){
					gameCombat.newGoCombatPageOne();
				}else{
					gameCombat.newGoCombatPageTwo(gameCombat.combatData.pageOneIndex);
				}
				break;
			case 84:
				gameCombat.Send_get_player_grade1(0);
				break;
			case 85:
				gameCombat.Send_get_player_grade1(1);
				break;
			case 104://我的开房上一页 
				gameCombat.Send_get_player_grade1(1,1,gameCombat.combatData.gradeIdx1);
				break;
			case 105://下一页 
				gameCombat.Send_get_player_grade1(1,2,gameCombat.combatData.gradeIdx2);
				break;
		}


	}
}
gameCombat.utlmousemove=function(gameid, spid, downx, downy, movex,movey ,timelong,offmovex, offmovey, no1){
	switch(spid){
		case gameCombat.combatPageOneConfig.fSpid:
			if(ifast_abs(offmovey)>2){
				set_self(spid,19,offmovey,1,0,0);
				gameCombat.combatPageOneData.slide = true;
			}
			break;
		case gameCombat.combatPageTwoConfig.fSpid:
			if(ifast_abs(offmovey)>2){
				set_self(spid,19,offmovey,1,0,0);
				gameCombat.combatPageTwoData.slide = true;
			}
			break;
	}
}
gameCombat.utlgamemydraw=function(gameid, spid, times, timelong, no2, no3, no4, no5, no6, no7){
	
}
gameCombat.utlgamemydrawbegin=function(gameid, spid, times, timelong, no2, no3, no4, no5, no6, no7){
	if(spid==gameCombat.combatPageOneConfig.fSpid){
		set_clip(0,0,gameCombat.combatPageOneConfig.clip_x,gameCombat.combatPageOneConfig.clip_y,gameCombat.combatPageOneConfig.clip_w,gameCombat.combatPageOneConfig.clip_h);
	}
	if(spid==gameCombat.combatPageTwoConfig.fSpid){
		set_clip(0,0,gameCombat.combatPageTwoConfig.clip_x,gameCombat.combatPageTwoConfig.clip_y,gameCombat.combatPageTwoConfig.clip_w,gameCombat.combatPageTwoConfig.clip_h);
	}
}

//打开战绩
gameCombat.openNewCombat = function(){

	//gameCombat.combatData.page = 0;
	if(!gameCombat.combatData.type){
		set_self(83,43,1,0,0);
	}else{
		set_self(83,43,2,0,0);
	}
	set_group(7,37,1,0,0);
	
	
	//gameCombat.newCreateCombatPageOne();
	gameCombat.newGoCombatPageOne();
}
//关闭战绩
gameCombat.closeNewCombat = function(){
	set_group(7,37,0,0,0);
	set_group(8,37,0,0,0);
	set_group(9,37,0,0,0);
	set_group(13,37,0,0,0);
	set_group(14,37,0,0,0);
	set_group(15,37,0,0,0);
	set_group(16,37,0,0,0);
	set_group(17,37,0,0,0);
	gameCombat.removeCombatPageOne();
	gameCombat.removeCombatPageTwo();
	gameCombat.removeCombatPageThree();
}
//创建战绩页一
gameCombat.newCreateCombatPageOne = function(){
	gameCombat.removeCombatPageOne();
	set_group(8,37,1,0,0);
	set_self(gameCombat.combatPageOneConfig.fSpid,18,gameCombat.combatPageOneConfig.clip_x,0,0);
	set_self(gameCombat.combatPageOneConfig.fSpid,19,gameCombat.combatPageOneConfig.clip_y,0,0);
	var h = gameCombat.combatPageOneConfig.bgSpace;
	set_self(gameCombat.combatPageOneConfig.fSpid,21,h*CombatInfo.length,0,0);
	set_self(gameCombat.combatPageOneConfig.fSpid,20,get_self(gameCombat.combatPageOneConfig.bgSpid,20,0,0,0),0,0);
	var bgTag = gameCombat.combatPageOneConfig.bgTag;
	var btnTag = gameCombat.combatPageOneConfig.btnTag;
	var txt1Tag = gameCombat.combatPageOneConfig.txt1Tag;
	var txt2Tag = gameCombat.combatPageOneConfig.txt2Tag;
	var txt3Tag = gameCombat.combatPageOneConfig.txt3Tag;
	var splitTag = gameCombat.combatPageOneConfig.splitTag;
	for(var i=0;i<CombatInfo.length;i++){
		//背景
		var bg = ifast_addtospritefromspritecopy(gameCombat.combatPageOneConfig.fSpid,gameCombat.combatPageOneConfig.bgSpid,
			0,0+i*gameCombat.combatPageOneConfig.bgSpace,bgTag);
		bgTag++;
		//时间标签
		var timeTag = ifast_addtospritefromspritecopy(gameCombat.combatPageOneConfig.fSpid,gameCombat.combatPageOneConfig.txt1Spid,
			gameCombat.combatPageOneConfig.txt1Position[0][0],
			gameCombat.combatPageOneConfig.txt1Position[0][1]+i*gameCombat.combatPageOneConfig.bgSpace,
			txt1Tag);
		set_self(timeTag,7,"时间:",0,0);
		txt1Tag++;
		//房号标签
		var roomCodeTag = ifast_addtospritefromspritecopy(gameCombat.combatPageOneConfig.fSpid,gameCombat.combatPageOneConfig.txt1Spid,
			gameCombat.combatPageOneConfig.txt1Position[1][0],
			gameCombat.combatPageOneConfig.txt1Position[1][1]+i*gameCombat.combatPageOneConfig.bgSpace,
			txt1Tag);
		set_self(roomCodeTag,7,"房号:",0,0);
		txt1Tag++;
		//局数标签
		var countTag = ifast_addtospritefromspritecopy(gameCombat.combatPageOneConfig.fSpid,gameCombat.combatPageOneConfig.txt1Spid,
			gameCombat.combatPageOneConfig.txt1Position[2][0],
			gameCombat.combatPageOneConfig.txt1Position[2][1]+i*gameCombat.combatPageOneConfig.bgSpace,
			txt1Tag);
		set_self(countTag,7,"局数:",0,0);
		txt1Tag++;
		//时间
		var time =  ifast_addtospritefromspritecopy(gameCombat.combatPageOneConfig.fSpid,gameCombat.combatPageOneConfig.txt2Spid,
			gameCombat.combatPageOneConfig.txt2Position[0][0],
			gameCombat.combatPageOneConfig.txt2Position[0][1]+i*gameCombat.combatPageOneConfig.bgSpace,
			txt2Tag);
		set_self(time,7,CombatInfo[i].overtime,0,0);
		txt2Tag++;

		//房号
		var roomcode =  ifast_addtospritefromspritecopy(gameCombat.combatPageOneConfig.fSpid,gameCombat.combatPageOneConfig.txt2Spid,
			gameCombat.combatPageOneConfig.txt2Position[1][0],
			gameCombat.combatPageOneConfig.txt2Position[1][1]+i*gameCombat.combatPageOneConfig.bgSpace,
			txt2Tag);
		txt2Tag++;
		set_self(roomcode,7,CombatInfo[i].roomcode,0,0);
		//局数
		var round =  ifast_addtospritefromspritecopy(gameCombat.combatPageOneConfig.fSpid,gameCombat.combatPageOneConfig.txt2Spid,
			gameCombat.combatPageOneConfig.txt2Position[2][0],
			gameCombat.combatPageOneConfig.txt2Position[2][1]+i*gameCombat.combatPageOneConfig.bgSpace,
			txt2Tag);
		txt2Tag++;
		set_self(round,7,CombatInfo[i].gameinfo1.roundsum,0,0);

		//玩家信息(昵称，积分)
		var position = gameCombat.combatPageOneConfig.txt3Position5;
		var _pCount = 0;
		for(var m=0;m<CombatInfo[i].gameinfo1.playerlist.length;m++){
			if(CombatInfo[i].gameinfo1.playerlist[m]){
				_pCount++;
			}
		}
		if(_pCount > 5){
			//splitPosition
			position = gameCombat.combatPageOneConfig.txt3Position10;
			var splitLine = ifast_addtospritefromspritecopy(gameCombat.combatPageOneConfig.fSpid,gameCombat.combatPageOneConfig.splitSpid,
			gameCombat.combatPageOneConfig.splitPosition[0],
			gameCombat.combatPageOneConfig.splitPosition[1]+i*gameCombat.combatPageOneConfig.bgSpace,
			splitTag);
			splitTag++;
		}
		var nameLimit;
		CombatInfo[i].gameinfo1.playerlist.length > 5 ? nameLimit = gameCombat.combatPageOneConfig.nickNameLimit10:nameLimit = gameCombat.combatPageOneConfig.nickNameLimit5;
		var n=0;
		for(var j=0;j<CombatInfo[i].gameinfo1.playerlist.length;j++){
			if(CombatInfo[i].gameinfo1.playerlist[j]){
				//set_rec(233+i*count+j*2,Func.subString(CombatInfo[i].gameinfo1.playerlist[j][0],gameCombat.combat.pageOnelimitStrLen,gameCombat.combat.pageOneDoc));
				//set_rec(234+i*count+j*2,CombatInfo[i].gameinfo1.playerlist[j][1]);
				//var nameTxt = "";
				//if(CombatInfo[i].gameinfo1.playerlist[j]){
				var nameTxt = Func.subString(CombatInfo[i].gameinfo1.playerlist[j][0],nameLimit,true);	
				//}
				
				var nickname = ifast_addtospritefromspritecopy(gameCombat.combatPageOneConfig.fSpid,gameCombat.combatPageOneConfig.txt3Spid,
				position[n][0]- String(nameTxt).gblen()*gameCombat.combatPageOneConfig.txt3Width/2,
				position[n][1]+i*gameCombat.combatPageOneConfig.bgSpace,txt3Tag);
				txt3Tag++;
				set_self(nickname,7,nameTxt,0,0);
				//var scoreTxt = "";
				//if(CombatInfo[i].gameinfo1.playerlist[j]){
				var scoreTxt = CombatInfo[i].gameinfo1.playerlist[j][1];
				//}
				//
				var score = ifast_addtospritefromspritecopy(gameCombat.combatPageOneConfig.fSpid,gameCombat.combatPageOneConfig.txt3Spid,
				position[n][0]- String(scoreTxt).gblen()*gameCombat.combatPageOneConfig.txt3Width/2,
				position[n][1]+gameCombat.combatPageOneConfig.nsSpace+i*gameCombat.combatPageOneConfig.bgSpace,txt3Tag);
				txt3Tag++;
				set_self(score,7,scoreTxt,0,0);
				n++;
			}
		}
		var btn = ifast_addtospritefromspritecopy(gameCombat.combatPageOneConfig.fSpid,gameCombat.combatPageOneConfig.btnSpid,
			gameCombat.combatPageOneConfig.btnPosition[0],
			gameCombat.combatPageOneConfig.btnPosition[1]+i*gameCombat.combatPageOneConfig.bgSpace,
			btnTag);
			btnTag++;
	}
	gameCombat.combatPageOneData.bgTag = bgTag;
	gameCombat.combatPageOneData.btnTag = btnTag;
	gameCombat.combatPageOneData.txt1Tag = txt1Tag;
	gameCombat.combatPageOneData.txt2Tag = txt2Tag;
	gameCombat.combatPageOneData.txt3Tag = txt3Tag;
	gameCombat.combatPageOneData.splitTag = splitTag;
}
//删除战绩页一
gameCombat.removeCombatPageOne = function(){
	for(var i=gameCombat.combatPageOneConfig.bgTag;i<gameCombat.combatPageOneData.bgTag;i++){
		ifast_dllpritefromspritecopy(gameCombat.combatPageOneConfig.fSpid,i);
	}
	gameCombat.combatPageOneData.bgTag = 0;
	for(var i=gameCombat.combatPageOneConfig.btnTag;i<gameCombat.combatPageOneData.btnTag;i++){
		ifast_dllpritefromspritecopy(gameCombat.combatPageOneConfig.fSpid,i);
	}
	gameCombat.combatPageOneData.btnTag = 0;
	for(var i=gameCombat.combatPageOneConfig.txt1Tag;i<gameCombat.combatPageOneData.txt1Tag;i++){
		ifast_dllpritefromspritecopy(gameCombat.combatPageOneConfig.fSpid,i);
	}
	gameCombat.combatPageOneData.txt1Tag = 0;
	for(var i=gameCombat.combatPageOneConfig.txt2Tag;i<gameCombat.combatPageOneData.txt2Tag;i++){
		ifast_dllpritefromspritecopy(gameCombat.combatPageOneConfig.fSpid,i);
	}
	gameCombat.combatPageOneData.txt2Tag = 0;
	for(var i=gameCombat.combatPageOneConfig.txt3Tag;i<gameCombat.combatPageOneData.txt3Tag;i++){
		ifast_dllpritefromspritecopy(gameCombat.combatPageOneConfig.fSpid,i);
	}
	gameCombat.combatPageOneData.txt3Tag = 0;
	for(var i=gameCombat.combatPageOneConfig.splitTag;i<gameCombat.combatPageOneData.splitTag;i++){
		ifast_dllpritefromspritecopy(gameCombat.combatPageOneConfig.fSpid,i);
	}
	gameCombat.combatPageOneData.splitTag = 0;
	set_group(8,37,0,0,0);
}
//创建战绩页二
gameCombat.newCreateCombatPageTwo = function(){

	set_group(9,37,1,0,0);
	set_self(gameCombat.combatPageTwoConfig.fSpid,18,gameCombat.combatPageTwoConfig.clip_x,0,0);
	set_self(gameCombat.combatPageTwoConfig.fSpid,19,gameCombat.combatPageTwoConfig.clip_y,0,0);
	var h = gameCombat.combatPageTwoConfig.bgSpace;
	set_self(gameCombat.combatPageTwoConfig.fSpid,21,h*CombatInfo[gameCombat.combatData.pageOneIndex].gameinfo1.round.length,0,0);
	set_self(gameCombat.combatPageTwoConfig.fSpid,20,get_self(gameCombat.combatPageTwoConfig.bgSpid,20,0,0,0),0,0);
	var bgTag = gameCombat.combatPageTwoConfig.bgTag;
	var btnTag = gameCombat.combatPageTwoConfig.btnTag;
	var txt1Tag = gameCombat.combatPageTwoConfig.txt1Tag;
	var txt3Tag = gameCombat.combatPageTwoConfig.txt3Tag;
	var splitTag = gameCombat.combatPageTwoConfig.splitTag;




	for(var i=0;i<CombatInfo[gameCombat.combatData.pageOneIndex].gameinfo1.round.length;i++){
		//背景
		var bg = ifast_addtospritefromspritecopy(gameCombat.combatPageTwoConfig.fSpid,gameCombat.combatPageTwoConfig.bgSpid,
			0,0+i*gameCombat.combatPageTwoConfig.bgSpace,bgTag);
		bgTag++;
		//第几局
		var round = ifast_addtospritefromspritecopy(gameCombat.combatPageTwoConfig.fSpid,gameCombat.combatPageTwoConfig.txt1Spid,
			gameCombat.combatPageTwoConfig.txt1Position[0][0],
			gameCombat.combatPageTwoConfig.txt1Position[0][1]+i*gameCombat.combatPageTwoConfig.bgSpace,
			txt1Tag);
		var rd = i+1;
		var txt = "";
		rd < 10 ? (txt = "第 "+rd+" 局" ): (txt = "第"+rd+"局");
		set_self(round,7,txt,0,0);
		txt1Tag++;

		//玩家信息(昵称，积分)
		var position = gameCombat.combatPageTwoConfig.txt3Position5;
		var _pCount=0;
		for(var m=0;m<CombatInfo[gameCombat.combatData.pageOneIndex].gameinfo1.playerlist.length;m++){
			if(CombatInfo[gameCombat.combatData.pageOneIndex].gameinfo1.playerlist[m]){
				_pCount++;
			}
		}
		if(_pCount > 5){
			//splitPosition
			position = gameCombat.combatPageTwoConfig.txt3Position10;
			var splitLine = ifast_addtospritefromspritecopy(gameCombat.combatPageTwoConfig.fSpid,gameCombat.combatPageTwoConfig.splitSpid,
			gameCombat.combatPageTwoConfig.splitPosition[0],
			gameCombat.combatPageTwoConfig.splitPosition[1]+i*gameCombat.combatPageTwoConfig.bgSpace,
			splitTag);
			splitTag++;
		}
		var nameLimit;
		CombatInfo[gameCombat.combatData.pageOneIndex].gameinfo1.playerlist.length > 5 ? nameLimit = gameCombat.combatPageTwoConfig.nickNameLimit10:nameLimit = gameCombat.combatPageTwoConfig.nickNameLimit5;
		var scoreList = [];
		var n=0;
		for(var j=0;j<CombatInfo[gameCombat.combatData.pageOneIndex].gameinfo1.playerlist.length;j++){
			if(CombatInfo[gameCombat.combatData.pageOneIndex].gameinfo1.playerlist[j]){
				//set_rec(233+i*count+j*2,Func.subString(CombatInfo[i].gameinfo1.playerlist[j][0],gameCombat.combat.pageOnelimitStrLen,gameCombat.combat.pageOneDoc));
				//set_rec(234+i*count+j*2,CombatInfo[i].gameinfo1.playerlist[j][1]); - String(nameTxt).gblen()*gameCombat.combatPageOneConfig.txt3Width
				var nameTxt = Func.subString(CombatInfo[gameCombat.combatData.pageOneIndex].gameinfo1.playerlist[j][0],nameLimit,true);
				var nickname = ifast_addtospritefromspritecopy(gameCombat.combatPageTwoConfig.fSpid,gameCombat.combatPageTwoConfig.txt3Spid,
				position[n][0],position[n][1]+i*gameCombat.combatPageTwoConfig.bgSpace,txt3Tag);
				txt3Tag++;
				set_self(nickname,7,nameTxt,0,0);
	
				//var scoreTxt = CombatInfo[gameCombat.combatData.page].gameinfo1.playerlist[j][1];
				// - String(scoreTxt).gblen()*gameCombat.combatPageOneConfig.txt3Width
				var score = ifast_addtospritefromspritecopy(gameCombat.combatPageTwoConfig.fSpid,gameCombat.combatPageTwoConfig.txt3Spid,
				position[n][0],position[n][1]+gameCombat.combatPageTwoConfig.nsSpace+i*gameCombat.combatPageTwoConfig.bgSpace,txt3Tag);
				txt3Tag++;
				set_self(score,7,0,0,0);
				//scoreList.push(score);
				//.length <= 5 ? _maxLen = CombatInfo[v].gameinfo1.round[i].length : _maxLen = 5;
				for(var k=0;k<CombatInfo[gameCombat.combatData.pageOneIndex].gameinfo1.round[i].length;k++){
					//set_rec(232+i*count+CombatInfo[gameCombat.combatData.page].gameinfo1.round[i][j][0],CombatInfo[v].gameinfo1.round[i][j][1]);
					if(CombatInfo[gameCombat.combatData.pageOneIndex].gameinfo1.round[i][k][0] == j){
						set_self(score,7,CombatInfo[gameCombat.combatData.pageOneIndex].gameinfo1.round[i][k][1]);
					}
				}
				n++;
			}
		}

		var btn = ifast_addtospritefromspritecopy(gameCombat.combatPageTwoConfig.fSpid,gameCombat.combatPageTwoConfig.btnSpid,
			gameCombat.combatPageTwoConfig.btnPosition[0],
			gameCombat.combatPageTwoConfig.btnPosition[1]+i*gameCombat.combatPageTwoConfig.bgSpace,
			btnTag);
			btnTag++;



	}

	gameCombat.combatPageTwoData.bgTag = bgTag;
	gameCombat.combatPageTwoData.btnTag = btnTag;
	gameCombat.combatPageTwoData.txt1Tag = txt1Tag;
	gameCombat.combatPageTwoData.txt3Tag = txt3Tag;
	gameCombat.combatPageTwoData.splitTag = splitTag;
}
//删除战绩页一
gameCombat.removeCombatPageTwo = function(){
	for(var i=gameCombat.combatPageTwoConfig.bgTag;i<gameCombat.combatPageTwoData.bgTag;i++){
		ifast_dllpritefromspritecopy(gameCombat.combatPageTwoConfig.fSpid,i);
	}
	gameCombat.combatPageTwoData.bgTag = 0;
	for(var i=gameCombat.combatPageTwoConfig.btnTag;i<gameCombat.combatPageTwoData.btnTag;i++){
		ifast_dllpritefromspritecopy(gameCombat.combatPageTwoConfig.fSpid,i);
	}
	gameCombat.combatPageTwoData.btnTag = 0;
	for(var i=gameCombat.combatPageTwoConfig.txt1Tag;i<gameCombat.combatPageTwoData.txt1Tag;i++){
		ifast_dllpritefromspritecopy(gameCombat.combatPageTwoConfig.fSpid,i);
	}
	gameCombat.combatPageTwoData.txt1Tag = 0;
	for(var i=gameCombat.combatPageTwoConfig.txt3Tag;i<gameCombat.combatPageTwoData.txt3Tag;i++){
		ifast_dllpritefromspritecopy(gameCombat.combatPageTwoConfig.fSpid,i);
	}
	gameCombat.combatPageTwoData.txt3Tag = 0;
	for(var i=gameCombat.combatPageTwoConfig.splitTag;i<gameCombat.combatPageTwoData.splitTag;i++){
		ifast_dllpritefromspritecopy(gameCombat.combatPageTwoConfig.fSpid,i);
	}
	gameCombat.combatPageTwoData.splitTag = 0;
	set_group(9,37,0,0,0);
}
//创建战绩页三
gameCombat.newCreateCombatPageThree = function(){
	gameCombat.combatData.page = 2;
}
gameCombat.removeCombatPageThree = function(){

}
//前往战绩页一
gameCombat.newGoCombatPageOne = function(){
	gameCombat.removeCombatPageTwo();
	gameCombat.removeCombatPageThree();
	gameCombat.combatData.page = 0;
	gameCombat.newCreateCombatPageOne();
	if(gameCombat.combatData.type){
		set_self(104,37,1,0,0);
		set_self(105,37,1,0,0);
	}else{
		set_self(104,37,0,0,0);
		set_self(105,37,0,0,0);	
	}
	if(CombatCount){
		set_self(684,7,CombatCount,0,0);
		set_self(684,20,String(CombatCount).length*14,0,0);
	}else{
		set_self(683,37,0,0,0);
		set_self(684,37,0,0,0);
	}
	set_self(82,37,1,0,0);
	if(!gameCombat.combatData.type){
		set_self(82,43,1,0,0);
	}else{
		set_self(82,43,2,0,0);
	}
}
//前往战绩页一
gameCombat.newGoCombatPageTwo = function(page){
	gameCombat.combatData.page = 1;
	gameCombat.removeCombatPageOne();
	gameCombat.removeCombatPageThree();
	gameCombat.combatData.pageOneIndex = page;
	gameCombat.newCreateCombatPageTwo();
	if(CombatCount){
		set_self(684,7,CombatCount,0,0);
		set_self(684,20,String(CombatCount).length*14,0,0);
	}else{
		set_self(683,37,0,0,0);
		set_self(684,37,0,0,0);
	}
	set_self(82,37,1,0,0);
	if(!gameCombat.combatData.type){
		set_self(82,43,1,0,0);
	}else{
		set_self(82,43,2,0,0);
	}
}
//前往战绩页一
gameCombat.newGoCombatPageThree = function(idx1,idx2){//idx1第几大局,idx2第几小局 
	gameCombat.removeCombatPageOne();
	gameCombat.removeCombatPageTwo();
	gameCombat.newCreateCombatPageThree();
	//console.log("idx1:"+idx1+" idx2:"+idx2);
}
//发送战绩一
gameCombat.Send_get_player_grade1 = function(type,direction,gradeidx){
	var data={};
	data.agentid = GameData.AgentId;
	data.playerid = C_Player.playerid;
	data.gameid = GameData.GameId;
	gameCombat.combatData.type = type;
	if(typeof type != "undefined"){
		data.type = type;
	}
	if(typeof direction != "undefined"){
		data.direction = direction;
	}
	if(typeof gradeidx != "undefined"){
		data.gradeidx = gradeidx;
	}
	Net.Send_get_player_grade1(data);
}
//接收获取战绩
gameCombat.get_player_grade1 = function(_msg){
	Utl.playSound(Game_Config.ClickButton.src_2);
	
	//gameCombat.combatData.type = _msg.data.type;
	CombatInfo = _msg.data.gradeinfo;
	CombatCount = _msg.data.asetcount;
	for(var i=0;i<CombatInfo.length;i++){
		if(typeof CombatInfo[i].gameinfo1 == "string"){
			CombatInfo[i].gameinfo1=JSON.parse(CombatInfo[i].gameinfo1);
		}
		if(i==0){
			gameCombat.combatData.gradeIdx1 = CombatInfo[i].idx;
		}
		if(i==CombatInfo.length-1){
			gameCombat.combatData.gradeIdx2 = CombatInfo[i].idx;
		}
	}
	
	gameCombat.openNewCombat();

}
//
gameCombat.Send_get_player_grade2 = function(_data){
	Net.Send_get_player_grade2(_data);

}
//
gameCombat.get_player_grade2 = function(_msg){

}



















