Fix styles
This commit is contained in:
parent
342a0ec7b3
commit
cc10f38a54
@ -47,8 +47,7 @@ export default {
|
|||||||
}
|
}
|
||||||
#dashboard-inner {
|
#dashboard-inner {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
margin: 4px;
|
padding: 10px;
|
||||||
padding-bottom: 10px;
|
|
||||||
}
|
}
|
||||||
.separator {
|
.separator {
|
||||||
margin: 10px auto;
|
margin: 10px auto;
|
||||||
|
@ -24,10 +24,12 @@ export default {
|
|||||||
<style scoped>
|
<style scoped>
|
||||||
.title {
|
.title {
|
||||||
font-size: 160%;
|
font-size: 160%;
|
||||||
margin: 8px;
|
padding-top: 8px;
|
||||||
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
.version {
|
.version {
|
||||||
font-size: 120%;
|
font-size: 120%;
|
||||||
margin: 8px;
|
margin-top: 8px;
|
||||||
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -47,10 +47,12 @@ export default {
|
|||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
.task-list {
|
.task-list {
|
||||||
margin: 8px 8px auto;
|
margin-top: 8px;
|
||||||
|
margin-bottom: 8px;
|
||||||
}
|
}
|
||||||
.summary {
|
.summary {
|
||||||
margin: 10px auto 0;
|
margin-top: 10px;
|
||||||
|
margin-bottom: 0;
|
||||||
}
|
}
|
||||||
.container {
|
.container {
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
|
15
src/Game.ts
15
src/Game.ts
@ -28,15 +28,11 @@ export class Resources {
|
|||||||
readonly clay: number;
|
readonly clay: number;
|
||||||
readonly iron: number;
|
readonly iron: number;
|
||||||
readonly crop: number;
|
readonly crop: number;
|
||||||
readonly warehouse: number;
|
constructor(lumber: number, clay: number, iron: number, crop: number) {
|
||||||
readonly granary: number;
|
|
||||||
constructor(lumber: number, clay: number, iron: number, crop: number, warehouse: number, granary: number) {
|
|
||||||
this.lumber = lumber;
|
this.lumber = lumber;
|
||||||
this.clay = clay;
|
this.clay = clay;
|
||||||
this.iron = iron;
|
this.iron = iron;
|
||||||
this.crop = crop;
|
this.crop = crop;
|
||||||
this.warehouse = warehouse;
|
|
||||||
this.granary = granary;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getByType(type: ResourceType): number {
|
getByType(type: ResourceType): number {
|
||||||
@ -61,6 +57,15 @@ export class Resources {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class ResourceStorage {
|
||||||
|
readonly warehouse: number;
|
||||||
|
readonly granary: number;
|
||||||
|
constructor(warehouse: number, granary: number) {
|
||||||
|
this.warehouse = warehouse;
|
||||||
|
this.granary = granary;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export class Coordinates {
|
export class Coordinates {
|
||||||
readonly x: number;
|
readonly x: number;
|
||||||
readonly y: number;
|
readonly y: number;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Resources, ResourceType } from '../Game';
|
import { Resources, ResourceStorage, ResourceType } from '../Game';
|
||||||
import { GrabError } from '../Errors';
|
import { GrabError } from '../Errors';
|
||||||
import { getNumber } from '../utils';
|
import { getNumber } from '../utils';
|
||||||
|
|
||||||
@ -8,10 +8,13 @@ export function grabResources(): Resources {
|
|||||||
const iron = grabResource(ResourceType.Iron);
|
const iron = grabResource(ResourceType.Iron);
|
||||||
const crop = grabResource(ResourceType.Crop);
|
const crop = grabResource(ResourceType.Crop);
|
||||||
|
|
||||||
|
return new Resources(lumber, clay, iron, crop);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function grabResourceStorage() {
|
||||||
const warehouse = grabCapacity('warehouse');
|
const warehouse = grabCapacity('warehouse');
|
||||||
const granary = grabCapacity('granary');
|
const granary = grabCapacity('granary');
|
||||||
|
return new ResourceStorage(warehouse, granary);
|
||||||
return new Resources(lumber, clay, iron, crop, warehouse, granary);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function findStockBarElement() {
|
function findStockBarElement() {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import { StateGrabber } from './StateGrabber';
|
import { StateGrabber } from './StateGrabber';
|
||||||
import { grabActiveVillageId } from '../Page/VillageBlock';
|
import { grabActiveVillageId } from '../Page/VillageBlock';
|
||||||
import { grabResources } from '../Page/ResourcesBlock';
|
import { grabResources, grabResourceStorage } from '../Page/ResourcesBlock';
|
||||||
import { VillageState } from './VillageState';
|
import { VillageState } from './VillageState';
|
||||||
|
|
||||||
export class ResourceGrabber extends StateGrabber {
|
export class ResourceGrabber extends StateGrabber {
|
||||||
grab(): void {
|
grab(): void {
|
||||||
const villageId = grabActiveVillageId();
|
const villageId = grabActiveVillageId();
|
||||||
const resources = grabResources();
|
|
||||||
const state = new VillageState(villageId);
|
const state = new VillageState(villageId);
|
||||||
state.storeResources(resources);
|
state.storeResources(grabResources());
|
||||||
|
state.storeResourceStorage(grabResourceStorage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { DataStorage } from '../Storage/DataStorage';
|
import { DataStorage } from '../Storage/DataStorage';
|
||||||
import { Resources } from '../Game';
|
import { Resources, ResourceStorage } from '../Game';
|
||||||
|
|
||||||
export class VillageState {
|
export class VillageState {
|
||||||
private storage: DataStorage;
|
private storage: DataStorage;
|
||||||
@ -13,7 +13,17 @@ export class VillageState {
|
|||||||
|
|
||||||
getResources(): Resources {
|
getResources(): Resources {
|
||||||
let plain = this.storage.get('res');
|
let plain = this.storage.get('res');
|
||||||
let res = new Resources(0, 0, 0, 0, 0, 0);
|
let res = new Resources(0, 0, 0, 0);
|
||||||
return Object.assign(res, plain) as Resources;
|
return Object.assign(res, plain) as Resources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
storeResourceStorage(storage: ResourceStorage) {
|
||||||
|
this.storage.set('cap', storage);
|
||||||
|
}
|
||||||
|
|
||||||
|
getResourceStorage(): ResourceStorage {
|
||||||
|
let plain = this.storage.get('res');
|
||||||
|
let res = new ResourceStorage(0, 0);
|
||||||
|
return Object.assign(res, plain) as ResourceStorage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user