wip
This commit is contained in:
parent
92007a8c37
commit
b22026fb56
@ -123,6 +123,14 @@ svg {
|
|||||||
stroke-width: 0;
|
stroke-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
img {
|
||||||
|
object-fit: contain;
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
width: auto;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
COLOURS
|
COLOURS
|
||||||
*/
|
*/
|
||||||
@ -597,6 +605,7 @@ table td svg {
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: column;
|
flex-flow: column;
|
||||||
|
justify-content: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cryp-box .stats {
|
.cryp-box .stats {
|
||||||
@ -671,9 +680,10 @@ table td svg {
|
|||||||
filter: blur(5px);
|
filter: blur(5px);
|
||||||
}
|
}
|
||||||
|
|
||||||
text.combat-text {
|
.combat-text {
|
||||||
|
position: fixed;
|
||||||
|
top: 50%;
|
||||||
fill: whitesmoke;
|
fill: whitesmoke;
|
||||||
font-size: 5em;
|
|
||||||
font-family: 'Jura';
|
font-family: 'Jura';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
const preact = require('preact');
|
const preact = require('preact');
|
||||||
const range = require('lodash/range');
|
const range = require('lodash/range');
|
||||||
|
|
||||||
const molecule = require('./molecule');
|
const { STATS, eventClasses, getCombatText, genAvatar } = require('../utils');
|
||||||
|
|
||||||
const { STATS, eventClasses, getCombatText } = require('../utils');
|
|
||||||
|
|
||||||
const GameCryp = require('./game.cryp');
|
const GameCryp = require('./game.cryp');
|
||||||
const SkillBtn = require('./skill.btn');
|
const SkillBtn = require('./skill.btn');
|
||||||
@ -146,18 +144,21 @@ function GamePanel(props) {
|
|||||||
|
|
||||||
const combatText = getCombatText(cryp, resolution);
|
const combatText = getCombatText(cryp, resolution);
|
||||||
|
|
||||||
|
const combatTextEl = combatText
|
||||||
|
? <div className="combat-text">{combatText}</div>
|
||||||
|
: null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
key={i}
|
key={i}
|
||||||
className={`cryp-box ${ko} ${classes}`}
|
className={`cryp-box ${ko} ${classes}`}
|
||||||
style={ activeSkill ? { cursor: 'pointer' } : {}}
|
style={ activeSkill ? { cursor: 'pointer' } : {}}
|
||||||
onClick={() => selectSkillTarget(cryp.id)} >
|
onClick={() => selectSkillTarget(cryp.id)} >
|
||||||
<div className="cryp-box-top">
|
|
||||||
<figure className="img">
|
<figure className="img">
|
||||||
{molecule(combatText)}
|
<img src={`/molecules/${genAvatar(cryp.name)}.svg`} />
|
||||||
<figcaption>{cryp.name}</figcaption>
|
<div className="combat-text">attack</div>
|
||||||
|
<div>{cryp.name}</div>
|
||||||
</figure>
|
</figure>
|
||||||
</div>
|
|
||||||
<div className="stats">
|
<div className="stats">
|
||||||
{stats}
|
{stats}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -4,7 +4,7 @@ const range = require('lodash/range');
|
|||||||
|
|
||||||
const molecule = require('./molecule');
|
const molecule = require('./molecule');
|
||||||
const actions = require('../actions');
|
const actions = require('../actions');
|
||||||
const { STATS, eventClasses, getCombatText } = require('../utils');
|
const { STATS, eventClasses, getCombatText, genAvatar } = require('../utils');
|
||||||
|
|
||||||
const SkillBtn = require('./skill.btn');
|
const SkillBtn = require('./skill.btn');
|
||||||
|
|
||||||
@ -88,8 +88,8 @@ function GameCryp(props) {
|
|||||||
<figure
|
<figure
|
||||||
className="img"
|
className="img"
|
||||||
onClick={() => selectSkillTarget(cryp.id)} >
|
onClick={() => selectSkillTarget(cryp.id)} >
|
||||||
{molecule(combatText)}
|
<img src={`/molecules/${genAvatar(cryp.name)}.svg`} />
|
||||||
<figcaption>{cryp.name}</figcaption>
|
<div>{cryp.name}</div>
|
||||||
</figure>
|
</figure>
|
||||||
<div className="skills">
|
<div className="skills">
|
||||||
{skills}
|
{skills}
|
||||||
|
|||||||
@ -177,7 +177,6 @@ function Info(args) {
|
|||||||
function scoreBoard() {
|
function scoreBoard() {
|
||||||
const players = instance.players.map((p, i) => {
|
const players = instance.players.map((p, i) => {
|
||||||
const pText = playerText(p);
|
const pText = playerText(p);
|
||||||
console.log(pText);
|
|
||||||
return (
|
return (
|
||||||
<tr key={i}
|
<tr key={i}
|
||||||
className={p.ready ? 'ready' : ''}>
|
className={p.ready ? 'ready' : ''}>
|
||||||
@ -209,6 +208,10 @@ function Info(args) {
|
|||||||
? infoVar(info)
|
? infoVar(info)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
// const beginningHdr = instance.phase === 'Lobby'
|
||||||
|
// ? <h2>game beginning...</h2>
|
||||||
|
// : null;
|
||||||
|
|
||||||
const instanceInfoClass = `instance-info ${!info[0] ? '' : 'hidden'}`;
|
const instanceInfoClass = `instance-info ${!info[0] ? '' : 'hidden'}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -4,7 +4,7 @@ const range = require('lodash/range');
|
|||||||
const mapValues = require('lodash/mapValues');
|
const mapValues = require('lodash/mapValues');
|
||||||
|
|
||||||
const molecule = require('./molecule');
|
const molecule = require('./molecule');
|
||||||
const { SPECS } = require('../utils');
|
const { SPECS, genAvatar } = require('../utils');
|
||||||
const actions = require('../actions');
|
const actions = require('../actions');
|
||||||
const SkillBtn = require('./skill.btn');
|
const SkillBtn = require('./skill.btn');
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ function Cryp(props) {
|
|||||||
>
|
>
|
||||||
<div className="cryp-box-top">
|
<div className="cryp-box-top">
|
||||||
<figure className="img" onClick={onClick}>
|
<figure className="img" onClick={onClick}>
|
||||||
{molecule()}
|
<img src={`/molecules/${genAvatar(cryp.name)}.svg`} />
|
||||||
<figcaption>{cryp.name}</figcaption>
|
<figcaption>{cryp.name}</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
<div className="skills">
|
<div className="skills">
|
||||||
|
|||||||
@ -3,7 +3,7 @@ const range = require('lodash/range');
|
|||||||
|
|
||||||
const { NULL_UUID } = require('./../utils');
|
const { NULL_UUID } = require('./../utils');
|
||||||
|
|
||||||
const { stringSort } = require('./../utils');
|
const { stringSort, genAvatar } = require('./../utils');
|
||||||
const molecule = require('./molecule');
|
const molecule = require('./molecule');
|
||||||
const SpawnButton = require('./spawn.button');
|
const SpawnButton = require('./spawn.button');
|
||||||
|
|
||||||
@ -123,9 +123,7 @@ function Menu(args) {
|
|||||||
className="menu-cryp"
|
className="menu-cryp"
|
||||||
style={ { 'border-color': borderColour || 'whitesmoke' } }
|
style={ { 'border-color': borderColour || 'whitesmoke' } }
|
||||||
onClick={() => selectCryp(cryp.id)} >
|
onClick={() => selectCryp(cryp.id)} >
|
||||||
<figure className="img">
|
<img src={`/molecules/${genAvatar(cryp.name)}.svg`} />
|
||||||
{molecule()}
|
|
||||||
</figure>
|
|
||||||
<h2>{cryp.name}</h2>
|
<h2>{cryp.name}</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -220,13 +220,11 @@ function createSocket(events) {
|
|||||||
const [structName, i] = response;
|
const [structName, i] = response;
|
||||||
clearTimeout(instanceStateTimeout);
|
clearTimeout(instanceStateTimeout);
|
||||||
instanceStateTimeout = setTimeout(() => sendInstanceState(i.id), 1000);
|
instanceStateTimeout = setTimeout(() => sendInstanceState(i.id), 1000);
|
||||||
console.log(instanceStateTimeout);
|
|
||||||
events.setInstance(i);
|
events.setInstance(i);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearInstanceStateTimeout() {
|
function clearInstanceStateTimeout() {
|
||||||
console.log('instance state timeout cleared');
|
|
||||||
clearTimeout(instanceStateTimeout);
|
clearTimeout(instanceStateTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,9 +39,9 @@ const genAvatar = name => {
|
|||||||
for (let i = 0; i < name.length; i += 1) {
|
for (let i = 0; i < name.length; i += 1) {
|
||||||
const chr = name.charCodeAt(i);
|
const chr = name.charCodeAt(i);
|
||||||
hash = ((hash << 5) - hash) + chr;
|
hash = ((hash << 5) - hash) + chr;
|
||||||
hash = hash & 10000; // We have avatars named 0-19
|
hash = hash % 10000;
|
||||||
}
|
}
|
||||||
return `sprite${hash}`;
|
return `${hash}`;
|
||||||
};
|
};
|
||||||
|
|
||||||
function requestAvatar(name) {
|
function requestAvatar(name) {
|
||||||
|
|||||||
@ -29,7 +29,6 @@ fn fetch_instances(mut tx: Transaction) -> Result<Transaction, Error> {
|
|||||||
|
|
||||||
for mut instance in instances {
|
for mut instance in instances {
|
||||||
let (instance, new_games) = instance.upkeep();
|
let (instance, new_games) = instance.upkeep();
|
||||||
println!("{:?} new games", new_games.len());
|
|
||||||
for game in new_games {
|
for game in new_games {
|
||||||
game_write(&mut tx, &game)?;
|
game_write(&mut tx, &game)?;
|
||||||
}
|
}
|
||||||
@ -40,14 +39,11 @@ fn fetch_instances(mut tx: Transaction) -> Result<Transaction, Error> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn warden(db: Db) -> Result<(), Error> {
|
pub fn warden(db: Db) -> Result<(), Error> {
|
||||||
println!("upkeep beginning");
|
|
||||||
fetch_games(db.transaction()?)?
|
fetch_games(db.transaction()?)?
|
||||||
.commit()?;
|
.commit()?;
|
||||||
|
|
||||||
fetch_instances(db.transaction()?)?
|
fetch_instances(db.transaction()?)?
|
||||||
.commit()?;
|
.commit()?;
|
||||||
|
|
||||||
println!("upkeep done");
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user