highlights

This commit is contained in:
ntr 2019-05-06 00:39:52 +10:00
parent 3fb35288d8
commit 491e470d6c
4 changed files with 35 additions and 21 deletions

View File

@ -64,7 +64,7 @@ function Cryp(props) {
: (<span>&nbsp;</span>); : (<span>&nbsp;</span>);
function skillClick() { function skillClick() {
if (!skill) return false; if (!skill) return setInfo('highlight', 'skill');
setInfo('skill', { skill: skill.skill, cryp }); setInfo('skill', { skill: skill.skill, cryp });
return setActiveCryp(cryp); return setActiveCryp(cryp);
} }

View File

@ -11,6 +11,8 @@ function Vbox(args) {
activeCryp, activeCryp,
player, player,
instance, instance,
info,
vboxInfo,
combiner, combiner,
reclaiming, reclaiming,
sendVboxAccept, sendVboxAccept,
@ -129,6 +131,7 @@ function Vbox(args) {
} }
const boundTds = range(0, 9).map(i => { const boundTds = range(0, 9).map(i => {
const value = vbox.bound[i];
if (combiner.indexOf(i) > -1) { if (combiner.indexOf(i) > -1) {
return ( return (
<td <td
@ -137,18 +140,27 @@ function Vbox(args) {
</td> </td>
); );
} }
const highlight = () => {
if (!value || !info[0] || info[0] !== 'highlight') return false;
const v = vboxInfo.vars.find(vi => vi.v === value);
if (info[1] === 'skill') return v.skill;
if (info[1] === 'spec') return v.spec;
return false;
};
return ( return (
<td <td
key={i} key={i}
draggable="true" draggable="true"
onDragStart={e => e.dataTransfer.setData('text', i)} onDragStart={e => e.dataTransfer.setData('text', i)}
className={`${highlight() ? 'highlight' : ''}`}
onTouchStart={e => boundTouchStart(e, i)} onTouchStart={e => boundTouchStart(e, i)}
onTouchEnd={e => boundTouchEnd(e, i)} onTouchEnd={e => boundTouchEnd(e, i)}
onTouchMove={e => boundTouchMove(e)} onTouchMove={e => boundTouchMove(e)}
onClick={e => boundClick(e, i) }> onClick={e => boundClick(e, i) }>
{convertVar(vbox.bound[i])} {convertVar(value)}
</td> </td>
); );
}); });

View File

@ -15,6 +15,7 @@ const addState = connect(
activeVar, activeVar,
activeCryp, activeCryp,
info, info,
vboxInfo,
} = state; } = state;
function sendVboxDiscard() { function sendVboxDiscard() {
@ -41,6 +42,7 @@ const addState = connect(
activeVar, activeVar,
activeCryp, activeCryp,
info, info,
vboxInfo,
sendVboxAccept, sendVboxAccept,
sendVboxDiscard, sendVboxDiscard,
sendVboxReclaim, sendVboxReclaim,

View File

@ -18,24 +18,24 @@ function registerEvents(store) {
}); });
// // cryp animations // cryp animations
// function crypAnimations() { function crypAnimations() {
// const cryps = document.querySelectorAll('img'); const cryps = document.querySelectorAll('img');
// if (!cryps.length) return window.requestAnimationFrame(crypAnimations); if (!cryps.length) return window.requestAnimationFrame(crypAnimations);
// return anime({ return anime({
// targets: 'img', targets: 'img',
// translateX: () => anime.random(-20, 20), translateX: () => anime.random(-20, 20),
// translateY: () => anime.random(0, -40), translateY: () => anime.random(0, -40),
// rotate: () => anime.random(-15, 15), rotate: () => anime.random(-15, 15),
// duration: () => anime.random(5000, 6000), duration: () => anime.random(5000, 6000),
// delay: () => anime.random(0, 1000), delay: () => anime.random(0, 1000),
// direction: 'alternate', direction: 'alternate',
// easing: 'linear', easing: 'linear',
// loop: true, loop: true,
// }); });
// } }
// setInterval(crypAnimations, 5000); setInterval(crypAnimations, 10000);
// crypAnimations(); crypAnimations();
function setPing(ping) { function setPing(ping) {
store.dispatch(actions.setPing(ping)); store.dispatch(actions.setPing(ping));