mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-01-31 03:12:35 +01:00
Avatar updates
This commit is contained in:
parent
90fe77abd1
commit
35a91d4ffb
@ -18,7 +18,7 @@ export class AvatarFigureContainer implements IAvatarFigureContainer
|
||||
|
||||
public hasPartType(k: string): boolean
|
||||
{
|
||||
return this.partSets().get(k) !== null;
|
||||
return !!this.partSets().get(k);
|
||||
}
|
||||
|
||||
public getPartSetId(k: string): number
|
||||
@ -39,18 +39,18 @@ export class AvatarFigureContainer implements IAvatarFigureContainer
|
||||
return existing.get('colorids');
|
||||
}
|
||||
|
||||
public updatePart(k: string, _arg_2: number, _arg_3: number[]): void
|
||||
public updatePart(setType: string, partSetId: number, colorIds: number[]): void
|
||||
{
|
||||
const set: Map<string, any> = new Map();
|
||||
|
||||
set.set('type', k);
|
||||
set.set('setid', _arg_2);
|
||||
set.set('colorids', _arg_3);
|
||||
set.set('type', setType);
|
||||
set.set('setid', partSetId);
|
||||
set.set('colorids', colorIds);
|
||||
|
||||
const existingSets = this.partSets();
|
||||
|
||||
existingSets.delete(k);
|
||||
existingSets.set(k, set);
|
||||
existingSets.delete(setType);
|
||||
existingSets.set(setType, set);
|
||||
}
|
||||
|
||||
public removePart(k: string): void
|
||||
|
@ -1,8 +1,9 @@
|
||||
import { AdvancedMap } from '../../../../core';
|
||||
import { IPartColor } from './IPartColor';
|
||||
|
||||
export interface IPalette
|
||||
{
|
||||
getColor(id: number): IPartColor;
|
||||
id: number;
|
||||
colors: Map<string, IPartColor>;
|
||||
colors: AdvancedMap<string, IPartColor>;
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
import { AdvancedMap } from '../../../../core';
|
||||
import { IFigureDataPalette } from '../../interfaces';
|
||||
import { IPalette } from './IPalette';
|
||||
import { IPartColor } from './IPartColor';
|
||||
@ -6,14 +7,14 @@ import { PartColor } from './PartColor';
|
||||
export class Palette implements IPalette
|
||||
{
|
||||
private _id: number;
|
||||
private _colors: Map<string, IPartColor>;
|
||||
private _colors: AdvancedMap<string, IPartColor>;
|
||||
|
||||
constructor(data: IFigureDataPalette)
|
||||
{
|
||||
if(!data) throw new Error('invalid_data');
|
||||
|
||||
this._id = data.id;
|
||||
this._colors = new Map();
|
||||
this._colors = new AdvancedMap();
|
||||
|
||||
this.append(data);
|
||||
}
|
||||
@ -24,7 +25,7 @@ export class Palette implements IPalette
|
||||
{
|
||||
const newColor = new PartColor(color);
|
||||
|
||||
this._colors.set(color.id.toString(), newColor);
|
||||
this._colors.add(color.id.toString(), newColor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,7 +33,7 @@ export class Palette implements IPalette
|
||||
{
|
||||
if((id === undefined) || id < 0) return null;
|
||||
|
||||
return (this._colors.get(id.toString()) || null);
|
||||
return (this._colors.getValue(id.toString()) || null);
|
||||
}
|
||||
|
||||
public get id(): number
|
||||
@ -40,7 +41,7 @@ export class Palette implements IPalette
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public get colors(): Map<string, IPartColor>
|
||||
public get colors(): AdvancedMap<string, IPartColor>
|
||||
{
|
||||
return this._colors;
|
||||
}
|
||||
|
@ -60,13 +60,13 @@ export class SetType implements ISetType
|
||||
for(const set of setType.sets) this._partSets.add(set.id.toString(), new FigurePartSet(this._type, set));
|
||||
}
|
||||
|
||||
public getDefaultPartSet(k: string): IFigurePartSet
|
||||
public getDefaultPartSet(gender: string): IFigurePartSet
|
||||
{
|
||||
for(const set of this._partSets.getValues())
|
||||
{
|
||||
if(!set) continue;
|
||||
|
||||
if((set.clubLevel === 0) && ((set.gender === k) || (set.gender === 'U'))) return set;
|
||||
if((set.clubLevel === 0) && ((set.gender === gender) || (set.gender === 'U'))) return set;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user