Scripting API

Scripting API

GameApplication

Class in Abyss.Core, from Abyss.Core.

The game as an application: what it is called, who makes it and its version, as its Player settings say; whether it is played in the editor; its end, asked for from its code — a main menu's Exit — and whether there is one; and a web page opened from it, an About screen's link. World.Application.

public sealed class GameApplication

Remarks

Quit ends a game on its own after the frame it is asked in: its plugins told they are stopping, with the world still there, so what they save is saved, and then the window closed. Its window's close button and Alt+F4 end it the same way. In the editor it stops Play, as the Stop button does.

What it is called is what the build was given: Product, or the game's assembly's name where Player names none, as its window's title is; in the editor, read from Player as Play starts.

Properties

Product

public string Product { get; private set; }

What the game is called: Player's Product, or the game's own name where it says none.

Company

public string Company { get; private set; }

Who makes it, as Player says; empty where it says no one.

Version

public string Version { get; private set; }

Its version, as Player says: major.minor.patch.

InEditor

public bool InEditor { get; private set; }

Whether it is played in the editor, rather than on its own.

Quitting

public bool Quitting { get; private set; }

Whether its end has been asked for, by GameApplication.Quit or its window's close: what ends it after this frame.

CanQuit

public bool CanQuit { get; }

Whether GameApplication.Quit ends anything a player sees: false in a browser, where a game cannot close the tab it plays in, so a menu leaves its Quit out.

IsWeb

public bool IsWeb { get; }

Whether the game plays in a browser: where its JSImportAttribute methods call its page.

Methods

Quit

public void Quit()

Ends the game after this frame: a game on its own closes, its plugins told first; the editor stops Play.

public void OpenLink(string url)

Opens a web page: in the system's browser, or in a new tab where the game plays in a browser — where the browser refuses a tab no click or key asked for, on the player's next click or key. Nothing waits for it.

Parameters

  • url: The page's link: https:// or http:// and a site, as https://abyssengine.net.

Exceptions

  • ArgumentNullException: url is null.
  • AbyssException: AbyssStatus.InvalidLink for what is not a web page's link — another scheme, no site, a space — which is never opened, so a game cannot start another program through one.

Start

public void Start(PlayerSettings player, string product, bool inEditor)

Says what the game is, from its Player settings, as it starts: in the editor where inEditor. The player's and the editor's to call, as a game starts or is played.

Parameters

  • player
  • product
  • inEditor

TakeQuit

public bool TakeQuit()

Whether its end was asked for since this was last asked: once a quit. The editor's, which stops Play for it.