.NET class library for simulation of Orteil's Cookie Clicker
Create a new project with your desired GUI framework or game engine.
Build the CookieCore
solution, and add a reference to the CookieCore.Services
, CookieCore.ViewModels
, and CookieCore.Models
assembly.
On startup, create a new instance of the MainViewModel
class.
MainViewModel = new(timersService: new(), filesService: new(), ticksPerSecond: 60);
⚠️ ImplementingITimersService
andIFilesService
is required
You can effortlessly bind to properties under the MainViewModel
<TextBlock Text="{Binding MainViewModel.GameViewModel.Cookies}"/>
<Button Command="{Binding MainViewModel.GameViewModel.ClickCookieCommand}"/>
Subscribe to the PropertyChanged
event on any class you want, then update your view accordingly
MainViewModel.GameViewModel.PropertyChanged += delegate(object? sender, PropertyChangedEventArgs args)
{
if (args.PropertyName == nameof(GameViewModel.Cookies))
{
// Update UI here...
}
};
⚠️ Proper handling of changes in MainViewModel is required (binding cascade)