mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-02-21 20:12:36 +01:00
Small changes
This commit is contained in:
parent
568d3829bd
commit
50b80b6eae
@ -13,6 +13,7 @@ import { INitroLocalizationManager } from './localization/INitroLocalizationMana
|
|||||||
import { IRoomEngine } from './room/IRoomEngine';
|
import { IRoomEngine } from './room/IRoomEngine';
|
||||||
import { IRoomSessionManager } from './session/IRoomSessionManager';
|
import { IRoomSessionManager } from './session/IRoomSessionManager';
|
||||||
import { ISessionDataManager } from './session/ISessionDataManager';
|
import { ISessionDataManager } from './session/ISessionDataManager';
|
||||||
|
import { ISoundManager } from './sound/ISoundManager';
|
||||||
|
|
||||||
export interface INitro extends Application
|
export interface INitro extends Application
|
||||||
{
|
{
|
||||||
@ -41,6 +42,7 @@ export interface INitro extends Application
|
|||||||
roomSessionManager: IRoomSessionManager;
|
roomSessionManager: IRoomSessionManager;
|
||||||
roomManager: IRoomManager;
|
roomManager: IRoomManager;
|
||||||
cameraManager: IRoomCameraWidgetManager;
|
cameraManager: IRoomCameraWidgetManager;
|
||||||
|
soundManager: ISoundManager;
|
||||||
width: number;
|
width: number;
|
||||||
height: number;
|
height: number;
|
||||||
ticker: Ticker;
|
ticker: Ticker;
|
||||||
|
@ -2,7 +2,6 @@ import { Application, IApplicationOptions } from '@pixi/app';
|
|||||||
import { SCALE_MODES } from '@pixi/constants';
|
import { SCALE_MODES } from '@pixi/constants';
|
||||||
import { settings } from '@pixi/settings';
|
import { settings } from '@pixi/settings';
|
||||||
import { Ticker } from '@pixi/ticker';
|
import { Ticker } from '@pixi/ticker';
|
||||||
import { INitroManager } from '../core';
|
|
||||||
import { ConfigurationEvent } from '../core/configuration/ConfigurationEvent';
|
import { ConfigurationEvent } from '../core/configuration/ConfigurationEvent';
|
||||||
import { EventDispatcher } from '../core/events/EventDispatcher';
|
import { EventDispatcher } from '../core/events/EventDispatcher';
|
||||||
import { IEventDispatcher } from '../core/events/IEventDispatcher';
|
import { IEventDispatcher } from '../core/events/IEventDispatcher';
|
||||||
@ -54,15 +53,15 @@ export class Nitro extends Application implements INitro
|
|||||||
private _worker: Worker;
|
private _worker: Worker;
|
||||||
private _core: INitroCore;
|
private _core: INitroCore;
|
||||||
private _events: IEventDispatcher;
|
private _events: IEventDispatcher;
|
||||||
private _localization: INitroLocalizationManager;
|
|
||||||
private _communication: INitroCommunicationManager;
|
private _communication: INitroCommunicationManager;
|
||||||
|
private _localization: INitroLocalizationManager;
|
||||||
private _avatar: IAvatarRenderManager;
|
private _avatar: IAvatarRenderManager;
|
||||||
private _roomEngine: IRoomEngine;
|
private _roomEngine: IRoomEngine;
|
||||||
private _sessionDataManager: ISessionDataManager;
|
private _sessionDataManager: ISessionDataManager;
|
||||||
private _roomSessionManager: IRoomSessionManager;
|
private _roomSessionManager: IRoomSessionManager;
|
||||||
private _roomManager: IRoomManager;
|
private _roomManager: IRoomManager;
|
||||||
private _cameraManager: IRoomCameraWidgetManager;
|
private _cameraManager: IRoomCameraWidgetManager;
|
||||||
private _soundManager: INitroManager;
|
private _soundManager: ISoundManager;
|
||||||
private _linkTrackers: ILinkEventTracker[];
|
private _linkTrackers: ILinkEventTracker[];
|
||||||
private _workerTrackers: IWorkerEventTracker[];
|
private _workerTrackers: IWorkerEventTracker[];
|
||||||
|
|
||||||
@ -79,8 +78,8 @@ export class Nitro extends Application implements INitro
|
|||||||
this._worker = null;
|
this._worker = null;
|
||||||
this._core = core;
|
this._core = core;
|
||||||
this._events = new EventDispatcher();
|
this._events = new EventDispatcher();
|
||||||
this._localization = new NitroLocalizationManager();
|
|
||||||
this._communication = new NitroCommunicationManager(core.communication);
|
this._communication = new NitroCommunicationManager(core.communication);
|
||||||
|
this._localization = new NitroLocalizationManager(this._communication);
|
||||||
this._avatar = new AvatarRenderManager();
|
this._avatar = new AvatarRenderManager();
|
||||||
this._roomEngine = new RoomEngine(this._communication);
|
this._roomEngine = new RoomEngine(this._communication);
|
||||||
this._sessionDataManager = new SessionDataManager(this._communication);
|
this._sessionDataManager = new SessionDataManager(this._communication);
|
||||||
@ -99,7 +98,6 @@ export class Nitro extends Application implements INitro
|
|||||||
|
|
||||||
if(this._worker) this._worker.onmessage = this.createWorkerEvent.bind(this);
|
if(this._worker) this._worker.onmessage = this.createWorkerEvent.bind(this);
|
||||||
}
|
}
|
||||||
soundManager: ISoundManager;
|
|
||||||
|
|
||||||
public static bootstrap(): void
|
public static bootstrap(): void
|
||||||
{
|
{
|
||||||
@ -395,6 +393,11 @@ export class Nitro extends Application implements INitro
|
|||||||
return this._cameraManager;
|
return this._cameraManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get soundManager(): ISoundManager
|
||||||
|
{
|
||||||
|
return this._soundManager;
|
||||||
|
}
|
||||||
|
|
||||||
public get width(): number
|
public get width(): number
|
||||||
{
|
{
|
||||||
return (this.renderer.width / this.renderer.resolution);
|
return (this.renderer.width / this.renderer.resolution);
|
||||||
|
@ -4,13 +4,13 @@ import { AdvancedMap } from '../../../../../../core/utils/AdvancedMap';
|
|||||||
export class BadgesParser implements IMessageParser
|
export class BadgesParser implements IMessageParser
|
||||||
{
|
{
|
||||||
private _allBadgeCodes: string[];
|
private _allBadgeCodes: string[];
|
||||||
private _activeBadgeCodes: string[];
|
private _activeBadgeCodes: AdvancedMap<string, number>;
|
||||||
private _badgeIds: AdvancedMap<string, number>;
|
private _badgeIds: AdvancedMap<string, number>;
|
||||||
|
|
||||||
public flush(): boolean
|
public flush(): boolean
|
||||||
{
|
{
|
||||||
this._allBadgeCodes = [];
|
this._allBadgeCodes = [];
|
||||||
this._activeBadgeCodes = [];
|
this._activeBadgeCodes = null;
|
||||||
this._badgeIds = null;
|
this._badgeIds = null;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -21,7 +21,7 @@ export class BadgesParser implements IMessageParser
|
|||||||
if(!wrapper) return false;
|
if(!wrapper) return false;
|
||||||
|
|
||||||
this._allBadgeCodes = [];
|
this._allBadgeCodes = [];
|
||||||
this._activeBadgeCodes = [];
|
this._activeBadgeCodes = new AdvancedMap();
|
||||||
this._badgeIds = new AdvancedMap();
|
this._badgeIds = new AdvancedMap();
|
||||||
|
|
||||||
let count = wrapper.readInt();
|
let count = wrapper.readInt();
|
||||||
@ -45,7 +45,7 @@ export class BadgesParser implements IMessageParser
|
|||||||
const badgeSlot = wrapper.readInt();
|
const badgeSlot = wrapper.readInt();
|
||||||
const badgeCode = wrapper.readString();
|
const badgeCode = wrapper.readString();
|
||||||
|
|
||||||
this._activeBadgeCodes[badgeSlot] = badgeCode;
|
this._activeBadgeCodes.add(badgeCode, badgeSlot);
|
||||||
|
|
||||||
count--;
|
count--;
|
||||||
}
|
}
|
||||||
@ -53,9 +53,14 @@ export class BadgesParser implements IMessageParser
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getBadgeId(k: string): number
|
public getBadgeId(code: string): number
|
||||||
{
|
{
|
||||||
return this._badgeIds.getValue(k);
|
return this._badgeIds.getValue(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
public getActiveBadgeSlot(code: string): number
|
||||||
|
{
|
||||||
|
return this._activeBadgeCodes.getValue(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getAllBadgeCodes(): string[]
|
public getAllBadgeCodes(): string[]
|
||||||
@ -65,6 +70,6 @@ export class BadgesParser implements IMessageParser
|
|||||||
|
|
||||||
public getActiveBadgeCodes(): string[]
|
public getActiveBadgeCodes(): string[]
|
||||||
{
|
{
|
||||||
return this._activeBadgeCodes;
|
return this._activeBadgeCodes.getKeys();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import { NitroManager } from '../../core/common/NitroManager';
|
import { NitroManager } from '../../core/common/NitroManager';
|
||||||
|
import { INitroCommunicationManager } from '../communication/INitroCommunicationManager';
|
||||||
|
import { BadgePointLimitsEvent } from '../communication/messages/incoming/inventory/badges/BadgePointLimitsEvent';
|
||||||
import { Nitro } from '../Nitro';
|
import { Nitro } from '../Nitro';
|
||||||
import { BadgeBaseAndLevel } from './BadgeBaseAndLevel';
|
import { BadgeBaseAndLevel } from './BadgeBaseAndLevel';
|
||||||
import { INitroLocalizationManager } from './INitroLocalizationManager';
|
import { INitroLocalizationManager } from './INitroLocalizationManager';
|
||||||
@ -6,16 +8,18 @@ import { NitroLocalizationEvent } from './NitroLocalizationEvent';
|
|||||||
|
|
||||||
export class NitroLocalizationManager extends NitroManager implements INitroLocalizationManager
|
export class NitroLocalizationManager extends NitroManager implements INitroLocalizationManager
|
||||||
{
|
{
|
||||||
|
private _communication: INitroCommunicationManager;
|
||||||
private _definitions: Map<string, string>;
|
private _definitions: Map<string, string>;
|
||||||
private _parameters: Map<string, Map<string, string>>;
|
private _parameters: Map<string, Map<string, string>>;
|
||||||
private _badgePointLimits: Map<string, number>;
|
private _badgePointLimits: Map<string, number>;
|
||||||
private _romanNumerals: string[];
|
private _romanNumerals: string[];
|
||||||
private _pendingUrls: string[];
|
private _pendingUrls: string[];
|
||||||
|
|
||||||
constructor()
|
constructor(communication: INitroCommunicationManager)
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
this._communication = communication;
|
||||||
this._definitions = new Map();
|
this._definitions = new Map();
|
||||||
this._parameters = new Map();
|
this._parameters = new Map();
|
||||||
this._badgePointLimits = new Map();
|
this._badgePointLimits = new Map();
|
||||||
@ -25,6 +29,8 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca
|
|||||||
|
|
||||||
protected onInit(): void
|
protected onInit(): void
|
||||||
{
|
{
|
||||||
|
this._communication.registerMessageEvent(new BadgePointLimitsEvent(this.onBadgePointLimitsEvent.bind(this)));
|
||||||
|
|
||||||
let urls: string[] = Nitro.instance.getConfiguration<string[]>('external.texts.url');
|
let urls: string[] = Nitro.instance.getConfiguration<string[]>('external.texts.url');
|
||||||
|
|
||||||
if(!Array.isArray(urls))
|
if(!Array.isArray(urls))
|
||||||
@ -86,6 +92,13 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private onBadgePointLimitsEvent(event: BadgePointLimitsEvent): void
|
||||||
|
{
|
||||||
|
const parser = event.getParser();
|
||||||
|
|
||||||
|
for(const data of parser.data) this.setBadgePointLimit(data.badgeId, data.limit);
|
||||||
|
}
|
||||||
|
|
||||||
public getBadgePointLimit(badge: string): number
|
public getBadgePointLimit(badge: string): number
|
||||||
{
|
{
|
||||||
return (this._badgePointLimits.get(badge) || -1);
|
return (this._badgePointLimits.get(badge) || -1);
|
||||||
@ -218,6 +231,8 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca
|
|||||||
const parameter = parameters[i];
|
const parameter = parameters[i];
|
||||||
const replacement = replacements[i];
|
const replacement = replacements[i];
|
||||||
|
|
||||||
|
if(replacement === undefined) continue;
|
||||||
|
|
||||||
value = value.replace('%' + parameter + '%', replacement);
|
value = value.replace('%' + parameter + '%', replacement);
|
||||||
|
|
||||||
if(value.startsWith('%{'))
|
if(value.startsWith('%{'))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user