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
16 changes: 3 additions & 13 deletions Prowl.Editor/Panels/ProjectPanel.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;

using Prowl.Editor.Docking;
using Prowl.Editor.Widgets;
Expand Down Expand Up @@ -698,19 +700,7 @@ private static void OpenWithSystem(ContentItem item)
private static void ShowInExplorer(ContentItem item)
{
string absPath = Path.Combine(Project.Current!.AssetsPath, item.RelativePath);
ShowInExplorerPath(absPath);
}

private static void ShowInExplorerPath(string absPath)
{
try
{
if (Directory.Exists(absPath))
System.Diagnostics.Process.Start("explorer.exe", absPath);
else if (File.Exists(absPath))
System.Diagnostics.Process.Start("explorer.exe", $"/select,\"{absPath}\"");
}
catch { }
ReferenceOpenerService.OpenFileSystemPath(absPath);
}

// ================================================================
Expand Down
2 changes: 1 addition & 1 deletion Prowl.Editor/Project/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static Project Create(string parentFolder, string projectName)
if (!File.Exists(gitignore))
{
File.WriteAllText(gitignore,
"Library/\nTemp/\nLogs/\n*.csproj\n*.sln\n.vs/\nbin/\nobj/\n");
"Library/\nTemp/\nLogs/\n*.csproj\n*.sln\n.vs/\nbin/\nobj/\n# MacOS/\n.DS_Store/\n");
}

return project;
Expand Down
245 changes: 120 additions & 125 deletions Prowl.Editor/Project/ProjectLauncher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,79 +52,101 @@ public static void Draw(Paper paper, float dt, bool forceDraw = false)
int h = Window.InternalWindow.Size.Y;

// Full background
// paper.Box("pl_bg")
// .PositionType(PositionType.SelfDirected)
// .Position(0, 0)
// .Size(w, h)
// .BackgroundColor(EditorTheme.Neutral100)
// .OnPostLayout((handle, rect) => paper.Draw(ref handle, (canvas, r) =>
// {
// float cx = w / 2f;
// float cy = h / 2f;
// float radius = Math.Max(cx, cy) * 1.2f;
// float t = _animTime * 0.05f;
// var transparent = Prowl.Vector.Color32.FromArgb(0, 0, 0, 0);

// // Subtle background gradients (same as editor but dimmer)
// float px = cx + (float)Math.Sin(t) * cx * 0.6f;
// float py = cy + (float)Math.Sin(t * 2) * cy * 0.3f;
// var purple = Prowl.Vector.Color32.FromArgb(25, 140, 60, 200);
// canvas.SetRadialBrush(px, py, 0, radius, purple, transparent);
// canvas.BeginPath();
// canvas.Rect(0, 0, w, h);
// canvas.Fill();

// float bx = cx - (float)Math.Sin(t) * cx * 0.6f;
// float by = cy - (float)Math.Sin(t * 2) * cy * 0.3f;
// var blue = Prowl.Vector.Color32.FromArgb(25, 60, 140, 220);
// canvas.SetRadialBrush(bx, by, 0, radius, blue, transparent);
// canvas.BeginPath();
// canvas.Rect(0, 0, w, h);
// canvas.Fill();
// }));

// Center card
// float cardW = 600f;
// float cardH = 500f;

float sidebarW = 200f;

using (paper.Row("root")
paper.Box("pl_bg")
.PositionType(PositionType.SelfDirected)
.Position(0, 0)
.Size(w, h)
.BorderColor(EditorTheme.Ink100)
.BorderWidth(1)
.BackgroundColor(EditorTheme.Neutral300)
.Enter())
.BackgroundColor(EditorTheme.Neutral100)
.OnPostLayout((handle, rect) => paper.Draw(ref handle, (canvas, r) =>
{
float cx = w / 2f;
float cy = h / 2f;
float radius = Math.Max(cx, cy) * 1.2f;
float t = _animTime * 0.05f;
var transparent = Prowl.Vector.Color32.FromArgb(0, 0, 0, 0);

// Subtle background gradients (same as editor but dimmer)
float px = cx + (float)Math.Sin(t) * cx * 0.6f;
float py = cy + (float)Math.Sin(t * 2) * cy * 0.3f;
var purple = Prowl.Vector.Color32.FromArgb(25, 140, 60, 200);
canvas.SetRadialBrush(px, py, 0, radius, purple, transparent);
canvas.BeginPath();
canvas.Rect(0, 0, w, h);
canvas.Fill();

float bx = cx - (float)Math.Sin(t) * cx * 0.6f;
float by = cy - (float)Math.Sin(t * 2) * cy * 0.3f;
var blue = Prowl.Vector.Color32.FromArgb(25, 60, 140, 220);
canvas.SetRadialBrush(bx, by, 0, radius, blue, transparent);
canvas.BeginPath();
canvas.Rect(0, 0, w, h);
canvas.Fill();
}));

