Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
love_飞影
Neos
Commits
e17ac6e2
Commit
e17ac6e2
authored
Feb 12, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'optimize/mora' into 'main'
Optimize/mora See merge request
mycard/Neos!104
parents
12f150aa
6425550f
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
94 deletions
+65
-94
src/styles/_mora.scss
src/styles/_mora.scss
+0
-12
src/styles/_wait-room.scss
src/styles/_wait-room.scss
+0
-21
src/styles/core.scss
src/styles/core.scss
+1
-3
src/ui/Mora.tsx
src/ui/Mora.tsx
+62
-56
src/ui/Neos.tsx
src/ui/Neos.tsx
+2
-2
No files found.
src/styles/_mora.scss
deleted
100644 → 0
View file @
12f150aa
.mora_container
{
display
:
flex
;
margin
:
auto
;
padding
:
0
;
}
.item
{
text-align
:
center
;
flex
:
1
;
margin
:
auto
;
padding
:
10%
;
}
src/styles/_wait-room.scss
deleted
100644 → 0
View file @
12f150aa
.wait_container
{
display
:
flex
;
margin
:
auto
;
padding
:
0
;
}
.playerRegion
{
text-align
:
center
;
flex
:
1
;
margin
:
auto
;
padding
:
10%
;
}
.roomRegion
{
flex
:
1
;
margin
:
auto
;
padding
:
10%
;
}
.roomRegion
>
p
{
text-align
:
start
;
}
src/styles/core.scss
View file @
e17ac6e2
...
@@ -52,9 +52,7 @@ url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css")
...
@@ -52,9 +52,7 @@ url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css")
"commom"
,
"commom"
,
"header"
,
"header"
,
"login-form"
,
"login-form"
,
"sign-in"
,
"sign-in"
;
"wait-room"
,
"mora"
;
*
{
*
{
...
...
src/ui/Mora.tsx
View file @
e17ac6e2
/*
* 猜拳页面
*
* */
import
React
from
"
react
"
;
import
React
from
"
react
"
;
import
{
sendHandResult
,
sendTpResult
}
from
"
../api/ocgcore/ocgHelper
"
;
import
{
sendHandResult
,
sendTpResult
}
from
"
../api/ocgcore/ocgHelper
"
;
import
{
useAppSelector
}
from
"
../hook
"
;
import
{
useAppSelector
}
from
"
../hook
"
;
...
@@ -12,23 +7,22 @@ import {
...
@@ -12,23 +7,22 @@ import {
selectTpSelectAble
,
selectTpSelectAble
,
unSelectTpAble
,
unSelectTpAble
,
}
from
"
../reducers/moraSlice
"
;
}
from
"
../reducers/moraSlice
"
;
import
{
selectPlayer0
,
selectPlayer1
}
from
"
../reducers/playerSlice
"
;
import
{
selectDuelHsStart
}
from
"
../reducers/duel/mod
"
;
import
{
selectDuelHsStart
}
from
"
../reducers/duel/mod
"
;
import
{
store
}
from
"
../store
"
;
import
{
store
}
from
"
../store
"
;
import
{
useEffect
}
from
"
react
"
;
import
{
useEffect
}
from
"
react
"
;
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
{
Button
}
from
"
antd
"
;
import
{
Button
,
Modal
}
from
"
antd
"
;
import
"
../styles/core.scss
"
;
import
{
ScissorOutlined
,
SketchOutlined
,
TableOutlined
,
}
from
"
@ant-design/icons
"
;
// TODO: 应该展示聊天信息
const
Mora
=
()
=>
{
export
default
function
Mora
()
{
const
dispatch
=
store
.
dispatch
;
const
dispatch
=
store
.
dispatch
;
const
selectHandAble
=
useAppSelector
(
selectHandSelectAble
);
const
selectHandAble
=
useAppSelector
(
selectHandSelectAble
);
const
selectTpAble
=
useAppSelector
(
selectTpSelectAble
);
const
selectTpAble
=
useAppSelector
(
selectTpSelectAble
);
const
player0
=
useAppSelector
(
selectPlayer0
);
const
player1
=
useAppSelector
(
selectPlayer1
);
const
duelHsStart
=
useAppSelector
(
selectDuelHsStart
);
const
duelHsStart
=
useAppSelector
(
selectDuelHsStart
);
const
navigate
=
useNavigate
();
const
navigate
=
useNavigate
();
useEffect
(()
=>
{
useEffect
(()
=>
{
...
@@ -38,58 +32,70 @@ export default function Mora() {
...
@@ -38,58 +32,70 @@ export default function Mora() {
}
}
},
[
duelHsStart
]);
},
[
duelHsStart
]);
const
handleSelectScissors
=
()
=>
{
const
handleSelectMora
=
(
selected
:
string
)
=>
{
sendHandResult
(
"
scissors
"
);
sendHandResult
(
selected
);
dispatch
(
unSelectHandAble
());
};
const
handleSelectRock
=
()
=>
{
sendHandResult
(
"
rock
"
);
dispatch
(
unSelectHandAble
());
dispatch
(
unSelectHandAble
());
};
};
const
handleSelectPaper
=
()
=>
{
const
handleSelectTp
=
(
isFirst
:
boolean
)
=>
{
sendHandResult
(
"
paper
"
);
sendTpResult
(
isFirst
);
dispatch
(
unSelectHandAble
());
};
const
handleSelectFirst
=
()
=>
{
sendTpResult
(
true
);
dispatch
(
unSelectTpAble
());
};
const
handleSelectSecond
=
()
=>
{
sendTpResult
(
false
);
dispatch
(
unSelectTpAble
());
dispatch
(
unSelectTpAble
());
};
};
return
(
return
(
<
div
className=
"mora_container"
>
<>
<
div
className=
"item"
>
<
Modal
title=
"请选择猜拳"
open=
{
selectHandAble
}
footer=
{
<></>
}
>
<
Button
disabled=
{
!
selectHandAble
}
onClick=
{
handleSelectScissors
}
>
<
Button
scissors
disabled=
{
!
selectHandAble
}
onClick=
{
()
=>
{
handleSelectMora
(
"
scissors
"
);
}
}
icon=
{
<
ScissorOutlined
/>
}
>
剪刀
</
Button
>
</
Button
>
<
Button
disabled=
{
!
selectHandAble
}
onClick=
{
handleSelectRock
}
>
<
Button
rock
disabled=
{
!
selectHandAble
}
onClick=
{
()
=>
{
handleSelectMora
(
"
rock
"
);
}
}
icon=
{
<
SketchOutlined
/>
}
>
石头
</
Button
>
</
Button
>
<
Button
disabled=
{
!
selectHandAble
}
onClick=
{
handleSelectPaper
}
>
<
Button
paper
disabled=
{
!
selectHandAble
}
onClick=
{
()
=>
{
handleSelectMora
(
"
paper
"
);
}
}
icon=
{
<
TableOutlined
/>
}
>
布
</
Button
>
</
Button
>
</
div
>
</
Modal
>
<
div
className=
"item"
>
<
Modal
<
Button
disabled=
{
!
selectTpAble
}
onClick=
{
handleSelectFirst
}
>
title=
"请选择先攻/后攻"
first
open=
{
!
selectHandAble
&&
selectTpAble
}
footer=
{
<></>
}
>
<
Button
disabled=
{
!
selectTpAble
}
onClick=
{
()
=>
{
handleSelectTp
(
true
);
}
}
>
先攻
</
Button
>
</
Button
>
<
Button
disabled=
{
!
selectTpAble
}
onClick=
{
handleSelectSecond
}
>
<
Button
second
disabled=
{
!
selectTpAble
}
onClick=
{
()
=>
{
handleSelectTp
(
false
);
}
}
>
后攻
</
Button
>
</
Button
>
</
div
>
</
Modal
>
<
div
className=
"item"
>
</>
<
p
>
Me: main=
{
player0
.
deckInfo
?.
mainCnt
}
, extra=
{
player0
.
deckInfo
?.
extraCnt
}
, side=
{
player0
.
deckInfo
?.
sideCnt
}
</
p
>
<
p
>
Me: main=
{
player1
.
deckInfo
?.
mainCnt
}
, extra=
{
player1
.
deckInfo
?.
extraCnt
}
, side=
{
player1
.
deckInfo
?.
sideCnt
}
</
p
>
</
div
>
</
div
>
);
);
}
};
export
default
Mora
;
src/ui/Neos.tsx
View file @
e17ac6e2
import
React
from
"
react
"
;
import
React
from
"
react
"
;
import
JoinRoom
from
"
./JoinRoom
"
;
import
JoinRoom
from
"
./JoinRoom
"
;
import
WaitRoomV2
from
"
./WaitRoom
"
;
import
WaitRoomV2
from
"
./WaitRoom
"
;
import
MoraV2
from
"
./Mora
"
;
import
{
Routes
,
Route
}
from
"
react-router-dom
"
;
import
{
Routes
,
Route
}
from
"
react-router-dom
"
;
import
Mora
from
"
./Mora
"
;
import
NeosDuel
from
"
./Duel/main
"
;
import
NeosDuel
from
"
./Duel/main
"
;
export
default
function
()
{
export
default
function
()
{
...
@@ -11,7 +11,7 @@ export default function () {
...
@@ -11,7 +11,7 @@ export default function () {
<
Routes
>
<
Routes
>
<
Route
path=
"/"
element=
{
<
JoinRoom
/>
}
/>
<
Route
path=
"/"
element=
{
<
JoinRoom
/>
}
/>
<
Route
path=
"/:player/:passWd/:ip"
element=
{
<
WaitRoomV2
/>
}
/>
<
Route
path=
"/:player/:passWd/:ip"
element=
{
<
WaitRoomV2
/>
}
/>
<
Route
path=
"/mora"
element=
{
<
Mora
/>
}
/>
<
Route
path=
"/mora"
element=
{
<
Mora
V2
/>
}
/>
<
Route
path=
"/duel"
element=
{
<
NeosDuel
/>
}
/>
<
Route
path=
"/duel"
element=
{
<
NeosDuel
/>
}
/>
</
Routes
>
</
Routes
>
);
);
...
...
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