generated from yordan-kanchelov/pixi-typescript-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finish storyboard parsing, start rendering storyboard
- Loading branch information
Showing
18 changed files
with
694 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import * as PIXI from "pixi.js"; | ||
import {BackgroundContainer} from "./Background"; | ||
import {Main} from "../../main"; | ||
import {BeatmapData} from "../../Util/Beatmap/Data/BeatmapData"; | ||
import {DestroyOptions} from "pixi.js"; | ||
import {EventSprite} from "../../Util/Beatmap/Data/Sections/Events/Storyboard/EventSprite"; | ||
import {StoryboardCommand} from "../../Util/Beatmap/Data/Sections/Events/Storyboard/Commands/StoryboardCommand"; | ||
|
||
export class StoryBoard extends BackgroundContainer { | ||
private beatmap: BeatmapData; | ||
private startTime = Date.now(); | ||
|
||
public constructor(beatmap: BeatmapData) { | ||
super(); | ||
this.interactiveChildren = false; | ||
this.interactive = false; | ||
this.beatmap = beatmap; | ||
Main.app.ticker.add(this.Update, this); | ||
for (let i = 0; i < beatmap.Events.Events.length; i++) { | ||
let event = beatmap.Events.Events[i]; | ||
if (event instanceof EventSprite && event.texture){ | ||
let sprite = PIXI.Sprite.from(event.texture); | ||
sprite.visible = false; | ||
event.sprite = sprite; | ||
this.addChild(sprite); | ||
} | ||
} | ||
} | ||
|
||
|
||
public Update() { | ||
let currentTime = Date.now() - this.startTime; | ||
for (let i = 0; i < this.beatmap.Events.Events.length; i++) { | ||
let event = this.beatmap.Events.Events[i]; | ||
if (event instanceof StoryboardCommand) { | ||
if (currentTime > event.startTime) { | ||
|
||
} | ||
} | ||
} | ||
} | ||
|
||
public destroy(options?: DestroyOptions) { | ||
Main.app.ticker.remove(this.Update, this); | ||
super.destroy(options); | ||
} | ||
} |
15 changes: 14 additions & 1 deletion
15
src/Util/Beatmap/Data/Sections/Events/Storyboard/Commands/StoryboardCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,18 @@ | ||
import {CommandType} from "./CommandType"; | ||
import {EasingFunction} from "../../../../../../TweenWrapper/EasingFunction"; | ||
import {EventStoryboard} from "../EventStoryboard"; | ||
import {Event} from "../../Event"; | ||
|
||
export abstract class StoryboardCommand { | ||
export abstract class StoryboardCommand extends Event{ | ||
public abstract commandType: CommandType; | ||
|
||
public parentStoryboardObject!: EventStoryboard; | ||
|
||
/** | ||
* indicates if the command should "accelerate". See <a href="http://easings.net/">Easing Functions Cheat Sheet</a>. | ||
*/ | ||
public easing: (amount: number) => number = EasingFunction.None; | ||
|
||
public endTime: number = 0; | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
src/Util/Beatmap/Data/Sections/Events/Storyboard/Commands/impl/ColorCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {StoryboardCommand} from "../StoryboardCommand"; | ||
import {CommandType} from "../CommandType"; | ||
import * as PIXI from "pixi.js"; | ||
|
||
export class ColorCommand extends StoryboardCommand { | ||
public commandType = CommandType.Color; | ||
|
||
public startColor: PIXI.Color = new PIXI.Color("white"); | ||
public endColor: PIXI.Color = new PIXI.Color("white"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/Util/Beatmap/Data/Sections/Events/Storyboard/Commands/impl/LoopCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {StoryboardCommand} from "../StoryboardCommand"; | ||
import {CommandType} from "../CommandType"; | ||
|
||
export class LoopCommand extends StoryboardCommand { | ||
public commandType = CommandType.Loop; | ||
|
||
public readonly endTime = -1; | ||
|
||
public loopCount: number = 1; | ||
|
||
public childCommands: StoryboardCommand[] = []; | ||
} |
10 changes: 10 additions & 0 deletions
10
src/Util/Beatmap/Data/Sections/Events/Storyboard/Commands/impl/MoveCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {StoryboardCommand} from "../StoryboardCommand"; | ||
import {CommandType} from "../CommandType"; | ||
import * as PIXI from "pixi.js"; | ||
|
||
export class MoveCommand extends StoryboardCommand { | ||
public commandType = CommandType.Move; | ||
|
||
public startPos: PIXI.PointData = new PIXI.Point(0, 0); | ||
public endPos: PIXI.PointData = new PIXI.Point(0, 0); | ||
} |
9 changes: 9 additions & 0 deletions
9
src/Util/Beatmap/Data/Sections/Events/Storyboard/Commands/impl/MoveXCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {StoryboardCommand} from "../StoryboardCommand"; | ||
import {CommandType} from "../CommandType"; | ||
|
||
export class MoveXCommand extends StoryboardCommand { | ||
public commandType = CommandType.MoveX; | ||
|
||
public startX: number = 0; | ||
public endX: number = 0; | ||
} |
9 changes: 9 additions & 0 deletions
9
src/Util/Beatmap/Data/Sections/Events/Storyboard/Commands/impl/MoveYCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {StoryboardCommand} from "../StoryboardCommand"; | ||
import {CommandType} from "../CommandType"; | ||
|
||
export class MoveYCommand extends StoryboardCommand { | ||
public commandType = CommandType.MoveY; | ||
|
||
public startY: number = 0; | ||
public endY: number = 0; | ||
} |
13 changes: 13 additions & 0 deletions
13
src/Util/Beatmap/Data/Sections/Events/Storyboard/Commands/impl/ParameterCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import {StoryboardCommand} from "../StoryboardCommand"; | ||
import {CommandType} from "../CommandType"; | ||
|
||
export class ParameterCommand extends StoryboardCommand { | ||
public commandType = CommandType.Parameter; | ||
public parameter!: ParameterCommandType; | ||
} | ||
|
||
export enum ParameterCommandType{ | ||
HorizontalFlip = "H", | ||
VerticalFlip = "F", | ||
UseAdditiveBlending = "A" | ||
} |
15 changes: 15 additions & 0 deletions
15
src/Util/Beatmap/Data/Sections/Events/Storyboard/Commands/impl/RotateCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {StoryboardCommand} from "../StoryboardCommand"; | ||
import {CommandType} from "../CommandType"; | ||
|
||
export class RotateCommand extends StoryboardCommand { | ||
public commandType = CommandType.Rotate; | ||
|
||
/** | ||
* rotation in radians | ||
*/ | ||
public startRotation: number = 0; | ||
/** | ||
* rotation in radians | ||
*/ | ||
public endRotation: number = 0; | ||
} |
9 changes: 9 additions & 0 deletions
9
src/Util/Beatmap/Data/Sections/Events/Storyboard/Commands/impl/ScaleCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {StoryboardCommand} from "../StoryboardCommand"; | ||
import {CommandType} from "../CommandType"; | ||
|
||
export class ScaleCommand extends StoryboardCommand { | ||
public commandType = CommandType.Scale; | ||
|
||
public startScale: number = 1; | ||
public endScale: number = 1; | ||
} |
8 changes: 8 additions & 0 deletions
8
src/Util/Beatmap/Data/Sections/Events/Storyboard/Commands/impl/TriggerCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import {StoryboardCommand} from "../StoryboardCommand"; | ||
import {CommandType} from "../CommandType"; | ||
|
||
// will not be supported for now | ||
export class TriggerCommand extends StoryboardCommand { | ||
public commandType = CommandType.Trigger; | ||
public childCommands: StoryboardCommand[] = []; | ||
} |
10 changes: 10 additions & 0 deletions
10
src/Util/Beatmap/Data/Sections/Events/Storyboard/Commands/impl/VectorScaleCommand.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {StoryboardCommand} from "../StoryboardCommand"; | ||
import {CommandType} from "../CommandType"; | ||
import * as PIXI from "pixi.js"; | ||
|
||
export class VectorScaleCommand extends StoryboardCommand { | ||
public commandType = CommandType.VectorScale; | ||
|
||
public startScale: PIXI.PointData = new PIXI.Point(1, 1); | ||
public endScale: PIXI.PointData = new PIXI.Point(1, 1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.