forked from goplus/builder
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore:remove sceneIndex & add costume's config in backdrop
- Loading branch information
1 parent
3d96349
commit 871e8ba
Showing
3 changed files
with
17 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
/* | ||
* @Author: TuGitee [email protected] | ||
* @Date: 2024-01-19 21:53:50 | ||
* @LastEditors: xuning [email protected] | ||
* @LastEditTime: 2024-02-06 12:52:11 | ||
* @LastEditors: Zhang Zhi Yang | ||
* @LastEditTime: 2024-02-19 09:10:03 | ||
* @FilePath: /spx-gui/src/class/backdrop.ts | ||
* @Description: The class of a backdrop. | ||
*/ | ||
|
@@ -122,46 +122,9 @@ export class Backdrop extends AssetBase { | |
"path": file.name | ||
})), | ||
"zorder": useProjectStore().project?.sprite.list.map(sprite => sprite.name) || [], | ||
"sceneIndex": 0 | ||
} | ||
} | ||
|
||
/** | ||
* Get the current scene index. | ||
*/ | ||
get currentSceneIndex(): number { | ||
return this.config.sceneIndex ?? 0 | ||
} | ||
|
||
/** | ||
* Set the current scene index. | ||
*/ | ||
set currentSceneIndex(index: number) { | ||
if (!this.config.scenes[index]) { | ||
throw new Error(`Scene ${index} does not exist.`) | ||
} | ||
this.config.sceneIndex = index | ||
} | ||
|
||
/** | ||
* Get the current scene. | ||
*/ | ||
get currentScene() { | ||
return this.config.scenes[this.currentSceneIndex] | ||
} | ||
|
||
/** | ||
* Get the current scene with config. | ||
*/ | ||
get currentSceneConfig(): Scene { | ||
const scene = this.currentScene | ||
return Object.assign({}, scene, { | ||
index: this.currentSceneIndex, | ||
file: this.files[this.currentSceneIndex], | ||
url: this.files[this.currentSceneIndex].url | ||
}) | ||
} | ||
|
||
/** | ||
* Get the directory of the backdrop. | ||
*/ | ||
|
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
/* | ||
* @Author: TuGitee [email protected] | ||
* @Date: 2024-01-24 21:42:28 | ||
* @LastEditors: TuGitee [email protected] | ||
* @LastEditTime: 2024-01-25 14:32:14 | ||
* @FilePath: \builder\spx-gui\src\interface\file.ts | ||
* @LastEditors: Zhang Zhi Yang | ||
* @LastEditTime: 2024-02-19 09:05:07 | ||
* @FilePath: /spx-gui/src/interface/file.ts | ||
* @Description: The interface of file. | ||
*/ | ||
|
||
|
@@ -164,15 +164,21 @@ export interface BackdropConfig extends Config { | |
/** | ||
* The image of the backdrop. | ||
*/ | ||
scenes: Scene[]; | ||
scenes?: Scene[]; | ||
|
||
/** | ||
* The sprite zorder in the stage, the later Sprite will be above the previous Sprite, which means that the later Sprite will override the previous Sprite. | ||
*/ | ||
zorder: string[]; | ||
|
||
/** | ||
* The index of the current scene. | ||
* The costume of the backdrop | ||
*/ | ||
sceneIndex?: number; | ||
costumes?: Costume[]; | ||
|
||
/** | ||
* The index of the current costume. | ||
*/ | ||
currentCostumeIndex?: number; | ||
|
||
} |