Remove quick actions
This commit is contained in:
parent
b6d86ee659
commit
08c7119879
@ -4,8 +4,6 @@ import { BuildingPageController } from './Page/BuildingPageController';
|
|||||||
import { UpgradeBuildingTask } from './Task/UpgradeBuildingTask';
|
import { UpgradeBuildingTask } from './Task/UpgradeBuildingTask';
|
||||||
import { grabActiveVillageId } from './Page/VillageBlock';
|
import { grabActiveVillageId } from './Page/VillageBlock';
|
||||||
import {
|
import {
|
||||||
grabBuildingSlots,
|
|
||||||
grabResourceSlots,
|
|
||||||
onBuildingSlotCtrlClick,
|
onBuildingSlotCtrlClick,
|
||||||
onResourceSlotCtrlClick,
|
onResourceSlotCtrlClick,
|
||||||
showBuildingSlotIds,
|
showBuildingSlotIds,
|
||||||
@ -14,7 +12,6 @@ import {
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import Vuex from 'vuex';
|
import Vuex from 'vuex';
|
||||||
import DashboardApp from './DashboardView/Dashboard.vue';
|
import DashboardApp from './DashboardView/Dashboard.vue';
|
||||||
import { ResourcesToLevel } from './Task/ResourcesToLevel';
|
|
||||||
import { ConsoleLogger, Logger } from './Logger';
|
import { ConsoleLogger, Logger } from './Logger';
|
||||||
import { DataStorage } from './DataStorage';
|
import { DataStorage } from './DataStorage';
|
||||||
import { getBuildingPageAttributes, isBuildingPage } from './Page/PageDetectors';
|
import { getBuildingPageAttributes, isBuildingPage } from './Page/PageDetectors';
|
||||||
@ -27,11 +24,6 @@ import { VillageFactory } from './VillageFactory';
|
|||||||
|
|
||||||
Vue.use(Vuex);
|
Vue.use(Vuex);
|
||||||
|
|
||||||
interface QuickAction {
|
|
||||||
label: string;
|
|
||||||
cb: () => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface GameState {
|
interface GameState {
|
||||||
name: string;
|
name: string;
|
||||||
version: string;
|
version: string;
|
||||||
@ -39,7 +31,6 @@ interface GameState {
|
|||||||
villageStates: ReadonlyArray<VillageState>;
|
villageStates: ReadonlyArray<VillageState>;
|
||||||
taskList: ReadonlyArray<Task>;
|
taskList: ReadonlyArray<Task>;
|
||||||
actionList: ReadonlyArray<Action>;
|
actionList: ReadonlyArray<Action>;
|
||||||
quickActions: Array<QuickAction>;
|
|
||||||
pauseSeconds: number;
|
pauseSeconds: number;
|
||||||
|
|
||||||
refresh(): void;
|
refresh(): void;
|
||||||
@ -65,8 +56,6 @@ export class ControlPanel {
|
|||||||
await waitForLoad();
|
await waitForLoad();
|
||||||
|
|
||||||
const p = parseLocation();
|
const p = parseLocation();
|
||||||
this.logger.info('PARSED LOCATION', p);
|
|
||||||
|
|
||||||
const villageId = grabActiveVillageId();
|
const villageId = grabActiveVillageId();
|
||||||
|
|
||||||
const scheduler = this.scheduler;
|
const scheduler = this.scheduler;
|
||||||
@ -81,7 +70,6 @@ export class ControlPanel {
|
|||||||
villageStates: [],
|
villageStates: [],
|
||||||
taskList: [],
|
taskList: [],
|
||||||
actionList: [],
|
actionList: [],
|
||||||
quickActions: [],
|
|
||||||
pauseSeconds: 0,
|
pauseSeconds: 0,
|
||||||
|
|
||||||
refresh() {
|
refresh() {
|
||||||
@ -127,9 +115,7 @@ export class ControlPanel {
|
|||||||
.map(t => t.args.buildId || 0);
|
.map(t => t.args.buildId || 0);
|
||||||
|
|
||||||
if (p.pathname === '/dorf1.php') {
|
if (p.pathname === '/dorf1.php') {
|
||||||
console.log('RSLOTS', grabResourceSlots());
|
|
||||||
showResourceSlotIds(getBuildingsInQueue());
|
showResourceSlotIds(getBuildingsInQueue());
|
||||||
state.quickActions.push(...this.createDepositsQuickActions(villageId));
|
|
||||||
onResourceSlotCtrlClick(buildId => {
|
onResourceSlotCtrlClick(buildId => {
|
||||||
this.onSlotCtrlClick(villageId, buildId);
|
this.onSlotCtrlClick(villageId, buildId);
|
||||||
showResourceSlotIds(getBuildingsInQueue());
|
showResourceSlotIds(getBuildingsInQueue());
|
||||||
@ -137,7 +123,6 @@ export class ControlPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (p.pathname === '/dorf2.php') {
|
if (p.pathname === '/dorf2.php') {
|
||||||
console.log('BSLOTS', grabBuildingSlots());
|
|
||||||
showBuildingSlotIds(getBuildingsInQueue());
|
showBuildingSlotIds(getBuildingsInQueue());
|
||||||
onBuildingSlotCtrlClick(buildId => {
|
onBuildingSlotCtrlClick(buildId => {
|
||||||
this.onSlotCtrlClick(villageId, buildId);
|
this.onSlotCtrlClick(villageId, buildId);
|
||||||
@ -168,25 +153,6 @@ export class ControlPanel {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private createDepositsQuickActions(villageId: number) {
|
|
||||||
const deposits = grabResourceSlots();
|
|
||||||
if (deposits.length === 0) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
const quickActions: QuickAction[] = [];
|
|
||||||
const sorted = deposits.sort((x, y) => x.level - y.level);
|
|
||||||
const minLevel = sorted[0].level;
|
|
||||||
for (let i = minLevel + 1; i < minLevel + 4; ++i) {
|
|
||||||
quickActions.push({
|
|
||||||
label: `Ресурсы до уровня ${i}`,
|
|
||||||
cb: () => {
|
|
||||||
this.scheduler.scheduleTask(ResourcesToLevel.name, { villageId, level: i });
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return quickActions;
|
|
||||||
}
|
|
||||||
|
|
||||||
private onSlotCtrlClick(villageId: number, buildId: number) {
|
private onSlotCtrlClick(villageId: number, buildId: number) {
|
||||||
this.scheduler.scheduleTask(UpgradeBuildingTask.name, { villageId, buildId });
|
this.scheduler.scheduleTask(UpgradeBuildingTask.name, { villageId, buildId });
|
||||||
notify(`Building ${buildId} scheduled`);
|
notify(`Building ${buildId} scheduled`);
|
||||||
|
@ -4,8 +4,6 @@
|
|||||||
<hdr></hdr>
|
<hdr></hdr>
|
||||||
<village-state-list />
|
<village-state-list />
|
||||||
<hr class="separator" />
|
<hr class="separator" />
|
||||||
<quick-actions />
|
|
||||||
<hr class="separator" />
|
|
||||||
<task-list />
|
<task-list />
|
||||||
</section>
|
</section>
|
||||||
<section id="dashboard-secondary" v-if="isSecondaryDashboardVisible">
|
<section id="dashboard-secondary" v-if="isSecondaryDashboardVisible">
|
||||||
@ -18,7 +16,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import Header from './Header';
|
import Header from './Header';
|
||||||
import TaskList from './TaskList';
|
import TaskList from './TaskList';
|
||||||
import QuickActions from './QuickActions';
|
|
||||||
import VillageStateList from './VillageStateList';
|
import VillageStateList from './VillageStateList';
|
||||||
import LogList from './LogList';
|
import LogList from './LogList';
|
||||||
import { mapState } from 'vuex';
|
import { mapState } from 'vuex';
|
||||||
@ -29,7 +26,6 @@ export default {
|
|||||||
'village-editor': VillageEditor,
|
'village-editor': VillageEditor,
|
||||||
'hdr': Header,
|
'hdr': Header,
|
||||||
'task-list': TaskList,
|
'task-list': TaskList,
|
||||||
'quick-actions': QuickActions,
|
|
||||||
'village-state-list': VillageStateList,
|
'village-state-list': VillageStateList,
|
||||||
'log-list': LogList,
|
'log-list': LogList,
|
||||||
},
|
},
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
<template>
|
|
||||||
<ul class="actions">
|
|
||||||
<li v-for="action in actions">
|
|
||||||
<a href="#" v-on:click.prevent="onAction(action.cb)">{{ action.label }}</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
shared: this.$root.$data,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
actions() {
|
|
||||||
return this.shared.quickActions;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
onAction(cb) {
|
|
||||||
cb();
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.actions {
|
|
||||||
margin: 10px auto;
|
|
||||||
padding-inline-start: 20px;
|
|
||||||
}
|
|
||||||
</style>
|
|
Loading…
Reference in New Issue
Block a user