// Center card
float cardW = 600f;
float cardH = 500f;

using (paper.Box("container").Size(w, h).Position(0, 0).PositionType(PositionType.SelfDirected).Enter())
{
using (paper.Column("sidebar")
.BackgroundColor(EditorTheme.Neutral400)
.Size(sidebarW, h)
using (paper.Column("pl_window")
.Margin(UnitValue.StretchOne)
.Size(cardW, cardH)
.BorderColor(EditorTheme.Ink100)
.BorderWidth(1)
.Rounded(EditorTheme.Roundness)
.BackgroundColor(EditorTheme.Neutral300)
.Enter())
{

// Prowl Emblem
using (paper.Row("pl_header")
// Header
using (paper.Row("header")
.Height(60)
.RowBetween(12)
.RowBetween(0)
.RoundedTop(EditorTheme.Roundness)
.BackgroundColor(EditorTheme.Neutral300)
.BorderColor(EditorTheme.Ink100)
.BorderWidth(1)
.Enter())
{
paper.Box("pl_title")
.Height(60)
.Margin(16, 16, 0, 8)
.Width(110)
.Margin(16, 0, 8, 0)
.Text("PROWL", boldFont)
.TextColor(EditorTheme.Ink500)
.FontSize(28f)
.Alignment(TextAlignment.MiddleLeft);

// Spacer
paper.Box("pl_spacer");
// Links
using (paper.Row("pl_header")
.Height(UnitValue.Auto)
.RowBetween(12)
.Margin(0, 0, 28, 0)
.Enter())
{
EditorGUI.ButtonSquareGhost(paper, "www_link", EditorIcons.Globe).OnValueChanged((_) =>
{
ReferenceOpenerService.OpenUrl("https://prowlengine.com");
});

EditorGUI.ButtonSquareGhost(paper, "ds_link", EditorIcons.Message).OnValueChanged((_) =>
{
ReferenceOpenerService.OpenUrl("https://discord.gg/HgBsBqfSpa");
});

EditorGUI.ButtonSquareGhost(paper, "yt_link", EditorIcons.Video).OnValueChanged((_) =>
{
ReferenceOpenerService.OpenUrl("https://youtube.com/@prowlengine");
});

EditorGUI.ButtonSquareGhost(paper, "gh_link", EditorIcons.Code).OnValueChanged((_) =>
{
ReferenceOpenerService.OpenUrl("https://github.com/ProwlEngine/Prowl");
});
}

paper.Box("spacer");


paper.Box("pl_version")
.Height(60)
Expand All @@ -136,90 +158,61 @@ public static void Draw(Paper paper, float dt, bool forceDraw = false)
.Alignment(TextAlignment.MiddleRight);
}

paper.Box("spacer").Height(UnitValue.Stretch());

// Links
using (paper.Column("pl_header")
.Height(60)
.ColBetween(12)
.Margin(16, 12)
using (paper.Column("content")
.Size(cardW, cardH - 90)
.Enter())
{
EditorGUI.Button(paper, "yt_link", "YouTube").OnValueChanged((_) =>
{
WebService.OpenUrl("https://youtube.com/@prowlengine");
});

EditorGUI.Button(paper, "gh_link", "GitHub").OnValueChanged((_) =>
// New / Open buttons
using (paper.Row("toolbar")
.Height(30)
.Margin(10, 10, 16, 0)
.RowBetween(8)
.Enter())
{
WebService.OpenUrl("https://github.com/ProwlEngine/Prowl");
});
}
}

using (paper.Column("content")
.Size(w - sidebarW, h)
.Enter())
{
// New / Open buttons
using (paper.Row("toolbar")
.Height(40)
.Margin(10, 10, 32, 0)
.RowBetween(8)
.Enter())
{
paper.Box("tl_label")
.Width(UnitValue.Auto)
.Height(EditorTheme.RowHeight)
.Text("Projects", boldFont)
.TextColor(EditorTheme.Ink500)
.FontSize(EditorTheme.FontSize + 8)
.Alignment(TextAlignment.MiddleLeft);

// Spacer
paper.Box("tl_tb_spacer");
// Spacer
EditorGUI.SearchBar(paper, "search", "", "Search Projects");

// Spacer
EditorGUI.SearchBar(paper, "search", "", "Search");

EditorGUI.Button(paper, "tl_btn_open", $"{EditorIcons.FolderOpen} Open Project", 130)
.OnValueChanged(_ =>
{
FileDialog.Open(FileDialogMode.SelectFolder, path =>
EditorGUI.Button(paper, "tl_btn_open", $"{EditorIcons.FolderOpen} Open Project", 130)
.OnValueChanged(_ =>
{
if (path == null) return;
TryOpenProject(path);
FileDialog.Open(FileDialogMode.SelectFolder, path =>
{
if (path == null) return;
TryOpenProject(path);
});
});
});

using (paper.Box("tl_btn_new")
.Height(EditorTheme.RowHeight)
.Width(120)
.BackgroundColor(EditorTheme.Blue300)
.Hovered.BackgroundColor(EditorTheme.Blue400).End()
.Rounded(3)
.BorderColor(EditorTheme.Blue400)
.BorderWidth(1)
.OnClick((_) => _showNewProject = !_showNewProject)
.Enter()) {
paper.Box($"label")
using (paper.Box("tl_btn_new")
.Height(EditorTheme.RowHeight)
.Margin(EditorTheme.RowHeight / 4, 0)
.Alignment(PaperUI.TextAlignment.MiddleLeft)
.Text($" {EditorIcons.Plus} New Project", EditorTheme.DefaultFont)
.TextColor(EditorTheme.Ink500)
.FontSize(EditorTheme.FontSize);
.Width(120)
.BackgroundColor(EditorTheme.Blue300)
.Hovered.BackgroundColor(EditorTheme.Blue400).End()
.Rounded(3)
.BorderColor(EditorTheme.Blue400)
.BorderWidth(1)
.OnClick((_) => _showNewProject = !_showNewProject)
.Enter())
{
paper.Box($"label")
.Height(EditorTheme.RowHeight)
.Margin(EditorTheme.RowHeight / 4, 0)
.Alignment(PaperUI.TextAlignment.MiddleLeft)
.Text($" {EditorIcons.Plus} New Project", EditorTheme.DefaultFont)
.TextColor(EditorTheme.Ink500)
.FontSize(EditorTheme.FontSize);
}
}
}

// New project panel (collapsible)
if (_showNewProject)
{
DrawNewProjectPanel(paper, font);
}
// New project panel (collapsible)
if (_showNewProject)
{
DrawNewProjectPanel(paper, font);
}

// Recent projects list
DrawRecentProjects(paper, font, w - sidebarW, h - 60 - 40 - (_showNewProject ? 80 : 0));
// Recent projects list
DrawRecentProjects(paper, font, cardW, cardH - 60 - 46 - (_showNewProject ? 80 : 0));
}
}
}
}
Expand Down Expand Up @@ -291,7 +284,7 @@ private static void DrawRecentProjects(Paper paper, Prowl.Scribe.FontFile font,
{
var entries = RecentProjects.Entries;

using (ScrollView.Begin(paper, "pl_scroll", width, height, colSpacing: 8, paddingLeft: 8))
using (ScrollView.Begin(paper, "pl_scroll", width, height, colSpacing: 8, paddingLeft: 8, paddingRight: 8))
{
if (entries.Count == 0)
{
Expand Down Expand Up @@ -379,6 +372,8 @@ private static void DrawRecentProjects(Paper paper, Prowl.Scribe.FontFile font,
}
}
}

paper.Box("spacer").Height(6);
}
}

Expand Down
Loading
Loading