-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improves Scene Blocks for script prefabs.
- Loading branch information
1 parent
eb380a9
commit e8925ce
Showing
11 changed files
with
149 additions
and
111 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
8 changes: 7 additions & 1 deletion
8
source/editor/plugins/phasereditor2d.scene/src/ui/blocks/SceneEditorBlocksLabelProvider.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
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
17 changes: 17 additions & 0 deletions
17
...editor/plugins/phasereditor2d.scene/src/ui/blocks/SceneEditorBlocksStyledLabelProvider.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
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
60 changes: 60 additions & 0 deletions
60
...tor/plugins/phasereditor2d.scene/src/ui/sceneobjects/scriptNode/ScriptsContentProvider.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,60 @@ | ||
namespace phasereditor2d.scene.ui.sceneobjects { | ||
|
||
import controls = colibri.ui.controls; | ||
import io = colibri.core.io; | ||
import code = ide.core.code; | ||
|
||
export class ScriptsContentProvider implements controls.viewers.ITreeContentProvider { | ||
|
||
getRoots(input: any[]): any[] { | ||
|
||
const finder = ScenePlugin.getInstance().getSceneFinder(); | ||
|
||
const files = finder.getScriptPrefabFiles(); | ||
|
||
files.sort((a, b) => { | ||
|
||
const aa = a.getFullName(); | ||
const bb = b.getFullName(); | ||
|
||
return aa.localeCompare(bb); | ||
}); | ||
|
||
files.sort((a, b) => { | ||
|
||
const aa = code.isNodeModuleFile(a)? -1 : 1; | ||
const bb = code.isNodeModuleFile(b)? -1 : 1; | ||
|
||
return aa - bb; | ||
}); | ||
|
||
const folders: io.FilePath[] = []; | ||
|
||
for (const file of files) { | ||
|
||
let parent = file.getParent(); | ||
|
||
if (folders.indexOf(parent) < 0) { | ||
|
||
folders.push(parent); | ||
} | ||
} | ||
|
||
return [ScriptNodeExtension.getInstance(), ...folders]; | ||
} | ||
|
||
getChildren(parent: any): any[] { | ||
|
||
if (parent instanceof io.FilePath) { | ||
|
||
const finder = ScenePlugin.getInstance().getSceneFinder(); | ||
|
||
const files = finder.getScriptPrefabFiles(); | ||
|
||
return files.filter(f => f.getParent() === parent); | ||
} | ||
|
||
return []; | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...plugins/phasereditor2d.scene/src/ui/sceneobjects/scriptNode/ScriptsStyledLabelProvider.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,41 @@ | ||
namespace phasereditor2d.scene.ui.sceneobjects { | ||
|
||
import controls = colibri.ui.controls; | ||
import io = colibri.core.io; | ||
import code = ide.core.code; | ||
|
||
export class ScriptStyledLabelProvider implements controls.viewers.IStyledLabelProvider { | ||
|
||
getStyledTexts(obj: any, dark: boolean) { | ||
|
||
let text: string; | ||
let color: string; | ||
|
||
if (obj instanceof io.FilePath && obj.isFolder()) { | ||
|
||
if (code.isNodeModuleFile(obj)) { | ||
|
||
text = code.findNodeModuleName(obj); | ||
color = ScenePlugin.getInstance().getScriptsLibraryColor(); | ||
|
||
} else { | ||
|
||
text = obj.getName(); | ||
color = controls.Controls.getTheme().viewerForeground; | ||
} | ||
|
||
} else if (obj instanceof ScriptNodeExtension) { | ||
|
||
text = obj.getTypeName(); | ||
color = controls.Controls.getTheme().viewerForeground; | ||
|
||
} else { | ||
|
||
text = getSceneDisplayName(obj); | ||
color = ScenePlugin.getInstance().getPrefabColor(); | ||
} | ||
|
||
return [{ text, color }]; | ||
} | ||
} | ||
} |