implemented feedback
This commit is contained in:
parent
7c6b73efdb
commit
e5a196a42b
9 changed files with 31 additions and 35 deletions
|
@ -1,6 +1,6 @@
|
|||
import Sprite = Phaser.GameObjects.Sprite;
|
||||
import Container = Phaser.GameObjects.Container;
|
||||
import { lazyLoadResource } from "./CompanionTexturesLoadingManager";
|
||||
import { lazyLoadCompanionResource } from "./CompanionTexturesLoadingManager";
|
||||
import { PlayerAnimationDirections, PlayerAnimationTypes } from "../Player/Animation";
|
||||
|
||||
export interface CompanionStatus {
|
||||
|
@ -37,7 +37,7 @@ export class Companion extends Container {
|
|||
|
||||
this.companionName = name;
|
||||
|
||||
lazyLoadResource(this.scene.load, this.companionName)
|
||||
lazyLoadCompanionResource(this.scene.load, this.companionName)
|
||||
.then(resource => {
|
||||
this.addResource(resource);
|
||||
this.invisible = false;
|
||||
|
|
|
@ -1,23 +1,15 @@
|
|||
import LoaderPlugin = Phaser.Loader.LoaderPlugin;
|
||||
import { COMPANION_RESOURCES, CompanionResourceDescriptionInterface } from "./CompanionTextures";
|
||||
|
||||
export const getAllResources = (): CompanionResourceDescriptionInterface[] => {
|
||||
export const getAllCompanionResources = (loader: LoaderPlugin): CompanionResourceDescriptionInterface[] => {
|
||||
COMPANION_RESOURCES.forEach((resource: CompanionResourceDescriptionInterface) => {
|
||||
lazyLoadCompanionResource(loader, resource.name);
|
||||
});
|
||||
|
||||
return COMPANION_RESOURCES;
|
||||
}
|
||||
|
||||
export const lazyLoadAllResources = (loader: LoaderPlugin): Promise<CompanionResourceDescriptionInterface[]> => {
|
||||
const promises: Promise<string>[] = [];
|
||||
|
||||
COMPANION_RESOURCES.forEach((resource: CompanionResourceDescriptionInterface) => {
|
||||
promises.push(lazyLoadResource(loader, resource.name));
|
||||
});
|
||||
|
||||
return Promise.all(promises).then(() => {
|
||||
return COMPANION_RESOURCES;
|
||||
});
|
||||
}
|
||||
|
||||
export const lazyLoadResource = (loader: LoaderPlugin, name: string): Promise<string> => {
|
||||
export const lazyLoadCompanionResource = (loader: LoaderPlugin, name: string): Promise<string> => {
|
||||
return new Promise((resolve, reject) => {
|
||||
const resource = COMPANION_RESOURCES.find(item => item.name === name);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue