Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
微笑面对bug
ddz
提交
1bc57ad8
ddz
项目概览
微笑面对bug
/
ddz
通知
5
Star
2
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ddz
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
1bc57ad8
编写于
9月 20, 2020
作者:
微笑面对bug
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
界面
上级
c408a20f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
63 addition
and
1 deletion
+63
-1
src/components/Game.vue
src/components/Game.vue
+39
-1
src/doudizhu/Game.js
src/doudizhu/Game.js
+24
-0
未找到文件。
src/components/Game.vue
浏览文件 @
1bc57ad8
...
...
@@ -57,13 +57,51 @@
<div
:style=
"
{ marginLeft: buttonMarginLeft + 'px' }" style="width: 200px;height: 30px;">
<button
@
click=
"sendPoker2"
style=
"height: 30px;border-radius: 4px;float:left"
>
出牌
</button>
<button
@
click=
"pass"
style=
"height: 30px;border-radius: 4px;margin-left: 20px;float:right"
>
不出
</button>
<div
v-show=
"game.currentPlayer===game.playerList[0]"
style=
"color: red;width:150px;border: solid;border-radius: 4px;float: left"
>
请在
{{
game
.
second
}}
秒内出牌
</div>
</div>
</div>
<div
:style=
"
{ marginLeft: deskPokerMarginLeft + 'px' }" style="position: fixed;bottom:400px;width: 100%;height: 200px">
<div
v-for=
"item in deskPoker"
style=
"height:100%;width:100px;border: solid 1px;border-radius: 8px;float: left;margin-left:-50px;background-color: azure"
>
<div
v-
show=
"deskPoker.length>0"
v-
for=
"item in deskPoker"
style=
"height:100%;width:100px;border: solid 1px;border-radius: 8px;float: left;margin-left:-50px;background-color: azure"
>
{{
item
.
text
}}
</div>
<div
v-show=
"deskPoker.length===0"
style=
"height:100%;width:100px;float: left;margin-left:-50px;font-size: 50px;"
>
pass
</div>
</div>
<div
style=
"position: fixed;top:40px;left: 20px;height:200px;width:100px;border: solid 1px;border-radius: 8px;background-color: azure;text-align: center"
>
<p>
{{
game
.
playerList
[
2
].
type
===
'
nongmin
'
?
'
农民
'
:
'
地主
'
}}
</p>
<p>
{{
game
.
playerList
[
2
].
name
}}
</p>
<p>
剩余
{{
game
.
playerList
[
2
].
pokerList
.
length
}}
张
</p>
<div
v-show=
"game.currentPlayer===game.playerList[2]"
style=
"color: red;width:150px;border: solid;border-radius: 4px;position: absolute;bottom:-50px;left: 0"
>
请在
{{
game
.
second
}}
秒内出牌
</div>
</div>
<div
style=
"position: fixed;top:40px;right: 20px;height:200px;width:100px;border: solid 1px;border-radius: 8px;background-color: azure;text-align: center"
>
<p>
{{
game
.
playerList
[
1
].
type
===
'
nongmin
'
?
'
农民
'
:
'
地主
'
}}
</p>
<p>
{{
game
.
playerList
[
1
].
name
}}
</p>
<p>
剩余
{{
game
.
playerList
[
1
].
pokerList
.
length
}}
张
</p>
<div
v-show=
"game.currentPlayer===game.playerList[1]"
style=
"color: red;width:150px;border: solid;border-radius: 4px;position: absolute;bottom:-50px;right: 0"
>
请在
{{
game
.
second
}}
秒内出牌
</div>
</div>
</div>
</
template
>
...
...
src/doudizhu/Game.js
浏览文件 @
1bc57ad8
...
...
@@ -9,6 +9,7 @@ class Game{
this
.
oldPokerList
=
[];
this
.
currentPlayer
=
[];
this
.
dizhu
=
null
;
this
.
second
=
20
;
this
.
init
();
}
...
...
@@ -21,7 +22,29 @@ class Game{
this
.
start
();
}
resetTime
(){
this
.
second
=
20
;
}
timeLoop
(){
this
.
second
--
;
if
(
this
.
second
===
0
){
this
.
timeout
();
}
let
that
=
this
;
setTimeout
(
function
()
{
that
.
timeLoop
();
},
1000
);
}
timeout
(){
this
.
currentPlayer
.
playByString
(
'
pass
'
);
}
start
(){
this
.
timeLoop
();
this
.
currentPlayer
=
this
.
dizhu
;
if
(
this
.
currentPlayer
.
isRobot
){
this
.
currentPlayer
.
playByAI
();
...
...
@@ -34,6 +57,7 @@ class Game{
this
.
gameOver
();
return
;
}
this
.
resetTime
();
this
.
currentPlayer
=
this
.
currentPlayer
.
next
;
if
(
this
.
currentPlayer
.
isRobot
){
this
.
currentPlayer
.
playByAI
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录