Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/lib/player/objects/Line.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export class Line {
private _yModifier: 1 | -1 = 1;
private _rotationModifier: 1 | -1 = 1;
private _rotationOffset: 0 | 180 = 0;
private _rotateWithParent: boolean = false;

private _curX = [];
private _curY = [];
Expand Down Expand Up @@ -107,6 +108,7 @@ export class Line {
: new GameObjects.Image(scene, 0, 0, this.getLineTexture(`asset-${lineData.Texture}`));

this._hasAttach = !!this._data.attachUI;
this._rotateWithParent = this._data.rotateWithFather ?? false;
this._line.setScale(
this._scene.p(1) * (this._scaleX ?? 1),
(this._hasCustomTexture
Expand Down Expand Up @@ -245,8 +247,7 @@ export class Line {
else if (!this._hasCustomTexture && (!this._hasAttach || this._data.appearanceOnAttach === 2))
this._line.setTint(getLineColor(this._scene));
const { x, y } = this.getPosition();
const rotation =
(this._rotationModifier * this._rotation + this._rotationOffset) * (Math.PI / 180);
const rotation = this.getRotation();
this._line.setPosition(x, y);
this._line.setRotation(rotation);
this._line.setAlpha(this._opacity / 255);
Expand Down Expand Up @@ -363,6 +364,15 @@ export class Line {
return { x, y };
}

getRotation() {
let rotation = this._rotationModifier * this._rotation + this._rotationOffset;
rotation *= Math.PI / 180;
if (this._parent !== null && this._rotateWithParent) {
rotation += this._parent.rotation;
}
return rotation;
}

createContainer(depth: number) {
const container = new GameObjects.Container(this._scene);
container.setDepth(depth);
Expand Down
1 change: 1 addition & 0 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export interface JudgeLine {
eventLayers: (EventLayer | null)[];
extended?: Extended;
father: number;
rotateWithFather?: boolean;
isCover: number;
isGif?: boolean;
notes?: Note[];
Expand Down