目录结构调整
This commit is contained in:
656
codes/games/client/Projects/niuniu/js/00_Surface/00_minhttp.js
Normal file
656
codes/games/client/Projects/niuniu/js/00_Surface/00_minhttp.js
Normal file
@@ -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/niuniu/js/00_Surface/02_Const.js
Normal file
822
codes/games/client/Projects/niuniu/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/niuniu/js/00_Surface/04_Data.js
Normal file
582
codes/games/client/Projects/niuniu/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/niuniu/js/00_Surface/05_Func.js
Normal file
4190
codes/games/client/Projects/niuniu/js/00_Surface/05_Func.js
Normal file
File diff suppressed because it is too large
Load Diff
553
codes/games/client/Projects/niuniu/js/00_Surface/06_Player.js
Normal file
553
codes/games/client/Projects/niuniu/js/00_Surface/06_Player.js
Normal file
@@ -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/niuniu/js/00_Surface/07_Desk.js
Normal file
1425
codes/games/client/Projects/niuniu/js/00_Surface/07_Desk.js
Normal file
File diff suppressed because it is too large
Load Diff
1027
codes/games/client/Projects/niuniu/js/00_Surface/08_Utl_Output.js
Normal file
1027
codes/games/client/Projects/niuniu/js/00_Surface/08_Utl_Output.js
Normal file
File diff suppressed because it is too large
Load Diff
886
codes/games/client/Projects/niuniu/js/00_Surface/09_Net.js
Normal file
886
codes/games/client/Projects/niuniu/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/niuniu/js/00_Surface/10_Game.js
Normal file
610
codes/games/client/Projects/niuniu/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/niuniu/js/00_Surface/11_GameUI.js
Normal file
9860
codes/games/client/Projects/niuniu/js/00_Surface/11_GameUI.js
Normal file
File diff suppressed because it is too large
Load Diff
2437
codes/games/client/Projects/niuniu/js/00_Surface/12_Logic.js
Normal file
2437
codes/games/client/Projects/niuniu/js/00_Surface/12_Logic.js
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,162 @@
|
||||
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->本地服务器
|
||||
gameserver:"https://tsgames.daoqi88.cn/config/update_jsonv2.txt"
|
||||
};
|
||||
|
||||
Game_Config.Max = {
|
||||
SumOfRoomtype:5,//创建时房间类型roomtype数组长度
|
||||
ShowChat:2000,//聊天停留时间
|
||||
PlayerCnt:10,//房间最大人数
|
||||
group:500,//游戏最大群组号
|
||||
showtime:10,//加载等待最少时间
|
||||
reconnecttime:30000,//唤醒游戏间隔(超过间隔断线重连)
|
||||
Mainnickname:20,//主界面玩家昵称显示长度(字符长度)
|
||||
Infonickname:16//个人信息显示长度(字符长度)
|
||||
};
|
||||
Game_Config.Combat = {
|
||||
height:80,//战绩页单行高度高度
|
||||
up_y:190,//战绩页裁剪y坐标
|
||||
bannerheight:60,//战绩横幅高度
|
||||
bannery:80,//战绩横幅Y左边(相对48精灵)
|
||||
btnbg:50
|
||||
};
|
||||
Game_Config.Info = {
|
||||
Mainnickname:8,//游戏主界面玩家信息显示最大长度(字符)
|
||||
textwidth_1:10,//聊天显示文字的宽度(未改动聊天显示文字大小无需改动无需修改)
|
||||
textwidth_2:12.5,//聊天显示文字的宽度(未改动聊天显示文字大小无需改动无需修改)
|
||||
otherPositionDefault:false,//其他主界面玩家信息(昵称、积分)是否采用默认对齐方式对齐居中点为头像中点
|
||||
myPositionDefault:false,//其他主界面玩家信息(昵称、积分)是否采用默认对齐方式对齐居中点为头像中点
|
||||
myPosition:194,//自己信息对齐点(根据游戏界面自行修改) 5人
|
||||
position:[1195,1195,85,85], //5人
|
||||
TextContent:["快点下注啊!","大家都别抢,让我坐把庄!","下这么多注,输死你去!","输死了,一盘大牌都没摸过!","今天手气真好。","给我一个五花吧!","小手一抖,大牌到手!"],
|
||||
TextContentMp3:["","","","","","",""]//常用语对应音效
|
||||
};
|
||||
Game_Config.Share={//分享参数
|
||||
appdownload:"",//下载链接(无需配置,从服务器获取)
|
||||
title:"【友乐牛牛】",//(分享标题)
|
||||
description:"朋友圈的棋牌游戏,经典玩法,乐趣无穷!",//分享描述
|
||||
gameTitle:"",//游戏中的分享标题模板工程会自动将游戏名字分享出去、不必写在这个变量里(子游戏需要设置)
|
||||
gameDescription:"朋友圈的棋牌游戏,经典玩法,乐趣无穷!"//游戏中分享描述(子游戏需要设置)
|
||||
};
|
||||
Game_Config.Chat={//游戏内聊天配置信息
|
||||
LimitLength:40,//聊天最大长度(字节长度)
|
||||
textwidth:12.5,//聊天显示文字的宽度(未改动聊天显示文字大小无需改动无需修改)
|
||||
ChatDis:[30,15],//聊天气泡与内容的间隔0位置左右间隔(最好不要低于30)1位置上下间隔
|
||||
isLeft:[1,0,0,1,1],//聊天气泡是否为以左边为基准线
|
||||
ChatLoc:[[35,517],[1100,315],[1100,105],[175,105],[175,315]]//聊天气泡的基准点位置(注意是基准点位置!)
|
||||
|
||||
};
|
||||
Game_Config.Voice={//游戏内聊天配置信息
|
||||
VoiceTime:600,//播放语音动画的时间一般情况无需无需修改
|
||||
VoiceDis:[30,12],//语音气泡与内容的间隔0位置左右间隔(最好不要低于30)1位置上下间隔
|
||||
isLeft:[1,0,0,1,1],//气泡是否为以左边为基准线
|
||||
VoiceLoc:[[35,517],[1100,315],[1100,105],[175,105],[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:276,//帮助图片初始x坐标
|
||||
y:160,//帮助图片初始y坐标
|
||||
w:729,//帮助图片显示高度
|
||||
h:482//帮助图片显示宽度
|
||||
};
|
||||
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:"00050.mp3",//大厅界面背景音
|
||||
MainSceneMusic:"00101.mp3"//游戏主界面背景音
|
||||
};
|
||||
Game_Config.ClickButton = {//需要设置点击音效的按钮(只有有弹窗的按钮设置此音效有效、按钮已经设置好、子游戏不允许修改)
|
||||
src_1:"",//点击时播放的声音资源文件( 不需要播放则不填,下同)
|
||||
src_2:"00051.mp3"//弹窗时播放的音效
|
||||
};
|
||||
Game_Config.loginButton = {//登录按钮信息
|
||||
x1:440,//非审核版本微信登录按钮x //415
|
||||
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,629 @@
|
||||
//注:ConsttVal中的ChatLoc与isLeft的数组长度一定要与ConstVal.Max.PlayerCnt保持一致否则会导致报错或者聊天气泡位置不对
|
||||
|
||||
Game_Modify.StartWar=function(_msg){//开战
|
||||
if(_msg.data && NN_RevData.firstStartWar){
|
||||
NN_RevData.firstStartWar(_msg.data);
|
||||
}
|
||||
};
|
||||
|
||||
Game_Modify._ReceiveData=function(_msg){//接收数据包
|
||||
if(NN_Net.DoPack){
|
||||
NN_Net.DoPack(_msg);
|
||||
}
|
||||
};
|
||||
|
||||
//无限局创建新桌时返回游戏数据
|
||||
Game_Modify.onCreateRoom = function(data){
|
||||
NN_RevData.firstStartWar(data);
|
||||
};
|
||||
|
||||
Game_Modify.createRoom=function(_roomtype, _infinite){//创建房间
|
||||
if(_infinite != null){
|
||||
NN_config.isInfinite = _infinite;
|
||||
}else {
|
||||
NN_config.isInfinite = 0;
|
||||
}
|
||||
};
|
||||
|
||||
Game_Modify.myJoinRoom=function(_msg){//自己进入房间
|
||||
|
||||
};
|
||||
|
||||
Game_Modify.Reconnect=function(_deskinfo){//重连
|
||||
NN_Desk = new NN_deskInfo();
|
||||
NN_Desk.initData_net(_deskinfo);
|
||||
if(NN_Desk.model_fast >= 1 || NN_Desk.model == 4 || NN_Desk.model == 5){
|
||||
if(NN_Desk.personMax == 10){
|
||||
NN_UIP.update.game();
|
||||
}else {
|
||||
NN_UIF.update.game();
|
||||
}
|
||||
}else{
|
||||
NN_UI.game(true, true);
|
||||
}
|
||||
//判断准备、换房、退出按钮显示
|
||||
//if(Utl.getPlayerReadyState(NN_Desk.myseat)){
|
||||
//Utl.closeMainSceneButton();
|
||||
//this.pList[seat].isJoin = 1;
|
||||
//}
|
||||
//测试定时刷新游戏界面
|
||||
//setInterval(function(){
|
||||
//Game_Modify.updateScene();
|
||||
//},2000);
|
||||
};
|
||||
|
||||
Game_Modify.stopAllSounds=function(){//关闭所有声音 (游戏声音)
|
||||
if(NN_playSound){
|
||||
NN_playSound();
|
||||
}
|
||||
};
|
||||
|
||||
Game_Modify.Free=function(_msg){//投票解散结果为同意时,点击结果界面确认的按钮时触发
|
||||
if(NN_RevData.disbandGame){
|
||||
NN_RevData.disbandGame(_msg);
|
||||
}
|
||||
};
|
||||
|
||||
Game_Modify.DeskInfo=function(_msg){//开战状态下自己加入是牌桌数据
|
||||
NN_Desk = new NN_deskInfo();
|
||||
NN_Desk.initData_net(_msg);
|
||||
if(NN_Desk.model_fast >= 1 || NN_Desk.model == 4 || NN_Desk.model == 5){
|
||||
if(NN_Desk.personMax == 10){
|
||||
NN_UIP.update.game();
|
||||
}else {
|
||||
NN_UIF.update.game();
|
||||
}
|
||||
}else{
|
||||
NN_UI.game(true, true);
|
||||
}
|
||||
};
|
||||
|
||||
Game_Modify.breakRoom=function(){//游戏已开局情况下自己退出房间触发
|
||||
//if(NN_UI.exit_clearDesk){
|
||||
//NN_UI.exit_clearDesk();
|
||||
//}
|
||||
//先清除牛牛游戏界面
|
||||
//NN_Exit_clearUI();
|
||||
//清除牛牛游戏桌数据
|
||||
//NN_Exit_clearData();
|
||||
};
|
||||
|
||||
Game_Modify.playerJoinRoom=function(seat){//其他玩家加入房间
|
||||
if(NN_Desk.isAddPlayer){
|
||||
NN_Desk.isAddPlayer(seat);
|
||||
}
|
||||
//无限局显示玩家星星数
|
||||
if(Utl.getIsInfinite() == 1){
|
||||
NN_UIF.update.setGrade(seat, Utl.getBeanBySeat(seat), 1);
|
||||
}
|
||||
};
|
||||
|
||||
Game_Modify.playerLeaveRoom=function(seat){//其他玩家离开房间
|
||||
if(NN_UI.isAddPlayer){
|
||||
NN_UI.playerState_leave(seat,false);
|
||||
NN_Desk.delPlayer(seat);
|
||||
}
|
||||
};
|
||||
|
||||
Game_Modify.updateScene = function(){//更新游戏界面
|
||||
//根据本地数据重新显示界面
|
||||
setTimeout(function(){
|
||||
if(typeof(NN_Desk.state) != "undefined" && NN_Desk.pList){//
|
||||
var temp_NN_Desk = JSON.stringify(NN_Desk);
|
||||
if(NN_Desk.stageTime_loc > 0){
|
||||
NN_Desk.stageTime = (new Date()).getTime() - NN_Desk.stageTime_loc;
|
||||
}
|
||||
NN_RevDataRecord.over = -1;
|
||||
try{
|
||||
if(NN_Desk.model_fast >= 1 || NN_Desk.model == 4 || NN_Desk.model == 5){
|
||||
if(NN_Desk.personMax == 10){
|
||||
NN_UIP.update.game();
|
||||
}else {
|
||||
NN_UIF.update.game();
|
||||
}
|
||||
}else{
|
||||
NN_UI.game(true);
|
||||
}
|
||||
//普通房间准备按钮刷新显示
|
||||
if(Utl.getIsInfinite() != 1){
|
||||
GameUI.showReady();
|
||||
}
|
||||
}catch(e){
|
||||
//alert("重画错误:"+e.message+" \n桌数据:"+JSON.stringify(NN_Desk));
|
||||
NN_Net.submit_error("切回重画界面",e.stack+"出错时:"+JSON.stringify(NN_Desk)+" 未错时:"+temp_NN_Desk);
|
||||
}
|
||||
}
|
||||
},200);
|
||||
};
|
||||
|
||||
Game_Modify.closeGameScene=function(){//关闭游戏界面
|
||||
//if(NN_UI.exit_clearDesk){
|
||||
//NN_UI.exit_clearDesk();
|
||||
//}
|
||||
//先清除牛牛游戏界面
|
||||
NN_Exit_clearUI();
|
||||
//清除牛牛游戏桌数据
|
||||
NN_Exit_clearData();
|
||||
};
|
||||
|
||||
Game_Modify.playerOffline = function(seat){//玩家离线
|
||||
if(NN_UI.playerState_leave){
|
||||
NN_UI.playerState_leave(seat,false);
|
||||
}
|
||||
};
|
||||
|
||||
Game_Modify.playerOnline = function(seat){//玩家上线
|
||||
if(NN_UI.playerState_leave){
|
||||
NN_UI.playerState_leave(seat,true);
|
||||
}
|
||||
};
|
||||
|
||||
Game_Modify.playerphonestate = function(seat,type){//玩家电话状态type->挂断1->接打电话、有电话进来的状态
|
||||
if(NN_UI.playerState_leave){
|
||||
NN_UI.playerState_leave(seat,false);
|
||||
}
|
||||
};
|
||||
|
||||
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){
|
||||
//console.log("计算结果:"+inputArr);
|
||||
if(NN_Desk && NN_Desk.personMax == 10){
|
||||
NN_UIP.gameOver.multResult(true, inputArr);
|
||||
}else {
|
||||
NN_UI.gameOver_multResult(inputArr);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Game_Modify.onEnterMainScene = function(roomtype){//进入游戏主场景
|
||||
//玩家头像位置调整
|
||||
if(roomtype[5] && roomtype[5][5] == 1){ //10人局
|
||||
//框架相关显示
|
||||
if(roomtype[5][1] == 1){
|
||||
NN_Sprite.mainScence.init(10, 1);
|
||||
}else{
|
||||
NN_Sprite.mainScence.init(10);
|
||||
}
|
||||
}else{ //5人
|
||||
//框架相关显示
|
||||
NN_Sprite.mainScence.init(5);
|
||||
}
|
||||
|
||||
//NN_UIP.deskInfo.update();
|
||||
//游戏开始相关按钮调整
|
||||
//Game_Modify.gameFunc.updateMainSceneBtn();
|
||||
//无限局显示玩家星星数
|
||||
if(Utl.getIsInfinite() == 1){
|
||||
for(var i=0; i<5; i++){
|
||||
NN_UIF.update.setGrade(i, Utl.getBeanBySeat(i));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Game_Modify.onExitMainScene = function(){//退出游戏主场景
|
||||
//隐藏模式图标(比赛、星星)
|
||||
set_self(976,37,0,0,0);
|
||||
//先清除牛牛游戏界面
|
||||
NN_Exit_clearUI();
|
||||
//清除牛牛游戏桌数据
|
||||
NN_Exit_clearData();
|
||||
};
|
||||
|
||||
Game_Modify.onGameConfig = function(_gameConfig){//获取到游戏配置时调用(只在game_config有数据时才调用)
|
||||
//alert("配置文件:"+JSON.stringify(_gameConfig));
|
||||
NN_config.data = _gameConfig;
|
||||
//局数及房卡消耗 格式:[[[6,4],[12,8]],[[6,1],[12,2]]];
|
||||
if(_gameConfig.room_card && _gameConfig.room_card.length > 0){
|
||||
NN_config.room_card = _gameConfig.room_card;
|
||||
Game_Modify.gameFunc.roomCardUpdate();
|
||||
}
|
||||
/*
|
||||
if(_gameConfig.room_card && _gameConfig.room_card.length > 0){
|
||||
NN_config.room_card = _gameConfig.room_card;
|
||||
for(var i=0;i<_gameConfig.room_card[0].length;i++){
|
||||
if(_gameConfig.room_card[i].length == 2){
|
||||
//局数
|
||||
Game_Modify.Type_2[0].roomcount[i] = _gameConfig.room_card[i][0][0];
|
||||
Game_Modify.Type_2[1].roomcount[i] = _gameConfig.room_card[i][1][0];
|
||||
//房卡消耗数量
|
||||
Game_Modify.Type_2[0].roomcard[i] = _gameConfig.room_card[i][0][1];
|
||||
Game_Modify.Type_2[1].roomcard[i] = _gameConfig.room_card[i][1][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
// _gameConfig.card_mult = [[9,2],[1,1,1,1,1,1,1,1,1,2,3,4,4,6]];
|
||||
//牛八2倍类型牌型倍数
|
||||
if(_gameConfig.card_mult){
|
||||
NN_config.card_mult = _gameConfig.card_mult;
|
||||
//显示
|
||||
var cap = ["一","二","三","四","五","六","七","八","九","双十"];
|
||||
if(NN_config.card_mult[0][0] < 11){
|
||||
Game_Modify.Type_3[0].des = "十带" + cap[NN_config.card_mult[0][0] - 1] + NN_config.card_mult[0][1] + "倍";
|
||||
} else {
|
||||
Game_Modify.Type_3[0].des = cap[NN_config.card_mult[0][0] - 1] + NN_config.card_mult[0][1] + "倍";
|
||||
}
|
||||
}
|
||||
//是否强制下注配置
|
||||
//if(_gameConfig.force_bet && _gameConfig.force_bet.length >= 3){
|
||||
//NN_config.force_bet = _gameConfig.force_bet;
|
||||
//}
|
||||
//NN_config.force_bet = [1,-1,2];
|
||||
//if(_gameConfig.model_bean){
|
||||
//NN_config.model_bean = gameConfig.model_bean;
|
||||
//}
|
||||
//
|
||||
//_gameConfig.cfg_bean[2] = [1,[111,222],1,[333,444]];
|
||||
//服务费
|
||||
if(_gameConfig.cfg_bean){
|
||||
if(_gameConfig.cfg_bean[0] != null){
|
||||
NN_config.cfg_bean[0] = _gameConfig.cfg_bean[0];
|
||||
}
|
||||
if(_gameConfig.cfg_bean[1] != null){
|
||||
NN_config.cfg_bean[1] = _gameConfig.cfg_bean[1];
|
||||
}
|
||||
if(_gameConfig.cfg_bean[2] != null && _gameConfig.cfg_bean[2].length == 4){
|
||||
NN_config.teaCost = NN_config.teaCost.slice(0,2).concat(_gameConfig.cfg_bean[2]);
|
||||
if(NN_config.teaCost[2] == 2 && NN_config.teaCost[3] >= 0){ //固定值时赋值
|
||||
NN_config.teaCost[1] = NN_config.teaCost[3];
|
||||
}
|
||||
}
|
||||
//离场相关
|
||||
if(_gameConfig.cfg_bean[3] != null){
|
||||
NN_config.bean_leaveMin[1] = _gameConfig.cfg_bean[3][0];
|
||||
NN_config.bean_leaveMin[2] = _gameConfig.cfg_bean[3][1];
|
||||
}
|
||||
}
|
||||
//游戏相关设置
|
||||
if(_gameConfig.cfg_game){
|
||||
//无限局
|
||||
if(_gameConfig.cfg_game[0] != null){
|
||||
NN_config.isOwnerInfinite = _gameConfig.cfg_bean[0];
|
||||
}
|
||||
}
|
||||
if(_gameConfig.ui){
|
||||
if(_gameConfig.ui[0] != null){
|
||||
NN_config.ui.sysRoomDes = _gameConfig.ui[0];
|
||||
}
|
||||
if(_gameConfig.ui[1] != null){
|
||||
NN_config.creatRoomMode[0] = _gameConfig.ui[1];
|
||||
}
|
||||
}
|
||||
//桌相关设置
|
||||
if(_gameConfig.desk){
|
||||
if(_gameConfig.desk[0] != null){ //强制下注,最低下注
|
||||
NN_config.forceBetType = _gameConfig.desk[0];
|
||||
}
|
||||
}
|
||||
//进入游戏后游戏初始化些数据
|
||||
Game_Modify.gameFunc.initData();
|
||||
|
||||
//测试数据模拟
|
||||
//NN_config.isOwnerInfinite = 1; //无限局
|
||||
};
|
||||
|
||||
Game_Modify.onEnterVideo = function(){//进入牌局回放触发
|
||||
|
||||
};
|
||||
|
||||
Game_Modify.onSurrender = function(_msg){//收到投降回包
|
||||
NN_RevData.surrender(_msg.data);
|
||||
};
|
||||
|
||||
Game_Modify.onReady = function(seat){//玩家准备触发
|
||||
if(NN_Desk && NN_Desk.model_fast != null && NN_Desk.model != null){
|
||||
if(NN_Desk.personMax == 10){
|
||||
NN_UIP.net.ready(seat);
|
||||
}else {
|
||||
NN_UIF.net.ready(seat);
|
||||
}
|
||||
//if(NN_Desk.model_fast < 1 && NN_Desk.model != 4 && NN_Desk.model != 5){
|
||||
//NN_UI.playerReady(seat);
|
||||
//}else { //快版
|
||||
//NN_UIF.net.ready(seat);
|
||||
//}
|
||||
}
|
||||
};
|
||||
|
||||
Game_Modify.getRoomInfo = function(roomtype, isInfinite ,tea, isAll){//通过roomtype获取房间描述每行最多18个字符超过需要自己换行
|
||||
if(!roomtype || (roomtype && roomtype.length == 0)){ return; }
|
||||
var _roomDes = "";
|
||||
var personType = 0;
|
||||
if(roomtype[5][5] == 1){
|
||||
personType = 1;
|
||||
}
|
||||
//局数
|
||||
if(isInfinite == 1){
|
||||
//_roomDes += " 无限局";
|
||||
_roomDes += " ";
|
||||
} else if(NN_config.room_card[personType] && NN_config.room_card[personType].length == 2){
|
||||
if(NN_config.room_card[personType][roomtype[4] - 1].length > 0 && NN_config.room_card[personType][roomtype[4] - 1][roomtype[0] - 1][0] > 0){ //房主扣卡
|
||||
if(NN_config.room_card[personType][roomtype[4] - 1][roomtype[0] - 1][0] >= 10){
|
||||
_roomDes += " " + NN_config.room_card[personType][roomtype[4] - 1][roomtype[0] - 1][0] + "局";
|
||||
}else {
|
||||
_roomDes += " " + NN_config.room_card[personType][roomtype[4] - 1][roomtype[0] - 1][0] + "局";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//扣卡张数
|
||||
if(Utl.getVersionState() != 1){
|
||||
if(isInfinite != 1 && roomtype[4] > 0){
|
||||
if(NN_config.creatRoomMode[0] != 1 || (NN_config.creatRoomMode[0] == 1 && roomtype[5][1] != 1)){ //真人竞技房不显示扣卡
|
||||
_roomDes += " " + (Game_Modify.Type_1[roomtype[4]-1].des + Game_Modify.Type_2[roomtype[0]-1].roomcard[roomtype[4]-1]);
|
||||
if(NN_config.roomCardDes.slice(1,2) == "卡"){
|
||||
_roomDes += "张";
|
||||
}
|
||||
}
|
||||
|
||||
if(_roomDes != ""){
|
||||
_roomDes += "\n";
|
||||
}
|
||||
}else {
|
||||
if(_roomDes != ""){
|
||||
_roomDes += "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
//上庄
|
||||
_roomDes += " " + Game_Modify.Type_4[roomtype[1]-1].des;
|
||||
//几副牌
|
||||
var _pairs = 0;
|
||||
if(roomtype[2] == 1){
|
||||
_pairs = 1;
|
||||
}else if(roomtype[2] == 2){
|
||||
_pairs = 2;
|
||||
}
|
||||
if(isAll){
|
||||
_roomDes += " " + _pairs + "副牌 ";
|
||||
}
|
||||
|
||||
//倍数
|
||||
_roomDes += " " + Game_Modify.Type_3[roomtype[3]-1].des;
|
||||
//快版
|
||||
if(isInfinite != 1 && roomtype[5][0] != null && roomtype[5][0] == 1){
|
||||
_roomDes += "\n 快版";
|
||||
//if(roomtype[3] == 3){
|
||||
//_roomDes += " 快版";
|
||||
//}else {
|
||||
//_roomDes += " 快版";
|
||||
//}
|
||||
}
|
||||
//强制下注
|
||||
if(isAll){
|
||||
if(isInfinite != 1 && roomtype[6] && roomtype[6][0] != null && roomtype[6][0] == 1 && roomtype[6][2] > 0){
|
||||
_roomDes += " 强制下注:" + roomtype[6][2];
|
||||
//10人局
|
||||
if(roomtype[5][5] == 1){
|
||||
_roomDes += " " + Game_Modify.Type_6[4].des;
|
||||
}
|
||||
}else {
|
||||
//10人局
|
||||
if(roomtype[5][5] == 1){
|
||||
_roomDes += " \n " + Game_Modify.Type_6[4].des;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//服务费
|
||||
//if(isInfinite != 1 && !isAll && roomtype[5][3] != null && roomtype[5][3][0] == 1 && roomtype[5][3][1] > 0){
|
||||
//if(tea != null){
|
||||
//_roomDes += " \n 房间费:" + tea;
|
||||
//}else {
|
||||
//_roomDes += " \n 房间费:" + roomtype[5][3][1];
|
||||
//}
|
||||
//}
|
||||
|
||||
//星星数
|
||||
if(isAll && roomtype[5][2] != null){
|
||||
if(roomtype[5][1] == 1){
|
||||
_roomDes += " \n " + NN_config.beanDes + "场(" + roomtype[5][2][2] + "倍)";
|
||||
_roomDes += " " + NN_config.beanDes + "数限:" + roomtype[5][2][1] + "\n";
|
||||
}else if(roomtype[5][2][0] == 1){
|
||||
_roomDes += " \n "+ NN_config.beanDes +"数限:"+ roomtype[5][2][1]+"\n";
|
||||
}
|
||||
}
|
||||
if(!isAll){
|
||||
_roomDes = _roomDes.replace(/[\r\n]/g, ""); //去除换行
|
||||
_roomDes = _roomDes.replace(/\s+/g, ' '); //多个空格替换一个空格
|
||||
if(_roomDes.substring(0,1) == " "){
|
||||
_roomDes = _roomDes.slice(1); //去除换行
|
||||
}
|
||||
}
|
||||
return _roomDes;
|
||||
};
|
||||
|
||||
Game_Modify.getStarLimit = function(roomtype){//通过roomtype获取房间星星场下限数量
|
||||
//星星数限制
|
||||
if(roomtype && roomtype[5][2] != null && roomtype[5][2][0] == 1){
|
||||
return roomtype[5][2][1];
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
Game_Modify.getMult = function(roomtype, isInfinite){//通过roomtype获取房间星星场倍数
|
||||
//星星场倍数
|
||||
if(roomtype && roomtype[5][2] != null && roomtype[5][2][0] == 1){
|
||||
if(roomtype[5][2][2] > 0){
|
||||
return roomtype[5][2][2];
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
};
|
||||
|
||||
Game_Modify.getFullRoomInfo = function(roomtype){//通过roomtype获取房间全部信息描述 返回的字符串最多两行,一行最多38字符
|
||||
return Game_Modify.getRoomInfo(roomtype, 2 , null, 1);
|
||||
};
|
||||
|
||||
Game_Modify.onOpenHelp = function(spid){//打开帮助页面触发spid为帮助内容图片精灵
|
||||
|
||||
};
|
||||
|
||||
Game_Modify.onMainMenuScene = function(){//显示大厅界面触发
|
||||
//NN_config.beanDes = Utl.getstarName(); //星星文字显示
|
||||
//NN_config.roomCardDes = Utl.getRoomCardName(); //房卡显示
|
||||
//Game_Modify.Type_6[1].des = NN_config.beanDes +"场";
|
||||
//Game_Modify.Type_6[2].des = NN_config.beanDes +"数";
|
||||
};
|
||||
|
||||
Game_Modify.onCheckInput = function(_result){ //数字输入
|
||||
|
||||
};
|
||||
|
||||
|
||||
//获取离场限制
|
||||
Game_Modify.getLeaveLimit = function(roomtype){
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
//成功获取定位信息触发
|
||||
Game_Config.onLocationInfo = function(_locationInfo){
|
||||
|
||||
};
|
||||
|
||||
//成功获取定位信息触发
|
||||
Game_Modify.onLocationInfo = function(_locationInfo){
|
||||
|
||||
};
|
||||
|
||||
//进入游戏界面创建牌桌之前调用
|
||||
Game_Modify.onCreateDesk = function(roomtype){
|
||||
NN_Sprite.init_OnCreateDesk(roomtype);
|
||||
//console.log("onCreateDesk:"+roomtype);
|
||||
};
|
||||
|
||||
Game_Modify.getVideoByRoomType = function(roomtype){
|
||||
return 0;
|
||||
};
|
||||
|
||||
//返回值为字符数组数组每项为房间一项描述信息
|
||||
Game_Modify.getRoomTopDescAry = function(roomtype){
|
||||
var _roomDes = [];
|
||||
|
||||
//局数
|
||||
var personType = 0;
|
||||
if(roomtype[5][5] == 1){
|
||||
personType = 1;
|
||||
}
|
||||
if(Utl.getIsInfinite() != 1 && NN_config.room_card[personType] && NN_config.room_card[personType].length >= 2){
|
||||
if(NN_config.room_card[personType][roomtype[4] - 1].length > 0 && NN_config.room_card[personType][roomtype[4] - 1][roomtype[0] - 1][0] > 0){ //房主扣卡
|
||||
_roomDes.push(NN_config.room_card[personType][roomtype[4] - 1][roomtype[0] - 1][0] + "局");
|
||||
}
|
||||
}
|
||||
|
||||
//扣卡张数
|
||||
if(Utl.getVersionState() != 1 && roomtype[4] > 0){
|
||||
if(NN_config.creatRoomMode[0] != 1 || (NN_config.creatRoomMode[0] == 1 && roomtype[5][1] != 1)){ //真人竞技房不显示扣卡
|
||||
_roomDes.push(Game_Modify.Type_1[roomtype[4]-1].des + Game_Modify.Type_2[roomtype[0]-1].roomcard[roomtype[4]-1]);
|
||||
if(NN_config.roomCardDes.slice(1,2) == "卡"){
|
||||
_roomDes[_roomDes.length -1] += "张";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//上庄
|
||||
_roomDes.push(Game_Modify.Type_4[roomtype[1]-1].des);
|
||||
|
||||
//几副牌
|
||||
_roomDes.push(roomtype[2] + "副牌");
|
||||
|
||||
//倍数
|
||||
_roomDes.push(Game_Modify.Type_3[roomtype[3]-1].des);
|
||||
|
||||
//强制下注
|
||||
if(Utl.getIsInfinite() != 1 && roomtype[6] && roomtype[6][0] != null && roomtype[6][0] == 1 && roomtype[6][2] > 0){
|
||||
_roomDes.push("强制下注:" + roomtype[6][2]);
|
||||
//10人局
|
||||
if(roomtype[5][5] == 1){
|
||||
_roomDes.push(Game_Modify.Type_6[4].des);
|
||||
}
|
||||
}else {
|
||||
//10人局
|
||||
if(roomtype[5][5] == 1){
|
||||
_roomDes.push(Game_Modify.Type_6[4].des);
|
||||
}
|
||||
}
|
||||
|
||||
//快版
|
||||
if(Utl.getIsInfinite() != 1 && roomtype[5][0] != null && roomtype[5][0] == 1){
|
||||
_roomDes.push("快版");
|
||||
}
|
||||
//服务费
|
||||
//if(isInfinite != 1 && !isAll && roomtype[5][3] != null && roomtype[5][3][0] == 1 && roomtype[5][3][1] > 0){
|
||||
//if(tea != null){
|
||||
//_roomDes += " \n 房间费:" + tea;
|
||||
//}else {
|
||||
//_roomDes += " \n 房间费:" + roomtype[5][3][1];
|
||||
//}
|
||||
//}
|
||||
|
||||
//星星数
|
||||
//if(isAll && roomtype[5][2] != null){
|
||||
//if(roomtype[5][1] == 1){
|
||||
//_roomDes += " \n\n " + NN_config.beanDes + "场(" + roomtype[5][2][2] + "倍)";
|
||||
//_roomDes += " \n " + NN_config.beanDes + "数限:" + roomtype[5][2][1] + "\n";
|
||||
//}else if(roomtype[5][2][0] == 1){
|
||||
//_roomDes += " \n\n "+ NN_config.beanDes +"数限:"+ roomtype[5][2][1]+"\n";
|
||||
//}
|
||||
//}
|
||||
//if(!isAll){
|
||||
//_roomDes = _roomDes.replace(/[\r\n]/g, ""); //去除换行
|
||||
//_roomDes = _roomDes.replace(/\s+/g, ' '); //多个空格替换一个空格
|
||||
//if(_roomDes.substring(0,1) == " "){
|
||||
//_roomDes = _roomDes.slice(1); //去除换行
|
||||
//}
|
||||
//}
|
||||
return _roomDes;
|
||||
};
|
||||
|
||||
//星星场房间列表
|
||||
Game_Modify.getShareRoom = function(_msg){
|
||||
|
||||
}
|
||||
//玩家自己退出房间
|
||||
Game_Modify.myExitRoom = function(seat){
|
||||
|
||||
}
|
||||
|
||||
//接收到换座包触发
|
||||
Game_Modify.changeSeat = function(seat1,seat2){
|
||||
|
||||
}
|
||||
|
||||
//判断房间是否为金币场(是金币场返回1否则返回0)
|
||||
Game_Modify.getRoomMode = function(roomtype){
|
||||
if(roomtype[5] != null ){
|
||||
if(roomtype[5][1] != null){
|
||||
if(roomtype[5][1] == 1){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
5543
codes/games/client/Projects/niuniu/js/gameabc.min.js
vendored
Normal file
5543
codes/games/client/Projects/niuniu/js/gameabc.min.js
vendored
Normal file
File diff suppressed because it is too large
Load Diff
5703
codes/games/client/Projects/niuniu/js/gameabc.min2.js
Normal file
5703
codes/games/client/Projects/niuniu/js/gameabc.min2.js
Normal file
File diff suppressed because it is too large
Load Diff
474
codes/games/client/Projects/niuniu/js/gamemain.js
Normal file
474
codes/games/client/Projects/niuniu/js/gamemain.js
Normal file
@@ -0,0 +1,474 @@
|
||||
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)
|
||||
{
|
||||
//游戏初始化代码
|
||||
Logic.AppStart();
|
||||
NN_game_start();
|
||||
};
|
||||
|
||||
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)
|
||||
{
|
||||
game_close_zsmsg("");
|
||||
|
||||
} 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);
|
||||
};
|
||||
|
||||
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);
|
||||
//游戏
|
||||
NN_MouseDown(gameid, spid, downx, downy);
|
||||
};
|
||||
|
||||
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);
|
||||
//游戏
|
||||
NN_MouseUp(gameid, spid_down, downx, downy, spid_up, upx, upy, timelong, no1, no2);
|
||||
};
|
||||
|
||||
gameabc_face.mousemove=function(gameid, spid, downx, downy, movex,movey ,timelong,offmovex, offmovey, no1)
|
||||
{
|
||||
//点击后移动代码
|
||||
//set_self(spid,18,offmovex,1,0);
|
||||
//set_self(spid,19,offmovey,1,0);
|
||||
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);
|
||||
//游戏
|
||||
NN_MouseMove(gameid,spid,downx,downy,movex,movey ,timelong,offmovex,offmovey);
|
||||
};
|
||||
|
||||
gameabc_face.gamemydraw=function(gameid, spid, times, timelong, no2, no3, no4, no5, no6, no7)
|
||||
{
|
||||
//每个精灵更新绘画代码
|
||||
//游戏
|
||||
NN_Draw.MyDraw(gameid, spid, times, timelong);
|
||||
//大厅
|
||||
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);
|
||||
//游戏
|
||||
NN_Draw.Settlement_clip(gameid, spid, times, timelong);
|
||||
};
|
||||
|
||||
gameabc_face.ontimer= function(gameid, spid, /* 本次间隔多少次了 */ times, /* 本次间隔多久 */ timelong,/* 开启后运行多少次了 */ alltimes){
|
||||
/*请在下面输入您的代码
|
||||
*/
|
||||
//set_self(1,18,5,1,0);
|
||||
GameUI.utlontimer(gameid, spid, /* 本次间隔多少次了 */ times, /* 本次间隔多久 */ timelong,/* 开启后运行多少次了 */ alltimes);
|
||||
//游戏
|
||||
NN_ontimer.Event(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);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
4
codes/games/client/Projects/niuniu/js/jquery-2.1.1.min.js
vendored
Normal file
4
codes/games/client/Projects/niuniu/js/jquery-2.1.1.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
codes/games/client/Projects/niuniu/js/jweixin-1.2.0.js
Normal file
1
codes/games/client/Projects/niuniu/js/jweixin-1.2.0.js
Normal file
File diff suppressed because one or more lines are too long
757
codes/games/client/Projects/niuniu/js/niuniu/nn_click.js
Normal file
757
codes/games/client/Projects/niuniu/js/niuniu/nn_click.js
Normal file
@@ -0,0 +1,757 @@
|
||||
/*
|
||||
点击事件
|
||||
*/
|
||||
function NN_MouseUp(gameid,spid_down,downx,downy,spid_up,upx,upy,timelong){
|
||||
//鼠标弹起
|
||||
switch (NN_GameState){
|
||||
case NN_State.inHall:
|
||||
NN_MouseUp_hall(gameid,spid_down,downx,downy,spid_up,upx,upy,timelong);
|
||||
break;
|
||||
case NN_State.inGame:
|
||||
NN_MouseUp_game(gameid,spid_down,downx,downy,spid_up,upx,upy,timelong);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
NN_MouseUp_other(gameid,spid_down,downx,downy,spid_up,upx,upy,timelong);
|
||||
};
|
||||
|
||||
function NN_MouseDown(gameid,spid,downx,downy,timelong){
|
||||
//鼠标按下
|
||||
if(NN_GameState == NN_State.inHall){//大厅按下事件
|
||||
switch (spid){
|
||||
case 0://
|
||||
//play_ani(1,spid,33,100,110,0,60,0,0,0,1,0,0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}else if(NN_GameState == NN_State.inGame){
|
||||
if(NN_Desk.state == NN_state.robZhuang){
|
||||
if(spid == 706 || spid == 707 || spid == NN_Sprite.btn.noRob || spid == NN_Sprite.btn.rob){
|
||||
NN_clickEffect(spid);
|
||||
}
|
||||
}else if(NN_Desk.state == NN_state.bet){
|
||||
if(spid >= 809 && spid <= 818){
|
||||
NN_clickEffect(spid);
|
||||
}else if((spid >= 946 && spid <= 948) || spid == 955 || spid == 956){
|
||||
NN_clickEffect(spid);
|
||||
}else if(spid >= 1122 && spid <= 1125){
|
||||
NN_clickEffect(spid);
|
||||
}
|
||||
}else if(NN_Desk.state == NN_state.rubCard){
|
||||
if(spid == 750 || spid == 751){
|
||||
NN_UI.rubPutUI_anim(false);
|
||||
NN_UIP.anim.fingerSlide(false);
|
||||
}
|
||||
}else if(NN_Desk.state == NN_state.putCard){
|
||||
if(spid == 807 || spid == 808 || spid == NN_Sprite.btn.sureCattle || spid == NN_Sprite.btn.noCattle){
|
||||
NN_clickEffect(spid);
|
||||
}
|
||||
if(spid >= 725 && spid <= 729 && NN_Desk.pList[NN_Desk.myseat].putcard != 1){
|
||||
NN_moveSelectCard(spid);
|
||||
}
|
||||
}else {
|
||||
if(spid == 851 || spid == 1802 || spid == 925 || spid == 957 || spid == 981 || (spid >= 1000 && spid <= 1004) || spid == 1802 || (spid >= 1933 && spid <= 1942)){
|
||||
NN_clickEffect(spid);
|
||||
}
|
||||
}
|
||||
if(spid == 961 || spid == 962){
|
||||
NN_clickEffect(spid);
|
||||
}
|
||||
}
|
||||
//取消震动
|
||||
if(NN_Desk.state == NN_state.bet && NN_Judge.isVibrator == 1){
|
||||
NN_Judge.isVibrator = -1;
|
||||
Func.canclevibrator();
|
||||
}
|
||||
};
|
||||
function NN_MouseMove(gameid,spid,downx,downy,movex,movey ,timelong,offmovex,offmovey){
|
||||
//鼠标移动
|
||||
if(NN_Desk.state == NN_state.rubCard){
|
||||
if(offmovex != 0 || offmovey != 0){
|
||||
if(spid == 750 || spid == 751){
|
||||
var offx = Math.round((movex - downx)*0.3), offy = Math.round((movey - downy)*0.3);
|
||||
set_self(spid,18,get_self(spid-22,18)+offx,0,0);
|
||||
set_self(spid,19,get_self(spid-22,19)+offy,0,0);
|
||||
//if(offx > 36 || offx < -114 || offy < -162 || offy > 64){
|
||||
//NN_Judge.isRub = 1;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}else if(NN_Desk.state == NN_state.putCard && NN_Desk.pList[NN_Desk.myseat].putcard != 1){
|
||||
//摆牌时移动选牌
|
||||
if(offmovex != 0 || offmovey != 0 ){
|
||||
if(spid >= 725 && spid <= 729){
|
||||
if(movex >= 332 && movex <= 462){
|
||||
if(movey >= get_self(725,19) && movey <= get_self(725,19)+176){
|
||||
NN_moveSelectCard(725);
|
||||
}
|
||||
}else if(movex >= 463 && movex <= 593){
|
||||
if(movey >= get_self(726,19) && movey <= get_self(726,19)+176){
|
||||
NN_moveSelectCard(726);
|
||||
}
|
||||
}else if(movex >= 594 && movex <= 724){
|
||||
if(movey >= get_self(727,19) && movey <= get_self(727,19)+176){
|
||||
NN_moveSelectCard(727);
|
||||
};
|
||||
}else if(movex >= 725 && movex <= 855){
|
||||
if(movey >= get_self(728,19) && movey <= get_self(728,19)+176){
|
||||
NN_moveSelectCard(728);
|
||||
}
|
||||
}else if(movex >= 856 && movex <= 986){
|
||||
if(movey >= get_self(729,19) && movey <= get_self(729,19)+176){
|
||||
NN_moveSelectCard(729);
|
||||
}
|
||||
}else {
|
||||
NN_Judge.boveCardaSpid = -1;
|
||||
}
|
||||
}else {
|
||||
NN_Judge.boveCardaSpid = -1;
|
||||
}
|
||||
}
|
||||
}else if(NN_Desk.state == NN_state.over){
|
||||
// 结算界面移动战绩
|
||||
if(offmovey != 0 && spid == 884){
|
||||
set_self(spid,19,offmovey,1,0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//移动选牌
|
||||
function NN_moveSelectCard(_spid){
|
||||
if(NN_Judge.boveCardaSpid != _spid){
|
||||
//console.log("判断中。。。");
|
||||
//先判断选择两张以上牌后返回选时,相对最前的牌隐藏,当前位置的牌不变
|
||||
if(NN_Judge.putLoc.length >= 2 && NN_Judge.putLoc[NN_Judge.putLoc.length - 2] == _spid-725 && NN_Judge.putLoc[NN_Judge.putLoc.length -1] == NN_Judge.boveCardaSpid-725 && Math.abs(NN_Judge.boveCardaSpid - _spid) == 1){
|
||||
NN_Judge.putLoc.splice(NN_Judge.putLoc.length - 1,1);
|
||||
NN_UI.cardSelect(NN_Judge.boveCardaSpid - 725,0);
|
||||
NN_Judge.boveCardaSpid = _spid;
|
||||
}else {
|
||||
NN_Judge.boveCardaSpid = _spid;
|
||||
var a = -1;
|
||||
for(var i=0;i<NN_Judge.putLoc.length;i++){
|
||||
if(NN_Judge.putLoc[i] == _spid - 725){
|
||||
NN_Judge.putLoc.splice(i,1);
|
||||
a = 1;
|
||||
if(NN_Judge.putLoc.length == 0){
|
||||
if(NN_Desk.personMax == 10){
|
||||
//搓摆牌提示
|
||||
NN_UIP.show.onRobPutTips(0,0,0,1);
|
||||
}else {
|
||||
set_self(905,37,1,0,0);
|
||||
set_self(769,37,1,0,0);
|
||||
}
|
||||
}
|
||||
NN_UI.cardSelect(_spid - 725,0);
|
||||
//console.log("第 "+(_spid - 725)+" 张牌下去 "+NN_Judge.putLoc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(a == -1 && NN_Judge.putLoc.length < 3){
|
||||
NN_Judge.putLoc[NN_Judge.putLoc.length] = _spid - 725;
|
||||
//console.log("第 "+(_spid - 725)+" 张牌弹起 "+NN_Judge.putLoc);
|
||||
NN_UI.cardSelect(_spid - 725,1);
|
||||
//选牌提示
|
||||
if(NN_Judge.putLoc.length > 0){
|
||||
if(NN_Desk.personMax == 10){
|
||||
//搓摆牌提示
|
||||
NN_UIP.show.onRobPutTips(0,0,0,0);
|
||||
}else {
|
||||
set_self(905,37,0,0,0);
|
||||
set_self(769,37,0,0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function NN_MouseUp_hall(gameid,spid_down,downx,downy,spid_up,upx,upy,timelong) {
|
||||
//大厅点击事件
|
||||
|
||||
};
|
||||
|
||||
function NN_MouseUp_game(gameid,spid_down,downx,downy,spid_up,upx,upy,timelong) {
|
||||
//游戏桌点击弹起事件
|
||||
if(spid_down == spid_up){
|
||||
switch (spid_up){
|
||||
case NN_Sprite.btn.noRob:
|
||||
case 706://不抢
|
||||
NN_SendData.robZhuang(-1);
|
||||
NN_clickRecovery(spid_up);
|
||||
break;
|
||||
case NN_Sprite.btn.rob:
|
||||
case 707://抢庄
|
||||
NN_SendData.robZhuang(1);
|
||||
NN_clickRecovery(spid_up);
|
||||
break;
|
||||
case 1802://总结算关闭按钮
|
||||
case 851://总结算关闭按钮
|
||||
//清除桌数据并返回大厅
|
||||
NN_Exit_intoHall();
|
||||
NN_clickRecovery(spid_up);
|
||||
break;
|
||||
case 809:
|
||||
case 810:
|
||||
case 811:
|
||||
case 812:
|
||||
case 813:
|
||||
case 814:
|
||||
case 815:
|
||||
case 816:
|
||||
case 817:
|
||||
case 818://玩家押注
|
||||
if(NN_Desk.state == NN_state.bet){
|
||||
//var arr1 = [1,2,3,4,5,6,7,8,9,10];
|
||||
if(NN_Desk.model == 5 && NN_Desk.zhuang > 0 && NN_Desk.pList[NN_Desk.myseat].betScoreAgain > 0){
|
||||
//隐藏下注栏
|
||||
NN_UIF.btn.betScore();
|
||||
} else {
|
||||
NN_SendData.betScore(spid_up - 808);
|
||||
}
|
||||
}
|
||||
NN_clickRecovery(spid_up);
|
||||
break;
|
||||
case 946:
|
||||
case 947:
|
||||
case 948://玩家押注
|
||||
if(NN_Desk.state == NN_state.bet){
|
||||
NN_SendData.betScore(spid_up - 945);
|
||||
}
|
||||
NN_clickRecovery(spid_up);
|
||||
break;
|
||||
case 1122:
|
||||
case 1123:
|
||||
case 1124:
|
||||
case 1125://玩家押注
|
||||
if(NN_Desk.model_bet == 4 && NN_Desk.state == NN_state.bet){
|
||||
NN_SendData.betScore(spid_up - 1122);
|
||||
}
|
||||
NN_clickRecovery(spid_up);
|
||||
break;
|
||||
case 925://游戏结束时分享好友
|
||||
try{
|
||||
if(NN_Judge.headViewList.length > 0){
|
||||
Func.sharefinend(1,2,"","","",NN_Judge.headViewList);
|
||||
}else {
|
||||
Func.sharefinend(1,2,"","","",[859,860,861,862,863]);
|
||||
}
|
||||
}catch(e){}
|
||||
NN_clickRecovery(spid_up);
|
||||
break;
|
||||
case 957://游戏结束时分享朋友圈
|
||||
try{
|
||||
if(NN_Judge.headViewList.length > 0){
|
||||
Func.sharefinend(2,2,Game_Config.Share.appdownload,Game_Config.Share.title+Game_Config.Share.description);
|
||||
}else {
|
||||
Func.sharefinend(2,2,"","","",[859,860,861,862,863]);
|
||||
}
|
||||
}catch(e){}
|
||||
NN_clickRecovery(spid_up);
|
||||
break;
|
||||
case 954://显示托管提示框
|
||||
if(NN_Desk.pList[NN_Desk.myseat].isAuto == 1){
|
||||
//取消托管
|
||||
NN_SendData.trusteeship(-1);
|
||||
} else {
|
||||
NN_config.auto.mode = [2,2,2];
|
||||
if(NN_config.auto.recode[1] < 1){
|
||||
if(NN_Desk.betRange && NN_Desk.betRange.length > 0){
|
||||
NN_config.auto.betScore = NN_Desk.betRange[NN_Desk.betRange.length - 1];
|
||||
NN_config.auto.recode[1] = NN_Desk.betRange[NN_Desk.betRange.length - 1];
|
||||
} else {
|
||||
NN_config.auto.betScore = NN_Desk.model_bet;
|
||||
NN_config.auto.recode[1] = NN_Desk.model_bet;
|
||||
}
|
||||
}
|
||||
NN_UI.trusteeship(true);
|
||||
}
|
||||
break;
|
||||
case 955://下注按钮显示及隐藏
|
||||
if(NN_Desk.state == NN_state.bet && (NN_Desk.model == 4 || (NN_Desk.model == 5 && NN_Desk.pList[NN_Desk.myseat].cards.cards.length > 0))){
|
||||
var temp = -1;
|
||||
if((NN_Desk.model_bet == 10 || NN_Desk.model_bet == 5) && get_self(892,37) == 1 && get_self(892,19) < 720){
|
||||
temp = 1;
|
||||
}else if(NN_Desk.model_bet == 3 && get_self(924,37) == 1 && get_self(924,19) < 720){
|
||||
temp = 1;
|
||||
}
|
||||
if(temp == -1){
|
||||
NN_UIF.btn.betScore(1, 1, 1, NN_Desk.model_fast);
|
||||
set_self(955,37,0,0,0);
|
||||
}else {
|
||||
NN_UIF.btn.betScore(0,1,0,1);
|
||||
//set_self(955,43,1,0,0);
|
||||
set_self(955,37,0,0,0);
|
||||
}
|
||||
} else {
|
||||
set_self(955,37,0,0,0);
|
||||
}
|
||||
NN_clickRecovery(spid_up);
|
||||
break;
|
||||
case 956://不加注
|
||||
NN_SendData.betScore(0);
|
||||
NN_clickRecovery(spid_up);
|
||||
break;
|
||||
case 964://隐藏管提示框
|
||||
case 962://取消托管
|
||||
//关闭托管提示框
|
||||
NN_UI.trusteeship(false);
|
||||
NN_clickRecovery(spid_down);
|
||||
break;
|
||||
case 961://确认托管-发包
|
||||
NN_SendData.trusteeship(1);
|
||||
NN_clickRecovery(spid_down);
|
||||
break;
|
||||
case 975://托管-抢庄切换
|
||||
if(NN_config.auto.robZhuang == 1){
|
||||
NN_config.auto.robZhuang = -1;
|
||||
set_self(968,43,2,0,0);
|
||||
} else {
|
||||
NN_config.auto.robZhuang = 1;
|
||||
set_self(968,43,1,0,0);
|
||||
}
|
||||
break;
|
||||
case 977://托管-下注分数增加
|
||||
if(NN_Desk.betRange && NN_Desk.betRange.length > 0){
|
||||
if(NN_config.auto.betScore >= NN_Desk.betRange[0] && NN_config.auto.betScore < NN_Desk.betRange[NN_Desk.betRange.length - 1]){
|
||||
var temp = -1;
|
||||
for(var i=0;i<NN_Desk.betRange.length;i++){
|
||||
if(NN_config.auto.betScore == NN_Desk.betRange[i]){
|
||||
temp = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(temp >= 0){
|
||||
NN_config.auto.betScore = NN_Desk.betRange[temp + 1];
|
||||
}
|
||||
}
|
||||
if(NN_config.auto.betScore >= NN_Desk.betRange[NN_Desk.betRange.length - 1]){
|
||||
set_self(977,35,150,0,0);
|
||||
}
|
||||
}else{
|
||||
if(NN_config.auto.betScore > 0 && NN_config.auto.betScore < NN_Desk.model_bet){
|
||||
NN_config.auto.betScore ++;
|
||||
}else{
|
||||
NN_config.auto.betScore = NN_Desk.model_bet;
|
||||
NN_config.auto.recode[1] = NN_Desk.model_bet;
|
||||
}
|
||||
if(NN_config.auto.betScore >= NN_Desk.model_bet){
|
||||
set_self(977,35,150,0,0);
|
||||
}
|
||||
}
|
||||
set_self(969,7,NN_config.auto.betScore,0,0);
|
||||
set_self(969,20,String(NN_config.auto.betScore).length * 30,0,0);
|
||||
set_self(969,18,get_self(979,18) + 55 - String(NN_config.auto.betScore).length * 15,0,0);
|
||||
set_self(978,35,255,0,0);
|
||||
break;
|
||||
case 978://托管-下注分数减小
|
||||
if(NN_Desk.betRange && NN_Desk.betRange.length > 0){
|
||||
if(NN_config.auto.betScore > NN_Desk.betRange[0] && NN_config.auto.betScore <= NN_Desk.betRange[NN_Desk.betRange.length - 1]){
|
||||
var temp = -1;
|
||||
for(var i=0;i<NN_Desk.betRange.length;i++){
|
||||
if(NN_config.auto.betScore == NN_Desk.betRange[i]){
|
||||
temp = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(temp > 0){
|
||||
NN_config.auto.betScore = NN_Desk.betRange[temp - 1];
|
||||
}
|
||||
}
|
||||
if(NN_config.auto.betScore == NN_Desk.betRange[0]){
|
||||
set_self(978,35,150,0,0);
|
||||
}
|
||||
}else{
|
||||
if(NN_config.auto.betScore > 1 && NN_config.auto.betScore <= NN_Desk.model_bet){
|
||||
NN_config.auto.betScore --;
|
||||
}else{
|
||||
NN_config.auto.betScore = 1;
|
||||
NN_config.auto.recode[1] = 1;
|
||||
}
|
||||
if(NN_config.auto.betScore == 1){
|
||||
set_self(978,35,150,0,0);
|
||||
}
|
||||
}
|
||||
set_self(969,7,NN_config.auto.betScore,0,0);
|
||||
set_self(969,20,String(NN_config.auto.betScore).length * 30,0,0);
|
||||
set_self(969,18,get_self(979,18) + 55 - String(NN_config.auto.betScore).length * 15,0,0);
|
||||
set_self(977,35,255,0,0);
|
||||
break;
|
||||
case 1112: //牌型奖励关闭
|
||||
NN_UI.cardTypeReward();
|
||||
break;
|
||||
case 981: //复制总结算内容
|
||||
NN_Desk.copyGameoverData();
|
||||
NN_clickRecovery(spid_up);
|
||||
break;
|
||||
case 1113: //显示发牌按钮勾选
|
||||
if(NN_UIF.disorderDeal.isView){
|
||||
NN_UIF.disorderDeal.isView = false;
|
||||
set_self(1113,43,2,0,0);
|
||||
NN_UIF.disorderDeal.show();
|
||||
}else {
|
||||
NN_UIF.disorderDeal.isView = true;
|
||||
set_self(1113,43,1,0,0);
|
||||
NN_UIF.disorderDeal.show(true);
|
||||
}
|
||||
break;
|
||||
case 1114: //发牌显示框点击
|
||||
if(NN_UIF.disorderDeal.isView){
|
||||
if(NN_UIF.disorderDeal.isDraw){
|
||||
set_self(1115, 7, "此区域显示发给玩家所有的牌\n\n 点击显示发牌", 0, 0 );
|
||||
if(NN_Desk.personMax == 10){ //10
|
||||
set_self(1115, 18, get_self(1114, 18) + 80, 0, 0);
|
||||
set_self(1115, 19, get_self(1114, 19) + 30, 0, 0);
|
||||
}else {
|
||||
set_self(1115, 18, get_self(1114, 18) + 10, 0, 0);
|
||||
set_self(1115, 19, get_self(1114, 19) + 30, 0, 0);
|
||||
}
|
||||
set_self(1115, 37, 1, 0, 0);
|
||||
NN_UIF.disorderDeal.isDraw = false;
|
||||
}else {
|
||||
set_self(1115, 37, 0, 0, 0);
|
||||
NN_UIF.disorderDeal.isDraw = true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(NN_Desk.state == NN_state.putCard){
|
||||
if(spid_up >= 725 && spid_up <= 729 && NN_Desk.state == NN_state.rubCard && get_self(750,37) == 0 && get_self(751,37) == 0){
|
||||
//牌背搓掉后不可地点牌处理
|
||||
NN_Desk.state = NN_state.putCard;
|
||||
}
|
||||
if(spid_up == 807 || spid_up == NN_Sprite.btn.sureCattle){//确定
|
||||
//判断是否已摆牌
|
||||
//if(NN_Desk.pList[NN_Desk.myseat].putcard == 1){//摆牌
|
||||
//NN_UI.putCard();
|
||||
//return;
|
||||
//}
|
||||
NN_Judge_selectCard();
|
||||
if(NN_Desk.pList[NN_Desk.myseat].cards.type == "wn"){
|
||||
NN_SendData.putCard();
|
||||
}else if(NN_Judge.putLoc.length == 3){
|
||||
if(NN_Judge_putCard()){
|
||||
NN_SendData.putCard();
|
||||
}else {
|
||||
NN_Tips.words("put_error");
|
||||
}
|
||||
}else if(NN_Judge.putLoc.length > 0){
|
||||
NN_Tips.words("put_error");
|
||||
//console.log("请点击选择三张牌选牛!");
|
||||
}
|
||||
//NN_SendData.putCard();
|
||||
NN_clickRecovery(spid_up);
|
||||
}else if(spid_up == 808 || spid_up == NN_Sprite.btn.noCattle){//无牛
|
||||
if(NN_Desk.pList[NN_Desk.myseat].cards.type == "wn"){
|
||||
NN_SendData.putCard();
|
||||
}else{
|
||||
NN_Tips.words("put_cattle");
|
||||
}
|
||||
NN_clickRecovery(spid_up);
|
||||
}
|
||||
}else if(NN_Desk.state == NN_state.over){ //总结算阶段
|
||||
if(spid_up >= 1000 && spid_up <= 1004){ //吱口令
|
||||
var seat = spid_up - 1000;
|
||||
if(Utl.getPayCodeBySeat(seat)){
|
||||
//复制到粘贴板
|
||||
Utl.gameCopytext(Utl.getPayCodeBySeat(seat));
|
||||
//提示复制成功
|
||||
Utl.openTips("吱口令复制成功",1200);
|
||||
}else {
|
||||
set_self(1000+seat,37,0,0,0);
|
||||
}
|
||||
NN_clickRecovery(spid_up);
|
||||
} else if(spid_up >= 1933 && spid_up <= 1942){
|
||||
var seat = spid_up - 1933;
|
||||
if(Utl.getPayCodeBySeat(seat)){
|
||||
//复制到粘贴板
|
||||
Utl.gameCopytext(Utl.getPayCodeBySeat(seat));
|
||||
//提示复制成功
|
||||
Utl.openTips("吱口令复制成功",1200);
|
||||
}else {
|
||||
set_self(1933 + seat,37,0,0,0);
|
||||
}
|
||||
NN_clickRecovery(spid_up);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if(spid_down == 706 || spid_down == 707 || spid_down == NN_Sprite.btn.noRob || spid_down == NN_Sprite.btn.rob
|
||||
|| spid_down == 808 || spid_down == 807 || spid_down == NN_Sprite.btn.sureCattle || spid_down == NN_Sprite.btn.noCattle
|
||||
|| spid_down == 851 || spid_down == 1802 || (spid_down >= 809 && spid_down <= 818)
|
||||
|| (spid_down >= 946 && spid_down <= 948) || spid_down == 925 || spid_down == 957 || spid_down == 961 || spid_down == 962 || spid_down == 981){
|
||||
NN_clickRecovery(spid_down);
|
||||
}
|
||||
}
|
||||
if(NN_Desk.state == NN_state.rubCard){
|
||||
if(spid_down == 750 || spid_down == 751){
|
||||
NN_SendData.rubCard(spid_down - 747);
|
||||
set_self(spid_down,37,0,0,0);
|
||||
|
||||
//搓牌后显示
|
||||
var loc = spid_down - 747;
|
||||
if(NN_Desk.pList[NN_Desk.myseat].rubcard.length == 0){
|
||||
NN_Desk.pList[NN_Desk.myseat].rubcard[0] = loc;
|
||||
}else if(NN_Desk.pList[NN_Desk.myseat].rubcard.length == 1){
|
||||
if(NN_Desk.pList[NN_Desk.myseat].rubcard[0] != loc){
|
||||
NN_Desk.pList[NN_Desk.myseat].rubcard[1] = loc;
|
||||
}
|
||||
//
|
||||
NN_Desk.state = NN_state.putCard;
|
||||
//搓牌完成-显示自动摆牌
|
||||
if(NN_Desk.pList[NN_Desk.myseat].putcard != 1){
|
||||
NN_putCard_autoSelection(true);
|
||||
}
|
||||
}
|
||||
//显示
|
||||
if(NN_Judge.isDealCards != 1){//判断是否发牌中
|
||||
//logmessage("自己搓牌:"+NN_Desk.pList[NN_Desk.myseat].rubcard,1);
|
||||
if(NN_Desk.model_fast >= 1){
|
||||
if(NN_Desk.personMax == 10){
|
||||
NN_UIP.card.rubCard(1,1,1,NN_Desk.model_fast, NN_Desk.myseat, loc, NN_Desk.pList[NN_Desk.myseat].cards.cards[loc]);
|
||||
}else {
|
||||
NN_UIF.card.rubCard(1,1,1,NN_Desk.model_fast, NN_Desk.myseat, loc, NN_Desk.pList[NN_Desk.myseat].cards.cards[loc]);
|
||||
}
|
||||
}else {
|
||||
NN_UI.rubCard(NN_Desk.myseat,loc,NN_Desk.pList[NN_Desk.myseat].cards.cards[loc]);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
NN_Judge.isRub = -1;
|
||||
}
|
||||
}else if(NN_Desk.state == NN_state.putCard && NN_Desk.pList[NN_Desk.myseat].putcard != 1){
|
||||
if(spid_down >= 725 && spid_down <= 729){
|
||||
NN_Judge.boveCardaSpid = -1;
|
||||
//NN_Judge_selectCard();
|
||||
//logmessage("NN_Judge.putLoc = "+NN_Judge.putLoc,1);
|
||||
}
|
||||
}else if(NN_Desk.state == NN_state.over){
|
||||
if(spid_down == 884){//战绩列表
|
||||
if(get_self(884,19) > 334 || get_self(884,21) < 143){
|
||||
play_ani(1,884,19,get_self(884,19),334,0,400,0,0,0,1,0,0);
|
||||
}else if(get_self(884,19)+get_self(884,21) < 477){
|
||||
play_ani(1,884,19,get_self(884,19),447-get_self(884,21),0,400,0,0,0,1,0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
function NN_MouseUp_other(gameid,spid_down,downx,downy,spid_up,upx,upy,timelong){
|
||||
//其他点击弹起事件
|
||||
/*
|
||||
if( Utl.getInfMode() == 1 && spid_down == spid_up){
|
||||
//if(spid_down == spid_up){
|
||||
switch (spid_up){
|
||||
case 188://
|
||||
Test.judge.times_click0 ++;
|
||||
break;
|
||||
case 203:
|
||||
Test.judge.times_click1 ++;
|
||||
break;
|
||||
case 698://
|
||||
Test.judge.times_click2 ++;
|
||||
if(Test.judge.times_click0 == Test.judge.triggerMode[0] && Test.judge.times_click2 == Test.judge.triggerMode[2]){
|
||||
//开启
|
||||
if(Test.autoOpt.isOpen){
|
||||
Test.autoOpt.close();
|
||||
}else {
|
||||
//测试用-自动操作
|
||||
Test.autoOpt.open(-1);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Test.judge.times_click0 = 0;
|
||||
Test.judge.times_click1 = 0;
|
||||
Test.judge.times_click2 = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
};
|
||||
|
||||
function NN_Judge_putCard(){
|
||||
//判断摆牌
|
||||
var _cards = NN_Desk.pList[NN_Desk.myseat].cards;
|
||||
if(_cards.niu < 0){
|
||||
return false;
|
||||
}
|
||||
if(_cards.type == "wn"){
|
||||
return true;
|
||||
}else {
|
||||
var c_val = [];
|
||||
for(var i=0;i<3;i++){
|
||||
c_val[i] = NN_Desk.cardList[_cards.cards[NN_Judge.putLoc[i]]].gameval;
|
||||
}
|
||||
if((c_val[0] + c_val[1] + c_val[2])%10 == 0){
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
//摆牌自动选中
|
||||
function NN_putCard_autoSelection(isAnim/*是否动画*/){
|
||||
//初始牌上下移动坐标点
|
||||
if(NN_Desk.personMax == 10){ //10人局
|
||||
NN_Judge.putPosY[1] = get_self(NN_Sprite.card.relvSpid[0], 19) + NN_Sprite.card.position[0][1];
|
||||
NN_Judge.putPosY[0] = NN_Judge.putPosY[1] - 30;
|
||||
}else{
|
||||
NN_Judge.putPosY[0] = 490;
|
||||
NN_Judge.putPosY[1] = 522;
|
||||
}
|
||||
|
||||
var _cards = NN_Desk.pList[NN_Desk.myseat].cards;
|
||||
var g_vallist = [];
|
||||
for(var i=0;i<_cards.cards.length;i++){
|
||||
g_vallist[i] = NN_Desk.cardList[_cards.cards[i]].gameval;
|
||||
}
|
||||
NN_Judge.putLoc = [];
|
||||
if(_cards.type == "wn" || _cards.niu < 0){
|
||||
return ;
|
||||
}else {
|
||||
var arr = [];
|
||||
outer:
|
||||
for(var i=0;i<3;i++){
|
||||
for(var j=i+1;j<4;j++){
|
||||
for(var k=j+1;k<=4;k++){
|
||||
if((g_vallist[i] + g_vallist[j] + g_vallist[k])%10 == 0){
|
||||
arr = [i,j,k];
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(arr.length > 0){
|
||||
NN_Judge.putLoc = arr;
|
||||
for(var i=0; i<arr.length; i++){
|
||||
if(get_self(725 + arr[i],19) != NN_Judge.putPosY[0]){
|
||||
if(isAnim){
|
||||
play_ani(1,725 + arr[i],19,get_self(725 + arr[i],19),NN_Judge.putPosY[0],0,80,0,0,0,1,0,0);
|
||||
} else {
|
||||
set_self(725 + arr[i],19,NN_Judge.putPosY[0],0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(NN_Desk.personMax == 10){ //10人局
|
||||
//隐藏牌背
|
||||
NN_UIP.show.onRobPutTips(0,0,0,0);
|
||||
//隐藏选牌提示
|
||||
NN_UIP.anim.fingerSlide();
|
||||
} else {
|
||||
//隐藏牌背
|
||||
set_self(750,37,0,0,0);
|
||||
set_self(751,37,0,0,0);
|
||||
//隐藏选牌提示
|
||||
set_self(905,37,0,0,0);
|
||||
set_self(769,37,0,0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function NN_Judge_selectCard(_putLoc){
|
||||
//摆牌时判断选牌是否正常
|
||||
if(_putLoc != null && _putLoc.length > 0){
|
||||
for(var i=0;i<5;i++){
|
||||
set_self(725+i,19,NN_Judge.putPosY[1],0,0);
|
||||
for(var j=0;j<_putLoc.length;j++){
|
||||
if(_putLoc[j] == i){
|
||||
set_self(725+i,19,NN_Judge.putPosY[0],0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}else {
|
||||
var up_loc = [];
|
||||
var temp = -1,up_num = 0;
|
||||
NN_Judge.putLoc = [];
|
||||
for(var i=0;i<5;i++){
|
||||
if(get_self(725+i,19) < NN_Judge.putPosY[0] + 15){//牌弹起
|
||||
NN_Judge.putLoc.push(i);
|
||||
if(get_self(725+i,19) != NN_Judge.putPosY[0]){
|
||||
play_ani(1,725+i,19,get_self(725+i,19),NN_Judge.putPosY[0],0,80,0,0,0,1,0,0);
|
||||
}
|
||||
}else{//牌未弹起
|
||||
if(get_self(725+i,19) != NN_Judge.putPosY[1]){
|
||||
play_ani(1,725+i,19,get_self(725+i,19),NN_Judge.putPosY[1],0,80,0,0,0,1,0,0);
|
||||
}
|
||||
/*
|
||||
for(var j=0;j<NN_Judge.putLoc.length;j++){
|
||||
if(NN_Judge.putLoc[j] == i){//若选牌数组中有,删掉
|
||||
NN_Judge.putLoc.splice(j,1);
|
||||
//console.log("选牌数组中有,删掉牌"+i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
return NN_Judge.putLoc.length;
|
||||
}
|
||||
};
|
||||
|
||||
function NN_clickEffect(spid){
|
||||
//按钮点击效果
|
||||
set_self(spid,35,200,0,0);
|
||||
set_self(spid,33,105,0,0);
|
||||
};
|
||||
function NN_clickRecovery(spid){
|
||||
//按钮点击恢复
|
||||
set_self(spid,35,255,0,0);
|
||||
set_self(spid,33,100,0,0);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
923
codes/games/client/Projects/niuniu/js/niuniu/nn_data.js
Normal file
923
codes/games/client/Projects/niuniu/js/niuniu/nn_data.js
Normal file
@@ -0,0 +1,923 @@
|
||||
/*data*/
|
||||
var NN_GameModel = 1; //游戏网络0-单机,1网络
|
||||
var NN_GameState = -1; //游戏状态
|
||||
var NN_FS = []; //方位转座位
|
||||
var NN_SF = []; //座位转方位
|
||||
var NN_nowTimeout = 0; //当前倒计时时间-秒
|
||||
var NN_nowTimeoutId = -1;//当前倒计时id
|
||||
var NN_soundState = -1; //音效开关
|
||||
var NN_timeout = 1; //定时器执开关
|
||||
|
||||
//牛牛配置参数
|
||||
var NN_config = {
|
||||
beanDes: "星星", //星星文字显示
|
||||
roomCardDes: "房卡", //房卡显示
|
||||
data : null, //配置文件数据
|
||||
creatRoomMode : [-1, 1], //创建房间类型 [是否区分,当前创建房间模式]
|
||||
room_card : [[[6,1],[12,2]],[[6,1],[12,2]]], //房卡类型
|
||||
mult_bet : [3,3,3], //倍数类型对应下注模式
|
||||
model_bet : 3, //下注模式
|
||||
betRange : [], //下注范围
|
||||
card_mult : [[8,2],[[-1],[1,1,1,1,1,1,1,1,2,3,4,-5,-6,-7,6,5,7,-11,-12],[1,1,2,3,4,5,6,7,8,9,10,-15,-16,-17,12,11,13,-25,-40]]], //牛八2倍类型牌型倍数
|
||||
isOwnerInfinite : -1, //是否有房主无限局
|
||||
isInfinite : 0, //是否无限局
|
||||
force_bet: [-1, -1, -1, -1], //强制操作[是否开启, 是否抢庄,下注分数, 最小下注值]
|
||||
model_bean: [-1,0,1000,10000,0.01], //星星分数显示 [1是否为星星场,星星数限制,星星数最小值,星星数最大值]
|
||||
bean_mult: [1,1,50,0.02], //星星倍数相关[星星倍数,最小倍数,最大倍数,滑动间隔]
|
||||
cfg_bean: [0, 0], //[抢庄限制,下注限制]
|
||||
teaCost: [-1, 0, -1, [0,0], 0, [0,0]], //[是否服务费,服务费值,是否房主服务费(-1、0:无,1:可变动,2:固定服务费值), 服务费值[6局,12局], 服务费最大值模式(1:可变动,2:固定值),服务费最大值[6局,12局]];
|
||||
teaCostRange: [0, 0], //茶水费范围
|
||||
bean_leaveMin: [0.5, 1, [0.5, 1]], //星星场离场星星数 [离场星星,离场设置模式,[相对入场最小值百分比,相对入场最大值百分比]]
|
||||
forceBetType: 2, //强制下注值:1-强制下注,2-最低下注
|
||||
//托管参数
|
||||
auto: {
|
||||
mode: [1,1,1], //托管模式[抢庄,下注,搓摆牌]
|
||||
toTime: 800, //定时延迟操作时间
|
||||
fast_toTime : 700, //快版定时延迟操作时间
|
||||
robZhuang: -1, //抢庄0-未操作,1-抢庄,-1-不抢
|
||||
betScore: -1, //下注分数
|
||||
recode: [-1,-1], //玩家操作记录
|
||||
},
|
||||
//托管提示框描述
|
||||
des_trusteeship: "提示:托管时与最近一局的操作相同,若\n无操作时默认不抢庄,下注分数为最大值。",
|
||||
ui:{
|
||||
sysRoomDes: -1, //系统房间房间类型是否显示,-1为显示
|
||||
}
|
||||
};
|
||||
|
||||
var NN_errorMsg = ""; //最近一次错误信息
|
||||
|
||||
var NN_RevDataRecord = {
|
||||
over:0, //0-断线重连时,-1-本地后台切回,1本地切回画完动画
|
||||
dealCards:null, //发牌数据包记录
|
||||
settlement:null,//结算数据包记录
|
||||
gameover:null //总结算数据包记录
|
||||
};
|
||||
|
||||
var NN_Judge = { //判断时用
|
||||
isRub:-1, //是否搓牌成功
|
||||
putLoc:[], //摆牌选中的位置
|
||||
putPosY:[], //摆牌选中的位置移动Y轴坐标
|
||||
boveCardaSpid:-1, //手是否移动到牌上,上次移动到哪张牌
|
||||
isVibrator:-1, //是否震动
|
||||
isDisband:-1, //是否解散房间
|
||||
isStartWar:-1, //是否开始动画中
|
||||
isOkZhuang:-1, //是否确定抢庄动画中
|
||||
isDealCards:-1, //是否发牌动画中
|
||||
|
||||
headViewList: [], //玩家头像精灵有显示的列表
|
||||
};
|
||||
|
||||
|
||||
var NN_Desk = {};
|
||||
function NN_createDesk(){
|
||||
//创建游戏桌
|
||||
NN_Desk = new NN_deskInfo(room_obj);
|
||||
//NN_Desk.addPlayer();
|
||||
//console.log("桌创建成功");
|
||||
};
|
||||
|
||||
var NN_State = { //游戏各阶段状态
|
||||
inHall:0,
|
||||
inGame:1
|
||||
};
|
||||
|
||||
var NN_state = { //游戏各阶段状态
|
||||
ready:10, //准备
|
||||
robZhuang:1, //抢庄
|
||||
bet:2, //下注状态
|
||||
betAgain:2, //下注状态
|
||||
dealCard:3, //发牌
|
||||
rubput:4, //搓牌和摆牌
|
||||
settlement:5, //结算
|
||||
over:6,
|
||||
|
||||
rubCard:7, //搓牌
|
||||
putCard:8 //摆牌
|
||||
};
|
||||
|
||||
//玩家游戏信息
|
||||
var NN_playerInfo = function(_seat){
|
||||
this.seat = _seat; //座位
|
||||
this.cards = new NN_cardsInfo([]); //玩家手牌
|
||||
this.isRob = 0; //-1不抢庄 1-抢
|
||||
this.rubcard = []; //搓牌0-开始搓牌,1搓第一张牌,2搓牌完成
|
||||
this.putcard = -1; //摆牌0-开始摆牌,1摆牌完成
|
||||
this.scores = 0; //玩家赢取的分数
|
||||
this.betScore = 0; //玩家下注
|
||||
this.betScoreAgain = -1; //玩家加注
|
||||
this.winScore = 0; //玩家赢取的分数
|
||||
this.isJoin = -1; //玩家是否下注参与游戏
|
||||
this.state = 1;
|
||||
this.isBet = -1; //是否未下注
|
||||
this.isReady = 0; //是否准备
|
||||
this.isAuto = -1; //是否托管
|
||||
this.betRange = [];//下注范围值
|
||||
};
|
||||
|
||||
//游戏中桌信息
|
||||
var NN_deskInfo = function(){
|
||||
this.personMax = 5; //桌上最大玩家人数
|
||||
this.roomtype = []; //roomtype:总局数+下注上限
|
||||
this.owner = { //房主信息
|
||||
seat: -1,
|
||||
name: "",
|
||||
id: -1
|
||||
};
|
||||
this.nowCount = 0; //当前游戏局数
|
||||
this.records = []; //历史对战记录
|
||||
this.state = -1; //状态
|
||||
this.model = 1; //模式0-无牛下庄,1-每局抢庄
|
||||
this.model_bet = 3; //下注模式:1-下注值为1~10,2-下注值为1-3
|
||||
this.betRange = []; //下注范围
|
||||
this.pairs = 0; //几副牌
|
||||
this.model_mult = 1; //牌型倍数类型
|
||||
this.model_fast = -1; //1-快速模式,其他值-正常模式
|
||||
this.model_bean = [-1,0,1,0,0]; //星星模式
|
||||
this.cardMaxMult= [7,13]; //牌型最大倍数值[牛八两倍,牛几几倍]
|
||||
this.isTrusteeship = true; //是否开启托管功能
|
||||
|
||||
this.myseat = -1; //玩家座位
|
||||
this.pList = []; //玩家列表
|
||||
this.betList = []; //下注玩家列表
|
||||
this.betAgainList = []; //再次下注玩家列表
|
||||
this.robList = [0,0,0,0,0]; //抢庄列表
|
||||
this.diceList = []; //色子点数列表
|
||||
this.playercount = 0; //玩家人数
|
||||
this.zhuang = -1; //庄
|
||||
|
||||
this.isDisorderDeal = 0; //是否显示无序发牌
|
||||
this.disorderDealCards = []; //无序的发牌
|
||||
|
||||
this.stageTime = 0;
|
||||
this.stageTime_loc = 0;
|
||||
|
||||
this.gameoverScores = [];
|
||||
};
|
||||
|
||||
//各阶段时间上限
|
||||
NN_deskInfo.prototype.timeout_m = {
|
||||
ready: 5, //准备时间
|
||||
shuffle:5, //洗牌时间
|
||||
robzhuang:12, //抢庄
|
||||
bet:12, //下注
|
||||
betAgain:6, //再次下注
|
||||
throwdice:5, //丢色子
|
||||
dealcards:5, //发牌
|
||||
rubput:12, //搓牌和摆牌
|
||||
result:10 //显示结果
|
||||
|
||||
};
|
||||
//各阶段时间上限
|
||||
NN_deskInfo.prototype.timeout_count = {
|
||||
bet:0
|
||||
};
|
||||
//计时器
|
||||
NN_deskInfo.prototype.timeout = {
|
||||
ready:0, //准备时间
|
||||
shuffle:0, //洗牌时间
|
||||
robzhuang:0, //抢庄
|
||||
bet:0, //下注
|
||||
betAgain:0, //再次下注
|
||||
throwdice:0, //丢色子
|
||||
dealcards:0, //发牌
|
||||
rubput:0, //搓牌和摆牌
|
||||
result:0 //显示结果
|
||||
};
|
||||
|
||||
//牌信息
|
||||
NN_deskInfo.prototype.cardList = nn_newCards();
|
||||
|
||||
//常量设置
|
||||
NN_deskInfo.prototype.constant = {
|
||||
cardTypeReward : [1,2,3] //特殊牌型奖励张数[五花牛,五小牛,炸弹]
|
||||
};
|
||||
|
||||
NN_deskInfo.prototype.initData_net = function(data){
|
||||
//初始化房间桌游戏数据
|
||||
this.myseat = Utl.getMySeat();
|
||||
//桌数据
|
||||
var desk = data;
|
||||
this.roomtype = desk.desk[0];
|
||||
this.nowCount = desk.desk[1];
|
||||
this.state = desk.desk[2];
|
||||
this.model = data.desk[3]; //模式0-无牛下庄,1-每局抢庄
|
||||
this.zhuang = data.desk[4];
|
||||
this.robList = data.desk[5];
|
||||
this.betList = data.desk[6];
|
||||
if(desk.desk[7] > 0){
|
||||
this.stageTime = desk.desk[7];
|
||||
if(this.state == NN_state.bet){
|
||||
if(data.desk[10] <= 0){
|
||||
this.stageTime_loc = (new Date()).getTime() - desk.desk[7];
|
||||
}
|
||||
}
|
||||
}
|
||||
this.playercount = data.desk[8]; //玩家人数
|
||||
this.constant.cardTypeReward = data.desk[9]; //特殊牌型奖励张数[五花牛,五小牛,炸弹]
|
||||
this.timeout_count.bet = data.desk[10];
|
||||
if(data.desk[11] != null){
|
||||
this.owner.seat = data.desk[11]; //房主
|
||||
}
|
||||
this.model_fast = data.desk[12]; //快版
|
||||
this.model_bean = data.desk[13];
|
||||
this.model_bet = data.desk[14];
|
||||
this.betRange = data.desk[15]; //下注范围
|
||||
this.cardMaxMult = data.desk[16]; //
|
||||
this.isTrusteeship = data.desk[17];
|
||||
this.personMax = data.desk[18];
|
||||
this.isDisorderDeal = data.desk[19];
|
||||
if(this.isDisorderDeal){
|
||||
this.disorderDealCards = data.desk[20];
|
||||
}
|
||||
|
||||
this.pairs = data.desk[0][2];
|
||||
this.model_mult = data.desk[0][3];
|
||||
//玩家游戏信息
|
||||
for(var i=0;i<desk.players.length;i++){
|
||||
if(desk.players[i].length > 0){
|
||||
this.pList[i] = new NN_playerInfo(i);
|
||||
this.pList[i].seat = desk.players[i][0];
|
||||
this.pList[i].betScore = desk.players[i][1];
|
||||
this.pList[i].rubcard = desk.players[i][2];
|
||||
this.pList[i].putcard = desk.players[i][3];
|
||||
this.pList[i].scores = desk.players[i][4];
|
||||
this.pList[i].winScore = desk.players[i][5];
|
||||
this.pList[i].cards.cards = [];
|
||||
if(desk.players[i][6].length > 0){
|
||||
this.pList[i].cards.cards = desk.players[i][6][0];
|
||||
if(desk.players[i][6][0].length > 0){
|
||||
for(var j=3;j<5;j++){
|
||||
if(this.pList[i].cards.cards[j] < 0){
|
||||
this.pList[i].cards.cards[j] = 54;
|
||||
}
|
||||
}
|
||||
if(desk.players[i][6].length > 1){
|
||||
this.pList[i].cards.type = desk.players[i][6][1];
|
||||
this.pList[i].cards.Multiple = desk.players[i][6][2];
|
||||
this.pList[i].cards.niu = desk.players[i][6][3];
|
||||
}
|
||||
}
|
||||
}
|
||||
this.pList[i].isJoin = desk.players[i][7];
|
||||
this.pList[i].isBet = desk.players[i][8];
|
||||
|
||||
this.pList[i].isAuto = desk.players[i][9];
|
||||
//托管数据
|
||||
if(desk.players[i][10].length > 0){
|
||||
NN_config.auto.mode = data.players[i][10][0]; //托管模式[抢庄,下注,搓摆牌]
|
||||
NN_config.auto.toTime = data.players[i][10][1]; //定时延迟操作时间
|
||||
NN_config.auto.robZhuang = data.players[i][10][2]; //抢庄0-未操作,1-抢庄,-1-不抢
|
||||
NN_config.auto.betScore = data.players[i][10][3]; //下注分数
|
||||
NN_config.auto.recode = data.players[i][10][4]; //玩家操作记录
|
||||
}
|
||||
this.pList[i].isReady = desk.players[i][11];
|
||||
this.pList[i].betScoreAgain = desk.players[i][12];
|
||||
this.pList[i].betRange = desk.players[i][13];
|
||||
}
|
||||
}
|
||||
//各阶段时间上限
|
||||
if(data.to_m){
|
||||
this.timeout_m.ready = data.to_m[0]; //准备时间
|
||||
this.timeout_m.robzhuang = data.to_m[1];//抢庄
|
||||
this.timeout_m.bet = data.to_m[2]; //下注
|
||||
this.timeout_m.betAgain = data.to_m[3]; //再次下注
|
||||
this.timeout_m.rubput = data.to_m[4]; //搓牌和摆牌
|
||||
}
|
||||
|
||||
//设置方位
|
||||
NN_setPositionSeat(this.myseat);
|
||||
NN_GameState = NN_State.inGame;
|
||||
NN_soundState = 1; //音效开关
|
||||
NN_timeout = 1; //定时器执开关
|
||||
NN_Judge.isDisband = -1;
|
||||
NN_RevDataRecord.over = 0;
|
||||
NN_RevDataRecord.dealCards = null;
|
||||
NN_RevDataRecord.settlement = null;
|
||||
NN_RevDataRecord.gameover = null;
|
||||
//
|
||||
NN_Sprite.person = this.personMax;
|
||||
//通知框架游戏状态
|
||||
if(Utl.getIsInfinite() == 1){
|
||||
if(this.state == NN_state.ready){
|
||||
Utl.setDeskStage(0);
|
||||
} else {
|
||||
Utl.setDeskStage(1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//初始化玩家下注范围值
|
||||
NN_deskInfo.prototype.initPlayerBetRange = function(arr_range){
|
||||
if(arr_range){
|
||||
for (var i=0; i<arr_range.length; i++){
|
||||
if(this.pList[arr_range[i][0]]){
|
||||
for (var j=0; j<arr_range[i][1].length; j++){
|
||||
this.pList[arr_range[i][0]].betRange = arr_range[i][1].slice();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NN_deskInfo.prototype.isAddPlayer = function(seat){
|
||||
//添加玩家信息,返回座位
|
||||
if(!this.pList[seat]){
|
||||
this.pList[seat] = new NN_playerInfo(seat);
|
||||
this.playercount ++;
|
||||
//console.log("添加玩家到座位:"+seat);
|
||||
}
|
||||
};
|
||||
|
||||
NN_deskInfo.prototype.delPlayer = function(seat){
|
||||
//删除玩家信息
|
||||
if(!this.pList[seat]){
|
||||
this.pList[seat] = null;
|
||||
this.playercount --;
|
||||
//console.log("删除 "+i+"号座位的玩家 ");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
//判断玩家星星数是否够
|
||||
NN_deskInfo.prototype.isBeanEnough = function(seat,step){
|
||||
if(seat == null){
|
||||
seat = this.myseat;
|
||||
}
|
||||
if(this.model_bean[0] == 1 && this.pList[seat]){
|
||||
var _bean = null;
|
||||
if(Desk.GetPlayerBySeat(seat) && Desk.GetPlayerBySeat(seat).bean != null){
|
||||
_bean = Desk.GetPlayerBySeat(seat).bean;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
if(step == "rob"){
|
||||
if(this.model_bean[3] > 0){
|
||||
if(_bean >= this.model_bean[3] * this.model_bean[2]){
|
||||
return true;
|
||||
}
|
||||
}else {
|
||||
return true;
|
||||
}
|
||||
}else if(step == "bet" || !step){
|
||||
if(this.model_bean[4] > 0){
|
||||
if(_bean >= this.model_bean[4] * this.model_bean[2]){
|
||||
return true;
|
||||
}
|
||||
}else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}else {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
//小局开始前数据初始化
|
||||
NN_deskInfo.prototype.initRoundData = function(){
|
||||
//桌数据
|
||||
this.zhuang = -1;
|
||||
this.betList = []; //下注玩家列表
|
||||
this.diceList = [[],[],[],[],[]]; //色子点数列表
|
||||
//抢庄列表
|
||||
if(this.personMax == 10){
|
||||
this.robList = [0,0,0,0,0,0,0,0,0,0];
|
||||
}else {
|
||||
this.robList = [0,0,0,0,0];
|
||||
}
|
||||
this.disorderDealCards = [];
|
||||
//玩家游戏数据
|
||||
for(var i=0;i<this.pList.length;i++){
|
||||
if(this.pList[i]){
|
||||
this.pList[i].cards = new NN_cardsInfo([]); //玩家手牌
|
||||
this.pList[i].rubcard = []; //搓牌0-开始搓牌,1搓第一张牌,2搓牌完成
|
||||
this.pList[i].putcard = -1; //摆牌0-开始摆牌,1摆牌完成
|
||||
this.pList[i].betScore = 0; //玩家下注
|
||||
this.pList[i].betScoreAgain = -1; //玩家加注注
|
||||
this.pList[i].winScore = 0; //玩家赢取的分数
|
||||
this.pList[i].isRob = 0; //玩家赢取的分数
|
||||
this.pList[i].betRange = [];
|
||||
this.pList[i].bean = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
NN_deskInfo.prototype.readyStage = function(data){
|
||||
//小局开始前数据初始化
|
||||
this.initRoundData();
|
||||
//准备阶段
|
||||
for(var i=0;i<this.pList.length;i++){
|
||||
if(this.pList[i]){
|
||||
Utl.setPlayerPrepare(i, 0); //设置玩家未准备状态
|
||||
this.pList[i].isReady = 0; //玩家准备状态
|
||||
}
|
||||
}
|
||||
NN_Desk.state = NN_state.ready;
|
||||
//通知框架进入准备阶段
|
||||
Utl.setDeskStage(0);
|
||||
};
|
||||
|
||||
NN_deskInfo.prototype.startWar = function(data){
|
||||
//小局开始前数据初始化
|
||||
this.initRoundData();
|
||||
//通知框架已开始游戏
|
||||
if(Utl.getIsInfinite() == 1){
|
||||
Utl.setDeskStage(1);
|
||||
}
|
||||
//开始游戏
|
||||
if(data.startType == 0){//抢庄
|
||||
this.zhuang = -1;
|
||||
}else if(data.startType >= 1){//庄不变 //倒桩
|
||||
this.zhuang = data.zhuang;
|
||||
}
|
||||
this.state = data.state;
|
||||
this.nowCount = data.nowCount;
|
||||
//牌数据赋值
|
||||
if(data.cards){
|
||||
for(var i=0;i<data.cards.length;i++){
|
||||
if(this.pList[i] && data.cards[i].length > 0){
|
||||
//if(data.cards[i].length > 0){
|
||||
this.pList[i].cards.cards = [54,54,54,54,54];//54-牌背
|
||||
for(var j=0;j<data.cards[i][0].length;j++){
|
||||
this.pList[i].cards.cards[j] = data.cards[i][0][j];
|
||||
}
|
||||
if(data.cards[i].length > 1){
|
||||
this.pList[i].cards.type = data.cards[i][1];
|
||||
this.pList[i].cards.Multiple = data.cards[i][2];
|
||||
this.pList[i].cards.niu = data.cards[i][3];
|
||||
}
|
||||
//看牌抢庄
|
||||
if(this.model == 4){
|
||||
this.pList[i].rubcard[0] = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this.pList[NN_Desk.myseat].cards.cards.length > 0){
|
||||
Utl.changePlayerState(0);
|
||||
}
|
||||
//
|
||||
if(data.disorderCards){
|
||||
this.disorderDealCards = data.disorderCards;
|
||||
}
|
||||
}
|
||||
if(this.zhuang >= 0){
|
||||
this.pList[this.zhuang].isBet = -1;
|
||||
}
|
||||
//初始化玩家下注范围
|
||||
if(data.pBetRange){
|
||||
this.initPlayerBetRange(data.pBetRange);
|
||||
}
|
||||
|
||||
//下注抢庄
|
||||
if(this.model == 5 && this.pList[NN_Desk.myseat].isReady){
|
||||
Utl.changePlayerState(0);
|
||||
}
|
||||
NN_Desk.stageTime_loc = (new Date()).getTime();
|
||||
};
|
||||
|
||||
NN_deskInfo.prototype.robZhuang = function(data){
|
||||
//抢庄-不抢
|
||||
this.isAddPlayer(data.seat);
|
||||
this.robList[data.seat] = data.isrob;
|
||||
this.pList[data.seat].isRob = data.isrob;
|
||||
this.pList[data.seat].isBet = -1;
|
||||
if(data.seat == NN_Desk.myseat){
|
||||
Utl.changePlayerState(0);
|
||||
//记录玩家是否抢庄
|
||||
NN_config.auto.recode[0] = data.isrob;
|
||||
NN_config.auto.robZhuang = data.isrob;
|
||||
}
|
||||
};
|
||||
|
||||
NN_deskInfo.prototype.okZhuang = function(data){
|
||||
//抢庄-确定庄
|
||||
this.zhuang = data.zhuang;
|
||||
this.robList = data.robList;
|
||||
this.diceList = data.diceList;
|
||||
this.state = NN_state.bet;
|
||||
if(this.zhuang == NN_Desk.myseat){
|
||||
Utl.changePlayerState(0);
|
||||
}
|
||||
this.pList[this.zhuang].isBet = -1;
|
||||
if(this.model == 5 && data.cards){
|
||||
for(var i=0;i<data.cards.length;i++){
|
||||
if(this.pList[i] && data.cards[i].length > 0){
|
||||
//if(data.cards[i].length > 0){
|
||||
this.pList[i].cards.cards = [54,54,54,54,54];//54-牌背
|
||||
for(var j=0;j<data.cards[i][0].length;j++){
|
||||
this.pList[i].cards.cards[j] = data.cards[i][0][j];
|
||||
}
|
||||
if(data.cards[i].length > 1){
|
||||
this.pList[i].cards.type = data.cards[i][1];
|
||||
this.pList[i].cards.Multiple = data.cards[i][2];
|
||||
this.pList[i].cards.niu = data.cards[i][3];
|
||||
}
|
||||
}
|
||||
}
|
||||
//this.state = NN_state.rubCard;//搓牌状态
|
||||
//去除庄下注分数
|
||||
this.pList[this.zhuang].betScore = 0;
|
||||
}else if(this.model == 5){
|
||||
//去除庄下注分数
|
||||
this.pList[this.zhuang].betScore = 0;
|
||||
}
|
||||
//初始化玩家下注范围
|
||||
if(data.pBetRange){
|
||||
this.initPlayerBetRange(data.pBetRange);
|
||||
}
|
||||
|
||||
NN_Desk.stageTime_loc = (new Date()).getTime();
|
||||
};
|
||||
|
||||
NN_deskInfo.prototype.betScore = function(data){
|
||||
//玩家下注
|
||||
this.isAddPlayer(data.seat);
|
||||
var seat = data.seat;
|
||||
var _score = data.score; //下注分数
|
||||
if(10 >= _score && _score > 0){
|
||||
this.pList[seat].betScore = _score;
|
||||
this.betList.push(seat);
|
||||
this.pList[seat].isJoin = 1;
|
||||
this.pList[data.seat].isBet = -1;
|
||||
if(seat == NN_Desk.myseat){
|
||||
Utl.changePlayerState(0);
|
||||
//记录玩家下注分数
|
||||
NN_config.auto.betScore = _score;
|
||||
NN_config.auto.recode[1] = _score;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
NN_deskInfo.prototype.dealCards = function(data){
|
||||
//发牌
|
||||
NN_RevDataRecord.dealCards = data;
|
||||
|
||||
this.state = NN_state.dealCard;//状态
|
||||
if(NN_Desk.model == 5){
|
||||
this.state = NN_state.robZhuang;
|
||||
}
|
||||
|
||||
for(var i=0;i<data.cards.length;i++){
|
||||
if(this.pList[i] && data.cards[i].length > 0){
|
||||
//if(data.cards[i].length > 0){
|
||||
this.pList[i].cards.cards = [54,54,54,54,54];//54-牌背
|
||||
for(var j=0;j<data.cards[i][0].length;j++){
|
||||
this.pList[i].cards.cards[j] = data.cards[i][0][j];
|
||||
}
|
||||
if(data.cards[i].length > 1){
|
||||
this.pList[i].cards.type = data.cards[i][1];
|
||||
this.pList[i].cards.Multiple = data.cards[i][2];
|
||||
this.pList[i].cards.niu = data.cards[i][3];
|
||||
}
|
||||
//看牌抢庄
|
||||
if(this.model == 4 || this.model == 5){
|
||||
this.pList[i].rubcard[0] = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(data.disorderCards){
|
||||
this.disorderDealCards = data.disorderCards;
|
||||
}
|
||||
|
||||
if(this.model != 4 && this.model != 5){
|
||||
//未下注
|
||||
if(data.noBets && data.noBets.length > 0){
|
||||
for(var i=0;i<data.noBets.length;i++){
|
||||
this.pList[data.noBets[i]].isBet = 1;
|
||||
}
|
||||
}else {
|
||||
for(var i=0;i<this.pList.length;i++){
|
||||
if(this.pList[i] && this.pList[i].isReady && this.pList[i].cards.cards.length == 0){
|
||||
if(this.model_bean[0] != 1 || (this.model_bean[0] == 1 && this.isBeanEnough(i,"bet"))){
|
||||
this.pList[i].isBet = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
NN_Desk.stageTime_loc = (new Date()).getTime();
|
||||
};
|
||||
|
||||
NN_deskInfo.prototype.betScoreAgain = function(data){
|
||||
//下注抢庄玩家第二次下注
|
||||
var seat = data.seat;
|
||||
this.pList[seat].betScoreAgain = data.score2;
|
||||
this.pList[seat].betScore = data.score;
|
||||
this.betAgainList.push(seat);
|
||||
this.pList[seat].isBet = -1;
|
||||
};
|
||||
|
||||
NN_deskInfo.prototype.dealCardsAgain = function(data){
|
||||
this.state = NN_state.dealCard;//状态
|
||||
if(data.cards){
|
||||
for(var i=0;i<data.cards.length;i++){
|
||||
if(this.pList[i] && data.cards[i].length > 0){
|
||||
this.pList[i].cards.cards = [54,54,54,54,54];//54-牌背
|
||||
for(var j=0;j<data.cards[i][0].length;j++){
|
||||
this.pList[i].cards.cards[j] = data.cards[i][0][j];
|
||||
}
|
||||
if(data.cards[i].length > 1){
|
||||
this.pList[i].cards.type = data.cards[i][1];
|
||||
this.pList[i].cards.Multiple = data.cards[i][2];
|
||||
this.pList[i].cards.niu = data.cards[i][3];
|
||||
}
|
||||
}
|
||||
}
|
||||
//this.state = NN_state.rubCard;//搓牌状态
|
||||
}
|
||||
NN_Desk.stageTime_loc = (new Date()).getTime();
|
||||
};
|
||||
|
||||
NN_deskInfo.prototype.rubCard = function(data){
|
||||
//搓牌
|
||||
var seat = data.seat;
|
||||
var loc = data.cardloc; //第几张牌
|
||||
if(this.pList[seat].rubcard.length == 0){
|
||||
this.pList[seat].rubcard[0] = loc;
|
||||
this.pList[seat].cards.cards[loc] = data.card;
|
||||
}else if(this.pList[seat].rubcard.length == 1){
|
||||
if(this.pList[seat].rubcard[0] != loc){
|
||||
this.pList[seat].rubcard[1] = loc;
|
||||
this.pList[seat].cards.cards[loc] = data.card;
|
||||
|
||||
if(data.cards){
|
||||
this.pList[seat].cards.cards = data.cards[0];
|
||||
this.pList[seat].cards.type = data.cards[1];
|
||||
this.pList[seat].cards.Multiple = data.cards[2];
|
||||
this.pList[seat].cards.niu = data.cards[3];
|
||||
}
|
||||
}
|
||||
}
|
||||
if(data.putcard != null){
|
||||
this.pList[seat].putcard = data.putcard;
|
||||
}
|
||||
};
|
||||
|
||||
NN_deskInfo.prototype.putCard = function(data){
|
||||
//摆牌
|
||||
var seat = data.seat;
|
||||
if(this.pList[seat].rubcard.length != 2){
|
||||
this.pList[seat].rubcard = [3,4];
|
||||
}
|
||||
if(this.pList[seat].rubcard.length == 2 && this.pList[seat].putcard <= 0){
|
||||
this.pList[seat].putcard = 1;//摆牌
|
||||
}
|
||||
|
||||
if(seat != NN_Desk.myseat && data.cards){
|
||||
this.pList[seat].cards.cards = data.cards[0];
|
||||
this.pList[seat].cards.type = data.cards[1];
|
||||
this.pList[seat].cards.Multiple = data.cards[2];
|
||||
this.pList[seat].cards.niu = data.cards[3];
|
||||
}
|
||||
};
|
||||
|
||||
NN_deskInfo.prototype.putAllCard = function(data){
|
||||
//摆牌超时所有玩家的牌
|
||||
for(var i=0;i<data.cards.length;i++){
|
||||
if(data.cards[i] && data.cards[i].length > 0){
|
||||
//if(data.cards[i].length > 0){
|
||||
//this.pList[i].rubcard = [3,4];
|
||||
this.pList[i].cards.cards = data.cards[i][0];
|
||||
this.pList[i].cards.type = data.cards[i][1];
|
||||
this.pList[i].cards.Multiple = data.cards[i][2];
|
||||
this.pList[i].cards.niu = data.cards[i][3];
|
||||
//完成搓摆牌
|
||||
this.pList[i].rubcard = [3,4];
|
||||
//this.pList[i].putcard = 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
NN_deskInfo.prototype.settlement = function(data){
|
||||
//结算
|
||||
NN_RevDataRecord.settlement = data;
|
||||
this.state = NN_state.settlement;
|
||||
for(var i=0;i<data.result.length;i++){
|
||||
if(this.pList[i] && data.result[i].length > 0){
|
||||
//if(data.result[i].length > 0){
|
||||
this.pList[i].winScore = data.result[i][0];
|
||||
this.pList[i].scores = data.result[i][1];
|
||||
this.pList[i].bean = data.result[i][2];
|
||||
}
|
||||
}
|
||||
NN_Desk.stageTime_loc = (new Date()).getTime();
|
||||
};
|
||||
|
||||
NN_deskInfo.prototype.gameOver = function(data){
|
||||
//游戏全部结束
|
||||
this.gameoverScores = data.scores;
|
||||
NN_RevDataRecord.gameover = data;
|
||||
this.state = NN_state.over;
|
||||
for(var i=0;i<data.scores.length;i++){
|
||||
this.pList[data.scores[i][0]].scores = data.scores[i][1];
|
||||
}
|
||||
this.records = data.rounds;
|
||||
|
||||
//房主信息
|
||||
if(data.owner){
|
||||
this.owner.seat = data.owner[0];
|
||||
this.owner.name = data.owner[1];
|
||||
this.owner.id = data.owner[2];
|
||||
}
|
||||
//战绩保存本地
|
||||
if(data.gamesRecord && data.gamesRecord.gameinfo1){
|
||||
data.gamesRecord.gameinfo1.round = data.rounds;
|
||||
this.saveLocRecord(data.gamesRecord);
|
||||
}
|
||||
};
|
||||
|
||||
//保存本地战绩
|
||||
NN_deskInfo.prototype.saveLocRecord = function(data){
|
||||
//
|
||||
try{
|
||||
if(data){
|
||||
var _record = {};
|
||||
var temp = [];
|
||||
if(data.createtime && data.createtime.length >= 16){
|
||||
temp = data.createtime.slice(11,data.createtime.length);
|
||||
temp = temp.split(":");
|
||||
_record.createtime = data.createtime.slice(5,10) + " " + temp[0] + ":" + temp[1];
|
||||
}
|
||||
if(data.makewartime && data.makewartime.length >= 16){
|
||||
temp = data.makewartime.slice(11,data.makewartime.length);
|
||||
temp = temp.split(":");
|
||||
_record.makewartime = data.makewartime.slice(5,10) + " " + temp[0] + ":" + temp[1];
|
||||
}
|
||||
//当前时间
|
||||
var _time = new Date();
|
||||
_record.overtime = (_time.getMonth() + 1) + "-" + _time.getDate() + " " + _time.getHours() + ":" + _time.getMinutes();
|
||||
_record.roomcode = data.gameinfo1.roomcode;
|
||||
_record.roomtype = data.roomtype;
|
||||
_record.gameinfo1 = JSON.stringify(data.gameinfo1);
|
||||
//战绩保存本地
|
||||
Utl.saveGradeInfo(_record);
|
||||
}
|
||||
}catch(e){
|
||||
NN_Net.submit_error("保存本地战绩", e.stack + " 数据:" + JSON.stringify(data));
|
||||
}
|
||||
};
|
||||
|
||||
NN_deskInfo.prototype.disbandGame = function(data){
|
||||
//解散房间-游戏结束
|
||||
if(data.isSett == 1){
|
||||
if(typeof(data.putAllCard) != "undefined"){
|
||||
NN_Desk.putAllCard(data.putAllCard);
|
||||
}
|
||||
|
||||
if(typeof(data.settlement) != "undefined"){
|
||||
NN_Desk.settlement(data.settlement);
|
||||
}
|
||||
|
||||
if(typeof(data.gameOver) != "undefined"){
|
||||
NN_Desk.gameOver(data.gameOver);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
NN_deskInfo.prototype.surrender = function(data){
|
||||
//投降
|
||||
//星星场
|
||||
NN_Desk.model_bean[0] = 1;
|
||||
|
||||
NN_setPositionSeat(this.myseat);
|
||||
NN_GameState = NN_State.inGame;
|
||||
NN_soundState = 1; //音效开关
|
||||
NN_Judge.isDisband = -1;
|
||||
NN_RevDataRecord.over = 0;
|
||||
NN_RevDataRecord.dealCards = null;
|
||||
NN_RevDataRecord.settlement = null;
|
||||
NN_RevDataRecord.gameover = null;
|
||||
|
||||
//房主信息
|
||||
if(data.ownerseat != null){
|
||||
this.owner.seat = data.ownerseat;
|
||||
this.owner.name = Utl.getNicknameBySeat(data.ownerseat);
|
||||
this.owner.id = Utl.getPlayeridBySeat(data.ownerseat);
|
||||
}
|
||||
|
||||
//模拟总结算包数据 {"scores":[[0,-4],[1,4]],"rounds":[[[0,-4,0,0,0,0,0,"",1],[1,4,0,0,0,0,0,"",1],[],[],[]]],"owner":[0,"测试15576",100312]}
|
||||
var _data = {
|
||||
scores:[],
|
||||
rounds:[],
|
||||
owner :[]
|
||||
};
|
||||
|
||||
for(var i=0; i<data.players.length; i++){
|
||||
if(data.players[i] != null){
|
||||
this.pList[i] = new NN_playerInfo(i);
|
||||
this.pList[i].scores = data.players[i];
|
||||
_data.scores.push([i, data.players[i]]);
|
||||
}
|
||||
}
|
||||
|
||||
_data.rounds = [_data.scores];
|
||||
_data.owner = [this.owner.seat, this.owner.name, this.owner.id];
|
||||
return _data;
|
||||
};
|
||||
|
||||
NN_deskInfo.prototype.copyGameoverData = function(){
|
||||
//复制总结算数据
|
||||
var str = "";
|
||||
if(NN_Desk.model_bean[0] == 1){
|
||||
str += ("房号:" + Utl.getRoomcode() + "(" + NN_config.beanDes + "场)\n");
|
||||
} else {
|
||||
str += ("房号:" + Utl.getRoomcode() + "\n");
|
||||
}
|
||||
str += ("房主:" + Utl.getNicknameBySeat(this.owner.seat) + "(ID:" + Utl.getPlayeridBySeat(this.owner.seat) + ")\n");
|
||||
str += "战绩:\n";
|
||||
for(var i=0;i<this.pList.length;i++){
|
||||
if(this.pList[i]){
|
||||
str += (" " + this.pList[i].scores + " " + Utl.getNicknameBySeat(i) + "(ID:" + Utl.getPlayeridBySeat(i) + ")\n");
|
||||
}
|
||||
}
|
||||
//调用复制接口
|
||||
Func.gameCopytext(str);
|
||||
//
|
||||
Utl.openTips("复制成功",1000);
|
||||
};
|
||||
|
||||
NN_deskInfo.prototype.trusteeship = function(data){
|
||||
//托管
|
||||
NN_Desk.pList[data.seat].isAuto = data.isAuto;
|
||||
};
|
||||
|
||||
//游戏中桌信息
|
||||
NN_deskInfo.prototype.clearData = function(){
|
||||
//手动清除对象数据
|
||||
this.roomtype = null; //roomtype:总局数+下注上限
|
||||
this.owner = null; //房主信息
|
||||
this.records = null; //历史对战记录
|
||||
this.model_bean = null; //星星模式
|
||||
this.pList = null; //玩家列表
|
||||
this.betList = null; //下注玩家列表
|
||||
this.robList = null; //抢庄列表
|
||||
this.diceList = null; //色子点数列表
|
||||
this.gameoverScores = null;
|
||||
};
|
||||
|
||||
//清除牛牛游戏桌数据
|
||||
NN_Exit_clearData = function(){
|
||||
NN_GameState = NN_State.inHall; //游戏状态
|
||||
|
||||
//清除牛牛游戏相关数据
|
||||
NN_FS = [];
|
||||
NN_SF = [];
|
||||
NN_timeout = -1;
|
||||
NN_RevDataRecord.dealCards = null;
|
||||
NN_RevDataRecord.settlement = null;
|
||||
NN_RevDataRecord.gameover = null;
|
||||
//桌数据
|
||||
if(NN_Desk.clearData){
|
||||
NN_Desk.clearData();
|
||||
}
|
||||
NN_Desk = null;
|
||||
NN_Desk = {};
|
||||
};
|
||||
|
||||
//清除牛牛游戏界面
|
||||
NN_Exit_clearUI = function(){
|
||||
NN_GameState = NN_State.inHall; //游戏状态
|
||||
//清除桌界面
|
||||
if(NN_Desk.model_fast >= 1 || NN_Desk.model == 4 || NN_Desk.model == 5){
|
||||
NN_UIF.hide(); //快版
|
||||
}else{
|
||||
NN_UI.hide(true); //正常
|
||||
}
|
||||
|
||||
//隐藏计算器按钮
|
||||
GameUI.hideCalBtn();
|
||||
//停止结算绘画Draw
|
||||
NN_Draw.settlement = -1;
|
||||
//清除定时器
|
||||
NN_UI.ClearTimeout();
|
||||
NN_UI.setCountDown();
|
||||
//清除游戏音效
|
||||
Func.play_wav("00101.mp3",-1);
|
||||
NN_playSound();
|
||||
};
|
||||
|
||||
//清除桌数据并返回大厅
|
||||
NN_Exit_intoHall = function(){
|
||||
//先清除牛牛游戏界面
|
||||
//NN_Exit_clearUI();
|
||||
//清除牛牛游戏桌数据
|
||||
//NN_Exit_clearData();
|
||||
//返回到大厅
|
||||
Utl.Exit();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
484
codes/games/client/Projects/niuniu/js/niuniu/nn_logic.js
Normal file
484
codes/games/client/Projects/niuniu/js/niuniu/nn_logic.js
Normal file
@@ -0,0 +1,484 @@
|
||||
/*
|
||||
逻辑算法等
|
||||
*/
|
||||
/*
|
||||
扑克牌的统一编码规则:
|
||||
1,牌面花色的定义 5:王 4:黑桃 3:红心 2:梅花 1:方块
|
||||
2,牌面数值的定义 01-A 02-2...09:9 10:10 11:J 12:Q 13:K 98:小王99:大王
|
||||
3,牌编码的定义 3位数字 第一位为牌面花色 第二三位为牌面数值
|
||||
4,大小王的定义 598:小王 599:大王
|
||||
|
||||
101
|
||||
*/
|
||||
|
||||
|
||||
//创建牌局牌
|
||||
function nn_newCards(pairs){
|
||||
function cardinfo (id, flower, val, code, gameval){
|
||||
//单张牌信息
|
||||
var card = {};
|
||||
card.id = id; //绝对id
|
||||
card.flower = flower; //牌面花色
|
||||
card.val = val; //牌面数值
|
||||
card.code = code; //牌编码
|
||||
card.gameval = gameval;//游戏中对应数值
|
||||
return card;
|
||||
};
|
||||
|
||||
if(pairs == null){
|
||||
pairs = 1;
|
||||
}
|
||||
var cards = [];
|
||||
for (var i = 1; i <= pairs; i++) {
|
||||
for (var j = 1; j <= 4; j++) {
|
||||
for (var k = 0; k < 13; k++) {
|
||||
var id = (i - 1) * 54 + (j - 1) * 13 + k;
|
||||
var code = j * 100 + k + 1;
|
||||
var val = k + 1;
|
||||
if(val > 10){
|
||||
val = 10;
|
||||
}
|
||||
var pai = cardinfo(id, j, k + 1, code,val);
|
||||
cards.push(pai);
|
||||
};
|
||||
};
|
||||
//小王
|
||||
var xiao = cardinfo((i - 1) * 54 + 52, 5, 98, 598,10);
|
||||
cards.push(xiao);
|
||||
//大王
|
||||
var da = cardinfo((i - 1) * 54 + 53, 5, 99, 599,10);
|
||||
cards.push(da);
|
||||
};
|
||||
return cards;
|
||||
};
|
||||
|
||||
//玩家手牌信息
|
||||
var NN_cardsInfo = function(_cards){
|
||||
this.cards = _cards;
|
||||
this.type = "";
|
||||
this.Multiple = 0; //牌输赢倍数
|
||||
this.niu = -1; //牛几
|
||||
};
|
||||
|
||||
NN_cardsInfo.prototype.AnalysisType = function(cardlist,type_mult){
|
||||
//分析牌型(cardlist-所有牌,type_mult-倍数类型)
|
||||
if(type_mult == 3){
|
||||
type_mult = 2;
|
||||
}
|
||||
|
||||
var clist = [];
|
||||
var vallist = []; //牌对应数值列表
|
||||
var g_vallist = []; //游戏对应数值列表
|
||||
for(var i=0;i<this.cards.length;i++){
|
||||
clist[i] = cardlist[this.cards[i]];
|
||||
vallist[i] = clist[i].val;
|
||||
g_vallist[i] = clist[i].gameval;
|
||||
}
|
||||
|
||||
//判断类型
|
||||
//炸弹
|
||||
var arr_s = vallist.sort();
|
||||
if((arr_s[0] == arr_s[1] && arr_s[1] == arr_s[2] && arr_s[2] == arr_s[3])
|
||||
||(arr_s[1] == arr_s[2] && arr_s[2] == arr_s[3] && arr_s[3] == arr_s[4])){
|
||||
this.type = "bomb";
|
||||
if(type_mult == 1){
|
||||
this.Multiple = 7;
|
||||
}else if(type_mult == 2){
|
||||
this.Multiple = 13;
|
||||
}
|
||||
return;
|
||||
}
|
||||
//五小
|
||||
if(clist[0].gameval + clist[1].gameval + clist[2].gameval + clist[3].gameval + clist[4].gameval <= 10){
|
||||
this.type = "wx";
|
||||
if(type_mult == 1){
|
||||
this.Multiple = 6;
|
||||
}else if(type_mult == 2){
|
||||
this.Multiple = 12;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//五花牛
|
||||
if(clist[0].val >= 10 && clist[1].val >= 10 && clist[2].val >= 10 && clist[3].val >= 10 && clist[4].val >= 10){
|
||||
this.type = "nmw";
|
||||
if(type_mult == 1){
|
||||
this.Multiple = 5;
|
||||
}else if(type_mult == 2){
|
||||
this.Multiple = 11;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//判断牛几
|
||||
var arr = [0,1,2,3,4];
|
||||
outer:
|
||||
for(var i=0;i<3;i++){
|
||||
for(var j=i+1;j<4;j++){
|
||||
for(var k=j+1;k<=4;k++){
|
||||
if((g_vallist[i] + g_vallist[j] + g_vallist[k])%10 == 0){
|
||||
arr.splice(k,1);
|
||||
arr.splice(j,1);
|
||||
arr.splice(i,1);
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(arr.length == 2){//有牛
|
||||
var a = (g_vallist[arr[0]] + g_vallist[arr[1]])%10;
|
||||
this.type = "n" + a;
|
||||
this.niu = a;
|
||||
if(type_mult == 1){
|
||||
if(a == 0){ //牛牛
|
||||
this.Multiple = 4;
|
||||
this.type = "nn";
|
||||
this.niu = 10;
|
||||
}else if(a == 9){ //牛九
|
||||
this.Multiple = 3;
|
||||
}else if(a == 8){ //牛八
|
||||
this.Multiple = 2;
|
||||
}else { //牛一~牛七
|
||||
this.Multiple = 1;
|
||||
}
|
||||
}else if(type_mult == 2){
|
||||
if(a == 0){ //牛牛
|
||||
this.Multiple = 10;
|
||||
this.type = "nn";
|
||||
this.niu = 10;
|
||||
}else{
|
||||
this.Multiple = a;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}else{//无牛
|
||||
this.type = "wn";
|
||||
this.Multiple = 1;
|
||||
this.niu = 0;
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
function NN_toCardImg(card) {
|
||||
//转换成显示牌的图片对应的帧数
|
||||
if(card == null){//返回牌背面帧数
|
||||
return 55;
|
||||
}else{//返回正面牌帧数
|
||||
return card+1;
|
||||
}
|
||||
};
|
||||
|
||||
function NN_setPositionSeat(myseat) {
|
||||
//设置方位和座位对应转换
|
||||
var a = myseat - 0;
|
||||
for(var i = 0; i < NN_Desk.personMax; i ++){
|
||||
if(i + a < NN_Desk.personMax){
|
||||
NN_FS[i] = i + a;//方位对应座位
|
||||
NN_SF[i + a] = i;//座位对应方位
|
||||
}else {
|
||||
NN_FS[i] = i + a - NN_Desk.personMax;
|
||||
NN_SF[i + a - NN_Desk.personMax] = i;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function getStrLength(str){
|
||||
//获取字符串长度
|
||||
var cArr = str.match(/[^\x00-\xff]/ig);
|
||||
return str.length + (cArr == null ? 0 : cArr.length);
|
||||
};
|
||||
|
||||
|
||||
|
||||
function subString(str, len, hasDot)
|
||||
{
|
||||
var newLength = 0;
|
||||
var newStr = "";
|
||||
var chineseRegex = /[^\x00-\xff]/g;
|
||||
var singleChar = "";
|
||||
var strLength = str.replace(chineseRegex,"**").length;
|
||||
for(var i = 0;i < strLength;i++)
|
||||
{
|
||||
singleChar = str.charAt(i).toString();
|
||||
if(singleChar.match(chineseRegex) != null)
|
||||
{
|
||||
newLength += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
newLength++;
|
||||
}
|
||||
if(newLength > len)
|
||||
{
|
||||
break;
|
||||
}
|
||||
newStr += singleChar;
|
||||
}
|
||||
|
||||
if(hasDot && strLength > len)
|
||||
{
|
||||
newStr += "...";
|
||||
}
|
||||
return newStr;
|
||||
}
|
||||
|
||||
function NN_playSound(wav_type,play_type,sex,wait_time){
|
||||
//播放音效
|
||||
if(wav_type != null){
|
||||
if(Utl.ReadData(Utl.Config.sound) != 1){return;}
|
||||
if(play_type == null){
|
||||
play_type = 0;
|
||||
}
|
||||
if(sex == null){
|
||||
sex = 1;
|
||||
}
|
||||
if(wait_time == null){
|
||||
wait_time = 0;
|
||||
}
|
||||
var sound = "";
|
||||
switch (wav_type){
|
||||
case "bgm"://游戏背景音
|
||||
sound = "00101.mp3";
|
||||
break;
|
||||
case "ksyx"://开始游戏
|
||||
sound = "00102.mp3";
|
||||
break;
|
||||
case "buttom"://按钮
|
||||
sound = "00051.mp3";
|
||||
break;
|
||||
case "xz"://下注
|
||||
sound = "00145.mp3";
|
||||
break;
|
||||
case "djj"://第几局
|
||||
sound = "00103.mp3";
|
||||
break;
|
||||
case "dz"://倒桩
|
||||
sound = "00104.mp3";
|
||||
break;
|
||||
case "ysz"://摇色子
|
||||
sound = "00105.mp3";
|
||||
break;
|
||||
case "fp"://发牌
|
||||
sound = "00106.mp3";
|
||||
break;
|
||||
case "jb"://金币
|
||||
sound = "00107.mp3";
|
||||
break;
|
||||
case "js"://结算
|
||||
sound = "00108.mp3";
|
||||
break;
|
||||
case "sl"://胜利
|
||||
sound = "00109.mp3";
|
||||
break;
|
||||
case "sb"://失败
|
||||
sound = "00110.mp3";
|
||||
break;
|
||||
case "wn"://无牛
|
||||
if(sex == 2){
|
||||
sound = "00125.mp3";
|
||||
}else {
|
||||
sound = "00111.mp3";
|
||||
}
|
||||
break;
|
||||
case "n1"://牛1
|
||||
if(sex == 2){
|
||||
sound = "00126.mp3";
|
||||
} else {
|
||||
sound = "00112.mp3";
|
||||
}
|
||||
break;
|
||||
case "n2"://牛2
|
||||
if(sex == 2){
|
||||
sound = "00127.mp3";
|
||||
} else {
|
||||
sound = "00113.mp3";
|
||||
}
|
||||
break;
|
||||
case "n3"://牛3
|
||||
if(sex == 2){
|
||||
sound = "00128.mp3";
|
||||
} else {
|
||||
sound = "00114.mp3";
|
||||
}
|
||||
break;v
|
||||
case "n4"://牛4
|
||||
if(sex == 2){
|
||||
sound = "00129.mp3";
|
||||
} else {
|
||||
sound = "00115.mp3";
|
||||
}
|
||||
break;
|
||||
case "n5"://牛5
|
||||
if(sex == 2){
|
||||
sound = "00130.mp3";
|
||||
} else {
|
||||
sound = "00116.mp3";
|
||||
}
|
||||
break;
|
||||
case "n6"://牛6
|
||||
if(sex == 2){
|
||||
sound = "00131.mp3";
|
||||
} else {
|
||||
sound = "00117.mp3";
|
||||
}
|
||||
break;
|
||||
case "n7"://牛7
|
||||
if(sex == 2){
|
||||
sound = "00132.mp3";
|
||||
} else {
|
||||
sound = "00118.mp3";
|
||||
}
|
||||
break;
|
||||
case "n8"://牛8
|
||||
if(sex == 2){
|
||||
sound = "00133.mp3";
|
||||
} else {
|
||||
sound = "00119.mp3";
|
||||
}
|
||||
break;
|
||||
case "n9"://牛9
|
||||
if(sex == 2){
|
||||
sound = "00134.mp3";
|
||||
} else {
|
||||
sound = "00120.mp3";
|
||||
}
|
||||
break;
|
||||
case "nn"://牛牛
|
||||
if(sex == 2){
|
||||
sound = "00135.mp3";
|
||||
} else {
|
||||
sound = "00121.mp3";
|
||||
}
|
||||
break;
|
||||
case "shunzi": //顺子
|
||||
if(sex == 2){
|
||||
sound = "00157.mp3";
|
||||
} else {
|
||||
sound = "00152.mp3";
|
||||
}
|
||||
break;
|
||||
case "tonghua": //同花
|
||||
if(sex == 2){
|
||||
sound = "00158.mp3";
|
||||
} else {
|
||||
sound = "00153.mp3";
|
||||
}
|
||||
break;
|
||||
case "hulu": //葫芦
|
||||
if(sex == 2){
|
||||
sound = "00156.mp3";
|
||||
} else {
|
||||
sound = "00151.mp3";
|
||||
}
|
||||
break;
|
||||
case "wuxiao": //五小牛
|
||||
if(sex == 2){
|
||||
sound = "00137.mp3";
|
||||
} else {
|
||||
sound = "00123.mp3";
|
||||
}
|
||||
break;
|
||||
case "wuhua": //五花牛
|
||||
if(sex == 2){
|
||||
sound = "00136.mp3";
|
||||
} else {
|
||||
sound = "00122.mp3";
|
||||
}
|
||||
break;
|
||||
case "bomb": //炸弹
|
||||
if(sex == 2){
|
||||
sound = "00138.mp3";
|
||||
} else {
|
||||
sound = "00124.mp3";
|
||||
}
|
||||
break;
|
||||
case "flush": //同花顺
|
||||
if(sex == 2){
|
||||
sound = "00159.mp3";
|
||||
} else {
|
||||
sound = "00154.mp3";
|
||||
}
|
||||
break;
|
||||
case "bigbomb": //五炸
|
||||
sound = "00155.mp3";
|
||||
break;
|
||||
case "qdz": //确定庄
|
||||
sound = "00139.mp3";
|
||||
break;
|
||||
case "xp": //洗牌
|
||||
sound = "00140.mp3";
|
||||
break;
|
||||
case "hd_zd": //炸弹
|
||||
sound = "00141.mp3";
|
||||
break;
|
||||
case "hd_pb": //碰杯
|
||||
sound = "00142.mp3";
|
||||
break;
|
||||
case "hd_xh": //鲜花
|
||||
sound = "00143.mp3";
|
||||
break;
|
||||
case "hd_zj"://抓鸡
|
||||
sound = "00144.mp3";
|
||||
break;
|
||||
case "rob": //抢
|
||||
if(sex == 2){
|
||||
sound = "00148.mp3";
|
||||
} else {
|
||||
sound = "00146.mp3";
|
||||
}
|
||||
break;
|
||||
case "norob"://不抢
|
||||
if(sex == 2){
|
||||
sound = "00149.mp3";
|
||||
} else {
|
||||
sound = "00147.mp3";
|
||||
}
|
||||
break;
|
||||
case "typeReward"://不抢
|
||||
sound = "00150.mp3";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(!Utl.isMainScene() || sound == ""){
|
||||
return;
|
||||
}
|
||||
if(wait_time > 0){
|
||||
window.setTimeout(function(){
|
||||
Func.play_wav(sound,play_type);
|
||||
},wait_time);
|
||||
}else {
|
||||
Func.play_wav(sound,play_type);
|
||||
}
|
||||
}else{
|
||||
//关闭音效
|
||||
for(var i=102;i<=149;i++){
|
||||
Func.play_wav("00"+i+".mp3",-1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function uaredirect(murl){
|
||||
//
|
||||
try{
|
||||
if(document.getElementById("bdmark") != null) {
|
||||
return
|
||||
}
|
||||
var urlhash = window.location.hash;
|
||||
if(!urlhash.match("fromapp")){
|
||||
if((navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i))){
|
||||
location.replace(murl);
|
||||
}
|
||||
}
|
||||
}catch(err){}
|
||||
}
|
||||
//uaredirect("http://m.5ixuexiwang.com/");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
42
codes/games/client/Projects/niuniu/js/niuniu/nn_main.js
Normal file
42
codes/games/client/Projects/niuniu/js/niuniu/nn_main.js
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
主流程操作
|
||||
*/
|
||||
|
||||
function NN_game_start (){
|
||||
//游戏开始操作
|
||||
NN_UI.hide(true);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
589
codes/games/client/Projects/niuniu/js/niuniu/nn_net.js
Normal file
589
codes/games/client/Projects/niuniu/js/niuniu/nn_net.js
Normal file
@@ -0,0 +1,589 @@
|
||||
/*
|
||||
网络
|
||||
*/
|
||||
var NN_Net = new Object();
|
||||
NN_Net.ws_tcp = null;
|
||||
//var NN_SendData = new Object();
|
||||
var ReadData = new Object();
|
||||
NN_Net.TcpMessage=function(tcpid,msg){//收Tcp包,解析
|
||||
var str = msg;
|
||||
var inx=str.indexOf(":");
|
||||
if (inx>0){
|
||||
var tou = str.substr(0,inx);//包头
|
||||
if (tou == "@toconcon") {
|
||||
NN_Net.OnConnect(t);//链接成功
|
||||
return;
|
||||
}
|
||||
}
|
||||
str = unescape(str);//解码
|
||||
//NN_Net.RevData(str);//处理实际数据
|
||||
var msg1 = JSON.parse(str);
|
||||
NN_Net.DoPack(msg1);
|
||||
};
|
||||
|
||||
NN_Net.TcpLogin=function(){//Tcp链接服务器
|
||||
//ifast_tcp_open(0,"127.0.0.1:5414");
|
||||
//ifast_tcp_open(0,"120.25.60.74:5411");
|
||||
};
|
||||
|
||||
NN_Net.OnConnect = function(){
|
||||
//链接成功
|
||||
|
||||
};
|
||||
|
||||
NN_Net.DoPack = function(msg){
|
||||
//收包处理
|
||||
// console.log("收到数据:"+JSON.stringify(msg));
|
||||
if(typeof(msg) == "string"){
|
||||
msg = JSON.parse(msg);
|
||||
}
|
||||
if(NN_Net.ExitsFunction(NN_RevData[msg.rpc])){
|
||||
//try{
|
||||
NN_RevData[msg.rpc](msg.data);
|
||||
//}catch(e){
|
||||
//alert("bug:"+e+"\n数据:"+msg.data);
|
||||
//}
|
||||
//普通房间准备按钮刷新显示
|
||||
if(Utl.getIsInfinite() != 1){
|
||||
GameUI.showReady();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
NN_Net.ExitsFunction = function(funcName){
|
||||
//判断函数名是否有效
|
||||
try{
|
||||
if (typeof(eval(funcName)) == "function"){
|
||||
return true;
|
||||
}
|
||||
}catch(error){}
|
||||
return false;
|
||||
};
|
||||
|
||||
/*
|
||||
*发送数据包
|
||||
*/
|
||||
NN_Net.SendGameData = function(_rpc,_data){
|
||||
//游戏中发送游戏桌包
|
||||
if(_data == null){
|
||||
_data = {};
|
||||
}
|
||||
var msg = {
|
||||
app:"youle",
|
||||
route:"niuniu",
|
||||
rpc:_rpc,
|
||||
data:_data
|
||||
}
|
||||
msg.data.seat = NN_Desk.myseat;
|
||||
msg.data.pid = Utl.getMyPlayerid();
|
||||
//msg.data.openid = Utl.getMyOpenid();
|
||||
msg.data.room = {
|
||||
agentid:Utl.getAgentID(),
|
||||
gameid:Utl.getGameID(),
|
||||
roomcode:Utl.getRoomcode()
|
||||
};
|
||||
var str = JSON.stringify(msg);
|
||||
//console.log("发网络包:"+str);
|
||||
// str = escape(str);
|
||||
// ifast_tcp_send(0,str);
|
||||
Net.ws_tcp.send(str);
|
||||
};
|
||||
|
||||
NN_Net.SendData = function(data){
|
||||
//发送数据包
|
||||
var str = JSON.stringify(data);
|
||||
if(NN_GameModel == 0){//单机处理
|
||||
|
||||
}else{//网络发包
|
||||
//console.log("发网络包:"+str);
|
||||
//str = escape(str);
|
||||
// ifast_tcp_send(0,str);
|
||||
Net.ws_tcp.send(str);
|
||||
}
|
||||
};
|
||||
|
||||
NN_Net.submit_error = function(_packet,_msg){
|
||||
//提交错误
|
||||
if(NN_errorMsg != _msg){
|
||||
NN_errorMsg = _msg;
|
||||
}else {
|
||||
return;
|
||||
}
|
||||
var msg = {
|
||||
app:"youle",
|
||||
route:"agent",
|
||||
rpc:"submit_error",
|
||||
data:{
|
||||
packet:_packet,
|
||||
msg:_msg,
|
||||
playerid:Utl.getMyPlayerid(),
|
||||
agentid:Utl.getAgentID(),
|
||||
gameid:Utl.getGameID()
|
||||
}
|
||||
}
|
||||
try{
|
||||
Net.ws_tcp.send(JSON.stringify(msg));
|
||||
}catch(e){}
|
||||
};
|
||||
|
||||
//游戏发包
|
||||
var NN_SendData = {};
|
||||
NN_SendData.startWar = function(){
|
||||
//房主开始游戏
|
||||
NN_Net.SendGameData("startWar");
|
||||
////console.log("发送房主开始数据");
|
||||
};
|
||||
NN_SendData.robZhuang = function(isrob){
|
||||
//抢庄
|
||||
var data = {
|
||||
isrob:isrob
|
||||
};
|
||||
NN_Net.SendGameData("robZhuang",data);
|
||||
////console.log("抢庄:"+isrob);
|
||||
};
|
||||
|
||||
NN_SendData.betScore = function(_score){
|
||||
//下注
|
||||
var data = {
|
||||
score:_score
|
||||
};
|
||||
if(NN_Desk.model == 5 && NN_Desk.zhuang >= 0){
|
||||
if(NN_Desk.pList[NN_Desk.myseat].cards.cards.length > 0){
|
||||
NN_Net.SendGameData("betScoreAgain",data);
|
||||
}
|
||||
}else {
|
||||
NN_Net.SendGameData("betScore",data);
|
||||
}
|
||||
////console.log("下注");
|
||||
};
|
||||
|
||||
NN_SendData.rubCard = function(_cardloc){
|
||||
//搓牌
|
||||
var data = {
|
||||
cardloc:_cardloc
|
||||
};
|
||||
NN_Net.SendGameData("rubCard",data);
|
||||
////console.log("搓牌");
|
||||
};
|
||||
|
||||
NN_SendData.putCard = function(){
|
||||
//摆牌确认
|
||||
NN_Net.SendGameData("putCard");
|
||||
////console.log("摆牌确认");
|
||||
};
|
||||
|
||||
NN_SendData.trusteeship = function(_isAuto){
|
||||
//托管
|
||||
var data = {};
|
||||
if(_isAuto == 1){
|
||||
//托管
|
||||
data.isAuto = 1; //托管状态
|
||||
data.betModel = NN_Desk.model_bet; //下注模式
|
||||
data.mode = NN_config.auto.mode; //托管模式
|
||||
if(NN_Desk.model_fast >= 1){
|
||||
data.toTime = NN_config.auto.fast_toTime; //定时延迟操作时间
|
||||
}
|
||||
//data.toTime = NN_config.auto.toTime; //定时延迟操作时间
|
||||
|
||||
data.robZhuang = NN_config.auto.robZhuang; //抢庄0-未操作,1-抢庄,-1-不抢
|
||||
data.betScore = NN_config.auto.betScore; //下注分数
|
||||
}else {
|
||||
//取消托管
|
||||
data.isAuto = -1; //托管状态
|
||||
}
|
||||
|
||||
NN_Net.SendGameData("trusteeship",data);
|
||||
//console.log("发送托管包");
|
||||
};
|
||||
|
||||
/*
|
||||
//游戏收包
|
||||
*/
|
||||
|
||||
var NN_RevData = {};
|
||||
//提示
|
||||
NN_RevData.tips = function(data){
|
||||
if(NN_Desk.personMax == 10){
|
||||
NN_UIP.show.tips(data.tips);
|
||||
}else {
|
||||
NN_UIF.show.tips(data.tips);
|
||||
}
|
||||
};
|
||||
|
||||
//准备阶段
|
||||
NN_RevData.readyStage = function(data){
|
||||
if(Utl.getIsInfinite() == 1){
|
||||
NN_Desk.readyStage(data);
|
||||
NN_UI.time_start = (new Date()).getTime();
|
||||
//显示
|
||||
if(NN_Desk.personMax == 10){
|
||||
NN_UIP.net.readyStage();
|
||||
}else {
|
||||
NN_UIF.net.readyStage();
|
||||
}
|
||||
//隐藏无序发牌
|
||||
NN_UIF.disorderDeal.show();
|
||||
}
|
||||
};
|
||||
|
||||
//玩家准备
|
||||
NN_RevData.playerReady = function(data){
|
||||
if(Utl.getIsInfinite() == 1){
|
||||
if(data.isReady){
|
||||
Utl.setPlayerPrepare(data.seat, 1);
|
||||
NN_Desk.pList[data.seat].isReady = 1; //玩家准备状态
|
||||
}else if(data.seat == NN_Desk.myseat){//准备失败-提示星星不足
|
||||
Utl.openTips("你的" + NN_config.beanDes + "数不足哦",2000);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
NN_RevData.firstStartWar = function(data){
|
||||
//第一次开战
|
||||
if(data.deskwar){
|
||||
NN_Desk = new NN_deskInfo();
|
||||
if(data.deskwar.deskdata){
|
||||
NN_Desk.initData_net(data.deskwar.deskdata);
|
||||
}
|
||||
if(data.deskwar.startwar){
|
||||
NN_RevData.startWar(data.deskwar.startwar);
|
||||
}else if(data.deskwar.readyStage){
|
||||
//准备阶段
|
||||
NN_RevData.readyStage(data.deskwar.readyStage);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
NN_RevData.other_join_room = function(data){
|
||||
//其他人进入房间
|
||||
};
|
||||
|
||||
NN_RevData.startWar = function(data){
|
||||
//开始游戏
|
||||
var _zhuang = NN_Desk.zhuang;
|
||||
NN_Desk.startWar(data);
|
||||
if(data.startType == 3 && data.ramZhuang){
|
||||
NN_Desk.okZhuang(data.ramZhuang);
|
||||
}
|
||||
NN_UI.time_start = (new Date()).getTime();
|
||||
//显示
|
||||
if(NN_Desk.model_fast < 1 && NN_Desk.model != 4 && NN_Desk.model != 5){
|
||||
NN_UI.startWar(data.startType,_zhuang,data);
|
||||
}else if(NN_Desk.personMax == 10){ //10快版
|
||||
NN_UIP.net.startWar(data.startType, _zhuang, data);
|
||||
}else {
|
||||
NN_UIF.net.startWar(data.startType, _zhuang, data);
|
||||
}
|
||||
//判断自己星星数,不够提示
|
||||
if(NN_Desk.model_bean[0] == 1 && !NN_Desk.isBeanEnough(NN_Desk.myseat,"bet")){
|
||||
Utl.openTips(NN_config.beanDes + "数不够哦",2000);
|
||||
}
|
||||
if(data.isPass){
|
||||
Utl.openTips("有玩家" + NN_config.beanDes + "数不足,跳过轮庄",2000);
|
||||
}
|
||||
//已准备玩家隐藏按钮
|
||||
if(Utl.getIsInfinite() == 1 && Utl.getPlayerReadyState(NN_Desk.myseat)){
|
||||
Utl.closeMainSceneButton();
|
||||
}
|
||||
//无序发牌
|
||||
NN_UIF.disorderDeal.show();
|
||||
};
|
||||
|
||||
NN_RevData.robZhuang = function(data){
|
||||
//抢庄
|
||||
NN_Desk.robZhuang(data);
|
||||
//显示
|
||||
NN_UI.playerState_leave(data.seat,false);
|
||||
if(NN_Desk.model_fast < 1 && NN_Desk.model != 4 && NN_Desk.model != 5){
|
||||
NN_UI.robZhuang(data.seat,data.isrob,1);
|
||||
}else if(NN_Desk.personMax == 10){
|
||||
NN_UIP.net.robZhuang(data.seat,data.isrob);
|
||||
}else {
|
||||
NN_UIF.net.robZhuang(data.seat,data.isrob);
|
||||
}
|
||||
if(data.seat == NN_Desk.myseat && data.isTips && data.isTips == "noBean"){
|
||||
Utl.openTips("抢庄失败,"+ NN_config.beanDes +"数不够哦",1500);
|
||||
}
|
||||
};
|
||||
|
||||
NN_RevData.okZhuang = function(data){
|
||||
//console.log("确定庄 收包时差:" + ((new Date()).getTime() - NN_UI.time_start));
|
||||
//确定庄
|
||||
NN_Desk.okZhuang(data);
|
||||
//显示
|
||||
//隐藏抢庄按钮
|
||||
set_self(706,37,0,0,0);
|
||||
set_self(707,37,0,0,0);
|
||||
NN_UI.setCountDown();
|
||||
|
||||
NN_UI.time_start = (new Date()).getTime();
|
||||
if(NN_Desk.model_fast < 1 && NN_Desk.model != 4 && NN_Desk.model != 5){
|
||||
NN_TO.okZhuang.t0 = window.setTimeout(function(){
|
||||
NN_TO.okZhuang.t0 = -1;
|
||||
if(NN_timeout != 1){return;}
|
||||
|
||||
NN_Desk.state = NN_state.bet;
|
||||
NN_UI.okZhuang();
|
||||
},1000);
|
||||
}else if(NN_Desk.personMax == 10){
|
||||
NN_UIP.net.okZhuang(data);
|
||||
}else {
|
||||
NN_UIF.net.okZhuang(data);
|
||||
}
|
||||
};
|
||||
|
||||
NN_RevData.betScore = function(data){
|
||||
//console.log("玩家下注 收包时差:" + ((new Date()).getTime() - NN_UI.time_start));
|
||||
//下注
|
||||
NN_Desk.betScore(data);
|
||||
//显示
|
||||
NN_UI.playerState_leave(data.seat,false);
|
||||
if(NN_Judge.isVibrator == 1){
|
||||
//取消震动
|
||||
Func.canclevibrator();
|
||||
NN_Judge.isVibrator = -1;
|
||||
}
|
||||
//if(NN_Desk.model_fast < 1 && NN_Desk.model != 4 && NN_Desk.model != 5){
|
||||
//if(NN_Judge.isOkZhuang != 1){
|
||||
//NN_UI.betScore(data.seat,data.score,1);
|
||||
//}
|
||||
//if(data.seat == NN_Desk.myseat){
|
||||
//NN_UI.betScoreButton(false);
|
||||
//}
|
||||
//}else{
|
||||
if(NN_Desk.personMax == 10){
|
||||
NN_UIP.net.betScore(data.seat,data.score);
|
||||
}else {
|
||||
NN_UIF.net.betScore(data.seat,data.score);
|
||||
}
|
||||
//}
|
||||
|
||||
if(data.seat == NN_Desk.myseat && data.isTips && data.isTips == "noBean" && NN_Desk.model != 5){
|
||||
Utl.openTips("下注失败,"+ NN_config.beanDes +"数不够哦",1500);
|
||||
}
|
||||
};
|
||||
|
||||
NN_RevData.dealCards = function(data){
|
||||
//console.log("发牌 收包时差:" + ((new Date()).getTime() - NN_UI.time_start));
|
||||
//发牌
|
||||
NN_Desk.dealCards(data);
|
||||
|
||||
//显示
|
||||
//隐藏倒计时、提示、下注栏
|
||||
NN_UI.setCountDown();
|
||||
NN_Tips.words();
|
||||
NN_UI.betScoreButton_anim(false);
|
||||
//
|
||||
|
||||
NN_UI.time_start = (new Date()).getTime();
|
||||
if(NN_Desk.model_fast < 1 && NN_Desk.model != 4 && NN_Desk.model != 5){
|
||||
NN_TO.dealCards.t0 = window.setTimeout(function(){
|
||||
NN_TO.dealCards.t0 = -1;
|
||||
if(NN_timeout != 1){return;}
|
||||
|
||||
NN_UI.dealCards(data.dice,data.dealorder);
|
||||
NN_Desk.state = NN_state.rubCard;
|
||||
},1000);
|
||||
}else if(NN_Desk.personMax == 10){
|
||||
NN_UIP.net.dealCards(data.dice, data.dealorder);
|
||||
}else {
|
||||
NN_UIF.net.dealCards(data.dice, data.dealorder);
|
||||
}
|
||||
//取消震动
|
||||
if(NN_Judge.isVibrator == 1){
|
||||
Func.canclevibrator();
|
||||
NN_Judge.isVibrator = -1;
|
||||
}
|
||||
};
|
||||
|
||||
NN_RevData.betScoreAgain = function(data){
|
||||
//下注抢庄第二次下注
|
||||
NN_Desk.betScoreAgain(data);
|
||||
//显示
|
||||
if(NN_Judge.isVibrator == 1){
|
||||
//取消震动
|
||||
Func.canclevibrator();
|
||||
NN_Judge.isVibrator = -1;
|
||||
}
|
||||
if(NN_Desk.personMax == 10){
|
||||
NN_UIP.net.betScore(data.seat, data.score, data.score2);
|
||||
}else {
|
||||
NN_UIF.net.betScore(data.seat, data.score, data.score2);
|
||||
}
|
||||
};
|
||||
|
||||
NN_RevData.dealCardsAgain = function(data){
|
||||
//下注抢庄第二次下注后发牌
|
||||
//console.log("发牌 收包时差:" + ((new Date()).getTime() - NN_UI.time_start));
|
||||
//发牌
|
||||
NN_Desk.dealCardsAgain(data);
|
||||
//显示
|
||||
//隐藏倒计时、提示、下注栏
|
||||
NN_UI.setCountDown();
|
||||
NN_Tips.words();
|
||||
NN_UI.betScoreButton_anim(false);
|
||||
//
|
||||
if(NN_Desk.personMax == 10){
|
||||
NN_UIP.net.dealCards([],data.dealorder);
|
||||
}else {
|
||||
NN_UIF.net.dealCards([],data.dealorder);
|
||||
}
|
||||
//取消震动
|
||||
if(NN_Judge.isVibrator == 1){
|
||||
Func.canclevibrator();
|
||||
NN_Judge.isVibrator = -1;
|
||||
}
|
||||
|
||||
NN_UI.time_start = (new Date()).getTime();
|
||||
};
|
||||
|
||||
NN_RevData.rubCard = function(data){
|
||||
//搓牌
|
||||
if(NN_Desk.pList[data.seat].rubcard.length < 2 && (data.seat != NN_Desk.myseat || (data.seat == NN_Desk.myseat && NN_Desk.pList[data.seat].isAuto == 1))){
|
||||
NN_Desk.rubCard(data);
|
||||
//显示
|
||||
if(NN_Desk.model_fast < 1 && NN_Desk.model != 4 && NN_Desk.model != 5){
|
||||
if(NN_Judge.isDealCards != 1 ){//判断是否发牌中
|
||||
NN_UI.rubCard(data.seat,data.cardloc,data.card);
|
||||
}
|
||||
}else if(NN_Desk.personMax == 10){
|
||||
NN_UIP.net.rubCard(data.seat, data.cardloc, data.card);
|
||||
} else {
|
||||
NN_UIF.net.rubCard(data.seat, data.cardloc, data.card);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
NN_RevData.putCard = function(data){
|
||||
//摆牌
|
||||
NN_Desk.putCard(data);
|
||||
//显示
|
||||
if(NN_Desk.model_fast < 1 && NN_Desk.model != 4 && NN_Desk.model != 5){
|
||||
if(NN_Judge.isDealCards != 1){//判断是否发牌中
|
||||
NN_UI.putCard_player(data.seat,1,true);
|
||||
}
|
||||
}else if(NN_Desk.personMax == 10){
|
||||
NN_UIP.net.putCard(data.seat);
|
||||
} else {
|
||||
NN_UIF.net.putCard(data.seat);
|
||||
}
|
||||
};
|
||||
|
||||
NN_RevData.putAllCard = function(data){
|
||||
//console.log("搓摆牌 收包时差:" + ((new Date()).getTime() - NN_UI.time_start));
|
||||
//显示出玩家全部牌型
|
||||
NN_Desk.putAllCard(data);
|
||||
//显示
|
||||
if(NN_Desk.model_fast < 1 && NN_Desk.model != 4 && NN_Desk.model != 5){
|
||||
NN_UI.putAllCard(1);
|
||||
}else if(NN_Desk.personMax == 10){
|
||||
NN_UIP.net.putAllCard();
|
||||
} else {
|
||||
NN_UIF.net.putAllCard();
|
||||
}
|
||||
};
|
||||
|
||||
NN_RevData.settlement = function(data){
|
||||
//每局-结算
|
||||
NN_Desk.settlement(data);
|
||||
//显示
|
||||
NN_UI.time_start = (new Date()).getTime();
|
||||
|
||||
if(NN_Desk.model_fast < 1 && NN_Desk.model != 4 && NN_Desk.model != 5){
|
||||
NN_TO.settlement.t0 = window.setTimeout(function(){
|
||||
NN_TO.settlement.t0 = -1;
|
||||
if(NN_timeout != 1){return;}
|
||||
|
||||
NN_UI.settlement(data.result, true);
|
||||
},3000);
|
||||
}else if(NN_Desk.personMax == 10){
|
||||
NN_UIP.net.settlement(data.result);
|
||||
} else {
|
||||
NN_UIF.net.settlement(data.result);
|
||||
}
|
||||
//提示自己星星数不足
|
||||
if(data.noBeanList && data.noBeanList.length > 0){
|
||||
for(var i=0;i<data.noBeanList.length;i++){
|
||||
if(data.noBeanList[i] == NN_Desk.myseat){
|
||||
Utl.openTips("庄家"+ NN_config.beanDes +"数不够哦",3000);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
NN_RevData.gameOver = function(data){
|
||||
//游戏结束-总
|
||||
NN_Desk.gameOver(data);
|
||||
NN_RevDataRecord.gameover = data;
|
||||
//显示
|
||||
var bigWiner = -1;
|
||||
if(NN_Desk.model_fast < 1 && NN_Desk.model != 4 && NN_Desk.model != 5){
|
||||
bigWiner = NN_UI.gameOver(data.scores,data.rounds,1);
|
||||
//大赢家调用接口
|
||||
if(bigWiner == 1){
|
||||
Utl.typeForActivity(1,null);
|
||||
}
|
||||
}else if(NN_Desk.personMax == 10){
|
||||
NN_UIP.net.gameOver(data.scores,data.rounds);
|
||||
} else {
|
||||
NN_UIF.net.gameOver(data.scores,data.rounds);
|
||||
}
|
||||
|
||||
//星星场出现负分提示
|
||||
if(data.isAdvance){
|
||||
Utl.openTips("玩家"+ NN_config.beanDes +"数不足,游戏提前结束",0);
|
||||
}
|
||||
};
|
||||
|
||||
NN_RevData.disbandGame = function(data){
|
||||
//游戏结束-解散房间
|
||||
NN_Desk.disbandGame(data);
|
||||
//显示
|
||||
if(NN_Desk.model_fast < 1 && NN_Desk.model != 4 && NN_Desk.model != 5){
|
||||
NN_UI.disbandGame(data);
|
||||
}else if(NN_Desk.personMax == 10){
|
||||
NN_UIP.net.disbandGame(data);
|
||||
} else {
|
||||
NN_UIF.net.disbandGame(data);
|
||||
}
|
||||
};
|
||||
|
||||
NN_RevData.surrender = function(data){
|
||||
//投降
|
||||
if(NN_Desk && NN_Desk.state != null){
|
||||
NN_Desk = null;
|
||||
}
|
||||
NN_Desk = new NN_deskInfo();
|
||||
var _data = NN_Desk.surrender(data);
|
||||
//模拟收到总结算包
|
||||
NN_RevData.gameOver(_data);
|
||||
};
|
||||
|
||||
NN_RevData.trusteeship = function(data){
|
||||
//托管
|
||||
NN_Desk.trusteeship(data);
|
||||
//显示
|
||||
if(data.isAuto == 1){
|
||||
//隐藏托管确认框
|
||||
NN_UI.trusteeship(false);
|
||||
}
|
||||
//托管状态显示并提示
|
||||
NN_UI.trusteeshipState(true,true,data.seat);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
429
codes/games/client/Projects/niuniu/js/niuniu/nn_test.js
Normal file
429
codes/games/client/Projects/niuniu/js/niuniu/nn_test.js
Normal file
@@ -0,0 +1,429 @@
|
||||
/*
|
||||
测试用
|
||||
*/
|
||||
//|| (Utl.getIsInfinite() == 1 && Utl.getPlayerReadyState(NN_Desk.myseat) != 1)
|
||||
|
||||
|
||||
//测试
|
||||
var Test = Test || {};
|
||||
//测试数据
|
||||
Test.data = {
|
||||
roundResult: [],
|
||||
roundScores: [],
|
||||
totalScores: [],
|
||||
};
|
||||
|
||||
Test.addScoreData = function(round, seat, score){
|
||||
//添加回合分数
|
||||
if(!this.data.roundScores[round]){
|
||||
this.data.roundScores[round] = [];
|
||||
}
|
||||
this.data.roundScores[round][seat] = score;
|
||||
//统计玩家总分数
|
||||
if(!this.data.totalScores[seat]){
|
||||
this.data.totalScores[seat] = 0;
|
||||
}
|
||||
this.data.totalScores[seat] += score;
|
||||
};
|
||||
//
|
||||
Test.logDataString = function(){
|
||||
for(var sx in this.data){
|
||||
console.log( sx + " = " + JSON.stringify(this.data[sx]));
|
||||
}
|
||||
};
|
||||
|
||||
Test.AnalysisData = function(roundNum, roundNumMax, sysCutPercent){
|
||||
//有效局数
|
||||
var rCount = Math.floor(Test.data.roundScores.length / roundNum);
|
||||
if(roundNumMax < rCount){
|
||||
rCount = roundNumMax;
|
||||
}
|
||||
console.log("有效"+ roundNum +"局数:" + rCount);
|
||||
//统计每局玩家最后输赢分数
|
||||
var pScores = [];
|
||||
var sysCutScore = 0;
|
||||
var arr = [];
|
||||
for(var i=0;i<rCount;i++){
|
||||
pScores[i] = [0,0,0,0,0];
|
||||
for(var j=0;j<roundNum;j++){
|
||||
pScores[i][0] += Test.data.roundScores[i*roundNum + j][0];
|
||||
pScores[i][1] += Test.data.roundScores[i*roundNum + j][1];
|
||||
pScores[i][2] += Test.data.roundScores[i*roundNum + j][2];
|
||||
pScores[i][3] += Test.data.roundScores[i*roundNum + j][3];
|
||||
pScores[i][4] += Test.data.roundScores[i*roundNum + j][4];
|
||||
}
|
||||
arr = pScores[i].slice();
|
||||
arr.sort(function(a,b){return a<b?1:0;});
|
||||
sysCutScore += Math.floor(arr[0] * sysCutPercent);
|
||||
}
|
||||
console.log("局数对应每局玩家输赢分数:" + JSON.stringify(pScores));
|
||||
//
|
||||
console.log("抽成:" + sysCutScore);
|
||||
};
|
||||
|
||||
|
||||
Test.judge = {
|
||||
triggerMode : [3,1,3], //触发自动出牌模式参数
|
||||
times_click0 : 0,
|
||||
times_click1 : 0,
|
||||
times_click2 : 0,
|
||||
};
|
||||
|
||||
|
||||
//测试用-自动操作
|
||||
Test.autoOpt = {
|
||||
//是否开启
|
||||
isOpen : false,
|
||||
//自动模式:-1默认随机 1-托管 0-只自动搓摆牌
|
||||
_mode : 0,
|
||||
//开启
|
||||
open: function(mode){
|
||||
if(mode != null){
|
||||
this._mode = mode;
|
||||
}else {
|
||||
this._mode = 0;
|
||||
}
|
||||
this.isOpen = true;
|
||||
|
||||
//自动操作
|
||||
this.timeout_myOpt(1000);
|
||||
},
|
||||
|
||||
//关闭测试
|
||||
close: function(){
|
||||
this.isOpen = false;
|
||||
this._mode = 0;
|
||||
this.clearTimeout();
|
||||
},
|
||||
//自动操作延迟时间配置
|
||||
cfg_time: {
|
||||
|
||||
},
|
||||
//玩家自动操作时参数配置
|
||||
cfg_val: {
|
||||
robZhuang: -1, //抢庄0-未操作,1-抢庄,-1-不抢
|
||||
betScore: 5 //下注分数
|
||||
},
|
||||
|
||||
//定时器id
|
||||
_toId: {
|
||||
timeout_myOpt: { t1: -1 },
|
||||
myOpt: {
|
||||
t1: -1,
|
||||
t2: -1,
|
||||
t3: -1,
|
||||
t4: -1,
|
||||
},
|
||||
robZhuang: { t1: -1 },
|
||||
betScore: { t1: -1 },
|
||||
rubCard: { t1: -1 },
|
||||
putCard: { t1: -1 }
|
||||
},
|
||||
|
||||
//清除定时器
|
||||
clearTimeout: function(){
|
||||
for(var obj_sx in this._toId){
|
||||
for(var sx in obj_sx){
|
||||
if(obj_sx[sx] > -1){
|
||||
clearTimeout(obj_sx[sx]);
|
||||
obj_sx[sx] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
//定时执行自动操作
|
||||
timeout_myOpt : function(_time){
|
||||
if(NN_Desk && this.isOpen){
|
||||
if(_time == null){
|
||||
this.myOpt();
|
||||
}else {
|
||||
this._toId.timeout_myOpt.t1 = setTimeout(function(){
|
||||
this._toId.timeout_myOpt.t1 = -1;
|
||||
this.myOpt();
|
||||
}.bind(this),_time);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
//自己自动操作
|
||||
myOpt : function(){
|
||||
if(this.isOpen && Utl.getInfMode() == 1){
|
||||
//根据不同阶段操作
|
||||
if(NN_Desk.state == NN_state.robZhuang){
|
||||
//抢庄
|
||||
if(NN_Desk.robList[NN_Desk.myseat] == 0){ //未操作
|
||||
if(this._mode == 1){ //托管
|
||||
if(this.cfg_val.robZhuang != 0){
|
||||
this.robZhuang(this.cfg_val.robZhuang);
|
||||
} else{
|
||||
this.robZhuang(-1);
|
||||
}
|
||||
}else if(this._mode == -1){
|
||||
//随机抢庄
|
||||
if(parseInt(Math.random()*2) == 1){
|
||||
//不抢
|
||||
this.robZhuang(-1);
|
||||
}else {
|
||||
//抢
|
||||
this.robZhuang(1);
|
||||
};
|
||||
}
|
||||
}
|
||||
}else if(NN_Desk.state == NN_state.bet){
|
||||
//下注
|
||||
if(NN_Desk.zhuang != NN_Desk.myseat && NN_Desk.pList[NN_Desk.myseat].betScore <= 0){ //未操作
|
||||
if(this._mode == 1){ //托管
|
||||
if(this.cfg_val.betScore > 0){
|
||||
this.betScore(this.cfg_val.betScore);
|
||||
}else {
|
||||
var _score = 1;
|
||||
switch (NN_Desk.model_bet){
|
||||
case 10:
|
||||
_score = 5;
|
||||
break;
|
||||
case 5:
|
||||
_score = 3;
|
||||
break;
|
||||
case 3:
|
||||
_score = 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this.betScore(_score);
|
||||
}
|
||||
}else if(this._mode == -1){ //托管
|
||||
var _score = 1;
|
||||
switch (NN_Desk.model_bet){
|
||||
case 10:
|
||||
_score = parseInt(Math.random()*10 + 1, 10);
|
||||
break;
|
||||
case 5:
|
||||
_score = parseInt(Math.random()*5 + 1, 10);
|
||||
break;
|
||||
case 3:
|
||||
_score = parseInt(Math.random()*3 + 1, 10);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
this.betScore(_score);
|
||||
}
|
||||
}
|
||||
}else if(NN_Desk.state == NN_state.rubCard){
|
||||
//搓牌
|
||||
if(NN_Desk.pList[NN_Desk.myseat].rubcard.length == 0){
|
||||
//搓第一张牌
|
||||
this.rubCard(3);
|
||||
|
||||
NN_UI.rubPutUI_anim();
|
||||
set_self(750,37,0,0,0);
|
||||
NN_Desk.pList[NN_Desk.myseat].rubcard[0] = 3;
|
||||
//定时搓第二张
|
||||
this.timeout_myOpt(1000);
|
||||
}else if(NN_Desk.pList[NN_Desk.myseat].rubcard.length == 1){
|
||||
//搓第二张
|
||||
this.rubCard(4);
|
||||
|
||||
NN_UI.rubPutUI_anim();
|
||||
set_self(751,37,0,0,0);
|
||||
if(NN_Desk.pList[NN_Desk.myseat].rubcard[0] != 4){
|
||||
NN_Desk.pList[NN_Desk.myseat].rubcard[1] = 4;
|
||||
}
|
||||
//搓牌完成-显示自动摆牌
|
||||
NN_putCard_autoSelection(true);
|
||||
NN_Desk.state = NN_state.putCard;
|
||||
//定时摆牌
|
||||
this.timeout_myOpt(1000);
|
||||
}
|
||||
}else if(NN_Desk.state == NN_state.putCard){
|
||||
//摆牌
|
||||
this.putCard();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
robZhuang : function(isrob, _time){
|
||||
//抢庄
|
||||
var data = {
|
||||
isrob:isrob
|
||||
};
|
||||
|
||||
if(_time == null){
|
||||
NN_Net.SendGameData("robZhuang",data);
|
||||
}else {
|
||||
this._toId.robZhuang.t1 = setTimeout(function(){
|
||||
this._toId.robZhuang.t1 = -1;
|
||||
NN_Net.SendGameData("robZhuang",data);
|
||||
}.bind(this),_time);
|
||||
}
|
||||
//console.log("自动 抢庄:"+isrob);
|
||||
},
|
||||
|
||||
betScore : function(_score, _time){
|
||||
//下注
|
||||
var data = {
|
||||
score:_score
|
||||
};
|
||||
|
||||
if(_time == null){
|
||||
NN_Net.SendGameData("betScore",data);
|
||||
}else {
|
||||
this._toId.betScore.t1 = setTimeout(function(){
|
||||
this._toId.betScore.t1 = -1;
|
||||
NN_Net.SendGameData("betScore",data);
|
||||
}.bind(this),_time);
|
||||
}
|
||||
//console.log("自动 下注:"+ _score);
|
||||
},
|
||||
|
||||
rubCard : function(_cardloc, _time){
|
||||
//搓牌
|
||||
var data = {
|
||||
cardloc:_cardloc
|
||||
};
|
||||
|
||||
if(_time == null){
|
||||
NN_Net.SendGameData("rubCard",data);
|
||||
}else {
|
||||
this._toId.rubCard.t1 = setTimeout(function(){
|
||||
this._toId.rubCard.t1 = -1;
|
||||
NN_Net.SendGameData("rubCard",data);
|
||||
}.bind(this),_time);
|
||||
}
|
||||
//console.log("自动 搓牌:"+ _cardloc);
|
||||
},
|
||||
|
||||
putCard : function(_time){
|
||||
//摆牌确认
|
||||
if(_time == null){
|
||||
NN_Net.SendGameData("putCard");
|
||||
}else{
|
||||
this._toId.putCard.t1 = setTimeout(function(){
|
||||
this._toId.putCard.t1 = -1;
|
||||
NN_Net.SendGameData("putCard");
|
||||
}.bind(this),_time);
|
||||
}
|
||||
//console.log("自动 摆牌确认");
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
//调试用
|
||||
var Debug = Debug || {};
|
||||
//循环定时id
|
||||
Debug.ivId = {
|
||||
ui_rubput: -1
|
||||
};
|
||||
//普通定时id
|
||||
Debug.toId = {
|
||||
};
|
||||
//循环定时调试判断函数
|
||||
Debug.intervalFunc = function(){
|
||||
//搓摆牌界面
|
||||
if(NN_Desk && NN_Desk.state != null){
|
||||
if(NN_Desk.state == NN_state.rubput || NN_Desk.state == NN_state.rubCard || NN_Desk.state == NN_state.putCard){
|
||||
//清除定时器
|
||||
Debug.clear();
|
||||
//开启
|
||||
//console.log("开启 搓摆牌界面调试定时器");
|
||||
this.ivId.ui_rubput = setInterval(function(){
|
||||
if((NN_Desk.pList[NN_Desk.myseat].betScore > 0 || NN_Desk.myseat == NN_Desk.zhuang) && (NN_Desk.state == NN_state.rubput || NN_Desk.state == NN_state.rubCard || NN_Desk.state == NN_state.putCard)){
|
||||
if(Debug.ui_rubput()){
|
||||
//console.log("搓摆牌界面异常,提交错误信息");
|
||||
//清除定时器
|
||||
Debug.clear();
|
||||
}
|
||||
}else{
|
||||
//清除定时器
|
||||
Debug.clear();
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
};
|
||||
//循环定时调试判断函数
|
||||
Debug.clear = function(){
|
||||
if(Debug.ivId.ui_rubput > -1){
|
||||
//
|
||||
//console.log("清除搓摆牌界面调试定时器");
|
||||
clearInterval(Debug.ivId.ui_rubput);
|
||||
Debug.ivId.ui_rubput = -1;
|
||||
}
|
||||
};
|
||||
|
||||
//搓摆牌界面异常判断
|
||||
Debug.ui_rubput = function(){
|
||||
var upNum = 0; //牌弹起数量
|
||||
for(var i=0;i<5;i++){
|
||||
if(get_self(725+i,19) < 522){
|
||||
upNum ++;
|
||||
}
|
||||
}
|
||||
//
|
||||
var backNum = 0; //牌背
|
||||
if(get_self(750,37) == 1){
|
||||
backNum ++;
|
||||
}
|
||||
if(get_self(751,37) == 1){
|
||||
backNum ++;
|
||||
}
|
||||
//
|
||||
|
||||
if(NN_Desk.state == NN_state.rubCard){
|
||||
if(upNum > 0){
|
||||
NN_Net.submit_error("搓摆牌显示异常,状态:" + NN_Desk.state," 牌弹起数:" + upNum + " #牌背数:" + backNum + " #搓牌:" + NN_Desk.pList[NN_Desk.myseat].rubcard + " #摆牌:" + NN_Desk.pList[NN_Desk.myseat].putcard);
|
||||
return true;
|
||||
}
|
||||
} else if(NN_Desk.state == NN_state.putCard){
|
||||
if(backNum > 0){
|
||||
NN_Net.submit_error("搓摆牌显示异常,状态:" + NN_Desk.state," 牌弹起数:" + upNum + " #牌背数:" + backNum + " #搓牌:" + NN_Desk.pList[NN_Desk.myseat].rubcard + " #摆牌:" + NN_Desk.pList[NN_Desk.myseat].putcard);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (upNum > 0 && backNum > 0){
|
||||
NN_Net.submit_error("搓摆牌显示异常,状态:" + NN_Desk.state," 牌弹起数:" + upNum + " #牌背数:" + backNum + " #搓牌:" + NN_Desk.pList[NN_Desk.myseat].rubcard + " #摆牌:" + NN_Desk.pList[NN_Desk.myseat].putcard);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
3607
codes/games/client/Projects/niuniu/js/niuniu/nn_ui.js
Normal file
3607
codes/games/client/Projects/niuniu/js/niuniu/nn_ui.js
Normal file
File diff suppressed because one or more lines are too long
1013
codes/games/client/Projects/niuniu/js/niuniu/nn_ui_data.js
Normal file
1013
codes/games/client/Projects/niuniu/js/niuniu/nn_ui_data.js
Normal file
File diff suppressed because it is too large
Load Diff
4601
codes/games/client/Projects/niuniu/js/niuniu/nn_ui_fast.js
Normal file
4601
codes/games/client/Projects/niuniu/js/niuniu/nn_ui_fast.js
Normal file
File diff suppressed because it is too large
Load Diff
4263
codes/games/client/Projects/niuniu/js/niuniu/nn_ui_fast_10.js
Normal file
4263
codes/games/client/Projects/niuniu/js/niuniu/nn_ui_fast_10.js
Normal file
File diff suppressed because it is too large
Load Diff
1
codes/games/client/Projects/niuniu/js/niuniu_Event.js
Normal file
1
codes/games/client/Projects/niuniu/js/niuniu_Event.js
Normal file
@@ -0,0 +1 @@
|
||||
//精灵事件单元...
|
||||
Reference in New Issue
Block a user