Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jiquan_pintu
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
wildfirecode13
jiquan_pintu
Commits
6b040c15
Commit
6b040c15
authored
Nov 18, 2021
by
谌继荃
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
拼图
parent
9c63baab
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
304 additions
and
163 deletions
+304
-163
index.html
public/index.html
+1
-15
drag.ts
src/drag.ts
+237
-148
gameconfig.ts
src/gameconfig.ts
+18
-0
util.ts
src/util.ts
+48
-0
No files found.
public/index.html
View file @
6b040c15
...
...
@@ -5,7 +5,7 @@
<meta
charset=
"UTF-8"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
<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>
<style>
html
,
...
...
@@ -27,20 +27,6 @@
background-image: url("https://yun.duiba.com.cn/db_games/activity/game/1550472986/resource/assets/playscene/playscenebg.jpg"); */
}
</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>
<body>
...
...
src/drag.ts
View file @
6b040c15
This diff is collapsed.
Click to expand it.
src/gameconfig.ts
0 → 100644
View file @
6b040c15
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
src/util.ts
0 → 100644
View file @
6b040c15
// 填充数组
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
;
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment