Archive update v0.53.2

This commit is contained in:
Eliot Partridge
2019-09-17 20:19:23 -05:00
parent ac640dbe1a
commit 2c4e29eb70
133 changed files with 8047 additions and 9286 deletions
@@ -1,4 +1,5 @@
import { Component, Input, ViewChild, ElementRef } from '@angular/core';
import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal';
import { ButtonAction } from '../../../common/interfaces';
import { PonyTownGame } from '../../../client/game';
import { isMobile } from '../../../client/data';
@@ -6,6 +7,7 @@ import { useAction, serializeActions } from '../../../client/buttonActions';
import { SettingsService } from '../../services/settingsService';
import { ACTIONS_LIMIT } from '../../../common/constants';
import { last } from '../../../common/utils';
import { faCog } from '../../../client/icons';
@Component({
selector: 'action-bar',
@@ -14,11 +16,14 @@ import { last } from '../../../common/utils';
})
export class ActionBar {
@ViewChild('scroller', { static: true }) scroller!: ElementRef;
@ViewChild('actionsModal', { static: true }) actionsModal!: ElementRef;
@Input() blurred = false;
readonly cogIcon = faCog;
activeAction: ButtonAction | undefined = undefined;
shortcuts = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '='];
private modalRef?: BsModalRef;
private _editable = false;
constructor(private game: PonyTownGame, private settings: SettingsService) {
constructor(private game: PonyTownGame, private settings: SettingsService, private modalService: BsModalService) {
}
@Input() get editable() {
return this._editable;
@@ -68,6 +73,20 @@ export class ActionBar {
this.scroller.nativeElement.scrollLeft += delta * 20;
}
}
openActions() {
if (this.modalRef) {
this.closeActions();
}
else {
this.modalRef = this.modalService.show(this.actionsModal, { ignoreBackdropClick: true });
}
}
closeActions() {
if (this.modalRef) {
this.modalRef.hide();
this.modalRef = undefined;
}
}
private updateFreeSlots() {
const actions = this.actions;