mess with styles and reclaim
This commit is contained in:
parent
e2169ea890
commit
e466b65819
@ -174,7 +174,7 @@ button:hover {
|
|||||||
|
|
||||||
.vbox-btn {
|
.vbox-btn {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0.5em;
|
padding: 0 0.5em;
|
||||||
background-color: whitesmoke;
|
background-color: whitesmoke;
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
@ -191,16 +191,12 @@ button:hover {
|
|||||||
|
|
||||||
.vbox-table td {
|
.vbox-table td {
|
||||||
border: 1px solid whitesmoke;
|
border: 1px solid whitesmoke;
|
||||||
padding: 0.5em;
|
padding: 0 0.5em;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.vbox-table th:first-child, td:first-child {
|
|
||||||
padding: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.spacer {
|
.spacer {
|
||||||
min-width: 100%;
|
min-width: 100%;
|
||||||
}
|
}
|
||||||
@ -213,19 +209,35 @@ button:hover {
|
|||||||
this controls the size of the box
|
this controls the size of the box
|
||||||
as it fills the whole container
|
as it fills the whole container
|
||||||
*/
|
*/
|
||||||
padding: 0 2em 0 0;
|
padding: 0 1em 2em 0;
|
||||||
margin: 0 0 2em 0;
|
}
|
||||||
|
|
||||||
|
/*cheeky one to push them in line with the buttons */
|
||||||
|
.cryp-box:first-child {
|
||||||
|
margin-top: -2.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cryp-box figure {
|
.cryp-box figure {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
flex-grow: 1;
|
flex: 1 1 50%;
|
||||||
border: 1px solid whitesmoke;
|
border: 1px solid whitesmoke;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
display: flex;
|
||||||
|
flex-flow: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cryp-box figure figcaption {
|
.cryp-box figure figcaption {
|
||||||
/*border-top: 1px solid whitesmoke;*/
|
}
|
||||||
|
|
||||||
|
.cryp-box .stats figure {
|
||||||
|
border: 0;
|
||||||
|
align-items: center
|
||||||
|
}
|
||||||
|
|
||||||
|
.cryp-box .stats {
|
||||||
|
border-top-width: 0;
|
||||||
|
border: 1px solid whitesmoke;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cryp-box .skills {
|
.cryp-box .skills {
|
||||||
|
|||||||
@ -25,5 +25,8 @@ export const setActiveIncoming = value => ({ type: SET_ACTIVE_INCOMING, value })
|
|||||||
export const SET_ACTIVE_SKILL = 'SET_ACTIVE_SKILL';
|
export const SET_ACTIVE_SKILL = 'SET_ACTIVE_SKILL';
|
||||||
export const setActiveSkill = (crypId, skill) => ({ type: SET_ACTIVE_SKILL, value: crypId ? { crypId, skill } : null });
|
export const setActiveSkill = (crypId, skill) => ({ type: SET_ACTIVE_SKILL, value: crypId ? { crypId, skill } : null });
|
||||||
|
|
||||||
|
export const SET_RECLAIMING = 'SET_RECLAIMING';
|
||||||
|
export const setReclaiming = value => ({ type: SET_RECLAIMING, value });
|
||||||
|
|
||||||
export const SET_WS = 'SET_WS';
|
export const SET_WS = 'SET_WS';
|
||||||
export const setWs = value => ({ type: SET_WS, value });
|
export const setWs = value => ({ type: SET_WS, value });
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
const preact = require('preact');
|
const preact = require('preact');
|
||||||
// const key = require('keymaster');
|
|
||||||
|
|
||||||
function convertVar(v) {
|
function convertVar(v) {
|
||||||
return v || '';
|
return v || '';
|
||||||
@ -9,25 +8,18 @@ function Vbox(args) {
|
|||||||
const {
|
const {
|
||||||
instance,
|
instance,
|
||||||
combiner,
|
combiner,
|
||||||
setCombiner,
|
reclaiming,
|
||||||
sendVboxAccept,
|
sendVboxAccept,
|
||||||
sendVboxDiscard,
|
sendVboxDiscard,
|
||||||
sendVboxReclaim,
|
sendVboxReclaim,
|
||||||
sendVboxCombine,
|
sendVboxCombine,
|
||||||
|
setCombiner,
|
||||||
|
setReclaiming,
|
||||||
} = args;
|
} = args;
|
||||||
|
|
||||||
const { vbox } = instance;
|
const { vbox } = instance;
|
||||||
if (!instance.vbox) return false;
|
if (!instance.vbox) return false;
|
||||||
|
|
||||||
// lots of rubbish to make it flow nice
|
|
||||||
function combinerAdd(i) {
|
|
||||||
if (combiner.indexOf(i) === -1) {
|
|
||||||
const insert = combiner.findIndex(j => j === null);
|
|
||||||
combiner[insert] = i;
|
|
||||||
return setCombiner(combiner);
|
|
||||||
}
|
|
||||||
return setCombiner([i, null, null]);
|
|
||||||
}
|
|
||||||
|
|
||||||
function combinerRmv(i) {
|
function combinerRmv(i) {
|
||||||
combiner[i] = null;
|
combiner[i] = null;
|
||||||
@ -57,19 +49,19 @@ function Vbox(args) {
|
|||||||
|
|
||||||
const boundRows = [
|
const boundRows = [
|
||||||
<tr key={0} >
|
<tr key={0} >
|
||||||
<td onClick={() => combinerAdd(0) }>{convertVar(vbox.bound[0])}</td>
|
<td onClick={() => boundClick(0) }>{convertVar(vbox.bound[0])}</td>
|
||||||
<td onClick={() => combinerAdd(1) }>{convertVar(vbox.bound[1])}</td>
|
<td onClick={() => boundClick(1) }>{convertVar(vbox.bound[1])}</td>
|
||||||
<td onClick={() => combinerAdd(2) }>{convertVar(vbox.bound[2])}</td>
|
<td onClick={() => boundClick(2) }>{convertVar(vbox.bound[2])}</td>
|
||||||
</tr>,
|
</tr>,
|
||||||
<tr key={1}>
|
<tr key={1}>
|
||||||
<td onClick={() => combinerAdd(3) }>{convertVar(vbox.bound[3])}</td>
|
<td onClick={() => boundClick(3) }>{convertVar(vbox.bound[3])}</td>
|
||||||
<td onClick={() => combinerAdd(4) }>{convertVar(vbox.bound[4])}</td>
|
<td onClick={() => boundClick(4) }>{convertVar(vbox.bound[4])}</td>
|
||||||
<td onClick={() => combinerAdd(5) }>{convertVar(vbox.bound[5])}</td>
|
<td onClick={() => boundClick(5) }>{convertVar(vbox.bound[5])}</td>
|
||||||
</tr>,
|
</tr>,
|
||||||
<tr key={2}>
|
<tr key={2}>
|
||||||
<td onClick={() => combinerAdd(6) }>{convertVar(vbox.bound[6])}</td>
|
<td onClick={() => boundClick(6) }>{convertVar(vbox.bound[6])}</td>
|
||||||
<td onClick={() => combinerAdd(7) }>{convertVar(vbox.bound[7])}</td>
|
<td onClick={() => boundClick(7) }>{convertVar(vbox.bound[7])}</td>
|
||||||
<td onClick={() => combinerAdd(8) }>{convertVar(vbox.bound[8])}</td>
|
<td onClick={() => boundClick(8) }>{convertVar(vbox.bound[8])}</td>
|
||||||
</tr>,
|
</tr>,
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -104,7 +96,7 @@ function Vbox(args) {
|
|||||||
<span>INVENTORY</span>
|
<span>INVENTORY</span>
|
||||||
<button
|
<button
|
||||||
className="instance-btn instance-ui-btn vbox-btn"
|
className="instance-btn instance-ui-btn vbox-btn"
|
||||||
onClick={() => sendVboxReclaim()}>
|
onClick={() => setReclaiming(!reclaiming)}>
|
||||||
reclaim
|
reclaim
|
||||||
</button>
|
</button>
|
||||||
<table className="vbox-table">
|
<table className="vbox-table">
|
||||||
|
|||||||
@ -6,7 +6,7 @@ const Vbox = require('./vbox.component');
|
|||||||
|
|
||||||
const addState = connect(
|
const addState = connect(
|
||||||
function receiveState(state) {
|
function receiveState(state) {
|
||||||
const { ws, instance, combiner } = state;
|
const { ws, instance, combiner, reclaiming } = state;
|
||||||
|
|
||||||
function sendVboxDiscard() {
|
function sendVboxDiscard() {
|
||||||
return ws.sendVboxDiscard(instance.instance);
|
return ws.sendVboxDiscard(instance.instance);
|
||||||
@ -17,16 +17,20 @@ const addState = connect(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sendVboxCombine() {
|
function sendVboxCombine() {
|
||||||
return ws.sendVboxCombine(combiner);
|
return ws.sendVboxCombine(instance.instance, combiner);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendVboxReclaim(v) {
|
function sendVboxReclaim(i) {
|
||||||
return ws.sendVboxDiscard(instance.instance, v);
|
if (reclaiming) {
|
||||||
|
return ws.sendVboxReclaim(instance.instance, i);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
instance,
|
instance,
|
||||||
combiner,
|
combiner,
|
||||||
|
reclaiming,
|
||||||
sendVboxAccept,
|
sendVboxAccept,
|
||||||
sendVboxDiscard,
|
sendVboxDiscard,
|
||||||
sendVboxReclaim,
|
sendVboxReclaim,
|
||||||
@ -36,10 +40,14 @@ const addState = connect(
|
|||||||
|
|
||||||
function receiveDispatch(dispatch) {
|
function receiveDispatch(dispatch) {
|
||||||
function setCombiner(c) {
|
function setCombiner(c) {
|
||||||
dispatch(actions.setCombiner(c));
|
return dispatch(actions.setCombiner(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
return { setCombiner };
|
function setReclaiming(v) {
|
||||||
|
return dispatch(actions.setReclaiming(v));
|
||||||
|
}
|
||||||
|
|
||||||
|
return { setCombiner, setReclaiming };
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|||||||
@ -24,6 +24,10 @@ function registerEvents(store) {
|
|||||||
store.dispatch(actions.setAccount(account));
|
store.dispatch(actions.setAccount(account));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearCombiner() {
|
||||||
|
store.dispatch(actions.setCombiner([null, null, null]));
|
||||||
|
}
|
||||||
|
|
||||||
function setActiveSkill(skill) {
|
function setActiveSkill(skill) {
|
||||||
console.log('EVENT ->', 'activeSkill', skill);
|
console.log('EVENT ->', 'activeSkill', skill);
|
||||||
}
|
}
|
||||||
@ -187,6 +191,7 @@ function registerEvents(store) {
|
|||||||
return {
|
return {
|
||||||
errorPrompt,
|
errorPrompt,
|
||||||
// loginPrompt,
|
// loginPrompt,
|
||||||
|
clearCombiner,
|
||||||
setAccount,
|
setAccount,
|
||||||
setActiveSkill,
|
setActiveSkill,
|
||||||
setCryps,
|
setCryps,
|
||||||
|
|||||||
@ -2,21 +2,10 @@ const key = require('keymaster');
|
|||||||
const actions = require('./actions');
|
const actions = require('./actions');
|
||||||
|
|
||||||
function setupKeys(store) {
|
function setupKeys(store) {
|
||||||
store.subscribe(() => {
|
console.log('binding keys');
|
||||||
const state = store.getState();
|
key.unbind('esc');
|
||||||
|
key('esc', () => store.dispatch(actions.setCombiner([null, null, null])));
|
||||||
key.unbind('esc');
|
key('esc', () => store.dispatch(actions.setReclaiming(false)));
|
||||||
|
|
||||||
if (state.activeItem) {
|
|
||||||
key('esc', () => store.dispatch(actions.setActiveItem(null)));
|
|
||||||
}
|
|
||||||
if (state.activeSkill) {
|
|
||||||
key('esc', () => store.dispatch(actions.setActiveSkill(null)));
|
|
||||||
}
|
|
||||||
if (state.activeIncoming) {
|
|
||||||
key('esc', () => store.dispatch(actions.setActiveIncoming(null)));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = setupKeys;
|
module.exports = setupKeys;
|
||||||
|
|||||||
@ -6,7 +6,7 @@ const { createStore, combineReducers } = require('redux');
|
|||||||
|
|
||||||
const reducers = require('./reducers');
|
const reducers = require('./reducers');
|
||||||
const actions = require('./actions');
|
const actions = require('./actions');
|
||||||
// const setupKeys = require('./keyboard');
|
const setupKeys = require('./keyboard');
|
||||||
const createSocket = require('./socket');
|
const createSocket = require('./socket');
|
||||||
const registerEvents = require('./events');
|
const registerEvents = require('./events');
|
||||||
|
|
||||||
@ -19,19 +19,20 @@ const store = createStore(
|
|||||||
account: reducers.accountReducer,
|
account: reducers.accountReducer,
|
||||||
activeSkill: reducers.activeSkillReducer,
|
activeSkill: reducers.activeSkillReducer,
|
||||||
combiner: reducers.combinerReducer,
|
combiner: reducers.combinerReducer,
|
||||||
game: reducers.gameReducer,
|
|
||||||
cryps: reducers.crypsReducer,
|
cryps: reducers.crypsReducer,
|
||||||
selectedCryps: reducers.selectedCrypsReducer,
|
game: reducers.gameReducer,
|
||||||
instances: reducers.instancesReducer,
|
|
||||||
instance: reducers.instanceReducer,
|
instance: reducers.instanceReducer,
|
||||||
|
instances: reducers.instancesReducer,
|
||||||
|
reclaiming: reducers.reclaimingReducer,
|
||||||
|
selectedCryps: reducers.selectedCrypsReducer,
|
||||||
ws: reducers.wsReducer,
|
ws: reducers.wsReducer,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
document.fonts.load('10pt "Jura"').then(() => {
|
document.fonts.load('16pt "Jura"').then(() => {
|
||||||
const events = registerEvents(store);
|
const events = registerEvents(store);
|
||||||
store.subscribe(() => console.log(store.getState()));
|
store.subscribe(() => console.log(store.getState()));
|
||||||
// setupKeys(store);
|
setupKeys(store);
|
||||||
|
|
||||||
const ws = createSocket(events);
|
const ws = createSocket(events);
|
||||||
store.dispatch(actions.setWs(ws));
|
store.dispatch(actions.setWs(ws));
|
||||||
|
|||||||
@ -80,6 +80,16 @@ function gameReducer(state = defaultGame, action) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const defaultReclaiming = false;
|
||||||
|
function reclaimingReducer(state = defaultReclaiming, action) {
|
||||||
|
switch (action.type) {
|
||||||
|
case actions.SET_RECLAIMING:
|
||||||
|
return action.value;
|
||||||
|
default:
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const defaultWs = null;
|
const defaultWs = null;
|
||||||
function wsReducer(state = defaultWs, action) {
|
function wsReducer(state = defaultWs, action) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
@ -96,8 +106,9 @@ module.exports = {
|
|||||||
combinerReducer,
|
combinerReducer,
|
||||||
crypsReducer,
|
crypsReducer,
|
||||||
gameReducer,
|
gameReducer,
|
||||||
instancesReducer,
|
|
||||||
instanceReducer,
|
instanceReducer,
|
||||||
|
instancesReducer,
|
||||||
|
reclaimingReducer,
|
||||||
selectedCrypsReducer,
|
selectedCrypsReducer,
|
||||||
wsReducer,
|
wsReducer,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -103,6 +103,7 @@ function createSocket(events) {
|
|||||||
|
|
||||||
function sendVboxCombine(instanceId, indices) {
|
function sendVboxCombine(instanceId, indices) {
|
||||||
send({ method: 'player_vbox_combine', params: { instance_id: instanceId, indices } });
|
send({ method: 'player_vbox_combine', params: { instance_id: instanceId, indices } });
|
||||||
|
events.clearCombiner();
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendVboxReclaim(instanceId, index) {
|
function sendVboxReclaim(instanceId, index) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user