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