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.
- Create a
Panel Settings
asset inAssets/UI
- Select the asset and adjust
Scale Mode Parameters
- To make sure your theme fits the entire screen, set
Screen Match Mode
toMatch Width Or Height
. You will need to layout your elements in a way that works on all common aspect ratios. We recommend you to setMatch
to either 0 or 1, so your UI layout will have the exact width / height asReference Resolution
, and only the other dimension is dynamic. - To make sure your theme has a constant aspect ratio, set
Screen Match Mode
toExpand
. There will be black borders around your theme if it doesn't match the user's display's aspect ratio.
- To make sure your theme fits the entire screen, set
- In script, load and apply the panel settings via
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
.
- Fill in
tm.gameSetup
(of typeThemeApi.GameSetup
)- Only track folder and pattern GUID are required. TECHMANIA will handle the loading of the pattern.
- For setlists, fill in fields that start with
setlist
. Make suresetlist.enabled
is set to true.
- Interact with the TECHMANIA state machine via methods in
tm.game
(of typeThemeApi.GameState
)- Likewise, TECHMANIA will handle the background, score keeping and gameplay; your theme only needs to respond to events, such as fever being activated and note being resolved.
- A typical workflow is:
- Theme fills
tm.gameSetup
and callstm.game.BeginLoading()
- TECHMANIA loads the pattern and calls
tm.gameSetup.onLoadComplete
- Theme calls
tm.game.Begin()
- During game play, theme calls
tm.game.Pause()
,tm.game.Unpause()
andtm.game.ActivateFever()
as necessary - After stage clear or stage failed, TECHMANIA calls
tm.gameSetup.onStageClear
ortm.game.StageFailed
- Theme calls
tm.game.Conclude()
- Theme fills
- A typical workflow for setlists is:
- Theme fills
tm.gameSetup
and callstm.game.setlist.Prepare()
- TECHMANIA loads the setlist
- Theme calls
tm.game.setlist.LoadNextPattern()
- TECHMANIA loads the 1st pattern and calls
tm.gameSetup.onLoadComplete
- Theme calls
tm.game.Begin()
- During game play, theme calls
tm.game.Pause()
,tm.game.Unpause()
andtm.game.ActivateFever()
as necessary - After the player clears or fails a stage, TECHMANIA calls
tm.gameSetup.setlist.onPartialComplete
,tm.gameSetup.setlist.onHpBelowThreshold
ortm.gameSetup.setlist.onSetlistFailed
- If the player hasn't failed yet, theme calls
tm.gameSetup.LoadNextPattern()
for stage 2, and the previous few steps repeat for all 4 stages - After the setlist is complete, theme calls
tm.game.Conclude()
- Theme fills
- During the game, you can query information on the ongoing game from
tm.game.scoreKeeper
andtm.game.timer
.- For setlists, use
tm.game.setlist.scoreKeeper
instead oftm.game.scoreKeeper
- For setlists, use
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:
- Textures loaded from files
- Sounds loaded from files
- Videos loaded from the theme
- Videos loaded from files
See ThemeApi.IO
.