72 lines
1.9 KiB
ActionScript
72 lines
1.9 KiB
ActionScript
class ResourceExplorer : Panel {
|
|
int size = 96;
|
|
ResourceFolder currentFolder;
|
|
|
|
array<string> subFiles;
|
|
bool alreadyRendered = false;
|
|
float fase = 0;
|
|
|
|
dictionary meshFrameBuffer;
|
|
|
|
void onInit() {
|
|
currentFolder = Studio::getFolder("");
|
|
}
|
|
|
|
void onMenuBar() {
|
|
array<ResourceFolder> topFolders;
|
|
ResourceFolder renderFolder = currentFolder;
|
|
while (!renderFolder.isRoot()) {
|
|
topFolders.insertLast(renderFolder);
|
|
renderFolder = renderFolder.parent;
|
|
}
|
|
topFolders.insertLast(renderFolder);
|
|
|
|
for (int i = topFolders.length() - 1; i >= 0; i--) {
|
|
if (ImGui::menuItem(topFolders[i].name)) {
|
|
currentFolder = topFolders[i];
|
|
}
|
|
|
|
if (i != 0) {
|
|
ImGui::text("/");
|
|
}
|
|
}
|
|
|
|
ImGui::drawComboEnd("##IconSize", "Icon Size : " + size, SimpleFunction(this.setIconSize));
|
|
}
|
|
|
|
void setIconSize() {
|
|
if (ImGui::drawComboItem("64", size == 64)) {
|
|
size = 64;
|
|
}
|
|
|
|
if (ImGui::drawComboItem("96", size == 96)) {
|
|
size = 96;
|
|
}
|
|
|
|
if (ImGui::drawComboItem("128", size == 128)) {
|
|
size = 128;
|
|
}
|
|
|
|
if (ImGui::drawComboItem("160", size == 160)) {
|
|
size = 160;
|
|
}
|
|
}
|
|
|
|
void onImGui() {
|
|
ImGui::automaticColumns(size + 64);
|
|
|
|
int subFolderCount = currentFolder.getSubfolderCount();
|
|
Texture folderIcon = Studio::getIcon("folder");
|
|
|
|
for (int i = 0; i < subFolderCount; i++) {
|
|
ResourceFolder resourceFolder = currentFolder.getSubfolderByIndex(i);
|
|
if (ImGui::cartIconButton(resourceFolder.name, folderIcon, size, ImGui::getAvailableSizeX())) {
|
|
currentFolder = resourceFolder;
|
|
return;
|
|
}
|
|
|
|
ImGui::nextColumn();
|
|
}
|
|
}
|
|
}
|