Broken Toaster
Broken Toaster
CC#
Created by Broken Toaster on 5/24/2024 in #help
✅ VS is trying to put my whole user folder on github
No description
14 replies
CC#
Created by Broken Toaster on 5/24/2024 in #help
✅ Need help making classes
My current classes don't work, compilation error CS0115 for no reason, i'm crying here.
namespace BeatBooth.Classes.Pages
{
public abstract class EnginePage : Page
{
public abstract void open();
public abstract void close();
public static EnginePage currentPage { get; private set; }

public static void SwitchPage<T>() where T : EnginePage, new()
{
if (currentPage != null)
{
currentPage.close();
}

var newPage = new T();
currentPage = newPage;

GameWindow.Viewport.Content = newPage;
newPage.open();
}
}
}
namespace BeatBooth.Classes.Pages
{
public abstract class EnginePage : Page
{
public abstract void open();
public abstract void close();
public static EnginePage currentPage { get; private set; }

public static void SwitchPage<T>() where T : EnginePage, new()
{
if (currentPage != null)
{
currentPage.close();
}

var newPage = new T();
currentPage = newPage;

GameWindow.Viewport.Content = newPage;
newPage.open();
}
}
}
namespace BeatBooth.Classes.Pages
{
public partial class GameMainMenu : EnginePage
{
public GameMainMenu()
{
InitializeComponent();
}

public override void open()
{
Console.WriteLine("Open");
}

public override void close()
{
Console.WriteLine("Close");
}
}
}
namespace BeatBooth.Classes.Pages
{
public partial class GameMainMenu : EnginePage
{
public GameMainMenu()
{
InitializeComponent();
}

public override void open()
{
Console.WriteLine("Open");
}

public override void close()
{
Console.WriteLine("Close");
}
}
}
37 replies