目录结构调整
This commit is contained in:
@@ -0,0 +1,656 @@
|
||||
(function(wnd, undef){
|
||||
|
||||
//复制json对象
|
||||
function min_copyjson(json)
|
||||
{
|
||||
return JSON.parse(JSON.stringify(json));
|
||||
}
|
||||
|
||||
//json对象转字符串
|
||||
function min_jsontostr(json) {
|
||||
return JSON.stringify(json);
|
||||
}
|
||||
|
||||
//字符串转json对象
|
||||
function min_strtojson(str) {
|
||||
return JSON.parse(str);
|
||||
}
|
||||
|
||||
//字符串转整型 def:转换失败时返回的默认值
|
||||
function min_strtoint(str, def) {
|
||||
var i = parseInt(str);
|
||||
if (i == 0) {
|
||||
return 0;
|
||||
};
|
||||
if (!i) { //=0也会进来
|
||||
if (!def) {
|
||||
def = 0;
|
||||
};
|
||||
i = def;
|
||||
}
|
||||
return i;
|
||||
};
|
||||
|
||||
//整型转字符串
|
||||
function min_inttostr(i) {
|
||||
return i.toString();
|
||||
};
|
||||
|
||||
//整除
|
||||
function min_div(i, b)
|
||||
{
|
||||
if (!b) {
|
||||
return parseInt(i);
|
||||
}
|
||||
return parseInt(i / b);
|
||||
};
|
||||
|
||||
//取余数
|
||||
function min_mod(a, b){
|
||||
return a % b;
|
||||
};
|
||||
|
||||
//取绝对值
|
||||
function min_abs(b) {
|
||||
return Math.abs(b);
|
||||
};
|
||||
|
||||
//取随机数
|
||||
function min_random(min, max) {
|
||||
var Range = max - min;
|
||||
var Rand = Math.random();
|
||||
return (min + Math.round(Rand * Range));
|
||||
};
|
||||
//取随机数1
|
||||
function min_random1(num) {
|
||||
return parseInt(Math.random()*num);
|
||||
};
|
||||
|
||||
//随机字符串
|
||||
function min_randomChar(length){
|
||||
var x = "0123456789";
|
||||
var y = "qwertyuioplkjhgfdsazxcvbnm";
|
||||
var z = "QWERTYUIOPLKJHGFDSAZXCVBNM";
|
||||
var tmp = "";
|
||||
for (var i = 0; i < length; i++) {
|
||||
switch(min_random(0, 2)) {
|
||||
case 0:
|
||||
tmp += x.charAt(Math.ceil(Math.random()*100000000)%x.length);
|
||||
break;
|
||||
case 1:
|
||||
tmp += y.charAt(Math.ceil(Math.random()*100000000)%y.length);
|
||||
break;
|
||||
case 2:
|
||||
tmp += z.charAt(Math.ceil(Math.random()*100000000)%z.length);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
// var timestamp = new Date().getTime();
|
||||
// return timestamp + tmp;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
//取长度
|
||||
function min_length(key) {
|
||||
if (typeof(key) != "string") {
|
||||
var key = key + "";
|
||||
}
|
||||
return key.length;
|
||||
}
|
||||
|
||||
//字符全替换
|
||||
function min_replaceAll(str, str_old, str_new, ignoreCase)
|
||||
{
|
||||
if (!RegExp.prototype.isPrototypeOf(str_old)) {
|
||||
return str.replace(new RegExp(str_old, (ignoreCase ? "gi": "g")), str_new);
|
||||
} else {
|
||||
return str.replace(str_old, str_new);
|
||||
}
|
||||
}
|
||||
|
||||
//取本地当前时间,格式yyyy-MM-dd HH:MM:SS
|
||||
function min_now()
|
||||
{
|
||||
var date = new Date();
|
||||
var seperator1 = "-";
|
||||
var seperator2 = ":";
|
||||
var month = date.getMonth() + 1;
|
||||
var strDate = date.getDate();
|
||||
if (month >= 1 && month <= 9) {
|
||||
month = "0" + month;
|
||||
}
|
||||
if (strDate >= 0 && strDate <= 9) {
|
||||
strDate = "0" + strDate;
|
||||
}
|
||||
var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
|
||||
+ " " + date.getHours() + seperator2 + date.getMinutes()
|
||||
+ seperator2 + date.getSeconds();
|
||||
return currentdate;
|
||||
}
|
||||
|
||||
//本地存储数据
|
||||
function min_writefile_gameid(msg, gameid, fileid) {
|
||||
localStorage.setItem("file_" + gameid + "_" + fileid, msg);
|
||||
}
|
||||
|
||||
//读取本地数据
|
||||
function min_readfile_gameid(gameid, fileid) {
|
||||
return localStorage.getItem("file_" + gameid + "_" + fileid);
|
||||
}
|
||||
|
||||
//取当前页面url中的参数值 def:没取到时返回的默认值
|
||||
function min_getQueryString(name, def) {
|
||||
var self = window;
|
||||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
||||
var r = self.location.search.substr(1).match(reg);
|
||||
if (r != null) {
|
||||
return unescape(r[2])
|
||||
} else {
|
||||
if (def) {
|
||||
return def;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//获取当前页面的路径
|
||||
function min_getUrlRootPath() {
|
||||
var curWwwPath = window.location.host;
|
||||
var pathName = window.location.pathname;
|
||||
return curWwwPath + pathName.substr(0,pathName.lastIndexOf('/'));
|
||||
}
|
||||
|
||||
//设置cookie
|
||||
function min_setCookie(name, value, exp_minute) {
|
||||
if (!exp_minute) {
|
||||
exp_minute = 20; //默认时效20分钟
|
||||
}
|
||||
var exp = new Date();
|
||||
exp.setTime(exp.getTime() + exp_minute*60*1000);
|
||||
document.cookie = name + "=" + value + ";expires=" + exp.toGMTString()+';path=/';
|
||||
}
|
||||
|
||||
//读取cookie
|
||||
function min_getCookie(name) {
|
||||
var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
|
||||
if(arr != null)
|
||||
return arr[2];
|
||||
return null;
|
||||
}
|
||||
|
||||
//删除cookie
|
||||
function min_delCookie(name) {
|
||||
var value = min_getCookie(name);
|
||||
if (value) {
|
||||
min_setCookie(name, value, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//获取一个dom
|
||||
function min_getdom(id)
|
||||
{
|
||||
return document.getElementById(id);
|
||||
};
|
||||
|
||||
//设置一个dom属性值 id:dom、或dom的id、或实列,key:属性,val:值
|
||||
function min_setdom(id, key, val) {
|
||||
var obj;
|
||||
if (typeof(id) == 'string') {
|
||||
obj = min_getdom(id);
|
||||
}
|
||||
else {
|
||||
obj = id;
|
||||
}
|
||||
obj.setAttribute(key, val);
|
||||
}
|
||||
|
||||
//添加一段innerHTML
|
||||
function min_uphtml(id, str, isadd) {
|
||||
/*
|
||||
setAttribute是设置网页元素的属性,就是在标签里内如<img />标签的src属性。
|
||||
innerHTML不是属性,只是JS里内代表一个双标记中间的文本,如:<span> </span>中间的字符。
|
||||
*/
|
||||
var obj = window.document.getElementById(id);
|
||||
if (isadd) {
|
||||
obj.innerHTML = obj.innerHTML + str;
|
||||
}
|
||||
else {
|
||||
obj.innerHTML = str;
|
||||
}
|
||||
}
|
||||
|
||||
//新建一个定时器每隔time毫秒执行一次func函数,函数返回定时器id
|
||||
function min_ontime(func, time)
|
||||
{
|
||||
return setInterval(func, time);
|
||||
}
|
||||
|
||||
//新建一个定时器time毫秒后执行一次func函数(只执行一次),函数返回定时器id
|
||||
function min_ontimeout(func, time)
|
||||
{
|
||||
return setTimeout(func, time);
|
||||
}
|
||||
|
||||
//关闭定时器id为timerid的定时器
|
||||
function min_closetime(timerid)
|
||||
{
|
||||
return clearTimeout(timerid);
|
||||
}
|
||||
|
||||
//encode转码
|
||||
function min_encode(s)
|
||||
{
|
||||
return encodeURIComponent(s);
|
||||
}
|
||||
|
||||
//decode解码
|
||||
function min_decode(s)
|
||||
{
|
||||
return decodeURIComponent(s);
|
||||
}
|
||||
|
||||
//新建一个tcp连接
|
||||
function min_tcp(config)
|
||||
{
|
||||
var ws = new WebSocket("ws://" + config.ipport); //"127.0.0.1:5414"
|
||||
|
||||
//连接上服务器后触发的事件
|
||||
if (config.onopen) {
|
||||
ws.onopen = config.onopen;
|
||||
};
|
||||
|
||||
//收到服务器发来的数据包后触发的事件,onmessage函数会有一个底层的msg参数,其中msg.data才是服务器发过来的业务数据
|
||||
if (config.onmessage) {
|
||||
ws.onmessage = config.onmessage;
|
||||
};
|
||||
|
||||
//断开与服务器的连接后触发的事件
|
||||
if (config.onclose) {
|
||||
ws.onclose = config.onclose; //断开连接的事件
|
||||
};
|
||||
|
||||
return ws;
|
||||
}
|
||||
|
||||
//http请求
|
||||
function min_http(config) {
|
||||
/*
|
||||
config =
|
||||
{
|
||||
url: "http://127.0.0.1:5414/index.html",
|
||||
type: "POST", //GET or POST 方法
|
||||
data: "", //请求的数据
|
||||
success: func_callback_succ, //请求成功后的回调函数function(data,status,callbackdata)
|
||||
error: func_callback_err, //请求失败后的回调函数function(data,status)
|
||||
callbackdata: "", //作为回调函数第三个参数带入回调函数的数据
|
||||
//enurl: 0, //是否encodeURIComponent转码, 默认0不转码
|
||||
//deurl: 0, //是否decodeURIComponent解码,默认0不解码
|
||||
debugLog: false, //是否输出debug日志,默认false
|
||||
method: "(OPTIONAL) True for async and False for Non-async | By default its Async"
|
||||
}
|
||||
*/
|
||||
if (!config.debugLog) {
|
||||
config.debugLog = false;
|
||||
}
|
||||
if (!config.enurl) {
|
||||
config.enurl = 0;
|
||||
}
|
||||
if (!config.deurl) {
|
||||
config.deurl = 0;
|
||||
}
|
||||
if (!config.method) {
|
||||
config.method = true;
|
||||
}
|
||||
|
||||
if (!config.url) {
|
||||
if (config.debugLog == true) {
|
||||
console.log("No Url!");
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
||||
if (!config.type) {
|
||||
if (config.debugLog == true) {
|
||||
console.log("No Default type (GET/POST) given!");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var xmlhttp = initXMLhttp();
|
||||
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200 && config.success)
|
||||
{
|
||||
var responseText = mydecodeURIComponent(xmlhttp.responseText, config.deurl);
|
||||
if (!config.callbackdata) {
|
||||
config.success(responseText, xmlhttp.readyState);
|
||||
}
|
||||
else {
|
||||
config.success(responseText, xmlhttp.readyState, config.callbackdata);
|
||||
}
|
||||
if (config.debugLog == true) {
|
||||
console.log("SuccessResponse");
|
||||
}
|
||||
if (config.debugLog == true) {
|
||||
console.log("Response Data:" + xmlhttp.responseText);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (xmlhttp.readyState == 4 && config.error)
|
||||
{
|
||||
if (!config.callbackdata) {
|
||||
config.error(xmlhttp.readyState, xmlhttp.status);
|
||||
}
|
||||
else {
|
||||
config.error(xmlhttp.readyState, xmlhttp.status, config.callbackdata);
|
||||
}
|
||||
}
|
||||
if (config.debugLog == true) {
|
||||
console.log("FailureResponse --> readyState:" + xmlhttp.readyState + ", Status:" + xmlhttp.status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var sendString = [],
|
||||
sendData = config.data;
|
||||
if (typeof sendData === "string") {
|
||||
var tmpArr = String.prototype.split.call(sendData, '&');
|
||||
for (var i = 0, j = tmpArr.length; i < j; i++) {
|
||||
var datum = tmpArr[i].split('=');
|
||||
if (datum[1]) {
|
||||
sendString.push(myencodeURIComponent(datum[0], config.enurl) + "=" + myencodeURIComponent(datum[1], config.enurl));
|
||||
}
|
||||
else {
|
||||
sendString.push(myencodeURIComponent(datum[0], config.enurl));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (typeof sendData === 'object' && !(sendData instanceof String || (FormData && sendData instanceof FormData))) {
|
||||
for (var k in sendData) {
|
||||
var datum = sendData[k];
|
||||
if (Object.prototype.toString.call(datum) == "[object Array]") {
|
||||
for (var i = 0, j = datum.length; i < j; i++) {
|
||||
sendString.push(myencodeURIComponent(k, config.enurl) + "[]=" + myencodeURIComponent(datum[i], config.enurl));
|
||||
}
|
||||
}
|
||||
else {
|
||||
sendString.push(myencodeURIComponent(k, config.enurl) + "=" + myencodeURIComponent(datum, config.enurl));
|
||||
}
|
||||
}
|
||||
}
|
||||
sendString = sendString.join('&');
|
||||
|
||||
if (config.type == "GET") {
|
||||
var g;
|
||||
var i = config.url.lastIndexOf("?");
|
||||
if (i > 8) {
|
||||
g = "&";
|
||||
} else {
|
||||
g = "?";
|
||||
}
|
||||
var ddata = new Date().getMilliseconds();
|
||||
if (sendString == "") {
|
||||
sendString = '#dfw1977=' + (ddata + min_random(1, 99999) * 1000);
|
||||
} else {
|
||||
sendString = sendString + '#dfw1977=' + (ddata + min_random(1, 99999) * 1000);
|
||||
}
|
||||
xmlhttp.open("GET", config.url + g + sendString, config.method);
|
||||
xmlhttp.send();
|
||||
|
||||
if (config.debugLog == true) {
|
||||
console.log("GET fired at:" + config.url + "?" + sendString);
|
||||
}
|
||||
}
|
||||
if (config.type == "POST") {
|
||||
xmlhttp.open("POST", config.url, config.method);
|
||||
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||
xmlhttp.send(sendString);
|
||||
|
||||
if (config.debugLog == true) {
|
||||
console.log("POST fired at:" + config.url + " || Data:" + sendString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function initXMLhttp() {
|
||||
var xmlhttp;
|
||||
if (window.XMLHttpRequest) {
|
||||
//code for IE7,firefox chrome and above
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
} else {
|
||||
//code for Internet Explorer
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
return xmlhttp;
|
||||
}
|
||||
|
||||
//转码
|
||||
function myencodeURIComponent(s, ifif)
|
||||
{
|
||||
if (ifif == 1) {
|
||||
return min_encode(s);
|
||||
} else {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
//解码
|
||||
function mydecodeURIComponent(s, ifif)
|
||||
{
|
||||
if (ifif == 1) {
|
||||
return min_decode(s);
|
||||
} else {
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//在数组中根据元素值查找下标
|
||||
function min_ary_indexof(array1, val, name)
|
||||
{
|
||||
for (var i = 0; i < array1.length; i++)
|
||||
{
|
||||
if (!name)
|
||||
{
|
||||
if (array1[i] == val)
|
||||
return i;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (array1[i][name] == val)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
//在数组中根据值删除元素
|
||||
function min_ary_delval(array1, val, name)
|
||||
{
|
||||
var index = min_ary_indexof(array1, val, name);
|
||||
if (index > -1)
|
||||
{
|
||||
array1.splice(index, 1);
|
||||
}
|
||||
};
|
||||
|
||||
//在数组中根据下标删除诺干个元素
|
||||
function min_ary_delfromto(array1, from, to)
|
||||
{
|
||||
var rest = array1.slice((to || from) + 1 || array1.length);
|
||||
array1.length = from < 0 ? array1.length + from : from;
|
||||
array1.push.apply(array1, rest);
|
||||
};
|
||||
|
||||
//在数组中删除某一对象元素
|
||||
function min_ary_delobj(array1, object)
|
||||
{
|
||||
for (var i = 0; i < array1.length; ++i)
|
||||
{
|
||||
if (array1[i] === object)
|
||||
{
|
||||
array1.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//数组包含
|
||||
function min_ary_include(aryparent, arychild){
|
||||
for (var i = 0; i < arychild.length; i++) {
|
||||
var found = false;
|
||||
for (var j = 0; j < aryparent.length; j++) {
|
||||
if (aryparent[j] == arychild[i]){
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
//数组相减
|
||||
function min_ary_deduct(aryparent, arychild){
|
||||
var re = [];
|
||||
for (var i = 0; i < aryparent.length; i++){
|
||||
var found = false;
|
||||
for (var j = 0; j < arychild.length; j++){
|
||||
if (aryparent[i] == arychild[j]){
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found){
|
||||
re.push(aryparent[i])
|
||||
}
|
||||
}
|
||||
return re;
|
||||
};
|
||||
|
||||
//是否存在指定函数
|
||||
function min_ExitsFunction(funcName)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (typeof(funcName) == "function")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch(e)
|
||||
{}
|
||||
return false;
|
||||
}
|
||||
|
||||
//(按顺序)加载js文件
|
||||
function min_loadJsFile(str_jsfile, func_succ, NoRandomFlag)
|
||||
{
|
||||
var domScript = document.createElement('script');
|
||||
if (!NoRandomFlag)
|
||||
{
|
||||
// str_jsfile = str_jsfile + '?' + Math.random() * 10000;
|
||||
// str_jsfile = str_jsfile + '?' + min_random(1, 10000000);
|
||||
str_jsfile = str_jsfile + '?' + min_timestamp();
|
||||
}
|
||||
domScript.src = str_jsfile;
|
||||
func_succ = func_succ || function(){};
|
||||
domScript.onload = domScript.onreadystatechange = function() {
|
||||
if (!this.readyState || 'loaded' === this.readyState || 'complete' === this.readyState) {
|
||||
func_succ();
|
||||
this.onload = this.onreadystatechange = null;
|
||||
this.parentNode.removeChild(this);
|
||||
}
|
||||
}
|
||||
document.getElementsByTagName('head')[0].appendChild(domScript);
|
||||
}
|
||||
|
||||
//生成一个GUID
|
||||
function min_guid()
|
||||
{
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
||||
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
|
||||
return v.toString(16);});
|
||||
}
|
||||
|
||||
//获取时间戳
|
||||
function min_timestamp()
|
||||
{
|
||||
return new Date().getTime();
|
||||
}
|
||||
|
||||
|
||||
wnd.min_copyjson = min_copyjson; //复制json对象
|
||||
wnd.min_jsontostr = min_jsontostr; //json转字符串
|
||||
wnd.min_strtojson = min_strtojson; //字符串转json
|
||||
wnd.min_inttostr = min_inttostr; //整型转字符型
|
||||
wnd.min_strtoint = min_strtoint; //字符型转整型
|
||||
|
||||
wnd.min_div = min_div; //整除
|
||||
wnd.min_mod = min_mod; //取余数
|
||||
wnd.min_abs = min_abs; //取绝对值
|
||||
wnd.min_random = min_random; //取随机数
|
||||
wnd.min_random1 = min_random1; //取随机数1
|
||||
wnd.min_randomChar = min_randomChar; //随机字符串
|
||||
wnd.min_length = min_length; //取长度
|
||||
wnd.min_replaceAll = min_replaceAll; //字符全替换
|
||||
|
||||
wnd.min_now = min_now; //取本地当前时间
|
||||
wnd.min_guid = min_guid; //生成一个GUID
|
||||
|
||||
wnd.min_getQueryString = min_getQueryString; //取当前页面url中的参数值
|
||||
wnd.min_getUrlRootPath = min_getUrlRootPath; //获取当前页面的路径
|
||||
|
||||
wnd.min_setCookie = min_setCookie; //设置cookie
|
||||
wnd.min_getCookie = min_getCookie; //读取cookie
|
||||
wnd.min_delCookie = min_delCookie; //删除cookie
|
||||
|
||||
wnd.min_getdom = min_getdom; //获取一个dom
|
||||
wnd.min_setdom = min_setdom; //设置一个dom属性值
|
||||
wnd.min_uphtml = min_uphtml; //添加一段innerHTML
|
||||
|
||||
wnd.min_ontime = min_ontime; //新建一个周期性的定时器
|
||||
wnd.min_ontimeout = min_ontimeout; //新建一个一次性的定时器
|
||||
wnd.min_closetime = min_closetime; //关闭定时器
|
||||
|
||||
wnd.min_writefile_gameid = min_writefile_gameid; //本地存储数据
|
||||
wnd.min_readfile_gameid = min_readfile_gameid; //读取本地数据
|
||||
|
||||
wnd.min_encode = min_encode; //encodeURIComponent转码
|
||||
wnd.min_decode = min_decode; //decodeURIComponent解码
|
||||
|
||||
wnd.min_tcp = min_tcp; //新建一个tcp连接
|
||||
wnd.min_http = min_http; //http请求
|
||||
|
||||
wnd.min_ary_indexof = min_ary_indexof; //在数组中根据元素值查找下标
|
||||
wnd.min_ary_delval = min_ary_delval; //在数组中根据值删除元素
|
||||
wnd.min_ary_delfromto = min_ary_delfromto; //在数组中根据下标删除诺干个元素
|
||||
wnd.min_ary_delobj = min_ary_delobj; //在数组中删除某一对象元素
|
||||
wnd.min_ary_include = min_ary_include; //数组包含
|
||||
wnd.min_ary_deduct = min_ary_deduct; //数组相减
|
||||
|
||||
wnd.min_ExitsFunction = min_ExitsFunction; //是否存在函数
|
||||
wnd.min_loadJsFile = min_loadJsFile; //加载js文件
|
||||
|
||||
wnd.min_guid = min_guid; //生成一个GUID
|
||||
wnd.min_timestamp = min_timestamp; //获取时间戳
|
||||
})(window);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
822
codes/games/client/Projects/guanpai-jx/js/00_Surface/02_Const.js
Normal file
822
codes/games/client/Projects/guanpai-jx/js/00_Surface/02_Const.js
Normal file
@@ -0,0 +1,822 @@
|
||||
var AppList = AppList||{};
|
||||
var RouteList = RouteList||{};
|
||||
var RpcList = RpcList||{};
|
||||
//--------------AppList---------------
|
||||
AppList.app = "youle";
|
||||
|
||||
//-----------RouteList-------------
|
||||
RouteList.platform = "platform";
|
||||
RouteList.agent="agent";
|
||||
RouteList.room="room";
|
||||
|
||||
|
||||
//----------------RpcList--------------
|
||||
RpcList.player_login = "player_login";
|
||||
RpcList.self_join_room = "self_join_room";
|
||||
RpcList.create_room = "create_room";
|
||||
RpcList.self_break_room = "self_break_room";
|
||||
RpcList.other_break_room = "other_break_room";
|
||||
RpcList.other_join_room = "other_join_room";
|
||||
RpcList.self_exit_room = "self_exit_room";
|
||||
RpcList.other_exit_room = "other_exit_room";
|
||||
RpcList.self_apply_free_room = "self_apply_free_room";
|
||||
RpcList.other_apply_free_room = "other_apply_free_room";
|
||||
RpcList.self_agree_free_room = "self_agree_free_room";
|
||||
RpcList.other_agree_free_room = "other_agree_free_room";
|
||||
RpcList.self_refuse_free_room = "self_refuse_free_room";
|
||||
RpcList.other_refuse_free_room = "other_refuse_free_room";
|
||||
RpcList.free_room = "free_room";
|
||||
RpcList.over_game = "over_game";
|
||||
RpcList.get_player_grade1 = "get_player_grade1";
|
||||
RpcList.get_player_grade2 = "get_player_grade2";
|
||||
RpcList.update_roomcard = "update_roomcard";
|
||||
RpcList.other_offline = "other_offline";
|
||||
RpcList.other_online = "other_online";
|
||||
RpcList.send_voice = "send_voice";
|
||||
RpcList.play_voice = "play_voice";
|
||||
RpcList.send_text = "send_text";
|
||||
RpcList.receive_chat = "receive_chat";
|
||||
RpcList.get_player_task = "get_player_task";
|
||||
RpcList.player_finish_task = "player_finish_task";
|
||||
RpcList.get_task_award = "get_task_award";
|
||||
RpcList.can_award = "can_award";
|
||||
RpcList.kick_offline = "kick_offline";
|
||||
RpcList.call_phone = "call_phone";
|
||||
RpcList.other_callphone = "other_callphone";
|
||||
RpcList.hangup_phone = "hangup_phone";
|
||||
RpcList.other_hangup = "other_hangup";
|
||||
RpcList.self_makewar = "self_makewar";
|
||||
RpcList.other_makewar = "other_makewar";
|
||||
RpcList.agentserver_game="agentserver_game";
|
||||
RpcList.send_gift="send_gift";
|
||||
RpcList.other_send_gift="other_send_gift";
|
||||
RpcList.send_voice="send_voice";
|
||||
RpcList.play_voice="play_voice";
|
||||
RpcList.connect_roomserver="connect_roomserver";
|
||||
RpcList.connect_agentserver="connect_agentserver";
|
||||
RpcList.broadcast="broadcast";
|
||||
RpcList.send_phiz="send_phiz";
|
||||
RpcList.submit_opinion = "submit_opinion";
|
||||
RpcList.kick_server = "kick_server";
|
||||
RpcList.get_paylist = "get_paylist";
|
||||
RpcList.pay_succ = "pay_succ";
|
||||
RpcList.submit_location = "submit_location";
|
||||
RpcList.binding_invitecode = "binding_invitecode";
|
||||
RpcList.update_bean = "update_bean";
|
||||
RpcList.get_player_invitecode = "get_player_invitecode";
|
||||
RpcList.beanroom_surrender = "beanroom_surrender";
|
||||
RpcList.player_prepare = "player_prepare";
|
||||
RpcList.share_room = "share_room";
|
||||
RpcList.get_share_room = "get_share_room";
|
||||
RpcList.quick_enter_share_room = "quick_enter_share_room";
|
||||
RpcList.advanced_roomlist = "advanced_roomlist";
|
||||
RpcList.advanced_createroom = "advanced_createroom";
|
||||
RpcList.change_room = "change_room";
|
||||
RpcList.change_seat = "change_seat";
|
||||
RpcList.set_bankpwd = "set_bankpwd";
|
||||
|
||||
RpcList.binding_phone = "binding_phone";
|
||||
|
||||
RpcList.send_phone_checkcode = "send_phone_checkcode";
|
||||
RpcList.send_phone_code_wechat = "send_phone_code_wechat";
|
||||
|
||||
RpcList.get_treasurelist = "get_treasurelist";
|
||||
RpcList.change_star = "change_star";
|
||||
|
||||
RpcList.submit_phoneinfo = "submit_phoneinfo";
|
||||
|
||||
RpcList.update_charm = "update_charm";
|
||||
|
||||
RpcList.setSign = "setSign";
|
||||
|
||||
RpcList.switchRoomList = "switchRoomList";
|
||||
|
||||
RpcList.getInfoByShortCode = "getInfoByShortCode";
|
||||
|
||||
RpcList.optBanList = "optBanList";
|
||||
RpcList.getShortCodeRankList = "getShortCodeRankList";
|
||||
|
||||
RpcList.setAllCharm = "setAllCharm";
|
||||
RpcList.getVipRankList = "getVipRankList";
|
||||
RpcList.playerBehavior = "playerBehavior";
|
||||
RpcList.setVipForbidSelect = "setVipForbidSelect";
|
||||
|
||||
RpcList.topup_card = "topup_card";
|
||||
RpcList.query_player2 = "query_player2";
|
||||
RpcList.giveCoin = "giveCoin";
|
||||
|
||||
RpcList.getPlayerWhiteList = "getPlayerWhiteList";
|
||||
RpcList.optWhiteList = "optWhiteList";
|
||||
|
||||
var h5RpcList={}
|
||||
h5RpcList.joinRoom = "joinRoom";
|
||||
//----------------------------end------------------------------
|
||||
|
||||
var ClickBtn = [3,5,7,13,14,15,10,11,12,25,17,9,47,51,53,55,58,59,76,60,61,74,75,80,115,183,150,151,153,181,201,202,183,184,185,205,206,207,208,209,210,211,212,166,167,168,169,170,124,127,130,
|
||||
133,233,245,246,247,253,248,249,253,256,257,258,259,260,261,262,263,550,177,283,375,391,392,393,394,395,396,397,
|
||||
398,399,400,401,402,403,366,367,386,464,234,345,483,484,493,509,512,513,514,515,519,520,521,568,569,570,571,572,579,
|
||||
602,626,604,656,661,662,663,664,665,666,667,668,669,670,671,3000,3004,3007,3008,3009,3010,3011,3014,3016,3017,3018,3019,
|
||||
3034,3035,3044,3045,3046,3047,3048,3049,3050,3051,3052,3053,3054,3055,3057,3043,3038,3039,3067,3068,3087,3088,3089,3096,3075,3076,3097,3111,3120,92,93,97,
|
||||
99,104,105,106,107,3133,3139,3140,3144,3145,3149,3155,3159,679,3182,3184,3175,3194,3195,3199,3214,3215,3205,3206,3210,
|
||||
3203,3216,3217,3222,3231,3232,3233,3235,3240,3251,3253,3243,3244,3245,3255,3256,3258,3260,3264,3265,3266,3268,3269,3289,3281,3276,3274];
|
||||
var C_PageOne = {
|
||||
Tag:1,
|
||||
X:1100,
|
||||
Y:160,
|
||||
H:80
|
||||
};
|
||||
var C_PageTwo = {
|
||||
Tag:1,
|
||||
X:1100,
|
||||
Y:160,
|
||||
H:80
|
||||
};
|
||||
var UnClickBtn = [8,50,225,227,228,229,699,161,162,164,165,370,426,427,428,429,430,431,432,433,434,435,446,447,448,449,450,451,452,453,454,455,468,469,470,471,472,473,474,475,476,477,498,499,500,501,
|
||||
502,503,504,505,506,507,81,573,574,575,629,630,631,632,633,3056,3040,3058,3041,3061,3062,3071,3072,3069,3070,3090,3091,3092,3093,3094,3095,3098,3104,3108,3115,3116,3118,3119,
|
||||
102,336,337,338,155,154,156,110,111,3127,3128,3141,3142,3146,3147,3151,3157,3099,3197,3212,3237,3246,3247,3248,3249,3250,3291,3280,3288,3283,3279,3292
|
||||
];
|
||||
var exceptSrc = [115,5,253,338,339,340,21,361,362,363,364,365,366,367,368,369,370,371,372,396];
|
||||
var ConstVal=ConstVal||{};
|
||||
ConstVal.Max = {
|
||||
ShowChat:2000,
|
||||
textlength:20,
|
||||
headImgTimer:200,
|
||||
heartbeat:30000
|
||||
};
|
||||
|
||||
ConstVal.Tips={
|
||||
width:30,
|
||||
time:3000,
|
||||
|
||||
};
|
||||
ConstVal.Kick={
|
||||
text:"网络出现异常!",
|
||||
tip:"(请重启游戏)"
|
||||
};
|
||||
ConstVal.screenShotParam = 0.7;
|
||||
ConstVal.ShareTaskId="TJnueK1103Xgwj2o79xM2nvSe0WN6rzp";
|
||||
|
||||
ConstVal.iMessage={
|
||||
text_y1:-60,
|
||||
text_y2:25,
|
||||
icon_x:20,
|
||||
icon_y1:-65,
|
||||
icon_y2:20,
|
||||
close_x:1205,
|
||||
close_y1:-60,
|
||||
close_y2:25,
|
||||
bg_y1:-85,
|
||||
bg_y2:0,
|
||||
time:500,
|
||||
x1:85,
|
||||
x2:1205,
|
||||
y:0,
|
||||
h:85,
|
||||
speed:0.05,
|
||||
max_length:60
|
||||
};
|
||||
ConstVal.Emotion = {
|
||||
//动画帧间隔200
|
||||
mode:1,//表情播放时间模式1->按帧数确定时间2->按照show_time_list确定
|
||||
count:20,
|
||||
f_spid:467,
|
||||
tag:1,
|
||||
rate:100,
|
||||
col_num:4,//一行上的个数
|
||||
spid_list:[528,529,530,531,532,533,534,535,536,537,538,539,540,541,542,543,544,545,546,547],//表情精灵列表序号对应
|
||||
src_list:[147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166],//表情对应资源号
|
||||
frame_list:[5,25,31,30,14,7,8,17,3,8,30,14,35,24,23,15,6,24,31,9],//表情对应帧数
|
||||
show_time_list:[147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166],//表情播放时间
|
||||
x:20,
|
||||
y:20,
|
||||
dis_x:20,
|
||||
dis_y:20,
|
||||
w:100,
|
||||
h:100,
|
||||
clip_x:0,
|
||||
clip_y:0,
|
||||
clip_h:0,
|
||||
clip_w:0
|
||||
|
||||
}
|
||||
ConstVal.Com_History = {
|
||||
//动画帧间隔200
|
||||
f_spid:696,
|
||||
head_tag:1,
|
||||
page_count:5,
|
||||
text_width:12.5,
|
||||
bubble_tag:10000,
|
||||
content_tag:20000,
|
||||
time_tag:30000,
|
||||
time_length:[10,30,60,90,120,300],
|
||||
bubble_width:[100,140,180,220,260,300,340],//气泡长度
|
||||
head_res_id:116,
|
||||
head_x:20,
|
||||
head_y:30,
|
||||
head_h:60,
|
||||
head_dis_y:35,
|
||||
time_bubble_dis_x:10,
|
||||
head_bubble_dis_x:78,
|
||||
bubble_content_dis_x:25,
|
||||
head_bubble_dis_y:0,
|
||||
head_content_1_dis_y:13,
|
||||
head_content_2_dis_y:13,
|
||||
time_bubble_dis_y:13,
|
||||
clip_x:0,
|
||||
clip_y:0,
|
||||
clip_h:0,
|
||||
clip_w:0
|
||||
|
||||
}
|
||||
ConstVal.Task = {
|
||||
f_spid:176,//父精灵
|
||||
bg_spid:120,//背景精灵
|
||||
task_des_spid:135,//任务描述精灵
|
||||
reward_des_spid:307,//任务奖励描述
|
||||
proc_bg_spid:311,//任务进度背景
|
||||
proc_spid:315,//任务进度前景
|
||||
proc_des_spid:319,//任务进度文字描述
|
||||
get_reward_btn_spid:124,//领取任务按钮
|
||||
isreward_spid:328,//已领取
|
||||
tofinish_btn_spid:125,//去完成任务
|
||||
//tag值
|
||||
bg_tag:1,
|
||||
task_des_tag:1000,
|
||||
reward_des_tag:2000,
|
||||
proc_bg_tag:3000,
|
||||
proc_tag:4000,
|
||||
proc_des_tag:5000,
|
||||
get_reward_btn_tag:6000,
|
||||
isreward_tag:7000,
|
||||
tofinish_btn_tag:8000,
|
||||
//位置
|
||||
bg_x:0,
|
||||
bg_y:0,
|
||||
bg_w:0,//动态获取
|
||||
bg_dis_x:0,
|
||||
|
||||
task_des_x:30,
|
||||
task_des_y:30,
|
||||
|
||||
reward_des_y:265,
|
||||
proc_bg_y:380,
|
||||
proc_y:380,
|
||||
proc_des_y:380,
|
||||
get_reward_btn_y:368,
|
||||
isreward_y:365,
|
||||
tofinish_btn_y:330,
|
||||
|
||||
clip_x:110,
|
||||
clip_y:170,
|
||||
clip_w:0,
|
||||
clip_h:0
|
||||
}
|
||||
ConstVal.Launch_mode={
|
||||
name:"Launchtype",
|
||||
from_hall:1,
|
||||
from_self:0
|
||||
};
|
||||
ConstVal.OS = {//操作系统类型
|
||||
apple:1,//苹果
|
||||
android:2,//安卓
|
||||
winphone:3,//windowsphone
|
||||
other:4//其他
|
||||
};
|
||||
ConstVal.InterEffSoundsList = ["00001.mp3","00002.mp3","00003.mp3","00004.mp3"];
|
||||
ConstVal.soudsSpidList = [235,13,5,6,7,9,339,11,12,14,15,249,10,376,377,378,379,380,381,382,383,384,385,150,153,151,283,181,513,233,185];
|
||||
ConstVal.Broadcast = {
|
||||
textwidth:18,
|
||||
speed:0.1,
|
||||
clip_x:0,
|
||||
clip_y:0,
|
||||
clip_w:0,
|
||||
clip_h:0
|
||||
};
|
||||
ConstVal.Notice = {
|
||||
replaceOldWord:"#",
|
||||
replaceNewWord:"\n",
|
||||
lineHeight:60,
|
||||
textHeight:30,
|
||||
textWidth:14,
|
||||
clip_x:0,
|
||||
clip_y:0,
|
||||
clip_w:725,
|
||||
clip_h:450,
|
||||
img_clip_x:366,
|
||||
img_clip_y:156,
|
||||
img_clip_w:765,
|
||||
img_clip_h:483,
|
||||
};
|
||||
ConstVal.payConfig = {
|
||||
enablePay:false
|
||||
};
|
||||
|
||||
ConstVal.loginButton = {
|
||||
key:"loginimage",
|
||||
type1:[1,22],//0->类型值 1->图片资源ID
|
||||
type2:[2,203]
|
||||
}
|
||||
|
||||
ConstVal.userAgent = {
|
||||
paraName:"",
|
||||
uAgent_1:1,
|
||||
uAgent_2:2,
|
||||
uAgent_3:3
|
||||
};
|
||||
ConstVal.worldRoom = {
|
||||
f_sp_1:522,
|
||||
f_sp_2:523,
|
||||
bg_sp_1:524,
|
||||
bg_sp_2:525,
|
||||
top_sp_1:526,
|
||||
top_sp_2:563,
|
||||
des_sp_1:527,
|
||||
des_sp_2:564,
|
||||
starbg_sp_1:566,
|
||||
starbg_sp_2:567,
|
||||
star_sp_1:562,
|
||||
star_sp_2:565,
|
||||
mult_sp_1:3020,
|
||||
mult_sp_2:3021,
|
||||
join_sp_1:3022,
|
||||
join_sp_2:3023,
|
||||
pCount_sp_1:3024,
|
||||
leave_sp_2:3025,
|
||||
topImg_sp:96,
|
||||
title_sp:3165,
|
||||
|
||||
multIcon_sp:94,
|
||||
multImg_sp:95,
|
||||
imgList:[361,362,363,364,365,366,367,368,369,370,371,372],
|
||||
multIcon_y:100,
|
||||
multImg_y:119,
|
||||
topImg_y:25,
|
||||
multImgWidth:25,
|
||||
multIconImgSpace:20,
|
||||
|
||||
pCountIcon_sp_2:3026,
|
||||
pCount_sp_2:3027,
|
||||
roomCode_sp_2:3028,
|
||||
|
||||
|
||||
bg_sp_tag_1:1,
|
||||
top_sp_tag_1:2000,
|
||||
des_sp_tag_1:4000,
|
||||
starbg_sp_tag_1:6000,
|
||||
star_sp_tag_1:8000,
|
||||
mult_sp_tag_1:10000,
|
||||
pCount_sp_tag_1:12000,
|
||||
join_sp_tag_1:14000,
|
||||
multIcon_tag:16000,
|
||||
multImg_tag:18000,
|
||||
topImg_tag:20000,
|
||||
|
||||
|
||||
bg_sp_tag_2:1,
|
||||
top_sp_tag_2:2000,
|
||||
des_sp_tag_2:4000,
|
||||
starbg_sp_tag_2:6000,
|
||||
star_sp_tag_2:8000,
|
||||
mult_sp_tag_2:10000,
|
||||
leave_sp_tag_2:12000,
|
||||
roomCode_sp_tag_2:14000,
|
||||
pCountIcon_sp_tag_2:16000,
|
||||
join_sp_tag_2:18000,
|
||||
pCount_sp_tag_2:20000,
|
||||
title_tag:40000,
|
||||
|
||||
clip_x_1:0,
|
||||
clip_x_2:0,
|
||||
clip_y_1:0,
|
||||
clip_y_2:0,
|
||||
clip_w_1:1050,
|
||||
clip_w_2:1150,
|
||||
clip_h_1:512,
|
||||
clip_h_2:465,
|
||||
|
||||
bg_sp_x_1:0,
|
||||
bg_sp_x_2:0,
|
||||
bg_sp_y_1:0,
|
||||
bg_sp_y_2:0,
|
||||
//bg_sp_y_2:43,
|
||||
bg_sp_space_1:6,
|
||||
bg_sp_space_2:15,
|
||||
top_sp_x_1:25,
|
||||
top_sp_x_2:25,
|
||||
top_sp_y_1:35,
|
||||
top_sp_y_2:20,
|
||||
top_sp_width_1:20,
|
||||
top_sp_width_2:13,
|
||||
top_sp_space_1:6,
|
||||
top_sp_space_2:6,
|
||||
des_sp_x_1:25,
|
||||
des_sp_x_2:30,
|
||||
title_sp_x:20,
|
||||
title_sp_y:3,
|
||||
des_sp_y_1:80,
|
||||
des_sp_y_2:45,
|
||||
des_sp_width_1:11,
|
||||
des_sp_width_2:11,
|
||||
des_sp_space_1:6,
|
||||
des_sp_space_2:6,
|
||||
|
||||
//mult_sp_x_1:10000,
|
||||
pCount_sp_x_1:80,
|
||||
join_sp_x_1:302,//靠右显示
|
||||
mult_sp_y_1:74,
|
||||
pCount_sp_y_1:193,
|
||||
join_sp_y_1:193,
|
||||
|
||||
mult_sp_x_2:30,
|
||||
roomCode_sp_x_2:775,
|
||||
pCountIcon_sp_x_2:170,
|
||||
join_sp_x_2:700,//靠右显示
|
||||
leave_sp_x_2:700,//靠右显示
|
||||
|
||||
pCountIcon_pCount_space_2:10,
|
||||
pCount_space_2:8,
|
||||
|
||||
//mult_sp_y_2:72,
|
||||
//roomCode_sp_y_2:25,
|
||||
//pCountIcon_sp_y_2:76,
|
||||
//join_sp_y_2:72,
|
||||
//leave_sp_y_2:23,
|
||||
//pCount_sp_y_2:81,
|
||||
|
||||
mult_sp_y_2:92,
|
||||
roomCode_sp_y_2:45,
|
||||
pCountIcon_sp_y_2:96,
|
||||
join_sp_y_2:92,
|
||||
leave_sp_y_2:45,
|
||||
pCount_sp_y_2:101,
|
||||
|
||||
|
||||
starbg_sp_x_1:35,
|
||||
starbg_sp_x_2:35,
|
||||
starbg_sp_y_1:182,
|
||||
starbg_sp_y_2:182,
|
||||
starbg_sp_space_1:6,
|
||||
starbg_sp_space_2:6,
|
||||
|
||||
star_sp_x_1:35,
|
||||
star_sp_x_2:35,
|
||||
star_sp_y_1:189,
|
||||
star_sp_y_2:189,
|
||||
star_sp_space_1:6,
|
||||
star_sp_space_2:6,
|
||||
|
||||
mult_sp_w_1:13,
|
||||
join_sp_w_1:10,
|
||||
|
||||
join_sp_w_2:12,
|
||||
leave_sp_w_2:12,
|
||||
mult_sp_w_2:13,
|
||||
roomCode_sp_w_2:16,
|
||||
|
||||
bgSpaceX:438,
|
||||
bgSpaceY:250,
|
||||
};
|
||||
ConstVal.snrRoomList ={
|
||||
f_spid:611,
|
||||
bg_spid:622,
|
||||
rcode_bg_spid:623,
|
||||
rcode_spid:624,
|
||||
close_spid:625,
|
||||
update_spid:626,
|
||||
switch_spid:627,
|
||||
info_spid:600,
|
||||
profit_spid:601,
|
||||
video_spid:3138,
|
||||
|
||||
bg_tag:1,
|
||||
rcode_bg_tag:200,
|
||||
rcode_tag:400,
|
||||
close_tag:600,
|
||||
update_tag:800,
|
||||
switch_tag:1000,
|
||||
info_tag:1200,
|
||||
profit_tag:1400,
|
||||
video_tag:1600,
|
||||
|
||||
clip_x:0,
|
||||
clip_y:0,
|
||||
clip_w:900,
|
||||
clip_h:0,
|
||||
|
||||
bg_x:15,
|
||||
rcode_bg_x:33,
|
||||
rcode_x:35,
|
||||
close_x:70,
|
||||
update_x:20,
|
||||
switch_x:150,
|
||||
info_x:35,
|
||||
profit_x:150,
|
||||
video_x:420,
|
||||
|
||||
bg_y:10,
|
||||
rcode_bg_y:260,
|
||||
rcode_y:28,
|
||||
close_y:260,
|
||||
update_y:90,
|
||||
switch_y:90,
|
||||
info_y:80,
|
||||
profit_y:25,
|
||||
video_y:20,
|
||||
|
||||
profit_w:12,
|
||||
|
||||
bg_space:5,
|
||||
rcode_bg_space:35,
|
||||
rcode_space:50,
|
||||
close_space:300,
|
||||
update_space:400,
|
||||
switch_space:500,
|
||||
|
||||
bksp:3137,
|
||||
|
||||
|
||||
};
|
||||
ConstVal.rankList ={
|
||||
f_spid:609,
|
||||
bg_spid:610,
|
||||
badge_spid:629,
|
||||
headimg_spid:630,
|
||||
headfront_spid:631,
|
||||
name_spid:632,
|
||||
star_spid:633,
|
||||
|
||||
bg_tag:1,
|
||||
badge_tag:100,
|
||||
headimg_tag:200,
|
||||
headfront_tag:300,
|
||||
name_tag:400,
|
||||
star_tag:500,
|
||||
|
||||
clip_x:0,
|
||||
clip_y:0,
|
||||
clip_w:0,
|
||||
clip_h:511,
|
||||
|
||||
bg_x:0,
|
||||
badge_x:-20,
|
||||
headimg_x:93,
|
||||
headfront_x:85,
|
||||
name_x:190,
|
||||
star_x:190,
|
||||
|
||||
bg_y:0,
|
||||
badge_y:-5,
|
||||
headimg_y:12,
|
||||
headfront_y:5,
|
||||
name_y:8,
|
||||
star_y:42,
|
||||
|
||||
|
||||
space:13,
|
||||
|
||||
headsrc:262
|
||||
|
||||
};
|
||||
ConstVal.MenuScene = {
|
||||
createBtn_1:[780,182],//有星星场
|
||||
joinBtn_1:[780,320],
|
||||
starBtn:[780,458],
|
||||
createBtn_2:[780,230],
|
||||
joinBtn_2:[780,405]
|
||||
};
|
||||
//仓库
|
||||
ConstVal.wareHouse = {
|
||||
tableBgX:[41,33],
|
||||
tableTextX:[57,51],
|
||||
passWordLength:6,
|
||||
};
|
||||
ConstVal.sysNotice = {
|
||||
f_spid:3109,
|
||||
bubble_spid:163,
|
||||
msg_spid:3110,
|
||||
|
||||
msg_width:11,
|
||||
msg_tag:50000,
|
||||
msg_rOld:"#",
|
||||
msg_rNew:"\n",
|
||||
lineHeight:25,
|
||||
limit:10000,
|
||||
bubble_tag:1,
|
||||
x:20,
|
||||
y:20,
|
||||
spaceX:40,
|
||||
spaceY:40,
|
||||
|
||||
bm_space_x:20,
|
||||
bm_space_y:35,
|
||||
|
||||
|
||||
lineSpace:30,// 行距
|
||||
noteSpace:40,//每条的距离
|
||||
clip_x:0,
|
||||
clip_y:0,
|
||||
clip_h:0,
|
||||
clip_w:0
|
||||
}
|
||||
ConstVal.starConfig = {
|
||||
resList:[214,214],
|
||||
}
|
||||
ConstVal.Animation = {
|
||||
time1:1200,
|
||||
time2:2000,
|
||||
fundTime:5230,
|
||||
deltaTime:1000,
|
||||
};
|
||||
ConstVal.myRoomList ={
|
||||
maxLength:5,
|
||||
fSpid:98,
|
||||
|
||||
bgSp:100,
|
||||
roomCodeSp:102,
|
||||
|
||||
bgTag:1,
|
||||
roomCodeTag:100,
|
||||
placeX:0,
|
||||
placeY:95,
|
||||
bgX:8,
|
||||
bgY:55,
|
||||
space:5,
|
||||
|
||||
rCodeX:140,
|
||||
rCodeY:85,
|
||||
//clip_x:8,
|
||||
//clip_y:160,
|
||||
//clip_w:265,
|
||||
//clip_h:450,
|
||||
|
||||
roomCodeWidth:14,
|
||||
}
|
||||
ConstVal.netType = 0;
|
||||
ConstVal.isGameHall = false;
|
||||
|
||||
ConstVal.vipRoomList1 = {
|
||||
f_spid:3172,
|
||||
bg_spid:3176,
|
||||
title_spid:3177,
|
||||
code_spid:3178,
|
||||
owner_spid:3179,
|
||||
count_spid:3180,
|
||||
del_spid:3181,
|
||||
des_spid:3189,
|
||||
enter_spid:3192,
|
||||
|
||||
bg_tag:1,
|
||||
title_tag:1000,
|
||||
code_tag:2000,
|
||||
owner_tag:3000,
|
||||
count_tag:4000,
|
||||
des_tag:5000,
|
||||
del_tag:6000,
|
||||
enter_tag:7000,
|
||||
|
||||
clip_x:0,
|
||||
clip_y:0,
|
||||
clip_w:0,
|
||||
clip_h:460,
|
||||
|
||||
space:199,
|
||||
|
||||
title_x:20,
|
||||
code_x:70,
|
||||
des_x:25,
|
||||
owner_x:270,
|
||||
count_x:525,
|
||||
del_x:583,
|
||||
enter_x:514,
|
||||
|
||||
title_y:3,
|
||||
code_y:148,
|
||||
des_y:50,
|
||||
owner_y:146,
|
||||
count_y:146,
|
||||
del_y:0,
|
||||
enter_y:42,
|
||||
|
||||
}
|
||||
ConstVal.vipRoomList2 = {
|
||||
f_spid:3185,
|
||||
bg_spid:3186,
|
||||
code_spid:3187,
|
||||
count_spid:3188,
|
||||
|
||||
bg_tag:1,
|
||||
code_tag:1000,
|
||||
count_tag:2000,
|
||||
|
||||
clip_x:0,
|
||||
clip_y:0,
|
||||
clip_w:0,
|
||||
clip_h:460,
|
||||
|
||||
spaceX:285,
|
||||
spaceY:145,
|
||||
|
||||
code_x:56,
|
||||
count_x:50,
|
||||
|
||||
|
||||
code_y:25,
|
||||
count_y:65,
|
||||
|
||||
countW:12,
|
||||
|
||||
}
|
||||
ConstVal.blackList = {
|
||||
f_spid:3204,
|
||||
bg_spid:3207,
|
||||
id_spid:3209,
|
||||
del_spid:3208,
|
||||
|
||||
bg_tag:1,
|
||||
id_tag:10000,
|
||||
del_tag:20000,
|
||||
|
||||
clip_x:0,
|
||||
clip_y:0,
|
||||
clip_w:0,
|
||||
clip_h:0,
|
||||
|
||||
id_x:25,
|
||||
del_x:330,
|
||||
|
||||
id_y:12,
|
||||
del_y:4,
|
||||
|
||||
space:8,
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
ConstVal.vipRank = {
|
||||
f_spid:3227,
|
||||
bg_spid:3223,
|
||||
txt_spid:3229,
|
||||
rank_spid:3228,
|
||||
score_spid:3230,
|
||||
|
||||
bg_tag:1,
|
||||
txt_tag:10000,
|
||||
rank_tag:20000,
|
||||
score_tag:30000,
|
||||
|
||||
clip_x:0,
|
||||
clip_y:0,
|
||||
clip_w:0,
|
||||
clip_h:0,
|
||||
|
||||
txt_x:70,
|
||||
rank_x:0,
|
||||
score_x:230,
|
||||
|
||||
txt_y:10,
|
||||
rank_y:4,
|
||||
score_y:10,
|
||||
|
||||
rank_space:10,
|
||||
|
||||
space:8,
|
||||
rank_w:25,
|
||||
|
||||
|
||||
};
|
||||
ConstVal.whiteList = {
|
||||
f_spid:3272,
|
||||
bg_spid:3277,
|
||||
id_spid:3279,
|
||||
del_spid:3278,
|
||||
charm_spid:3292,
|
||||
|
||||
bg_tag:1,
|
||||
id_tag:10000,
|
||||
del_tag:20000,
|
||||
charm_tag:30000,
|
||||
|
||||
clip_x:0,
|
||||
clip_y:0,
|
||||
clip_w:0,
|
||||
clip_h:0,
|
||||
|
||||
id_x:25,
|
||||
del_x:450,
|
||||
charm_x:200,
|
||||
|
||||
id_y:12,
|
||||
del_y:4,
|
||||
charm_y:12,
|
||||
|
||||
|
||||
space:8,
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
582
codes/games/client/Projects/guanpai-jx/js/00_Surface/04_Data.js
Normal file
582
codes/games/client/Projects/guanpai-jx/js/00_Surface/04_Data.js
Normal file
@@ -0,0 +1,582 @@
|
||||
/*var returnCitySN = {"cip": "171.34.213.118", "cid": "360000", "cname": "江西省"}*/
|
||||
|
||||
var C_Player;
|
||||
var InfoSex=0;
|
||||
|
||||
|
||||
var arrBan=[];
|
||||
var RoomCode = "";
|
||||
var RoomNum = -1;
|
||||
|
||||
var CombatCount = 0;
|
||||
var CombatPage = 0;//战绩页码
|
||||
var CombatPageTwoIndex = 0;//大局标号
|
||||
var CombatPageThreeIndex = 0;//小局标号
|
||||
|
||||
var CombatInfo = [];//战绩详情
|
||||
var C_PageOneBtn = [];//战绩页一按钮id
|
||||
var C_PageTwoBtn = [];//战绩页二按钮id
|
||||
var CombatBackHeight = 0;//战绩背景高度
|
||||
|
||||
var TaskInfo = [];//任务详情
|
||||
var VoteTime=0;//投票倒计时秒
|
||||
|
||||
var GameData=GameData||{};
|
||||
GameData.HallServer="";
|
||||
GameData.Server="";
|
||||
GameData.AjaxUrl="";
|
||||
GameData.scrollmsg="";
|
||||
GameData.wechat_gzh="";
|
||||
GameData.wechat_kfh="";
|
||||
GameData.qq = "";
|
||||
GameData.tel = "";
|
||||
GameData.gzhcolor1 = "";
|
||||
GameData.gzhcolor2 = "";
|
||||
GameData.telcolor = "";
|
||||
|
||||
GameData.errorMsg = null;
|
||||
GameData.tcpConnect=true;
|
||||
GameData.tcpConnectState = false;
|
||||
GameData.TimerID=0;
|
||||
GameData.TimerID_2=0;
|
||||
GameData.timer=10000;
|
||||
GameData.time_2=15000;
|
||||
GameData.NetType=0;//是否为首次连接
|
||||
GameData.Protocol_H=1;
|
||||
GameData.ProtocolIndex=true;
|
||||
GameData.isLoad=true;
|
||||
GameData.LoadCount=0;
|
||||
GameData.Timesup=false;
|
||||
GameData.InteractPlayer = -1;
|
||||
GameData.isCallback=false;
|
||||
GameData.isBoard=true;
|
||||
GameData.ConnectType=false;//1->更换服务器不需要重连
|
||||
GameData.ConnectRpc="";//更换服务器成功后发包的RPC
|
||||
GameData.ConnectPack={};//更换服务器成功后发包数据
|
||||
GameData.Battery = 0;//电量
|
||||
GameData.NetWork = 0;//网络情况1 未连接网络 2 连接wifi 3 连接2G/3G/4G
|
||||
GameData.WifiLevel = 0;//WiFi强度
|
||||
GameData.wechat_ewm = "";//二维码
|
||||
GameData.appstate=true;//true程序前台运行false程序后台运行
|
||||
GameData.OS = ConstVal.OS.other;//1->IOS 2->Android 3->wp 4->other
|
||||
GameData.isLogin = false;//是否已登录
|
||||
GameData.leaveTime=0;//
|
||||
GameData.disType = false;
|
||||
GameData.reconnectTimer=0;
|
||||
GameData.isClose = false;
|
||||
GameData.isCloseTimer = null;
|
||||
GameData.firstConnect = true;//第一次连接
|
||||
GameData.firstConnect_Succ = false;//第一次连接成功
|
||||
GameData.firstConnect_Timer = null;//第一次连接定时器
|
||||
GameData.loginTimer = null;
|
||||
GameData.tryTimes = 0;//链接尝试次数
|
||||
GameData.isReconnect = false;
|
||||
GameData.isCreateEmotion = false;
|
||||
GameData.ChatPage = 1;
|
||||
GameData.slidEmotion = false;
|
||||
GameData.communionHistory=[];//聊天历史//二维数组[[方位,类型(1-文字2语音),内容,时长]]
|
||||
GameData.createHistoryLen = 0;//以创建的精灵的长度
|
||||
GameData.slideHistory = false;
|
||||
GameData.TcpTimer = null;//tcp连接失败判断定时器
|
||||
GameData.slideTask = false;//是否滑动任务
|
||||
GameData.copyTaskTagList = [];//任务复制精灵tag列表
|
||||
|
||||
|
||||
|
||||
GameData.versionState = 0;//苹果审核结果
|
||||
GameData.visitorserver = "";//游客服务器地址
|
||||
GameData.isVisitor = false;
|
||||
|
||||
GameData.shakeID = 0;//摇一摇事件ID
|
||||
GameData.isRecord = false;
|
||||
|
||||
GameData.LaunchMode = ConstVal.Launch_mode.from_self;
|
||||
|
||||
GameData.Multiple = "";
|
||||
GameData.OrgArr=[];
|
||||
GameData.MultiArr = [];
|
||||
|
||||
GameData.isFirstLogin = true;//是否是第一次登陆
|
||||
|
||||
GameData.payList = null;
|
||||
GameData.payData = [0,0];
|
||||
|
||||
GameData.visitorClick = 0;
|
||||
GameData.Scene = 0;
|
||||
|
||||
GameData.urlFail = false;
|
||||
GameData.BroadcastArray = [];
|
||||
GameData.isBoardcast = false;
|
||||
|
||||
GameData.tcpState = [0,0];
|
||||
GameData.Notice ={
|
||||
heigth:0,
|
||||
lineSum:0,
|
||||
width:0
|
||||
}
|
||||
GameData.marketID = 0;
|
||||
GameData.getJSONState = false;//JSON获取成功状态
|
||||
GameData.Config = null;//服务器配置json
|
||||
GameData.AgentLoginImg = "";//代理商图片
|
||||
GameData.TopUpUrl = "";//索要房卡地址
|
||||
|
||||
GameData.tryConnect = false;
|
||||
GameData.hallConfigName = ["enablePay",
|
||||
"logoffCallback",//不通知
|
||||
'worldRoomList',//星星争霸是否可用
|
||||
'max:',
|
||||
'min',
|
||||
'unit',
|
||||
'shareMsg',
|
||||
'autoWorldRoomList',//是否自动弹出星星争霸场
|
||||
'rankList',//是否显示排行榜按钮1模拟排行2真实排行
|
||||
'groupMsg',//试玩群信息
|
||||
'isReSetOwnerNote',//是否替换签名
|
||||
'activity',//是否显示活动如果显示则为[x,y,w,h/*,isOpen,btnUrl,url,actid*/]
|
||||
'actData:',//常驻活动按钮 [imgUrl,isOpen,jumpUrl,actUrl]
|
||||
'shareButton:',//是否显示分享到平台
|
||||
'enableQuickEnter',//是否隐藏快速加入
|
||||
'storeUrl',//商城url
|
||||
'bagUrl',//背包url
|
||||
'shareDesc',//平台分享描述信息
|
||||
'wareHouse',//是否开启仓库功能0->不开启1->开启保险箱不开启赠送2->开启赠送不开启保险箱3->开启星星赠送(开启保险箱)4->开启房卡赠送(开启保险箱)5->开启星星房卡赠送(开启保险箱)
|
||||
'betaText',//版本号后的beta显示内容
|
||||
'launchImgUrl',//启动页图片地址
|
||||
'shareType:',//分享朋友圈类型0->链接分享 1->图片分享
|
||||
'shareImgUrl',//分享朋友圈图片链接
|
||||
'launchWaitTime',//启动等待时间
|
||||
'shareBgUrl',//分享背景图片
|
||||
'qqLogin',//是否显示qq登录
|
||||
'androidPay',//是否开启安卓支付
|
||||
'channelKey',//支付key
|
||||
'payCSS',//支付css
|
||||
'payJS',//支付js
|
||||
'openVideo'
|
||||
];//是否开启视频];
|
||||
GameData.hallConfig = {
|
||||
enablePay:0,
|
||||
logoffCallback:0,//不通知
|
||||
worldRoomList:0,//星星争霸是否可用
|
||||
max:100,
|
||||
min:0,
|
||||
unit:1,
|
||||
shareMsg:"",
|
||||
autoWorldRoomList:0,//是否自动弹出星星争霸场
|
||||
rankList:0,//是否显示排行榜按钮1模拟排行2真实排行
|
||||
groupMsg:"",//试玩群信息
|
||||
isReSetOwnerNote:0,//是否替换签名
|
||||
activity:0,//是否显示活动如果显示则为[x,y,w,h/*,isOpen,btnUrl,url,actid*/]
|
||||
actData:0,//常驻活动按钮 [imgUrl,isOpen,jumpUrl,actUrl]
|
||||
shareButton:1,//是否显示分享到平台
|
||||
enableQuickEnter:1,//是否隐藏快速加入
|
||||
storeUrl:"",//商城url
|
||||
bagUrl:"",//背包url
|
||||
shareDesc:"",//平台分享描述信息
|
||||
wareHouse:0,//是否开启仓库功能0->不开启1->开启保险箱不开启赠送2->开启赠送不开启保险箱3->开启星星赠送(开启保险箱)4->开启房卡赠送(开启保险箱)5->开启星星房卡赠送(开启保险箱)
|
||||
betaText:"",//版本号后的beta显示内容
|
||||
launchImgUrl:"",//启动页图片地址
|
||||
shareType:0,//分享朋友圈类型0->链接分享 1->图片分享
|
||||
shareImgUrl:"",//分享朋友圈图片链接
|
||||
launchWaitTime:10,//启动等待时间
|
||||
shareBgUrl:"",//分享背景图片
|
||||
qqLogin:0,//是否显示qq登录
|
||||
androidPay:0,//是否开启安卓支付
|
||||
channelKey:"",//支付key
|
||||
payCSS:"",//支付css
|
||||
payJS:"",//支付js
|
||||
openVideo:0,//是否开启视频
|
||||
};
|
||||
GameData.starName = "星星";
|
||||
GameData.roomCardName = "房卡";
|
||||
GameData.gameConfig = {};
|
||||
|
||||
GameData.playerHeadImgState = false;//玩家主界面头像加载状态
|
||||
GameData.matchhtml = "";//比赛链接地址
|
||||
|
||||
GameData.Validator = null;
|
||||
GameData.loginBtnType = ConstVal.loginButton.type1[0];//登录按钮样式
|
||||
GameData.netWorkSate = false;
|
||||
|
||||
GameData.heartBeatTimer = null;//心跳事件定时器ID
|
||||
GameData.heartBeatStage = false;//提示框是否处于心跳提示事件
|
||||
|
||||
GameData.telSpid = 179;//拨打电话精灵号
|
||||
GameData.matchInfo = null;//比赛场信息
|
||||
|
||||
GameData.agentmode = 1;//邀请码模式
|
||||
|
||||
GameData.infMode = 0;//是否为无限局
|
||||
GameData.infClickCount = 0;//点击次数
|
||||
|
||||
GameData.checkType = 1;//确认面板事件类型 1->解散房间 2->退出房间 3->投降
|
||||
GameData.roomList = [];//房间列表
|
||||
|
||||
GameData.sendLoginTimer = null;//发送重连登录包定时器
|
||||
GameData.loginList = [];//
|
||||
GameData.isConnected = false;
|
||||
|
||||
GameData.isSendLoginState = false;//是否在等待登录包
|
||||
GameData.isSendLoginTimer = null;//登录包收包定时器
|
||||
GameData.isTcpConnect = false;//是否在连接状态
|
||||
|
||||
GameData.TcpID = 0;//tcpid
|
||||
GameData.websocketList=[];
|
||||
GameData.pack="";
|
||||
GameData.infoSeat = -1;
|
||||
|
||||
GameData.sendLoginTimes = 0;
|
||||
|
||||
GameData.backUrl = "";
|
||||
|
||||
GameData.playerid = "";
|
||||
|
||||
GameData.serverConfig = {};
|
||||
|
||||
GameData.userAgent = ConstVal.userAgent.uAgent_1;
|
||||
|
||||
GameData.getbattery = "";
|
||||
GameData.getbatteryPack = {};
|
||||
|
||||
GameData.getnetwork = "";
|
||||
GameData.getnetworkPack = {};
|
||||
|
||||
GameData.getVersionState = "";
|
||||
GameData.getVersionStatePack = {};
|
||||
|
||||
GameData.getchannelName = "";
|
||||
GameData.getchannelNamePack = {};
|
||||
|
||||
GameData.getmarketname = "";
|
||||
GameData.getmarketnamePack = {};
|
||||
|
||||
GameData.gamepastetext = "";
|
||||
GameData.gamepastetextPack = {};
|
||||
GameData.worldRoomSys=[];
|
||||
|
||||
//玩家房间数据
|
||||
GameData.worldRoomPly=[];
|
||||
|
||||
GameData.worldRoomSysSlide = false;
|
||||
GameData.worldRoomPlySlide = false;
|
||||
|
||||
GameData.menuNotice = null;
|
||||
|
||||
GameData.advertInfo_1 = {
|
||||
type:0,//是否使用默认的文字通知
|
||||
imgUrl:"",//图片地址
|
||||
imgAdUrl:"",//图片跳转链接地址
|
||||
height:1,//图片高度
|
||||
msg:"",
|
||||
url:"",
|
||||
};
|
||||
GameData.advertInfo_2 = {
|
||||
type:0,
|
||||
imgUrl:"",
|
||||
imgAdUrl:"",
|
||||
height:1,
|
||||
msg:"",
|
||||
url:"",
|
||||
};
|
||||
GameData.advertInfo_0 = {
|
||||
type:0,
|
||||
imgUrl:"",
|
||||
imgAdUrl:"",
|
||||
height:1,
|
||||
msg:"",
|
||||
url:"",
|
||||
};
|
||||
GameData.noticePage = 0;
|
||||
GameData.noticePara = [[0,0],[0,0],[0,0]];
|
||||
|
||||
GameData.snrOption = {
|
||||
profit:0,
|
||||
roomcode:"",
|
||||
};
|
||||
GameData.snrRoomList = {
|
||||
roomlist:[],
|
||||
roomtype:[],
|
||||
tea:1000,
|
||||
shortcode:888
|
||||
};
|
||||
GameData.snrRoomListSlide = false;
|
||||
GameData.snrOptionLength = 0;
|
||||
GameData.snrOptionRoomTag = 0;
|
||||
GameData.snrOptionMode = 0;
|
||||
GameData.snrOptionRoomtype = "";
|
||||
GameData.snrOptionDes = "";
|
||||
GameData.snrOptionProfit=0;
|
||||
|
||||
GameData.shortCode = "";
|
||||
|
||||
GameData.isShowWorldRoomList = true;
|
||||
GameData.shareMsg = "";
|
||||
|
||||
GameData.rankList = [];
|
||||
GameData.rankListTag = 0;
|
||||
GameData.ranListLength = 0;
|
||||
GameData.rankListSlide = false;
|
||||
|
||||
GameData.h5Version = 0;
|
||||
//
|
||||
var shareParam = {
|
||||
appid: "14936872341446",
|
||||
devkey: "14915485974028"
|
||||
}
|
||||
|
||||
GameData.shareTimeline = {//朋友圈
|
||||
title: "",
|
||||
desc: "",
|
||||
link: "",
|
||||
imgUrl: ""
|
||||
}
|
||||
GameData.shareAppMessage = {//好友
|
||||
title: "",
|
||||
desc: "",
|
||||
link: "",
|
||||
imgUrl: ""
|
||||
}
|
||||
GameData.gameData = "";
|
||||
GameData.fromH5GameData = {};
|
||||
GameData.isJoinRoomFromH5 = false;
|
||||
GameData.h5ShareImage = "";
|
||||
GameData.screenShotStage = 0;
|
||||
GameData.screenShotSpidList = [];
|
||||
|
||||
GameData.ownerNote = "";
|
||||
GameData.isDebugger = 0;
|
||||
|
||||
GameData.returnUrl = "";
|
||||
|
||||
GameData.configData = "";
|
||||
GameData.h5ShareUrl = "";
|
||||
|
||||
GameData.inputPanelData = "";
|
||||
GameData.inputCallBack = null;
|
||||
|
||||
GameData.isShowNeighbor = true;
|
||||
|
||||
GameData.nameImgFrame_1 = 1;//房卡图片帧数
|
||||
GameData.nameImgFrame_2 = 1;//星星图片帧数
|
||||
GameData.surrendCount = 0;
|
||||
|
||||
|
||||
GameData.htmlCode = "";
|
||||
GameData.htmlId = "";
|
||||
|
||||
GameData.serverIndex = 0;//连接地址下标
|
||||
GameData.tryReconnectTimes = 0;
|
||||
GameData.isChangeServer = false;
|
||||
|
||||
GameData.shareFrom = 0;//0->框架分享 1->游戏分享
|
||||
GameData.activityType = 0;//子游戏调用类型
|
||||
GameData.activityData = null;//子游戏调用类型
|
||||
GameData.shareTimes = 0;//分享次数
|
||||
|
||||
GameData.sharePostUrl = "http://localhost:4477/testurl";//截图分享链接
|
||||
//保险箱
|
||||
GameData.wareHouse = {
|
||||
page:1,//当前页
|
||||
safeInputType:1,//保险箱存入取出类型
|
||||
safeInputCount:-1,//保险箱存入取出数量
|
||||
safePassWord:-1,//保险箱存入取出密码
|
||||
inputNumber:0,//输入的数字
|
||||
selectType:1,//选择的当前输入框
|
||||
initPassWord1:-1,//初始化密码
|
||||
initPassWord2:-1,//确认初始化密码
|
||||
pId:0,//赠送id
|
||||
pImg:"",//赠送头像
|
||||
pNickName:"",//赠送昵称
|
||||
pInputType:1,//赠送类型
|
||||
pInputId:-1,//输入id
|
||||
pInputCount:-1,//赠送数量
|
||||
pInputPassWord:-1,//赠送密码
|
||||
|
||||
|
||||
};
|
||||
GameData.openVideo = 0;//是否开启视频功能
|
||||
GameData.imgAdIsSlide = false;
|
||||
GameData.launchImgLoaded = false;//启动页图片是否从网络加载完成
|
||||
GameData.configSuccess = false;//配置文件读取成功
|
||||
GameData.launchWaitTime = 0;
|
||||
GameData.adTimer = null;
|
||||
|
||||
GameData.sysNotice = [];//系统公告 {msg:"",read:false,line:1}
|
||||
GameData.sysCreateLength = 0;
|
||||
|
||||
GameData.selectSysNotice = false;//是否勾选发送系统公告
|
||||
GameData.sysNoticeCost = 0;
|
||||
GameData.sysNoticeLimit = 0;
|
||||
|
||||
|
||||
GameData.mainMenuAniTimer = null;
|
||||
GameData.worldRoomPage = 0;
|
||||
|
||||
GameData.createMyRoomListLength = 0;
|
||||
|
||||
GameData.starCount = 0;
|
||||
GameData.roomCardCount=0;
|
||||
|
||||
GameData.loginPlayerid = false;//登录是否带上playerid
|
||||
|
||||
GameData.matchId = null;
|
||||
|
||||
GameData.chatLine = null;
|
||||
GameData.chatInfo = null;
|
||||
GameData.isService = false;
|
||||
|
||||
GameData.submitLocation = false;
|
||||
GameData.submitPhoneInfo = false;
|
||||
GameData.submitAddressBook = false;
|
||||
GameData.getConfigTimer = null;
|
||||
|
||||
GameData.clickChat = 0;
|
||||
|
||||
GameData.phoneInfo = null;
|
||||
GameData.addressBook = null;
|
||||
//GameData.sysConfigName=[];
|
||||
GameData.sysConfigName=["hideEscape","charmName","hideTaskBtn","miniPro","videoConfig","ofcShortCode","ofcTips","ofcWx","ofcImg",
|
||||
"managerUrl","rebateConfig","gameNoticeShow","hallNoticeShow","ofcAutoEnter","vipFlushTime","vipWx","h5PayUrl","appShareH5",
|
||||
"vipRankLimit","behaviorList","deviceLogin","hideWxShare","hideRoomCard","hideSpid","cdKey","otherShare","avatarRange","avatarUrl","whiteListManager","nnLocal"];
|
||||
GameData.sysConfig={
|
||||
hideEscape:0,
|
||||
charmName:"魅力",
|
||||
hideTaskBtn:0,//是否隐藏任务按钮
|
||||
miniPro:0,//是否小程序/小游戏 (隐藏更多选项、分享朋友圈、聊天按钮、录音调整)
|
||||
videoConfig:null,//{type:1,profitMode:1,profit:3}
|
||||
ofcShortCode:null,//官方短号
|
||||
ofcImg:"",//官方按钮链接
|
||||
managerUrl:"",//管理后台地址
|
||||
rebateConfig:null,//抽成配置
|
||||
gameNoticeShow:0,//子游戏弹窗时间间隔 0每次都弹 -1不弹
|
||||
hallNoticeShow:0,//大厅弹窗时间间隔 0每次都弹 -1不弹
|
||||
ofcAutoEnter:0,//是否自动进入官方短号
|
||||
vipFlushTime:10000,//vip房间列表刷新间隔
|
||||
vipWx:"",//成为vip联系微信
|
||||
h5PayUrl:"",//h5支付地址
|
||||
appShareH5:"",//app分享的h5地址
|
||||
vipRankLimit:10,//vip排行显示个数
|
||||
behaviorList:null,//用户行为
|
||||
deviceLogin:0,//是否显示设备登录显示了设备登录就会显示手机号登录就会隐藏微信登录
|
||||
hideWxShare:0,//是否隐藏微信分享
|
||||
hideRoomCard:1,//隐藏主界面房卡 1 不隐藏 2隐藏
|
||||
hideSpid:null,//隐藏的精灵id
|
||||
cdKey:1,//是否显示CDKEY 1不显示 2显示
|
||||
otherShare:1,//开启新分享 1 关闭2开启
|
||||
avatarRange:[100,10000],//设备登录的头像列表
|
||||
avatarUrl:"https://projectimage.tscce.cn/image_132/",
|
||||
whiteListManager:2, //是否开启在游戏中管理白名单
|
||||
nnLocal:2,//
|
||||
|
||||
};
|
||||
GameData.inputCallBack2 = null;
|
||||
|
||||
GameData.topInfoTimer = null;
|
||||
|
||||
GameData.iscloseVideo = true;//是否开战关闭视频
|
||||
GameData.textCallback = null;
|
||||
|
||||
GameData.isLocation = false;
|
||||
GameData.otherLocation = false;//
|
||||
GameData.otherLocationTimes = 0;
|
||||
GameData.otherLocationAllTimes = 1;
|
||||
|
||||
|
||||
GameData.hallLogin = true;
|
||||
|
||||
GameData.senRoomState = 0;
|
||||
|
||||
GameData.rebateConfig = null;
|
||||
|
||||
GameData.vipRoomPage = 0;
|
||||
GameData.vipRoomCode = 0;
|
||||
GameData.vipRoomData = [];
|
||||
GameData.vipRoomTimer1 = false;
|
||||
GameData.vipRoomIsOpen = false;
|
||||
GameData.vipRoomShortList = [];
|
||||
GameData.vipRoomJump = false;
|
||||
GameData.vipRoomPageOne = {
|
||||
cLength:0,
|
||||
slide:false,
|
||||
}
|
||||
GameData.vipRoomPageTwo = {
|
||||
cLength:0,
|
||||
slide:false,
|
||||
data:null,
|
||||
}
|
||||
GameData.tipTimer1 = null;
|
||||
GameData.tipTimer2 = null;
|
||||
|
||||
GameData.initCard = 0;
|
||||
GameData.initBean = 0;
|
||||
|
||||
GameData.brNumber=0;
|
||||
|
||||
GameData.isKick = false;
|
||||
|
||||
GameData.blackList = {
|
||||
data:[],
|
||||
length:0,
|
||||
breakRoom:false,
|
||||
selectTag:0,
|
||||
slide:false,
|
||||
inputId:"",
|
||||
idWidth:12,
|
||||
}
|
||||
GameData.allCharm = 0;
|
||||
GameData.vipRank = {
|
||||
data:{
|
||||
rankList:[],
|
||||
myRank:1,
|
||||
myScore:100
|
||||
},
|
||||
length:0,
|
||||
//selectTag:0,
|
||||
slide:false,
|
||||
//inputId:"",
|
||||
//idWidth:12,
|
||||
}
|
||||
GameData.rankType = false;
|
||||
|
||||
GameData.coinMp3Time = 0;
|
||||
GameData.coinMp3Length = 3000;
|
||||
GameData.brRebateUnit = 10000;
|
||||
|
||||
GameData.phoneCodeTime = 0;
|
||||
GameData.phoneCode = "";
|
||||
GameData.phoneNumber = "";
|
||||
|
||||
GameData.phoneType = 0;
|
||||
|
||||
GameData.isGetPhoneInfo = false;
|
||||
GameData.isDeviceLogin = false;
|
||||
GameData.begin0 = false;
|
||||
|
||||
GameData.vipConfig = null;
|
||||
|
||||
GameData.feedMode = 0;
|
||||
|
||||
GameData.fromMiniProData = {};
|
||||
|
||||
|
||||
GameData.shareFriendInfo = {};
|
||||
|
||||
|
||||
GameData.deviceAvatarList = [];
|
||||
|
||||
GameData.whiteList = {
|
||||
data:[],
|
||||
length:0,
|
||||
breakRoom:false,
|
||||
selectTag:0,
|
||||
slide:false,
|
||||
inputId:"",
|
||||
inputCharm:"",
|
||||
searchId:"",
|
||||
idWidth:12,
|
||||
delPid:"",
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
4190
codes/games/client/Projects/guanpai-jx/js/00_Surface/05_Func.js
Normal file
4190
codes/games/client/Projects/guanpai-jx/js/00_Surface/05_Func.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,553 @@
|
||||
function Player(seat){
|
||||
this.openid = "";//id
|
||||
this.playerid = -1;//playerid
|
||||
this.nickname = "";//昵称
|
||||
this.avatar = "";//头像地址
|
||||
this.sex = 0;//性别
|
||||
this.ip = "";//ip地址
|
||||
this.province = "";//微信信息省份
|
||||
this.city = "";//微信信息城市
|
||||
this.roomcard = -1;//房卡数量
|
||||
this.taskstate = 0;//任务状态
|
||||
this.unionid = 0;//平台唯一表示
|
||||
this.seat = seat; //座位号
|
||||
this.score = 0;
|
||||
this.state = -1;//玩家状态0->默认值 -1->申请解散 1->同意解散 2->拒绝解散
|
||||
this.status = 0;//0->默认值 1->房主 2->非房主
|
||||
//this.offline = 0;//玩家是否离线0->否 1->离线
|
||||
this.canexit=1;//是否可以直接离开
|
||||
this.onstate=0;//0:在线1:离线2:通话中
|
||||
this.addr = null;
|
||||
this.invitecode = "";//邀请码
|
||||
this.isStart = false;//能否点击按钮开始游戏
|
||||
this.bean = 0;//玩家豆子数量
|
||||
this.initialBean = 0;//玩家豆子初始值
|
||||
this.isprepare = 0;//玩家是否准备
|
||||
this.advanced = 0;//玩家是否有高级选项
|
||||
this.paycode = "";//吱口令
|
||||
this.wareHouseStarCount = 0;//仓库库存星星
|
||||
this.bankpower = 0;//是否有仓库权限
|
||||
this.bankpwd = 0;//是否设置仓库密码
|
||||
this.charm = undefined;
|
||||
this.sign = "";//签名
|
||||
this.tel = "";//绑定手机号
|
||||
}
|
||||
//玩家信息初始化
|
||||
if(typeof(Player.prototype.Init) == "undefined"){
|
||||
Player.prototype.Init = function(bTemp){
|
||||
this.openid = "";//id
|
||||
this.playerid = -1;//playerid
|
||||
this.nickname = "";//昵称
|
||||
this.score = 0;
|
||||
this.avatar = "";//头像地址
|
||||
this.sex = 0;//性别
|
||||
this.ip = "";//ip地址
|
||||
this.province = "";//省份
|
||||
this.city = "";//城市
|
||||
this.roomcard = 0;//房卡数量
|
||||
this.taskstate = 0;//任务状态
|
||||
this.unionid = 0;//平台唯一表示
|
||||
if(bTemp)this.seat = -1; //座位号
|
||||
this.state = -1;//玩家状态0->默认值 1->申请解散 2->同意解散 3->拒绝解散
|
||||
this.status = 0;//0->默认值 1->房主 2->非房主
|
||||
this.offline = 0;//玩家是否离线0->否 1->离线
|
||||
this.canexit=1;//是否可以直接离开
|
||||
this.onstate=0;//0:在线1:离线2:通话中
|
||||
this.addr = null;
|
||||
this.invitecode = "";//邀请码
|
||||
this.isStart = false;//能否点击按钮开始游戏
|
||||
this.bean = 0;//玩家豆子数量
|
||||
this.initialBean = 0;//玩家豆子初始值
|
||||
this.isprepare = 0;//玩家是否准备
|
||||
this.advanced = 0;//玩家是否有高级选项
|
||||
this.paycode = "";//吱口令
|
||||
this.wareHouseStarCount = 0;//仓库库存星星
|
||||
this.bankpower = 0;//是否有仓库权限
|
||||
this.bankpwd = 0;//是否设置仓库密码
|
||||
this.charm = undefined;
|
||||
this.sign = "";//签名
|
||||
this.tel = "";//绑定手机号
|
||||
};
|
||||
}
|
||||
//玩家微信信息初始化
|
||||
if(typeof(Player.prototype.SetWxInfo) == "undefined"){
|
||||
Player.prototype.SetWxInfo = function(openid,headimgurl,nickname,sex,city,Province,unionid){
|
||||
this.openid = openid;//id
|
||||
this.nickname = nickname;//昵称
|
||||
this.avatar = headimgurl;//头像地址
|
||||
this.sex = sex;//性别
|
||||
this.city = city;//城市
|
||||
this.province = Province;//省
|
||||
this.unionid=unionid;//开放平台id
|
||||
//alert("设置玩家信息");
|
||||
};
|
||||
}
|
||||
//玩家游戏信息初始化
|
||||
if(typeof(Player.prototype.SetMyInfo) == "undefined"){
|
||||
//Player.prototype.SetMyInfo = function(_playerid,_roomcard,_taskstate,_ip,_score,_bean,_paycode){
|
||||
Player.prototype.SetMyInfo = function(object){
|
||||
this.playerid = object.playerid;
|
||||
this.roomcard = object.roomcard;
|
||||
this.taskstate = object.taskstate;
|
||||
this.ip=object.ip;
|
||||
this.score = object.score;
|
||||
this.bean = object.bean;
|
||||
this.initialBean = object.bean;
|
||||
this.bankpower = object.bankpower;
|
||||
if(object.bank){
|
||||
this.wareHouseStarCount = Number(object.bank);//仓库库存星星
|
||||
}else{
|
||||
this.wareHouseStarCount = 0;
|
||||
}
|
||||
if(object.bankpwd){
|
||||
this.bankpwd = Number(object.bankpwd);//仓库库存星星
|
||||
}else{
|
||||
this.bankpwd = 0;
|
||||
}
|
||||
this.charm = object.charm;
|
||||
this.sign = object.sign;
|
||||
this.tel = object.tel;
|
||||
//this.setTel();
|
||||
//this.bankpwd = object.bank;//是否设置仓库密码 this.bankpwd = 0;//是否设置仓库密码
|
||||
//this.paycode = _paycode;
|
||||
};
|
||||
}
|
||||
//设置玩家位置
|
||||
if(typeof(Player.prototype.SetLocationInfo) == "undefined"){
|
||||
Player.prototype.SetLocationInfo = function(_locationinfo){
|
||||
this.addr = _locationinfo;
|
||||
set_self(200,7,C_Player.addr.province+"-"+C_Player.addr.city,0,0);
|
||||
};
|
||||
}
|
||||
|
||||
//设置玩家座位
|
||||
if(typeof(Player.prototype.SetSeat) == "undefined"){
|
||||
Player.prototype.SetSeat = function(seat){
|
||||
this.seat = seat;
|
||||
};
|
||||
}
|
||||
//设置玩家邀请码
|
||||
if(typeof(Player.prototype.setInvitecod) == "undefined"){
|
||||
Player.prototype.setInvitecod = function(_invitecode){
|
||||
this.invitecode = _invitecode;
|
||||
};
|
||||
}
|
||||
//修改房卡
|
||||
if(typeof(Player.prototype.UpdateRoomcard) == "undefined"){
|
||||
Player.prototype.UpdateRoomcard = function(_msg){
|
||||
this.roomcard = _msg.data.roomcard;
|
||||
//set_self(157,7,C_Player.roomcard,0,0);
|
||||
//set_self(157,18,get_self(287,18,0,0,0)+get_self(287,20,0,0,0)/2-String(C_Player.roomcard).length*7,0,0);
|
||||
GameUI.setHallRoomCard();
|
||||
if(_msg.data.text){
|
||||
GameUI.Openupdataroomcard(_msg.data.text);
|
||||
}
|
||||
};
|
||||
}
|
||||
//修改豆豆
|
||||
if(typeof(Player.prototype.update_bean) == "undefined"){
|
||||
Player.prototype.update_bean = function(_msg){
|
||||
this.bean = _msg.data.bean;
|
||||
GameUI.setHallStar();
|
||||
//set_self(497,7,C_Player.bean,0,0);
|
||||
//set_self(497,18,get_self(496,18,0,0,0)+get_self(496,20,0,0,0)/2-String(C_Player.bean).length*7,0,0);
|
||||
set_self(510,7,GameData.starName+":"+C_Player.bean,0,0);
|
||||
GameUI.openUpdateBean(_msg.data.text);
|
||||
if(C_Player.seat>-1){//在房间内
|
||||
var pobj = Desk.GetPlayerBySeat(C_Player.seat);
|
||||
pobj.bean = C_Player.bean;
|
||||
pobj = null;
|
||||
if(C_Player.seat == GameData.infoSeat){
|
||||
set_self(511,7,GameData.starName+":"+C_Player.bean,0,0);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
//修改豆豆
|
||||
if(typeof(Player.prototype.update_bean2) == "undefined"){
|
||||
Player.prototype.update_bean2 = function(_bean){
|
||||
this.bean = _bean;
|
||||
GameUI.setHallStar();
|
||||
//set_self(497,7,C_Player.bean,0,0);
|
||||
//set_self(497,18,get_self(496,18,0,0,0)+get_self(496,20,0,0,0)/2-String(C_Player.bean).length*7,0,0);
|
||||
set_self(510,7,GameData.starName+":"+C_Player.bean,0,0);
|
||||
if(C_Player.seat>-1){//在房间内
|
||||
var pobj = Desk.GetPlayerBySeat(C_Player.seat);
|
||||
pobj.bean = C_Player.bean;
|
||||
pobj = null;
|
||||
if(C_Player.seat == GameData.infoSeat){
|
||||
set_self(511,7,GameData.starName+":"+C_Player.bean,0,0);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
//修改豆豆
|
||||
if(typeof(Player.prototype.changeBean) == "undefined"){
|
||||
Player.prototype.changeBean = function(_bean){
|
||||
this.bean = this.initialBean + _bean;
|
||||
GameUI.setHallStar();
|
||||
//set_self(497,7,C_Player.bean,0,0);
|
||||
//set_self(497,18,get_self(496,18,0,0,0)+get_self(496,20,0,0,0)/2-String(C_Player.bean).length*7,0,0);
|
||||
set_self(510,7,GameData.starName+":"+C_Player.bean,0,0);
|
||||
if(C_Player.seat>-1){//在房间内
|
||||
var pobj = Desk.GetPlayerBySeat(C_Player.seat);
|
||||
pobj.bean = C_Player.bean;
|
||||
pobj = null;
|
||||
if(C_Player.seat == GameData.infoSeat){
|
||||
set_self(511,7,GameData.starName+":"+C_Player.bean,0,0);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
//设置房卡
|
||||
if(typeof(Player.prototype.setRoomcard) == "undefined"){
|
||||
Player.prototype.setRoomcard = function(_roomcard){
|
||||
this.roomcard = _roomcard;
|
||||
GameUI.setHallRoomCard();
|
||||
};
|
||||
}
|
||||
//设置房卡
|
||||
if(typeof(Player.prototype.addRoomCard) == "undefined"){
|
||||
Player.prototype.addRoomCard = function(value,text){
|
||||
this.roomcard += value;
|
||||
GameUI.setHallRoomCard();
|
||||
if(text){
|
||||
GameUI.Openupdataroomcard(text);
|
||||
}
|
||||
};
|
||||
}
|
||||
if(typeof(Player.prototype.setBean) == "undefined"){
|
||||
Player.prototype.setBean = function(value){
|
||||
this.bean = value;
|
||||
GameUI.setHallStar();
|
||||
};
|
||||
}
|
||||
if(typeof(Player.prototype.addBean) == "undefined"){
|
||||
Player.prototype.addBean = function(value,text){
|
||||
this.bean += value;
|
||||
GameUI.setHallStar();
|
||||
if(text){
|
||||
GameUI.Openupdataroomcard(text);
|
||||
}
|
||||
};
|
||||
}
|
||||
//设置吱口令
|
||||
if(typeof(Player.prototype.setPayCode) == "undefined"){
|
||||
Player.prototype.setPayCode = function(_paycode){
|
||||
if(_paycode){
|
||||
this.paycode = _paycode;//吱口令
|
||||
}else{
|
||||
this.paycode = "";//吱口令
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
//绑定邀请码
|
||||
if(typeof(Player.prototype.binding_invitecode) == "undefined"){
|
||||
Player.prototype.binding_invitecode = function(_msg){
|
||||
|
||||
if(_msg.data.state == 0){
|
||||
this.invitecode = _msg.data.invitecode;
|
||||
}
|
||||
GameUI.OpenTips(_msg.data.error,ConstVal.Tips.time);
|
||||
|
||||
};
|
||||
}
|
||||
//设置牌桌内玩家数据
|
||||
if(typeof(Player.prototype.SetDeskInfo) == "undefined"){
|
||||
Player.prototype.SetDeskInfo = function(_data,bTemp){
|
||||
this.playerid=_data.playerid;
|
||||
this.nickname=_data.nickname;
|
||||
this.avatar=_data.avatar;
|
||||
this.sex=_data.sex;
|
||||
this.ip=_data.ip;
|
||||
this.onstate=_data.onstate;
|
||||
this.bean = _data.bean;
|
||||
if(!bTemp){
|
||||
this.initialBean = _data.bean;//玩家豆子初始值
|
||||
}else{
|
||||
this.initialBean = _data.initialBean;//玩家豆子初始值
|
||||
}
|
||||
this.isprepare = _data.isprepare;//玩家是否准备
|
||||
if(_data.paycode){
|
||||
this.paycode = _data.paycode;
|
||||
}else{
|
||||
this.paycode = "";
|
||||
}
|
||||
this.charm = _data.charm;
|
||||
this.sign = _data.sign;
|
||||
};
|
||||
}
|
||||
//获取牌桌内玩家数据
|
||||
if(typeof(Player.prototype.getDeskInfo) == "undefined"){
|
||||
Player.prototype.getDeskInfo = function(){
|
||||
var rValue = {};
|
||||
rValue.playerid=this.playerid;
|
||||
rValue.nickname=this.nickname;
|
||||
rValue.avatar=this.avatar;
|
||||
rValue.sex=this.sex;
|
||||
rValue.ip=this.ip;
|
||||
rValue.onstate=this.onstate;
|
||||
rValue.bean = this.bean;
|
||||
rValue.initialBean = this.initialBean;//玩家豆子初始值
|
||||
rValue.isprepare = this.isprepare;//玩家是否准备
|
||||
if(this.paycode){
|
||||
rValue.paycode = _data.paycode;
|
||||
}else{
|
||||
rValue.paycode = "";
|
||||
}
|
||||
rValue.charm = this.charm;
|
||||
return rValue;
|
||||
};
|
||||
}
|
||||
//房间解散
|
||||
if(typeof(Player.prototype.BreakRoom) == "undefined"){
|
||||
Player.prototype.BreakRoom = function(){
|
||||
this.seat = -1; //座位号
|
||||
this.state = -1;//玩家状态0->默认值 1->申请解散 2->同意解散 3->拒绝解散
|
||||
this.status = 0;//0->默认值 1->房主 2->非房主
|
||||
this.isStart = false;//能否点击按钮开始游戏
|
||||
//this.paycode = "";
|
||||
};
|
||||
}
|
||||
//申请解散房间
|
||||
if(typeof(Player.prototype.ApplyBreakRoom) == "undefined"){
|
||||
Player.prototype.ApplyBreakRoom = function(){
|
||||
this.state = 0;//玩家状态0->默认值 1->申请解散 2->同意解散 3->拒绝解散
|
||||
};
|
||||
}
|
||||
//同意解散房间
|
||||
if(typeof(Player.prototype.AgreeBreakRoom) == "undefined"){
|
||||
Player.prototype.AgreeBreakRoom = function(){
|
||||
this.state = 1;//玩家状态0->默认值 1->申请解散 2->同意解散 3->拒绝解散
|
||||
};
|
||||
}
|
||||
//拒绝解散房间
|
||||
if(typeof(Player.prototype.RefuseBreakRoom) == "undefined"){
|
||||
Player.prototype.RefuseBreakRoom = function(){
|
||||
this.state = 2;//玩家状态0->默认值 1->申请解散 2->同意解散 3->拒绝解散
|
||||
};
|
||||
}
|
||||
//更改玩家是否可以直接退出
|
||||
if(typeof(Player.prototype.ChangeExit) == "undefined"){
|
||||
Player.prototype.ChangeExit = function(v){
|
||||
this.canexit = v;
|
||||
switch(v){
|
||||
case 1:
|
||||
if(this.status == 1){
|
||||
set_self(181,43,4,0,0);
|
||||
}else{
|
||||
set_self(181,43,3,0,0);
|
||||
}
|
||||
|
||||
break;
|
||||
case 0:
|
||||
GameUI.hideExitBtn();
|
||||
set_self(181,43,1,0,0);
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
//更改玩家通话状态
|
||||
if(typeof(Player.prototype.phonestate) == "undefined"){
|
||||
Player.prototype.phonestate = function(state){
|
||||
state=Number(state);
|
||||
C_Player.onstate=state;
|
||||
var pobj=Desk.GetPlayerBySeat(C_Player.seat);
|
||||
if(!pobj){return;}
|
||||
pobj.onstate=state;
|
||||
GameUI.SetOnState(C_Player.seat.seat,state);
|
||||
switch(state){
|
||||
case 0://挂断
|
||||
var data={};
|
||||
data.agentid=GameData.AgentId;
|
||||
data.gameid=GameData.GameId;
|
||||
data.playerid=C_Player.playerid;
|
||||
data.roomcode=Desk.roomcode;
|
||||
Net.Send_hangup_phone(data);
|
||||
break;
|
||||
case 1://接起电话
|
||||
var data={};
|
||||
data.agentid=GameData.AgentId;
|
||||
data.gameid=GameData.GameId;
|
||||
data.playerid=C_Player.playerid;
|
||||
data.roomcode=Desk.roomcode;
|
||||
Net.Send_call_phone(data);
|
||||
break;
|
||||
case 2://电话进来
|
||||
var data={};
|
||||
data.agentid=GameData.AgentId;
|
||||
data.gameid=GameData.GameId;
|
||||
data.playerid=C_Player.playerid;
|
||||
data.roomcode=Desk.roomcode;
|
||||
Net.Send_call_phone(data);
|
||||
break;
|
||||
case 3://去电
|
||||
var data={};
|
||||
data.agentid=GameData.AgentId;
|
||||
data.gameid=GameData.GameId;
|
||||
data.playerid=C_Player.playerid;
|
||||
data.roomcode=Desk.roomcode;
|
||||
Net.Send_call_phone(data);
|
||||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
//更改玩家任务提醒状态
|
||||
if(typeof(Player.prototype.ChangeTaskstate) == "undefined"){
|
||||
Player.prototype.ChangeTaskstate = function(v){
|
||||
this.taskstate = v;
|
||||
};
|
||||
}
|
||||
//分享回调
|
||||
if(typeof(Player.prototype.sharesuccess) == "undefined"){
|
||||
Player.prototype.sharesuccess = function(success,type){
|
||||
|
||||
if(success==2 && type == 2){//分享成功
|
||||
var data={};
|
||||
data.agentid=GameData.AgentId;
|
||||
data.playerid=this.playerid;
|
||||
data.taskid=ConstVal.ShareTaskId;
|
||||
Net.Send_player_finish_task(data);
|
||||
|
||||
}else{
|
||||
//GameUI.OpenTips("分享失败!",ConstVal.Tips.time);
|
||||
}
|
||||
if(success == 2 && GameData.shareFrom == 1){//截图分享成功
|
||||
try{
|
||||
GameData.shareTimes++;
|
||||
if(isArray(GameData.hallConfig.actData)){
|
||||
if(GameData.hallConfig.actData[1] == 0){//活动关闭
|
||||
return;
|
||||
}
|
||||
switch(GameData.activityType){//
|
||||
case 1://大赢家
|
||||
if(GameData.shareTimes == 1){
|
||||
var sendUrl = GameData.hallConfig.actData[3];
|
||||
var event = 3;
|
||||
Logic.sendToWeb2(sendUrl,event);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
//if(!isArray(GameData.hallConfig.activity)){//
|
||||
|
||||
//return;
|
||||
//}else{
|
||||
//if(GameData.hallConfig.activity.length>=5){
|
||||
//if(GameData.hallConfig.activity[4] == 0){
|
||||
//return;
|
||||
//}
|
||||
//}
|
||||
//}
|
||||
|
||||
//logmessage("大赢家截图分享成功!"+GameData.shareTimes+"、"+GameData.activityType,1);
|
||||
//switch(GameData.activityType){//
|
||||
//case 1://大赢家
|
||||
//if(GameData.shareTimes == 1){
|
||||
//var sendUrl = "http://discount.0791ts.cn/api/add_game_times";
|
||||
//var actId = 1;
|
||||
|
||||
//if(GameData.hallConfig.activity.length > 5){
|
||||
//sendUrl = GameData.hallConfig.activity[6];
|
||||
//actId = GameData.hallConfig.activity[7];
|
||||
//}
|
||||
//Logic.sendToWeb(sendUrl,actId);
|
||||
//}
|
||||
//break;
|
||||
//}
|
||||
}catch(e){
|
||||
|
||||
}
|
||||
}
|
||||
GameData.activityType = 0;
|
||||
GameData.activityData = null;
|
||||
|
||||
};
|
||||
}
|
||||
//有
|
||||
if(typeof(Player.prototype.player_finish_task) == "undefined"){
|
||||
Player.prototype.player_finish_task = function(_msg){
|
||||
if(_msg.data.state==1 && C_Player.taskstate==0){
|
||||
C_Player.taskstate=1;
|
||||
}
|
||||
};
|
||||
}
|
||||
//领取任务奖励
|
||||
if(typeof(Player.prototype.get_task_award) == "undefined"){
|
||||
Player.prototype.get_task_award = function(_msg){
|
||||
for(var i=0;i<TaskInfo.length;i++){
|
||||
if(TaskInfo[i].taskid == _msg.data.taskid){
|
||||
TaskInfo[i].state = 2;
|
||||
}
|
||||
}
|
||||
this.taskstate=_msg.data.taskstate;
|
||||
GameUI.CloseTask();
|
||||
GameUI.OpenTask();
|
||||
|
||||
};
|
||||
}
|
||||
//设置是否已初始化密码
|
||||
if(typeof(Player.prototype.setBankPwd) == "undefined"){
|
||||
Player.prototype.setBankPwd = function(value){
|
||||
this.bankpwd = value;
|
||||
};
|
||||
}
|
||||
//设置库存星星数量
|
||||
if(typeof(Player.prototype.setWareHouseStarCOunt) == "undefined"){
|
||||
Player.prototype.setWareHouseStarCOunt = function(count){
|
||||
if(count){
|
||||
this.wareHouseStarCount = Number(count);
|
||||
}else{
|
||||
this.wareHouseStarCount = 0;
|
||||
}
|
||||
GameUI.setNumberImage(3033,C_Player.wareHouseStarCount,27);//仓库库存数量
|
||||
};
|
||||
}
|
||||
|
||||
//设置魅力值
|
||||
if(typeof(Player.prototype.setCharm) == "undefined"){
|
||||
Player.prototype.setCharm = function(count){
|
||||
this.charm = count;
|
||||
if(this.seat>-1){//在房间内
|
||||
if(this.seat == GameData.infoSeat){
|
||||
set_self(3125,7,GameData.sysConfig.charmName+":"+count,0,0);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
//设置魅力值
|
||||
if(typeof(Player.prototype.setSign) == "undefined"){
|
||||
Player.prototype.setSign = function(sign){
|
||||
this.sign = sign;
|
||||
GameUI.setSign(sign);
|
||||
GameUI.closeTextInput();
|
||||
};
|
||||
}
|
||||
if(typeof(Player.prototype.updateHallData) == "undefined"){
|
||||
Player.prototype.updateHallData = function(data){
|
||||
this.setSign(data.sign);
|
||||
this.setRoomcard(data.roomcard);
|
||||
this.update_bean2(data.bean);
|
||||
};
|
||||
}
|
||||
if(typeof(Player.prototype.returnHallData) == "undefined"){
|
||||
Player.prototype.returnHallData = function(data){
|
||||
var obj={};
|
||||
obj.sign = this.sign;
|
||||
obj.roomcard = this.roomcard;
|
||||
obj.bean = this.bean;
|
||||
return obj;
|
||||
};
|
||||
}
|
||||
|
||||
//设置手机号
|
||||
if(typeof(Player.prototype.setTel) == "undefined"){
|
||||
Player.prototype.setTel = function(val){
|
||||
this.tel = val;
|
||||
// set_self(3256,43,2,0,0);
|
||||
// play_ani(0,3256,35,255,100,0,1000,0,0,0,0,0,1);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
1425
codes/games/client/Projects/guanpai-jx/js/00_Surface/07_Desk.js
Normal file
1425
codes/games/client/Projects/guanpai-jx/js/00_Surface/07_Desk.js
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
886
codes/games/client/Projects/guanpai-jx/js/00_Surface/09_Net.js
Normal file
886
codes/games/client/Projects/guanpai-jx/js/00_Surface/09_Net.js
Normal file
@@ -0,0 +1,886 @@
|
||||
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);
|
||||
}
|
||||
|
||||
610
codes/games/client/Projects/guanpai-jx/js/00_Surface/10_Game.js
Normal file
610
codes/games/client/Projects/guanpai-jx/js/00_Surface/10_Game.js
Normal file
@@ -0,0 +1,610 @@
|
||||
var Game=Game||{};
|
||||
|
||||
Game.submit_location = function(_msg){
|
||||
GameData.submitLocation = true;
|
||||
if(_msg.data.wechat_gzh){
|
||||
GameData.wechat_gzh = _msg.data.wechat_gzh;
|
||||
set_self(340,41,0,0,0);
|
||||
set_self(340,7,GameData.wechat_gzh,0,0);
|
||||
set_self(339,20,GameData.wechat_gzh.gblen()*13,0,0);
|
||||
set_self(340,18,get_self(16,18,0,0,0)+get_self(16,20,0,0,0)/2-GameData.wechat_gzh.gblen()*6.5,0,0);
|
||||
set_self(339,18,get_self(16,18,0,0,0)+get_self(16,20,0,0,0)/2-GameData.wechat_gzh.gblen()*6.5,0,0);
|
||||
}
|
||||
if(_msg.data.wechat_ewm){
|
||||
GameData.wechat_ewm=_msg.data.wechat_ewm;
|
||||
}
|
||||
if(_msg.data.wechat_kfh){
|
||||
GameData.wechat_kfh=_msg.data.wechat_kfh;
|
||||
set_self(179,7,GameData.wechat_kfh,0,0);
|
||||
}
|
||||
if(_msg.data.qq){
|
||||
GameData.qq=_msg.data.qq;
|
||||
set_self(682,7,GameData.qq,0,0);
|
||||
}
|
||||
if(_msg.data.tel){
|
||||
GameData.tel=_msg.data.tel;
|
||||
set_self(GameData.telSpid,20,String(GameData.tel).gblen()*14,0,0);
|
||||
set_self(GameData.telSpid,7,GameData.tel,0,0);
|
||||
}
|
||||
if(_msg.data.invitecode){
|
||||
C_Player.setInvitecod(_msg.data.invitecode);
|
||||
GameUI.CloseBind();
|
||||
}
|
||||
|
||||
}
|
||||
//游戏其他信息
|
||||
//Game.mainSceneInfo = {};
|
||||
var recorderManager;
|
||||
var innerAudioContext1;
|
||||
|
||||
/**
|
||||
* ?????????? mdata ??????
|
||||
* openId,avatarUrl,nickName, gender, city, province, unionId
|
||||
*/
|
||||
function getwxuserinfo(mdata) {
|
||||
sharelogin(mdata.openId,mdata.avatarUrl,mdata.nickName,mdata.gender,mdata.city,mdata.province,mdata.unionId)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ????????
|
||||
*/
|
||||
function wxgameshow(mdata) {
|
||||
appservice(1);
|
||||
}
|
||||
/**
|
||||
* ????????
|
||||
*/
|
||||
function wxgamehide(mdata) {
|
||||
appservice(2);
|
||||
}
|
||||
/**
|
||||
* ?????? state ???? 1 ?? 2 ??
|
||||
*/
|
||||
function sharegameinfo(state) {
|
||||
//if (state == 1) {
|
||||
|
||||
//}
|
||||
//if (state == 2) {
|
||||
|
||||
//}
|
||||
state = Number(state);
|
||||
//type = Number(type);
|
||||
C_Player.sharesuccess(state,1);
|
||||
|
||||
|
||||
}
|
||||
//Recorderload();
|
||||
|
||||
|
||||
/**
|
||||
* ???????
|
||||
*/
|
||||
function Recorderload(){
|
||||
if(!innerAudioContext1){
|
||||
innerAudioContext1 = wx.createInnerAudioContext();
|
||||
}
|
||||
var that = this;
|
||||
recorderManager=wx.getRecorderManager()
|
||||
recorderManager.onError(function(){
|
||||
|
||||
console.log("????!");
|
||||
});
|
||||
recorderManager.onStop(function(res){
|
||||
|
||||
console.log(res.tempFilePath );
|
||||
|
||||
console.log("????!");
|
||||
//playRecord(res.tempFilePath);
|
||||
getaudiourl(res.tempFilePath,5);
|
||||
});
|
||||
|
||||
|
||||
//innerAudioContext1.onError((res) => {
|
||||
//console.log("??????!");
|
||||
|
||||
//})
|
||||
//innerAudioContext1.onEnded((res) => {
|
||||
//console.log("??????!");
|
||||
//})
|
||||
innerAudioContext1.onError(function(res){
|
||||
console.log("??????!");
|
||||
|
||||
})
|
||||
innerAudioContext1.onEnded(function(res){
|
||||
console.log("??????!");
|
||||
})
|
||||
}
|
||||
/**
|
||||
* ??????????
|
||||
*/
|
||||
function isxiaowxgame(){
|
||||
var iswxgame;
|
||||
try{
|
||||
var recorderManager = wx.getRecorderManager();
|
||||
iswxgame=true;
|
||||
}catch(e){
|
||||
iswxgame=false;
|
||||
}
|
||||
return iswxgame;
|
||||
|
||||
}
|
||||
function wxauthorize(){
|
||||
|
||||
}
|
||||
/**
|
||||
* ????
|
||||
*/
|
||||
function startRecordAac (){
|
||||
console.log("开始录音");
|
||||
recorderManager.start({
|
||||
format: 'aac'
|
||||
});
|
||||
// wx.authorize({
|
||||
// scope: 'scope.record',
|
||||
// fail: function (res) {
|
||||
// // iOS ? Android ????????? errMsg ????,?????????
|
||||
// console.log("????");
|
||||
// console.log(res);
|
||||
// if (res.errMsg.indexOf('auth deny') > -1 || res.errMsg.indexOf('fail') > -1 || res.errMsg.indexOf('auth denied') > -1 ) {
|
||||
// // ???????????
|
||||
// console.log("????");
|
||||
// wx.showModal({
|
||||
// title: '??',
|
||||
// content: '??????????????????->??(?????)->?????->??',
|
||||
// showCancel:false,
|
||||
// success: function (res) {
|
||||
// if (res.confirm) {
|
||||
// console.log('??????')
|
||||
// } else if (res.cancel) {
|
||||
// console.log('??????')
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
// },
|
||||
// success:function (res) {
|
||||
// console.log("????");
|
||||
// recorderManager.start({
|
||||
// format: 'aac'
|
||||
// });
|
||||
// }
|
||||
// })
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* ????
|
||||
*/
|
||||
|
||||
function stopRecord (){
|
||||
console.log("结束录音");
|
||||
// wx.authorize({
|
||||
// scope: 'scope.record',
|
||||
// fail: function (res) {
|
||||
// console.log("fail????");
|
||||
// },
|
||||
// success:function (res) {
|
||||
// console.log("stop????");
|
||||
|
||||
// }
|
||||
// })
|
||||
recorderManager.stop()
|
||||
}
|
||||
/***
|
||||
* ????
|
||||
*/
|
||||
function playRecord (src) {
|
||||
if(!innerAudioContext1){
|
||||
innerAudioContext1 = wx.createInnerAudioContext();
|
||||
}
|
||||
//var that = this;
|
||||
// var src = this.data.src;
|
||||
if (src == '') {
|
||||
console.log("????!");
|
||||
return;
|
||||
}
|
||||
innerAudioContext1.src = src;
|
||||
innerAudioContext1.play()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
var Wxloginbutton;
|
||||
/**
|
||||
* ?????
|
||||
*/
|
||||
function initwxgame() {
|
||||
gameshow();
|
||||
gamehide();
|
||||
}
|
||||
//initwxgame();
|
||||
/**
|
||||
* ???????
|
||||
*/
|
||||
//function gameshow() {
|
||||
//wx.onShow(data => {
|
||||
//console.log("******" + data)
|
||||
//console.log(data)
|
||||
//wxgameshow(data);
|
||||
|
||||
//});
|
||||
//}
|
||||
function gameshow() {
|
||||
wx.onShow(function(data){
|
||||
console.log("******" + data)
|
||||
console.log(data)
|
||||
wxgameshow(data);
|
||||
|
||||
});
|
||||
}
|
||||
/**
|
||||
* ???????
|
||||
*/
|
||||
//function gamehide() {
|
||||
//wx.onHide(data => {
|
||||
//wxgamehide(data)
|
||||
|
||||
//});
|
||||
//}
|
||||
function gamehide() {
|
||||
wx.onHide(function(data){
|
||||
wxgamehide(data)
|
||||
|
||||
});
|
||||
}
|
||||
/*
|
||||
* ?????????
|
||||
* wxgamew ?????? wxgameh ?????? imagex ???????? imagey ???????? imagew???? imageh ???? btnimageurl ????
|
||||
*/
|
||||
function WXgameloginbuttonshow(wxgamew, wxgameh, imagex, imagey, imagew, imageh, btnimageurl) {
|
||||
|
||||
var winh, winw;
|
||||
try {
|
||||
|
||||
|
||||
wx.getSystemInfo({
|
||||
success: function (res) {
|
||||
console.log(res.model)
|
||||
console.log(res.pixelRatio)
|
||||
console.log(res.windowWidth)
|
||||
console.log(res.windowHeight)
|
||||
winh = res.windowHeight;
|
||||
winw = res.windowWidth;
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
var sh = winh / wxgameh;
|
||||
var sw = winw / wxgamew;
|
||||
console.log("sw=" + sw + "sh=" + sh);
|
||||
|
||||
imagew = parseInt(imagew * sw);
|
||||
imageh = parseInt(imageh * sh);
|
||||
imagex = parseInt(imagex * sw);
|
||||
imagey = parseInt(imagey * sh);;
|
||||
|
||||
|
||||
if (wx.createUserInfoButton) {
|
||||
|
||||
|
||||
if (Wxloginbutton) {
|
||||
console.log("??button");
|
||||
Wxloginbutton.show();
|
||||
Wxloginbutton.offTap();//????????
|
||||
|
||||
} else {
|
||||
|
||||
console.log("????button");
|
||||
// console.log(document.title);
|
||||
|
||||
Wxloginbutton = wx.createUserInfoButton({
|
||||
type: 'image',
|
||||
image: btnimageurl,
|
||||
style: {
|
||||
left: imagex,
|
||||
top: imagey,
|
||||
width: imagew,
|
||||
height: imageh
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
//Wxloginbutton.onTap((res) => {
|
||||
|
||||
|
||||
//console.log(res)
|
||||
//if (res.errMsg.indexOf('auth deny') > -1 || res.errMsg.indexOf('auth denied') > -1 || res.errMsg.indexOf('fail') > -1 ) {
|
||||
//wx.showModal({
|
||||
//title: '??',
|
||||
//content: '??????????????????->??(?????)->?????->??',
|
||||
//showCancel: false,
|
||||
//success: function (res) {
|
||||
//if (res.confirm) {
|
||||
//console.log('??????')
|
||||
//} else if (res.cancel) {
|
||||
//console.log('??????')
|
||||
//}
|
||||
//}
|
||||
//})
|
||||
//} else {
|
||||
//WXgameLogin(res);
|
||||
//}
|
||||
//})
|
||||
Wxloginbutton.onTap(function(res){
|
||||
|
||||
|
||||
console.log(res)
|
||||
if (res.errMsg.indexOf('auth deny') > -1 || res.errMsg.indexOf('auth denied') > -1 || res.errMsg.indexOf('fail') > -1 ) {
|
||||
wx.showModal({
|
||||
title: '??',
|
||||
content: '??????????????????->??(?????)->?????->??',
|
||||
showCancel: false,
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
console.log('??????')
|
||||
} else if (res.cancel) {
|
||||
console.log('??????')
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
WXgameLogin(res);
|
||||
}
|
||||
})
|
||||
|
||||
} else {
|
||||
// ???????????????????????,???????
|
||||
console.log("????????");
|
||||
wx.showModal({
|
||||
title: '??',
|
||||
content: '????????,???????,??????????????',
|
||||
showCancel:false,
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
console.log('??????')
|
||||
} else if (res.cancel) {
|
||||
console.log('??????')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* ????????
|
||||
*/
|
||||
function WXgameloginbuttonhide() {
|
||||
if (Wxloginbutton) {
|
||||
Wxloginbutton.hide();
|
||||
}
|
||||
}
|
||||
|
||||
function Decrypt(key, iv, word) {
|
||||
// var openDataContext = wx.getOpenDataContext()
|
||||
// openDataContext.postMessage({
|
||||
// text: 'hello',
|
||||
// year: (new Date()).getFullYear()
|
||||
// })
|
||||
|
||||
var murl = "https://games.tscce.cn/wechatsmallgame/encrypt.php";
|
||||
var date = {};
|
||||
date.key = encodeURIComponent(key);
|
||||
date.type = "decrypt";
|
||||
date.iv = encodeURIComponent(iv);
|
||||
date.data = encodeURIComponent(word);
|
||||
|
||||
|
||||
wx.request({
|
||||
url: murl,
|
||||
data: date,
|
||||
method: 'POST',
|
||||
header: {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
},
|
||||
success: function (res) {
|
||||
if (res.statusCode == 200) {
|
||||
|
||||
if (res.data) {
|
||||
var mdata = decodeURIComponent(res.data);
|
||||
console.log('??------' + mdata)
|
||||
mdata = JSON.parse(mdata);
|
||||
|
||||
try {
|
||||
console.log("??");
|
||||
Wxloginbutton.hide();
|
||||
console.log("Wxloginbutton??");
|
||||
getwxuserinfo(mdata);
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
|
||||
// sharelogin(mdata.openId, mdata.avatarUrl, mdata.nickName, mdata.gender, mdata.city, mdata.province, mdata.unionId);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
console.log('??!res.statusCode' + res.statusCode)
|
||||
}
|
||||
},
|
||||
fail: function (res) {
|
||||
console.log('??!')
|
||||
}
|
||||
});
|
||||
}
|
||||
function WXgameLogin(uesrdata) {
|
||||
|
||||
// ??
|
||||
wx.login({
|
||||
|
||||
//success: res => {
|
||||
|
||||
//if (res.code) {
|
||||
//var murl = "https://games.tscce.cn/wechatsmallgame/code2accessToken.php?appid=wxaeeca8ffffa94105" +"&secret=639a292164680d4cd87a024edae21f41"+"&js_code="+res.code;
|
||||
|
||||
//console.log("????res.code=" + res.code);
|
||||
//wx.request({
|
||||
//url: murl,
|
||||
//method: 'GET',
|
||||
//header: {
|
||||
//'content-type': 'application/json'
|
||||
//},
|
||||
//success: function (res) {
|
||||
//console.log('??' + JSON.stringify(res));
|
||||
//console.log('res.statusCode' + res.statusCode);
|
||||
//if (res.statusCode == 200) {
|
||||
//var openid = res.data.openid;
|
||||
//var unionid = res.data.unionid;
|
||||
//var session_key = res.data.session_key;
|
||||
//Decrypt(session_key, uesrdata.iv, uesrdata.encryptedData);
|
||||
|
||||
//} else {
|
||||
//console.log('??!res.statusCode' + res.statusCode)
|
||||
//}
|
||||
//},
|
||||
//fail: function (res) {
|
||||
//console.log('??!')
|
||||
//}
|
||||
//});
|
||||
//}
|
||||
|
||||
//}
|
||||
success: function(res){
|
||||
|
||||
if (res.code) {
|
||||
var murl = "https://games.tscce.cn/wechatsmallgame/code2accessToken.php?appid=wxaeeca8ffffa94105" +"&secret=639a292164680d4cd87a024edae21f41"+"&js_code="+res.code;
|
||||
|
||||
console.log("????res.code=" + res.code);
|
||||
wx.request({
|
||||
url: murl,
|
||||
method: 'GET',
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success: function (res) {
|
||||
console.log('??' + JSON.stringify(res));
|
||||
console.log('res.statusCode' + res.statusCode);
|
||||
if (res.statusCode == 200) {
|
||||
var openid = res.data.openid;
|
||||
var unionid = res.data.unionid;
|
||||
var session_key = res.data.session_key;
|
||||
Decrypt(session_key, uesrdata.iv, uesrdata.encryptedData);
|
||||
|
||||
} else {
|
||||
console.log('??!res.statusCode' + res.statusCode)
|
||||
}
|
||||
},
|
||||
fail: function (res) {
|
||||
console.log('??!')
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
/**
|
||||
* ?????????
|
||||
*/
|
||||
function initgameshareinfo(sharetitle, shareimageurl) {
|
||||
wx.showShareMenu({ withShareTicket: true });
|
||||
//wx.onShareAppMessage(data => {
|
||||
//return {
|
||||
//title: sharetitle,
|
||||
//imageUrl: shareimageurl,
|
||||
//query: '',
|
||||
//success: function (res) {
|
||||
//console.log(res);
|
||||
//console.log('??????');
|
||||
//sharegameinfo(1);
|
||||
//},
|
||||
//fail: function (res) {
|
||||
//console.log('??????');
|
||||
//console.log(res);
|
||||
//sharegameinfo(2);
|
||||
//}
|
||||
//}
|
||||
//})
|
||||
wx.onShareAppMessage(function(data){
|
||||
return {
|
||||
title: sharetitle,
|
||||
imageUrl: shareimageurl,
|
||||
query: '',
|
||||
success: function (res) {
|
||||
console.log(res);
|
||||
console.log('??????');
|
||||
sharegameinfo(1);
|
||||
},
|
||||
fail: function (res) {
|
||||
console.log('??????');
|
||||
console.log(res);
|
||||
sharegameinfo(2);
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
/**
|
||||
* ?????????
|
||||
*/
|
||||
function hidegameshareinfo(sharetitle, shareimageurl) {
|
||||
wx.hideShareMenu();
|
||||
|
||||
}
|
||||
/**
|
||||
* ??????
|
||||
*/
|
||||
function Pullupgameshare(sharetitle, shareimageurl) {
|
||||
wx.shareAppMessage({
|
||||
title: sharetitle,
|
||||
imageUrl: shareimageurl,
|
||||
query: "",
|
||||
success: function (res) {
|
||||
console.log(res);
|
||||
console.log('??????');
|
||||
sharegameinfo(1);
|
||||
|
||||
},
|
||||
fail: function (res) {
|
||||
console.log('??????');
|
||||
console.log(res);
|
||||
sharegameinfo(2);
|
||||
}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* ???????
|
||||
*/
|
||||
function createGameClubButtonimage(mleft, mtop, mwidth, mheight) {
|
||||
var button = wx.createGameClubButton({
|
||||
type: 'image',
|
||||
icon: 'green',
|
||||
style: {
|
||||
left: mleft,
|
||||
top: mtop,
|
||||
width: mwidth,
|
||||
height: mheight
|
||||
}
|
||||
})
|
||||
}
|
||||
// var button = wx.createGameClubButton({
|
||||
// type: 'text',
|
||||
// icon: 'green',
|
||||
// style: {
|
||||
// left: 10,
|
||||
// top: 76,
|
||||
// width: 40,
|
||||
// height: 40
|
||||
// }
|
||||
// })
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
9860
codes/games/client/Projects/guanpai-jx/js/00_Surface/11_GameUI.js
Normal file
9860
codes/games/client/Projects/guanpai-jx/js/00_Surface/11_GameUI.js
Normal file
File diff suppressed because it is too large
Load Diff
2437
codes/games/client/Projects/guanpai-jx/js/00_Surface/12_Logic.js
Normal file
2437
codes/games/client/Projects/guanpai-jx/js/00_Surface/12_Logic.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,242 @@
|
||||
var Game_Config = Game_Config||{};//相关配置
|
||||
Game_Config.Debugger={//调试配置
|
||||
isDebugger : false,// debugger模式下会将所有收发的包输出到控制台(正式发布改为false)
|
||||
AutoLogin : true,//debugger模式下是否需要记住登录状态自动登录(正式发布改为true)
|
||||
isSubmitError : true,//是否需要服务器收集错误信息调试时可根据需要(正式发布改为true)
|
||||
visitorLogin : true,//隐藏式游客登录
|
||||
visiblePay:true,//审核通过后是否显示支付按钮
|
||||
serverType:0,//0->正式服务器 1->测试服务器 2->本地服务器
|
||||
//gameserver:"http://testgame.youlehdyx.com/update_json/ceshi_json.txt"
|
||||
gameserver:"https://tsgames.daoqi88.cn/config/update_jsonv2.txt"
|
||||
};
|
||||
|
||||
Game_Config.Max = {
|
||||
SumOfRoomtype:3,//创建时房间类型roomtype数组长度
|
||||
ShowChat:2000,//聊天停留时间
|
||||
PlayerCnt:3,//房间最大人数
|
||||
group:500,//游戏最大群组号
|
||||
showtime:10,//加载等待最少时间
|
||||
reconnecttime:30000,//唤醒游戏间隔(超过间隔断线重连)
|
||||
Mainnickname:10,//主界面玩家昵称显示长度(字符长度)
|
||||
Infonickname:16//个人信息显示长度(字符长度)
|
||||
|
||||
};
|
||||
Game_Config.Combat = {
|
||||
height:80,//战绩页单行高度高度
|
||||
up_y:190,//战绩页裁剪y坐标
|
||||
bannerheight:60,//战绩横幅高度
|
||||
bannery:80,//战绩横幅Y左边(相对48精灵)
|
||||
btnbg:50
|
||||
};
|
||||
Game_Config.Info = {
|
||||
Mainnickname:6,//游戏主界面玩家信息显示最大长度(字符)
|
||||
textwidth_1:12.5,//聊天显示文字的宽度(未改动聊天显示文字大小无需改动无需修改)
|
||||
textwidth_2:12.5,//聊天显示文字的宽度(未改动聊天显示文字大小无需改动无需修改)
|
||||
otherPositionDefault:true,//其他主界面玩家信息(昵称、积分)是否采用默认对齐方式对齐居中点为头像中点
|
||||
myPositionDefault:true,//其他主界面玩家信息(昵称、积分)是否采用默认对齐方式对齐居中点为头像中点
|
||||
myPosition:75,//自己信息对齐点(根据游戏界面自行修改)
|
||||
position:[],//其他主界面玩家信息(昵称、积分)居中对齐的x坐标 注意是其他玩家不包括自己从下家开始
|
||||
TextContent:["嫩真好喂打牌!","打的恶过下特!","晓得的嫩狼打牌个!","快级出牌、快级出牌哦,等的压里!","笔想恰愣里!","有奖放奖和!","不好意思,等两分钟马上来!"],//常用语内容
|
||||
TextContentMp3:["","","","","","",""],//常用语对应音效
|
||||
};
|
||||
Game_Config.Share={//分享参数
|
||||
appdownload:"",//下载链接(无需配置,从服务器获取)
|
||||
title:"关牌",//(分享标题)
|
||||
description:"关牌",//分享描述
|
||||
gameTitle:"",//游戏中的分享标题模板工程会自动将游戏名字分享出去、不必写在这个变量里
|
||||
gameDescription:""//游戏中分享描述
|
||||
};
|
||||
Game_Config.Chat={//游戏内聊天配置信息
|
||||
LimitLength:40,//聊天最大长度(字节长度)
|
||||
textwidth:12.5,//聊天显示文字的宽度(未改动聊天显示文字大小无需改动无需修改)
|
||||
ChatDis:[30,12],//聊天气泡与内容的间隔0位置左右间隔(最好不要低于30)1位置上下间隔
|
||||
isLeft:[1,0,1,1,1],//聊天气泡是否为以左边为基准线
|
||||
ChatLoc:[[100,480],[1180,153],[93,153],[185,192],[175,315]]//聊天气泡的基准点位置(注意是基准点位置!)
|
||||
|
||||
};
|
||||
Game_Config.Voice={//游戏内聊天配置信息
|
||||
VoiceTime:600,//播放语音动画的时间一般情况无需无需修改
|
||||
VoiceDis:[30,12],//语音气泡与内容的间隔0位置左右间隔(最好不要低于30)1位置上下间隔
|
||||
isLeft:[1,0,1,1,1],//气泡是否为以左边为基准线
|
||||
VoiceLoc:[[100,480],[1180,153],[93,153],[185,192],[175,315]]//气泡的基准点位置(注意是基准点位置!)
|
||||
};
|
||||
Game_Config.Setting={
|
||||
Ads1:"本游戏仅为娱乐休\n闲使用,房卡所有\n 游戏通用\n\n游戏问题请联系微\n 信公众号:\n",
|
||||
//Ads2:"\n 或客服号:\n",
|
||||
board:"",//从后台获取设置无效
|
||||
//info:[" 客服信息","QQ:","",""],//客服QQ提醒
|
||||
info:[" 客服信息","QQ:","手机:","微信:"],//客服QQ提醒
|
||||
board_blength:24,//通知页面一行最大字节数(无需设置)
|
||||
charge:"关注友乐微信公众号充值",//充值提示
|
||||
};
|
||||
Game_Config.Protocol={
|
||||
x:270,//协议图片初始x坐标
|
||||
y:70,//协议图片初始y坐标
|
||||
h:560,//协议图片显示高度
|
||||
w:729//协议图片显示宽度
|
||||
};
|
||||
Game_Config.Help={//帮助
|
||||
x:240,//帮助图片初始x坐标
|
||||
y:170,//帮助图片初始y坐标
|
||||
w:820,//帮助图片显示高度
|
||||
h:460//帮助图片显示宽度
|
||||
};
|
||||
Game_Config.Notice={//滚动公告
|
||||
x1:0,//无需设置
|
||||
x2:0,//无需设置
|
||||
y:0,//无需设置
|
||||
h:0,//无需设置
|
||||
//以上参数用来截取滚动公告的显示,截取位置是与滚动公告底大小位置一致
|
||||
speed:0.1,//滚动公告的滚动速度
|
||||
width:15//滚动公告的内容字体的字节长度(汉字是两个字节)
|
||||
};
|
||||
Game_Config.Feedback = {//反馈配置
|
||||
maxLen:250 //反馈内容最大长度
|
||||
};
|
||||
Game_Config.shakeList ={//摇一摇事件的回调ID、需要添加时在此处添加回调事件写在Utl_Input.js中的Utl.shakeEvent()中
|
||||
nil:0,
|
||||
startwar:1
|
||||
};
|
||||
Game_Config.soundList ={//声音资源名
|
||||
MenuSceneMusic:"00188.mp3",//大厅界面背景音
|
||||
MainSceneMusic:"00187.mp3"//游戏主界面背景音
|
||||
//Button:""//按钮音效
|
||||
};
|
||||
Game_Config.ClickButton = {//需要设置点击音效的按钮(只有有弹窗的按钮设置此音效有效、按钮已经设置好、子游戏不允许修改)
|
||||
src_1:"",//点击时播放的声音资源文件( 不需要播放则不填,下同)
|
||||
src_2:""//弹窗时播放的音效
|
||||
}
|
||||
//Game_Config.gameConfig = {//游戏配置
|
||||
//gameMode:0,//游戏模式
|
||||
//};
|
||||
Game_Config.loginButton = {//登录按钮信息
|
||||
x1:415,//非审核版本微信登录按钮x
|
||||
x2:113,//审核版本微信登录按钮x
|
||||
x3:488,//审核版本游客登录按钮x
|
||||
};
|
||||
|
||||
Game_Config.sysConfig = {
|
||||
mainMenuButton:false,//是否进入主菜单界面隐藏四个按钮
|
||||
mainScenePlayerInfo:false,//是否隐藏主界面玩家信息
|
||||
mainSceneButton:false,//是否隐藏主界面按钮
|
||||
shareRoom:false,//接收到星星场是否屏蔽平台框架显示
|
||||
changeSeat:false,//是否屏蔽平台自动刷新换座后界面
|
||||
hideNotice:false,//隐藏公告栏
|
||||
vipInfinite:false,//vip房是否默认开启无限局
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,451 @@
|
||||
|
||||
|
||||
|
||||
Game_Modify.StartWar=function(_msg){//开战
|
||||
gp_ui_kaizhan();
|
||||
Utl.changePlayerState(0);
|
||||
huifang=0;
|
||||
}
|
||||
Game_Modify._ReceiveData=function(_msg){//接收数据包
|
||||
set_level (101,1);
|
||||
gp_sfb(_msg);
|
||||
}
|
||||
Game_Modify.createRoom=function(_roomtype,_infinite){//创建房间
|
||||
GameUI.openRoomInfo();
|
||||
}
|
||||
Game_Modify.myJoinRoom=function(_msg){//自己进入房间
|
||||
if (Utl.getIsInfinite() == 1) {//如果是无限局
|
||||
for (var i = 0; i < _msg.data.players.length; i++) {
|
||||
Utl.setGrade(i,Desk.GetPlayerBySeat(i).bean);
|
||||
}
|
||||
}
|
||||
GameUI.openRoomInfo();
|
||||
}
|
||||
Game_Modify.Reconnect=function(_deskinfo){//重连
|
||||
set_self(291,57,35,0,0);
|
||||
game = _deskinfo;
|
||||
game.suoyoupai = _deskinfo.pai;
|
||||
if(Utl.getIsDebugger() == 1)
|
||||
{
|
||||
game.pai = _deskinfo.pai[Utl.getMySeat()];
|
||||
}
|
||||
game.tuoguan = game.tuoguan[Utl.getMySeat()];
|
||||
|
||||
//game.difen = GameData.gameConfig.difen[_deskinfo.leixing[4]-1];
|
||||
game.xs_paishu = [];
|
||||
for(var i = 0;i<_deskinfo.carlen.length;i++){
|
||||
game.xs_paishu[i] = _deskinfo.carlen[i];
|
||||
}
|
||||
game.ersansi = [1017,1034,1051,1068];
|
||||
if ( game.leixing[3]==2) {
|
||||
if (game.laizi ==14 ) {
|
||||
game.laizi = 1;
|
||||
}else if(game.laizi ==15 ) {
|
||||
game.laizi = 2;
|
||||
}
|
||||
}else {
|
||||
game.laizi = 0;
|
||||
game.laizi_bian = [[],[],[]]
|
||||
}
|
||||
if (Utl.getIsInfinite() == 1) {//如果是无限局
|
||||
if(_deskinfo.zhuangtai == 1){
|
||||
Utl.setDeskStage(1);
|
||||
}else{
|
||||
Utl.setDeskStage(0);
|
||||
for (var i = 0; i < 3; i++) {
|
||||
if (Utl.getPlayerReadyState(i) == 1) {//是否准备
|
||||
Utl.setPlayerPrepare(i,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < game.people; i++) {
|
||||
Utl.setGrade(i,Desk.GetPlayerBySeat(i).bean);
|
||||
}
|
||||
}
|
||||
if (game.zhuangtai>0&&game.zhuangtai<4) {
|
||||
huifang=0;
|
||||
}
|
||||
gp_chonglian();
|
||||
}
|
||||
Game_Modify.stopAllSounds=function(){//关闭所有声音 (游戏声音)
|
||||
|
||||
}
|
||||
Game_Modify.Free=function(_msg){//投票解散结果为同意时,点击结果界面确认的按钮时触发
|
||||
if (game.zhuangtai == 1) {
|
||||
game.jushu[0] = game.jushu[0]-1;
|
||||
}
|
||||
game.zhuangtai = 3;
|
||||
kg=2;
|
||||
game.grade = _msg.data.grade;
|
||||
game.quanbufen = _msg.data.quanbufen;
|
||||
gp_ui_daju();
|
||||
}
|
||||
Game_Modify.DeskInfo=function(_msg){//开战状态下自己加入是牌桌数据
|
||||
if(_msg.zhuangtai == 1){
|
||||
Utl.setDeskStage(1);
|
||||
}else{
|
||||
Utl.setDeskStage(0);
|
||||
Utl.setPlayerPrepare(Utl.getMySeat(), 0);
|
||||
}
|
||||
}
|
||||
Game_Modify.breakRoom=function(){//游戏已开局情况下自己退出房间触发
|
||||
|
||||
}
|
||||
|
||||
Game_Modify.playerJoinRoom=function(seat){//其他玩家加入房间
|
||||
if (Utl.getIsInfinite() == 0) {//如果bu是无限局
|
||||
if (seat == 0) {
|
||||
set_group(219,37,0,0,0);
|
||||
set_self(1135+Utl.changeToStatus(0),37,1,0,0);
|
||||
}
|
||||
}else {
|
||||
Utl.setGrade(seat,Desk.GetPlayerBySeat(seat).bean);
|
||||
if (Utl.getPlayerReadyState(seat) == 1) {//是否准备
|
||||
Utl.setPlayerPrepare(seat,1);
|
||||
}else {
|
||||
Utl.setPlayerPrepare(seat,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Game_Modify.playerLeaveRoom=function(seat){//其他玩家离开房间
|
||||
if (seat == 0) {
|
||||
set_group(219,37,0,0,0);
|
||||
//set_self(1135+Utl.changeToStatus(0),37,1,0,0);
|
||||
}
|
||||
}
|
||||
Game_Modify.updateScene = function(){//更新游戏界面
|
||||
//根据本地数据重新显示界面
|
||||
if (huifang == 0) {
|
||||
gp_chonglian();
|
||||
}
|
||||
}
|
||||
Game_Modify.closeGameScene=function(){//关闭游戏界面
|
||||
|
||||
}
|
||||
Game_Modify.playerOffline = function(seat){//玩家离线
|
||||
|
||||
}
|
||||
Game_Modify.playerOnline = function(seat){//玩家上线
|
||||
|
||||
}
|
||||
Game_Modify.playerphonestate = function(seat,type){//玩家电话状态type->挂断1->接打电话、有电话进来的状态
|
||||
|
||||
}
|
||||
Game_Modify.shakeEvent = function(){
|
||||
switch(GameData.shakeID){
|
||||
case Game_Config.shakeList.startwar://摇一摇开战(如果有主动开战)
|
||||
var data={};
|
||||
data.agentid=GameData.AgentId;
|
||||
data.gameid=GameData.GameId;
|
||||
data.playerid=C_Player.playerid;
|
||||
data.roomcode=Desk.roomcode;
|
||||
Net.Send_self_makewar(data);
|
||||
Func.stopshake();
|
||||
GameData.shakeID=Game_Config.shakeList.nil;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Game_Modify.calResult = function(inputArr){
|
||||
var xsd = [];
|
||||
for (var i=0;i<game.people;i++) {
|
||||
xsd[i] = min_replaceAll(String(ifast_abs(inputArr[i])),'\\.', 'b', '');
|
||||
}
|
||||
var input_mul = min_replaceAll(String(GameData.Multiple), "b", ".", false);
|
||||
input_mul = Number(input_mul);
|
||||
if(input_mul==0){
|
||||
input_mul = 1;
|
||||
}
|
||||
for (var i=0;i<game.people;i++) {
|
||||
//xsd[i]=game.grade[i]*input_mul;
|
||||
set_self(1541+i,20,30*ifast_inttostr(xsd[i]).length,0,0);
|
||||
set_self(1541+i,7,xsd[i]);
|
||||
set_self(1541+i,18,get_self(1537+i,18)+36-15*ifast_inttostr(ifast_abs(inputArr[i])).length,0,0);
|
||||
set_self(1545+i,7,"x"+input_mul);
|
||||
set_self(1545+i,18,375+334*i-7*ifast_inttostr(input_mul).length,0,0);
|
||||
if(inputArr[i]<0) //显示zong分
|
||||
{
|
||||
set_self(1549+i,37,1);
|
||||
set_self(1549+i,18,get_self(1541+i,18)-30,0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_self(1549+i,37,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Game_Modify.onEnterMainScene = function(roomtype){//进入游戏主场景
|
||||
set_group(219,37,0,0,0);
|
||||
if (Utl.getIsInfinite() == 1) {//如果是无限局
|
||||
var jbc=1;
|
||||
set_self(1480,7,"("+roomtype[6][0]+"倍;限制"+roomtype[6][1]+")",0,0);
|
||||
set_self(1479,43,jbc,0,0);
|
||||
set_self(1480,37,1,0,0);
|
||||
set_self(1479,37,1,0,0);
|
||||
} else {
|
||||
set_self(1135+Utl.changeToStatus(0),37,1,0,0);
|
||||
}
|
||||
set_self(291,57,35,0,0);
|
||||
}
|
||||
Game_Modify.onExitMainScene = function(){//退出游戏主场景
|
||||
if (Utl.getIsInfinite() == 1) {//如果是无限局
|
||||
Utl.setPlayerPrepare(Utl.getMySeat(), 0);
|
||||
}
|
||||
console.log("退出游戏主场景");
|
||||
}
|
||||
Game_Modify.onGameConfig = function(_gameConfig){//获取到游戏配置时调用(只在game_config有数据时才调用)
|
||||
zhadanfen = _gameConfig.zha;
|
||||
//game.hf_difen = _gameConfig.difen;
|
||||
Game_Modify.Type_1 = [
|
||||
{id:0,des:_gameConfig.numbergames[0]+"局"+"(房卡X"+_gameConfig.buckle[0]+")",roomcard:1,type:1},
|
||||
{id:1,des:_gameConfig.numbergames[1]+"局"+"(房卡X"+_gameConfig.buckle[1]+")",roomcard:2,type:2}
|
||||
];
|
||||
Game_Modify.Type_2 = [
|
||||
{id:0,des:_gameConfig.people[0]+"人",type:1},
|
||||
{id:1,des:_gameConfig.people[1]+"人",type:2}
|
||||
//{id:2,des:_gameConfig.people[2]+"人",type:3}
|
||||
];
|
||||
Game_Modify.Type_3 = [
|
||||
{id:0,des:_gameConfig.zha[0]+"分",type:1},
|
||||
{id:1,des:_gameConfig.zha[1]+"分",type:2},
|
||||
{id:2,des:_gameConfig.zha[2]+"分",type:3},
|
||||
{id:3,des:_gameConfig.zha[3]+"分",type:4}
|
||||
];
|
||||
//Game_Modify.Type_5 = [
|
||||
//{id:0,des:_gameConfig.difen[0]+"分",type:1},
|
||||
//{id:1,des:_gameConfig.difen[1]+"分",type:2}
|
||||
//{id:2,des:_gameConfig.difen[2]+"分",type:3}
|
||||
//];
|
||||
dfpeizhi = _gameConfig.difen; //低分配置
|
||||
xxcbs = _gameConfig.beishu; //星星场倍数
|
||||
xxcxz = _gameConfig.xianzhi; //星星场限制
|
||||
}
|
||||
Game_Modify.onEnterVideo = function(){//进入牌局回放触发
|
||||
huifang = 1;
|
||||
set_level (101,1);
|
||||
for ( var i=1001;i<=1068;i++) {
|
||||
set_self(i,33,50,0,0);
|
||||
}
|
||||
set_self(291,7,Game_Modify.roomDes,0,0);
|
||||
var aaa = game.hf_huifang[game.hf_ju].pai;
|
||||
var bbb = game.hf_playerid.length;
|
||||
var ccc = game.hf_huifang[game.hf_ju].kaijufen;
|
||||
var ddd = game.hf_huifang[game.hf_ju].zhuang;
|
||||
baipai(aaa,bbb);
|
||||
game.jushu = game.hf_huifang[game.hf_ju].jushu;
|
||||
gp_ui_xs_jushu();
|
||||
xs_zongfen(ccc,bbb);
|
||||
hf_shizhong(ddd);
|
||||
set_self(1054,57,2000,0,0);
|
||||
set_self(1139,37,1,0,0);
|
||||
set_self(1140,37,1,0,0);
|
||||
set_self(1140,43,2,0,0);
|
||||
set_self(1141,37,1,0,0);
|
||||
if (game.hf_huifang[game.hf_ju].laizi.length == 0) {
|
||||
set_self(1143,37,0,0,0);
|
||||
}else {
|
||||
set_self(1143,43,(game.hf_huifang[game.hf_ju].laizi-1)%13+1,0,0);
|
||||
set_self(1143,18,567,0,0);
|
||||
set_self(1143,19,-10,0,0);
|
||||
set_self(1143,33,45,0,0);
|
||||
set_self(1143,1,567,0,0);
|
||||
set_self(1143,37,1,0,0);
|
||||
}
|
||||
}
|
||||
Game_Modify.onSurrender = function(_msg){//收到投降回包
|
||||
|
||||
}
|
||||
Game_Modify.onReady = function(seat){//玩家准备触发
|
||||
if (Utl.getIsInfinite() == 1) {//如果是无限局
|
||||
Utl.setPlayerPrepare(seat, 1);
|
||||
}
|
||||
}
|
||||
Game_Modify.getRoomInfo = function(roomtype,type,tea){//tea为茶水费如有此属性且不为undefined或者null茶水费以此为准
|
||||
//通过roomtype获取房间描述每行最多18个字符超过需要自己换行type1系统房间2非系统房间
|
||||
console.log("Game_Modify.getRoomInfo:"+roomtype);
|
||||
return Game_Modify.Type_2[roomtype[1]-1].des+" 底"+roomtype[4]+"分"+
|
||||
" 炸"+Game_Modify.Type_3[roomtype[2]-1].des + " "+Game_Modify.Type_4[roomtype[3]-1].des;
|
||||
}
|
||||
Game_Modify.getStarLimit = function(roomtype){//通过roomtype获取房间星星场下限数量
|
||||
console.log("Game_Modify.getStarLimit:"+roomtype);
|
||||
return roomtype[6][1];
|
||||
}
|
||||
Game_Modify.getMult = function(roomtype,type){//通过roomtype获取房间星星场倍数
|
||||
if(type == 1){
|
||||
return roomtype[6][0];
|
||||
}else{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
Game_Modify.getFullRoomInfo = function(roomtype){//通过roomtype获取房间全部信息描述 每行最多26个字符超过需要自己换行
|
||||
console.log("Game_Modify.getFullRoomInfo:"+roomtype);
|
||||
var xxcjiesao="";
|
||||
if (roomtype[5] == 2) {
|
||||
//xxcjiesao = "\n星星场\n("+roomtype[6][0]+"倍;限制"+roomtype[6][1]+")";
|
||||
}
|
||||
return Game_Modify.Type_1[roomtype[0]-1].des +'\n'+ Game_Modify.Type_2[roomtype[1]-1].des +"\n炸"+Game_Modify.Type_3[roomtype[2]-1].des+" 底"+roomtype[4]+"分"+xxcjiesao
|
||||
+ "\n"+Game_Modify.Type_4[roomtype[3]-1].des + "\n"+Game_Modify.Type_6[roomtype[7]-1].des;;
|
||||
}
|
||||
Game_Modify.onOpenHelp = function(spid){//打开帮助页面触发
|
||||
|
||||
}
|
||||
//显示大厅界面触发
|
||||
Game_Modify.onMainMenuScene = function(){
|
||||
set_self(1054,57,0,0,0);
|
||||
set_self(1075,57,0,0,0);
|
||||
set_self(1061,57,0,0,0);
|
||||
set_self(1060,57,0,0,0);
|
||||
set_self(1053,57,0,0,0);
|
||||
for (var i = 201; i < 223; i++) {
|
||||
set_group(i,37,0,0,0);
|
||||
}for (var i = 301; i < 305; i++) {
|
||||
set_group(i,37,0,0,0);
|
||||
}for (var i = 501; i < 510; i++) {
|
||||
set_group(i,37,0,0,0);
|
||||
}gp_ui_paihuanyuan();
|
||||
}
|
||||
//确认数字输入框回调
|
||||
Game_Modify.onCheckInput = function(_result){
|
||||
console.log(_result);
|
||||
Utl.closeInputPanel();
|
||||
switch (tanchuang){
|
||||
case 0:
|
||||
if(_result<=1)
|
||||
{
|
||||
difen = 1;
|
||||
}
|
||||
else if(_result >= dfpeizhi)
|
||||
{
|
||||
difen = dfpeizhi;
|
||||
}
|
||||
else
|
||||
{
|
||||
difen = _result;
|
||||
}
|
||||
set_self(1392,7,difen+"分"+"(1分~"+dfpeizhi+"分)");
|
||||
break;
|
||||
case 1:
|
||||
if(_result<=xxcbs[0])
|
||||
{
|
||||
xxcshuju[0] = xxcbs[0];
|
||||
xsxianzhi[0] = xxcshuju[0]*xxcxz[0];
|
||||
xsxianzhi[1] = xxcshuju[0]*xxcxz[1];
|
||||
}
|
||||
else if(_result >= xxcbs[1])
|
||||
{
|
||||
xxcshuju[0] = xxcbs[1];
|
||||
xsxianzhi[0] = xxcshuju[0]*xxcxz[0];
|
||||
xsxianzhi[1] = xxcshuju[0]*xxcxz[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
xxcshuju[0] = _result;
|
||||
xsxianzhi[0] = xxcshuju[0]*xxcxz[0];
|
||||
xsxianzhi[1] = xxcshuju[0]*xxcxz[1];
|
||||
}
|
||||
if (xxcshuju[1]<=xsxianzhi[0]) {
|
||||
xxcshuju[1] = xxcshuju[0]*xxcxz[0];
|
||||
}else if (xxcshuju[1]>=xsxianzhi[1]) {
|
||||
xxcshuju[1] = xxcshuju[0]*xxcxz[1];
|
||||
}
|
||||
set_self(1482,7,xxcshuju[0]);
|
||||
set_self(1482,20,24*ifast_inttostr(xxcshuju[0]).length,0,0);
|
||||
set_self(1475,7,"(最小:"+xsxianzhi[0]+"最大:"+xsxianzhi[1]+")",0,0);
|
||||
set_self(1483,7,xxcshuju[1]);
|
||||
set_self(1483,20,24*ifast_inttostr(xxcshuju[1]).length,0,0);
|
||||
break;
|
||||
case 2:
|
||||
if(_result<=xsxianzhi[0])
|
||||
{
|
||||
xxcshuju[1] = xsxianzhi[0];
|
||||
}
|
||||
else if(_result >= xsxianzhi[1])
|
||||
{
|
||||
xxcshuju[1] = xsxianzhi[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
xxcshuju[1] = _result;
|
||||
}
|
||||
set_self(1483,7,xxcshuju[1]);
|
||||
set_self(1483,20,24*ifast_inttostr(xxcshuju[1]).length,0,0);
|
||||
break;
|
||||
case 3:
|
||||
if(_result<=0)
|
||||
{
|
||||
xxcshuju[2] = 0;
|
||||
}
|
||||
else if(_result >= xxccsf)
|
||||
{
|
||||
xxcshuju[2] = xxccsf;
|
||||
}
|
||||
else
|
||||
{
|
||||
xxcshuju[2] = _result;
|
||||
}
|
||||
set_self(1484,7,xxcshuju[2]);
|
||||
set_self(1484,20,24*ifast_inttostr(xxcshuju[2]).length,0,0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Game_Modify.onCreateRoom = function(_data){//无限局创建新桌时返回游戏数据
|
||||
if (Utl.getIsInfinite() == 1) {//如果是无限局
|
||||
Utl.setGrade(Utl.getMySeat(),Desk.GetPlayerBySeat(Utl.getMySeat()).bean);
|
||||
}
|
||||
}
|
||||
Game_Modify.getLeaveLimit = function(roomtype){//获取星星场离场限制
|
||||
return roomtype[6][1];
|
||||
}
|
||||
//成功获取定位信息触发
|
||||
Game_Modify.onLocationInfo = function(_locationInfo){
|
||||
|
||||
}
|
||||
//进入游戏界面创建牌桌之前调用
|
||||
Game_Modify.onCreateDesk = function(roomtype){
|
||||
console.log("onCreateDesk:"+roomtype);
|
||||
}
|
||||
//通过roomtype获取是否开启视频功能0->不开启1->开启
|
||||
Game_Modify.getVideoByRoomType = function(roomtype){
|
||||
return 1;
|
||||
}
|
||||
Game_Modify.getRoomTopDescAry = function(roomtype){
|
||||
//return ["牛几几倍","一副牌","特色玩特色玩法"];
|
||||
if (Utl.getIsInfinite() != 1) {//如果不是无限局
|
||||
if(Game_Modify.roomDes && Game_Modify.roomDes.length>0)
|
||||
{
|
||||
var s=Game_Modify.roomDes.split(") ");
|
||||
s=s[1].split(" ");
|
||||
return [zongju+"局",s[0]+" ",s[1],s[2],s[3],s[4]];
|
||||
}
|
||||
|
||||
return [""];
|
||||
}else {
|
||||
var roomdes =Game_Modify.Type_2[roomtype[1]-1].des+"关牌 底"+roomtype[4]+"分"+
|
||||
" 炸"+Game_Modify.Type_3[roomtype[2]-1].des + " "+Game_Modify.Type_4[roomtype[3]-1].des ;//+ " "+Game_Modify.Type_6[roomtype[7]-1].des
|
||||
var s=roomdes.split(" ");
|
||||
return [s[0]+" ",s[1],s[2],s[3]];//,s[4]
|
||||
}
|
||||
}
|
||||
//星星场房间列表
|
||||
Game_Modify.getShareRoom = function(_msg){
|
||||
|
||||
}
|
||||
//玩家自己退出房间
|
||||
Game_Modify.myExitRoom = function(seat){
|
||||
|
||||
}
|
||||
//接收到换座包触发
|
||||
Game_Modify.changeSeat = function(seat1,seat2){
|
||||
|
||||
}
|
||||
//关闭vip选项时调用
|
||||
Game_Modify.onCloseVip = function(){
|
||||
|
||||
}
|
||||
//判断房间是否为金币场(是金币场返回1否则返回0)
|
||||
Game_Modify.getRoomMode = function(roomtype){
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
//发牌
|
||||
//game.pai.shuffle();
|
||||
//for (var i=0;i<16;i++) {
|
||||
// game.arr[i]=game.pai[i];
|
||||
//}
|
||||
//dxpaixu(game.arr);
|
||||
game.arr = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,17];
|
||||
game.ersansi = [1017,1034,1051,1068];
|
||||
game.people = 2;
|
||||
|
||||
var msg =
|
||||
{
|
||||
rpc : 'fapai',
|
||||
seat : 0,
|
||||
data :
|
||||
{
|
||||
pai : game.arr,
|
||||
control : 0,
|
||||
jushu : [1,4],
|
||||
zhuangtai : 1,
|
||||
carlen : [17,17],
|
||||
laizi : 5,
|
||||
leixing : [1,1,1,2]
|
||||
}
|
||||
}
|
||||
Game_Modify._ReceiveData(msg);
|
||||
|
||||
//打牌
|
||||
|
||||
var msg =
|
||||
{
|
||||
rpc : 'dapai',
|
||||
data :
|
||||
{
|
||||
xs_dapai : [[],[],[],[]],
|
||||
control : 0,
|
||||
seat : 0,
|
||||
paixing : [1,5],
|
||||
zha : [0,0,0],
|
||||
pai : [],
|
||||
put : true,
|
||||
kexuanpai : [[],[],[]],
|
||||
carlen : [0,0],
|
||||
countdown : 15
|
||||
|
||||
}
|
||||
}
|
||||
Game_Modify._ReceiveData(msg);
|
||||
|
||||
//不要
|
||||
var msg =
|
||||
{
|
||||
rpc : 'buyao',
|
||||
data :
|
||||
{
|
||||
xs_dapai : [[],[],[],[]],
|
||||
control : 0,
|
||||
seat : 0,
|
||||
paixing : [1,5],
|
||||
kexuanpai : [[],[],[]],
|
||||
countdown : 15
|
||||
|
||||
}
|
||||
}
|
||||
Game_Modify._ReceiveData(msg);
|
||||
|
||||
//小局结算
|
||||
var msg =
|
||||
{
|
||||
rpc : 'xiaoju',
|
||||
data :
|
||||
{
|
||||
xs_dapai : [[],[],[],[]],
|
||||
grade : [2,-1,-1],
|
||||
xiaojufen : [2,-1,-1],
|
||||
seat : 0,
|
||||
paixing : [1,5],
|
||||
zha : [0,0,0],
|
||||
suoyoupai : [[],[],[],[]],
|
||||
chuntian : [1,0,0],
|
||||
shengli : 0,
|
||||
zhuangtai : 2,
|
||||
prople : 3,
|
||||
difen : 5
|
||||
|
||||
}
|
||||
}
|
||||
Game_Modify._ReceiveData(msg);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,248 @@
|
||||
var gp_chonglian = function(){
|
||||
for (var i=0;i<=3;i++) {
|
||||
set_group(201+i,37,0,0,0);
|
||||
}
|
||||
for (var i=0;i<=10;i++) {
|
||||
set_group(500+i,37,0,0,0);
|
||||
}
|
||||
for (var i=0;i<=6;i++) {
|
||||
set_group(212+i,37,0,0,0);
|
||||
}
|
||||
for (var i=220;i<=223;i++) {
|
||||
set_group(i,37,0,0,0);
|
||||
}
|
||||
set_group(301,37,0,0,0);
|
||||
set_group(302,37,0,0,0);
|
||||
set_group(303,37,0,0,0);
|
||||
set_self(1064,57,0);
|
||||
//if (Desk.roomtype[7]==2) {
|
||||
if (game.tuoguan==1) {
|
||||
set_self(1105,43,2,0,0);set_self(1106,37,1,0,0);set_self(1109,37,1,0,0);set_self(1108,37,1,0,0);
|
||||
//diand=0;
|
||||
}
|
||||
set_self(1105,37,1,0,0);
|
||||
//}
|
||||
gp_ui_paihuanyuan();
|
||||
if (kehuduan == 0) {
|
||||
game.my_seat = 0;
|
||||
}
|
||||
else {
|
||||
game.my_seat = Utl.getMySeat();
|
||||
}
|
||||
switch (game.zhuangtai){
|
||||
case 1:
|
||||
dxpaixu(game.pai,game.laizi);
|
||||
if (game.zha.length>0){
|
||||
for (var i = 0; i<=game.pai.length-1;i++)
|
||||
{
|
||||
set_self(100,18,spx-game.pai.length*spjg/2,0,0);
|
||||
set_self(1001+i,18,get_self(1001,18,0,0,0)+spjg*i,0,0);
|
||||
set_self(1001+i,19,spy,0,0);
|
||||
set_self(1001+i,43,game.pai[i]+1,0,0);
|
||||
set_self(1001+i,37,1,0,0);
|
||||
set_self(1081,18,spx-game.pai.length*spjg/2,0,0);
|
||||
set_self(1081+i,18,get_self(1001,18,0,0,0)+spjg*i,0,0);
|
||||
set_self(1081+i,19,spy,0,0);
|
||||
set_self(1081+i,37,0,0,0);
|
||||
}
|
||||
gp_ui_xschupai();
|
||||
}else {
|
||||
if (kehuduan != 0) {
|
||||
gp_ui_shizhong(game.control);
|
||||
}
|
||||
for (var i = 0; i<=game.pai.length-1;i++)
|
||||
{
|
||||
set_self(1001,18,spx-game.pai.length*spjg/2,0,0);
|
||||
set_self(1001+i,18,get_self(1001,18,0,0,0)+spjg*i,0,0);
|
||||
set_self(1001+i,19,spy,0,0);
|
||||
set_self(1001+i,43,game.pai[i]+1,0,0);
|
||||
set_self(1001+i,37,1,0,0);
|
||||
set_self(1081,18,spx-game.pai.length*spjg/2,0,0);
|
||||
set_self(1081+i,18,get_self(1001,18,0,0,0)+spjg*i,0,0);
|
||||
set_self(1081+i,19,spy,0,0);
|
||||
set_self(1081+i,37,0,0,0);
|
||||
}
|
||||
if (game.control == game.my_seat) //显示按钮
|
||||
{
|
||||
set_group(301,37,1,0,0);
|
||||
set_self(anniu[0],37,0,0,0);
|
||||
set_self(anniu[2],18,550,0,0);
|
||||
set_self(1070,37,0,0,0);
|
||||
}
|
||||
for (var a= 0;a<game.people;a++) {
|
||||
|
||||
switch (Utl.changeToStatus(a))//显示手牌数
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
set_self(1099,37,1,0,0);
|
||||
set_self(1102,37,1,0,0);
|
||||
set_self(1102,7,game.carlen[a],0,0);
|
||||
|
||||
break;
|
||||
case 2:
|
||||
set_self(1100,37,1,0,0);
|
||||
set_self(1103,37,1,0,0);
|
||||
set_self(1103,7,game.carlen[a],0,0);
|
||||
|
||||
break;
|
||||
case 3:
|
||||
set_self(1101,37,1,0,0);
|
||||
set_self(1104,37,1,0,0);
|
||||
set_self(1104,7,game.carlen[a],0,0);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (var i=1102;i<=1104;i++) { //显示手牌数的长度
|
||||
if(get_self(i,7)<10)
|
||||
{
|
||||
set_self(i,20,26,0,0);
|
||||
set_self(i,18,get_self(i-3,18)+19,0,0);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
set_self(i,20,52,0,0);
|
||||
set_self(i,18,get_self(i-3,18)+4,0,0);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
laizi_xs();
|
||||
gp_ui_xs_zongfen();
|
||||
guandonghua();
|
||||
gp_ui_laizibz(game.pai,game.laizi,1001);
|
||||
if (Utl.getIsInfinite() == 0) {
|
||||
gp_ui_xs_jushu();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
gp_ui_xs_zongfen();
|
||||
dxpaixu(game.pai,game.laizi);
|
||||
for (var i=0;i<3;i++) {
|
||||
if (game.zhunbei[i] ==1 && i== game.my_seat){
|
||||
set_level(102,1);
|
||||
set_level(501,0);
|
||||
set_group(201,37,0,0,0);
|
||||
set_group(202,37,0,0,0);
|
||||
set_group(203,37,0,0,0);
|
||||
set_group(204,37,0,0,0);
|
||||
set_group(213,37,0,0,0);
|
||||
set_self(1143,37,0,0,0);
|
||||
for(var a=0;a<=64;a++) {
|
||||
set_self(1001+a,33,100,0,0);
|
||||
}
|
||||
if (Utl.getIsInfinite() == 0) {//星星场如果bu是无限局
|
||||
for (var a=0;a<game.people;a++ ) {
|
||||
if(game.zhunbei[a]==1) {
|
||||
switch (Utl.changeToStatus(a))//显示准备
|
||||
{
|
||||
case 0:
|
||||
set_self(1276,37,1,0,0);
|
||||
break;
|
||||
case 1:
|
||||
set_self(1277,37,1,0,0);
|
||||
break;
|
||||
case 2:
|
||||
set_self(1278,37,1,0,0);
|
||||
break;
|
||||
case 3:
|
||||
set_self(1279,37,1,0,0);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
else {
|
||||
game.daxiaoju = 1;
|
||||
//gp_ui_xiaoju();
|
||||
if (Utl.getIsInfinite() == 1) {//如果是无限局
|
||||
for (var j = 0; j < game.people; j++) {
|
||||
xxs[j] = Desk.GetPlayerBySeat(j).bean;
|
||||
}
|
||||
}
|
||||
xj = 1;
|
||||
gameabc_face.ontimer_1060();
|
||||
}
|
||||
}
|
||||
if (Utl.getIsInfinite() == 0) {
|
||||
gp_ui_xs_jushu();
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
gp_ui_xs_zongfen();
|
||||
dxpaixu(game.pai,game.laizi);
|
||||
laizi_xs();
|
||||
game.daxiaoju = 2;
|
||||
//gp_ui_xiaoju();
|
||||
if (kg!=2) {
|
||||
gameabc_face.ontimer_1060();
|
||||
}else{
|
||||
gp_ui_daju();
|
||||
}
|
||||
break;
|
||||
if (Utl.getIsInfinite() == 0) {
|
||||
gp_ui_xs_jushu();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var laizi_xs = function() {
|
||||
if (game.laizi>0 ) {
|
||||
set_self(1143,43,game.laizi,0,0);
|
||||
set_self(1143,19,-10,0,0);
|
||||
set_self(1143,33,45,0,0);
|
||||
set_self(1143,35,255,0,0);
|
||||
set_self(1143,37,1,0,0);
|
||||
set_self(1143,1,567,0,0);
|
||||
}
|
||||
};
|
||||
var guandonghua = function(){
|
||||
for (var i=0;i<6;i++) {
|
||||
play_ani(0,1281+i,43);
|
||||
set_self(1281+i,37,0);
|
||||
play_ani(0,1281+i,18);
|
||||
}
|
||||
set_self(1107,37,0);
|
||||
play_ani(0,1107,18);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
|
||||
|
||||
|
||||
|
||||
gameabc_face.mouseup_4 = function(gameid, spid_down, downx, downy, spid_up, upx, upy, timelong, no1, no2)
|
||||
{
|
||||
//请在下面输入您的代码
|
||||
|
||||
};
|
||||
gameabc_face.mouseup_149 = function(gameid, spid_down, downx, downy, spid_up, upx, upy, timelong, no1, no2)
|
||||
{
|
||||
//请在下面输入您的代码
|
||||
|
||||
};
|
||||
gameabc_face.mouseup_346 = function(gameid, spid_down, downx, downy, spid_up, upx, upy, timelong, no1, no2)
|
||||
{
|
||||
//请在下面输入您的代码
|
||||
|
||||
};
|
||||
|
||||
gameabc_face.mouseup_68 = function(gameid, spid_down, downx, downy, spid_up, upx, upy, timelong, no1, no2)
|
||||
{
|
||||
//请在下面输入您的代码
|
||||
var reg = /[^0-9]/g;
|
||||
var text = Func.gamepastetext();
|
||||
|
||||
text = text.replace(reg,"");
|
||||
|
||||
console.log(text);
|
||||
};
|
||||
var datacount=0;
|
||||
gameabc_face.mouseup_286 = function(gameid, spid_down, downx, downy, spid_up, upx, upy, timelong, no1, no2)
|
||||
{
|
||||
//请在下面输入您的代码
|
||||
var data=
|
||||
{
|
||||
a:[1,2,4],
|
||||
b:{
|
||||
b1:"b1",
|
||||
b2:[3,5,7]
|
||||
},
|
||||
c:datacount
|
||||
};
|
||||
datacount++;
|
||||
Utl.saveGradeInfo(data);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
5543
codes/games/client/Projects/guanpai-jx/js/gameabc.min.js
vendored
Normal file
5543
codes/games/client/Projects/guanpai-jx/js/gameabc.min.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5703
codes/games/client/Projects/guanpai-jx/js/gameabc.min2.js
Normal file
5703
codes/games/client/Projects/guanpai-jx/js/gameabc.min2.js
Normal file
File diff suppressed because it is too large
Load Diff
394
codes/games/client/Projects/guanpai-jx/js/gamemain.js
Normal file
394
codes/games/client/Projects/guanpai-jx/js/gamemain.js
Normal file
@@ -0,0 +1,394 @@
|
||||
var gameabc_face = gameabc_face||{};
|
||||
{
|
||||
gameabc_face.tag=12; //定义你的游戏全局内存
|
||||
gameabc_face.tag1=123;//定义你的游戏全局内存
|
||||
gameabc_face.tag2=123;//定义你的游戏全局内存
|
||||
gameabc_face.tag3=123;//定义你的游戏全局内存
|
||||
gameabc_face.dfwgao=1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
gameabc_face.gamestart=function(gameid)
|
||||
{
|
||||
//游戏初始化代码
|
||||
set_level (501,0);
|
||||
set_level (502,0);
|
||||
|
||||
//set_level (302,0);
|
||||
for (var i=0;i<4;i++) {
|
||||
set_self(1401+i,41,0,0,0);
|
||||
}
|
||||
set_self(184,18,554,0,0);set_self(515,18,554,0,0);set_self(184,19,500,0,0);set_self(515,19,500,0,0);set_self(183,18,505,0,0);set_self(183,19,403,0,0);
|
||||
set_self(248,18,481,0,0);set_self(248,19,542,0,0);set_self(249,18,567,0,0);set_self(249,19,556,0,0);
|
||||
for (var i = 0; i < 5; i++) {
|
||||
set_self(208+i,43,i+3,0,0)
|
||||
}
|
||||
set_self(1004,57,300,0,0);
|
||||
set_self(1003,57,500,0,0);
|
||||
set_self(1080,41,0,0,0);
|
||||
set_self(1098,41,0,0,0);
|
||||
set_self(1482,41,0,0,0);set_self(1483,41,0,0,0);set_self(1484,41,0,0,0);
|
||||
Logic.AppStart();
|
||||
|
||||
gp.pai = cls_aset2_gp.New();
|
||||
for(var a = 0;a<gp.pai.cardlist.length;a++)//改变A和2的算法大小
|
||||
{
|
||||
if(cls_card2_gp.GetNumber(gp.pai.cardlist[a])==1)
|
||||
{
|
||||
cls_card2_gp.SetArithN(gp.pai.cardlist[a],14);
|
||||
}
|
||||
if(cls_card2_gp.GetNumber(gp.pai.cardlist[a])==2)
|
||||
{
|
||||
cls_card2_gp.SetArithN(gp.pai.cardlist[a],15);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
gameabc_face.ani_doend=function(id,sx,count,allend)
|
||||
{
|
||||
//logmessage(id+"/"+sx+"/"+count+"/"+allend);
|
||||
//play_ani(0,2,18,50,200,0,1000,0,0,0,0,6000,1);//主动关闭
|
||||
GameUI.utlani_doend(id,sx,count,allend);
|
||||
gameCombat.utlani_doend(id,sx,count,allend);
|
||||
|
||||
};
|
||||
|
||||
gameabc_face.box_doend=function(id,sx,timelen)
|
||||
{
|
||||
//play_box 结束事件
|
||||
//showmessage("box_doend:"+id+"/"+sx+"/"+timelen);
|
||||
//logmessage("box_doend:"+id+"/"+sx+"/"+timelen);
|
||||
};
|
||||
gameabc_face.onloadurl=function(recid,rectype,url,error,count,len)
|
||||
{
|
||||
//修改为gameabc_face.onloadurl 则自己处理图片加载进度
|
||||
//资源加载完成函数
|
||||
//recid:资源id
|
||||
//rectype:1 图片 2声音
|
||||
//url :网络地址
|
||||
//error:是否加载错误
|
||||
//len:资源大小
|
||||
//count:加载的个数百分比
|
||||
|
||||
//logmessage("onload:"+recid+"/"+rectype+"/"+count+"/"+error);
|
||||
GameUI.onloadurl(recid,rectype,url,error,count,len);
|
||||
/*
|
||||
if (rectype==0)
|
||||
{
|
||||
open_load("","1.mp3","");
|
||||
gameabc_face.randombase=0;//使用系统浏览器缓存
|
||||
}
|
||||
if (count==100)
|
||||
{
|
||||
|
||||
} else
|
||||
{
|
||||
//game_open_zsmsg(count+"%"+" 加载中...");
|
||||
};
|
||||
*/
|
||||
|
||||
};
|
||||
|
||||
gameabc_face.chongzhi=function(userid,zt,data)
|
||||
{
|
||||
//游戏接口代码
|
||||
|
||||
};
|
||||
|
||||
gameabc_face.onresize=function(pmw/*屏幕宽*/,pmh/*屏幕宽*/,sjweww/*设计宽*/,sjnewh/*设计宽*/,nweww/*显示宽*/,newh/*显示高*/)
|
||||
{
|
||||
|
||||
//屏幕变化
|
||||
// 在此调整 列表控件的宽高和区域 不是整体缩放
|
||||
//logmessage("onresize:"+pmw+"/"+pmh+"/"+sjweww+"/"+sjnewh+"/"+nweww+"/"+newh);
|
||||
};
|
||||
|
||||
gameabc_face.gamebegindraw=function(gameid, spid, times, timelong)
|
||||
{
|
||||
//更新开始代码
|
||||
GameUI.utlgamebegindraw(gameid, spid, times, timelong);
|
||||
if (kehuduan == 0) { //--前端测试用
|
||||
|
||||
set_level(101,1);
|
||||
set_self(149,37,1,0,0);
|
||||
for (var a=43;a<=46;a++)
|
||||
{
|
||||
set_group(a,37,1,0,0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
gameabc_face.gameenddraw=function(gameid, spid, times, timelong)
|
||||
{
|
||||
//更新完成代码
|
||||
GameUI.gameenddraw(gameid, spid, times, timelong);
|
||||
};
|
||||
|
||||
gameabc_face.mousedown=function(gameid, spid, downx, downy, no1, no2, no3, no4, no5, no6)
|
||||
{
|
||||
//点击代码
|
||||
GameUI.utlmousedown(gameid, spid, downx, downy, no1, no2, no3, no4, no5, no6);
|
||||
Game_Modify.utlmousedown(gameid, spid, downx, downy, no1, no2, no3, no4, no5, no6);
|
||||
gameCombat.utlmousedown(gameid, spid, downx, downy, no1, no2, no3, no4, no5, no6);
|
||||
};
|
||||
|
||||
gameabc_face.mousedown_nomove=function(gameid, spid, downx, downy, timelong, no1, no2, no3, no4, no5)
|
||||
{
|
||||
//点击代没移动代码
|
||||
GameUI.utlmousedown_nomove(gameid, spid, downx, downy, timelong, no1, no2, no3, no4, no5);
|
||||
Game_Modify.utlmousedown_nomove(gameid, spid, downx, downy, timelong, no1, no2, no3, no4, no5);
|
||||
};
|
||||
|
||||
gameabc_face.mouseup=function(gameid, spid_down, downx, downy, spid_up, upx, upy, timelong, no1, no2)
|
||||
{
|
||||
//点击弹起代码
|
||||
//可以通过spid_down和spid_up 的比较 来判断是 点击还是 移动
|
||||
GameUI.utlmouseup(gameid, spid_down, downx, downy, spid_up, upx, upy, timelong, no1, no2);
|
||||
Game_Modify.mouseup(gameid, spid_down, downx, downy, spid_up, upx, upy, timelong, no1, no2);
|
||||
gameCombat.utlmouseup(gameid, spid_down, downx, downy, spid_up, upx, upy, timelong, no1, no2);
|
||||
|
||||
if(spid_up == spid_down)
|
||||
{
|
||||
//gp_ui_laizidh();
|
||||
//Game_Modify.updateScene();
|
||||
gp_ui_dj(spid_up);
|
||||
Utl.playSound(yx.changyong[6]);
|
||||
}
|
||||
};
|
||||
|
||||
gameabc_face.mousemove=function(gameid, spid, downx, downy, movex,movey ,timelong,offmovex, offmovey, no1)
|
||||
{
|
||||
//点击后移动代码
|
||||
GameUI.utlmousemove(gameid, spid, downx, downy, movex,movey ,timelong,offmovex, offmovey, no1);
|
||||
Game_Modify.utlmousemove(gameid, spid, downx, downy, movex,movey ,timelong,offmovex, offmovey, no1);
|
||||
gameCombat.utlmousemove(gameid, spid, downx, downy, movex,movey ,timelong,offmovex, offmovey, no1);
|
||||
};
|
||||
|
||||
gameabc_face.gamemydraw=function(gameid, spid, times, timelong, no2, no3, no4, no5, no6, no7)
|
||||
{
|
||||
//每个精灵更新绘画代码
|
||||
GameUI.utlgamemydraw(gameid, spid, times, timelong, no2, no3, no4, no5, no6, no7);
|
||||
Game_Modify.gamemydraw(gameid, spid, times, timelong, no2, no3, no4, no5, no6, no7);
|
||||
gameCombat.utlgamemydraw(gameid, spid, times, timelong, no2, no3, no4, no5, no6, no7);
|
||||
};
|
||||
|
||||
gameabc_face.gamemydrawbegin=function(gameid, spid, times, timelong, no2, no3, no4, no5, no6, no7)
|
||||
{
|
||||
//每个精灵更新前绘画代码
|
||||
GameUI.utlgamemydrawbegin(gameid, spid, times, timelong, no2, no3, no4, no5, no6, no7);
|
||||
Game_Modify.utlgamemydrawbegin(gameid, spid, times, timelong, no2, no3, no4, no5, no6, no7);
|
||||
gameCombat.utlgamemydrawbegin(gameid, spid, times, timelong, no2, no3, no4, no5, no6, no7);
|
||||
};
|
||||
|
||||
|
||||
gameabc_face.ontimer= function(gameid, spid, /* 本次间隔多少次了 */ times, /* 本次间隔多久 */ timelong,/* 开启后运行多少次了 */ alltimes){
|
||||
GameUI.utlontimer(gameid, spid, /* 本次间隔多少次了 */ times, /* 本次间隔多久 */ timelong,/* 开启后运行多少次了 */ alltimes);
|
||||
game_dsq(gameid, spid, /* 本次间隔多少次了 */ times, /* 本次间隔多久 */ timelong,/* 开启后运行多少次了 */ alltimes);
|
||||
};
|
||||
|
||||
gameabc_face.tcpconnected=function(tcpid)
|
||||
{
|
||||
/*
|
||||
ifast_tcp_open(1,"127.0.0.1:5414");//连接ws tcp
|
||||
*/
|
||||
//logmessage("tcpopen:"+tcpid);
|
||||
//Logic.tcpconnected(tcpid);
|
||||
};
|
||||
gameabc_face.tcpmessage=function(tcpid,data)
|
||||
{
|
||||
//logmessage("tcpread:"+data);
|
||||
//Net._ReceiveData(data);
|
||||
//Net_nn.TcpMessage(tcpid,data);
|
||||
|
||||
};
|
||||
|
||||
gameabc_face.tcpdisconnected=function(tcpid)
|
||||
{
|
||||
//logmessage("tcpclose:"+tcpid);
|
||||
//Logic.DisConnect();
|
||||
|
||||
|
||||
};
|
||||
gameabc_face.tcperror=function(tcpid,data)
|
||||
{
|
||||
//logmessage("tcperror:"+tcpid);
|
||||
|
||||
};
|
||||
|
||||
gameabc_face.httpmessage=function(myid,url,data)
|
||||
{
|
||||
/*
|
||||
ifast_http(1,"web/test.txt",1);//获取文件 同域
|
||||
*/
|
||||
//logmessage("httpread:"+myid+"/"+url+":"+data);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,465 @@
|
||||
/*================= cls_aset2: 小局基础类 =================
|
||||
注意:
|
||||
1,此牌类是基础小局类;各子游戏需要继承此基础类后下编写自己的小局类。
|
||||
2,子游戏开发人员不能修改该文件。
|
||||
=========================================================*/
|
||||
var cls_aset2 = {
|
||||
|
||||
//================ 新建一小局 ================
|
||||
New: function(){
|
||||
//定义小局
|
||||
var o_aset = this.declare();
|
||||
//初始化牌列表
|
||||
this.initcardlist(o_aset);
|
||||
//除掉不要的牌
|
||||
this.deletecard(o_aset);
|
||||
//设置每张牌的分值
|
||||
this.setcardscore(o_aset);
|
||||
return o_aset;
|
||||
},
|
||||
//小局的数据定义
|
||||
declare: function(){
|
||||
var o_aset = {};
|
||||
//玩家列表
|
||||
o_aset.playerlist = []; //在此定义和存储玩家的状态,比如准备状态、叫分的分值、游戏的得分等等,格式如[[], [], ...], [{}, {}, ...], [player, player, ...]
|
||||
//牌列表
|
||||
o_aset.cardlist = []; //格式为[[], [], [], ...],里面的每个小数组就是一张牌
|
||||
//庄(位置)
|
||||
o_aset.zhuang = -1;
|
||||
//控制权(位置)
|
||||
o_aset.control = -1;
|
||||
//当前是第几轮出牌
|
||||
o_aset.play = 0;
|
||||
//当前是本轮的第几个出牌
|
||||
o_aset.index = 0;
|
||||
|
||||
return o_aset;
|
||||
},
|
||||
//初始化牌列表
|
||||
initcardlist: function(o_aset){
|
||||
//几副牌
|
||||
var card_count = this.get_cardcount();
|
||||
//牌类
|
||||
var card_class = this.get_cardclass();
|
||||
//初始化
|
||||
for (var i = 1; i <= card_count; i++){ //几副牌
|
||||
for (var j = 1; j <= 4; j++){ //方块、梅花、红心、黑桃四种花色
|
||||
for (var k = 1; k <= 13; k++){ //A到K
|
||||
var id = (i - 1) * 54 + (j - 1) * 13 + k - 1; //牌的绝对id
|
||||
//新建一张牌
|
||||
var card_object = card_class.New(id);
|
||||
o_aset.cardlist.push(card_object);
|
||||
}
|
||||
}
|
||||
//小王
|
||||
var card_object = card_class.New((i - 1) * 54 + 53 - 1);
|
||||
o_aset.cardlist.push(card_object);
|
||||
//大王
|
||||
var card_object = card_class.New((i - 1) * 54 + 54 - 1);
|
||||
o_aset.cardlist.push(card_object);
|
||||
}
|
||||
},
|
||||
//几副牌
|
||||
get_cardcount: function(){
|
||||
return 1;
|
||||
},
|
||||
//小局对应的牌类
|
||||
get_cardclass: function(){
|
||||
return cls_card2;
|
||||
},
|
||||
//除掉不要的牌
|
||||
deletecard: function(o_aset){
|
||||
for (var i = 0; i < o_aset.cardlist.length; i++){
|
||||
var o_card = o_aset.cardlist[i];
|
||||
this.get_cardclass().SetDeal(o_card, -1);
|
||||
}
|
||||
|
||||
//下面的代码是3人二七王除掉3、4的例子。类似功能需要在子游戏中重写该方法
|
||||
// for (var i = 0; i < o_aset.cardlist.length; i++){
|
||||
// var o_card = o_aset.cardlist[i];
|
||||
// var card_number = this.get_cardclass().GetNumber(o_card);
|
||||
// if (card_number == 3 || card_number == 4){
|
||||
// this.get_cardclass().SetDeal(o_card, -2);
|
||||
// }
|
||||
// }
|
||||
},
|
||||
//设置每张牌的分值
|
||||
setcardscore: function(o_aset){
|
||||
for (var i = 0; i < o_aset.cardlist.length; i++){
|
||||
var o_card = o_aset.cardlist[i];
|
||||
var card_deal = this.get_cardclass().GetDeal(o_card);
|
||||
if (card_deal != -2){
|
||||
this.get_cardclass().SetScore(o_card, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//下面的代码是设置5、10、K分值的例子。类似功能需要在子游戏中重写该方法
|
||||
// for (var i = 0; i < o_aset.cardlist.length; i++){
|
||||
// var o_card = o_aset.cardlist[i];
|
||||
// var card_deal = this.get_cardclass().GetDeal(o_card);
|
||||
// if (card_deal != -2){
|
||||
// var card_number = this.get_cardclass().GetNumber(o_card);
|
||||
// switch (card_number){
|
||||
// case 5:
|
||||
// this.get_cardclass().SetScore(o_card, 5);
|
||||
// break;
|
||||
// case 10:
|
||||
// this.get_cardclass().SetScore(o_card, 10);
|
||||
// break;
|
||||
// case 13:
|
||||
// this.get_cardclass().SetScore(o_card, 10);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
},
|
||||
|
||||
//===================== 发牌 =====================
|
||||
DealCard: function(o_aset, o_desk){
|
||||
//需要发牌的位置列表
|
||||
var seatlist = this.get_dealseatlist(o_aset, o_desk);
|
||||
//每人需要发多少张牌
|
||||
var dealcount = this.get_dealcount(o_aset, o_desk);
|
||||
//需要留几张底牌
|
||||
var bottomcount = this.get_bottomcount(o_aset, o_desk);
|
||||
//注意:dealcount * seatlist + bottomcount必须等于除掉不要的牌之后的牌的总数
|
||||
|
||||
//发牌数组
|
||||
var tmplist = [];
|
||||
for (var i = 0; i < seatlist.length; i++){
|
||||
for (var j = 0; j < dealcount; j++){
|
||||
tmplist.push(seatlist[i]);
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < bottomcount; i++){
|
||||
tmplist.push(-1);
|
||||
}
|
||||
|
||||
//随机发牌
|
||||
for (var i = 0; i < o_aset.cardlist.length; i++){
|
||||
var o_card = o_aset.cardlist[i];
|
||||
var card_deal = this.get_cardclass().GetDeal(o_card);
|
||||
if (card_deal != -2){
|
||||
var idx = min_random(0, tmplist.length - 1);
|
||||
this.get_cardclass().SetDeal(o_card, tmplist[idx]);
|
||||
this.get_cardclass().SetStart(o_card, tmplist[idx]);
|
||||
this.get_cardclass().SetPlay(o_card, -1);
|
||||
this.get_cardclass().SetOver(o_card, tmplist[idx]);
|
||||
//将发牌数组的最后一位移至该位置
|
||||
if (idx < tmplist.length - 1) {
|
||||
tmplist[idx] = tmplist[tmplist.length - 1];
|
||||
};
|
||||
//发牌数组长度减一
|
||||
tmplist.length = tmplist.length - 1;
|
||||
}
|
||||
}
|
||||
},
|
||||
//需要发牌的位置列表
|
||||
get_dealseatlist: function(o_aset, o_desk){
|
||||
var seatlist = [];
|
||||
for (var i = 0; i < o_desk.o_room.seatlist.length; i++){
|
||||
if (o_desk.o_room.seatlist[i]){
|
||||
if (o_desk.o_room.seatlist[i].gameinfo.isbet){
|
||||
seatlist.push(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return seatlist;
|
||||
},
|
||||
//每人需要发多少张牌
|
||||
get_dealcount: function(o_aset, o_desk){
|
||||
return 0;
|
||||
},
|
||||
//需要留几张底牌
|
||||
get_bottomcount: function(o_aset, o_desk){
|
||||
return 0;
|
||||
},
|
||||
|
||||
//==================== 拿底牌 ====================
|
||||
PutBottomCard: function(o_aset, seat){
|
||||
var bottomcardlist = this.GetBottomCards(o_aset);
|
||||
for (var i = 0; i < bottomcardlist.length; i++) {
|
||||
var o_card = bottomcardlist[i];
|
||||
this.get_cardclass().SetStart(o_card, seat);
|
||||
}
|
||||
},
|
||||
|
||||
//===================== 埋牌 =====================
|
||||
BuryCard: function(o_aset, seat, cardidlist){
|
||||
/*参数:
|
||||
seat:哪个位置要埋牌
|
||||
cardidlist:要埋的牌的id
|
||||
返回值:true表示执行成功,false表示执行失败。*/
|
||||
if (this.canBuryCard(o_aset, seat, cardidlist)){
|
||||
this.doBuryCard(o_aset, seat, cardidlist);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
get_burycardcount: function(){
|
||||
return 8;
|
||||
},
|
||||
//检查是否可埋牌
|
||||
canBuryCard: function(o_aset, seat, cardidlist){
|
||||
//检查控制权
|
||||
if (seat != o_aset.control){
|
||||
return false;
|
||||
}
|
||||
//检查埋牌数量
|
||||
if (cardidlist.length != this.get_burycardcount()){
|
||||
return false;
|
||||
}
|
||||
//检查要埋的牌是否在玩家手上
|
||||
var inhandcardids = this.GetCardIdsInhand(o_aset, seat);
|
||||
return min_ary_include(inhandcardids, cardidlist);
|
||||
},
|
||||
//埋牌
|
||||
doBuryCard: function(o_aset, seat, cardidlist){
|
||||
var cardlist = this.CardIdsToCards(o_aset, cardidlist);
|
||||
for (var i = 0; i < cardlist.length; i++) {
|
||||
var o_card = cardlist[i];
|
||||
this.get_cardclass().SetPlay(o_card, -2);
|
||||
}
|
||||
},
|
||||
|
||||
//===================== 出牌 =====================
|
||||
PlayCard: function(o_aset, seat, cardidlist, mode){
|
||||
/*参数:
|
||||
seat:哪个位置要出牌
|
||||
cardidlist:要出的牌的id
|
||||
mode:出牌模式 0-需要跟随上一家出牌 1-需要跟随第一家出牌
|
||||
返回值:true表示执行成功,false表示执行失败。*/
|
||||
var can = this.canPlayCard(o_aset, seat, cardidlist, mode); //检查是否可出
|
||||
if (can.result){ //可出
|
||||
this.doPlayCard(o_aset, seat, cardidlist); //出下去
|
||||
return true;
|
||||
} else { //不可出
|
||||
return false;
|
||||
}
|
||||
},
|
||||
//检查是否可出牌
|
||||
canPlayCard: function(o_aset, seat, cardidlist, mode){
|
||||
var can = {}; //返回的结果
|
||||
can.result = false; //是否可以出出去
|
||||
can.cards = null; //牌(对象)
|
||||
can.cardtype = null; //牌型
|
||||
can.value = null; //大小
|
||||
can.flower = null; //花色
|
||||
|
||||
//检查控制权
|
||||
if (seat != o_aset.control){
|
||||
can.result = false;
|
||||
return can;
|
||||
}
|
||||
//检查要出的牌是否在玩家手上
|
||||
var inhandcardids = this.GetCardIdsInhand(o_aset, seat);
|
||||
if (!min_ary_include(inhandcardids, cardidlist)){
|
||||
can.result = false;
|
||||
return can;
|
||||
}
|
||||
|
||||
return can;
|
||||
},
|
||||
//第一个出牌时分析选中的牌是否可以出出去(主要是分析牌型)
|
||||
canPlayCard_first: function(o_aset, cardidlist){
|
||||
var can = {}; //返回的结果
|
||||
can.result = false; //是否可以出出去
|
||||
can.cards = null; //牌(对象)
|
||||
can.cardtype = null; //牌型
|
||||
can.value = null; //大小
|
||||
can.flower = null; //花色
|
||||
|
||||
|
||||
return can;
|
||||
},
|
||||
//不是第一个出牌时分析选中的牌是否可以出出去(主要是分析牌型是否符合前面出牌的牌型)
|
||||
canPlayCard_second: function(o_aset, cardidlist, mode){
|
||||
var can = {}; //返回的结果
|
||||
can.result = false; //是否可以出出去
|
||||
can.cards = null; //牌(对象)
|
||||
can.cardtype = null; //牌型
|
||||
can.value = null; //大小
|
||||
can.flower = null; //花色
|
||||
|
||||
return can;
|
||||
},
|
||||
//出牌
|
||||
doPlayCard: function(o_aset, seat, cardidlist){
|
||||
var cardlist = this.CardIdsToCards(o_aset, cardidlist);
|
||||
for (var i = 0; i < cardlist.length; i++) {
|
||||
var o_card = cardlist[i];
|
||||
this.get_cardclass().SetPlay(o_card, o_aset.play);
|
||||
this.get_cardclass().SetIndex(o_card, o_aset.index);
|
||||
}
|
||||
},
|
||||
|
||||
//=================== 可跟随的牌 ===================
|
||||
CanFollowCard: function(o_aset, seat, mode){
|
||||
//根据第一个人或上一个人出的牌,分析seat这个位置上的人必出的牌和可出的牌
|
||||
|
||||
},
|
||||
|
||||
//==================== 小局结算 =====================
|
||||
CloseAccount: function(o_aset, o_desk){
|
||||
|
||||
},
|
||||
|
||||
//================ 获取各种情况的牌 ================
|
||||
//获取开局时玩家发到手上的牌
|
||||
GetDealCardsBySeat: function(o_aset, seat){
|
||||
return this.GetCardsByDealstate(o_aset, seat);
|
||||
},
|
||||
GetDealCardIdsBySeat: function(o_aset, seat){
|
||||
var cardlist = this.GetDealCardsBySeat(o_aset, seat);
|
||||
return this.CardsToCardIds(cardlist);
|
||||
},
|
||||
//获取底牌
|
||||
GetBottomCards: function(o_aset){
|
||||
return this.GetCardsByDealstate(o_aset, -1);
|
||||
},
|
||||
GetBottomCardIds: function(o_aset){
|
||||
var cardlist = this.GetBottomCards(o_aset);
|
||||
return this.CardsToCardIds(cardlist);
|
||||
},
|
||||
//获取玩家当前手上有的牌
|
||||
GetCardsInhand: function(o_aset, seat){
|
||||
var cardlist = [];
|
||||
for (var i = 0; i < o_aset.cardlist.length; i++){
|
||||
var o_card = o_aset.cardlist[i];
|
||||
var card_start = this.get_cardclass().GetStart(o_card);
|
||||
if (card_start == seat){
|
||||
var card_play = this.get_cardclass().GetPlay(o_card);
|
||||
if (card_play == -1 || card_play == null){
|
||||
cardlist.push(o_card);
|
||||
}
|
||||
}
|
||||
}
|
||||
return cardlist;
|
||||
},
|
||||
GetCardIdsInhand: function(o_aset, seat){
|
||||
var cardlist = this.GetCardsInhand(o_aset, seat);
|
||||
return this.CardsToCardIds(cardlist);
|
||||
},
|
||||
//获取埋牌 参数:seat谁埋的牌,可以不传,默认只有一个人会埋牌
|
||||
GetBuryCards: function(o_aset, seat){
|
||||
return this.GetCardsByPlaystate(o_aset, -2, seat);
|
||||
},
|
||||
GetBuryCardIds: function(o_aset, seat){
|
||||
var cardlist = this.GetBuryCards(o_aset, seat);
|
||||
return this.CardsToCardIds(cardlist);
|
||||
},
|
||||
//获取上一轮出牌
|
||||
GetPriorPlayCard: function(o_aset, round){
|
||||
|
||||
},
|
||||
//获取下一轮出牌
|
||||
GetNextPlayCard: function(o_aset, round){
|
||||
|
||||
},
|
||||
|
||||
//================== 各种底层函数 ==================
|
||||
//根据发牌状态获取牌列表
|
||||
GetCardsByDealstate: function(o_aset, dealstate){
|
||||
var cardlist = [];
|
||||
for (var i = 0; i < o_aset.cardlist.length; i++){
|
||||
var o_card = o_aset.cardlist[i];
|
||||
var card_deal = this.get_cardclass().GetDeal(o_card);
|
||||
if (card_deal == dealstate){
|
||||
cardlist.push(o_card);
|
||||
}
|
||||
}
|
||||
return cardlist;
|
||||
},
|
||||
//根据出牌状态获取牌列表
|
||||
GetCardsByPlaystate: function(o_aset, playstate, seat){
|
||||
var cardlist = [];
|
||||
for (var i = 0; i < o_aset.cardlist.length; i++){
|
||||
var o_card = o_aset.cardlist[i];
|
||||
var card_play = this.get_cardclass().GetPlay(o_card);
|
||||
if (card_play == playstate){
|
||||
if (seat != null){
|
||||
var card_start = this.get_cardclass().GetStart(o_card);
|
||||
if (card_start == seat){
|
||||
cardlist.push(o_card);
|
||||
}
|
||||
} else {
|
||||
cardlist.push(o_card);
|
||||
}
|
||||
}
|
||||
}
|
||||
return cardlist;
|
||||
},
|
||||
//将牌对象列表转换成牌id列表
|
||||
CardsToCardIds: function(cardlist){
|
||||
var cardidlist = [];
|
||||
for (var i = 0; i < cardlist.length; i++){
|
||||
var o_card = cardlist[i];
|
||||
var card_id = this.get_cardclass().GetId(o_card);
|
||||
cardidlist.push(card_id);
|
||||
}
|
||||
return cardidlist;
|
||||
},
|
||||
//将牌id列表转换成牌对象列表
|
||||
CardIdsToCards: function(o_aset, cardidlist){
|
||||
var cardlist = [];
|
||||
for (var i = 0; i < cardidlist.length; i++){
|
||||
var o_card = o_aset.cardlist[cardidlist[i]];
|
||||
cardlist.push(o_card);
|
||||
}
|
||||
return cardlist;
|
||||
},
|
||||
|
||||
//新建小局类
|
||||
NewClass: function(){
|
||||
var cls = {};
|
||||
cls.New = cls_aset2.New;
|
||||
cls.declare = cls_aset2.declare;
|
||||
cls.initcardlist = cls_aset2.initcardlist;
|
||||
cls.get_cardcount = cls_aset2.get_cardcount;
|
||||
cls.get_cardclass = cls_aset2.get_cardclass;
|
||||
cls.deletecard = cls_aset2.deletecard;
|
||||
cls.setcardscore = cls_aset2.setcardscore;
|
||||
|
||||
cls.DealCard = cls_aset2.DealCard;
|
||||
cls.get_dealseatlist = cls_aset2.get_dealseatlist;
|
||||
cls.get_dealcount = cls_aset2.get_dealcount;
|
||||
cls.get_bottomcount = cls_aset2.get_bottomcount;
|
||||
|
||||
cls.PutBottomCard = cls_aset2.PutBottomCard;
|
||||
|
||||
cls.BuryCard = cls_aset2.BuryCard;
|
||||
cls.get_burycardcount = cls_aset2.get_burycardcount;
|
||||
cls.canBuryCard = cls_aset2.canBuryCard;
|
||||
cls.doBuryCard = cls_aset2.doBuryCard;
|
||||
|
||||
cls.PlayCard = cls_aset2.PlayCard;
|
||||
cls.canPlayCard = cls_aset2.canPlayCard;
|
||||
cls.canPlayCard_first = cls_aset2.canPlayCard_first;
|
||||
cls.canPlayCard_second = cls_aset2.canPlayCard_second;
|
||||
cls.doPlayCard = cls_aset2.doPlayCard;
|
||||
|
||||
cls.CanFollowCard = cls_aset2.CanFollowCard;
|
||||
|
||||
cls.CloseAccount = cls_aset2.CloseAccount;
|
||||
|
||||
cls.GetDealCardsBySeat = cls_aset2.GetDealCardsBySeat;
|
||||
cls.GetDealCardIdsBySeat = cls_aset2.GetDealCardIdsBySeat;
|
||||
cls.GetBottomCards = cls_aset2.GetBottomCards;
|
||||
cls.GetBottomCardIds = cls_aset2.GetBottomCardIds;
|
||||
cls.GetCardsInhand = cls_aset2.GetCardsInhand;
|
||||
cls.GetCardIdsInhand = cls_aset2.GetCardIdsInhand;
|
||||
cls.GetBuryCards = cls_aset2.GetBuryCards;
|
||||
cls.GetBuryCardIds = cls_aset2.GetBuryCardIds;
|
||||
cls.GetPriorPlayCard = cls_aset2.GetPriorPlayCard;
|
||||
cls.GetNextPlayCard = cls_aset2.GetNextPlayCard;
|
||||
|
||||
cls.GetCardsByDealstate = cls_aset2.GetCardsByDealstate;
|
||||
cls.GetCardsByPlaystate = cls_aset2.GetCardsByPlaystate;
|
||||
cls.CardsToCardIds = cls_aset2.CardsToCardIds;
|
||||
cls.CardIdsToCards = cls_aset2.CardIdsToCards;
|
||||
return cls;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,747 @@
|
||||
/*===================== cls_card2: 牌的基础类 ======================
|
||||
扑克牌的统一定义:
|
||||
1,单张牌的定义是一个长度为14的数组 [Id, Flower, Number, ArithF, ArithN, Score, Deal, Start, Play, Index, Over, Tag1, Tag2, Tag3]
|
||||
第一位:Id,牌的绝对id,即数组下标,从0开始计数。
|
||||
第二位:Flower,牌的物理花色,5:王 4:黑桃 3:红心 2:梅花 1:方块。
|
||||
第三位:Number,牌的物理大小,1:A 2:2 ... 9:9 10:10 11:J 12:Q 13:K 53:小王 54:大王。
|
||||
第四位:ArithF,牌的算法花色,区别于物理花色,用于牌型计算和比较牌的大小。
|
||||
要求是大于0的整数,不能等于0或小于0,默认等于物理花色。
|
||||
第五位:ArithN,牌的算法大小,区别于物理大小,用于牌型计算和比较牌的大小。
|
||||
要求是大于0的整数,不能等于0或小于0,默认等于物理大小。
|
||||
第六位:Score,牌的分值,如5、10、K。
|
||||
第七位:Deal,发牌状态。
|
||||
-2:规则去除的牌;
|
||||
-1:未发的牌(底牌);
|
||||
>=0:发牌发到谁手上,即座位号。
|
||||
第八位:Start,开局状态,开局时牌在谁手上,与座位编号对应。
|
||||
第九位:Play,出牌状态。
|
||||
-2:埋的牌;
|
||||
-1:未出的牌(手上的牌);
|
||||
>=0:牌是第几轮出出去的,从0开始计数。
|
||||
第十位:Index,本轮中的出牌顺序号,从0开始计数。
|
||||
第十一位:Over,牌局结束时被谁得到,与座位编号对应。
|
||||
第十二位:Tag1,扩展属性1。
|
||||
第十三位:Tag2,扩展属性2。
|
||||
第十四位:Tag3,扩展属性3。
|
||||
2,基础牌型的统一定义:
|
||||
所有基础牌型都由两个值表示:tong,同,表示一样的牌;shun,顺,表示连续的牌。
|
||||
单张:tong=1,shun=1
|
||||
对子:tong=2,shun=1
|
||||
两连对:tong=2,shun=2
|
||||
三连对:tong=2,shun=3
|
||||
三个:tong=3,shun=1
|
||||
飞机:tong=3,shun=2
|
||||
四个:tong=4,shun=1
|
||||
五连顺:tong=1,shun=5
|
||||
六连顺:tong=1,shun=6
|
||||
其他基础牌型以此类推
|
||||
|
||||
注意:
|
||||
1,此牌类是基础扑克牌类、通用扑克牌类;各子游戏可以直接使用,也可以继承此基础类后下编写自己的牌类。
|
||||
2,子游戏开发人员不能修改该文件。
|
||||
3,访问牌的属性时要求使用Get和Set方法,不能直接通过数组下标的形式访问。
|
||||
===================================================================*/
|
||||
var cls_card2 = {
|
||||
|
||||
//新建一张牌
|
||||
New: function(id){
|
||||
return this.declare(id);
|
||||
},
|
||||
//牌的数据定义
|
||||
declare: function(id){
|
||||
//id转物理花色
|
||||
var IdToFlower = function(cardid){
|
||||
var yu = cardid % 54;
|
||||
if (yu == 52 || yu == 53){
|
||||
return 5;
|
||||
}
|
||||
return parseInt(yu / 13) + 1;
|
||||
}
|
||||
//id转物理数值
|
||||
var IdToNumber = function(cardid){
|
||||
var yu = cardid % 54;
|
||||
if (yu == 52){
|
||||
return 53;
|
||||
}
|
||||
if (yu == 53){
|
||||
return 54;
|
||||
}
|
||||
return yu % 13 + 1;
|
||||
}
|
||||
|
||||
var o_card = [];
|
||||
o_card[0] = id;
|
||||
o_card[1] = IdToFlower(id);
|
||||
o_card[2] = IdToNumber(id);
|
||||
o_card[3] = o_card[1];
|
||||
o_card[4] = o_card[2];
|
||||
o_card[5] = null;
|
||||
o_card[6] = null;
|
||||
o_card[7] = null;
|
||||
o_card[8] = null;
|
||||
o_card[9] = null;
|
||||
o_card[10] = null;
|
||||
o_card[11] = null;
|
||||
o_card[12] = null;
|
||||
o_card[13] = null;
|
||||
return o_card;
|
||||
},
|
||||
//牌的id,整型,只读
|
||||
GetId: function(o_card){
|
||||
return o_card[0];
|
||||
},
|
||||
//牌的物理花色,整型,只读
|
||||
GetFlower: function(o_card){
|
||||
return o_card[1];
|
||||
},
|
||||
//牌的物理大小,整型,只读
|
||||
GetNumber: function(o_card){
|
||||
return o_card[2];
|
||||
},
|
||||
//牌的算法花色,整型
|
||||
GetArithF: function(o_card){
|
||||
return o_card[3];
|
||||
},
|
||||
SetArithF: function(o_card, value){
|
||||
o_card[3] = value;
|
||||
},
|
||||
//牌的算法大小,整型
|
||||
GetArithN: function(o_card){
|
||||
return o_card[4];
|
||||
},
|
||||
SetArithN: function(o_card, value){
|
||||
o_card[4] = value;
|
||||
},
|
||||
//牌的分值,整型
|
||||
GetScore: function(o_card){
|
||||
return o_card[5];
|
||||
},
|
||||
SetScore: function(o_card, value){
|
||||
o_card[5] = value;
|
||||
},
|
||||
//发牌状态,整型
|
||||
GetDeal: function(o_card){
|
||||
return o_card[6];
|
||||
},
|
||||
SetDeal: function(o_card, value){
|
||||
o_card[6] = value;
|
||||
},
|
||||
//开局状态,整型
|
||||
GetStart: function(o_card){
|
||||
return o_card[7];
|
||||
},
|
||||
SetStart: function(o_card, value){
|
||||
o_card[7] = value;
|
||||
},
|
||||
//出牌状态,整型
|
||||
GetPlay: function(o_card){
|
||||
return o_card[8];
|
||||
},
|
||||
SetPlay: function(o_card, value){
|
||||
o_card[8] = value;
|
||||
},
|
||||
//出牌顺序,整型
|
||||
GetIndex: function(o_card){
|
||||
return o_card[9];
|
||||
},
|
||||
SetIndex: function(o_card, value){
|
||||
o_card[9] = value;
|
||||
},
|
||||
//结束时被谁得到,整型
|
||||
GetOver: function(o_card){
|
||||
return o_card[10];
|
||||
},
|
||||
SetOver: function(o_card, value){
|
||||
o_card[10] = value;
|
||||
},
|
||||
//扩展属性
|
||||
GetTag1: function(o_card){
|
||||
return o_card[11];
|
||||
},
|
||||
SetTag1: function(o_card, value){
|
||||
o_card[11] = value;
|
||||
},
|
||||
GetTag2: function(o_card){
|
||||
return o_card[12];
|
||||
},
|
||||
SetTag2: function(o_card, value){
|
||||
o_card[12] = value;
|
||||
},
|
||||
GetTag3: function(o_card){
|
||||
return o_card[13];
|
||||
},
|
||||
SetTag3: function(o_card, value){
|
||||
o_card[13] = value;
|
||||
},
|
||||
/*
|
||||
以下提供几个针对牌数组的基础算法,这两个方法是基于牌的算法花色和算法大小实现的,各子游戏在调用前需要将牌的算法花色和算法大小先设置好。
|
||||
|
||||
设置算法花色的原则是:
|
||||
1,如果对花色没要求则需要将所有牌的算法花色统一。比如斗地主中的五连顺是任何花色都可以一起连顺子的,则需要将所有牌的算法花色全部设置成0,表示都是同一花色,然后在同一花色下取顺子。
|
||||
2,如果对花色有要求则需要根据实际情况区分算法花色。比如升级中的两连对是指同一花色下的两连对,则需要将算法花色设置成不同的值,表示不同算法花色之间是不能组成两连对的。
|
||||
|
||||
设置算法大小的原则是:算法大小即可表示是否连牌,也可表示牌的大小关系。
|
||||
1,设置算法大小时要求做到数字连续则表示是连牌。比如A的物理大小是1,K的物理大小是13,1和13是不连续的,此时需要将A的算法大小设置成14,将K的算法大小设置成13,14和13是连续的,表示A和K可以连牌。再比如王牌和A是不能作为连牌出现的,则需要将王的算法大小设置成16,将A的算法大小设置成14,16和14不是连续的,表示王和A不能连牌。
|
||||
2,设置算法大小时要求做到数字大小则表示是牌的大小。比如A的物理大小是1,K的物理大小是13,1比13小,但A比K大,此时需要将A的算法大小设置成14,将K的算法大小设置成13,14比13大,表示A比K大。再比如王牌比A大,则需要将王的算法大小设置成16,将A的算法大小设置成14,16大于14,表示王比A大。
|
||||
*/
|
||||
|
||||
//根据算法花色筛选牌
|
||||
FilterCardListByArithF: function(o_cardlist, ArithF){
|
||||
/*参数说明
|
||||
o_cardlist:需要进行筛选的牌数组
|
||||
ArithF:要筛选的算法花色,默认不筛选
|
||||
|
||||
返回值:筛选后的牌数组*/
|
||||
var result = [];
|
||||
for (var i = 0; i < o_cardlist.length; i++) {
|
||||
var o_card = o_cardlist[i];
|
||||
var card_ArithF = this.GetArithF(o_card);
|
||||
if (!ArithF || card_ArithF == ArithF) {
|
||||
result.push(o_cardlist[i]);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
//根据算法大小筛选牌
|
||||
FilterCardListByArithN: function(o_cardlist, min_ArithN, max_ArithN){
|
||||
/*参数说明
|
||||
o_cardlist:需要进行筛选的牌数组
|
||||
min_ArithN:要筛选的算法大小最小值,>=,默认不限制
|
||||
max_ArithN:要筛选的算法大小最大值,<=,默认不限制
|
||||
返回值:筛选后的牌数组*/
|
||||
var result = [];
|
||||
for (var i = 0; i < o_cardlist.length; i++) {
|
||||
var o_card = o_cardlist[i];
|
||||
var card_ArithN = this.GetArithN(o_card);
|
||||
if ((!min_ArithN || card_ArithN >= min_ArithN) &&
|
||||
(!max_ArithN || card_ArithN <= max_ArithN)) {
|
||||
result.push(o_cardlist[i]);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
},
|
||||
|
||||
//根据算法大小对牌数组进行排序(冒泡排序法)
|
||||
SortCardList: function(o_cardlist, options){
|
||||
/*参数说明
|
||||
o_cardlist: 需要进行排序的牌数组
|
||||
options : 排序选项,长度为2的数组,结构为[大小排序方向,花色排序方向]
|
||||
第一位: 算法大小排序方向,0-从小到大排序 1-从大到小排序,默认为0。
|
||||
第二位: 物理花色排序方向,算法大小相同时是否再按物理花色排序,默认为0。
|
||||
0-根据算法大小排序方向默认选择物理花色排序方向,
|
||||
options[0]=0时,物理花色默认按“方块->梅花->红心->黑桃”排序;
|
||||
options[0]=1时,物理花色默认按“黑桃->红心->梅花->方块”排序。
|
||||
1-不按物理花色排序,在o_cardlist中是什么顺序就什么顺序。
|
||||
2-按物理花色从小到大,方块->梅花->红心->黑桃
|
||||
3-按物理花色从大到小,黑桃->红心->梅花->方块
|
||||
返回值: 排序后的牌数组*/
|
||||
var ArithN_direct = 0; //算法大小排序方向
|
||||
var Flower_direct = 0; //物理花色排序方向
|
||||
if (options) {
|
||||
ArithN_direct = parseInt(options[0]);
|
||||
Flower_direct = parseInt(options[1]);
|
||||
}
|
||||
if (!Flower_direct){
|
||||
if (ArithN_direct) {
|
||||
//算法大小从大到小排序时,默认按“黑桃->红心->梅花->方块”排序
|
||||
Flower_direct = 3;
|
||||
} else {
|
||||
//算法大小从小到大排序时,默认按“方块->梅花->红心->黑桃”排序
|
||||
Flower_direct = 2;
|
||||
}
|
||||
}
|
||||
|
||||
//j与j+1互换位置
|
||||
var doChangej = function(){
|
||||
var tmp = o_cardlist[j];
|
||||
o_cardlist[j] = o_cardlist[j + 1];
|
||||
o_cardlist[j + 1] = tmp;
|
||||
}
|
||||
|
||||
for (var i = 0; i < o_cardlist.length; i++){
|
||||
for (var j = 0; j < o_cardlist.length - i - 1; j++){
|
||||
var ArithN_j = this.GetArithN(o_cardlist[j]);
|
||||
var ArithN_j1 = this.GetArithN(o_cardlist[j + 1]);
|
||||
if (ArithN_direct == 0 && ArithN_j > ArithN_j1){
|
||||
//从小到大排序
|
||||
doChangej();
|
||||
continue;
|
||||
}
|
||||
if (ArithN_direct == 1 && ArithN_j < ArithN_j1){
|
||||
//从大到小排序
|
||||
doChangej();
|
||||
continue;
|
||||
}
|
||||
if (ArithN_j == ArithN_j1){
|
||||
//算法大小相同时
|
||||
if (Flower_direct == 1){
|
||||
//不按物理花色排序
|
||||
continue;
|
||||
}
|
||||
var Flower_j = this.GetFlower(o_cardlist[j]);
|
||||
var Flower_j1 = this.GetFlower(o_cardlist[j + 1]);
|
||||
if (Flower_direct == 2 && Flower_j > Flower_j1){
|
||||
//按“方块->梅花->红心->黑桃”排序
|
||||
doChangej();
|
||||
continue;
|
||||
}
|
||||
if (Flower_direct == 3 && Flower_j < Flower_j1){
|
||||
//按“黑桃->红心->梅花->方块”排序
|
||||
doChangej();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return o_cardlist;
|
||||
},
|
||||
|
||||
//获取指定牌型(基础牌型)的各种组合(只组合,无排列)
|
||||
GetCardListByCardType: function(o_cardlist, cardtype, options){
|
||||
/*参数说明
|
||||
o_cardlist:在这些牌中获取指定牌型,必须是经过了从小到大排序后的牌数组。
|
||||
cardtype :目标牌型,长度为2的数组,结构为[同,顺]。
|
||||
例如单张为[1,1],对子为[2,1],五连顺为[1,5]。
|
||||
options :取牌选项,长度为4的数组,结构为[结果数量,取牌方向,拆牌标志,一次标志]
|
||||
第一位:结果数量,0-获取所有可能的结果,>0要取的结果数量,默认为0。
|
||||
比如,牌数组为[2,3,5,7]时,
|
||||
当options[0]=0时,则取单张的结果为2,3,5,7;
|
||||
当options[0]=1时,则取单张的结果为2;
|
||||
当options[0]=3时,则取单张的结果为2,3,5。
|
||||
第二位:取牌方向,0-从小到大取结果,1-从大到小取结果,默认为0。
|
||||
第三位:拆牌标志,0-不拆牌,1-拆牌,默认为0。
|
||||
比如,牌数组为[2,2,3,5,5,5,7],
|
||||
当options[2]=0时,则取单张时会不取对子的牌和三张的牌,即结果为3,7;
|
||||
当options[2]=1时,则取单张时会拆掉对子的牌和三张的牌,即结果为2,3,5,7。
|
||||
第四位:一次标志,0-相同大小的牌只取一次,1-取所有情况,默认为0。
|
||||
比如,牌数组为[红心2, 黑桃2, 方块3, 方块5, 红心5, 黑桃5, 方块7],
|
||||
当options[3]=0时,则取单张的结果为:红心2, 方块3, 方块5, 方块7;
|
||||
当options[3]=1时,则取单张时结果为:红心2, 黑桃2, 方块3, 方块5, 红心5, 黑桃5, 方块7。
|
||||
返回值:满足牌型要求的牌组合数组。
|
||||
格式如
|
||||
[
|
||||
[o_card, o_card, o_card, ...],
|
||||
[o_card, o_card, o_card, ...],
|
||||
[o_card, o_card, o_card, ...],
|
||||
...
|
||||
]
|
||||
注意:统一用第一张牌的算法大小值表示牌型大小,比如34567是顺子,56789也是顺子,用3表示34567顺子的大小,用5表示56789顺子的大小,5大于3,表示56789的顺子比34567的顺子大*/
|
||||
|
||||
var cardtype_tong = parseInt(cardtype[0]); //牌型-同
|
||||
var cardtype_shun = parseInt(cardtype[1]); //牌型-顺
|
||||
var options_count = 0; //结果数量
|
||||
var options_direct= 0; //取牌方向
|
||||
var options_split = 0; //拆牌标志
|
||||
var options_once = 0; //一次标志
|
||||
if (options){
|
||||
options_count = parseInt(options[0]);
|
||||
options_direct= parseInt(options[1]);
|
||||
options_split = parseInt(options[2]);
|
||||
options_once = parseInt(options[3]);
|
||||
}
|
||||
|
||||
//将牌按大小分组,即相同大小的牌归为一组。如,将[2,2,3,5,5,5,7]这样的牌数组转成[[2,2],[3],[5,5,5],[7]]
|
||||
var SameGroupList = [];
|
||||
var SameGroup = [];
|
||||
for (var i = 0; i < o_cardlist.length; i++){
|
||||
var o_card = o_cardlist[i];
|
||||
if (SameGroup.length == 0){
|
||||
SameGroup.push(o_card);
|
||||
} else {
|
||||
var card_ArithN = this.GetArithN(o_card);
|
||||
var SameGroup_ArithN = this.GetArithN(SameGroup[0]);
|
||||
if (card_ArithN == SameGroup_ArithN){
|
||||
SameGroup.push(o_card);
|
||||
} else {
|
||||
SameGroupList.push(SameGroup);
|
||||
SameGroup = [];
|
||||
SameGroup.push(o_card);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (SameGroup.length > 0){
|
||||
SameGroupList.push(SameGroup);
|
||||
}
|
||||
|
||||
//将牌分组按牌型的“同”获取各自的组合。例如,将[[2,2],[3],[5,5,5],[7]]这样的牌分组按“同”等于2转成[[[2,2]], [[方5,梅5],[方5,红5],[梅5,红5]]]
|
||||
var TongGroupList = [];
|
||||
for (var i = 0; i < SameGroupList.length; i++){
|
||||
if (SameGroupList[i].length < cardtype_tong){
|
||||
// TongGroupList.push([]);
|
||||
continue;
|
||||
}
|
||||
if (SameGroupList[i].length == cardtype_tong){
|
||||
TongGroupList.push([SameGroupList[i]]);
|
||||
continue;
|
||||
}
|
||||
if (SameGroupList[i].length > cardtype_tong){
|
||||
if (!options_split){ //不允许拆牌
|
||||
// TongGroupList.push([]);
|
||||
continue;
|
||||
}
|
||||
if (!options_once){ //同样大小的牌只取一次
|
||||
TongGroupList.push([SameGroupList[i].slice(0, cardtype_tong)]);
|
||||
} else {
|
||||
TongGroupList.push(min_CombineInAry(SameGroupList[i], cardtype_tong));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//返回结果
|
||||
var resultlist = [];
|
||||
var ShunGroup = [];
|
||||
//检查ShunGroup是否是连顺,如果是连顺则在ShunGroup取结果保存到resultlist中
|
||||
var check_return_ShunGroup = function(){
|
||||
var isShun = true;
|
||||
for (var j = 0; j < ShunGroup.length; j++){
|
||||
if (ShunGroup[j].length == 0) {
|
||||
isShun = false;
|
||||
break;
|
||||
}
|
||||
if (j > 0) {
|
||||
var j1_ArithN = this.GetArithN(ShunGroup[j-1][0][0]);
|
||||
var j_ArithN = this.GetArithN(ShunGroup[j][0][0]);
|
||||
//相减等于1表示是顺
|
||||
if (j_ArithN - j1_ArithN != 1){
|
||||
isShun = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isShun){
|
||||
return false;
|
||||
}
|
||||
var result = min_CombineByArys(ShunGroup);
|
||||
for (var j = 0; j < result.length; j++) {
|
||||
var temp = [];
|
||||
for (var k = 0; k < result[j].length; k++) {
|
||||
temp = temp.concat(result[j][k]);
|
||||
}
|
||||
resultlist.push(temp);
|
||||
|
||||
if (options_count && resultlist.length >= options_count) {
|
||||
//达到了要取的结果数量
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}.bind(this);
|
||||
|
||||
//按牌型的“顺”获取符合要求的结果
|
||||
if (!options_direct){
|
||||
//从小到大取结果
|
||||
for (var i = 0; i <= TongGroupList.length - cardtype_shun; i++){
|
||||
ShunGroup = TongGroupList.slice(i, i + cardtype_shun);
|
||||
if (check_return_ShunGroup()){
|
||||
return resultlist;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//从大到小取结果
|
||||
for (var i = TongGroupList.length - cardtype_shun; i >= 0; i--){
|
||||
ShunGroup = TongGroupList.slice(i, i + cardtype_shun);
|
||||
if (check_return_ShunGroup()){
|
||||
return resultlist;
|
||||
}
|
||||
}
|
||||
}
|
||||
return resultlist;
|
||||
},
|
||||
GetCardListByCardTypeA: function(o_cardlist, cardtype, options, min_ArithN, max_ArithN){
|
||||
/*参数说明
|
||||
o_cardlist:同GetCardListByCardType中的参数说明。
|
||||
cardtype :同GetCardListByCardType中的参数说明。
|
||||
options :同GetCardListByCardType中的参数说明。
|
||||
min_ArithN:同FilterCardListByArithN中的参数说明。
|
||||
max_ArithN:同FilterCardListByArithN中的参数说明。
|
||||
返回值:同GetCardListByCardType中的参数说明。*/
|
||||
var cardlist = this.FilterCardListByArithN(o_cardlist, min_ArithN, max_ArithN);
|
||||
return this.GetCardListByCardType(cardlist, cardtype, options);
|
||||
},
|
||||
GetCardListByCardTypeB: function(o_cardlist, cardtype, options, ArithF, min_ArithN, max_ArithN){
|
||||
/*参数说明
|
||||
o_cardlist:可以是未排序的牌数组,该函数会实现排序。
|
||||
cardtype :同GetCardListByCardType中的参数说明。
|
||||
options :同GetCardListByCardType中的参数说明。
|
||||
ArithF :同FilterCardListByArithF中的参数说明。
|
||||
min_ArithN:同FilterCardListByArithN中的参数说明。
|
||||
max_ArithN:同FilterCardListByArithN中的参数说明。
|
||||
返回值:同GetCardListByCardType中的参数说明。*/
|
||||
var cardlist = this.FilterCardListByArithF(o_cardlist, ArithF);
|
||||
this.SortCardList(cardlist);
|
||||
cardlist = this.FilterCardListByArithN(cardlist, min_ArithN, max_ArithN);
|
||||
return this.GetCardListByCardType(cardlist, cardtype, options);
|
||||
},
|
||||
|
||||
//获取指定牌型(扩展牌型)的一种组合(只取一种组合)
|
||||
GetCardListByExtendCardTypeA: function(o_cardlist, cardtypelist){
|
||||
/*参数说明
|
||||
o_cardlist :同GetCardListByCardTypeA中的参数说明。
|
||||
cardtypelist:扩展牌型和取牌选项。
|
||||
结构为[
|
||||
[cardtype, options, min_ArithN, max_ArithN],
|
||||
[cardtype, options, min_ArithN, max_ArithN],
|
||||
[cardtype, options, min_ArithN, max_ArithN]
|
||||
]
|
||||
其中cardtype、options、min_ArithN、max_ArithN同GetCardListByCardTypeA中的参数说明。
|
||||
例如3带1,cardtypelist=[
|
||||
[[3,1], [1,x,x,x], min_ArithN, max_ArithN],
|
||||
[[1,1], [1,x,x,x], min_ArithN, max_ArithN]
|
||||
]
|
||||
3带2,cardtypelist=[
|
||||
[[3,1], [1,x,x,x], min_ArithN, max_ArithN],
|
||||
[[1,1], [1,x,x,x], min_ArithN, max_ArithN],
|
||||
[[1,1], [1,x,x,x], min_ArithN, max_ArithN]
|
||||
]
|
||||
3带1对,cardtypelist=[
|
||||
[[3,1], [1,x,x,x], min_ArithN, max_ArithN],
|
||||
[[2,1], [1,x,x,x], min_ArithN, max_ArithN]
|
||||
]
|
||||
注意:options中第一参数一定为1,表示只取一个结果,如果传的值不等于1,也会按等于1处理。
|
||||
|
||||
返回值:同GetCardListByCardTypeA中的参数说明。*/
|
||||
|
||||
var cardlist = o_cardlist;
|
||||
var result = [];
|
||||
for (var i = 0; i < cardtypelist.length; i++){
|
||||
var cardtype = cardtypelist[i][0];
|
||||
var options = cardtypelist[i][1];
|
||||
if (options[0] != 1){
|
||||
options[0] = 1;
|
||||
}
|
||||
var min_ArithN = cardtypelist[i][2];
|
||||
var max_ArithN = cardtypelist[i][3];
|
||||
var BaseCardGroup = this.GetCardListByCardTypeA(cardlist, cardtype, options, min_ArithN, max_ArithN);
|
||||
if (BaseCardGroup.length == 0){
|
||||
return [];
|
||||
}
|
||||
result = result.concat(BaseCardGroup[0]);
|
||||
cardlist = min_ary_deduct(cardlist, BaseCardGroup[0]);
|
||||
}
|
||||
return [result];
|
||||
},
|
||||
|
||||
//获取牌数组的最大牌型
|
||||
GetMaxCardTypeByCardList: function(o_cardlist, option){
|
||||
/*参数说明
|
||||
o_cardlist: 必须是经过了从小到大排序后的牌数组。
|
||||
option: 选项,默认为0
|
||||
0-返回"同"最多的最大牌型(如果"同"相同则取"顺"最多的,如果"顺"也相同则取"值"最大的)
|
||||
1-返回"顺"最多的最大牌型(如果"顺"相同则取"同"最多的,如果"同"也相同则取"值"最大的)
|
||||
返回值:结构为[cardtype, cardlist]。其中,
|
||||
cardtype为基础牌型,结构为[同,顺];
|
||||
cardlist为满足cardtype的牌数组,牌型相同时取最大值的牌。
|
||||
|
||||
例如,当option=0时,
|
||||
牌数组为[3,7,7,7,9,9,J,J,J,Q,Q], 返回值为[[3,1], [J,J,J]]
|
||||
牌数组为[3,7,7,7,8,8,8,9,9,J,J,J,Q,Q], 返回值为[[3,2], [7,7,7,8,8,8]]
|
||||
牌数组为[3,7,7,7,8,8,8,9,9,J,J,J,Q,Q,Q],返回值为[[3,2], [J,J,J,Q,Q,Q]]
|
||||
当option=1时,
|
||||
牌数组为[2,4,5,6,8,9,J,J,Q,Q,K], 返回值为[[1,3], [J,Q,K]]
|
||||
牌数组为[2,4,4,5,5,6,6,8,9,J,J,Q,Q,K], 返回值为[[2,3], [4,4,5,5,6,6]]
|
||||
牌数组为[2,4,4,5,5,6,6,8,9,J,J,Q,Q,K,K],返回值为[[2,3], [J,J,Q,Q,K,K]]*/
|
||||
var result = [];
|
||||
|
||||
//将o_cardlist按大小分组。
|
||||
//如,将[2,2,3,5,5,5,7]这样的牌数组转成[[2,2],[3],[5,5,5],[7]]
|
||||
var changeto_SameGroupList = function(){
|
||||
var SameGroupList = [];
|
||||
var SameGroup = [];
|
||||
for (var i = 0; i < o_cardlist.length; i++){
|
||||
var o_card = o_cardlist[i];
|
||||
if (SameGroup.length == 0){
|
||||
SameGroup.push(o_card);
|
||||
} else {
|
||||
var card_ArithN = this.GetArithN(o_card);
|
||||
var SameGroup_ArithN = this.GetArithN(SameGroup[0]);
|
||||
if (card_ArithN == SameGroup_ArithN){
|
||||
SameGroup.push(o_card);
|
||||
} else {
|
||||
SameGroupList.push(SameGroup);
|
||||
SameGroup = [];
|
||||
SameGroup.push(o_card);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (SameGroup.length > 0){
|
||||
SameGroupList.push(SameGroup);
|
||||
}
|
||||
return SameGroupList;
|
||||
}.bind(this);
|
||||
|
||||
var SameGroupList = changeto_SameGroupList();
|
||||
switch (option){
|
||||
case 0: //取"同"最多的牌型 [A,2,2,3,4,4,5,5,7,7,8,8,9,9,J,J,Q,Q,K,K]
|
||||
//检查ShunGroup是否是连顺
|
||||
var check_ShunGroup_isShun = function(){
|
||||
for (var j = 0; j < ShunGroup.length; j++){
|
||||
if (ShunGroup[j].length == 0) {
|
||||
return false;
|
||||
}
|
||||
if (j > 0) {
|
||||
var j1_ArithN = this.GetArithN(ShunGroup[j-1][0]);
|
||||
var j_ArithN = this.GetArithN(ShunGroup[j][0]);
|
||||
//相减等于1表示是顺
|
||||
if (j_ArithN - j1_ArithN != 1){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}.bind(this);
|
||||
|
||||
result[0] = [SameGroupList[0].length, 1];
|
||||
result[1] = SameGroupList[0];
|
||||
for (var i = 1; i < SameGroupList.length; i++) {
|
||||
if (SameGroupList[i].length > result[0][0]){
|
||||
result[0] = [SameGroupList[i].length, 1];
|
||||
result[1] = SameGroupList[i];
|
||||
} else if (SameGroupList[i].length == result[0][0]){
|
||||
var ArithN_i = this.GetArithN(SameGroupList[i][0]);
|
||||
var ArithN_r = this.GetArithN(result[1][result[1].length - 1]);
|
||||
if (ArithN_i - ArithN_r == 1){ //相减等于1表示是顺
|
||||
result[0][1] = result[0][1] + 1;
|
||||
result[1] = result[1].concat(SameGroupList[i]);
|
||||
} else {
|
||||
if (i + result[0][1] <= SameGroupList.length){
|
||||
var ShunGroup = SameGroupList.slice(i, i + result[0][1]);
|
||||
var isShun = check_ShunGroup_isShun();
|
||||
if (isShun){
|
||||
var check_Tong = true;
|
||||
for (var j = 1; j < ShunGroup.length; j++) {
|
||||
if (ShunGroup[j].length != result[0][0]){
|
||||
check_Tong = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (check_Tong) {
|
||||
result[1] = [];
|
||||
for (var j = 0; j < ShunGroup.length; j++) {
|
||||
result[1] = result[1].concat(ShunGroup[j]);
|
||||
}
|
||||
i = i + result[0][1] - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1: //取"顺"最多的牌型 [A,3,4,6,8,8,9,9,J,J,J,Q,Q,Q]
|
||||
//将SameGroupList转成ShunGroupList
|
||||
//如,将[[2,2],[3],[5,5,5],[6,6],[7],[9,9]]转成[[[2,2],[3]], [[5,5,5],[6,6],[7]], [[9,9]]]
|
||||
var changeto_ShunGroupList = function(){
|
||||
var ShunGroupList = [];
|
||||
for (var i = 0; i < SameGroupList.length; i++) {
|
||||
var ArithN_i = this.GetArithN(SameGroupList[i][0]);
|
||||
var isFound = false;
|
||||
for (var j = 0; j < ShunGroupList.length; j++) {
|
||||
var ArithN_j = this.GetArithN(ShunGroupList[j][ShunGroupList[j].length - 1][0]);
|
||||
if (ArithN_i - ArithN_j == 1) {
|
||||
ShunGroupList[j].push(SameGroupList[i]);
|
||||
isFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!isFound){
|
||||
ShunGroupList.push([SameGroupList[i]]);
|
||||
}
|
||||
}
|
||||
return ShunGroupList;
|
||||
}.bind(this);
|
||||
|
||||
//获取ShunGroup中最小的"同"数
|
||||
var get_ShunGroup_minTong = function(){
|
||||
var min_Tong = ShunGroup[0].length;
|
||||
for (var j = 1; j < ShunGroup.length; j++) {
|
||||
if (ShunGroup[j].length < min_Tong) {
|
||||
min_Tong = ShunGroup[j].length;
|
||||
}
|
||||
}
|
||||
return min_Tong;
|
||||
}.bind(this);
|
||||
|
||||
//根据ShunGroup的min_Tong设置result
|
||||
var set_result_byShunGroup_byMinTong = function(){
|
||||
result[0] = [min_Tong, ShunGroup.length];
|
||||
result[1] = [];
|
||||
for (var j = 0; j < ShunGroup.length; j++) {
|
||||
result[1] = result[1].concat(ShunGroup[j].slice(0, min_Tong));
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
var ShunGroupList = changeto_ShunGroupList();
|
||||
//在ShunGroupList中取最长的"顺"
|
||||
for (var i = 0; i < ShunGroupList.length; i++) {
|
||||
var ShunGroup = ShunGroupList[i];
|
||||
var min_Tong = get_ShunGroup_minTong();
|
||||
if (i == 0){
|
||||
set_result_byShunGroup_byMinTong();
|
||||
} else {
|
||||
if (ShunGroup.length > result[0][1]) {
|
||||
set_result_byShunGroup_byMinTong();
|
||||
} else if (ShunGroup.length == result[0][1]) {
|
||||
if (min_Tong >= result[0][0]){
|
||||
set_result_byShunGroup_byMinTong();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
},
|
||||
GetMaxCardTypeByCardListA: function(o_cardlist){
|
||||
/*参数说明 o_cardlist:可以是未排序的牌数组,该函数会实现排序。*/
|
||||
this.SortCardList(o_cardlist);
|
||||
return this.GetMaxCardTypeByCardList(o_cardlist);
|
||||
},
|
||||
|
||||
//新建单张牌类
|
||||
NewClass: function(){
|
||||
var cls = {};
|
||||
cls.New = cls_card2.New;
|
||||
cls.declare = cls_card2.declare;
|
||||
cls.GetId = cls_card2.GetId;
|
||||
cls.GetFlower = cls_card2.GetFlower;
|
||||
cls.GetNumber = cls_card2.GetNumber;
|
||||
cls.GetArithF = cls_card2.GetArithF;
|
||||
cls.SetArithF = cls_card2.SetArithF;
|
||||
cls.GetArithN = cls_card2.GetArithN;
|
||||
cls.SetArithN = cls_card2.SetArithN;
|
||||
cls.GetScore = cls_card2.GetScore;
|
||||
cls.SetScore = cls_card2.SetScore;
|
||||
cls.GetDeal = cls_card2.GetDeal;
|
||||
cls.SetDeal = cls_card2.SetDeal;
|
||||
cls.GetStart = cls_card2.GetStart;
|
||||
cls.SetStart = cls_card2.SetStart;
|
||||
cls.GetPlay = cls_card2.GetPlay;
|
||||
cls.SetPlay = cls_card2.SetPlay;
|
||||
cls.GetIndex = cls_card2.GetIndex;
|
||||
cls.SetIndex = cls_card2.SetIndex;
|
||||
cls.GetOver = cls_card2.GetOver;
|
||||
cls.SetOver = cls_card2.SetOver;
|
||||
cls.GetTag1 = cls_card2.GetTag1;
|
||||
cls.SetTag1 = cls_card2.SetTag1;
|
||||
cls.GetTag2 = cls_card2.GetTag2;
|
||||
cls.SetTag2 = cls_card2.SetTag2;
|
||||
cls.GetTag3 = cls_card2.GetTag3;
|
||||
cls.SetTag3 = cls_card2.SetTag3;
|
||||
cls.FilterCardListByArithF = cls_card2.FilterCardListByArithF;
|
||||
cls.FilterCardListByArithN = cls_card2.FilterCardListByArithN;
|
||||
cls.SortCardList = cls_card2.SortCardList;
|
||||
cls.GetCardListByCardType = cls_card2.GetCardListByCardType;
|
||||
cls.GetCardListByCardTypeA = cls_card2.GetCardListByCardTypeA;
|
||||
cls.GetCardListByCardTypeB = cls_card2.GetCardListByCardTypeB;
|
||||
cls.GetCardListByExtendCardTypeA = cls_card2.GetCardListByExtendCardTypeA;
|
||||
cls.GetMaxCardTypeByCardList = cls_card2.GetMaxCardTypeByCardList;
|
||||
cls.GetMaxCardTypeByCardListA = cls_card2.GetMaxCardTypeByCardListA;
|
||||
return cls;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,804 @@
|
||||
var panduan = function(shangjia,chupai){ //牌型,手牌,出的牌
|
||||
var yici = 0;
|
||||
var can_play = 1;//判断出的牌是否能出
|
||||
var paixing = [];//本次出牌牌型
|
||||
var chupaipx0 = [];//同算法
|
||||
var shangjiapai = [];//上家出的牌
|
||||
var sjpshuzu = [];//上家的牌数组
|
||||
var cpshuzu = [];//本次出牌数组
|
||||
var zuidazha = 0;
|
||||
var shangjiapx = [];
|
||||
if (shangjia) {
|
||||
if ( shangjia.length>0) {
|
||||
shangjiapx = shangjia[0];
|
||||
shangjiapai = game.xs_dapai[game.chu];
|
||||
}
|
||||
}
|
||||
if ( game.people == 2) {//根据人数判断最大的炸
|
||||
zuidazha = 14;
|
||||
} else {
|
||||
zuidazha = 15;
|
||||
}
|
||||
cpshuzu = cls_aset2_gp.CardIdsToCards(gp.pai, chupai);//获取打出牌的11位数组牌
|
||||
cls_card2_gp.SortCardList(cpshuzu);//从小到大排序牌(以下都经过排序)
|
||||
chupai = cls_aset2_gp.CardsToCardIds(cpshuzu);//从小到大排序出牌的ID(以下都经过排序)
|
||||
chupaipx0=cls_card2_gp.GetMaxCardTypeByCardList(cpshuzu, 0);////返回"同"最多的最大牌型(如果"同"相同则取"顺"最多的,如果"顺"也相同则取"值"最大的)
|
||||
|
||||
|
||||
sjpshuzu = cls_aset2_gp.CardIdsToCards(gp.pai, shangjiapai);
|
||||
paixing=chupaipx0[0];
|
||||
if(chupaipx0[0][0]==chupai.length && chupaipx0[0][0]<5)
|
||||
{
|
||||
paixing=chupaipx0[0];//同
|
||||
}else if(chupaipx0[0][1] == chupai.length && chupai.length>=5)
|
||||
{
|
||||
paixing=chupaipx0[0];//顺子
|
||||
}else if(chupaipx0[0][0]==2 && chupaipx0[1].length==chupai.length)
|
||||
{
|
||||
paixing=chupaipx0[0];//连对
|
||||
}else if(chupaipx0[0][0]==3&&chupaipx0[0][1]>1&&chupai.length==chupaipx0[0][1]*5 && chupaipx0[1][chupaipx0[1].length-1][4] != 15){
|
||||
paixing=chupaipx0[0];//飞机
|
||||
}else if(chupaipx0[0][0]==3&&chupaipx0[0][1]>1&&chupai.length==chupaipx0[0][1]*3 && chupaipx0[1][chupaipx0[1].length-1][4] != 15){
|
||||
paixing=chupaipx0[0];//飞机
|
||||
}else if(chupaipx0[0][0]==3&&chupaipx0[0][1]==1&&chupai.length==chupaipx0[0][1]*5){
|
||||
paixing=chupaipx0[0];//3带二
|
||||
}else if(chupaipx0[0][0]==4&&chupaipx0[0][1]==1&&chupai.length==5){
|
||||
paixing=chupaipx0[0];//3带二
|
||||
paixing[0]=chupaipx0[0][0]-1;
|
||||
}else if(chupaipx0[0][0]==3&&chupaipx0[0][1]>=1&&chupai.length <= chupaipx0[0][1]*5 && chupai.length >= chupaipx0[0][1]*3 && game.pai.length == chupai.length){
|
||||
paixing=chupaipx0[0];//3带1
|
||||
}else if (chupaipx0[0][0] == 4 && chupaipx0[0][1] >= 1 && chupai.length > 4) {//有个炸弹
|
||||
if (chupai.length !=game.pai.length) {
|
||||
if (chupai.length == 10) {//10张牌
|
||||
var feiji = cls_card2_gp.GetCardListByCardTypeA(cls_card2_gp.SortCardList(cpshuzu,[0,0]),
|
||||
// 牌的类型 [所有可能,小到大,拆牌,取所有情况] 起始牌
|
||||
[3,2], [0,0,1,1], null ,null);
|
||||
if(feiji.length){//如果有就是飞机
|
||||
paixing = [3,2];
|
||||
}else {
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
}else if (chupai.length == 15) {//15张牌
|
||||
var feiji = cls_card2_gp.GetCardListByCardTypeA(cls_card2_gp.SortCardList(cpshuzu,[0,0]),
|
||||
// 牌的类型 [所有可能,小到大,拆牌,取所有情况] 起始牌
|
||||
[3,3], [0,0,1,0], null ,null);
|
||||
if(feiji.length){//如果有就是飞机
|
||||
paixing = [3,3];
|
||||
}else {
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
}else{
|
||||
if (chupai.length >6) {//多余6张牌
|
||||
if(chupai.length <=9){//飞机 2
|
||||
var feiji = cls_card2_gp.GetCardListByCardTypeA(cls_card2_gp.SortCardList(cpshuzu,[0,0]),
|
||||
// 牌的类型 [所有可能,小到大,拆牌,取所有情况] 起始牌
|
||||
[3,2], [0,0,1,0], null ,null);
|
||||
if(feiji.length){//如果有就是飞机
|
||||
paixing = [3,2];
|
||||
}else {
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
}
|
||||
else if (chupai.length <=12 && chupai.length >9) {//飞机 3
|
||||
var feiji = cls_card2_gp.GetCardListByCardTypeA(cls_card2_gp.SortCardList(cpshuzu,[0,0]),
|
||||
// 牌的类型 [所有可能,小到大,拆牌,取所有情况] 起始牌
|
||||
[3,3], [0,0,1,0], null ,null);
|
||||
if(feiji.length){//如果有就是飞机
|
||||
paixing = [3,3];
|
||||
}else {
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
}
|
||||
else if (chupai.length <= 15) {//飞机 3.4
|
||||
if (shangjiapx[0] == 3 && shangjiapx[1] == 4) {//飞机 4
|
||||
var feiji = cls_card2_gp.GetCardListByCardTypeA(cls_card2_gp.SortCardList(cpshuzu,[0,0]),
|
||||
// 牌的类型 [所有可能,小到大,拆牌,取所有情况] 起始牌
|
||||
[3,4], [0,0,1,0], null ,null);
|
||||
if(feiji.length){//如果有就是飞机
|
||||
paixing = [3,4];
|
||||
}else {
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
}else if(shangjiapx[0] == 3 && shangjiapx[1] == 3) {//飞机 3
|
||||
var feiji = cls_card2_gp.GetCardListByCardTypeA(cls_card2_gp.SortCardList(cpshuzu,[0,0]),
|
||||
// 牌的类型 [所有可能,小到大,拆牌,取所有情况] 起始牌
|
||||
[3,3], [0,0,1,0], null ,null);
|
||||
if(feiji.length){//如果有就是飞机
|
||||
paixing = [3,3];
|
||||
}else {
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
}else {
|
||||
var feiji = cls_card2_gp.GetCardListByCardTypeA(cls_card2_gp.SortCardList(cpshuzu,[0,0]),
|
||||
// 牌的类型 [所有可能,小到大,拆牌,取所有情况] 起始牌
|
||||
[3,3], [0,0,1,0], null ,null);
|
||||
if(feiji.length){//如果有就是飞机
|
||||
paixing = [3,3];
|
||||
}else {
|
||||
var feiji = cls_card2_gp.GetCardListByCardTypeA(cls_card2_gp.SortCardList(cpshuzu,[0,0]),
|
||||
// 牌的类型 [所有可能,小到大,拆牌,取所有情况] 起始牌
|
||||
[3,4], [0,0,1,0], null ,null);
|
||||
if(feiji.length){//如果有就是飞机
|
||||
paixing = [3,4];
|
||||
}else {
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if (chupai.length > 15) {//飞机 3.4
|
||||
if (shangjiapx[0] == 3 && shangjiapx[1] == 4) {//飞机 4
|
||||
var feiji = cls_card2_gp.GetCardListByCardTypeA(cls_card2_gp.SortCardList(cpshuzu,[0,0]),
|
||||
// 牌的类型 [所有可能,小到大,拆牌,取所有情况] 起始牌
|
||||
[3,4], [0,0,1,0], null ,null);
|
||||
if(feiji.length){//如果有就是飞机
|
||||
paixing = [3,4];
|
||||
}else {
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
}else if(shangjiapx[0] == 3 && shangjiapx[1] == 5) {//飞机 3
|
||||
var feiji = cls_card2_gp.GetCardListByCardTypeA(cls_card2_gp.SortCardList(cpshuzu,[0,0]),
|
||||
// 牌的类型 [所有可能,小到大,拆牌,取所有情况] 起始牌
|
||||
[3,5], [0,0,1,0], null ,null);
|
||||
if(feiji.length){//如果有就是飞机
|
||||
paixing = [3,5];
|
||||
}else {
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
}else {
|
||||
var feiji = cls_card2_gp.GetCardListByCardTypeA(cls_card2_gp.SortCardList(cpshuzu,[0,0]),
|
||||
// 牌的类型 [所有可能,小到大,拆牌,取所有情况] 起始牌
|
||||
[3,5], [0,0,1,0], null ,null);
|
||||
if(feiji.length){//如果有就是飞机
|
||||
paixing = [3,5];
|
||||
}else {
|
||||
var feiji = cls_card2_gp.GetCardListByCardTypeA(cls_card2_gp.SortCardList(cpshuzu,[0,0]),
|
||||
// 牌的类型 [所有可能,小到大,拆牌,取所有情况] 起始牌
|
||||
[3,4], [0,0,1,0], null ,null);
|
||||
if(feiji.length){//如果有就是飞机
|
||||
paixing = [3,4];
|
||||
}else {
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
}else {
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
|
||||
if( shangjiapx && shangjiapx.length!=0)//上家出了牌
|
||||
{
|
||||
if(chupai.length != shangjiapai.length)//判断出的牌的长度相同
|
||||
{
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
|
||||
if(paixing[0]!=shangjiapx[0]&&paixing[1]!=shangjiapx[1]&&yici == 0)//判断牌型是否与上家相同
|
||||
{
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
|
||||
if(paixing[0]==shangjiapx[0]&&paixing[1]==shangjiapx[1]&&yici == 0 && shangjiapai.length == paixing[0]*paixing[1])//未带牌的情况
|
||||
{
|
||||
//判断牌型相同的第一张的算法大小
|
||||
|
||||
if(cls_card2_gp.GetArithN(cpshuzu[0]) >= cls_card2_gp.GetArithN(sjpshuzu[0]) + 1)//
|
||||
{
|
||||
can_play = 1;//能出
|
||||
}
|
||||
else
|
||||
{
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
}
|
||||
else if(paixing[0]==shangjiapx[0]&&paixing[1]==shangjiapx[1] &&paixing[0]==3 &&shangjiapai.length > shangjiapx[0]*shangjiapx[1])//3带2比大小
|
||||
{
|
||||
//判断牌型相同的第一张的算法大小
|
||||
if (game.pai.length == chupai.length ) {
|
||||
if(cls_card2_gp.GetArithN(chupaipx0[1][0]) >= cls_card2_gp.GetArithN(cls_card2_gp.GetMaxCardTypeByCardList(sjpshuzu, 0)[1][0]) + 1)
|
||||
{
|
||||
can_play = 1;//能出
|
||||
}
|
||||
else
|
||||
{
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
}else {
|
||||
if(chupai.length != shangjiapai.length)//判断出的牌的长度相同
|
||||
{
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}else {
|
||||
if(cls_card2_gp.GetArithN(chupaipx0[1][0]) >= cls_card2_gp.GetArithN(cls_card2_gp.GetMaxCardTypeByCardList(sjpshuzu, 0)[1][0]) + 1)
|
||||
{
|
||||
can_play = 1;//能出
|
||||
}
|
||||
else
|
||||
{
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(chupai.length == 2&&yici == 0)//长度为2只能为对子
|
||||
{
|
||||
if(cls_card2_gp.GetArithN(cpshuzu[0]) != cls_card2_gp.GetArithN(cpshuzu[1]))
|
||||
{
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
}
|
||||
|
||||
if(yici == 0)
|
||||
{
|
||||
for(var er = 0;er<chupai.length;er++)
|
||||
{
|
||||
if(chupaipx0[0][0]==2&&chupaipx0[0][1]>=2)//大于等于3的牌组中 如果有2 则不能出(顺子和连对)
|
||||
{
|
||||
if(cls_card2_gp.GetArithN(cpshuzu[er]) == 15)
|
||||
{
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
}
|
||||
else if(chupaipx0[0][0] == 1&& chupaipx0[1].length == chupai.length && chupai.length >= 5)
|
||||
{
|
||||
if(cls_card2_gp.GetArithN(cpshuzu[er]) == 15)
|
||||
{
|
||||
can_play = 0;//不能出
|
||||
yici++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(shangjiapx && shangjiapx.length!=0)//上家出牌
|
||||
{
|
||||
if(chupai.length == 4)//判断炸弹是否能出
|
||||
{
|
||||
var s=0;
|
||||
var zhadan = 0;
|
||||
for(var aaa = 0;aaa<=chupai.length - 1;aaa++)
|
||||
{
|
||||
if(cls_card2_gp.GetArithN(cpshuzu[0])==cls_card2_gp.GetArithN(cpshuzu[aaa]))
|
||||
{
|
||||
s++;
|
||||
{
|
||||
if(s==chupai.length)
|
||||
{ //下家炸弹要比上家大或者比上家长
|
||||
if (laizi_mun == 0) {//出真炸弹
|
||||
if((cls_card2_gp.GetArithN(cpshuzu[0]) <= cls_card2_gp.GetArithN(sjpshuzu[0]))&&shangjiapx[0]==4&&shangjiapx[1] == 1)
|
||||
{
|
||||
if (game.laizi_bian[game.chu].length == 0) {
|
||||
can_play = 0;//不能出,炸弹大小小于上家
|
||||
yici++;
|
||||
} else {
|
||||
can_play = 1;
|
||||
}
|
||||
|
||||
}else {
|
||||
can_play = 1;
|
||||
}
|
||||
} else {//出假炸弹
|
||||
if (shangjiapx[0]==4&&shangjiapx[1] == 1) {//上家也是炸
|
||||
if((cls_card2_gp.GetArithN(cpshuzu[0]) > cls_card2_gp.GetArithN(sjpshuzu[0])))
|
||||
{
|
||||
if (game.laizi_bian[game.chu].length == 0) {//上家真炸弹
|
||||
can_play = 0;//不能出,炸弹大小小于上家
|
||||
yici++;
|
||||
} else {
|
||||
can_play = 1;
|
||||
}
|
||||
|
||||
}else {
|
||||
can_play = 0;//不能出,炸弹大小小于上家
|
||||
yici++;
|
||||
}
|
||||
} else {
|
||||
can_play = 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(chupai.length==3)//判断炸弹(无视牌型)
|
||||
{
|
||||
var s=0;
|
||||
for(var aaa = 0;aaa<=chupai.length - 1;aaa++)
|
||||
{
|
||||
if(cls_card2_gp.GetArithN(cpshuzu[0])==cls_card2_gp.GetArithN(cpshuzu[aaa]))
|
||||
{
|
||||
s++;
|
||||
{
|
||||
if(s==chupai.length && cls_card2_gp.GetArithN(cpshuzu[0]) == zuidazha)//判断为最大的炸
|
||||
{
|
||||
if (shangjiapx[0]==4&&shangjiapx[1] == 1 && cls_card2_gp.GetArithN(sjpshuzu[0]) == zuidazha) {//上家出了最大炸
|
||||
can_play = 0;//不能出,炸弹大小小于上家
|
||||
yici++;
|
||||
}else {
|
||||
if (shangjiapx[0]==4&&shangjiapx[1] == 1 && game.laizi_bian[game.chu].length == 0 && laizi_mun > 0){
|
||||
can_play = 0;//不能出,炸弹大小小于上家
|
||||
yici++;
|
||||
}else {
|
||||
can_play = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(chupai.length == 4)//判断炸弹是否能出
|
||||
{
|
||||
var s=0;
|
||||
var zhadan = 0;
|
||||
for(var aaa = 0;aaa<=chupai.length - 1;aaa++)
|
||||
{
|
||||
if(cls_card2_gp.GetArithN(cpshuzu[0])==cls_card2_gp.GetArithN(cpshuzu[aaa]))
|
||||
{
|
||||
s++;
|
||||
{
|
||||
if(s==chupai.length)
|
||||
{
|
||||
if(cls_card2_gp.GetArithN(cpshuzu[0]) == 15)
|
||||
{
|
||||
can_play = 0;//不能出,
|
||||
yici++;
|
||||
}else if(cls_card2_gp.GetArithN(cpshuzu[0]) == 14 && game.people == 2){
|
||||
can_play = 0;//不能出,
|
||||
yici++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var cppx = [];
|
||||
cppx[0] = chupai;
|
||||
cppx[1] = paixing;
|
||||
cppx[2] = chupaipx0[1];
|
||||
if (can_play == 0 ) {
|
||||
cppx[0]=[];
|
||||
cppx[1] = [];
|
||||
cppx[2] = [];
|
||||
}else
|
||||
{
|
||||
var iqas = 0;
|
||||
}
|
||||
return cppx;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var pd_laizi = function(chupai,laizi){//出的牌id,选的癞子牌
|
||||
for(var a = 0;a<gp.pai.cardlist.length;a++)//改变A和2的算法大小
|
||||
{
|
||||
if(cls_card2_gp.GetNumber(gp.pai.cardlist[a])==1&&laizi == 14)
|
||||
{
|
||||
cls_card2_gp.SetArithN(gp.pai.cardlist[a],14);
|
||||
}else if(cls_card2_gp.GetNumber(gp.pai.cardlist[a])==2&&laizi == 15){
|
||||
cls_card2_gp.SetArithN(gp.pai.cardlist[a],15);
|
||||
}
|
||||
}
|
||||
|
||||
if (laizi == 1) {
|
||||
laizi = 14;
|
||||
} else if (laizi == 2){
|
||||
laizi = 15;
|
||||
}
|
||||
laizi_paizu = []; //存癞子的数组
|
||||
laizi_mun = 0; //癞子数目
|
||||
var pais = cls_aset2_gp.CardIdsToCards(gp.pai,chupai); //出的牌转数组
|
||||
cls_card2.SortCardList(pais); //从小到大排序牌(以下都经过排序)
|
||||
if (laizi == 0) {
|
||||
return panduan(game.paixing,chupai)[0];
|
||||
}
|
||||
else {
|
||||
var pai_s = cls_aset2.CardsToCardIds(pais);
|
||||
var paiss = [];
|
||||
var zdz =15;
|
||||
laizi_weizhi = [];
|
||||
for (var i = 0; i < pais.length; i++) { //出的牌中癞子数量以及位置
|
||||
paiss[i] = cls_card2.GetArithN(pais[i]);
|
||||
if (paiss[i] == laizi) {
|
||||
laizi_mun ++;
|
||||
laizi_weizhi.push(i);
|
||||
}
|
||||
}
|
||||
if (laizi_mun == chupai.length) {
|
||||
return panduan(game.paixing,chupai)[0];
|
||||
} else {
|
||||
switch (laizi_mun){
|
||||
case 0:
|
||||
var rr = cls_aset2.CardsToCardIds(pais)
|
||||
return panduan(game.paixing,rr)[0];
|
||||
break;
|
||||
case 1:
|
||||
var sz = [];
|
||||
if ( game.people == 2) {
|
||||
zdz =14;
|
||||
}
|
||||
for (var i = zdz; i >= 3; i--) {
|
||||
cls_card2_gp.SetArithN(pais[laizi_weizhi[0]],i);
|
||||
var rr = cls_aset2.CardsToCardIds(pais);
|
||||
var keyichu = panduan(game.paixing,rr)[0];
|
||||
var zd = panduan(game.paixing,rr)[1];
|
||||
if(keyichu.length!=0)
|
||||
{
|
||||
sz.push([i]);
|
||||
laizi_paizu[laizi_paizu.length]=[];
|
||||
var ss = cls_aset2.CardIdsToCards(gp.pai,pai_s);
|
||||
ss = cls_card2_gp.SortCardList(ss);
|
||||
var uu = cls_aset2.CardsToCardIds(ss)
|
||||
laizi_paizu[laizi_paizu.length-1] = laizi_paizu[laizi_paizu.length-1].concat(uu.slice());
|
||||
if(zd[0] ==4 && chupai.length == 4){//如果为炸弹直接跳出
|
||||
sz = [[i]];
|
||||
laizi_paizu = [laizi_paizu[laizi_paizu.length-1]];
|
||||
a = 0;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
var sz = [];
|
||||
if ( game.people == 2) {
|
||||
zdz =14;
|
||||
}
|
||||
for (var a = zdz; a >= 3; a--) {
|
||||
for (var b = zdz; b >= 3; b--) {
|
||||
cls_card2_gp.SetArithN(pais[laizi_weizhi[0]],a);
|
||||
cls_card2_gp.SetArithN(pais[laizi_weizhi[1]],b);
|
||||
var rr = cls_aset2.CardsToCardIds(pais);
|
||||
var keyichu = panduan(game.paixing,rr)[0];
|
||||
var zd = panduan(game.paixing,rr)[1];
|
||||
if(keyichu.length!=0)
|
||||
{
|
||||
sz.push([a,b]);
|
||||
|
||||
laizi_paizu[laizi_paizu.length]=[];
|
||||
var ss = cls_aset2.CardIdsToCards(gp.pai,pai_s);
|
||||
ss = cls_card2_gp.SortCardList(ss);
|
||||
var uu = cls_aset2.CardsToCardIds(ss)
|
||||
laizi_paizu[laizi_paizu.length-1] = laizi_paizu[laizi_paizu.length-1].concat(uu.slice());
|
||||
if(zd[0] ==4 && chupai.length == 4){//如果为炸弹直接跳出
|
||||
sz = [[a,b]];
|
||||
laizi_paizu = [laizi_paizu[laizi_paizu.length-1]];
|
||||
a = 0;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
var sz = [];
|
||||
if ( game.people == 2) {
|
||||
zdz =14;
|
||||
}
|
||||
for (var c = zdz; c >= 3; c--) {
|
||||
for (var a = zdz; a >= 3; a--) {
|
||||
for (var b = zdz; b >= 3; b--) {
|
||||
cls_card2_gp.SetArithN(pais[laizi_weizhi[0]],c);
|
||||
cls_card2_gp.SetArithN(pais[laizi_weizhi[1]],a);
|
||||
cls_card2_gp.SetArithN(pais[laizi_weizhi[2]],b);
|
||||
var rr = cls_aset2.CardsToCardIds(pais);
|
||||
var keyichu = panduan(game.paixing,rr)[0];
|
||||
var zd = panduan(game.paixing,rr)[1];
|
||||
if(keyichu.length!=0)
|
||||
{
|
||||
sz.push([c,a,b]);
|
||||
laizi_paizu[laizi_paizu.length]=[];
|
||||
var ss = cls_aset2.CardIdsToCards(gp.pai,pai_s);
|
||||
ss = cls_card2_gp.SortCardList(ss);
|
||||
var uu = cls_aset2.CardsToCardIds(ss)
|
||||
laizi_paizu[laizi_paizu.length-1] = laizi_paizu[laizi_paizu.length-1].concat(uu.slice());
|
||||
if(zd[0] ==4 && chupai.length == 4){//如果为炸弹直接跳出
|
||||
sz = [[c,a,b]];
|
||||
laizi_paizu = [laizi_paizu[laizi_paizu.length-1]];
|
||||
a = 0;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
var sz = [];
|
||||
if ( game.people == 2) {
|
||||
zdz =14;
|
||||
}
|
||||
for (var d = zdz; d >= 3; d--) {
|
||||
for (var c = zdz; c >= 3; c--) {
|
||||
for (var a = zdz; a >= 3; a--) {
|
||||
for (var b = zdz; b >= 3; b--) {
|
||||
cls_card2_gp.SetArithN(pais[laizi_weizhi[2]],d);
|
||||
cls_card2_gp.SetArithN(pais[laizi_weizhi[1]],c);
|
||||
cls_card2_gp.SetArithN(pais[laizi_weizhi[3]],a);
|
||||
cls_card2_gp.SetArithN(pais[laizi_weizhi[0]],b);
|
||||
var rr = cls_aset2.CardsToCardIds(pais);
|
||||
var keyichu = panduan(game.paixing,rr)[0];
|
||||
var zd = panduan(game.paixing,rr)[1];
|
||||
if(keyichu.length!=0)
|
||||
{
|
||||
sz.push([d,c,a,b]);
|
||||
laizi_paizu[laizi_paizu.length]=[];
|
||||
var ss = cls_aset2.CardIdsToCards(gp.pai,pai_s);
|
||||
ss = cls_card2_gp.SortCardList(ss);
|
||||
var uu = cls_aset2.CardsToCardIds(ss)
|
||||
laizi_paizu[laizi_paizu.length-1] = laizi_paizu[laizi_paizu.length-1].concat(uu.slice());
|
||||
if(zd[0] ==4 && chupai.length == 4){//如果为炸弹直接跳出
|
||||
sz = [[d,c,a,b]];
|
||||
laizi_paizu = [laizi_paizu[laizi_paizu.length-1]];
|
||||
a = 0;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for(var a = 0;a<gp.pai.cardlist.length;a++)
|
||||
{
|
||||
if(cls_card2_gp.GetNumber(gp.pai.cardlist[a])==laizi){
|
||||
cls_card2_gp.SetArithN(gp.pai.cardlist[a],laizi); //癞子算法还原
|
||||
}
|
||||
if ( laizi > 13 && laizi < 16) { //癞子为A和2
|
||||
if(cls_card2_gp.GetNumber(gp.pai.cardlist[a])==laizi-13){
|
||||
cls_card2_gp.SetArithN(gp.pai.cardlist[a],laizi); //癞子算法还原
|
||||
}
|
||||
}
|
||||
}
|
||||
for(var p = 0;p<sz.length;p++)
|
||||
{
|
||||
if(sz[p].length>1)
|
||||
{
|
||||
systemSort(sz[p]);
|
||||
}
|
||||
}
|
||||
//console.log(sz);
|
||||
|
||||
shanchu = sz.distinct_t()[1];//癞子位置
|
||||
shanchu_pai = sz.distinct_t()[0];//癞子牌型算法
|
||||
jieguo_pai = [];
|
||||
paipai = [];
|
||||
|
||||
for(var b=0;b<shanchu.length;b++)
|
||||
{
|
||||
for(var a=0;a<laizi_paizu.length;a++)//去掉多个癞子位置不同但结果相同的情况
|
||||
{
|
||||
if(shanchu[b] == a)
|
||||
{
|
||||
jieguo_pai.push(laizi_paizu[a]);
|
||||
paipai.push(sz[a]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (jieguo_pai.length>1 ) {
|
||||
|
||||
for(var i = 0; i < jieguo_pai.length; i++){//改变后的可出牌
|
||||
jieguo_pai_gai[i] = [];
|
||||
for (var j = 0; j < jieguo_pai[i].length; j++) {
|
||||
jieguo_pai_gai[i].push(jieguo_pai[i][j]);
|
||||
}
|
||||
}
|
||||
for (var i = 0; i < jieguo_pai.length; i++) {//把癞子id换成改变后的
|
||||
var yici = 0;
|
||||
for (var a = 0; a < jieguo_pai[i].length; a++) {
|
||||
if (jieguo_pai[i][a]%13+1 ==game.laizi ) {
|
||||
jieguo_pai_gai[i][a]= (paipai[i][yici]-1)%13;
|
||||
yici++;
|
||||
}
|
||||
}
|
||||
}
|
||||
var tongpaixing = [];
|
||||
for (var i = 0; i < jieguo_pai_gai.length; i++ ) {
|
||||
|
||||
tongpaixing[i] = panduan(game.paixing,jieguo_pai_gai[i]);
|
||||
tongpaixing[i].splice(0,1);
|
||||
}
|
||||
for (var i = 0; i < jieguo_pai_gai.length-1; i++) { //删除同类型的牌
|
||||
if (tongpaixing.length>1 ) { //当牌型大于一的情况
|
||||
for (var j = i+1;j<tongpaixing.length;j++) { //遍历所有的牌型 每一个都比较
|
||||
if (tongpaixing[i][0][0] == tongpaixing[j][0][0] && tongpaixing[i][0][1] == tongpaixing[j][0][1]) { //牌型相同
|
||||
if ( tongpaixing[i][1][0][4]>tongpaixing[j][1][0][4]) { //牌型大于后面的删除后面
|
||||
jieguo_pai.splice(j,1);
|
||||
paipai.splice(j,1);
|
||||
tongpaixing.splice(j,1);
|
||||
jieguo_pai_gai.splice(j,1);
|
||||
i = -1;
|
||||
break;
|
||||
}else {//否则删除前面的
|
||||
jieguo_pai.splice(i,1);
|
||||
paipai.splice(i,1);
|
||||
tongpaixing.splice(i,1);
|
||||
jieguo_pai_gai.splice(i,1);
|
||||
i = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return jieguo_pai;
|
||||
|
||||
|
||||
}
|
||||
|
||||
Array.prototype.distinct_t = function() { //数组去重
|
||||
var arr = this,
|
||||
i,
|
||||
obj = {},
|
||||
result = [],
|
||||
dd = [],
|
||||
len = arr.length;
|
||||
for(i = 0; i < arr.length; i++) {
|
||||
if(!obj[arr[i]]) { //如果能查找到,证明数组元素重复了
|
||||
obj[arr[i]] = 1;
|
||||
result.push(arr[i]);
|
||||
dd.push(i);
|
||||
}
|
||||
}
|
||||
return [result,dd];
|
||||
}
|
||||
|
||||
function systemSort(array) { //快速排序
|
||||
return array.sort(function(a, b) {
|
||||
return a - b;
|
||||
});
|
||||
}
|
||||
|
||||
Array.prototype.duplicate = function() { //数组中相同数tmp 有几个tem.length
|
||||
var tmp = [];
|
||||
this.concat().sort().sort(function(a, b) {
|
||||
if(a == b && tmp.indexOf(a) === -1) tmp.push(a);
|
||||
});
|
||||
return tmp;
|
||||
}
|
||||
var gp_ui_duoxuan = function(kechu)
|
||||
{
|
||||
set_group(222,37,1,0,0);
|
||||
set_group(223,37,0,0,0);
|
||||
set_self(1145,21,160+100*kechu.length,0,0);
|
||||
set_self(1145,20,160+75*kechu[0].length,0,0);
|
||||
set_self(1145,18,640-get_self(1145,20)/2,0,0);
|
||||
if (get_self(1145,20)>1290) {
|
||||
set_self(1145,20,1290,0,0);
|
||||
}
|
||||
for (var i = 1152; i < 1186; i++) {
|
||||
set_self(i,33,55,0,0);
|
||||
}
|
||||
var gbh_laizi = [[]]; //癞子为改编后牌组
|
||||
var cishu = 0;
|
||||
for (var i = 0; i < kechu.length; i++) {//把癞子id换成改变后的
|
||||
var yici = 0;
|
||||
for (var a = 0; a < kechu[i].length; a++) {
|
||||
gbh_laizi[i][a]= kechu[i][a];
|
||||
if (kechu[i][a]%13+1 ==game.laizi ) {
|
||||
gbh_laizi[i][a]= paipai[i][yici]-1;
|
||||
yici++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (var a=0;a<kechu.length;a++) {
|
||||
for (var i=0;i<kechu[0].length;i++) {
|
||||
var dxpaishu = kechu[0].length;
|
||||
set_self(1152+dxpaishu*a+i,37,1,0,0);
|
||||
set_self(1152+dxpaishu*a+i,43,kechu[a][i],0,0);
|
||||
set_self(1152+dxpaishu*a+i,19,170+a*100,0,0);
|
||||
set_self(1152+dxpaishu*a,18,610-kechu[0].length*73/2,0,0);
|
||||
set_self(1152+dxpaishu*a+i,18,get_self(1152+dxpaishu*a,18,0,0,0)+73*i,0,0);
|
||||
}
|
||||
gp_ui_laizidx(kechu[a],paipai[a],1152+a*kechu[0].length);
|
||||
set_self(1148+a,19,get_self(1152+dxpaishu*a,19)+40,0,0);
|
||||
set_self(1148+a,18,get_self(1152+dxpaishu*a,18)+25,0,0);
|
||||
set_self(1148+a,20,75*kechu[0].length,0,0);
|
||||
set_self(1148+a,37,1,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var gp_ui_laizidx = function(pai,_paipai,diyz){ //癞子出牌变帧 pai为id paipai为该变后的算法大小 diyz为精灵id
|
||||
var bianzhen = [];
|
||||
var yici = 0;
|
||||
|
||||
for(var i=0;i<pai.length;i++)
|
||||
{
|
||||
bianzhen[i] = pai[i];
|
||||
|
||||
var da=pai[i]%13+1;
|
||||
if ( da == game.laizi ) {
|
||||
bianzhen[i] = _paipai[yici]-1;
|
||||
yici++;
|
||||
var xiao =bianzhen[i]%13+1
|
||||
set_self(diyz+i,1,567,0,0); //癞子牌变帧
|
||||
set_self(diyz+i,43,xiao,0,0);
|
||||
}else {
|
||||
set_self(diyz+i,1,53,0,0); //癞子牌变帧
|
||||
set_self(diyz+i,43, bianzhen[i]+1,0,0);
|
||||
set_self(diyz+i,37,1,0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
////////////////////////////////////////////////////////
|
||||
///////////小局类/////////////////
|
||||
var cls_aset2_gp=cls_aset2.NewClass();
|
||||
//几副牌
|
||||
cls_aset2_gp.get_cardcount = function(){
|
||||
return 1;
|
||||
}
|
||||
//初始化牌列表
|
||||
cls_aset2_gp.initcardlist = function(o_aset){
|
||||
//几副牌
|
||||
var card_count = this.get_cardcount();
|
||||
//牌类
|
||||
var card_class = this.get_cardclass();
|
||||
//初始化
|
||||
for (var i = 1; i <= card_count; i++){ //几副牌
|
||||
for (var j = 1; j <= 4; j++){ //方块、梅花、红心、黑桃四种花色
|
||||
for (var k = 1; k <= 13; k++){ //A到K
|
||||
var id = (i - 1) * 54 + (j - 1) * 13 + k - 1; //牌的绝对id
|
||||
//新建一张牌
|
||||
var card_object = card_class.New(id);
|
||||
o_aset.cardlist.push(card_object);
|
||||
}
|
||||
}
|
||||
//小王
|
||||
var card_object = card_class.New((i - 1) * 54 + 53 - 1);
|
||||
o_aset.cardlist.push(card_object);
|
||||
//大王
|
||||
var card_object = card_class.New((i - 1) * 54 + 54 - 1);
|
||||
o_aset.cardlist.push(card_object);
|
||||
}
|
||||
}
|
||||
//每人需要发多少张牌
|
||||
cls_aset2_gp.get_dealcount = function(o_aset, o_desk){
|
||||
return 17;
|
||||
}
|
||||
//将牌id列表转换成牌对象列表
|
||||
cls_aset2_gp.CardIdsToCards = function(o_aset, cardidlist){
|
||||
var cardlist = [];
|
||||
for (var i = 0; i < cardidlist.length; i++){
|
||||
if(cardidlist[i]==214||cardidlist[i]==215){
|
||||
var o_card = o_aset.cardlist[cardidlist[i]-52];
|
||||
}else{
|
||||
var o_card = o_aset.cardlist[cardidlist[i]];
|
||||
}
|
||||
cardlist.push(o_card);
|
||||
}
|
||||
return cardlist;
|
||||
}
|
||||
//设置每张牌的分值
|
||||
cls_aset2_gp.setcardscore = function(o_aset){
|
||||
//下面的代码是设置5、10、K分值的例子。类似功能需要在子游戏中重写该方法
|
||||
for (var i = 0; i < o_aset.cardlist.length; i++){
|
||||
var o_card = o_aset.cardlist[i];
|
||||
var card_deal = this.get_cardclass().GetDeal(o_card);
|
||||
if (card_deal != -2){
|
||||
var card_number = this.get_cardclass().GetNumber(o_card);
|
||||
switch (card_number){
|
||||
case 5:
|
||||
this.get_cardclass().SetScore(o_card, 5);
|
||||
break;
|
||||
case 10:
|
||||
this.get_cardclass().SetScore(o_card, 10);
|
||||
break;
|
||||
case 13:
|
||||
this.get_cardclass().SetScore(o_card, 10);
|
||||
break;
|
||||
default :
|
||||
this.get_cardclass().SetScore(o_card, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
///////////牌类/////////////////
|
||||
var cls_card2_gp=cls_card2.NewClass();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
782
codes/games/client/Projects/guanpai-jx/js/gp_cards/minhttp.js
Normal file
782
codes/games/client/Projects/guanpai-jx/js/gp_cards/minhttp.js
Normal file
@@ -0,0 +1,782 @@
|
||||
(function(wnd, undef){
|
||||
|
||||
//复制json对象
|
||||
function min_copyjson(json)
|
||||
{
|
||||
return JSON.parse(JSON.stringify(json));
|
||||
}
|
||||
|
||||
function min_clone(myObj){
|
||||
if(!myObj)
|
||||
return myObj;
|
||||
if(typeof(myObj) != 'object')
|
||||
return myObj;
|
||||
|
||||
var myNewObj = new Object();
|
||||
|
||||
for(var i in myObj)
|
||||
myNewObj[i] = min_clone(myObj[i]);
|
||||
|
||||
return myNewObj;
|
||||
}
|
||||
|
||||
//json对象转字符串
|
||||
function min_jsontostr(json) {
|
||||
return JSON.stringify(json);
|
||||
}
|
||||
|
||||
//字符串转json对象
|
||||
function min_strtojson(str) {
|
||||
return JSON.parse(str);
|
||||
}
|
||||
|
||||
//字符串转整型 def:转换失败时返回的默认值
|
||||
function min_strtoint(str, def) {
|
||||
var i = parseInt(str);
|
||||
if (i == 0) {
|
||||
return 0;
|
||||
};
|
||||
if (!i) { //=0也会进来
|
||||
if (!def) {
|
||||
def = 0;
|
||||
};
|
||||
i = def;
|
||||
}
|
||||
return i;
|
||||
};
|
||||
|
||||
//整型转字符串
|
||||
function min_inttostr(i) {
|
||||
return i.toString();
|
||||
};
|
||||
|
||||
//去左空格
|
||||
function min_ltrim(s){
|
||||
return s.replace(/(^\s*)/g, "");
|
||||
};
|
||||
|
||||
//去右空格;
|
||||
function min_rtrim(s){
|
||||
return s.replace(/(\s*$)/g, "");
|
||||
};
|
||||
|
||||
//去左右空格;
|
||||
function min_trim(s){
|
||||
return s.replace(/(^\s*)|(\s*$)/g, "");
|
||||
};
|
||||
|
||||
//整除
|
||||
function min_div(i, b)
|
||||
{
|
||||
if (!b) {
|
||||
return parseInt(i);
|
||||
}
|
||||
return parseInt(i / b);
|
||||
};
|
||||
|
||||
//取余数
|
||||
function min_mod(a, b){
|
||||
return a % b;
|
||||
};
|
||||
|
||||
//取绝对值
|
||||
function min_abs(b) {
|
||||
return Math.abs(b);
|
||||
};
|
||||
|
||||
//取随机数(范围包含了min和max)
|
||||
function min_random(min, max) {
|
||||
var Range = max - min;
|
||||
var Rand = Math.random();
|
||||
return (min + Math.round(Rand * Range));
|
||||
};
|
||||
//取随机数1
|
||||
function min_random1(num) {
|
||||
return parseInt(Math.random()*num);
|
||||
};
|
||||
|
||||
//随机字符串
|
||||
function min_randomChar(length){
|
||||
var x = "0123456789";
|
||||
var y = "qwertyuioplkjhgfdsazxcvbnm";
|
||||
var z = "QWERTYUIOPLKJHGFDSAZXCVBNM";
|
||||
var tmp = "";
|
||||
for (var i = 0; i < length; i++) {
|
||||
switch(min_random(0, 2)) {
|
||||
case 0:
|
||||
tmp += x.charAt(Math.ceil(Math.random()*100000000)%x.length);
|
||||
break;
|
||||
case 1:
|
||||
tmp += y.charAt(Math.ceil(Math.random()*100000000)%y.length);
|
||||
break;
|
||||
case 2:
|
||||
tmp += z.charAt(Math.ceil(Math.random()*100000000)%z.length);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
// var timestamp = new Date().getTime();
|
||||
// return timestamp + tmp;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
//取长度
|
||||
function min_length(key) {
|
||||
if (typeof(key) != "string") {
|
||||
var key = key + "";
|
||||
}
|
||||
return key.length;
|
||||
}
|
||||
|
||||
//字符全替换 ignoreCase:true忽略大小写 false不忽略大小写
|
||||
function min_replaceAll(str, str_old, str_new, ignoreCase)
|
||||
{
|
||||
if (!RegExp.prototype.isPrototypeOf(str_old)) {
|
||||
return str.replace(new RegExp(str_old, (ignoreCase ? "gi": "g")), str_new);
|
||||
} else {
|
||||
return str.replace(str_old, str_new);
|
||||
}
|
||||
}
|
||||
|
||||
//取本地当前时间,格式yyyy-MM-dd HH:MM:SS
|
||||
function min_now()
|
||||
{
|
||||
var date = new Date();
|
||||
var seperator1 = "-";
|
||||
var seperator2 = ":";
|
||||
var month = date.getMonth() + 1;
|
||||
var strDate = date.getDate();
|
||||
if (month >= 1 && month <= 9) {
|
||||
month = "0" + month;
|
||||
}
|
||||
if (strDate >= 0 && strDate <= 9) {
|
||||
strDate = "0" + strDate;
|
||||
}
|
||||
var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
|
||||
+ " " + date.getHours() + seperator2 + date.getMinutes()
|
||||
+ seperator2 + date.getSeconds();
|
||||
return currentdate;
|
||||
}
|
||||
|
||||
//取本地当前日期,格式yyyy-MM-dd
|
||||
function min_day()
|
||||
{
|
||||
var date = new Date();
|
||||
var seperator1 = "-";
|
||||
var month = date.getMonth() + 1;
|
||||
var strDate = date.getDate();
|
||||
if (month >= 1 && month <= 9) {
|
||||
month = "0" + month;
|
||||
}
|
||||
if (strDate >= 0 && strDate <= 9) {
|
||||
strDate = "0" + strDate;
|
||||
}
|
||||
var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate;
|
||||
return currentdate;
|
||||
}
|
||||
|
||||
//获取时间差
|
||||
function min_datediff(startTime, endTime, diffType) {
|
||||
//将xxxx-xx-xx的时间格式,转换为 xxxx/xx/xx的格式
|
||||
startTime = startTime.replace(/\-/g, "/");
|
||||
endTime = endTime.replace(/\-/g, "/");
|
||||
|
||||
//将计算间隔类性字符转换为小写
|
||||
diffType = diffType.toLowerCase();
|
||||
var sTime = new Date(startTime); //开始时间
|
||||
var eTime = new Date(endTime); //结束时间
|
||||
//作为除数的数字
|
||||
var divNum = 1;
|
||||
switch (diffType) {
|
||||
case "second":
|
||||
divNum = 1000;
|
||||
break;
|
||||
case "minute":
|
||||
divNum = 1000 * 60;
|
||||
break;
|
||||
case "hour":
|
||||
divNum = 1000 * 3600;
|
||||
break;
|
||||
case "day":
|
||||
divNum = 1000 * 3600 * 24;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return parseInt((eTime.getTime() - sTime.getTime()) / parseInt(divNum));
|
||||
}
|
||||
|
||||
//本地存储数据
|
||||
function min_writefile_gameid(msg, gameid, fileid) {
|
||||
localStorage.setItem("file_" + gameid + "_" + fileid, msg);
|
||||
}
|
||||
|
||||
//读取本地数据
|
||||
function min_readfile_gameid(gameid, fileid) {
|
||||
return localStorage.getItem("file_" + gameid + "_" + fileid);
|
||||
}
|
||||
|
||||
//取当前页面url中的参数值 def:没取到时返回的默认值
|
||||
function min_getQueryString(name, def) {
|
||||
var self = window;
|
||||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
|
||||
var r = self.location.search.substr(1).match(reg);
|
||||
if (r != null) {
|
||||
return unescape(r[2])
|
||||
} else {
|
||||
if (def) {
|
||||
return def;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//获取当前页面的路径
|
||||
function min_getUrlRootPath() {
|
||||
var curWwwPath = window.location.host;
|
||||
var pathName = window.location.pathname;
|
||||
return curWwwPath + pathName.substr(0,pathName.lastIndexOf('/'));
|
||||
}
|
||||
|
||||
//设置cookie
|
||||
function min_setCookie(name, value, exp_minute) {
|
||||
if (!exp_minute) {
|
||||
exp_minute = 20; //默认时效20分钟
|
||||
}
|
||||
var exp = new Date();
|
||||
exp.setTime(exp.getTime() + exp_minute*60*1000);
|
||||
document.cookie = name + "=" + value + ";expires=" + exp.toGMTString()+';path=/';
|
||||
}
|
||||
|
||||
//读取cookie
|
||||
function min_getCookie(name) {
|
||||
var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
|
||||
if(arr != null)
|
||||
return arr[2];
|
||||
return null;
|
||||
}
|
||||
|
||||
//删除cookie
|
||||
function min_delCookie(name) {
|
||||
var value = min_getCookie(name);
|
||||
if (value) {
|
||||
min_setCookie(name, value, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//获取一个dom
|
||||
function min_getdom(id)
|
||||
{
|
||||
return document.getElementById(id);
|
||||
};
|
||||
|
||||
//设置一个dom属性值 id:dom、或dom的id、或实列,key:属性,val:值
|
||||
function min_setdom(id, key, val) {
|
||||
var obj;
|
||||
if (typeof(id) == 'string') {
|
||||
obj = min_getdom(id);
|
||||
}
|
||||
else {
|
||||
obj = id;
|
||||
}
|
||||
obj.setAttribute(key, val);
|
||||
}
|
||||
|
||||
//添加一段innerHTML
|
||||
function min_uphtml(id, str, isadd) {
|
||||
/*
|
||||
setAttribute是设置网页元素的属性,就是在标签里内如<img />标签的src属性。
|
||||
innerHTML不是属性,只是JS里内代表一个双标记中间的文本,如:<span> </span>中间的字符。
|
||||
*/
|
||||
var obj = window.document.getElementById(id);
|
||||
if (isadd) {
|
||||
obj.innerHTML = obj.innerHTML + str;
|
||||
}
|
||||
else {
|
||||
obj.innerHTML = str;
|
||||
}
|
||||
}
|
||||
|
||||
//新建一个定时器每隔time毫秒执行一次func函数,函数返回定时器id
|
||||
function min_ontime(func, time)
|
||||
{
|
||||
return setInterval(func, time);
|
||||
}
|
||||
|
||||
//新建一个定时器time毫秒后执行一次func函数(只执行一次),函数返回定时器id
|
||||
function min_ontimeout(func, time)
|
||||
{
|
||||
return setTimeout(func, time);
|
||||
}
|
||||
|
||||
//关闭定时器id为timerid的定时器
|
||||
function min_closetime(timerid)
|
||||
{
|
||||
return clearTimeout(timerid);
|
||||
}
|
||||
|
||||
//encode转码
|
||||
function min_encode(s)
|
||||
{
|
||||
return encodeURIComponent(s);
|
||||
}
|
||||
|
||||
//decode解码
|
||||
function min_decode(s)
|
||||
{
|
||||
return decodeURIComponent(s);
|
||||
}
|
||||
|
||||
//新建一个tcp连接
|
||||
function min_tcp(config)
|
||||
{
|
||||
var ws = new WebSocket("ws://" + config.ipport); //不要带htpp,例如127.0.0.1:5414
|
||||
|
||||
//连接上服务器后触发的事件
|
||||
if (config.onopen) {
|
||||
ws.onopen = config.onopen;
|
||||
};
|
||||
|
||||
//收到服务器发来的数据包后触发的事件,onmessage函数会有一个底层的msg参数,其中msg.data才是服务器发过来的业务数据
|
||||
if (config.onmessage) {
|
||||
ws.onmessage = config.onmessage;
|
||||
};
|
||||
|
||||
//断开与服务器的连接后触发的事件
|
||||
if (config.onclose) {
|
||||
ws.onclose = config.onclose; //断开连接的事件
|
||||
};
|
||||
|
||||
//错误事件
|
||||
if (config.onerror) {
|
||||
ws.onerror = config.onerror; //错误事件
|
||||
};
|
||||
|
||||
return ws;
|
||||
}
|
||||
|
||||
//http请求
|
||||
function min_http(config) {
|
||||
/*
|
||||
config =
|
||||
{
|
||||
url: "http://127.0.0.1:5414/index.html",
|
||||
type: "POST", //GET or POST 方法
|
||||
data: "", //请求的数据
|
||||
success: func_callback_succ, //请求成功后的回调函数function(data,status,callbackdata)
|
||||
error: func_callback_err, //请求失败后的回调函数function(data,status)
|
||||
callbackdata: "", //作为回调函数第三个参数带入回调函数的数据
|
||||
//enurl: 0, //是否encodeURIComponent转码, 默认0不转码
|
||||
//deurl: 0, //是否decodeURIComponent解码,默认0不解码
|
||||
debugLog: false, //是否输出debug日志,默认false
|
||||
method: "(OPTIONAL) True for async and False for Non-async | By default its Async"
|
||||
}
|
||||
*/
|
||||
if (!config.debugLog) {
|
||||
config.debugLog = false;
|
||||
}
|
||||
if (!config.enurl) {
|
||||
config.enurl = 0;
|
||||
}
|
||||
if (!config.deurl) {
|
||||
config.deurl = 0;
|
||||
}
|
||||
if (!config.method) {
|
||||
config.method = true;
|
||||
}
|
||||
|
||||
if (!config.url) {
|
||||
if (config.debugLog == true) {
|
||||
console.log("No Url!");
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
||||
if (!config.type) {
|
||||
if (config.debugLog == true) {
|
||||
console.log("No Default type (GET/POST) given!");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var xmlhttp = initXMLhttp();
|
||||
|
||||
xmlhttp.onreadystatechange = function() {
|
||||
if (xmlhttp.readyState == 4 && xmlhttp.status == 200 && config.success)
|
||||
{
|
||||
var responseText = mydecodeURIComponent(xmlhttp.responseText, config.deurl);
|
||||
if (!config.callbackdata) {
|
||||
config.success(responseText, xmlhttp.readyState);
|
||||
}
|
||||
else {
|
||||
config.success(responseText, xmlhttp.readyState, config.callbackdata);
|
||||
}
|
||||
if (config.debugLog == true) {
|
||||
console.log("SuccessResponse");
|
||||
}
|
||||
if (config.debugLog == true) {
|
||||
console.log("Response Data:" + xmlhttp.responseText);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (xmlhttp.readyState == 4 && config.error)
|
||||
{
|
||||
if (!config.callbackdata) {
|
||||
config.error(xmlhttp.readyState, xmlhttp.status);
|
||||
}
|
||||
else {
|
||||
config.error(xmlhttp.readyState, xmlhttp.status, config.callbackdata);
|
||||
}
|
||||
}
|
||||
if (config.debugLog == true) {
|
||||
console.log("FailureResponse --> readyState:" + xmlhttp.readyState + ", Status:" + xmlhttp.status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var sendString = [],
|
||||
sendData = config.data;
|
||||
if (typeof sendData === "string") {
|
||||
var tmpArr = String.prototype.split.call(sendData, '&');
|
||||
for (var i = 0, j = tmpArr.length; i < j; i++) {
|
||||
var datum = tmpArr[i].split('=');
|
||||
if (datum[1]) {
|
||||
sendString.push(myencodeURIComponent(datum[0], config.enurl) + "=" + myencodeURIComponent(datum[1], config.enurl));
|
||||
}
|
||||
else {
|
||||
sendString.push(myencodeURIComponent(datum[0], config.enurl));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (typeof sendData === 'object' && !(sendData instanceof String || (FormData && sendData instanceof FormData))) {
|
||||
for (var k in sendData) {
|
||||
var datum = sendData[k];
|
||||
if (Object.prototype.toString.call(datum) == "[object Array]") {
|
||||
for (var i = 0, j = datum.length; i < j; i++) {
|
||||
sendString.push(myencodeURIComponent(k, config.enurl) + "[]=" + myencodeURIComponent(datum[i], config.enurl));
|
||||
}
|
||||
}
|
||||
else {
|
||||
sendString.push(myencodeURIComponent(k, config.enurl) + "=" + myencodeURIComponent(datum, config.enurl));
|
||||
}
|
||||
}
|
||||
}
|
||||
sendString = sendString.join('&');
|
||||
|
||||
if (config.type == "GET") {
|
||||
var g;
|
||||
var i = config.url.lastIndexOf("?");
|
||||
if (i > 8) {
|
||||
g = "&";
|
||||
} else {
|
||||
g = "?";
|
||||
}
|
||||
var ddata = new Date().getMilliseconds();
|
||||
if (sendString == "") {
|
||||
sendString = '#dfw1977=' + (ddata + min_random(1, 99999) * 1000);
|
||||
} else {
|
||||
sendString = sendString + '#dfw1977=' + (ddata + min_random(1, 99999) * 1000);
|
||||
}
|
||||
xmlhttp.open("GET", config.url + g + sendString, config.method);
|
||||
xmlhttp.send();
|
||||
|
||||
if (config.debugLog == true) {
|
||||
console.log("GET fired at:" + config.url + "?" + sendString);
|
||||
}
|
||||
}
|
||||
if (config.type == "POST") {
|
||||
xmlhttp.open("POST", config.url, config.method);
|
||||
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
|
||||
xmlhttp.send(sendString);
|
||||
|
||||
if (config.debugLog == true) {
|
||||
console.log("POST fired at:" + config.url + " || Data:" + sendString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function initXMLhttp() {
|
||||
var xmlhttp;
|
||||
if (window.XMLHttpRequest) {
|
||||
//code for IE7,firefox chrome and above
|
||||
xmlhttp = new XMLHttpRequest();
|
||||
} else {
|
||||
//code for Internet Explorer
|
||||
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
return xmlhttp;
|
||||
}
|
||||
|
||||
//转码
|
||||
function myencodeURIComponent(s, ifif)
|
||||
{
|
||||
if (ifif == 1) {
|
||||
return min_encode(s);
|
||||
} else {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
//解码
|
||||
function mydecodeURIComponent(s, ifif)
|
||||
{
|
||||
if (ifif == 1) {
|
||||
return min_decode(s);
|
||||
} else {
|
||||
return s;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//在数组中根据元素值查找下标
|
||||
function min_ary_indexof(array1, val, name)
|
||||
{
|
||||
for (var i = 0; i < array1.length; i++)
|
||||
{
|
||||
if (!name)
|
||||
{
|
||||
if (array1[i] == val)
|
||||
return i;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (array1[i][name] == val)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
};
|
||||
|
||||
//在数组中根据值删除元素
|
||||
function min_ary_delval(array1, val, name)
|
||||
{
|
||||
var index = min_ary_indexof(array1, val, name);
|
||||
if (index > -1)
|
||||
{
|
||||
array1.splice(index, 1);
|
||||
}
|
||||
};
|
||||
|
||||
//在数组中根据下标删除诺干个元素
|
||||
function min_ary_delfromto(array1, from, to)
|
||||
{
|
||||
var rest = array1.slice((to || from) + 1 || array1.length);
|
||||
array1.length = from < 0 ? array1.length + from : from;
|
||||
array1.push.apply(array1, rest);
|
||||
};
|
||||
|
||||
//在数组中删除某一对象元素
|
||||
function min_ary_delobj(array1, object)
|
||||
{
|
||||
for (var i = 0; i < array1.length; ++i)
|
||||
{
|
||||
if (array1[i] === object)
|
||||
{
|
||||
array1.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//数组包含
|
||||
function min_ary_include(aryparent, arychild){
|
||||
for (var i = 0; i < arychild.length; i++) {
|
||||
var found = false;
|
||||
for (var j = 0; j < aryparent.length; j++) {
|
||||
if (aryparent[j] == arychild[i]){
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
//数组相减
|
||||
function min_ary_deduct(aryparent, arychild){
|
||||
var re = [];
|
||||
for (var i = 0; i < aryparent.length; i++){
|
||||
var found = false;
|
||||
for (var j = 0; j < arychild.length; j++){
|
||||
if (aryparent[i] == arychild[j]){
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found){
|
||||
re.push(aryparent[i])
|
||||
}
|
||||
}
|
||||
return re;
|
||||
};
|
||||
|
||||
//从m个数中获取n个数的组合,只取组合,不取排列(递归算法)
|
||||
function min_CombineInAry(ary, n){
|
||||
if (ary.length < n){
|
||||
return [];
|
||||
}
|
||||
if (ary.length == n){
|
||||
return [ary];
|
||||
}
|
||||
if (ary.length > n){
|
||||
var result = [];
|
||||
for (var i = 0; i <= ary.length - n; i++) {
|
||||
var tmplist = [];
|
||||
tmplist.push(ary[i]);
|
||||
if (n - 1 > 0){
|
||||
var sub_cardlist = ary.slice(i + 1);
|
||||
var sub_tmplist = min_CombineInAry(sub_cardlist, n - 1);
|
||||
for (var j = 0; j < sub_tmplist.length; j++) {
|
||||
result.push(tmplist.concat(sub_tmplist[j]));
|
||||
}
|
||||
} else {
|
||||
result.push(tmplist);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
//从n个数组中各取一个元素出来进行组合,只取组合,不取排列(递归算法)
|
||||
function min_CombineByArys(arylist){
|
||||
if (arylist.length == 0){
|
||||
return [];
|
||||
}
|
||||
var result = [];
|
||||
for (var i = 0; i < arylist[0].length; i++) {
|
||||
result.push([arylist[0][i]]);
|
||||
}
|
||||
if (arylist.length == 1){
|
||||
return result;
|
||||
}
|
||||
var resultlist = [];
|
||||
var sub_result = min_CombineByArys(arylist.slice(1));
|
||||
for (var i = 0; i < result.length; i++) {
|
||||
for (var j = 0; j < sub_result.length; j++) {
|
||||
resultlist.push(result[i].concat(sub_result[j]));
|
||||
}
|
||||
}
|
||||
return resultlist;
|
||||
}
|
||||
|
||||
//是否存在指定函数
|
||||
function min_ExitsFunction(funcName)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (typeof(eval(funcName)) == "function")
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch(e)
|
||||
{}
|
||||
return false;
|
||||
}
|
||||
|
||||
//(按顺序)加载js文件
|
||||
function min_loadJsFile(str_jsfile, func_succ, NoRandomFlag)
|
||||
{
|
||||
var domScript = document.createElement('script');
|
||||
if (!NoRandomFlag)
|
||||
{
|
||||
// str_jsfile = str_jsfile + '?' + Math.random() * 10000;
|
||||
// str_jsfile = str_jsfile + '?' + min_random(1, 10000000);
|
||||
str_jsfile = str_jsfile + '?' + min_timestamp();
|
||||
}
|
||||
domScript.src = str_jsfile;
|
||||
func_succ = func_succ || function(){};
|
||||
domScript.onload = domScript.onreadystatechange = function() {
|
||||
if (!this.readyState || 'loaded' === this.readyState || 'complete' === this.readyState) {
|
||||
func_succ();
|
||||
this.onload = this.onreadystatechange = null;
|
||||
this.parentNode.removeChild(this);
|
||||
}
|
||||
}
|
||||
document.getElementsByTagName('head')[0].appendChild(domScript);
|
||||
}
|
||||
|
||||
//生成一个GUID
|
||||
function min_guid()
|
||||
{
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
||||
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
|
||||
return v.toString(16);});
|
||||
}
|
||||
|
||||
//获取时间戳
|
||||
function min_timestamp()
|
||||
{
|
||||
return new Date().getTime();
|
||||
}
|
||||
|
||||
wnd.min_copyjson = min_copyjson; //复制json对象
|
||||
wnd.min_clone = min_clone;
|
||||
wnd.min_jsontostr = min_jsontostr; //json转字符串
|
||||
wnd.min_strtojson = min_strtojson; //字符串转json
|
||||
wnd.min_inttostr = min_inttostr; //整型转字符型
|
||||
wnd.min_strtoint = min_strtoint; //字符型转整型
|
||||
|
||||
wnd.min_ltrim = min_ltrim; //去左空格
|
||||
wnd.min_rtrim = min_rtrim; //去右空格
|
||||
wnd.min_trim = min_trim; //去左右空格
|
||||
|
||||
wnd.min_div = min_div; //整除
|
||||
wnd.min_mod = min_mod; //取余数
|
||||
wnd.min_abs = min_abs; //取绝对值
|
||||
wnd.min_random = min_random; //取随机数
|
||||
wnd.min_random1 = min_random1; //取随机数1
|
||||
wnd.min_randomChar = min_randomChar; //随机字符串
|
||||
wnd.min_length = min_length; //取长度
|
||||
wnd.min_replaceAll = min_replaceAll; //字符全替换
|
||||
|
||||
wnd.min_now = min_now; //取本地当前时间
|
||||
wnd.min_day = min_day; //取本地当前日期
|
||||
wnd.min_datediff = min_datediff; //获取时间差
|
||||
wnd.min_guid = min_guid; //生成一个GUID
|
||||
|
||||
wnd.min_getQueryString = min_getQueryString; //取当前页面url中的参数值
|
||||
wnd.min_getUrlRootPath = min_getUrlRootPath; //获取当前页面的路径
|
||||
|
||||
wnd.min_setCookie = min_setCookie; //设置cookie
|
||||
wnd.min_getCookie = min_getCookie; //读取cookie
|
||||
wnd.min_delCookie = min_delCookie; //删除cookie
|
||||
|
||||
wnd.min_getdom = min_getdom; //获取一个dom
|
||||
wnd.min_setdom = min_setdom; //设置一个dom属性值
|
||||
wnd.min_uphtml = min_uphtml; //添加一段innerHTML
|
||||
|
||||
wnd.min_ontime = min_ontime; //新建一个周期性的定时器
|
||||
wnd.min_ontimeout = min_ontimeout; //新建一个一次性的定时器
|
||||
wnd.min_closetime = min_closetime; //关闭定时器
|
||||
|
||||
wnd.min_writefile_gameid = min_writefile_gameid; //本地存储数据
|
||||
wnd.min_readfile_gameid = min_readfile_gameid; //读取本地数据
|
||||
|
||||
wnd.min_encode = min_encode; //encodeURIComponent转码
|
||||
wnd.min_decode = min_decode; //decodeURIComponent解码
|
||||
|
||||
wnd.min_tcp = min_tcp; //新建一个tcp连接
|
||||
wnd.min_http = min_http; //http请求
|
||||
|
||||
wnd.min_ary_indexof = min_ary_indexof; //在数组中根据元素值查找下标
|
||||
wnd.min_ary_delval = min_ary_delval; //在数组中根据值删除元素
|
||||
wnd.min_ary_delfromto = min_ary_delfromto; //在数组中根据下标删除诺干个元素
|
||||
wnd.min_ary_delobj = min_ary_delobj; //在数组中删除某一对象元素
|
||||
wnd.min_ary_include = min_ary_include; //数组包含
|
||||
wnd.min_ary_deduct = min_ary_deduct; //数组相减
|
||||
wnd.min_CombineInAry = min_CombineInAry; //从m个数中取n个数的组合
|
||||
wnd.min_CombineByArys = min_CombineByArys; //从n个数组中各取一个元素出来进行组合
|
||||
|
||||
wnd.min_ExitsFunction = min_ExitsFunction; //是否存在函数
|
||||
wnd.min_loadJsFile = min_loadJsFile; //加载js文件
|
||||
|
||||
wnd.min_guid = min_guid; //生成一个GUID
|
||||
wnd.min_timestamp = min_timestamp; //获取时间戳
|
||||
})(window);
|
||||
@@ -0,0 +1 @@
|
||||
//精灵事件单元...
|
||||
199
codes/games/client/Projects/guanpai-jx/js/guanpai/data.js
Normal file
199
codes/games/client/Projects/guanpai-jx/js/guanpai/data.js
Normal file
@@ -0,0 +1,199 @@
|
||||
|
||||
kehuduan = 1; //是否有服务器
|
||||
/////////////////////////////////////////////////////////
|
||||
////本地数据/////////
|
||||
//game.ersansi = [1017,1034,1051,1068];
|
||||
huifang=0;
|
||||
xj = 0;
|
||||
xxs = [];
|
||||
xxcxjch = -1; //星星场小局重绘变量
|
||||
cunjingling = []; //全部虚拟精灵
|
||||
xuanjl = []; //癞子虚拟精灵
|
||||
kg = 0; //大小局控制
|
||||
djzt = 0; //点击状态
|
||||
xp = 0; //滑动状态
|
||||
sp = 0; //手牌的变量
|
||||
touxiang = []; //头像
|
||||
zhadanfen = []; //所有炸分类型
|
||||
tishi = 1; //提示用
|
||||
spy = 540; //牌初始值坐标
|
||||
spx = 620;
|
||||
spy2= 520;
|
||||
cpy1 = 345; //出牌初始值坐标
|
||||
cpy2 = 175;
|
||||
cpy3 = 20;
|
||||
cpx1 = 580; //出牌初始值坐标
|
||||
cpx2 = 1013;
|
||||
cpx3 = 557;
|
||||
cpx4 = 155;
|
||||
spjg = 50; //手牌间距
|
||||
cpsf = 60; //牌缩放
|
||||
anniu = [1069,1070,1071]; //按钮
|
||||
xs_dsq = 2000; //定时器时间
|
||||
huadong_h = 147; //滑动的高度
|
||||
kongzhi = [0,0,0,0]; //保单音效控制
|
||||
lunshu = 0; //回放的轮数
|
||||
keyichu = []; //可以出的牌
|
||||
bianpai = 0; //癞子动画
|
||||
difen = 1; //低分初始值
|
||||
xxcshuju = [0,0,0]; //星星场倍数和限制
|
||||
tanchuang = 0; //弹窗的显示情况
|
||||
diand = 0;
|
||||
xsxianzhi = [0,0]
|
||||
xxccsf=100;//星星场茶水费
|
||||
//////////////////////////////////////////////////
|
||||
var gp = gp||{}; //算法用的数据
|
||||
|
||||
laizi_weizhi = []; //癞子牌位置
|
||||
paipai = []; //癞子牌改变的大小
|
||||
quchong = []; //去重
|
||||
quchong_pai = [];
|
||||
jieguo_pai_gai = []; //结果牌该
|
||||
laizi_mun = 0; //癞子数目
|
||||
gp.pai = {};
|
||||
shanchu = [];
|
||||
shanchu_pai = [];
|
||||
jieguo_pai = [];
|
||||
//////////////////////////////////////////////////
|
||||
////服务器数据/////////
|
||||
var game = game||{};
|
||||
|
||||
|
||||
game.my_seat = 0; //自己座位号
|
||||
game.arr = [];
|
||||
game.pass = 0; //不要
|
||||
game.jushu = [0,0]; //局数和总局数
|
||||
game.dq_dapai = []; // 玩家出的牌
|
||||
game.xs_dapai = [[],[],[]]; //显示玩家出的牌
|
||||
game.paixing = [[]] ; //出的牌型,-1为出的牌错误
|
||||
game.grade = [0,0,0]; //三个人总得分
|
||||
game.xiaojufen = [0,0,0]; //三个人小局得分
|
||||
game.zha = [] ; //三个人的炸弹
|
||||
game.shengli = 0; //小局赢家
|
||||
game.suoyoupai = [[],[],[]];//打完剩的手牌
|
||||
game.quanbufen = [[],[],[]];//三个人全局得分
|
||||
game.shoupai = []; //玩家手牌
|
||||
game.ersansi = []; //保存不同人数的手牌长度
|
||||
game.people = 0; //保存人数
|
||||
game.kexuanpai = []; //保存出牌人的可选牌型
|
||||
game.zhuang = 0; //庄
|
||||
game.zhuangtai = 0; //状态
|
||||
game.countdown = 10000; //倒计时
|
||||
game.zhanji = [0,0,0,0]; //战绩分
|
||||
game.pai = []; //牌
|
||||
game.seat = 99; //出牌的人
|
||||
game.control = -1; //控制权
|
||||
game.zhunbei = [0,0,0]; //是否准备
|
||||
game.carlen = []; //每个人剩几张牌
|
||||
game.xs_paishu = []; //小局显示排数
|
||||
game.daxiaoju = 0; //判断大小局
|
||||
game.tishipai = []; //提示牌
|
||||
game.zhinengchu = 0; //只能出
|
||||
game.baodan = []; //报单
|
||||
game.leixing = []; //房间类型
|
||||
game.chu = 0; //出牌的人
|
||||
game.tuoguan = 0;
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
var yx = yx||{};
|
||||
///////////音效///////
|
||||
yx.danpai1 = ["00101.mp3",
|
||||
"00102.mp3","00103.mp3","00104.mp3","00105.mp3","00106.mp3","00107.mp3","00108.mp3","00109.mp3","00110.mp3","00111.mp3","00112.mp3","00113.mp3"];
|
||||
yx.danpai2 = ["00114.mp3",
|
||||
"00115.mp3","00116.mp3","00117.mp3","00118.mp3","00119.mp3","00120.mp3","00121.mp3","00122.mp3","00123.mp3","00124.mp3","00125.mp3","00126.mp3"];
|
||||
|
||||
yx.duizi1 = ["00127.mp3",
|
||||
"00128.mp3","00129.mp3","00130.mp3","00131.mp3","00132.mp3","00133.mp3","00134.mp3","00135.mp3","00136.mp3","00137.mp3","00138.mp3","00139.mp3"];
|
||||
yx.duizi2 = ["00140.mp3",
|
||||
"00141.mp3","00142.mp3","00143.mp3","00144.mp3","00145.mp3","00146.mp3","00147.mp3","00148.mp3","00149.mp3","00150.mp3","00151.mp3","00152.mp3"];
|
||||
|
||||
yx.sanzhang1 = ["00153.mp3",
|
||||
"00154.mp3","00155.mp3","00156.mp3","00157.mp3","00158.mp3","00159.mp3","00160.mp3","00161.mp3","00162.mp3","00163.mp3","00164.mp3","00165.mp3"];
|
||||
yx.sanzhang2 = ["00166.mp3",
|
||||
"00167.mp3","00168.mp3","00169.mp3","00170.mp3","00171.mp3","00172.mp3","00173.mp3","00174.mp3","00175.mp3","00176.mp3","00177.mp3","00178.mp3"];
|
||||
|
||||
yx.zhadan1 = ["00179.mp3","00181.mp3","00205.mp3","00206.mp3"];
|
||||
yx.zhadan2 = ["00180.mp3","00182.mp3","00207.mp3","00208.mp3"];
|
||||
|
||||
yx.shun1 = ["00183.mp3","00185.mp3","00195.mp3"];
|
||||
yx.shun2 = ["00184.mp3","00186.mp3","00196.mp3"];
|
||||
|
||||
yx.buyao1 = ["00189.mp3","00190.mp3","00191.mp3"];
|
||||
yx.buyao2 = ["00192.mp3","00193.mp3","00194.mp3"];
|
||||
|
||||
yx.changyong = ["00197.mp3","00198.mp3","00199.mp3","00200.mp3","00201.mp3","00202.mp3","00203.mp3",
|
||||
"00204.mp3"];//保单,打牌,发牌,飞机,截图,时间,按钮 ,炸弹
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
///////////回放///////
|
||||
game.hf_xinxi = [];
|
||||
game.hf_seat = 0;
|
||||
game.hf_roomcode = [];
|
||||
game.hf_difen = [];
|
||||
game.hf_ju = 0; //回放第几局
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
418
codes/games/client/Projects/guanpai-jx/js/guanpai/huifang.js
Normal file
418
codes/games/client/Projects/guanpai-jx/js/guanpai/huifang.js
Normal file
@@ -0,0 +1,418 @@
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
/////出牌音效动画//////////
|
||||
var gp_yx = gp_yx||{
|
||||
paixing:function(dppx){
|
||||
var fanhui = [];
|
||||
if(dppx[0][0]==1&&dppx[0][1]==1){//单牌
|
||||
fanhui = [1,dppx[1][0][4]];
|
||||
}
|
||||
if(dppx[0][0]>1&&dppx[0][1]==1){//炸弹 对子 三张
|
||||
if(dppx[0][0]==2){
|
||||
fanhui = [2,dppx[1][0][4]];//对子
|
||||
}
|
||||
if(dppx[0][0]==3){
|
||||
if (game.xs_dapai[game.seat].length==3) {
|
||||
fanhui = [3,dppx[1][0][4]];//三张
|
||||
}else if (game.xs_dapai[game.seat].length==4) {
|
||||
fanhui = [4,2];//三带一
|
||||
}else if (game.xs_dapai[game.seat].length==5) {
|
||||
fanhui = [4,3];//三带二
|
||||
}
|
||||
}
|
||||
if(dppx[0][0]==4 && game.xs_dapai[game.seat].length<=4){
|
||||
fanhui = [4,0];//炸弹
|
||||
}
|
||||
if(dppx[0][0]==4 && game.xs_dapai[game.seat].length>4){
|
||||
fanhui = [4,1];//四带二
|
||||
}
|
||||
}if(dppx[0][0]==2&&dppx[0][1]>1){//连对
|
||||
fanhui = [5,0];
|
||||
}if(dppx[0][0]==1&&dppx[0][1]>=5){//顺子
|
||||
fanhui = [5,1];
|
||||
}
|
||||
if(dppx[0][0]==3&&dppx[0][1]>=2){
|
||||
fanhui = [5,2];//飞机
|
||||
}
|
||||
return fanhui ;
|
||||
},
|
||||
yinxiao:function(dppx,sex){
|
||||
var jieguo = this.paixing(dppx);
|
||||
if (sex==1){ //判断男女
|
||||
switch (jieguo[0]){
|
||||
case 1:
|
||||
Utl.playSound(yx.danpai1[jieguo[1]-3]);
|
||||
break;
|
||||
case 2:
|
||||
Utl.playSound(yx.duizi1[jieguo[1]-3]);
|
||||
break;
|
||||
case 3:
|
||||
Utl.playSound(yx.sanzhang1[jieguo[1]-3]);
|
||||
break;
|
||||
case 4:
|
||||
Utl.playSound(yx.zhadan1[jieguo[1]]);
|
||||
break;
|
||||
case 5:
|
||||
Utl.playSound(yx.shun1[jieguo[1]]);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (jieguo[0]){
|
||||
case 1:
|
||||
Utl.playSound(yx.danpai2[jieguo[1]-3]);
|
||||
break;
|
||||
case 2:
|
||||
Utl.playSound(yx.duizi2[jieguo[1]-3]);
|
||||
break;
|
||||
case 3:
|
||||
Utl.playSound(yx.sanzhang2[jieguo[1]-3]);
|
||||
break;
|
||||
case 4:
|
||||
Utl.playSound(yx.zhadan2[jieguo[1]]);
|
||||
break;
|
||||
case 5:
|
||||
Utl.playSound(yx.shun2[jieguo[1]]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
passyinxiao:function(sex){//不要
|
||||
if (sex){//判断男女
|
||||
Utl.playSound(yx.buyao1[2]);
|
||||
} else {
|
||||
Utl.playSound(yx.buyao2[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
////////////////回放////////////////////////
|
||||
////////////////////////////////////////////
|
||||
var baipai=function (pai,people){
|
||||
var aaa = [[1001,1018,1035],[550,1070,100],[491,175,175]];//牌精灵,X坐标,Y坐标
|
||||
set_group(201,37,0,0,0);
|
||||
set_group(202,37,0,0,0);
|
||||
set_group(203,37,0,0,0);
|
||||
for (var i=0;i<people;i++) {
|
||||
var yihao = pai;
|
||||
var laizi = (game.hf_huifang[game.hf_ju].laizi-1)%13+1;
|
||||
if (game.hf_huifang[game.hf_ju].laizi.length == 0 ) {
|
||||
dxpaixu(yihao[i],0);
|
||||
}else {
|
||||
dxpaixu(yihao[i],laizi);
|
||||
}
|
||||
switch (Utl.changeToStatus(i))
|
||||
{
|
||||
case 0:
|
||||
set_group(201,37,0,0,0);
|
||||
for (var a = 0; a<yihao[i].length;a++)
|
||||
{
|
||||
set_self(aaa[0][0],18,aaa[1][0]-yihao[i].length*20/2,0,0);
|
||||
set_self(aaa[0][0]+a,18,get_self(aaa[0][0],18,0,0,0)+20*a,0,0);
|
||||
set_self(aaa[0][0]+a,19,aaa[2][0],0,0);
|
||||
set_self(aaa[0][0]+a,43,yihao[i][a]+1,0,0);
|
||||
set_self(aaa[0][0]+a,37,1,0,0);
|
||||
set_self(aaa[0][0]+a,1,53,0,0);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
set_group(202,37,0,0,0);
|
||||
for (var a = 0; a<yihao[i].length;a++)
|
||||
{
|
||||
set_self(aaa[0][1],18,aaa[1][1]-yihao[i].length*20,0,0);
|
||||
set_self(aaa[0][1]+a,18,get_self(aaa[0][1],18,0,0,0)+20*a,0,0);
|
||||
set_self(aaa[0][1]+a,19,aaa[2][1],0,0);
|
||||
set_self(aaa[0][1]+a,43,yihao[i][a]+1,0,0);
|
||||
set_self(aaa[0][1]+a,37,1,0,0);
|
||||
set_self(aaa[0][1]+a,1,53,0,0);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
set_group(203,37,0,0,0);
|
||||
for (var a = 0; a<yihao[i].length;a++)
|
||||
{
|
||||
set_self(aaa[0][2],18,aaa[1][2],0,0);
|
||||
set_self(aaa[0][2]+a,18,get_self(aaa[0][2],18,0,0,0)+20*a,0,0);
|
||||
set_self(aaa[0][2]+a,19,aaa[2][2],0,0);
|
||||
set_self(aaa[0][2]+a,43,yihao[i][a]+1,0,0);
|
||||
set_self(aaa[0][2]+a,37,1,0,0);
|
||||
set_self(aaa[0][2]+a,1,53,0,0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (laizi){
|
||||
gp_ui_laizibz(yihao[i],laizi,aaa[0][Utl.changeToStatus(i)]);
|
||||
}
|
||||
}
|
||||
}
|
||||
var xs_zongfen = function(grade) //显示分数
|
||||
{
|
||||
for(var i=0;i<grade.length;i++)
|
||||
{
|
||||
Utl.setGrade(i,grade[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var xs_dapai = function(dapai,renshu,px,seat,laizib) // 出牌,人数,牌型,出牌的人
|
||||
{
|
||||
var ersansi = [1017,1034,1051];
|
||||
var hf_cpy1 = 400;
|
||||
var hf_cpx1 = 550;
|
||||
var hf_cpy2 = 265;
|
||||
var hf_cpx2 = 1040;
|
||||
var hf_cpy3 = 265;
|
||||
var hf_cpx3 = 120;
|
||||
var hf_cpx4 = 100;
|
||||
var hf_cpsf = 50;
|
||||
if ( laizib ==0) {
|
||||
laizib =[[],[],[]];
|
||||
}
|
||||
for (var a= 0;a<renshu;a++)
|
||||
{
|
||||
switch (Utl.changeToStatus(a))
|
||||
{
|
||||
case 0:
|
||||
for(var i =1001;i<=ersansi[0] ; i++){
|
||||
if(get_self(i,19,0,0,0) == hf_cpy1){
|
||||
set_self(i,37,0,0,0);
|
||||
}
|
||||
}
|
||||
if (dapai[a] != -1) {
|
||||
for (var i = ersansi[0]+1 - dapai[a].length;i<=ersansi[0];i++) //显示出牌的位置
|
||||
{
|
||||
set_self(ersansi[0]+1-dapai[a].length,18,hf_cpx1-dapai[a].length*20/2,0,0);
|
||||
set_self(i,18,get_self(ersansi[0]+1-dapai[a].length,18,0,0,0)+20*(i-(ersansi[0]+1-dapai[a].length)),0,0);
|
||||
set_self(i,19,hf_cpy1,0,0);
|
||||
set_self(i,33,hf_cpsf,0,0);
|
||||
set_self(i,1,53,0,0);
|
||||
set_self(i,43,dapai[a][ersansi[0]-i]+1);
|
||||
set_self(i,37,1,0,0);
|
||||
}
|
||||
gp_hf_laizicp(dapai[a],laizib[a],ersansi[0]+1-dapai[a].length);//癞子出牌变帧 pai为id paipai为该变后的id大小 diyz为精灵id
|
||||
}
|
||||
|
||||
break;
|
||||
case 1:
|
||||
if (dapai[a] != -1) {
|
||||
for (var i = ersansi[1]+1 - dapai[a].length;i<=ersansi[1];i++) //显示出牌的位置
|
||||
{
|
||||
set_self(ersansi[1]+1-dapai[a].length,18,hf_cpx2-dapai[a].length*20,0,0);
|
||||
set_self(i,18,get_self(ersansi[1]+1-dapai[a].length,18,0,0,0)+20*(i-(ersansi[1]+1-dapai[a].length)),0,0);
|
||||
set_self(i,19,hf_cpy2,0,0);
|
||||
set_self(i,33,hf_cpsf,0,0);
|
||||
set_self(i,1,53,0,0);
|
||||
set_self(i,43,dapai[a][ersansi[1]-i]+1);
|
||||
set_self(i,37,1,0,0);
|
||||
}
|
||||
gp_hf_laizicp(dapai[a],laizib[a],ersansi[1]+1-dapai[a].length);//癞子出牌变帧 pai为id paipai为该变后的id大小 diyz为精灵id
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (dapai[a] != -1) {
|
||||
for (var i = ersansi[2]+1 - dapai[a].length;i<=ersansi[2];i++) //显示出牌的位置
|
||||
{
|
||||
set_self(ersansi[2]+1-dapai[a].length,18,hf_cpx3,0,0);
|
||||
set_self(i,18,get_self(ersansi[2]+1-dapai[a].length,18,0,0,0)+20*(i-(ersansi[2]+1-dapai[a].length)),0,0);
|
||||
set_self(i,19,hf_cpy3,0,0);
|
||||
set_self(i,33,hf_cpsf,0,0);
|
||||
set_self(i,1,53,0,0);
|
||||
set_self(i,43,dapai[a][ersansi[2]-i]+1);
|
||||
set_self(i,37,1,0,0);
|
||||
}
|
||||
gp_hf_laizicp(dapai[a],laizib[a],ersansi[2]+1-dapai[a].length);//癞子出牌变帧 pai为id paipai为该变后的id大小 diyz为精灵id
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (px == -1) {
|
||||
switch(Utl.changeToStatus((seat+renshu-1)%renshu)) {
|
||||
case 0:
|
||||
set_self(1076,37,1,0,0);
|
||||
break;
|
||||
case 1:
|
||||
set_self(1077,37,1,0,0);
|
||||
break;
|
||||
case 2:
|
||||
set_self(1078,37,1,0,0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch(Utl.changeToStatus(seat))
|
||||
{
|
||||
case 0:
|
||||
set_self(1076,37,0,0,0);
|
||||
break;
|
||||
case 1:
|
||||
set_self(1077,37,0,0,0);
|
||||
break;
|
||||
case 2:
|
||||
set_self(1078,37,0,0,0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
var hf_shizhong = function (kzq) {
|
||||
var time = 15
|
||||
set_group(212,37,0,0,0);
|
||||
set_self(1075,57,0,0,0);
|
||||
set_self(1075,7,time,0,0);
|
||||
switch (Utl.changeToStatus(kzq))//根据控制权来显示时钟
|
||||
{
|
||||
case 0:
|
||||
set_self(1074,37,1,0,0);
|
||||
set_self(1075,37,1,0,0);
|
||||
set_self(1074,18,560,0,0);
|
||||
set_self(1074,19,400,0,0);
|
||||
break;
|
||||
case 1:
|
||||
set_self(1074,37,1,0,0);
|
||||
set_self(1075,37,1,0,0);
|
||||
set_self(1074,18,1015,0,0);
|
||||
set_self(1074,19,310,0,0);
|
||||
break;
|
||||
case 2:
|
||||
set_self(1074,37,1,0,0);
|
||||
set_self(1075,37,1,0,0);
|
||||
set_self(1074,18,180,0,0);
|
||||
set_self(1074,19,310,0,0);
|
||||
break;
|
||||
|
||||
}
|
||||
set_self(1075,18,get_self(1074,18)+37,0,0);
|
||||
set_self(1075,19,get_self(1074,19)+53,0,0);
|
||||
set_self(1075,20,40,0,0);
|
||||
set_self(1075,57,1000,0,0);
|
||||
};
|
||||
var hf_anniu = function (spid){
|
||||
switch (spid){
|
||||
case 1139:
|
||||
set_level(101,0);
|
||||
set_level(501,0);
|
||||
set_group(215,37,0,0,0);
|
||||
set_group(212,37,0,0,0);
|
||||
set_group(304,37,0,0,0);
|
||||
set_group(220,37,0,0,0);
|
||||
set_self(1054,57,0,0,0);
|
||||
set_self(1053,57,0,0,0);
|
||||
Utl.closeVideo();
|
||||
gameCombat.newGoCombatPageTwo(gameCombat.combatData.pageOneIndex);
|
||||
lunshu = 0;
|
||||
break;
|
||||
case 1559:
|
||||
if (get_self(1072,37) ==1 ) {
|
||||
set_level(101,0);
|
||||
set_level(501,0);
|
||||
set_group(215,37,0,0,0);
|
||||
set_group(212,37,0,0,0);
|
||||
set_group(304,37,0,0,0);
|
||||
set_group(220,37,0,0,0);
|
||||
set_self(1054,57,0,0,0);
|
||||
set_self(1053,57,0,0,0);
|
||||
Utl.closeVideo();
|
||||
gameCombat.newGoCombatPageTwo(gameCombat.combatData.pageOneIndex);
|
||||
lunshu = 0;
|
||||
} else if (get_self(1072,37) ==0 ) {
|
||||
if (get_self(1189,37) ==0 && get_self(1191,37) ==1) {
|
||||
gp_ui_djzb();
|
||||
}else if(get_self(1189,37) ==1 && get_self(1191,37) ==0) {
|
||||
kg=2;
|
||||
gp_ui_daju();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1140:
|
||||
if (get_self(1140,43,0,0,0) == 2) {
|
||||
set_self(1054,57,0,0,0);
|
||||
set_self(1075,57,0,0,0);
|
||||
set_self(1140,43,1,0,0);
|
||||
}else {
|
||||
set_self(1054,57,2000,0,0);
|
||||
set_self(1140,43,2,0,0);
|
||||
set_self(1075,57,1000,0,0);
|
||||
}
|
||||
break;
|
||||
case 1141:
|
||||
var eee = game.hf_huifang[game.hf_ju].putpai;
|
||||
set_self(1054,57,0,0,0);
|
||||
set_self(1140,43,1,0,0);
|
||||
gameabc_face.ontimer_1054();
|
||||
if ( lunshu>eee.length) {
|
||||
gameabc_face.ontimer_1053();
|
||||
lunshu = 0;
|
||||
set_self(1141,37,0,0,0);
|
||||
set_self(1140,37,0,0,0);
|
||||
}
|
||||
set_self(1075,57,0,0,0);
|
||||
break;
|
||||
case 1072:
|
||||
set_level(101,0);
|
||||
set_level(501,0);
|
||||
set_group(215,37,0,0,0);
|
||||
set_group(212,37,0,0,0);
|
||||
set_group(304,37,0,0,0);
|
||||
set_group(220,37,0,0,0);
|
||||
set_self(1054,57,0,0,0);
|
||||
set_self(1053,57,0,0,0);
|
||||
Utl.closeVideo();
|
||||
gameCombat.newGoCombatPageTwo(gameCombat.combatData.pageOneIndex);
|
||||
lunshu = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var gp_hf_laizicp = function(pai,_paipai,diyz){ //癞子出牌变帧 pai为牌id paipai为该变后的id diyz为精灵id
|
||||
var yici = 0;
|
||||
if (_paipai.length !=0) {
|
||||
for(var i=0;i<pai.length;i++)
|
||||
{
|
||||
|
||||
if ( pai[i] == _paipai[yici] && yici <_paipai.length) {
|
||||
set_self(diyz+i,1,567,0,0); //癞子牌变帧
|
||||
yici++;
|
||||
}else {
|
||||
set_self(diyz+i,1,53,0,0); //癞子牌变帧
|
||||
set_self(diyz+i,37,1,0,0);
|
||||
}
|
||||
set_self(diyz+i,43, pai[i]+1,0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
861
codes/games/client/Projects/guanpai-jx/js/guanpai/ls.js
Normal file
861
codes/games/client/Projects/guanpai-jx/js/guanpai/ls.js
Normal file
@@ -0,0 +1,861 @@
|
||||
gameabc_face.ontimer_1001 = function(gameid, spid, times, timelong, alltimes)
|
||||
{
|
||||
set_self(1001,57,0,0,0);
|
||||
set_self(1002,57,500,0,0);
|
||||
}
|
||||
gameabc_face.ontimer_1002 = function(gameid, spid, times, timelong, alltimes)
|
||||
{
|
||||
play_ani(1,1107,18,474,1280,0,300,0,0,0,1,0,0);
|
||||
set_self(1002,57,0,0,0);
|
||||
}
|
||||
gameabc_face.ontimer_1075 = function(gameid, spid, times, timelong, alltimes)
|
||||
{
|
||||
|
||||
if(get_self(1075,7)<=0)
|
||||
{
|
||||
Utl.playSound(yx.changyong[5]);
|
||||
set_self(1075,57,0,0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_self(1075,7,get_self(1075,7)-1);
|
||||
|
||||
if(get_self(1075,7)<10)
|
||||
{
|
||||
set_self(1075,20,20,0,0);
|
||||
set_self(1075,18,get_self(1074,18)+47,0,0);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
set_self(1075,20,40,0,0);
|
||||
set_self(1075,18,get_self(1074,18)+37,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
gameabc_face.ontimer_1076 = function(gameid, spid, times, timelong, alltimes)
|
||||
{
|
||||
if (game.paixing == null ) {
|
||||
for (var i=1131;i<=1134;i++) {
|
||||
set_self(i,37,0,0,0);
|
||||
}
|
||||
}
|
||||
set_self(1076,57,0);
|
||||
}
|
||||
gameabc_face.ontimer_1010 = function(gameid, spid, times, timelong, alltimes)
|
||||
{
|
||||
gp_chonglian();//重绘
|
||||
}
|
||||
gameabc_face.ontimer_1065 = function(gameid, spid, times, timelong, alltimes)
|
||||
{
|
||||
bianpai ++;
|
||||
var zhongzhi = 567+67;
|
||||
var chuzhi = 567;
|
||||
if (bianpai%2 == 1) {
|
||||
set_self(1143,1,53,0,0);
|
||||
set_self(1143,43,55,0,0);
|
||||
play_ani(1,1143,20,0,134,0,150,0,0,0,1,0,0);
|
||||
play_ani(1,1143,18,zhongzhi,chuzhi,0,150,0,0,0,1,0,0);
|
||||
} else {
|
||||
var ss = ifast_random(13)+1;
|
||||
set_self(1143,1,567,0,0);
|
||||
set_self(1143,43,ss,0,0);
|
||||
play_ani(1,1143,20,134,0,0,150,0,0,0,1,0,0);
|
||||
play_ani(1,1143,18,chuzhi,zhongzhi,0,150,0,0,0,1,0,0);
|
||||
}
|
||||
if (bianpai == 8) {
|
||||
set_self(1143,1,567,0,0);
|
||||
set_self(1065,57,0,0,0);
|
||||
set_self(1143,43,game.laizi,0,0);
|
||||
play_ani(0,1143,0);
|
||||
set_self(1143,20,134,0,0);
|
||||
set_self(1063,57,0,0,0);
|
||||
set_self(1063,57,200,0,0);
|
||||
}
|
||||
};
|
||||
|
||||
gameabc_face.ontimer_1052 = function(gameid, spid, times, timelong, alltimes)
|
||||
{
|
||||
play_ani(1,1143,35,0,255,0,200,0,0,0,1,0,0);
|
||||
set_self(1052,57,0);
|
||||
dxpaixu(game.pai,game.laizi);
|
||||
gp_ui_xssp(game.pai,game.laizi,game.leixing);
|
||||
if (kehuduan!=0) {
|
||||
gp_ui_shizhong(game.control);
|
||||
}
|
||||
|
||||
for (var i = 0; i < game.pai.length; i++) {
|
||||
set_self(1081+i,37,0,0,0);
|
||||
}
|
||||
if (game.control == game.my_seat) //显示按钮
|
||||
{
|
||||
set_group(301,37,0,0,0);
|
||||
set_self(anniu[2],37,1,0,0);
|
||||
set_self(anniu[2],18,550,0,0);
|
||||
if (game.people == 3 ) {
|
||||
if ( game.laizi == 3) {
|
||||
gp_tishiyu()
|
||||
set_self(1080,1,577,0,0);//先手
|
||||
} else {
|
||||
set_self(1080,1,575,0,0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
gameabc_face.ontimer_1063 = function(gameid, spid, times, timelong, alltimes)
|
||||
{
|
||||
var laizi = game.laizi;
|
||||
set_self(1143,43,laizi,0,0);
|
||||
play_ani(1,1143,19,280,-10,0,800,0,500,0,1,0,0);
|
||||
play_ani(1,1143,33,100,45,0,800,0,500,0,1,0,0);
|
||||
play_ani(1,1143,35,255,0,0,300,0,500,0,1,0,0);
|
||||
set_self(1063,57,0);
|
||||
set_self(1052,57,1100,0,0);
|
||||
}
|
||||
gameabc_face.ontimer_1064 = function(gameid, spid, times, timelong, alltimes)
|
||||
{
|
||||
if (sp>game.ersansi[0]-1000) {
|
||||
set_self(1064,57,0,0,0);
|
||||
if (game.leixing[3] ==2 ) { //癞子模式
|
||||
gp_ui_laizidh();
|
||||
/////再次排序////////////
|
||||
/////在显示按钮//////////
|
||||
} else {
|
||||
gp_ui_shizhong(game.control);
|
||||
if (game.control == game.my_seat) //显示按钮
|
||||
{
|
||||
set_group(301,37,0,0,0);
|
||||
set_self(anniu[2],37,1,0,0);
|
||||
set_self(anniu[2],18,550,0,0);
|
||||
if (game.people == 3 ) {
|
||||
if ( game.laizi == 3) {
|
||||
gp_tishiyu(4,536);
|
||||
} else {
|
||||
gp_tishiyu(2,536);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
for (var i=0;i<=sp-1;i++) {
|
||||
set_self(1001,18,spx-sp*spjg/2,0,0);
|
||||
set_self(1001+i,18,get_self(1001,18,0,0,0)+spjg*i,0,0);
|
||||
set_self(1001+i,19,spy,0,0);
|
||||
set_self(1001+i,43,game.pai[i]+1,0,0);
|
||||
//set_self(1001+i,43,55,0,0);
|
||||
set_self(1001+i,37,1,0,0);
|
||||
set_self(1081,18,spx-sp*spjg/2,0,0);
|
||||
set_self(1081+i,18,get_self(1001,18,0,0,0)+spjg*i,0,0);
|
||||
set_self(1081+i,19,spy,0,0);
|
||||
}
|
||||
var ssssa =[];
|
||||
for (var i = 0; i < game.people; i++) {
|
||||
ssssa.push(sp);
|
||||
}
|
||||
gp_ui_xsspshu(ssssa);
|
||||
sp++;
|
||||
}
|
||||
}
|
||||
gameabc_face.ontimer_1061 = function(gameid, spid, times, timelong, alltimes)
|
||||
{
|
||||
set_self(1061,57,0);
|
||||
set_group(218,37,0,0,0);
|
||||
set_group(303,37,0,0,0);
|
||||
|
||||
for (var a= 0;a<game.people;a++)
|
||||
{
|
||||
switch (Utl.changeToStatus(a)){
|
||||
case 0:
|
||||
for(var i =1001;i<=game.ersansi[0] ; i++){
|
||||
if(get_self(i,19,0,0,0) == spy || get_self(i,19,0,0,0) == spy2){
|
||||
set_self(i,37,0,0,0);
|
||||
}
|
||||
}
|
||||
dxpaixu(game.suoyoupai[a],game.laizi);
|
||||
for (var i = game.ersansi[0]+1 -game.suoyoupai[a].length;i<=game.ersansi[0];i++) //显示出牌的位置
|
||||
{
|
||||
set_self(game.ersansi[0]+1-game.suoyoupai[a].length,18,cpx1-game.suoyoupai[a].length*23/2,0,0);
|
||||
set_self(i,18,get_self(game.ersansi[0]+1-game.suoyoupai[a].length,18,0,0,0)+23*(i-(game.ersansi[0]+1-game.suoyoupai[a].length)),0,0);
|
||||
set_self(i,19,cpy1,0,0);
|
||||
set_self(i,33,cpsf,0,0);
|
||||
set_self(i,43,game.suoyoupai[a][i-game.ersansi[0]-1 +game.suoyoupai[a].length]+1);
|
||||
set_self(i,37,1,0,0);
|
||||
set_self(i,1,53,0,0);
|
||||
}
|
||||
gp_ui_laizibz(game.suoyoupai[a],game.laizi,game.ersansi[0]+1 - game.suoyoupai[a].length);
|
||||
break;
|
||||
case 1:
|
||||
dxpaixu(game.suoyoupai[a],game.laizi);
|
||||
for (var i = game.ersansi[1]+1 -game.suoyoupai[a].length;i<=game.ersansi[1];i++) //显示出牌的位置
|
||||
{
|
||||
set_self(game.ersansi[1]+1-game.suoyoupai[a].length,18,cpx2-game.suoyoupai[a].length*23,0,0);
|
||||
set_self(i,18,get_self(game.ersansi[1]+1-game.suoyoupai[a].length,18,0,0,0)+23*(i-(game.ersansi[1]+1-game.suoyoupai[a].length)),0,0);
|
||||
set_self(i,19,cpy2,0,0);
|
||||
set_self(i,33,cpsf,0,0);
|
||||
set_self(i,43,game.suoyoupai[a][i-game.ersansi[1]-1 +game.suoyoupai[a].length]+1);
|
||||
set_self(i,37,1,0,0);
|
||||
set_self(i,1,53,0,0);
|
||||
}
|
||||
gp_ui_laizibz(game.suoyoupai[a],game.laizi,game.ersansi[1]+1 - game.suoyoupai[a].length);
|
||||
break;
|
||||
case 2:
|
||||
dxpaixu(game.suoyoupai[a],game.laizi);
|
||||
for (var i = game.ersansi[2]+1 -game.suoyoupai[a].length;i<=game.ersansi[2];i++) //显示出牌的位置
|
||||
{
|
||||
set_self(game.ersansi[2]+1-game.suoyoupai[a].length,18,cpx4,0,0);
|
||||
set_self(i,18,get_self(game.ersansi[2]+1-game.suoyoupai[a].length,18,0,0,0)+23*(i-(game.ersansi[2]+1-game.suoyoupai[a].length)),0,0);
|
||||
set_self(i,19,cpy2,0,0);
|
||||
set_self(i,33,cpsf,0,0);
|
||||
set_self(i,43,game.suoyoupai[a][i-game.ersansi[2]-1 +game.suoyoupai[a].length]+1);
|
||||
set_self(i,37,1,0,0);
|
||||
set_self(i,1,53,0,0);
|
||||
}
|
||||
gp_ui_laizibz(game.suoyoupai[a],game.laizi,game.ersansi[2]+1 - game.suoyoupai[a].length);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
gameabc_face.ontimer_1060 = function(gameid, spid, times, timelong, alltimes)
|
||||
{
|
||||
set_self(1060,57,0);
|
||||
set_group(500,37,1,0,0);
|
||||
set_group(303,37,0,0,0);
|
||||
if (game.daxiaoju ==1) { //小局
|
||||
set_self(1189,37,0,0,0)
|
||||
}
|
||||
if (game.daxiaoju ==2) {
|
||||
set_self(1191,37,0,0,0)
|
||||
}
|
||||
set_level (501,1);
|
||||
for(var a=501;a<=505;a++)
|
||||
{
|
||||
set_group(a,37,0,0,0);
|
||||
}
|
||||
//结算取消托管
|
||||
//set_self(1104,37,1,0,0);
|
||||
//set_self(1088,37,0,0,0);
|
||||
//set_self(1089,37,0,0,0);
|
||||
//set_self(1088,19,-1000,0,0);
|
||||
//set_self(1089,18,-1000,0,0);
|
||||
//打开结算页s
|
||||
for(var a=501;a<501+game.people;a++)
|
||||
{
|
||||
set_group(a,37,1,0,0);
|
||||
}
|
||||
var ab=0;
|
||||
var paidefen = [];
|
||||
for (var i=0;i<game.people;i++) {
|
||||
set_self(1204+i,1,Utl.getHeadimgSrc(i)); //头像
|
||||
set_self(1212+i,7,Func.subString(Utl.getNicknameBySeat(i),8,true)); //ID
|
||||
set_self(1216+i,7,"ID:"+Utl.getPlayeridBySeat(i)); //id号
|
||||
|
||||
set_self(1236+i,7,game.difen); //底分
|
||||
set_self(1236+i,20,16*ifast_inttostr(game.difen).length,0,0); //底分
|
||||
set_self(1123+i,7,game.zha[i]); //炸分
|
||||
if (game.carlen[i] == 1) { //改变牌数目
|
||||
game.xs_paishu[i] = 0;
|
||||
}
|
||||
if (game.chuntian[i] != 1) {
|
||||
set_self(1256+i,37,0); //春天印章
|
||||
set_self(1264+i,7,"无");
|
||||
}else {
|
||||
set_self(1264+i,7,"x2");
|
||||
}
|
||||
if (game.shengli != i) {
|
||||
set_self(1244+i,37,0); //赢家印章
|
||||
set_self(1248+i,37,0);
|
||||
}else {
|
||||
//set_self(1220+i,37,0);
|
||||
set_self(1224+i,37,0);
|
||||
set_self(1232+i,37,0);
|
||||
set_self(1236+i,37,0);
|
||||
//set_self(1260+i,37,0);
|
||||
set_self(1268+i,37,0);
|
||||
//set_self(1264+i,37,0);
|
||||
//set_self(1123+i,37,0);
|
||||
}
|
||||
if (game.carlen[i] != 1) {
|
||||
set_self(1252+i,37,0); //剩余一张牌提示
|
||||
}
|
||||
set_self(1240+i,7,ifast_abs(game.xiaojufen[i]));
|
||||
set_self(1240+i,18,get_self(1228+i,18)+48-ifast_inttostr(get_self(1240+i,7)).length*15,0,0);
|
||||
set_self(1240+i,20,30*ifast_inttostr(ifast_abs(game.xiaojufen[i])).length,0,0);
|
||||
if(game.xiaojufen[i]<0) //显示小局分
|
||||
{
|
||||
set_self(1272+i,37,1);
|
||||
set_self(1272+i,18,get_self(1240+i,18)-30,0,0);
|
||||
}
|
||||
else if(game.xiaojufen[i]>=0)
|
||||
{
|
||||
set_self(1272+i,37,0);
|
||||
}
|
||||
set_self(1240+i,18,get_self(1228+i,18)+48-ifast_inttostr(get_self(1240+i,7)).length*15,0,0);
|
||||
}
|
||||
for (var i=0;i<game.people;i++) {
|
||||
if (game.shengli == i) {
|
||||
for (var a = 0; a < game.xs_paishu.length; a++){
|
||||
ab = ab + game.xs_paishu[a];
|
||||
}
|
||||
if (kg == 0) {
|
||||
game.xs_paishu[i] = ab; //赢家计算牌数
|
||||
kg++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var i=0;i<game.people;i++) {
|
||||
set_self(1232+i,7,game.xs_paishu[i]); //获取牌数目
|
||||
set_self(1232+i,20,16*ifast_inttostr(game.xs_paishu[i]).length,0,0); //数字长度
|
||||
}
|
||||
for (var i=0;i<game.people;i++) {
|
||||
set_self(1268+i,7,game.xs_paishu[i]*game.difen); //获取牌得分
|
||||
set_self(1268+i,20,16*ifast_inttostr(game.xs_paishu[i]*game.difen).length,0,0);
|
||||
if (game.chuntian[i] == 1 ) {
|
||||
set_self(1232+i,7,17); //获取牌数目
|
||||
set_self(1232+i,20,32,0,0); //数字长度
|
||||
set_self(1268+i,7,17*game.difen);
|
||||
set_self(1268+i,20,16*ifast_inttostr(17*game.difen).length,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
for (var i=0;i<=3;i++) { //显示手牌数的长度
|
||||
if(get_self(1123+i,7)<10)
|
||||
{
|
||||
set_self(1123+i,20,16,0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_self(1123+i,20,32,0,0);
|
||||
|
||||
}
|
||||
if(get_self(1232+i,7)<10)
|
||||
{
|
||||
set_self(1232+i,18,get_self(1224+i,18)+38,0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_self(1232+i,18,get_self(1224+i,18)+30,0,0);
|
||||
|
||||
}
|
||||
if(get_self(1236+i,7)<10)
|
||||
{
|
||||
set_self(1236+i,18,get_self(1224+i,18)+140,0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_self(1236+i,18,get_self(1224+i,18)+132,0,0);
|
||||
|
||||
}
|
||||
if(get_self(1268+i,7)<10)
|
||||
{
|
||||
set_self(1268+i,18,get_self(1224+i,18)+200,0,0);
|
||||
}
|
||||
if(get_self(1268+i,7)>=10 && get_self(1268+i,7)<100)
|
||||
{
|
||||
set_self(1268+i,18,get_self(1224+i,18)+192,0,0);
|
||||
|
||||
}
|
||||
if(get_self(1268+i,7)>100){
|
||||
set_self(1268+i,18,get_self(1224+i,18)+184,0,0);
|
||||
}
|
||||
}
|
||||
for (var i = 1405; i <= 1440; i++) {
|
||||
set_self(i,1,53,0,0);
|
||||
}
|
||||
for (var a = 0;a<game.people;a++) {
|
||||
dxpaixu(game.suoyoupai[a],game.laizi);
|
||||
if ( a==0) {
|
||||
if (game.suoyoupai[a].length == 17) {
|
||||
set_self(1121,43,game.suoyoupai[a][16]+1);
|
||||
set_self(1121,37,1,0,0);
|
||||
for (var i =1405 ;i<16+1405;i++) //显示剩余的牌
|
||||
{
|
||||
set_self(i,43,game.suoyoupai[a][i-1405]+1);
|
||||
set_self(i,37,1,0,0);
|
||||
}
|
||||
}else {
|
||||
for (var i =1405 ;i<game.suoyoupai[a].length+1405;i++) //显示剩余的牌
|
||||
{
|
||||
set_self(i,43,game.suoyoupai[a][i-1405]+1);
|
||||
set_self(i,37,1,0,0);
|
||||
}
|
||||
}
|
||||
gp_ui_laizibz(game.suoyoupai[a],game.laizi,1405);
|
||||
}
|
||||
if ( a==1) {
|
||||
if (game.suoyoupai[a].length == 17) {
|
||||
set_self(1122,43,game.suoyoupai[a][16]+1);
|
||||
set_self(1122,37,1,0,0);
|
||||
for (var i =1421 ;i<16+1421;i++) //显示剩余的牌
|
||||
{
|
||||
set_self(i,43,game.suoyoupai[a][i-1421]+1);
|
||||
set_self(i,37,1,0,0);
|
||||
}
|
||||
}else {
|
||||
for (var i =1421 ;i<game.suoyoupai[a].length+1421;i++) //显示剩余的牌
|
||||
{
|
||||
set_self(i,43,game.suoyoupai[a][i-1421]+1);
|
||||
set_self(i,37,1,0,0);
|
||||
}
|
||||
}
|
||||
gp_ui_laizibz(game.suoyoupai[a],game.laizi,1421);
|
||||
}
|
||||
if ( a==2) {
|
||||
for (var i =1437 ;i<game.suoyoupai[a].length+1437;i++) //显示剩余的牌
|
||||
{
|
||||
set_self(i,43,game.suoyoupai[a][i-1437]+1);
|
||||
set_self(i,37,1,0,0);
|
||||
}
|
||||
gp_ui_laizibz(game.suoyoupai[a],game.laizi,1437);
|
||||
}
|
||||
}
|
||||
if (Utl.getIsInfinite() == 0) {//星星场如果bu是无限局
|
||||
for(var i=0;i<game.grade.length;i++)
|
||||
{
|
||||
Utl.setGrade(i,game.grade[i]);
|
||||
}
|
||||
}else{
|
||||
for(var i=0;i<game.people;i++)
|
||||
{
|
||||
Utl.setGrade(i,xxs[i]);
|
||||
}
|
||||
Utl.setDeskStage(0);
|
||||
if (!xj) {
|
||||
for (var i = 0; i < 3; i++) {
|
||||
Utl.setPlayerPrepare(i, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
xj = 0;
|
||||
}
|
||||
gameabc_face.ontimer_1058 = function(gameid, spid, times, timelong, alltimes)
|
||||
{
|
||||
set_group(217,37,0,0,0);
|
||||
set_self (1058,57,0,0,0);
|
||||
}
|
||||
gameabc_face.ontimer_1057 = function(gameid, spid, times, timelong, alltimes)
|
||||
{
|
||||
//gp_ui_xsbuyao();
|
||||
set_self (1057,57,0,0,0);
|
||||
gp_ui_shizhong(game.control);//显示时钟
|
||||
if (game.paixing == null ) {
|
||||
for (var i=1131;i<=1134;i++) {
|
||||
set_self(i,37,0,0,0);
|
||||
}
|
||||
}
|
||||
if (game.control == game.my_seat) //显示按钮
|
||||
{
|
||||
for(var i =1001;i<=game.ersansi[0] ; i++){
|
||||
if(get_self(i,19,0,0,0) == cpy1){
|
||||
set_self(i,37,0,0,0);
|
||||
}
|
||||
}
|
||||
gp_ui_xsan(game.paixing,game.tishipai,game.zhinengchu);
|
||||
|
||||
}
|
||||
|
||||
set_self(1056,57,xs_dsq,0,0);
|
||||
}
|
||||
gameabc_face.ontimer_1056 = function(gameid, spid, times, timelong, alltimes)
|
||||
{
|
||||
|
||||
set_self(1056,57,0,0,0);
|
||||
switch(Utl.changeToStatus(game.control)) //出牌隐藏
|
||||
{
|
||||
case 0:
|
||||
for(var i =1001;i<=game.ersansi[0] ; i++){
|
||||
if(get_self(i,19,0,0,0) == cpy1){
|
||||
set_self(i,37,0,0,0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
for(var i = game.ersansi[0]+1;i<=game.ersansi[1] ; i++){
|
||||
set_self(i,37,0,0,0);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
for(var i = game.ersansi[1]+1;i<=game.ersansi[2] ; i++){
|
||||
set_self(i,37,0,0,0);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
for(var i = game.ersansi[2]+1;i<=game.ersansi[3] ; i++){
|
||||
set_self(i,37,0,0,0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (game.paixing == null) {
|
||||
for (var i=0;i<=3;i++) { //不出消失
|
||||
set_self(1131+i,37,0,0,0);
|
||||
set_group (201+i,37,0,0,0);
|
||||
}
|
||||
set_group(201,37,0,0,0);
|
||||
for (var i = 0; i<=game.pai.length-1;i++)
|
||||
{
|
||||
set_self(1001,18,spx-game.pai.length*spjg/2,0,0);
|
||||
set_self(1001+i,18,get_self(1001,18,0,0,0)+spjg*i,0,0);
|
||||
//set_self(1001+i,19,spy,0,0);
|
||||
set_self(1001+i,43,game.pai[i]+1,0,0);
|
||||
set_self(1001+i,37,1,0,0);
|
||||
set_self(1081,18,spx-game.pai.length*spjg/2,0,0);
|
||||
set_self(1081+i,18,get_self(1001,18,0,0,0)+spjg*i,0,0);
|
||||
set_self(1081+i,19,spy,0,0);
|
||||
//set_self(1081+i,37,1,0,0);
|
||||
}
|
||||
}
|
||||
gp_ui_shizhong(game.control);//显示时钟
|
||||
if (game.control == game.my_seat && game.kexuanpai.length>0) //显示按钮
|
||||
{
|
||||
gp_ui_xsan(game.paixing,game.kexuanpai,game.zhinengchu);
|
||||
for (var i = 0; i<=game.pai.length-1;i++)
|
||||
{
|
||||
set_self(1081+i,37,1,0,0);
|
||||
}
|
||||
for (var i = 0; i<=game.pai.length-1;i++)
|
||||
{
|
||||
for (var a = 0; a<=game.kexuanpai.length-1;a++){
|
||||
if (!game.kexuanpai[a][0]){
|
||||
if (game.pai[i] == game.kexuanpai[a]) {
|
||||
set_self(1081+i,37,0,0,0);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for ( var b = 0;b <=game.kexuanpai[a].length;b++) {
|
||||
if (game.pai[i] == game.kexuanpai[a][b]) {
|
||||
set_self(1081+i,37,0,0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
for (var i = 0; i<=game.pai.length-1;i++) //不可出的牌还原位置
|
||||
{
|
||||
if (get_self(1081+i,37) == 1){
|
||||
set_self(1001+i,19,spy,0,0);
|
||||
}
|
||||
}
|
||||
for(var i =1001;i<=game.ersansi[0] ; i++){
|
||||
if(get_self(i,19,0,0,0) == cpy1){
|
||||
set_self(i,37,0,0,0);
|
||||
}
|
||||
}
|
||||
switch(Utl.changeToStatus(game.control))//要不起消失
|
||||
{
|
||||
case 0:
|
||||
set_self(1131,37,0,0,0);
|
||||
|
||||
break;
|
||||
case 1:
|
||||
|
||||
set_self(1132,37,0,0,0);
|
||||
break;
|
||||
case 2:
|
||||
|
||||
set_self(1133,37,0,0,0);
|
||||
break;
|
||||
case 3:
|
||||
|
||||
set_self(1134,37,0,0,0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
gameabc_face.ontimer_1055 = function(gameid, spid, times, timelong, alltimes)
|
||||
{
|
||||
set_self(1055,57,0,0,0);
|
||||
var sex = Utl.getSexBySeat(game.seat);
|
||||
gp_yx.passyinxiao(sex);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
gameabc_face.ontimer_1054 = function(gameid, spid, times, timelong, alltimes)
|
||||
{
|
||||
var aaa = game.hf_huifang[game.hf_ju].putpai[lunshu][0];//显示打牌,
|
||||
var bbb = game.hf_playerid.length;
|
||||
var ccc = game.hf_huifang[game.hf_ju].putpai[lunshu][1];//牌型
|
||||
var ddd = game.hf_huifang[game.hf_ju].putpai[lunshu][4];//控制权
|
||||
var eee = game.hf_huifang[game.hf_ju].putpai;
|
||||
var fff = game.hf_huifang[game.hf_ju].putpai[lunshu][2];//剩余的手牌
|
||||
var ggg = game.hf_huifang[game.hf_ju].pai;
|
||||
baipai(fff,bbb);
|
||||
if (!game.hf_huifang[game.hf_ju].laizi ) { //经典
|
||||
xs_dapai(aaa,bbb,ccc,ddd,0);
|
||||
} else { //癞子
|
||||
var hhh = game.hf_huifang[game.hf_ju].putpai[lunshu][5];//显示打牌,
|
||||
xs_dapai(aaa,bbb,ccc,ddd,hhh);
|
||||
}
|
||||
|
||||
hf_shizhong(ddd);
|
||||
lunshu++;
|
||||
if ( lunshu>=eee.length) {
|
||||
set_self(1054,57,0,0,0);
|
||||
set_self(1075,57,0,0,0);
|
||||
set_self(1075,37,0,0,0);
|
||||
set_self(1074,37,0,0,0);
|
||||
set_self(1141,37,0,0,0);
|
||||
set_self(1140,37,0,0,0);
|
||||
///进入结算节面///
|
||||
set_self(1053,57,1000,0,0);
|
||||
}
|
||||
}
|
||||
gameabc_face.ontimer_1053 = function(gameid, spid, times, timelong, alltimes)
|
||||
{
|
||||
var fff = game.hf_huifang[game.hf_ju].putpai[lunshu-1][2];//剩余的手牌
|
||||
set_self(1053,57,0);
|
||||
set_group(500,37,1,0,0);
|
||||
set_level (501,1);
|
||||
for(var a=501;a<=505;a++)
|
||||
{
|
||||
set_group(a,37,0,0,0);
|
||||
}
|
||||
set_self(1189,37,0,0,0)
|
||||
set_self(1191,37,0,0,0)
|
||||
set_self(1072,37,1,0,0);
|
||||
//结算取消托管
|
||||
//set_self(1104,37,1,0,0);
|
||||
//set_self(1088,37,0,0,0);
|
||||
//set_self(1089,37,0,0,0);
|
||||
//set_self(1088,19,-1000,0,0);
|
||||
//set_self(1089,18,-1000,0,0);
|
||||
//打开结算页s
|
||||
for(var a=501;a<501+game.hf_playerid.length;a++)
|
||||
{
|
||||
set_group(a,37,1,0,0);
|
||||
}
|
||||
var ab=0;
|
||||
var paidefen = [];
|
||||
var xs_paishu = [];
|
||||
for (var i=0;i<game.hf_playerid.length;i++) {
|
||||
set_self(1204+i,1,Utl.getHeadimgSrc(i)); //头像
|
||||
set_self(1212+i,7,Func.subString(Utl.getNicknameBySeat(i),8,true)); //ID
|
||||
set_self(1216+i,7,"ID:"+game.hf_playerid[i]); //id号
|
||||
|
||||
set_self(1236+i,7,game.hf_difen); //底分
|
||||
set_self(1236+i,20,16*ifast_inttostr(game.hf_difen).length,0,0); //底分
|
||||
set_self(1123+i,7,game.hf_zha[i]); //炸分
|
||||
if (game.hf_huifang[game.hf_ju].carlen[i] == 1) { //改变牌数目
|
||||
xs_paishu[i] = 0;
|
||||
}else {
|
||||
xs_paishu[i] = game.hf_huifang[game.hf_ju].carlen[i];
|
||||
}
|
||||
if (game.hf_huifang[game.hf_ju].chuntian[i] != 1) {
|
||||
set_self(1256+i,37,0); //春天印章
|
||||
set_self(1260+i,43,2);
|
||||
}else {
|
||||
set_self(1260+i,43,1);
|
||||
}
|
||||
if (game.hf_huifang[game.hf_ju].shengli != i) {
|
||||
set_self(1244+i,37,0); //赢家印章
|
||||
set_self(1248+i,37,0);
|
||||
}else {
|
||||
//set_self(1220+i,37,0);
|
||||
set_self(1224+i,37,0);
|
||||
set_self(1232+i,37,0);
|
||||
set_self(1236+i,37,0);
|
||||
set_self(1260+i,37,0);
|
||||
set_self(1268+i,37,0);
|
||||
//set_self(1264+i,37,0);
|
||||
//set_self(1123+i,37,0);
|
||||
}
|
||||
if (game.hf_huifang[game.hf_ju].carlen[i] != 1) {
|
||||
set_self(1252+i,37,0); //剩余一张牌提示
|
||||
}
|
||||
set_self(1240+i,7,ifast_abs(game.hf_huifang[game.hf_ju].xiaojufen[i]));
|
||||
set_self(1240+i,18,get_self(1228+i,18)+48-ifast_inttostr(get_self(1240+i,7)).length/2*30,0,0);
|
||||
set_self(1240+i,20,30*ifast_inttostr(ifast_abs(game.hf_huifang[game.hf_ju].xiaojufen[i])).length,0,0);
|
||||
if(game.hf_huifang[game.hf_ju].xiaojufen[i]<0) //显示小局分
|
||||
{
|
||||
set_self(1272+i,37,1);
|
||||
set_self(1272+i,18,get_self(1240+i,18)-30,0,0);
|
||||
}
|
||||
else if(game.hf_huifang[game.hf_ju].xiaojufen[i]>=0)
|
||||
{
|
||||
set_self(1272+i,37,0);
|
||||
}
|
||||
}
|
||||
for (var i=0;i<game.hf_playerid.length;i++) {
|
||||
if (game.hf_huifang[game.hf_ju].shengli == i) {
|
||||
for (var a = 0; a < xs_paishu.length; a++){
|
||||
ab = ab + xs_paishu[a];
|
||||
}
|
||||
if (kg == 0) {
|
||||
xs_paishu[i] = ab; //赢家计算牌数
|
||||
kg++;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (var i=0;i<game.hf_playerid.length;i++) {
|
||||
set_self(1232+i,7,xs_paishu[i]); //获取牌数目
|
||||
set_self(1232+i,20,16*ifast_inttostr(xs_paishu[i]).length,0,0); //数字长度
|
||||
}
|
||||
for (var i=0;i<game.hf_playerid.length;i++) {
|
||||
set_self(1268+i,7,xs_paishu[i]*game.hf_difen); //获取牌得分
|
||||
set_self(1268+i,20,16*ifast_inttostr(xs_paishu[i]*game.hf_difen).length,0,0);
|
||||
}
|
||||
|
||||
for (var i=0;i<=3;i++) { //显示手牌数的长度
|
||||
if(get_self(1123+i,7)<10)
|
||||
{
|
||||
set_self(1123+i,20,16,0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_self(1123+i,20,32,0,0);
|
||||
|
||||
}
|
||||
if(get_self(1232+i,7)<10)
|
||||
{
|
||||
set_self(1232+i,18,get_self(1224+i,18)+38,0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_self(1232+i,18,get_self(1224+i,18)+30,0,0);
|
||||
|
||||
}
|
||||
if(get_self(1236+i,7)<10)
|
||||
{
|
||||
set_self(1236+i,18,get_self(1224+i,18)+140,0,0);
|
||||
}
|
||||
else
|
||||
{
|
||||
set_self(1236+i,18,get_self(1224+i,18)+132,0,0);
|
||||
}
|
||||
if(get_self(1268+i,7)<10)
|
||||
{
|
||||
set_self(1268+i,18,get_self(1224+i,18)+200,0,0);
|
||||
}
|
||||
if(get_self(1268+i,7)>=10 && get_self(1268+i,7)<100)
|
||||
{
|
||||
set_self(1268+i,18,get_self(1224+i,18)+192,0,0);
|
||||
}
|
||||
if(get_self(1268+i,7)>100){
|
||||
set_self(1268+i,18,get_self(1224+i,18)+184,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
for (var a = 0;a<game.hf_playerid.length;a++) {
|
||||
if ( a==0) {
|
||||
if (fff.length == 17) {
|
||||
set_self(1121,43,fff[a][16]+1);
|
||||
set_self(1121,37,1,0,0);
|
||||
for (var i =1405 ;i<16+1405;i++) //显示剩余的牌
|
||||
{
|
||||
set_self(i,43,fff[a][i-1405]+1);
|
||||
set_self(i,37,1,0,0);
|
||||
}
|
||||
}else {
|
||||
for (var i =1405 ;i<fff[a].length+1405;i++) //显示剩余的牌
|
||||
{
|
||||
set_self(i,43,fff[a][i-1405]+1);
|
||||
set_self(i,37,1,0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( a==1) {
|
||||
if (fff[a].length == 17) {
|
||||
set_self(1122,43,fff[a][16]+1);
|
||||
set_self(1122,37,1,0,0);
|
||||
for (var i =1421 ;i<16+1421;i++) //显示剩余的牌
|
||||
{
|
||||
set_self(i,43,fff[a][i-1421]+1);
|
||||
set_self(i,37,1,0,0);
|
||||
}
|
||||
}else {
|
||||
for (var i =1421 ;i<fff[a].length+1421;i++) //显示剩余的牌
|
||||
{
|
||||
set_self(i,43,fff[a][i-1421]+1);
|
||||
set_self(i,37,1,0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( a==2) {
|
||||
for (var i =1437 ;i<fff[a].length+1437;i++) //显示剩余的牌
|
||||
{
|
||||
set_self(i,43,fff[a][i-1437]+1);
|
||||
set_self(i,37,1,0,0);
|
||||
}
|
||||
}
|
||||
if ( a==3) {
|
||||
for (var i =1453 ;i<fff[a].length+1453;i++) //显示剩余的牌
|
||||
{
|
||||
set_self(i,43,fff[a][i-1453]+1);
|
||||
set_self(i,37,1,0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
263
codes/games/client/Projects/guanpai-jx/js/guanpai/net.js
Normal file
263
codes/games/client/Projects/guanpai-jx/js/guanpai/net.js
Normal file
@@ -0,0 +1,263 @@
|
||||
//收发包
|
||||
var gp_sfb = function(_msg){
|
||||
if (kehuduan == 0) {
|
||||
game.my_seat = _msg.seat;
|
||||
}
|
||||
else {
|
||||
game.my_seat = Utl.getMySeat();
|
||||
}
|
||||
switch (_msg.rpc){
|
||||
case 'fapai':
|
||||
tishi = 0;
|
||||
game.zha = [];
|
||||
game.paixing = [];
|
||||
set_group(214,37,0,0,0);
|
||||
game.zhunbei = [0,0,0];
|
||||
game.pai = _msg.data.pai;
|
||||
game.control = _msg.data.control;
|
||||
game.jushu = _msg.data.jushu;
|
||||
game.carlen = _msg.data.carlen;
|
||||
game.zhuangtai = _msg.data.zhuangtai;
|
||||
game.countdown = _msg.data.countdown;
|
||||
game.leixing = _msg.data.leixing;
|
||||
if ( game.leixing[3]==2) {
|
||||
game.laizi = _msg.data.laizi;
|
||||
if (game.laizi ==14 ) {
|
||||
game.laizi = 1;
|
||||
}else if(game.laizi ==15 ) {
|
||||
game.laizi = 2;
|
||||
}
|
||||
}else {
|
||||
game.laizi = 0;
|
||||
game.laizi_bian = [[],[],[]]
|
||||
}
|
||||
switch (game.leixing[1]){
|
||||
case 1:
|
||||
game.ersansi = [1017,1034,1051,1068];
|
||||
game.people = 2;
|
||||
break;
|
||||
case 2:
|
||||
game.ersansi = [1017,1034,1051,1068];
|
||||
game.people = 3;
|
||||
break;
|
||||
}
|
||||
gp_ui_fapai();
|
||||
break;
|
||||
case 'dapai':
|
||||
game.tuoguan = _msg.data.tuoguan;
|
||||
tishi = 0;
|
||||
game.baodan = []; // 报单
|
||||
if( !_msg.data.put ){
|
||||
|
||||
if ( !_msg.hongsan && game.people == 3) {//显示3人 先手必出红3
|
||||
if ( game.laizi == 3) {
|
||||
gp_tishiyu(3,536);
|
||||
} else {
|
||||
gp_tishiyu(1,536);
|
||||
}
|
||||
}else {
|
||||
gp_tishiyu(1,508);
|
||||
}
|
||||
}
|
||||
else {
|
||||
game.kexuanpai =[];
|
||||
game.tishipai =[];
|
||||
game.zhinengchu = 0;
|
||||
game.seat = _msg.data.seat;
|
||||
game.grade = _msg.data.grade;
|
||||
game.zha = _msg.data.zha;
|
||||
game.carlen = _msg.data.carlen;
|
||||
game.control = _msg.data.control;
|
||||
game.xs_dapai = _msg.data.xs_dapai;
|
||||
game.paixing = _msg.data.paixing;
|
||||
game.jiang = _msg.data.jiang;
|
||||
game.chu = _msg.data.chu;
|
||||
if(_msg.data.kexuanpai.length > 0){
|
||||
game.kexuanpai = _msg.data.kexuanpai;
|
||||
game.tishipai = _msg.data.tishipai;
|
||||
game.zhinengchu =_msg.data.zhinengchu;
|
||||
game.baodan = _msg.data.baodan;
|
||||
|
||||
}
|
||||
if (_msg.data.seat == game.my_seat)
|
||||
{
|
||||
game.pai = _msg.data.pai;
|
||||
}
|
||||
if ( game.leixing[3]!=2) {
|
||||
game.laizi = 0;
|
||||
}else {
|
||||
game.laizi_bian =_msg.data.laizi_bian;
|
||||
game.laizi_dapai = _msg.data.laizi_dapai;
|
||||
}
|
||||
gp_ui_xschupai();
|
||||
gp_ui_xs_fen();
|
||||
gp_ui_xs_zongfen();
|
||||
gp_ui_deng();
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 'buyao':
|
||||
game.tuoguan = _msg.data.tuoguan;
|
||||
tishi = 0;
|
||||
game.baodan = []; // 报单
|
||||
game.seat = _msg.data.seat;
|
||||
game.control = _msg.data.control;
|
||||
game.xs_dapai = _msg.data.xs_dapai;
|
||||
game.paixing = _msg.data.paixing;
|
||||
//game.countdown = _msg.data.countdown;
|
||||
game.kexuanpai =[];
|
||||
game.tishipai =[];
|
||||
if(_msg.data.kexuanpai.length > 0){
|
||||
game.kexuanpai = _msg.data.kexuanpai;
|
||||
game.tishipai = _msg.data.tishipai;
|
||||
game.zhinengchu = _msg.data.zhinengchu;
|
||||
game.baodan = _msg.data.baodan;
|
||||
|
||||
}
|
||||
if (game.tuoguan==1&&game.seat==game.my_seat) {
|
||||
set_self(1105,43,2,0,0);set_self(1106,37,1,0,0);set_self(1109,37,1,0,0);set_self(1108,37,1,0,0);
|
||||
//diand=0;
|
||||
}
|
||||
game.pass = _msg.data.pass;
|
||||
for (var i = 0; i<=game.pai.length-1;i++)
|
||||
{
|
||||
set_self(1081+i,37,0,0,0);
|
||||
}
|
||||
if (game.pass==-2 ) {
|
||||
//gp_ui_passbuyao();
|
||||
}else {
|
||||
gp_ui_xsbuyao();
|
||||
}
|
||||
if ( game.leixing[3]!=2) {
|
||||
game.laizi = 0;
|
||||
}
|
||||
gp_ui_deng();
|
||||
break ;
|
||||
case 'xiaoju':
|
||||
game.tuoguan = 0;
|
||||
game.seat = _msg.data.seat;
|
||||
game.zhuangtai = _msg.data.zhuangtai;
|
||||
game.daxiaoju = 1;
|
||||
game.xs_dapai = _msg.data.xs_dapai;
|
||||
game.control = _msg.data.control;
|
||||
game.chuntian = _msg.data.chuntian;
|
||||
game.paixing = _msg.data.paixing;
|
||||
gp_ui_xiaoju_zha();
|
||||
game.grade = _msg.data.grade;
|
||||
game.zha = _msg.data.zha;
|
||||
game.xiaojufen = _msg.data.xiaojufen;
|
||||
game.shengli = _msg.data.shengli;
|
||||
game.difen = _msg.data.difen;
|
||||
game.suoyoupai = _msg.data.suoyoupai;
|
||||
game.zhuangtai = _msg.data.zhuangtai;
|
||||
game.carlen = _msg.data.carlen;
|
||||
xxs = _msg.data.xxs;
|
||||
if ( game.leixing[3]!=2) {
|
||||
game.laizi = 0;
|
||||
game.laizi_bian = [[],[],[]]
|
||||
}else {
|
||||
game.laizi_bian =_msg.data.laizi_bian;
|
||||
game.laizi_dapai = _msg.data.laizi_dapai;
|
||||
}
|
||||
for(var i = 0;i<_msg.data.carlen.length;i++){
|
||||
game.xs_paishu[i] = _msg.data.carlen[i];
|
||||
}
|
||||
kg=0;
|
||||
game.people = _msg.data.people;
|
||||
game.pai = _msg.data.suoyoupai[game.my_seat];
|
||||
gp_ui_xiaoju();
|
||||
gp_ui_xs_fen();
|
||||
gp_ui_donghua();
|
||||
kongzhi = [0,0,0,0];
|
||||
break ;
|
||||
case 'zhunbei':
|
||||
game.zhunbei = _msg.data.zhunbei;
|
||||
if (_msg.data.seat == game.my_seat){
|
||||
|
||||
set_level(501,0);
|
||||
set_group(201,37,0,0,0);
|
||||
set_group(202,37,0,0,0);
|
||||
set_group(203,37,0,0,0);
|
||||
set_group(204,37,0,0,0);
|
||||
set_group(213,37,0,0,0);
|
||||
set_self(1143,37,0,0,0);
|
||||
set_group(303,37,0,0,0);
|
||||
gp_ui_paihuanyuan();
|
||||
}
|
||||
|
||||
for (var i=0;i<game.people;i++ ) {
|
||||
if(game.zhunbei[i]==1 && Utl.getIsInfinite() == 0) {//星星场如果bu是无限局
|
||||
set_self(1276+Utl.changeToStatus(i),37,1,0,0);//显示准备
|
||||
}
|
||||
}
|
||||
|
||||
break ;
|
||||
case 'daju':
|
||||
game.seat = _msg.data.seat;
|
||||
game.zhuangtai = _msg.data.zhuangtai;
|
||||
game.xs_dapai = _msg.data.xs_dapai;
|
||||
game.control = _msg.data.control;
|
||||
game.chuntian = _msg.data.chuntian;
|
||||
game.paixing = _msg.data.paixing;
|
||||
gp_ui_xiaoju_zha();
|
||||
game.zha = _msg.data.zha;
|
||||
game.xiaojufen = _msg.data.xiaojufen;
|
||||
game.shengli = _msg.data.shengli;
|
||||
game.difen = _msg.data.difen;
|
||||
game.suoyoupai = _msg.data.suoyoupai;
|
||||
game.carlen = _msg.data.carlen;
|
||||
game.grade = _msg.data.grade;
|
||||
game.quanbufen = _msg.data.quanbufen;
|
||||
game.laizi_bian =_msg.data.laizi_bian;
|
||||
for(var i = 0;i<_msg.data.carlen.length;i++){
|
||||
game.xs_paishu[i] = _msg.data.carlen[i];
|
||||
}
|
||||
kg=0;
|
||||
game.people = _msg.data.people;
|
||||
game.pai = _msg.data.suoyoupai[game.my_seat];
|
||||
if ( game.leixing[3]!=2) {
|
||||
game.laizi = 0;
|
||||
game.laizi_bian = [[],[],[]]
|
||||
}else {
|
||||
game.laizi_bian =_msg.data.laizi_bian;
|
||||
game.laizi_dapai = _msg.data.laizi_dapai;
|
||||
}
|
||||
gp_ui_xiaoju();
|
||||
gp_ui_xs_fen();
|
||||
game.daxiaoju = 2;
|
||||
gp_ui_donghua();
|
||||
break ;
|
||||
case 'xingxingbugou':
|
||||
Utl.openTips("星星不足已离场", 3000);
|
||||
break ;
|
||||
case 'tuoguan':
|
||||
game.tuoguan=_msg.data.tuoguan;
|
||||
gp_ui_xstuoguan();
|
||||
break ;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1189
codes/games/client/Projects/guanpai-jx/js/guanpai/ui.js
Normal file
1189
codes/games/client/Projects/guanpai-jx/js/guanpai/ui.js
Normal file
File diff suppressed because it is too large
Load Diff
26
codes/games/client/Projects/guanpai-jx/js/guanpai_Event.js
Normal file
26
codes/games/client/Projects/guanpai-jx/js/guanpai_Event.js
Normal file
@@ -0,0 +1,26 @@
|
||||
//精灵事件单元...
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
4
codes/games/client/Projects/guanpai-jx/js/jquery-2.1.1.min.js
vendored
Normal file
4
codes/games/client/Projects/guanpai-jx/js/jquery-2.1.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user