ifastunit = 6; var gameabc_face = gameabc_face || {}; var ifastfen = "\r\n"; var ifastnull = null; var dfwnull = "null"; var ifastno = undefined; gameabc_face.showmessage = function(str,mode) { // } gameabc_face.logmessage = function(str) { // }; function ifast_float(f,r) { /* 数字转字符 * f:输入floar数字 r:坐标缩放比例 例如 var y=ifast_floar(1.1,2); showmessage(y); 输出:"2.2"; */ // }; function ifast_int(i,r) { /* 数字转字符 * i:输入数字 r:坐标缩放比例 例如 var y=ifast_intt(123,2); showmessage(y); 输出:"246"; */ // }; function ifast_inttostr(i) { /* 数字转字符 * i:输入数字 例如 var y=ifast_inttostr(123); showmessage(y); 输出:"123"; */ // }; function ifast_strtoint(s, def) { /* 字符转数字 * s:输入字符 * def:转换失败的默认值 例如 var y=ifast_strtoint("dfw123",-1); var y2=ifast_strtoint("123",-1); showmessage(y);//输出-1 showmessage(y2);//输出123 */ // }; function set_color(spid, r, g, b, a) { //遮罩颜色 相互取透明 /* * spid:0 屏幕 >0 精灵 设置遮罩颜色 a:透明度 0。。255 a=0就 没遮罩了 r,g,b:红绿兰 例如:set_color(0,255,0,0,128); 整个屏幕将是被半透明红色遮挡 */ // }; function game_open_zsmsg(msg,a) { /* 阻塞用户点击,进度并提示信息 例如 game_open_zsmsg('加载中..'); 屏幕将变灰,并在居中提示 加载中... msg:显示消息 a:透明度 默认是 128 加减 a */ // }; function game_close_zsmsg() { /* 关闭阻塞用户点击 关闭 game_open_zsmsg('加载中..')类似语句的提示 */ // }; function open_load(bmprec, wavrec, urlrec) { //加载资源 /* * 异步加载资源 进度回调函数:gameabc_face.onloadurl bmprec:图片资源 格式 ";" 多资源 回调触发类型0 wavrec:声音资源 格式 ";" 多资源 回调触发类型1 urlrec:url资源 格式 ";" 多资源 回调触发类型2 //调用后 屏蔽灰掉不能点击 , 等待加载完成后恢复 */ // }; function ifast_strtotime(str) { /* 字符串转时间,时间可直接比较大小 */ // } function ifast_getonlyid()//获取唯一id { /* 获取唯一id */ // } function set_windows(mysf, v,dfw) { /* mysf: 0:全屏拉伸 1 本身扩大填充 2 黑边 3 宽对齐 100:设置背景 v:背景图片 101:设置高清 102:设置游戏背景透明 */ // }; function charge_windows(sjw, sjh, winw, winh) { /* myxz;//是否根据屏幕宽高旋转 1 自己判断 0系统 mybx;//是否变形缩放 0 变形 1 不变形 mysf;//不变形的缩放模式 0 全显示带黑边 1 本身扩大填充,不全显示 sjw:设计宽 sjh:设计高 winw:屏幕宽 winh:屏幕高 */ //gameabc_face.myxz=myxz;//是否根据屏幕宽高旋转 //gameabc_face.mybx=mybx;//是否变形缩放 //gameabc_face.mysf=mysf;//不变形的缩放模式 // }; function addinputdiv(id, type, x, y, w, h) { /* id:控件名字 type:0普通 1密码输入 x y w h */ // }; function set_selfdiv(div, p1, val, mode, data2) { /* div:名字 p1属性编号 val :值 mode:+1 -2 0= */ // }; function get_img(recid) { /*: recid:图片id;图片数据:data; */ // //gameabc_check_click() }; function ifast_loadsprite(spritelist) { /*//预先加载精灵列表 1. ifast_loadsprite([1,2,5,3]); 2 必须在 onloadurl里调用 if(recid==0 &&rectype==0) { ifast_loadsprite([1,2,5,3]); } 先加载 1 2 5 再加载3 */ // } function up_imgurl(recid, url,rewh) { /*: recid:图片id;网络地址:url; rewh=1:替换新图的宽高 */ // }; function up_imgdata(recid, data) { /*: recid:图片id;图片数据:data; */ // }; function get_selfdiv(div, p1) { /* div:名字 p1属性编号 */ // }; function set_selflist_off(id, offx1, offy1) { // }; function set_selflist_xywh(id, x1, y1, w1, h1) { /* id:精灵id x,y,w,h新位置和宽高 */ // }; function ifast_random(b) { /* b:随机函数 */ // }; function ifast_abs(b) { /* b:绝对值函数 */ // }; function ifast_tcp_open(tcpid, weburl) //ws\ { /* tcpid :网络编号 weburl: websocket地址 */ // }; function ifast_tcp_send(tcpid, msg) { /* tcpid :网络编号 msg: 发送的数据 */ // }; function ifast_tcp_close(tcpid) { /* tcpid :网络编号,断开tcp */ // }; function set_jm_xx(jms) { /* jms :组合层显示 “8,9,1” 这样只会显示 891层 1层最上 8层最下 方便 组合界面显示 */ // }; function ifast_ajax(myid, url,postcs, mode,fun) //单个ws 0是同步 { } function ifast_http(myid, url,postcs, mode,fun) //单个ws 0是同步 { /* myid:返回数据id url:网址 postcs:如果是post模式请填参数 get模式不填 例如: post模式: ifast_http(1,'http://kalado.com.cn/sharefriend','{"openid":"op41aaa"}'); get模式: ifast_http(1,'http://kalado.com.cn/sharefriend'); 数据返回在 gameabc_face.httpmessage=function(myid,url,data)中 用myid区分不同访问 的data 数据结果 mode:0同步 1 异步 fun:自定义回调函数 结构 function(myid,url,data) */ // }; function play_wav(id, isloop1) { /* 播放声音 路径 比如 "1.wav" play_wav('1.mp3',1);//循环播放1.mp3 play_wav('1.mp3',0);//播放1.mp3 但不循环 play_wav('1.mp3',-1);//停止播放1.mp3 */ // }; //gameabc_face.ifast_getcs function ifast_getcs(name, daf) { /* 获取网页传来的参数 * 例如:http://www.baidu.com?cpname=123 * 获取cpname的值 * daf:默认值 */ // }; /* function ifast_getcs(name,daf) { var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)"); var r = winodw.location.search.substr(1).match(reg); if(r!=null)return unescape(r[2]); return daf; }; */ /* 获取网页传来的参数 * 例如:http://www.baidu.com?cpname=123 * 获取cpname的值 * daf:默认值 */ function set_chargez(spid1, spid2) { /* 变化2个精灵的显示先后 */ // }; function readfile_key(key) { // }; function ifast_getdc_rect(dcid) { /* 获取画布 区域大小 */ // }; function ifast_getdc(dcid) { /* 获取画布 可以使用canvas系统函数绘画 */ // }; //function ifast_mydrawcolour(spid, colour, sp_x, sp_y, sp_w, sp_h) { //画颜色 // /* 描述:以精灵定位 绘画图像 // * spid 精灵id 0 表示 游戏区域(0,0) // * colour 要填充的颜色 // * sp_x, sp_y, sp_w, sp_h:精灵的绘画区域 // */ // // // // // //}; //function ifast_myaddsprite(spid, spidsourse, sp_x, sp_y) { // //} function ifast_mydrawsprite(spid, spidsourse, sp_x, sp_y) { /* 描述:以精灵定位 绘画图像 * spid 精灵id 0 表示 游戏区域(0,0) * spidsourse 源绘画精灵 * sp_x, sp_y, sp_w, sp_h:精灵的绘画区域 */ // }; function ifast_mydrawbmp(spid, recid, sp_x, sp_y, sp_w, sp_h, bmp_x, bmp_y, bmp_w, bmp_h) { /* 描述:以精灵定位 绘画图像 * spid 精灵id 0 表示 游戏区域(0,0) * recid 图片资源id * sp_x, sp_y, sp_w, sp_h:精灵的绘画区域 * bmp_x, bmp_y, bmp_w, bmp_h:图片的区域 */ //return localStorage.getItem(key); // }; function ifast_mydrawtext(spid, recid, sp_x, sp_y, sp_w, sp_h) { /* 描述:以精灵定位 绘画图像 * spid 精灵id 0 表示 游戏区域(0,0) * recid 图片文字资源id * sp_x, sp_y, sp_w, sp_h:精灵的绘画区域 */ // }; function ifast_lenth(key) { // } function ifast_stringat(key, pos) { /* 获取字符串某位置的 ansi码 编号 * 第一参数 字符串 * 第二参数 位置 */ // }; function ifast_setpause(is) { /* * is=0 不暂停 * is=1 暂停 */ // }; function ifasthttpobj(httppath,httpdata) {// /* * 文件名 index.html index.js index.txt 这样命名 var index_render=function(httppath,httpdata) { return httppath; } 命名规则 页面——_render */ // } function ifast_replaceall(str, oldkey, newkey) { /* 替换所有字符 例如: var str="ddd,ddd"; str=ifast_replaceall(str,"ddd","123"); str="123,123"; */ // } function ifast_replacestr(str, oldkey, newkey) { /* 替换一个字符 例如: var str="ddd,ddd"; str=ifast_replacestr(str,"ddd","123"); str="123,ddd"; */ // } function ifast_copystr(str, start, end) { /* 复制start和end间字符 例如: var str="dd(d,d)dd"; str=ifast_copystr(str,"(",")"); str="d,d"; */ }; function ifast_getpause() { /* */ // }; function drawround(ctx, mode, cx, cy, r, fx, bgColor, starta, enda, isout) { /* ctx 画笔 0:屏幕原点 >0 以精灵坐标为原点 *ctx 画布 cs,cy 园中心 r 半径 * mode=0 园框 =1 园实体 默认0 * //mode==0实体 >0 框 mode为 线宽 * fx =0 顺时针 =1逆时针 默认 0 * bgColor 颜色 默认 "red" * starta 开始角度 默认0(逆时针) * enda 结束角度 默认 360(逆时针) * isout 是否挖空 0:不挖空 1 挖空 默认不挖空 */ // }; function drawlines(ctx, startx, starty, endx, endy, lw, bgColor) { /* * 画线 * ctx 画笔 0:屏幕原点 >0 以精灵坐标为原点 ctx 画笔 startx 开始x坐标 startx 开始y 坐标 endx 直线的终点的X坐标 endy 直线的终点的Y坐标 lw 线的宽度 */ // }; function set_clip(ctx, mode, x, y, w, h, starta, enda, timefx) { //画矩形画框 /* ctx 画笔 0:屏幕原点 >0 以精灵坐标为原点 x 矩形边框X坐标 y 矩形边框Y坐标 w 矩形边框宽度 h 矩形边框高度 * mode=0 矩形全部裁剪 * mode=1 矩形内部圆形裁剪 * mode=2 矩形内部无角星裁剪 * starta,enda,timefx:mode=1 有效 * starta开始百分比,enda结束角度百分比默认是正上方也就是起点 * timefx:方向 0 顺 1 逆时针 测试:set_clip(0,1,0,0,300,300,80); set_clip(0,1,0,0,300,300,80,100); set_clip(0,1,0,0,300,300,80,100,1); */ // } function drawrect(ctx, mode, x, y, w, h, bgColor, isout) { //画矩形画框 /* ctx 画笔 0:屏幕原点 >0 以精灵坐标为原点 * mode=0 园框 =1 园实体 默认0 * //mode==0实体 >0 框 mode为 线宽 bgColor:颜色 默认“red” x 矩形边框X坐标 y 矩形边框Y坐标 w 矩形边框宽度 h 矩形边框高度 */ // } function play_box(zt, id, sx, start, startv, av, timelen) { /* 播放加速度函数 开关 id 参数 开始值 初速度 加速度 总时间 */ // } function play_ani(zt, id, sx, start, end, times0, timelen, timee, timesz, timese, timesall, timeall, xhmode) { /* 播放动画函数 // 开关, id 属性 初始 结束 ,单次开始等待时间,单次持续时间,单次结束等待,总开始等待时间,总结束等待时间,重复模式 */ // }; function play_ani123(zt, id, sx, start, end, timelen, timesall, timeall, xhmode) { /* 播放动画函数 // 开关, id 属性 初始 结束 ,单次持续时间,重复模式 */ // }; function writefile_key(msg, key) { // } function writefile_gameid(msg, gameid, fileid) { // } function readfile_gameid(gameid, fileid) { // } function chartoint(str) { // } function inttochar(code) { // } function ifast_isno(str) { // if (!str) { // return false; // } else { // return true; // }; // // } function ifast_set_str_add(str1, str2, delim) { // } function ifast_checkjsonstr(v) { // v=other_replaceall(v,">",">"); // v=other_replaceall(v,"<","<"); // v=other_replaceall(v," "," "); // v=other_replaceall(v,"\"", """); //v=other_replaceall(v,"\'","'"); //v=other_replaceall(v,"\\","\\\\");//对斜线的转义 v=other_replaceall(v,"\n","\\n"); v=other_replaceall(v,"\r","\\r"); //v=other_replaceall(v,"\n",""); //v=other_replaceall(v,"\r",""); return v; }; function ifast_tojson(str) { /* *json 格式字符串 转json对象 * 例如:var str = '{"name":"huangxiaojian","age":"23"}' * var obj=ifast_tojson(str); * showmessage(obj.age); * 显示 :23 */ // /* * JSON.stringify(obj); */ }; function ifast_jsontostring(json1) { /* *json 对象 转 字符串格式 * 例如:var obj={}; * obj.age="24"; * var str=ifast_jsontostring(obj); * showmessage(str); * 显示 :'{"age":"24"}' */ // /* * */ }; function ifast_get_str_index(str, index1, delim) { /* *得到字符串str,index1行的值 * str:输入字符串 * index1:第几行 * delim:字符串分割符 默认是"\r\n 回车换行" 例如 var str="x1,x2,x3"; var g=ifast_get_str_index(str,1,","); showmessage(g); g输出: x2 */ // }; function ifast_get_str_val(str, com, delim, index) { /* *得到字符串,关键字的值 * str:输入字符串 * com:关键字 * delim:字符串分割符 默认是"\r\n 回车换行" * 例如 var str="x1=12,x2=22,x3=33"; var g=ifast_get_str_val(str,"x2",","); showmessage(g); g输出: 22 */ // } function ifast_get_str_count(str, delim) { // } function showmessage(str,mode) { // } function ifast_renderjson2html(data, inits, re, mb) { /* * 把json转成html 有mydata属性是模版,下面替换数据 有myfunc属性是取外部文件模版 */ // } function logmessage(str, mode) { /* 日志输出 str 日志内容、、 mode 0 调试日志 1 屏幕日志 -1清空屏幕日志 2游戏标题 */ // }; function readfile_a2(myid, url,postcp, fun) { // }; function readfile_a(url,postcp,fun) { // }; function readfile_t(url,postcp) { //同步读文件 // }; function ifast_mod(i, b) //余数 { // }; function ifast_div(i, b) //整除 { // }; function ifast_getobj(spid) // { // }; function set_rec(stringid, stringv) { // } function get_rec(stringid) { // } function ifast_tel(tel) { // }; function set_level_up(levelid, vsb) { /* 设置某层最前显示 * set_level_up(1,1);//第一层提到最前显示 */ // }; function set_level(levelid, vsb,val) { /* 设置层可见性 * set_level(1,0);//第一层不可见 * set_level(1,1);//第一层可见 * set_level([5,2,1]);//设置5 2 1层可见 ,且 按顺序1 在最上层 如果3个参数 就是设置点击 set_level(1,41,0); 设置第一层 都不能点击 */ // }; function set_group(groupid, cpid, val, mode, val2) { // }; //function gameabc_getobj(id) { //检测点击 // // if (id < 1) { // return gameabc_face.obj; // } // return gameabc_Object["sp" + id]; //}; function get_self(id, cpid, val, mode, val2) { /* 特别:get_self(5,7,1);获取精灵5的文字的宽度 get_self(5,7,"想获取的文字");获取精灵5的以“想获取的文字”的宽度 */ // } function set_self(id, cpid, val, mode, val2) { // }; function ifast_getrectdec(allrect, syrect, Align, SizeStyle, size, dec) //得到绘制区域 { /* 得到区域递减带坐标xy */ // } function ifast_getrect(spid, Align, SizeStyle, size) //得到绘制区域 { /* 得到的是带父辈xy坐标的 */ // }; function ifast_checksprite(spido /*源精灵id*/ , spidd /*目标精灵id*/ ) //区域检测碰撞 { /* 返回 1:碰撞 0 没碰撞 */ // }; function ifast_checkpoint(x /*源区域x*/ , y /*源区域y*/ , d /*目标区域*/ ) //区域检测碰撞 { /* 返回 1:碰撞 0 没碰撞 */ // }; function ifast_checkrect(o /*源区域*/ , d /*目标区域*/ ) //区域检测碰撞 { /* 返回 1:碰撞 0 没碰撞 */ // }; function ifast_rectalign(rects /*源区域*/ , mode /*对齐模式*/ , pointx /*对齐点 也可以传入 x,y做参数*/ , y /*y坐标*/ ) //得到绘制区域 { /* 说明:以相对屏幕0.0的 rects计算出 相对point为原点的 新相对屏幕0.0的坐标 point:取传入区域 x y对齐 mode :point以 1 左上 2右上 3 右下 4 左下 顺时针 计算 rects x y对齐 */ // }; function ifast_spritealignxy(offx, offy, spids /*源精灵*/ , modeds /*源对齐模式*/ , cx /*对齐点x*/ , cy /*对齐点y*/ ) //得到绘制区域 { /* * offx,offy:相距距离 spids:源精灵 mode :以 1 左上 2右上 3 右下 4 左下 顺时针 计算 cx,cy:参照点坐标 */ // }; function ifast_spritealign(offx, offy, spids /*源精灵*/ , modeds /*源对齐模式*/ , spidd /*参照精灵*/ , moded /*参照对齐模式*/ ) //得到绘制区域 { /* offx,offy:相距距离 spids:源精灵 spidd:参照精灵 modes :源精灵以 1 左上 2右上 3 右下 4 左下 顺时针 计算 moded :目标精灵以 1 左上 2右上 3 右下 4 左下 顺时针 计算 */ // }; function ifast_point(r, mode) //得到区域的5个点 { /* 得到区域的4个点 mode : 1 左上 2右上 3 右下 4 左下 5中心点 顺时针 */ // } function ifast_rectscwh(r, sw, sh) //得到绘制缩放区域 { /* 得到绘制缩放区域 */ // } function ifast_rectoffxy(r, x, y) //得到绘制区域 { /* 得到的是直接区域 */ // } function ifast_rect(ox, oy, ow, oh) //得到绘制区域 { /* 得到的是直接区域 */ // } function ifast_setkey(id /*关键字集合编号*/ , key /*关键字*/ , val /*值*/ ) { /* ifast_setkey * ifast_getkey * ifast_delkey 三个函数组合使用 维护一个列表 */ // }; function ifast_getkey(id /*关键字集合编号*/ , key /*关键字*/ ) { /* ifast_setkey * ifast_getkey * ifast_delkey 三个函数组合使用 维护一个列表 */ // }; function ifast_delkey(id /*关键字集合编号*/ , key /*关键字*/ ) { /* ifast_setkey * ifast_getkey * ifast_delkey 三个函数组合使用 维护一个列表 */ // }; function ifast_addtospritefromspritecopy(fspid /*父精灵id*/ , copyspid /*被复制的精灵id*/ , /**Number*/ x, /**Number*/ y, tag /*标识*/ ) { /* * fspid添加子精灵 copyspid 副本 tag:为自定义标识 * 新精灵的标识为 fspid+'add'+tag * 可以使用 set_self(fspid+'add'+tag,.....);设置属性参数 * */ // } function ifast_dllpritefromspritecopy(fspid /*父精灵*/ , tag /*标识*/ ) { /* *删除 子精灵 */ // } function ifast_check_add(spid, x1, y1) { /*说明:检测spid,内部坐标 x1,y1 在哪个内部添加的精灵上 * 例如在 mouseup_1事件里 * var id=gameabc_check_add(1,upx,upy); logmessage(id,1); 获取内部点击的精灵 */ // } //function ifast_set_mouse(lmx,lmy) //{ // /*说明:设置点击灵敏度,手机手指会抖动 // */ // // // //} function ifast_ispc() { /*说明: 返回1是 电脑 * 0 是手机 * */ // }; function ifast_checkimg(image_id,upwh) { /* * 检测资源图是否加载完成 * 参数 upwh是否调整大小 * 0:为开始加载 * 1:加载完成 * 0<:加载失败 */ // }; function ifast_addimgfromimgcopy(fimgid, copyimgid, url) { /* 动态加载资源图 fimgid:静态资源图id 套用该图格式 应该小于10000 copyimgid:新生成的 动态资源图id ,必须唯一 且大于10000 函数返回:copyimgid; 配合 ifast_checkimg 可以检测加载是否成功 例如: ifast_addimgfromimgcopy(1,10000,'wwww.baidu.com/ddd.png'); set_self(9,1,10000); */ // }; function ifast_delimgfromimgcopy(recid) { /* 删除动态加载资源图,节省内存 例如:ifast_delimgfromimgcopy(10000); */ // } function ifast_loadhtml(htmltxt) { /* * 加载一个网页文件 htmltxt:网页字符串 var s; s=''+ ''+ ''+ ''+ ''+ ''+ 'aaaa'+ ''; ifast_loadhtml(s); */ // }; function ifast_split(str1,str2) { /* * 分割字符串成数组 例如: str1='123,,456,,789'; var gg=ifast_split(str1,',,'); showmessage(gg[1]); 显示456; */ // }; function draw_bg(recid) { /* * 静态背景 */ // }; function other_replaceall(sstr,key1,ostr) { /* 字符替换函数 1,如果2个参数 表示 key为json 按key替换 2,如果3个参数 表示 关键字 值替换 */ // } function other_upimgsrc(id,str) { /* * setAttribute是设置网页元素的属性,就是在标签里内如标签的src属性。innerHTML不是属性 只是JS里内代表一个双标记中间的文本如: 中间的字符。innerHTML属性所以只会原样输出。 */ // } function other_upinnerHTML(id,str,isadd) { /* * setAttribute是设置网页元素的属性,就是在标签里内如标签的src属性。innerHTML不是属性 只是JS里内代表一个双标记中间的文本如: 中间的字符。innerHTML属性所以只会原样输出。 */ // } function other_upkey(id,key,ostr) { /*说明:设置一个dom属性 * setAttribute是设置网页元素的属性,就是在标签里内如标签的src属性。innerHTML不是属性 只是JS里内代表一个双标记中间的文本如: 中间的字符。innerHTML属性所以只会原样输出。 */ // } //frame function other_setdom(id,key,val) { /* 说明:设置一个dom属性 * * id:dom id或者 实列 * key:属性 * val :值 */ // } function other_deldom(id) { /* 删除一个dom * * id:dom id或者 实列 * */ // } function other_creatdom(mode) { /* 创建一个dom * * mode:创建的dom类型 比如input 就是输入框 * */ // } function other_offdomxywh(sdom,ddom,offx,offy,offw,offh) { /* * 说明:相对sdom摆放一个dom * sdom:源dom * ddom:目标 dom * offx:偏移x * offy:偏移y * offw:宽偏移 * offh:高偏移 */ // } function other_appdom(pdom,dom) { /* 添加一个dom到pdom * * pdom:父dom * dom:目标dom */ // } function other_setdom_v(pdom,v) { /* 设置一个dom 是否可见 * pdom:操作的dom * v: 1可见 0 不可见 * * pdom:父dom * dom:目标dom * 例如 other_setdom_v('myweb',1); */ // } // ////卡拉多 function ifast_urlstr(sstr) { // }; function ifast_unurlstr(sstr) { // } /////////转码 function ifast_checkjsonstr(v) { // };