Skip to content

Instantly share code, notes, and snippets.

@ericoporto
Created January 9, 2022 13:35
Show Gist options
  • Select an option

  • Save ericoporto/d5644040f292d148bfe243ef566490d2 to your computer and use it in GitHub Desktop.

Select an option

Save ericoporto/d5644040f292d148bfe243ef566490d2 to your computer and use it in GitHub Desktop.
Preferences.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AGS.Types
{
[Flags]
public enum StartupPane
{
StartPage = 0,
GeneralSettings = 1,
None = 2
}
[Flags]
public enum MessageBoxOnCompile
{
Always = 0,
WarningsAndErrors = 1,
OnlyErrors = 2,
Never = 3
}
[Flags]
public enum ReloadScriptOnExternalChange
{
Prompt = 0,
Always = 1,
Never = 2
}
[Flags]
public enum SpriteImportMethod
{
Pixel0 = 0,
TopLeft = 1,
BottomLeft = 2,
TopRight = 3,
BottomRight = 4,
LeaveAsIs = 5,
NoTransparency = 6
}
[Flags]
public enum TestGameWindowStyle
{
UseGameSetup = 0,
FullScreen = 1,
Windowed = 2
}
class Preferences : ICustomTypeDescriptor
{
private TestGameWindowStyle _testGameWindowStyle;
private StartupPane _startupPane;
private MessageBoxOnCompile _messageBoxOnCompile;
private ReloadScriptOnExternalChange _reloadScriptOnExternalChange;
private SpriteImportMethod _spriteImportMethod;
private int _tabSize;
private bool _indentUseTabs;
private bool _showViewPreviewByDefault;
private string _paintProgramPath;
private string _newGamePath;
private bool _sendAnonymousStats;
private int _backupWarningInterval;
private bool _remapPalettizedBackgrounds;
private bool _keepHelpOnTop;
private bool _dialogOnMultipleTabsClose;
private string _colorTheme;
private string _defaultImportPath;
[DisplayName("Test Game Style")]
[Description("Game should run in window or full-screen when you test it. When using F5 game will always run in a window.")]
[DefaultValue("UseGameSetup")]
[Category("Test Game")]
public TestGameWindowStyle TestGameWindowStyle
{
get { return _testGameWindowStyle; }
set
{
_testGameWindowStyle = value;
}
}
[DisplayName("Editor Startup Action")]
[Description("What editor should do at startup.")]
[DefaultValue("StartPage")]
[Category("Editor Appearance")]
public StartupPane StartupPane
{
get { return _startupPane; }
set
{
_startupPane = value;
}
}
[DisplayName("Pop-up messages on Compile")]
[Description("In which cases the editor should show pop-up windows when compiling.")]
[DefaultValue("WarningsAndErrors")]
[Category("Editor Appearance")]
public MessageBoxOnCompile MessageBoxOnCompile
{
get { return _messageBoxOnCompile; }
set
{
_messageBoxOnCompile = value;
}
}
[DisplayName("Color Theme")]
[Description("Select which theme the editor should be using.")]
[DefaultValue("Default")]
[Category("Editor Appearance")]
public string ColorTheme
{
get { return _colorTheme; }
set
{
_colorTheme = value;
}
}
[DisplayName("Show view preview by default in view editors")]
[Description("Wheter view preview is always showing when a view editor is loaded.")]
[DefaultValue(false)]
[Category("Editor Appearance")]
public bool ShowViewPreviewByDefault
{
get { return _showViewPreviewByDefault; }
set
{
_showViewPreviewByDefault = value;
}
}
[DisplayName("Keep Help window on top")]
[Description("Should Help window always be on top of the Editor window when shown?")]
[DefaultValue(true)]
[Category("Editor Appearance")]
public bool KeepHelpOnTop
{
get { return _keepHelpOnTop; }
set
{
_keepHelpOnTop = value;
}
}
[DisplayName("Ask before closing multiple tabs")]
[Description("Prompt dialog on closing multiple tabs.")]
[DefaultValue(true)]
[Category("Editor Appearance")]
public bool DialogOnMultipleTabsClose
{
get { return _dialogOnMultipleTabsClose; }
set
{
_dialogOnMultipleTabsClose = value;
}
}
[DisplayName("How many days before asking to backup my game.")]
[Description("Every number of days set it will remind you to backup your game.")]
[DefaultValue(7)]
[Category("Backup Reminders")]
public int BackupWarningInterval
{
get { return _backupWarningInterval; }
set
{
_backupWarningInterval = value;
}
}
[DisplayName("Remap palette of room backgrounds")]
[Description("Remap paletter of room background into allocated background palette slots (8-bit games only).")]
[DefaultValue(true)]
[Category("Import of 8-bit background")]
public bool RemapPalettizedBackgrounds
{
get { return _remapPalettizedBackgrounds; }
set
{
_remapPalettizedBackgrounds = value;
}
}
[DisplayName("Script file modified by other program")]
[Description("If a script is open for editing and is modified by another program, how should this be handled?")]
[DefaultValue("Prompt")]
[Category("Script Editor")]
public ReloadScriptOnExternalChange ReloadScriptOnExternalChange
{
get { return _reloadScriptOnExternalChange; }
set
{
_reloadScriptOnExternalChange = value;
}
}
[DisplayName("Tab width")]
[Description("How many space characters a tab width should be. This setting requires editor restart to be applied.")]
[DefaultValue(2)]
[Category("Script Editor")]
public int TabSize
{
get { return _tabSize; }
set
{
_tabSize = value;
}
}
[DisplayName("Indent")]
[Description("Should editor use tabs instead of spaces when indenting?")]
[DefaultValue(false)]
[Category("Script Editor")]
public bool IndentUseTabs
{
get { return _indentUseTabs; }
set
{
_indentUseTabs = value;
}
}
[DisplayName("Default image editor")]
[Description("When you double-click a sprite, what program do you want to use to edit it? This program must support PNG and BMP files.")]
[DefaultValue("")]
[Category("Sprite Editor")]
public string PaintProgramPath
{
get { return _paintProgramPath; }
set
{
_paintProgramPath = value;
}
}
[DisplayName("Default sprite import transparency")]
[Description("Sprite transparency import method to use by default.")]
[DefaultValue("LeaveAsIs")]
[Category("Sprite Editor")]
public SpriteImportMethod SpriteImportMethod
{
get { return _spriteImportMethod; }
set
{
_spriteImportMethod = value;
}
}
[DisplayName("New Game Directory")]
[Description("When you create a new game, where do you want it to go?")]
[DefaultValue("")]
[Category("New Game Directory")]
public string NewGamePath
{
get { return _newGamePath; }
set
{
_newGamePath = value;
}
}
[DisplayName("Import Directory")]
[Description("When you import files, where do you want to look first?")]
[DefaultValue("")]
[Category("Import Directory")]
public string DefaultImportPath
{
get { return _defaultImportPath; }
set
{
_defaultImportPath = value;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment