<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>水果老虎机</title>
<link type="text/css" href="css.css" rel="Stylesheet" />
<style type="text/css">
*
{
font-size:12px;
font-family:宋体;
margin:0;
padding:0;
}
</style>
<script type="text/javascript">
function LHJ(id) {
this.frameid = id;
this._doc = document;
this._config = {
cardwidth: 66,
cardheight: 66,
betcardwidth:87,
betcardheight:87,
margin:5,
runboxlength:4,
runloop:4,
maxbet:99
};
this._piecelist = [];
this._multitype = {
"b_bar":100,
"s_bar":50,
"b_seven": 40,
"b_star":30,
"b_watermelons":25,
"b_alarm":20,
"b_coconut":15,
"b_orange":10,
"b_apple":5,
"small":2,
"cha":0
};
this._piecelistposition = {};
this._piecelistmulti = {};
this._piecelisttype = {};
this._money = 0;
this._total = 20; //默认为20分
this._startbox = 1; //上次结果,此次的起点
this._endbox = 1; //这是这次的结果
this._jumpnum = 1; //这些需要算出来
this._currentshowlist = [1];
//状态值
this._isfirstbet = true;
this._isrun = false;
//定时器
this._interval = null;
this._mainDiv = null;
this.frame = {
"piece": {"bg":null,"run":null},
"bet": null
};
this._self = this;
var i;
for (i = 1; i < 25; i++) {
this._piecelist.push(i);
}
}
LHJ.prototype.$ = function(id) {
if (!this._doc) {
this._doc = document;
}
if (id && typeof (id) === "string") {
return this._doc.getElementById(id);
}
return null;
};
// 判断obj是否为数组
LHJ.prototype.isArray = function(obj) {
return Object.prototype.toString.call(obj) === '[object Array]';
}
// 判断e是否在数组arr中
LHJ.prototype.in_Array = function(arr, e) {
for (var i = 0; i < arr.length; i++) {
if (arr[i] == e)
return true;
}
return false;
}
//生成随机数
LHJ.prototype.rand = function(min, max) {
return parseInt(Math.random() * (max - min + 1) + min);
}
LHJ.prototype._getWinNum = function() {
var r = this.rand(1, 100);
var b = 2;
if (r == 100) {
//大Bar 1/100
b = 24;
}
else if (r > 97) {
//小Bar 2/100
b = 23;
}
else if (r >= 95 && r <= 97) {
//大77 3/100
b = 12;
}
else if (r >= 90 && r <= 94) {
//大星星 5/100
b = 16;
}
else if (r >= 84 && r <= 89) {
//大西瓜 6/100
b = 4;
}
else if (r >= 76 && r <= 83) {
//大铃铛 8/100
var ar = this.rand(1, 2);
switch (ar) {
case 1:
b = 22;
break;
case 2:
b = 10;
break;
}
}
else if (r >= 68 && r <= 75) {
//大椰子1 8/100
var ar = this.rand(1, 2);
switch (ar) {
case 1:
b = 3;
break;
case 2:
b = 15;
break;
}
}
else if (r >= 59 && r <= 68) {
//大桔子1 10/100
var ar = this.rand(1, 2);
switch (ar) {
case 1:
b = 21;
break;
case 2:
b = 9;
break;
}
}
else if (r >= 44 && r <= 58) {
//苹果 15/100
var ar = this.rand(1, 4);
switch (ar) {
case 1:
b = 1;
break;
case 2:
b = 7;
break;
case 3:
b = 13;
break;
case 4:
b = 19;
break;
}
}
else if (r >= 36 && r <= 43) {
//CHA 8/100
var ar = this.rand(1, 2);
switch (ar) {
case 1:
b = 6;
break;
case 2:
b = 18;
break;
}
}
else {
//小东西
var ar = this.rand(1, 7);
switch (ar) {
case 1:
b = 2;
break;
case 2:
b = 5;
break;
case 3:
b = 8;
break;
case 4:
b = 11;
break;
case 5:
b = 14;
break;
case 6:
b = 17;
break;
case 7:
b = 20;
break;
}
}
return b;
}
LHJ.prototype._getpieceinfo = function(i, j) {
switch (i + "-" + j) {
case "0-0":
return { "type":"orange","css": "b_orange", "list": 21, "multi": "b_orange" };
case "0-1":
return { "type": "alarm", "css": "b_alarm", "list": 22, "multi": "b_alarm" };
case "0-2":
return { "type": "bar", "css": "s_bar", "list": 23, "multi": "s_bar" };
case "0-3":
return { "type": "bar", "css": "b_bar", "list": 24, "multi": "b_bar" };
case "0-4":
return { "type": "apple", "css": "b_apple", "list": 1, "multi": "b_apple" };
case "0-5":
return { "type": "apple", "css": "s_apple", "list": 2, "multi": "small" };
case "0-6":
return { "type": "coconut", "css": "b_coconut", "list": 3, "multi": "b_coconut" };
case "1-0":
return { "type": "alarm", "css": "s_alarm", "list": 20, "multi": "small" };
case "2-0":
return { "type": "apple", "css": "b_apple", "list": 19, "multi": "b_apple" };
case "3-0":
return { "type": "cha", "css": "cha", "list": 18, "multi": "cha" };
case "4-0":
return { "type": "star", "css": "s_star", "list": 17, "multi": "small" };
case "5-0":
return { "type": "star", "css": "b_star", "list": 16, "multi": "b_star" };
case "6-0":
return { "type": "coconut", "css": "b_coconut", "list": 15, "multi": "b_coconut" };
case "6-1":
return { "type": "coconut", "css": "s_coconut", "list": 14, "multi": "small" };
case "6-2":
return { "type": "apple", "css": "b_apple", "list": 13, "multi": "b_apple" };
case "6-3":
return { "type": "seven", "css": "b_seven", "list": 12, "multi": "b_seven" };
case "6-4":
return { "type": "seven", "css": "s_seven", "list": 11, "multi": "small" };
case "6-5":
return