You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-19 15:06:20 +00:00
🆕 Added support for wf_slc_users_area and some avatar fixes
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { Container, Texture } from 'pixi.js';
|
||||
import { IAvatarFigureContainer } from './IAvatarFigureContainer';
|
||||
import { IGraphicAsset } from '../../asset';
|
||||
import { IAnimationLayerData, ISpriteDataContainer } from './animation';
|
||||
import { IPartColor } from './structure';
|
||||
|
||||
@@ -16,7 +15,6 @@ export interface IAvatarImage
|
||||
processAsTexture(setType: string, hightlight: boolean, texture?: Texture): Texture;
|
||||
processAsImageUrl(setType: string): string;
|
||||
processAsContainer(setType: string): Container;
|
||||
getAsset(name: string): IGraphicAsset;
|
||||
getDirection(): number;
|
||||
getFigure(): IAvatarFigureContainer;
|
||||
getPartColor(_arg_1: string): IPartColor;
|
||||
|
||||
@@ -9,5 +9,6 @@ export interface IRoomAreaSelectionManager
|
||||
activate(callback: (rootX: number, rootY: number, width: number, height: number) => void, highlightType: string): boolean;
|
||||
deactivate(): void;
|
||||
setHighlight(rootX: number, rootY: number, width: number, height: number): void;
|
||||
setHighlightType(highlightType: string): void;
|
||||
readonly areaSelectionState: number;
|
||||
}
|
||||
|
||||
@@ -188,30 +188,19 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
}
|
||||
}
|
||||
|
||||
const isSleeping = (model.getValue<number>(RoomObjectVariable.FIGURE_SLEEP) > 0);
|
||||
if((this._blinkingStartTimestamp > -1) && (time > this._blinkingStartTimestamp))
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_BLINK, 1);
|
||||
|
||||
if(isSleeping)
|
||||
this._blinkingStartTimestamp = time + this.randomBlinkStartTimestamp();
|
||||
this._blinkingEndTimestamp = time + this.randomBlinkEndTimestamp();
|
||||
}
|
||||
|
||||
if((this._blinkingEndTimestamp > 0) && (time > this._blinkingEndTimestamp))
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_BLINK, 0);
|
||||
|
||||
this._blinkingEndTimestamp = 0;
|
||||
this._blinkingStartTimestamp = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if((this._blinkingStartTimestamp > -1) && (time > this._blinkingStartTimestamp))
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_BLINK, 1);
|
||||
|
||||
this._blinkingStartTimestamp = time + this.randomBlinkStartTimestamp();
|
||||
this._blinkingEndTimestamp = time + this.randomBlinkEndTimestamp();
|
||||
}
|
||||
|
||||
if((this._blinkingEndTimestamp > 0) && (time > this._blinkingEndTimestamp))
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_BLINK, 0);
|
||||
|
||||
this._blinkingEndTimestamp = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if((this._effectChangeTimeStamp > 0) && (time > this._effectChangeTimeStamp))
|
||||
@@ -316,9 +305,6 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
if(message instanceof ObjectAvatarSleepUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_SLEEP, message.isSleeping ? 1 : 0);
|
||||
model.setValue(RoomObjectVariable.FIGURE_BLINK, 0);
|
||||
|
||||
this._blinkingEndTimestamp = 0;
|
||||
|
||||
if(message.isSleeping) this._blinkingStartTimestamp = -1;
|
||||
else this._blinkingStartTimestamp = (this.time + this.randomBlinkStartTimestamp());
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { AlphaTolerance, AvatarAction, AvatarGuideStatus, AvatarSetType, IAdvancedMap, IAvatarEffectListener, IAvatarImage, IAvatarImageListener, IGraphicAsset, IObjectVisualizationData, IRoomGeometry, IRoomObject, IRoomObjectModel, RoomObjectSpriteType, RoomObjectVariable } from '@nitrots/api';
|
||||
import { GetAssetManager } from '@nitrots/assets';
|
||||
import { AdvancedMap, GetRenderer } from '@nitrots/utils';
|
||||
import { Container, RenderTexture, Sprite, Texture } from 'pixi.js';
|
||||
import { RoomObjectSpriteVisualization } from '../RoomObjectSpriteVisualization';
|
||||
@@ -428,7 +429,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement
|
||||
|
||||
const assetName = ((((((this._avatarImage.getScale() + '_') + spriteData.member) + '_') + dd) + '_') + frameNumber);
|
||||
|
||||
const asset = this._avatarImage.getAsset(assetName);
|
||||
const asset = GetAssetManager().getAsset(assetName);
|
||||
|
||||
if(!asset) continue;
|
||||
|
||||
@@ -957,15 +958,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement
|
||||
|
||||
if(this._talk) this._avatarImage.appendAction(AvatarAction.TALK);
|
||||
|
||||
if(this._sleep)
|
||||
{
|
||||
this._avatarImage.appendAction(AvatarAction.SLEEP);
|
||||
}
|
||||
else if(this._blink)
|
||||
{
|
||||
this._avatarImage.appendAction(AvatarAction.BLINK);
|
||||
this._avatarImage.appendAction(AvatarAction.SLEEP);
|
||||
}
|
||||
if(this._sleep || this._blink) this._avatarImage.appendAction(AvatarAction.SLEEP);
|
||||
|
||||
if(this._expression > 0)
|
||||
{
|
||||
@@ -1196,7 +1189,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement
|
||||
{
|
||||
sprite.libraryAssetName = 'sh_std_sd_1_0_0';
|
||||
|
||||
this._shadow = this._avatarImage.getAsset(sprite.libraryAssetName);
|
||||
this._shadow = GetAssetManager().getAsset(sprite.libraryAssetName);
|
||||
|
||||
offsetX = -8;
|
||||
offsetY = ((this._canStandUp) ? 6 : -3);
|
||||
@@ -1205,7 +1198,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement
|
||||
{
|
||||
sprite.libraryAssetName = 'h_std_sd_1_0_0';
|
||||
|
||||
this._shadow = this._avatarImage.getAsset(sprite.libraryAssetName);
|
||||
this._shadow = GetAssetManager().getAsset(sprite.libraryAssetName);
|
||||
|
||||
offsetX = -17;
|
||||
offsetY = ((this._canStandUp) ? 10 : -7);
|
||||
|
||||
@@ -12,6 +12,7 @@ export class RoomAreaSelectionManager implements IRoomAreaSelectionManager
|
||||
public static HIGHLIGHT_DARKEN = 'highlight_darken';
|
||||
public static HIGHLIGHT_BRIGHTEN = 'highlight_brighten';
|
||||
public static HIGHLIGHT_BLUE = 'highlight_blue';
|
||||
public static HIGHLIGHT_GREEN = 'highlight_green';
|
||||
|
||||
private static HIGHLIGHT_FILTERS: { [key: string]: ColorMatrixFilter } = {};
|
||||
|
||||
@@ -72,9 +73,19 @@ export class RoomAreaSelectionManager implements IRoomAreaSelectionManager
|
||||
0, 0, 0, 1,
|
||||
-0.0392, -0.0392, -0.0392, 0];
|
||||
|
||||
const greenFilter = new ColorMatrixFilter();
|
||||
|
||||
greenFilter.matrix = [
|
||||
0.5, 0, 0, 0,
|
||||
0, 1.6, 0, 0,
|
||||
0, 0, 0.5, 0,
|
||||
0, 0, 0, 1,
|
||||
0, 0.15, 0, 0];
|
||||
|
||||
RoomAreaSelectionManager.HIGHLIGHT_FILTERS[RoomAreaSelectionManager.HIGHLIGHT_DARKEN] = darkenFilter;
|
||||
RoomAreaSelectionManager.HIGHLIGHT_FILTERS[RoomAreaSelectionManager.HIGHLIGHT_BRIGHTEN] = brightenFilter;
|
||||
RoomAreaSelectionManager.HIGHLIGHT_FILTERS[RoomAreaSelectionManager.HIGHLIGHT_BLUE] = blueFilter;
|
||||
RoomAreaSelectionManager.HIGHLIGHT_FILTERS[RoomAreaSelectionManager.HIGHLIGHT_GREEN] = greenFilter;
|
||||
}
|
||||
|
||||
private getAllFurniture(): IRoomObject[]
|
||||
@@ -188,6 +199,18 @@ export class RoomAreaSelectionManager implements IRoomAreaSelectionManager
|
||||
if(this._callback) this._callback(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public setHighlightType(highlightType: string): void
|
||||
{
|
||||
if(this._state === RoomAreaSelectionManager.NOT_ACTIVE) return;
|
||||
|
||||
this._highlightType = highlightType;
|
||||
|
||||
if(this._highlightWidth > 0 && this._highlightHeight > 0)
|
||||
{
|
||||
this.setHighlight(this._highlightRootX, this._highlightRootY, this._highlightWidth, this._highlightHeight);
|
||||
}
|
||||
}
|
||||
|
||||
public setHighlight(rootX: number, rootY: number, width: number, height: number): void
|
||||
{
|
||||
if(this._state === RoomAreaSelectionManager.NOT_ACTIVE) return;
|
||||
|
||||
Reference in New Issue
Block a user