fast unequip items
This commit is contained in:
parent
3732e5414f
commit
00b0dd023b
@ -310,7 +310,8 @@
|
|||||||
|
|
||||||
.equip .items {
|
.equip .items {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: row;
|
flex: 1 0 100%;
|
||||||
|
justify-content: space-around;
|
||||||
}
|
}
|
||||||
|
|
||||||
.label {
|
.label {
|
||||||
@ -322,8 +323,21 @@
|
|||||||
border: 2px solid #222;
|
border: 2px solid #222;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.equip .highlight {
|
||||||
|
animation: equip-bg 1s infinite ease-in-out alternate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes equip-bg {
|
||||||
|
0% {
|
||||||
|
background-color: black;
|
||||||
|
}
|
||||||
|
|
||||||
|
100% {
|
||||||
|
background-color: #181818;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.equip .skills button {
|
.equip .skills button {
|
||||||
flex: 1;
|
|
||||||
color: whitesmoke;
|
color: whitesmoke;
|
||||||
font-size: 16pt;
|
font-size: 16pt;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
@ -349,7 +363,6 @@ button.equip {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.equip .specs figure {
|
.equip .specs figure {
|
||||||
flex: 1;
|
|
||||||
border: 0;
|
border: 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,9 +7,13 @@ const { convertVar, SPECS } = require('./../utils');
|
|||||||
|
|
||||||
const addState = connect(
|
const addState = connect(
|
||||||
function receiveState(state) {
|
function receiveState(state) {
|
||||||
const { player, vboxInfo } = state;
|
const { player, vboxInfo, info, ws, instance } = state;
|
||||||
|
|
||||||
return { player, vboxInfo };
|
function sendUnequip(crypId, item) {
|
||||||
|
return ws.sendVboxUnequip(instance.id, crypId, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
return { player, vboxInfo, info, sendUnequip };
|
||||||
},
|
},
|
||||||
|
|
||||||
function receiveDispatch(dispatch) {
|
function receiveDispatch(dispatch) {
|
||||||
@ -33,12 +37,16 @@ const addState = connect(
|
|||||||
function Equipment(props) {
|
function Equipment(props) {
|
||||||
const {
|
const {
|
||||||
player,
|
player,
|
||||||
|
info,
|
||||||
vboxInfo,
|
vboxInfo,
|
||||||
|
sendUnequip,
|
||||||
setInfo,
|
setInfo,
|
||||||
setActiveVar,
|
setActiveVar,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const { vbox } = player;
|
const { vbox } = player;
|
||||||
|
const infoType = info ? info[0] : false;
|
||||||
|
const infoValue = info ? info[1] : false;
|
||||||
|
|
||||||
function boundClick(e, i) {
|
function boundClick(e, i) {
|
||||||
const value = vbox.bound[i];
|
const value = vbox.bound[i];
|
||||||
@ -47,10 +55,25 @@ function Equipment(props) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function skillUnequip(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
if (infoType === 'skill') sendUnequip(infoValue.cryp.id, infoValue.skill);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function specUnequip(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
if (infoType === 'spec') sendUnequip(infoValue.cryp.id, infoValue.spec);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
const skillClass = infoType === 'skill' ? 'skills highlight' : 'skills';
|
||||||
|
const specClass = infoType === 'spec' ? 'specs highlight' : 'specs';
|
||||||
|
|
||||||
// const classes = `right ${skill ? '' : 'action'}`;
|
// const classes = `right ${skill ? '' : 'action'}`;
|
||||||
const skillList = vboxInfo.vars.filter(v => v.skill).map(v => v.v);
|
const skillList = vboxInfo.vars.filter(v => v.skill).map(v => v.v);
|
||||||
const specList = vboxInfo.vars.filter(v => v.spec).map(v => v.v);
|
const specList = vboxInfo.vars.filter(v => v.spec).map(v => v.v);
|
||||||
|
|
||||||
|
|
||||||
const skills = range(0, 9).map(i => {
|
const skills = range(0, 9).map(i => {
|
||||||
const item = convertVar(vbox.bound[i]);
|
const item = convertVar(vbox.bound[i]);
|
||||||
if (skillList.includes(item)) {
|
if (skillList.includes(item)) {
|
||||||
@ -76,13 +99,13 @@ function Equipment(props) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="equip" >
|
<div className="equip" >
|
||||||
<div className="skills">
|
<div className={skillClass} onClick={e => skillUnequip(e)}>
|
||||||
<h3>Skills</h3>
|
<h3>Skills</h3>
|
||||||
<div className ="items">
|
<div className ="items">
|
||||||
{skills}
|
{skills}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="specs">
|
<div className={specClass} onClick={e => specUnequip(e)}>
|
||||||
<h3>Specs</h3>
|
<h3>Specs</h3>
|
||||||
<div className ="items">
|
<div className ="items">
|
||||||
{specs}
|
{specs}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user