profectus-docs/assets/api_modules_game_settings.md.10d4f8c7.js

1 line
7.9 KiB
JavaScript

import{_ as e,c as t,o as a,a as r}from"./app.ab34650d.js";const m=JSON.parse('{"title":"Module: game/settings","description":"","frontmatter":{"editLink":false},"headers":[{"level":2,"title":"Interfaces","slug":"interfaces"},{"level":2,"title":"Variables","slug":"variables"},{"level":3,"title":"default","slug":"default"},{"level":3,"title":"gameComponents","slug":"gamecomponents"},{"level":3,"title":"infoComponents","slug":"infocomponents"},{"level":3,"title":"settingFields","slug":"settingfields"},{"level":2,"title":"Functions","slug":"functions"},{"level":3,"title":"hardResetSettings","slug":"hardresetsettings"},{"level":3,"title":"loadSettings","slug":"loadsettings"},{"level":3,"title":"registerGameComponent","slug":"registergamecomponent"},{"level":3,"title":"registerInfoComponent","slug":"registerinfocomponent"},{"level":3,"title":"registerSettingField","slug":"registersettingfield"}],"relativePath":"api/modules/game/settings.md","lastUpdated":null}'),n={name:"api/modules/game/settings.md"},s=r('<h1 id="module-game-settings" tabindex="-1">Module: game/settings <a class="header-anchor" href="#module-game-settings" aria-hidden="true">#</a></h1><h2 id="interfaces" tabindex="-1">Interfaces <a class="header-anchor" href="#interfaces" aria-hidden="true">#</a></h2><ul><li><a href="../../interfaces/game/settings.Settings">Settings</a></li></ul><h2 id="variables" tabindex="-1">Variables <a class="header-anchor" href="#variables" aria-hidden="true">#</a></h2><h3 id="default" tabindex="-1">default <a class="header-anchor" href="#default" aria-hidden="true">#</a></h3><p>\u2022 <strong>default</strong>: <a href="../../interfaces/game/settings.Settings"><code>Settings</code></a></p><p>The player settings object. Stores data that persists across all saves. Automatically saved to localStorage whenever changed.</p><h4 id="defined-in" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in" aria-hidden="true">#</a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/013092f/src/game/settings.ts#L53" target="_blank" rel="noopener noreferrer">profectus/src/game/settings.ts:53</a></p><hr><h3 id="gamecomponents" tabindex="-1">gameComponents <a class="header-anchor" href="#gamecomponents" aria-hidden="true">#</a></h3><p>\u2022 <code>Const</code> <strong>gameComponents</strong>: <a href="./../features/feature.html#coercablecomponent"><code>CoercableComponent</code></a>[]</p><p>A list of components to add to the root of the page.</p><h4 id="defined-in-1" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-1" aria-hidden="true">#</a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/013092f/src/game/settings.ts#L115" target="_blank" rel="noopener noreferrer">profectus/src/game/settings.ts:115</a></p><hr><h3 id="infocomponents" tabindex="-1">infoComponents <a class="header-anchor" href="#infocomponents" aria-hidden="true">#</a></h3><p>\u2022 <code>Const</code> <strong>infoComponents</strong>: <a href="./../features/feature.html#coercablecomponent"><code>CoercableComponent</code></a>[]</p><p>A list of components to show in the info modal.</p><h4 id="defined-in-2" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-2" aria-hidden="true">#</a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/013092f/src/game/settings.ts#L108" target="_blank" rel="noopener noreferrer">profectus/src/game/settings.ts:108</a></p><hr><h3 id="settingfields" tabindex="-1">settingFields <a class="header-anchor" href="#settingfields" aria-hidden="true">#</a></h3><p>\u2022 <code>Const</code> <strong>settingFields</strong>: <a href="./../features/feature.html#coercablecomponent"><code>CoercableComponent</code></a>[]</p><p>A list of fields to append to the settings modal.</p><h4 id="defined-in-3" tabindex="-1">Defined in <a class="header-anchor" href="#defined-in-3" aria-hidden="true">#</a></h4><p><a href="https://github.com/profectus-engine/Profectus/blob/013092f/src/game/settings.ts#L101" target="_blank" rel="noopener noreferrer">profectus/src/game/settings.ts:101</a></p><h2 id="functions" tabindex="-1">Functions <a class="header-anchor" href="#functions" aria-hidden="true">#</a></h2><h3 id="hardresetsettings" tabindex="-1">hardResetSettings <a class="header-anchor" href="#hardresetsettings" aria-hidden="true">#</a></h3><p>\u25B8 <strong>hardResetSettings</strong>(): <code>void</code></p><h4 id="returns" tabindex="-1">Returns <a class="header-anchor" href="#returns" aria-hidden="true">#</a></h4><p><code>void</code></p><hr><h3 id="loadsettings" tabindex="-1">loadSettings <a class="header-anchor" href="#loadsettings" aria-hidden="true">#</a></h3><p>\u25B8 <strong>loadSettings</strong>(): <code>void</code></p><p>Loads the player settings from localStorage. Calls the GlobalEvents.loadSettings event for custom properties to be included. Custom properties should be added by the file they relate to, so they won&#39;t be included if the file is tree shaken away. Custom properties should also register the field to modify said setting using <a href="./settings.html#registersettingfield">registerSettingField</a>.</p><h4 id="returns-1" tabindex="-1">Returns <a class="header-anchor" href="#returns-1" aria-hidden="true">#</a></h4><p><code>void</code></p><hr><h3 id="registergamecomponent" tabindex="-1">registerGameComponent <a class="header-anchor" href="#registergamecomponent" aria-hidden="true">#</a></h3><p>\u25B8 <strong>registerGameComponent</strong>(<code>component</code>): <code>void</code></p><p>Register a component to be displayed at the root of the page.</p><h4 id="parameters" tabindex="-1">Parameters <a class="header-anchor" href="#parameters" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th></tr></thead><tbody><tr><td style="text-align:left;"><code>component</code></td><td style="text-align:left;"><a href="./../features/feature.html#coercablecomponent"><code>CoercableComponent</code></a></td></tr></tbody></table><h4 id="returns-2" tabindex="-1">Returns <a class="header-anchor" href="#returns-2" aria-hidden="true">#</a></h4><p><code>void</code></p><hr><h3 id="registerinfocomponent" tabindex="-1">registerInfoComponent <a class="header-anchor" href="#registerinfocomponent" aria-hidden="true">#</a></h3><p>\u25B8 <strong>registerInfoComponent</strong>(<code>component</code>): <code>void</code></p><p>Register a component to be displayed in the info modal.</p><h4 id="parameters-1" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-1" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th></tr></thead><tbody><tr><td style="text-align:left;"><code>component</code></td><td style="text-align:left;"><a href="./../features/feature.html#coercablecomponent"><code>CoercableComponent</code></a></td></tr></tbody></table><h4 id="returns-3" tabindex="-1">Returns <a class="header-anchor" href="#returns-3" aria-hidden="true">#</a></h4><p><code>void</code></p><hr><h3 id="registersettingfield" tabindex="-1">registerSettingField <a class="header-anchor" href="#registersettingfield" aria-hidden="true">#</a></h3><p>\u25B8 <strong>registerSettingField</strong>(<code>component</code>): <code>void</code></p><p>Register a field to be displayed in the settings modal.</p><h4 id="parameters-2" tabindex="-1">Parameters <a class="header-anchor" href="#parameters-2" aria-hidden="true">#</a></h4><table><thead><tr><th style="text-align:left;">Name</th><th style="text-align:left;">Type</th></tr></thead><tbody><tr><td style="text-align:left;"><code>component</code></td><td style="text-align:left;"><a href="./../features/feature.html#coercablecomponent"><code>CoercableComponent</code></a></td></tr></tbody></table><h4 id="returns-4" tabindex="-1">Returns <a class="header-anchor" href="#returns-4" aria-hidden="true">#</a></h4><p><code>void</code></p>',62),o=[s];function i(d,h,l,c,g,f){return a(),t("div",null,o)}var u=e(n,[["render",i]]);export{m as __pageData,u as default};