Documentations of TECHMANIA projects, hosted in a repo so they can be localized.
This article aims to be a reverse index of the scripting reference. Instead of listing APIs and telling you what they do, we will list some things you may want to do and point you towards the APIs to do that.
Panel Settings
asset in Assets/UI
Scale Mode Parameters
Screen Match Mode
to Match Width Or Height
. You will need to layout your elements in a way that works on all common aspect ratios. We recommend you to set Match
to either 0 or 1, so your UI layout will have the exact width / height as Reference Resolution
, and only the other dimension is dynamic.Screen Match Mode
to Expand
. There will be black borders around your theme if it doesn’t match the user’s display’s aspect ratio.tm.SetPanelSettings
Use VisualElementWrap.RegisterCallback
.
Change styles on a VisualElementWrap
via style
field, though a few common ones have a shortcut on the VisualElementWrap
itself. style
is of type UnityEngine.UIElements.IStyle
.
If changing some value inside style
has no effect, you may need to instantiate new objects. The documentation on style
provides an example.
Most animations can be achieved by continuously changing some style on an element over multiple frames. If you are familiar with Unity coroutines, you can implement this in a similar style with tm.StartCoroutine
.
Use tm.io
, of type ThemeApi.IO
. Audio can be played with tm.audio
, textures can be set to backgroundImage
of VisualElementWrap
s, and videos can be played with members in VideoElement
.
See tm.resource
, of type GlobalResource
.
These are available at tm.options
, tm.options.modifiers
, tm.ruleset
respectively.
Read the documentation of Options
carefully to understand which options need to be applied with a separate call.
Each theme gets its own dictionary to store any option it needs. Access it via tm.options.GetPerTrackOptions
.
tm.gameSetup
(of type ThemeApi.GameSetup
)
setlist
. Make sure setlist.enabled
is set to true.tm.game
(of type ThemeApi.GameState
)
tm.gameSetup
and calls tm.game.BeginLoading()
tm.gameSetup.onLoadComplete
tm.game.Begin()
tm.game.Pause()
, tm.game.Unpause()
and tm.game.ActivateFever()
as necessarytm.gameSetup.onStageClear
or tm.game.StageFailed
tm.game.Conclude()
tm.gameSetup
and calls tm.game.setlist.Prepare()
tm.game.setlist.LoadNextPattern()
tm.gameSetup.onLoadComplete
tm.game.Begin()
tm.game.Pause()
, tm.game.Unpause()
and tm.game.ActivateFever()
as necessarytm.gameSetup.setlist.onPartialComplete
, tm.gameSetup.setlist.onHpBelowThreshold
or tm.gameSetup.setlist.onSetlistFailed
tm.gameSetup.LoadNextPattern()
for stage 2, and the previous few steps repeat for all 4 stagestm.game.Conclude()
tm.game.scoreKeeper
and tm.game.timer
.
tm.game.setlist.scoreKeeper
instead of tm.game.scoreKeeper
To get the record on a pattern / setlist, call tm.records.GetRecord
/ tm.records.setlist.GetRecord
and pass in the full pattern / setlist. Tracks from tm.resources
are minimized and do not contain full patterns; you will need to manually load them with tm.io.LoadFullTrack
.
When the game is in Complete
state, you can call tm.game.ScoreIsNewRecord()
to check if the player made a new record, and tm.game.UpdateRecord()
to update the in-memory record. For setlists, call tm.game.setlist.ScoreIsNewRecord()
and tm.game.setlist.UpdateRecord()
.
See ThemeApi.ThemeL10n
.
See ThemeApi.EditorInterface
.
See ThemeApi.CalibrationPreview
and ThemeApi.SkinPreview
.
The following resources need to be manually released after you are done with them in order to conserve memory:
See ThemeApi.IO
.