Commit 6b040c15 authored by 谌继荃's avatar 谌继荃

拼图

parent 9c63baab
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title> <title>拼图</title>
<script src="http://yun.duiba.com.cn/db_games/libs0924/fyge2018.minSpine.js" crossorigin="anonymous"></script> <script src="http://yun.duiba.com.cn/db_games/libs0924/fyge2018.minSpine.js" crossorigin="anonymous"></script>
<style> <style>
html, html,
...@@ -27,20 +27,6 @@ ...@@ -27,20 +27,6 @@
background-image: url("https://yun.duiba.com.cn/db_games/activity/game/1550472986/resource/assets/playscene/playscenebg.jpg"); */ background-image: url("https://yun.duiba.com.cn/db_games/activity/game/1550472986/resource/assets/playscene/playscenebg.jpg"); */
} }
</style> </style>
<script>
Array.prototype.shuffle = function () {
var array = this;
var m = array.length,
t, i;
while (m) {
i = Math.floor(Math.random() * m--);
t = array[m];
array[m] = array[i];
array[i] = t;
}
return array;
}
</script>
</head> </head>
<body> <body>
......
This diff is collapsed.
export const PIC_URLS = [
"//yun.duiba.com.cn/aurora/assets/cd16134f2544202ed5676adbd5114286aec44347.png",
"//yun.duiba.com.cn/aurora/assets/c55dcd277542a6c3e983278ae5835d89848b9bd9.png",
"//yun.duiba.com.cn/aurora/assets/b42c49baaf8754139d2e940fe97ba1cb289b11fa.png",
"//yun.duiba.com.cn/aurora/assets/4a4b850995da348ccd5fb520d5b9ef5e0fb8349f.png",
"//yun.duiba.com.cn/aurora/assets/5b3e3b52f406df1543e2eeca1ce11719a28c6401.png",
"//yun.duiba.com.cn/aurora/assets/cae0529d1ff2eaa323dc0615d12a1f05e3a67c06.png",
"//yun.duiba.com.cn/aurora/assets/5b91853f9d87de73e319d42ea9df139ddd89d537.png",
"//yun.duiba.com.cn/aurora/assets/a2893c5a0d03ca3252160de1584584e18abe2a4a.png",
"//yun.duiba.com.cn/aurora/assets/c36b0851f61a812e6d745bc205c0551b6590d11d.png",
"//yun.duiba.com.cn/aurora/assets/cd16134f2544202ed5676adbd5114286aec44347.png",
"//yun.duiba.com.cn/aurora/assets/c55dcd277542a6c3e983278ae5835d89848b9bd9.png",
"//yun.duiba.com.cn/aurora/assets/b42c49baaf8754139d2e940fe97ba1cb289b11fa.png",
];
export const GAME_SIZE = 3;
export const GAME_SIZE2 = 3;
\ No newline at end of file
// 填充数组
export const fill = (size) => {
const list = [];
for (let i = 0; i < size; i++) {
list.push(i);
}
return list;
};
//数组元素交换
export const swap = (index1, index2, list) => {
const ele1 = list[index1];
const ele2 = list[index2];
list[index1] = ele2;
list[index2] = ele1;
return list;
};
//判断数组是否相等
export const equalTo = (array1: any[], array2: any[]) => {
if (array1.length != array1.length) return false;
const len = array1.length || array1.length;
for (let i = 0; i < len; i++) {
const a = array1[i];
const b = array2[i];
if (a != b) return false;
}
return true;
};
export const getIndex = (row, col, maxCol) => {
let index;
index = row * maxCol + col;
return index;
};
export const shuffle = (array: any[]) => {
var m = array.length,
t,
i;
while (m) {
i = Math.floor(Math.random() * m--);
t = array[m];
array[m] = array[i];
array[i] = t;
}
return array;
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment