mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-24 21:55:52 +02:00
Archive commit
This commit is contained in:
@@ -0,0 +1,132 @@
|
||||
.modal-header.d-none.d-sm-block.d-none-for-low-height
|
||||
h4.modal-title(labelledBy=".modal")
|
||||
| Settings
|
||||
|
||||
.modal-body.modal-checkboxes
|
||||
tabset(type="pills")
|
||||
tab(title="Game" [icon]="gameIcon")
|
||||
div(*tabContent)
|
||||
.form-group
|
||||
custom-checkbox(
|
||||
[(checked)]="account.ignorePartyInvites"
|
||||
help="Useful when other players bother you with unwanted party invites (does not apply to friends)")
|
||||
| Ignore party invites
|
||||
.form-group
|
||||
custom-checkbox(
|
||||
[(checked)]="account.ignoreFriendInvites"
|
||||
help="Useful when other players bother you with unwanted friend requests")
|
||||
| Ignore friend requests
|
||||
.form-group
|
||||
custom-checkbox(
|
||||
[(checked)]="account.seeThroughObjects"
|
||||
help="Makes all obstacles transparent")
|
||||
| See through obstacles
|
||||
.form-group
|
||||
custom-checkbox(
|
||||
[(checked)]="browser.walkByDefault"
|
||||
help="Uses walking speed by default and run when pressing shift key")
|
||||
| Prefer walking to running
|
||||
|
||||
tab(title="Graphics" [icon]="graphicsIcon")
|
||||
div(*tabContent)
|
||||
.form-group
|
||||
custom-checkbox(
|
||||
*ngIf="!lockLowGraphicsMode" [(checked)]="browser.lowGraphicsMode"
|
||||
help="Can improve game performance in some cases")
|
||||
| Low graphics mode
|
||||
custom-checkbox(
|
||||
*ngIf="lockLowGraphicsMode" [checked]="true" [disabled]="true"
|
||||
help="Can improve game performance in some cases")
|
||||
| Low graphics mode
|
||||
.form-group
|
||||
custom-checkbox(
|
||||
[(checked)]="browser.brightNight"
|
||||
help="Increases brightness of the game at night and in dark areas")
|
||||
| Brighter darkness
|
||||
.form-group
|
||||
custom-checkbox(
|
||||
[(checked)]="browser.powerSaving"
|
||||
help="Reduces frame rate to extend battery life and reduce CPU overheating")
|
||||
| Power saving mode
|
||||
.form-group
|
||||
custom-checkbox(
|
||||
[(checked)]="browser.showStats"
|
||||
help="Show rendering and network stats")
|
||||
| Show statistics
|
||||
.form-group
|
||||
custom-checkbox(
|
||||
[(checked)]="browser.showFps"
|
||||
help="Show FPS counter")
|
||||
| Show FPS
|
||||
|
||||
tab(title="Chat" [icon]="chatIcon")
|
||||
div(*tabContent)
|
||||
.form-group
|
||||
custom-checkbox(
|
||||
[(checked)]="account.ignorePublicChat"
|
||||
help="Don't show any public chat messages, only party chat and whispes will be visible")
|
||||
| Hide all public chat messages
|
||||
.form-group
|
||||
custom-checkbox(
|
||||
[(checked)]="account.ignoreNonFriendWhispers"
|
||||
help="Don't show any whispers from players who are not on your friends list")
|
||||
| Only allow whispers from friends
|
||||
.form-group
|
||||
label#chatlog-opacity-label Chatlog background opacity
|
||||
div
|
||||
slider-bar.mr-2(
|
||||
[(value)]="account.chatlogOpacity" style="max-width: 300px" labelledBy="chatlog-opacity-label")
|
||||
| {{(account.chatlogOpacity / 100) | percent}}
|
||||
small.form-text.text-muted.mt-0 Changes chatlog background to make it more readable or less obtrusive.
|
||||
.form-group
|
||||
label#chatlog-range-label Chatlog range
|
||||
div
|
||||
slider-bar.mr-2(
|
||||
[(value)]="account.chatlogRange" [min]="minChatlogRange" [max]="maxChatlogRange" [step]="1"
|
||||
(valueChange)="updateChatlogRange($event)" (changed)="finishChatlogRange()"
|
||||
style="max-width: 300px" labelledBy="chatlog-range-label")
|
||||
| {{chatlogRangeText}}
|
||||
small.form-text.text-muted.mt-0
|
||||
| Only show messages in chatlog from players near you (doesn't affect party chat or whispers).
|
||||
|
||||
tab(title="Filters" [icon]="filtersIcon")
|
||||
div(*tabContent)
|
||||
.form-group
|
||||
custom-checkbox(
|
||||
[(checked)]="account.filterCyrillic"
|
||||
help="Hide all messages containing russian alphabet")
|
||||
| Filter russian chat
|
||||
.form-group
|
||||
custom-checkbox(
|
||||
[(checked)]="account.filterSwearWords"
|
||||
help="Censors swear words and other harmful phrases in the chat")
|
||||
| Filter bad words
|
||||
.form-group
|
||||
label.mb-1 Custom chat filter
|
||||
small.form-text.text-muted.mt-0.mb-2
|
||||
| Space separated list of words to filter.
|
||||
| All chat messages containing listed words will be hidden.
|
||||
| Does not affect party chat or whispers from friends.
|
||||
textarea.form-control(rows="5" [(ngModel)]="account.filterWords")
|
||||
|
||||
tab(title="Controls" [icon]="controlsIcon")
|
||||
div(*tabContent)
|
||||
.form-group
|
||||
custom-checkbox(
|
||||
[(checked)]="browser.disableGamepad"
|
||||
help="Useful if gamepad controls are causing issues with the game")
|
||||
| Disable gamepad controls
|
||||
.form-group
|
||||
custom-checkbox(
|
||||
[(checked)]="browser.disableFKeys"
|
||||
help="Useful if you're using function keys in a way that conflicts with game controls")
|
||||
| Disable function keys (F1-F12)
|
||||
|
||||
.modal-footer.d-flex
|
||||
button.btn.btn-outline-secondary.d-none.d-sm-block((click)="reset()")
|
||||
| Reset
|
||||
.flex-grow-1
|
||||
button.btn.btn-outline-secondary((click)="cancel()")
|
||||
| Cancel
|
||||
button.btn.btn-outline-secondary.ml-2((click)="ok()")
|
||||
| OK
|
||||
@@ -0,0 +1,12 @@
|
||||
@import '../../../../styles/partials/variables';
|
||||
|
||||
.modal-body {
|
||||
min-height: 450px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.modal-footer {
|
||||
.btn {
|
||||
min-width: 100px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
import { Component, Output, EventEmitter, OnInit, OnDestroy } from '@angular/core';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { AccountSettings, BrowserSettings } from '../../../common/interfaces';
|
||||
import { SettingsService } from '../../services/settingsService';
|
||||
import {
|
||||
DEFAULT_CHATLOG_OPACITY, MAX_CHATLOG_RANGE, MIN_CHATLOG_RANGE, isChatlogRangeUnlimited, MAX_FILTER_WORDS_LENGTH
|
||||
} from '../../../common/constants';
|
||||
import { StorageService } from '../../services/storageService';
|
||||
import { cloneDeep } from '../../../common/utils';
|
||||
import { PonyTownGame } from '../../../client/game';
|
||||
import { updateRangeIndicator } from '../../../client/clientUtils';
|
||||
import { faSlidersH, faCommentSlash, faGamepad, faImage } from '../../../client/icons';
|
||||
|
||||
@Component({
|
||||
selector: 'settings-modal',
|
||||
templateUrl: 'settings-modal.pug',
|
||||
styleUrls: ['settings-modal.scss'],
|
||||
})
|
||||
export class SettingsModal implements OnInit, OnDestroy {
|
||||
readonly maxChatlogRange = MAX_CHATLOG_RANGE;
|
||||
readonly minChatlogRange = MIN_CHATLOG_RANGE;
|
||||
readonly gameIcon = faSlidersH;
|
||||
readonly chatIcon = faCommentSlash;
|
||||
readonly filtersIcon = faCommentSlash;
|
||||
readonly controlsIcon = faGamepad;
|
||||
readonly graphicsIcon = faImage;
|
||||
@Output() close = new EventEmitter();
|
||||
account: AccountSettings = {};
|
||||
browser: BrowserSettings = {};
|
||||
accountBackup: AccountSettings = {};
|
||||
browserBackup: BrowserSettings = {};
|
||||
private done = false;
|
||||
private subscription?: Subscription;
|
||||
constructor(
|
||||
private settingsService: SettingsService,
|
||||
private storage: StorageService,
|
||||
private game: PonyTownGame,
|
||||
) {
|
||||
}
|
||||
get pane() {
|
||||
return this.storage.getItem('settings-modal-pane') || 'game';
|
||||
}
|
||||
set pane(value: string) {
|
||||
this.storage.setItem('settings-modal-pane', value);
|
||||
}
|
||||
get lockLowGraphicsMode() {
|
||||
return this.game.failedFBO;
|
||||
}
|
||||
get chatlogRangeText() {
|
||||
const range = this.account.chatlogRange;
|
||||
return isChatlogRangeUnlimited(range) ? 'entire screen' : `${range} tiles`;
|
||||
}
|
||||
ngOnInit() {
|
||||
this.accountBackup = cloneDeep(this.settingsService.account);
|
||||
this.browserBackup = cloneDeep(this.settingsService.browser);
|
||||
this.account = this.settingsService.account;
|
||||
this.browser = this.settingsService.browser;
|
||||
this.setupDefaults();
|
||||
this.subscription = this.game.onLeft.subscribe(() => this.cancel());
|
||||
}
|
||||
ngOnDestroy() {
|
||||
this.finishChatlogRange();
|
||||
|
||||
if (!this.done) {
|
||||
this.cancel();
|
||||
}
|
||||
|
||||
this.subscription && this.subscription.unsubscribe();
|
||||
}
|
||||
reset() {
|
||||
this.account = this.settingsService.account = {};
|
||||
this.browser = this.settingsService.browser = {};
|
||||
this.setupDefaults();
|
||||
}
|
||||
cancel() {
|
||||
this.done = true;
|
||||
this.settingsService.account = this.accountBackup;
|
||||
this.settingsService.browser = this.browserBackup;
|
||||
this.close.emit();
|
||||
}
|
||||
ok() {
|
||||
if (this.account.filterWords) {
|
||||
let filter = this.account.filterWords;
|
||||
|
||||
while (filter.length > MAX_FILTER_WORDS_LENGTH && /\s/.test(filter)) {
|
||||
filter = filter.trim().replace(/\s+\S+$/, '');
|
||||
}
|
||||
|
||||
if (filter.length > MAX_FILTER_WORDS_LENGTH) {
|
||||
this.account.filterWords = '';
|
||||
} else {
|
||||
this.account.filterWords = filter;
|
||||
}
|
||||
}
|
||||
|
||||
this.done = true;
|
||||
this.settingsService.saveAccountSettings(this.account);
|
||||
this.settingsService.saveBrowserSettings(this.browser);
|
||||
this.close.emit();
|
||||
}
|
||||
updateChatlogRange(range: number | undefined) {
|
||||
document.body.classList.add('translucent-modals');
|
||||
updateRangeIndicator(range, this.game);
|
||||
}
|
||||
finishChatlogRange() {
|
||||
document.body.classList.remove('translucent-modals');
|
||||
updateRangeIndicator(undefined, this.game);
|
||||
}
|
||||
private setupDefaults() {
|
||||
if (this.account.chatlogOpacity === undefined) {
|
||||
this.account.chatlogOpacity = DEFAULT_CHATLOG_OPACITY;
|
||||
}
|
||||
|
||||
if (this.account.chatlogRange === undefined) {
|
||||
this.account.chatlogRange = MAX_CHATLOG_RANGE;
|
||||
}
|
||||
|
||||
if (this.account.filterWords === undefined) {
|
||||
this.account.filterWords = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user