mirror of
https://github.com/Terncode/pixel.horse.git
synced 2026-09-24 21:55:52 +02:00
Archive update v0.53.2
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
ng-template(#actionsModal)
|
||||
actions-modal((close)="closeActions()" [focusTrap]="true" (keydown)="$event.stopPropagation()")
|
||||
|
||||
.action-bar(
|
||||
[class.has-scroller]="hasScroller" [class.is-mobile]="mobile" [class.is-blurred]="blurred"
|
||||
#scroller (mousewheel)="scroll($event)" (wheel)="scroll($event)" (scroll)="true")
|
||||
@@ -14,6 +17,8 @@
|
||||
[draggablePad]="10"
|
||||
(draggableDrag)="drag(i)"
|
||||
(draggableDrop)="drop($event, i)")
|
||||
button.action-settings.game-button((click)="openActions()" style="touch-action: inherit;")
|
||||
fa-icon.action-icon([icon]="cogIcon" [fixedWidth]="true")
|
||||
.action-button-padding
|
||||
.scroller-label
|
||||
| scroll using this bar
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
.action-bar {
|
||||
overflow: hidden;
|
||||
padding-bottom: 7px;
|
||||
padding-bottom: 0px;
|
||||
padding-top: 7px;
|
||||
padding-right: 5px;
|
||||
max-width: calc(100vw - 50px);
|
||||
@@ -60,7 +60,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
action-button {
|
||||
.action-icon {
|
||||
font-size: 30px;
|
||||
position: relative;
|
||||
right: 6px;
|
||||
bottom: 8px;
|
||||
}
|
||||
|
||||
action-button, .action-settings {
|
||||
pointer-events: auto;
|
||||
margin: 3px 6px;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import { element, textNode, removeAllNodes, replaceNodes } from '../../../client
|
||||
import { DEFAULT_CHATLOG_OPACITY, PONY_TYPE } from '../../../common/constants';
|
||||
import { faCaretUp, faArrowDown } from '../../../client/icons';
|
||||
import { sampleMessages } from '../../../common/debugData';
|
||||
import { isMobile } from '../../../client/data';
|
||||
|
||||
interface IndexEntryUser {
|
||||
id: number;
|
||||
@@ -354,7 +355,10 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
|
||||
return (tab === 'local' || tab === 'party' || tab === 'whisper') ? tab : 'local';
|
||||
}
|
||||
get open() {
|
||||
return !this.settings.chatlogClosed;
|
||||
if (this.settings.chatlogClosed === undefined) {
|
||||
return !isMobile; // closed by default on mobile
|
||||
}
|
||||
return this.settings.chatlogClosed === false;
|
||||
}
|
||||
get width() {
|
||||
return this.settings.chatlogWidth || 500;
|
||||
@@ -475,7 +479,7 @@ export class ChatLog implements AfterViewInit, OnDestroy, DoCheck {
|
||||
}
|
||||
}
|
||||
toggle() {
|
||||
this.settings.chatlogClosed = !this.settings.chatlogClosed;
|
||||
this.settings.chatlogClosed = this.open;
|
||||
this.settingsService.saveBrowserSettings();
|
||||
this.updateOpen();
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ $color-picker-box-offset: 5px;
|
||||
border: solid 1px $border-color;
|
||||
border-radius: 2px;
|
||||
pointer-events: none;
|
||||
z-index: 10;
|
||||
|
||||
.disabled > & {
|
||||
opacity: 0.8;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.btn-group.d-flex(*ngIf="canInstall")
|
||||
button.btn.btn-lg.btn-outline-success.text-wrap.flex-grow-1((click)="install()")
|
||||
| Add #[b Pony Town] to {{isMobile ? 'home screen' : 'desktop'}}
|
||||
| Add #[b Pony Town Custom Server] to {{isMobile ? 'home screen' : 'desktop'}}
|
||||
button.btn.btn-lg.btn-outline-success.flex-grow-0(
|
||||
(click)="dismiss()" title="Dismiss" [attr.aria-label]="'Dismiss add to ' + (isMobile ? 'home screen' : 'desktop')")
|
||||
fa-icon([icon]="closeIcon")
|
||||
|
||||
@@ -13,7 +13,7 @@ export class InstallButton {
|
||||
constructor(private installService: InstallService) {
|
||||
}
|
||||
get canInstall() {
|
||||
return this.installService.canInstall;
|
||||
return false;
|
||||
}
|
||||
get isMobile() {
|
||||
return isMobile;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
nav.navbar.navbar-expand.justify-content-end(role="navigation")
|
||||
.d-none.d-md-block
|
||||
a.pixelart.logo(*ngIf="logo" routerLink="/" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }")
|
||||
img.pixelart.logo-large(revSrc="images/logo-large.png" alt="Pony Town" width="287" height="65")
|
||||
img.pixelart.logo-small(revSrc="images/logo-small.png" alt="Pony Town" width="37" height="43")
|
||||
img.pixelart.logo-large(revSrc="images/logo-large.png" alt="Pony Town Custom Server" width="287" height="88")
|
||||
img.pixelart.logo-small(revSrc="images/logo-small.png" alt="Pony Town Custom Server" width="37" height="43")
|
||||
|
||||
.navbar-collapse.text-right
|
||||
.navbar-nav.ml-auto
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
.form-group(*ngIf="isAndroidBrowser")
|
||||
.alert.alert-warning(role="alert")
|
||||
| Your browser is outdated and is not able to correctly run Pony Town.
|
||||
| Your browser is outdated and is not able to correctly run Pony Town Custom Server.
|
||||
| Please install different browser to be able to play the game.
|
||||
|
||||
.form-group(*ngIf="model.missingBirthdate && !birthdateSet && requestBirthdate")
|
||||
@@ -86,8 +86,8 @@
|
||||
.form-group(*ngIf="isBrowserOutdated")
|
||||
.alert.alert-warning(role="alert")
|
||||
button.close.float-right((click)="dismissOutdatedBrowser()" aria-label="Close" style="font-size: 20px;") ×
|
||||
| Your browser is outdated and is known to have issues running Pony Town.
|
||||
| Make sure you have latest version installed.
|
||||
| Your browser is outdated and is known to have issues running Pony Town Custom Server.
|
||||
| Make sure you have the latest version installed.
|
||||
|
||||
.form-group(*ngIf="invalidVersion && !offline")
|
||||
.alert.alert-danger(role="alert")
|
||||
|
||||
@@ -2,9 +2,11 @@
|
||||
h5 General rules
|
||||
ul.text-muted.list-rules
|
||||
li(*ngFor="let r of rules") {{r}}
|
||||
p.text-muted For more details about the rules, see our #[a(routerLink="/help" fragment="rules") Help page].
|
||||
hr
|
||||
|
||||
h5 Notice
|
||||
h5 This is a Pony Town custom server
|
||||
p.text-muted
|
||||
| This game is very #[strong early in development]. There might be bugs and occasional downtimes.
|
||||
| The developers of Pony Town are not responsible for this server or the contents on it in any way.
|
||||
p.text-muted
|
||||
| Please do not redistribute any of the game files or code.
|
||||
| You can check out the original game #[a(href="https://pony.town") here].
|
||||
|
||||
@@ -12,32 +12,33 @@ ng-template(#actionsModal)
|
||||
button.game-button.dropdown-toggle.no-arrow(dropdownToggle (click)="false" title="Settings")
|
||||
fa-icon([icon]="cogIcon" [fixedWidth]="true")
|
||||
.dropdown-menu.dropdown-menu-right.settings-box-menu(*dropdownMenu)
|
||||
.dropdown-header.d-flex.justify-content-between
|
||||
.dropdown-header.d-flex.justify-content-between.mb-1
|
||||
span {{server}}
|
||||
span.clock-display {{time}}
|
||||
.dropdown-item.d-flex
|
||||
.dropdown-item.d-flex.mb-1
|
||||
fa-icon.mr-2([icon]="searchIcon" [fixedWidth]="true")
|
||||
.flex-grow-1 Scale (x{{scale}})
|
||||
button.btn.btn-xs.btn-outline-secondary((click)="zoomOut()" aria-label="Zoom out")
|
||||
fa-icon([icon]="minusIcon" [fixedWidth]="true")
|
||||
button.btn.btn-xs.btn-outline-secondary.ml-2((click)="zoomIn()" aria-label="Zoom in")
|
||||
fa-icon([icon]="plusIcon" [fixedWidth]="true")
|
||||
.dropdown-item.dropdown-item-static
|
||||
.dropdown-item.dropdown-item-static.mb-1
|
||||
a((click)="toggleVolume()" title="Toggle sound")
|
||||
fa-icon([icon]="volumeIcon" [fixedWidth]="true")
|
||||
//.flex-grow-1 Volume
|
||||
slider-bar([(value)]="volume" [step]="1" (started)="volumeStarted()")
|
||||
.text-muted.text-right(*ngIf="track" style="margin-top: -5px;")
|
||||
small
|
||||
| playing: #[b {{track}}]
|
||||
a.text-muted.ml-1((click)="nextTrack()" title="Next track")
|
||||
fa-icon([icon]="forwardIcon" [fixedWidth]="true")
|
||||
a.dropdown-item((click)="unhideAllHiddenPlayers()")
|
||||
a.dropdown-item((click)="unhideAllHiddenPlayers()").mb-1
|
||||
fa-icon.mr-2([icon]="emptyIcon" [fixedWidth]="true")
|
||||
| Unhide players (temporary)
|
||||
a.dropdown-item((click)="openSettings()")
|
||||
a.dropdown-item((click)="openSettings()").mb-1
|
||||
fa-icon.mr-2([icon]="emptyIcon" [fixedWidth]="true")
|
||||
| Settings
|
||||
a.dropdown-item((click)="openActions()")
|
||||
a.dropdown-item((click)="openActions()").mb-1
|
||||
fa-icon.mr-2([icon]="emptyIcon" [fixedWidth]="true")
|
||||
| Actions
|
||||
//-a.dropdown-item((click)="openInvites()" *ngIf="hasInvites")
|
||||
|
||||
@@ -30,14 +30,12 @@
|
||||
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
|
||||
label#graphics-quality-label Graphics quality
|
||||
div
|
||||
slider-bar.mr-2.mb-2(
|
||||
[(value)]="browser.graphicsQuality" [min]="0" [max]="maxGraphicsQuality" [step]="1"
|
||||
style="max-width: 300px" labelledBy="graphics-quality-label")
|
||||
| {{graphicsQualityText}}
|
||||
.form-group
|
||||
custom-checkbox(
|
||||
[(checked)]="browser.brightNight"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Component, Output, EventEmitter, OnInit, OnDestroy } from '@angular/core';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { AccountSettings, BrowserSettings } from '../../../common/interfaces';
|
||||
import { AccountSettings, BrowserSettings, GraphicsQuality } from '../../../common/interfaces';
|
||||
import { SettingsService } from '../../services/settingsService';
|
||||
import {
|
||||
DEFAULT_CHATLOG_OPACITY, MAX_CHATLOG_RANGE, MIN_CHATLOG_RANGE, isChatlogRangeUnlimited, MAX_FILTER_WORDS_LENGTH
|
||||
@@ -9,7 +9,7 @@ import { StorageService } from '../../services/storageService';
|
||||
import { cloneDeep } from '../../../common/utils';
|
||||
import { PonyTownGame } from '../../../client/game';
|
||||
import { updateRangeIndicator, readFileAsText } from '../../../client/clientUtils';
|
||||
import { faSlidersH, faCommentSlash, faGamepad, faImage, faDownload, faUpload } from '../../../client/icons';
|
||||
import { faSlidersH, faCommentSlash, faGamepad, faImage, faDownload, faUpload, faComment } from '../../../client/icons';
|
||||
|
||||
@Component({
|
||||
selector: 'settings-modal',
|
||||
@@ -19,8 +19,10 @@ import { faSlidersH, faCommentSlash, faGamepad, faImage, faDownload, faUpload }
|
||||
export class SettingsModal implements OnInit, OnDestroy {
|
||||
readonly maxChatlogRange = MAX_CHATLOG_RANGE;
|
||||
readonly minChatlogRange = MIN_CHATLOG_RANGE;
|
||||
readonly maxGraphicsQuality: number;
|
||||
readonly maxGraphicsQualityValue: GraphicsQuality;
|
||||
readonly gameIcon = faSlidersH;
|
||||
readonly chatIcon = faCommentSlash;
|
||||
readonly chatIcon = faComment;
|
||||
readonly filtersIcon = faCommentSlash;
|
||||
readonly controlsIcon = faGamepad;
|
||||
readonly graphicsIcon = faImage;
|
||||
@@ -38,6 +40,24 @@ export class SettingsModal implements OnInit, OnDestroy {
|
||||
private storage: StorageService,
|
||||
private game: PonyTownGame,
|
||||
) {
|
||||
if (game.webgl) {
|
||||
if (game.webgl.failedFBO) {
|
||||
this.maxGraphicsQuality = 0;
|
||||
this.maxGraphicsQualityValue = GraphicsQuality.Low;
|
||||
}
|
||||
else if (game.webgl.failedDepthBuffer) {
|
||||
this.maxGraphicsQuality = 1;
|
||||
this.maxGraphicsQualityValue = GraphicsQuality.Medium;
|
||||
}
|
||||
else {
|
||||
this.maxGraphicsQuality = 2;
|
||||
this.maxGraphicsQualityValue = GraphicsQuality.High;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.maxGraphicsQuality = 2;
|
||||
this.maxGraphicsQualityValue = GraphicsQuality.High;
|
||||
}
|
||||
}
|
||||
get pane() {
|
||||
return this.storage.getItem('settings-modal-pane') || 'game';
|
||||
@@ -45,13 +65,25 @@ export class SettingsModal implements OnInit, OnDestroy {
|
||||
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`;
|
||||
}
|
||||
get graphicsQualityText() {
|
||||
if (!this.game.webgl || (this.browser.graphicsQuality === undefined)) {
|
||||
return 'Undefined';
|
||||
}
|
||||
|
||||
if (this.game.webgl.failedFBO || (this.browser.graphicsQuality === GraphicsQuality.Low)) {
|
||||
return 'Low';
|
||||
}
|
||||
else if (this.game.webgl.failedDepthBuffer || (this.browser.graphicsQuality === GraphicsQuality.Medium)) {
|
||||
return 'Medium';
|
||||
}
|
||||
else {
|
||||
return 'High';
|
||||
}
|
||||
}
|
||||
ngOnInit() {
|
||||
this.accountBackup = cloneDeep(this.settingsService.account);
|
||||
this.browserBackup = cloneDeep(this.settingsService.browser);
|
||||
@@ -120,6 +152,10 @@ export class SettingsModal implements OnInit, OnDestroy {
|
||||
if (this.account.filterWords === undefined) {
|
||||
this.account.filterWords = '';
|
||||
}
|
||||
|
||||
if (this.browser.graphicsQuality === undefined) {
|
||||
this.browser.graphicsQuality = this.maxGraphicsQualityValue;
|
||||
}
|
||||
}
|
||||
export() {
|
||||
const account = { ...this.account, actions: undefined };
|
||||
|
||||
@@ -23,8 +23,6 @@ import { EmoteBox } from './emote-box/emote-box';
|
||||
import { SliderBar } from './slider-bar/slider-bar';
|
||||
import { SpriteBox } from './sprite-box/sprite-box';
|
||||
import { SpriteSelection } from './sprite-selection/sprite-selection';
|
||||
import { SupportButton } from './support-button/support-button';
|
||||
import { SupporterPony } from './supporter-pony/supporter-pony';
|
||||
import { SetSelection, SetOutlineHidden } from './set-selection/set-selection';
|
||||
import { CheckBox } from './check-box/check-box';
|
||||
import { PortraitBox } from './portrait-box/portrait-box';
|
||||
@@ -73,6 +71,8 @@ import { dropdownDirectives } from './directives/dropdown';
|
||||
import { SaveActiveTab } from './directives/saveActiveTab';
|
||||
|
||||
import { SiteNamePipe } from './pipes/siteName';
|
||||
import { VisitPTButton } from './visit-pt-button/visit-pt-button';
|
||||
import { VisitPTPony } from './visit-pt-pony/visit-pt-pony';
|
||||
|
||||
const declarations = [
|
||||
ActionBar,
|
||||
@@ -89,8 +89,8 @@ const declarations = [
|
||||
SliderBar,
|
||||
SpriteBox,
|
||||
SpriteSelection,
|
||||
SupportButton,
|
||||
SupporterPony,
|
||||
VisitPTButton,
|
||||
VisitPTPony,
|
||||
SetSelection,
|
||||
SetOutlineHidden,
|
||||
CheckBox,
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
a.btn.btn-lg.btn-outline-patreon.btn-block.mb-2(
|
||||
*ngIf="patreonLink" (mouseenter)="pony.excite()" (mouseout)="pony.reset()" [href]="patreonLink" target="_blank"
|
||||
rel="noopener noreferrer")
|
||||
| {{supporter ? 'Thank you for supporting us!' : 'Support us on Patreon!'}}
|
||||
svg.patreon-logo(xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 150")
|
||||
circle(fill="#f9685f" cx="75" cy="75" r="75")
|
||||
path(fill="#052d49" d="M31.729 27.659h17.578v95.888H31.729z")
|
||||
circle(fill="#fff" cy="63.565" cx="95.783" r="35.955")
|
||||
.supporter-pony
|
||||
supporter-pony(#pony [scale]="2")
|
||||
@@ -1,17 +0,0 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { Model } from '../../services/model';
|
||||
import { supporterLink } from '../../../client/data';
|
||||
|
||||
@Component({
|
||||
selector: 'support-button',
|
||||
templateUrl: 'support-button.pug',
|
||||
styleUrls: ['support-button.scss'],
|
||||
})
|
||||
export class SupportButton {
|
||||
readonly patreonLink = supporterLink;
|
||||
constructor(private model: Model) {
|
||||
}
|
||||
get supporter() {
|
||||
return this.model.supporter;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
a.btn.btn-lg.btn-pt.btn-outline-primary.btn-block.mb-2(
|
||||
*ngIf="enableVisitPTButton" (mouseenter)="pony.select()" (mouseout)="pony.reset()" [href]="ptLink" target="_blank"
|
||||
rel="noopener noreferrer")
|
||||
.pt-logo
|
||||
img.pixelart.logo(revSrc="images/logo-small.png")
|
||||
| {{'Visit Pony Town main server!'}}
|
||||
.visit-pt-pony
|
||||
visit-pt-pony(#pony [scale]="2")
|
||||
+14
-8
@@ -12,30 +12,36 @@
|
||||
}
|
||||
}
|
||||
|
||||
.patreon-logo {
|
||||
.btn-pt {
|
||||
padding: 1.0rem;
|
||||
font-weight: 500;
|
||||
//height: 60px;
|
||||
}
|
||||
|
||||
.pt-logo {
|
||||
position: absolute;
|
||||
left: 8px;
|
||||
top: 5px;
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
top: 6px;
|
||||
width: 37px;
|
||||
height: 47px;
|
||||
|
||||
@media (max-width: 320px) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
.supporter-pony {
|
||||
.visit-pt-pony {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
height: 70px;
|
||||
height: 80px;
|
||||
width: 100px;
|
||||
overflow: hidden;
|
||||
border-radius: $border-radius-lg - 2px;
|
||||
|
||||
> supporter-pony {
|
||||
> visit-pt-pony {
|
||||
position: absolute;
|
||||
bottom: -95px;
|
||||
bottom: -80px;
|
||||
left: -20px;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Component } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'visit-pt-button',
|
||||
templateUrl: 'visit-pt-button.pug',
|
||||
styleUrls: ['visit-pt-button.scss'],
|
||||
})
|
||||
export class VisitPTButton {
|
||||
readonly ptLink = 'http://pony.town';
|
||||
readonly enableVisitPTButton = true;
|
||||
constructor() {
|
||||
}
|
||||
}
|
||||
+42
-15
@@ -1,41 +1,42 @@
|
||||
import { Component, OnInit, OnDestroy, Input, ViewChild } from '@angular/core';
|
||||
import { defaultExpression } from '../../../client/ponyUtils';
|
||||
import { defaultPonyState } from '../../../client/ponyHelpers';
|
||||
import { SUPPORTER_PONY } from '../../../common/constants';
|
||||
import { Expression, Muzzle, HeadAnimation, Iris } from '../../../common/interfaces';
|
||||
import { excite } from '../../../client/ponyAnimations';
|
||||
import { Expression, Muzzle, HeadAnimation, BodyAnimation, Eye } from '../../../common/interfaces';
|
||||
import { excite_meno, happy_tongue_meno, stand, boop, happy_tongue_meno_2 } from '../../../client/ponyAnimations';
|
||||
import { FrameService, FrameLoop } from '../../services/frameService';
|
||||
import { CharacterPreview } from '../character-preview/character-preview';
|
||||
import { decompressPonyString } from '../../../common/compressPony';
|
||||
|
||||
const BLEP: Expression = {
|
||||
...defaultExpression,
|
||||
left: Eye.Neutral2,
|
||||
right: Eye.Neutral2,
|
||||
muzzle: Muzzle.Blep,
|
||||
};
|
||||
|
||||
const EXCITED: Expression = {
|
||||
...defaultExpression,
|
||||
left: Eye.Neutral2,
|
||||
right: Eye.Neutral2,
|
||||
muzzle: Muzzle.SmileOpen,
|
||||
};
|
||||
|
||||
const DERP: Expression = {
|
||||
...defaultExpression,
|
||||
muzzle: Muzzle.SmileOpen,
|
||||
leftIris: Iris.Up,
|
||||
};
|
||||
const MENO = 'DBWIzP8imd08//D19fVazSjcwf1GhLNEiMxENSovLy/NsIdJQDnGqYBiSztWQTM6LychEnE/KRX///9WPeE1HbSpBUEIIASwgEIAAAAAbIAgCFMY34AHAAjwgCMRQCVLY38IDhAAwmFBz4fAIxjKM6SjGlaxjWtYgjGI';
|
||||
|
||||
@Component({
|
||||
selector: 'supporter-pony',
|
||||
templateUrl: 'supporter-pony.pug',
|
||||
selector: 'visit-pt-pony',
|
||||
templateUrl: 'visit-pt-pony.pug',
|
||||
})
|
||||
export class SupporterPony implements OnInit, OnDestroy {
|
||||
export class VisitPTPony implements OnInit, OnDestroy {
|
||||
@ViewChild('characterPreview', { static: true }) characterPreview!: CharacterPreview;
|
||||
@Input() scale = 3;
|
||||
pony = decompressPonyString(SUPPORTER_PONY);
|
||||
pony = decompressPonyString(MENO);
|
||||
state = defaultPonyState();
|
||||
private expression?: Expression;
|
||||
private headAnimation?: HeadAnimation;
|
||||
private headTime = 0;
|
||||
private bodyAnimation?: BodyAnimation;
|
||||
private bodyTime = 0;
|
||||
private loop: FrameLoop;
|
||||
constructor(frameService: FrameService) {
|
||||
this.loop = frameService.create(delta => this.tick(delta));
|
||||
@@ -46,16 +47,29 @@ export class SupporterPony implements OnInit, OnDestroy {
|
||||
ngOnDestroy() {
|
||||
this.loop.destroy();
|
||||
}
|
||||
excite() {
|
||||
select() {
|
||||
this.headTime = 0;
|
||||
this.headAnimation = excite;
|
||||
this.expression = Math.random() < 0.2 ? DERP : EXCITED;
|
||||
this.bodyTime = 0;
|
||||
this.expression = EXCITED;
|
||||
this.bodyAnimation = Math.random() < 0.25 ? boop : stand;
|
||||
|
||||
const headRandom = Math.random();
|
||||
if (headRandom < 0.5) {
|
||||
this.headAnimation = excite_meno;
|
||||
}
|
||||
else if (headRandom < 0.8) {
|
||||
this.headAnimation = happy_tongue_meno;
|
||||
}
|
||||
else {
|
||||
this.headAnimation = happy_tongue_meno_2;
|
||||
}
|
||||
}
|
||||
reset() {
|
||||
this.expression = undefined;
|
||||
}
|
||||
private tick(delta: number) {
|
||||
this.headTime += delta;
|
||||
this.bodyTime += delta;
|
||||
|
||||
if (this.headAnimation) {
|
||||
const frame = Math.floor(this.headTime * this.headAnimation.fps);
|
||||
@@ -83,6 +97,19 @@ export class SupporterPony implements OnInit, OnDestroy {
|
||||
}
|
||||
}
|
||||
|
||||
if (this.bodyAnimation) {
|
||||
const frame = Math.floor(this.bodyTime * this.bodyAnimation.fps * 0.75);
|
||||
|
||||
if (frame >= this.bodyAnimation.frames.length && !this.bodyAnimation.loop) {
|
||||
this.bodyAnimation = undefined;
|
||||
this.state.animation = stand;
|
||||
this.state.animationFrame = 0;
|
||||
} else {
|
||||
this.state.animation = this.bodyAnimation;
|
||||
this.state.animationFrame = frame % this.bodyAnimation.frames.length;
|
||||
}
|
||||
}
|
||||
|
||||
this.state.expression = this.expression;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user