var gamehall_GameUI = gamehall_GameUI ||{}; gamehall_GameUI.Mem = {}; gamehall_GameUI.Mem.categoryObj = null; gamehall_GameUI.Mem.gameList = []; gamehall_GameUI.utlani_doend = function(id,sx,count,allend){ } gamehall_GameUI.onloadurl = function(recid,rectype,url,error,count,len){ } gamehall_GameUI.utlgamebegindraw = function(gameid, spid, times, timelong){ } gamehall_GameUI.utlmousedown = function(gameid, spid, downx, downy, no1, no2, no3, no4, no5, no6){ for(var i=0;i gamehall_Const.GameList.place_x1){// //var t = pos - gamehall_Const.GameList.place_x1; //play_ani(1,spid_down,18,pos,gamehall_Const.GameList.place_x1,0,t,0,0,0,1,0,0,0); //}else{ //if(gamehall_Const.GameList.pageCount>=gamehall_Data.GameList.length){ //if(pos < gamehall_Const.GameList.place_x1){ //var t = gamehall_Const.GameList.place_x1 - pos; //play_ani(1,spid_down,18,pos,gamehall_Const.GameList.place_x1,0,t,0,0,0,1,0,0,0); //} //}else{ //var dis = get_self(spid_down,20,0,0,0);; //if(pos + dis < gamehall_Const.GameList.place_x2){ //var t = gamehall_Const.GameList.place_x2 - dis - pos; //play_ani(1,spid_down,18,pos,gamehall_Const.GameList.place_x2 - dis,0,t,0,0,0,1,0,0,0); //} //} //} //} if(spid_down == gamehall_Const.GameList.f_spid){ gamehall_Data.deltaX = upx - gamehall_Data.downX; var pos = get_self(spid_down,18,0,0,0); var x = gamehall_GameUI.getSlideLocation(pos); var t = ifast_abs(x-pos)/2; //t=100; //console.log("x="+x); play_ani(1,spid_down,18,pos,x,0,t,0,0,0,1,0,0,0); } if(spid_down == gamehall_Const.categoryTwo.f_spid){ gamehall_Data.deltaX = upx - gamehall_Data.downX; var pos = get_self(spid_down,18,0,0,0); var x = gamehall_GameUI.getSlideLocation2(pos); var t = ifast_abs(x-pos)/2; //console.log("x="+x); //t=100; play_ani(1,spid_down,18,pos,x,0,t,0,0,0,1,0,0,0); } if(spid_down==gamehall_Const.Location.f_spid){ var pos=get_self(spid_down,19,0,0,0); var h=get_self(spid_down,21,0,0,0); if(pos>gamehall_Const.Location.clip_y){ var t = pos - gamehall_Const.Location.clip_y; play_ani(1,spid_down,19,pos,gamehall_Const.Location.clip_y,0,t,0,0,0,1,0,0,0); }else{ if(gamehall_Const.Location.clip_h < h){ var t = gamehall_Const.Location.clip_y+gamehall_Const.Location.clip_h-pos-h; play_ani(1,spid_down,19,pos,gamehall_Const.Location.clip_y+gamehall_Const.Location.clip_h-h,0,t,0,0,0,1,0,0,0); }else{ var t = gamehall_Const.Location.clip_y - pos; play_ani(1,spid_down,19,pos,gamehall_Const.Location.clip_y,0,t,0,0,0,1,0,0,0); } } } if(spid_up == spid_down){ switch(spid_up){ /* case gamehall_Const.GameList.f_spid://点击游戏列表 var up_id = ifast_check_add(spid_up,upx,upy); if(!gamehall_Data.isSliderGameList){ //console.log(up_id); if(up_id>=gamehall_Const.GameList.bg_tag&&up_id=gamehall_Const.GameList.bg_tag&&up_id=gamehall_Const.categoryTwo.bg_tag&&up_id= gamehall_Const.Location.selectTag && up_id < gamehall_Const.Location.nameTag){ gamehall_GameUI.selectAgent(up_id - gamehall_Const.Location.selectTag); } } break; //case 1002: //GameUI.OpenInfo_hall(); //break; case 1010: var data={}; var webtype = 3; if(gamehall_Data.GameList[gamehall_Data.gameIdx].webtype){ webtype = gamehall_Data.GameList[gamehall_Data.gameIdx].webtype; } data.webtype = webtype; data.gamedir = gamehall_Data.GameList[gamehall_Data.gameIdx].gamedir; data.gameid = gamehall_Data.GameList[gamehall_Data.gameIdx].gameid; gamehall_Logic.saveGameinfo(JSON.stringify(data)); var data1={}; data1.from=2; data1.opt = "loginPlayerid"; data1.data = Utl.ReadData(gamehall_Logic.launchGameId); Func.SwitchOverGameData(webtype,gamehall_Data.GameList[gamehall_Data.gameIdx].gamedir,gamehall_Data.GameList[gamehall_Data.gameIdx].gameid,data1); gamehall_GameUI.closeCheckDownload(); break; case 1011: case 1008: gamehall_GameUI.closeCheckDownload(); break; case 1029: gamehall_GameUI.showCategoryOne(); break; case 1030: gamehall_GameUI.showCategoryTwo(); break; case 1031: gamehall_GameUI.showCategoryThree(); break; case 1032: gamehall_GameUI.showCategoryFour(); break; case 1033: gamehall_GameUI.showCategoryFive(); break; //确认切换 case 1036: gamehall_GameUI.switchLocalHall(); break; //取消切换 case 1038: case 1034: gamehall_GameUI.closeCheckSwitch(); break; case 1040: gamehall_GameUI.openSelectAgent(); break; case 1042: case 1049: gamehall_GameUI.closeSelectAgent(); break; case 1048: gamehall_Data.agentConfigTemp = gamehall_Data.selectedAgent; gamehall_GameUI.switchLocalHall(); break; } if(spid_up >= 1029 && spid_up <=1033){ Utl.playSound("00052.mp3"); gamehall_Data.categoryPage = spid_up-1029; gamehall_GameUI.updateSelectBar(); } } } gamehall_GameUI.utlmousemove = function(gameid, spid, downx, downy, movex,movey ,timelong,offmovex, offmovey, no1){ switch(spid){ case gamehall_Const.GameList.f_spid://游戏列表 if(ifast_abs(offmovex)>10){ set_self(spid,18,offmovex,1,0); gamehall_Data.isSliderGameList = true; } break; case gamehall_Const.categoryTwo.f_spid://游戏列表 if(ifast_abs(offmovex)>10){ set_self(spid,18,offmovex,1,0); gamehall_Data.categoryTwo.isSlide = true; } break; case gamehall_Const.Location.f_spid://游戏列表 if(ifast_abs(offmovey)>10){ set_self(spid,19,offmovey,1,0); gamehall_Data.selectAgentSlide = true; } break; } } gamehall_GameUI.utlgamemydraw = function(gameid, spid, times, timelong, no2, no3, no4, no5, no6, no7){ } gamehall_GameUI.utlgamemydrawbegin = function(gameid, spid, times, timelong, no2, no3, no4, no5, no6, no7){ if(spid==gamehall_Const.GameList.f_spid){ set_clip(0,0,gamehall_Const.GameList.clip_x,gamehall_Const.GameList.clip_y,gamehall_Const.GameList.clip_w,gamehall_Const.GameList.clip_h); set_clip(0,0,gamehall_Const.GameList.place_x1,gamehall_Const.GameList.clip_y,gamehall_Const.GameList.pageWidth,gamehall_Const.GameList.clip_h); } if(spid==gamehall_Const.Location.f_spid){ set_clip(0,0,gamehall_Const.Location.clip_x,gamehall_Const.Location.clip_y,gamehall_Const.Location.clip_w,gamehall_Const.Location.clip_h); } } gamehall_GameUI.utlontimer = function(gameid, spid, /* 本次间隔多少次了 */ times, /* 本次间隔多久 */ timelong,/* 开启后运行多少次了 */ alltimes){ } //显示游戏大厅子游戏信息按钮 gamehall_GameUI.updateHall = function(){ for(var i=0;i gamehall_Const.GameList.deltaX){//向右滑动 if(categoryObj.pageTag == 0){ pIndex =0; }else{ pIndex = (categoryObj.pageTag - 1) % categoryObj.pageCount; } }else if(gamehall_Data.deltaX < -gamehall_Const.GameList.deltaX){//向左滑动 if(categoryObj.pageTag == categoryObj.pageCount - 1){ pIndex = categoryObj.pageTag; }else{ pIndex = (categoryObj.pageTag + 1) % categoryObj.pageCount; } } categoryObj.pageTag = pIndex; //gamehall_GameUI.updateCategoryOnePageNumber(); gamehall_GameUI.updatePageNumber(categoryObj.pageTag); return pageLocation[pIndex]; } gamehall_GameUI.getSlideLocation2 = function(x){ //if(x > gamehall_Const.categoryTwo.place_x1 ){ //return gamehall_Const.categoryTwo.place_x1; //} //if(x < gamehall_Const.categoryTwo.place_x1 - get_self(gamehall_Const.categoryTwo.f_spid,20,0,0,0)-(gamehall_Const.categoryTwo.pageSpace + gamehall_Const.categoryTwo.pageWidth)){ //return gamehall_Const.categoryTwo.place_x1 - get_self(gamehall_Const.categoryTwo.f_spid,20,0,0,0); //} var pageLocation = []; for(var i=0;i < gamehall_Data.categoryTwo.pageCount;i++ ){ pageLocation.push(gamehall_Const.categoryTwo.place_x1 - i*(gamehall_Const.categoryTwo.pageSpace + gamehall_Const.categoryTwo.pageWidth)); } //if(x > pageLocation[0]){ //pIndex = 0; //}else{ //if(x < pageLocation[pageLocation.length - 1]){ //pIndex = pageLocation.length - 1; //}else{ //for(var i=0;i pageLocation[i+1]){ //pIndex = i+1; //break; //} //} //} //} var pIndex = gamehall_Data.categoryTwo.pageTag; if(gamehall_Data.deltaX > gamehall_Const.categoryTwo.deltaX){//向右滑动 if(gamehall_Data.categoryTwo.pageTag == 0){ pIndex =0; }else{ pIndex = (gamehall_Data.categoryTwo.pageTag - 1) % gamehall_Data.categoryTwo.pageCount; } }else if(gamehall_Data.deltaX < -gamehall_Const.categoryTwo.deltaX){//向左滑动 if(gamehall_Data.categoryTwo.pageTag == gamehall_Data.categoryTwo.pageCount - 1){ pIndex = gamehall_Data.categoryTwo.pageTag; }else{ pIndex = (gamehall_Data.categoryTwo.pageTag + 1) % gamehall_Data.categoryTwo.pageCount; } } //return gamehall_Data.categoryTwo.pageTag; //console.log(pIndex); gamehall_Data.categoryTwo.pageTag = pIndex; //gamehall_GameUI.updateCategoryTwoPageNumber(); gamehall_GameUI.updatePageNumber(gamehall_Data.categoryTwo.pageTag); return pageLocation[pIndex]; } //设置首页页数 /* gamehall_GameUI.setCategoryOnePageCount = function(){ if(gamehall_Data.GameList.length<=6){ gamehall_Data.categoryOne.pageCount = 1; }else{ gamehall_Data.categoryOne.pageCount = Math.ceil((gamehall_Data.GameList.length-6)/8)+1; } }*/ //设置首页页数 gamehall_GameUI.setCategoryOnePageCount = function(){ gamehall_Data.categoryOne.pageCount = Math.ceil(gamehall_Data.GameList.length/6); /* if(gamehall_Data.GameList.length<=6){ gamehall_Data.categoryOne.pageCount = 1; }else{ gamehall_Data.categoryOne.pageCount = Math.ceil((gamehall_Data.GameList.length-6)/8)+1; }*/ } //设置首页页数 gamehall_GameUI.setCategoryTwoPageCount = function(){ gamehall_Data.categoryTwo.pageCount = Math.ceil(gamehall_Data.categoryTwo.gameList.length/6); } gamehall_GameUI.getCategoryOnePageTag = function(tag){ return Math.floor(tag/6); if(tag<5){ return 0; }else{ return Math.ceil((tag-5)/8); } } gamehall_GameUI.getCategoryTwoPageTag = function(tag){ return Math.floor(tag/6); } gamehall_GameUI.showCategoryTwo = function(){ set_self(1015,37,1,0,0); set_self(1016,37,1,0,0); set_self(gamehall_Const.GameList.f_spid,37,0,0,0); gamehall_Data.categoryPage = 1; gamehall_GameUI.createDownloadedPage(); gamehall_GameUI.updateCategoryItem(); } gamehall_GameUI.createDownloadedPage = function(){ gamehall_GameUI.createCategory(gamehall_Data.categoryTwo.gameList,gamehall_Data.categoryTwo,0); return; //set_self(1001,1,219,0,0); gamehall_Data.categoryTwo.pageTag = 0; gamehall_GameUI.clearCategoryTwo(); gamehall_GameUI.clearGameHall(); gamehall_GameUI.setCategoryTwoPageCount(); var pages = gamehall_Data.categoryTwo.pageCount; set_self(gamehall_Const.categoryTwo.f_spid,37,1,0,0); set_self(gamehall_Const.categoryTwo.bg_spid,37,1,0,0); set_self(gamehall_Const.categoryTwo.f_spid,18,gamehall_Const.categoryTwo.place_x1,0,0); set_self(gamehall_Const.categoryTwo.f_spid,20,gamehall_Const.categoryTwo.pageWidth*pages+(pages-1)*gamehall_Const.categoryTwo.pageSpace,0,0); set_self(gamehall_Const.categoryTwo.f_spid,21,gamehall_Const.categoryTwo.h,0,0); if(!gamehall_Data.categoryTwo.isCreate){//未创建 for(var i=0;i 135){ set_self(1040,20,w,0,0); }else{ set_self(1040,20,135,0,0); } }else{ set_group(209,37,0,0,0); } } gamehall_GameUI.showGameHall = function(){ gamehall_GameUI.updateLocation(); gamehall_GameUI.updateSelectBar(); gamehall_GameUI.updateHall(); switch(gamehall_Data.categoryPage){ case 0://全部 gamehall_GameUI.showCategoryOne(); break; case 1://分类一 gamehall_GameUI.showCategoryTwo(); break; case 2://分类二 gamehall_GameUI.showCategoryThree(); break; case 3://分类三 gamehall_GameUI.showCategoryFour(); break; case 4://分类四 gamehall_GameUI.showCategoryFive(); break; } } gamehall_GameUI.showCategoryThree = function(){ gamehall_GameUI.createCategory(gamehall_Data.categoryThree.gameList,gamehall_Data.categoryThree,2); } gamehall_GameUI.showCategoryFour = function(){ gamehall_GameUI.createCategory(gamehall_Data.categoryFour.gameList,gamehall_Data.categoryFour,3); } gamehall_GameUI.showCategoryFive = function(){ gamehall_GameUI.createCategory(gamehall_Data.categoryFive.gameList,gamehall_Data.categoryFive,4); } gamehall_GameUI.createCategory = function(gameList,categoryObject,page){ gamehall_GameUI.Mem.categoryObj = categoryObject; gamehall_GameUI.Mem.gameList = gameList; //gamehall_Data.categoryOne.pageTag = 0; gamehall_GameUI.clearCategory(); categoryObject.pageTag = 0; set_self(1015,37,1,0,0); set_self(1016,37,1,0,0); gamehall_Data.categoryPage = page; gamehall_GameUI.setCategoryPageCount(categoryObject,gameList.length); var pages = categoryObject.pageCount; set_self(gamehall_Const.GameList.f_spid,19,gamehall_Const.GameList.clip_y,0,0); set_self(gamehall_Const.GameList.f_spid,37,1,0,0); set_self(gamehall_Const.GameList.bg_spid,37,1,0,0); set_self(gamehall_Const.GameList.spidList[0],37,1,0,0); set_self(gamehall_Const.GameList.spidList[1],37,1,0,0); set_self(gamehall_Const.GameList.spidList[2],37,1,0,0); set_self(gamehall_Const.GameList.pack_spid,37,1,0,0); set_self(gamehall_Const.GameList.front_spid,37,1,0,0); set_self(1007,37,1,0,0); set_self(gamehall_Const.GameList.f_spid,18,gamehall_Const.GameList.place_x1,0,0); //set_self(gamehall_Const.GameList.f_spid,20,gamehall_Data.GameList.length*(gamehall_Const.GameList.dis_x+gamehall_Const.GameList.w),0,0); set_self(gamehall_Const.GameList.f_spid,20,gamehall_Const.GameList.pageWidth*pages+(pages-1)*gamehall_Const.GameList.pageSpace,0,0); //set_self(gamehall_Const.GameList.f_spid,20,pages*(gamehall_Const.GameList.pageSpace+gamehall_Const.GameList.pageWidth),0,0); set_self(gamehall_Const.GameList.f_spid,21,gamehall_Const.GameList.h,0,0); if(!gamehall_Data.isCreateGameList){//未创建 for(var i=0;i