Commit 7ea5d38f authored by Matthew Odle's avatar Matthew Odle

add some formatting

parent 00a5fa0a
......@@ -4,7 +4,7 @@ export class AssignedVillagers extends React.Component {
render() {
var building = this.props.building;
return (
<div className='goods'>
<div className={building.assignedVillagers.length > 0 ? "active" : "inactive"}>
<span>Villagers Assigned: </span>
<span>{building.assignedVillagers.length}</span>
</div>
......
......@@ -10,14 +10,17 @@ export class Building extends React.Component {
render() {
var building = this.props.building;
return (
<div className={ building.producing ? "building yes" : "building no" }>
<div className="building">
<div className='tooltip'>{building.label}
<span className='tooltiptext'>{building.description}</span>
</div>
{ building.priority !== undefined ? <Priority building={building} increasePriority={this.props.increasePriority} decreasePriority={this.props.decreasePriority} /> : null }
{ building.priority !== undefined
? <Priority building={building} increasePriority={this.props.increasePriority} decreasePriority={this.props.decreasePriority} />
: null
}
{ building.goods ? <Goods building={building} /> : null }
{ building.materials ? <Materials building={building} /> : null }
<div>Active: {building.producing ? "Yes" : "No" }</div>
<div className={building.producing ? "active" : "inactive"}>Active: {building.producing ? "Yes" : "No" }</div>
<div>Progress: {building.progress}</div>
{ building.assignedVillagers ? <AssignedVillagers building={building} /> : null }
<button type="button" id="addAVillager" onClick={() => this.props.manageVillagers(building, 1, 'assign')}>+</button>
......
......@@ -5,8 +5,8 @@ export class Villager extends React.Component {
render(props) {
var villager = this.props.villager;
return <div className="villager">
<div className={villager.assignment != "none" ? "active" : "inactive"}>
Villager {villager.id}{villager.assignment === "none" ? null : ": " + villager.assignment}
<div className={villager.assignment !== "none" ? "active" : "inactive"}>
Villager {villager.id}{villager.assignment === "none" ? ": IDLE" : ": " + villager.assignment}
</div>
<div className={villager.toolDurability > 0 ? "active" : "inactive"}>Tool: {villager.toolDurability + "%"}</div>
</div>
......
......@@ -52,6 +52,7 @@ button {
.building {
width: 200px;
margin-right: none;
border: 1px solid black;
}
.buildings {
......@@ -61,9 +62,10 @@ button {
.villagers {
float: left;
margin-left: 1em;
width: 200px;
width: 210px;
}
.villager {
border: 1px solid black;
margin-bottom: 1em;
}
......@@ -6,23 +6,25 @@ import './index.css';
import { Village } from './components/village';
const knobsAndLevers = {
unassignedVillagers: 30,
unassignedVillagers: 5,
villagerHasTool: true,
toolMultiplier: 4,
toolDurability: 100,
toolDegradeRate: 20,
toolDegradeRate: 1,
interval: 1000,
productionComplete: 100,
defaultCapacity: 50,
defaultProductionRate: 1,
elapsed: 0,
}
const villageStore = [
{name: 'wood', count: 0, source: 'FORESTER_HUT'},
{name: 'tool', count: 0, source: 'SMITHY'},
{name: 'iron', count: 0, source: 'MINE'},
{name: 'firewood', count: 0, source: 'WOODCUTTER_HUT'},
];
const villagers = []
const addVillager = () => {
let nextId = villagers.length > 0 ? Math.max(...villagers.map(v => v.id)) + 1 : 0;
......@@ -32,6 +34,7 @@ const addVillager = () => {
addVillager();
}
}
const init = () => {
addVillager();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment