### Kusudama Start Event Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420206/en.txt Called once when a Kusudama sequence begins. No specific setup is required beyond defining the function. ```javascript function kusuIn() Called once when a Kusudama sequence has started. ``` -------------------------------- ### GET /battleWin Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420311/en.txt Retrieves the current win status of the player against the AI. ```APIDOC ## GET /battleWin ### Description Gets a boolean value indicating if the player is currently winning or has already won against the AI in an AI Battle. This function is intended for use within the Results Screen menu. ### Method GET ### Response - **battleWin** (boolean) - True if the player is winning or has won, false otherwise. ``` -------------------------------- ### Configure Fonts for SimpleStyle Skin Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/README.md Modify the Config.ini file to set the desired fonts for rendering text within the SimpleStyle skin. Ensure the specified fonts are installed. ```ini ; フォントレンダリングに使用するフォント名 ; Font name used for font rendering. FontName=廻想体 ネクスト UP B ; Boxの説明文のフォントレンダリングに使用するフォント名 ; Font name used for font rendering. BoxFontName=廻想体 ネクスト UP B ; Use " マキナス 4 Square " if you want to use the font used on the skin assets (but letters are wider and more blocky on it) ; Feel free to use only one of those fonts if you don't like one of them (both are blocky, the second one is more standard for English), Kaisoutai contains less kanji than Makinas. ; If you don't like both fonts, keep the default ones (MS Gothic), but keep in mind that the skin is built around the given fonts. ``` -------------------------------- ### GET /lang Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420302/en.txt Retrieves the current selected language in a short string format (e.g., 'en', 'ja', 'fr'). ```APIDOC ## GET /lang ### Description Gets the current selected language as a short string format (i.e. "en", "ja", "fr", etc.). ### Method GET ### Endpoint /lang ### Response #### Success Response (200) - **language** (string) - The short string representation of the current language. ``` -------------------------------- ### Animator Class for Frame-Based Animation Source: https://context7.com/0aubsq/opentaiko/llms.txt Initializes an Animator for frame-based animation. Requires start value, end value, tick interval, and loop setting. ```csharp // OpenTaiko/src/Animations/Animator.cs class Animator : IAnimatable { public CCounter Counter { get; private set; } public object StartValue { get; private set; } public object EndValue { get; private set; } public object TickInterval { get; private set; } public bool IsLoop { get; private set; } // Frame-based animation public Animator(int startValue, int endValue, int tickInterval, bool isLoop) { Type = CounterType.Normal; StartValue = startValue; EndValue = endValue; TickInterval = tickInterval; IsLoop = isLoop; Counter = new CCounter(); } // Time-based animation (uses sound timer for sync) public Animator(double startValue, double endValue, double tickInterval, bool isLoop) { Type = CounterType.Double; StartValue = startValue; EndValue = endValue; TickInterval = tickInterval; IsLoop = isLoop; Counter = new CCounter(); } public void Start() { switch (Type) { case CounterType.Normal: Counter.Start((int)StartValue, (int)EndValue, (int)TickInterval, OpenTaiko.Timer); break; case CounterType.Double: Counter.Start((double)StartValue, (double)EndValue, (double)TickInterval, SoundManager.PlayTimer); break; } } public void Tick() { if (IsLoop) Counter.TickLoop(); else Counter.Tick(); if (!IsLoop && Counter.IsEnded) Stop(); } public virtual object GetAnimation() => throw new NotImplementedException(); } // Easing implementations class EaseIn : Animator { public override object GetAnimation() { double t = (double)Counter.CurrentValue / (double)EndValue; return t * t; // Quadratic ease-in } } class FadeIn : Animator { public override object GetAnimation() { return (int)(255 * ((double)Counter.CurrentValue / (double)EndValue)); } } ``` -------------------------------- ### GET /dictionary/indexes Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Documentation/I18N/DictionnaryIndexes.md Retrieves string data based on specific dictionary index identifiers. ```APIDOC ## GET /dictionary/indexes ### Description Retrieves the string associated with a specific index from the CLangManager.LangInstance. ### Method GET ### Parameters #### Query Parameters - **idx** (integer) - Required - The index identifier to retrieve. Supported values include 70 and 71, which correspond to the actual name. ### Response #### Success Response (200) - **value** (string) - The string content associated with the provided index. ``` -------------------------------- ### GET /player/gauge Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420306/en.txt Retrieves the current soul gauge values for all active players in the game. ```APIDOC ## GET /player/gauge ### Description Gets a list of integers between 0-100 for each player that represent their current position on the soul gauge. ### Method GET ### Endpoint /player/gauge ### Response #### Success Response (200) - **gauge_values** (array of integers) - A list of integers (0-100) representing the soul gauge level for each player. #### Response Example { "gauge_values": [85, 92] } ``` -------------------------------- ### Get Player Go-Go Time Status Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420308/en.txt Retrieves the Go-Go Time status for all players. This is useful for game logic that depends on this active state. ```APIDOC ## GET /api/players/gogo-time ### Description Gets a list of booleans indicating if Go-Go Time is currently active for each player. ### Method GET ### Endpoint /api/players/gogo-time ### Parameters #### Query Parameters - **player_ids** (array[string]) - Optional - A list of specific player IDs to query. If omitted, all players are returned. ### Response #### Success Response (200) - **gogo_time_active** (array[boolean]) - A list of booleans, where each boolean corresponds to a player and indicates if Go-Go Time is active for them. #### Response Example ```json { "gogo_time_active": [ true, false, true ] } ``` ``` -------------------------------- ### Get AI Battle State Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420310/en.txt Retrieves an integer representing the current state of the active AI Battle. A positive number indicates the player is winning, while a negative number indicates the AI is winning. The default value is 0. ```APIDOC ## GET /api/battle/state ### Description Gets an integer about the current state of the active AI Battle, valued between -9 and 9. Default is 0. Zero or higher number means the player is winning. Lower number means the AI is winning. ### Method GET ### Endpoint /api/battle/state ### Parameters #### Query Parameters - **default** (integer) - Optional - The default value for the battle state if no battle is active. Defaults to 0. ### Response #### Success Response (200) - **battleState** (integer) - The current state of the AI Battle, ranging from -9 (AI winning) to 9 (player winning). #### Response Example ```json { "battleState": 5 } ``` ``` -------------------------------- ### Initialize OpenTaiko Application Source: https://context7.com/0aubsq/opentaiko/llms.txt The main entry point handles platform detection, FFmpeg path configuration, and prevents multiple instances using a Mutex. ```csharp // Program.cs - Application entry point [STAThread] static void Main(params string[] args) { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); mutex二重起動防止用 = new Mutex(false, "DTXManiaMutex"); if (mutex二重起動防止用.WaitOne(0, false)) { // Detect OS and architecture string osplatform = OperatingSystem.IsWindows() ? "win" : OperatingSystem.IsMacOS() ? "osx" : OperatingSystem.IsLinux() ? "linux" : throw new PlatformNotSupportedException(); string platform = RuntimeInformation.ProcessArchitecture switch { Architecture.X64 => "x64", Architecture.X86 => "x86", Architecture.Arm64 => "arm64", _ => throw new PlatformNotSupportedException() }; // Set FFmpeg path for video playback FFmpeg.AutoGen.ffmpeg.RootPath = AppContext.BaseDirectory + @"FFmpeg/" + osplatform + "-" + platform + "/"; // Launch the game using (var mania = new OpenTaiko(args)) mania.Run(); mutex二重起動防止用.ReleaseMutex(); } } ``` -------------------------------- ### Initialize SoundManager and Audio Devices Source: https://context7.com/0aubsq/opentaiko/llms.txt Handles audio device initialization and switching between Bass, WASAPI, and ASIO backends. Requires an active window context and specific delay configurations for each device type. ```csharp // FDK/src/03.Sound/SoundManager.cs public class SoundManager { private static ISoundDevice SoundDevice { get; set; } public static CSoundTimer PlayTimer = null; public static bool bIsTimeStretch = false; // Constructor for OpenTaiko initialization public SoundManager(IWindow window, ESoundDeviceType soundDeviceType, int nSoundDelayBASS, int nSoundDelayExclusiveWASAPI, int nSoundDelayASIO, int nASIODevice, bool _bUseOSTimer) { tInitialize(soundDeviceType, nSoundDelayBASS, nSoundDelayExclusiveWASAPI, nSoundDelayASIO, nASIODevice, _bUseOSTimer); } public static void tReloadSoundDeviceAndSound() { // Create sound device based on type switch (SoundDeviceType) { case ESoundDeviceType.Bass: SoundDevice = new CSoundDeviceBASS(SoundDelayBASS, SoundUpdatePeriodBASS); break; case ESoundDeviceType.ExclusiveWASAPI: SoundDevice = new CSoundDeviceWASAPI(CSoundDeviceWASAPI.EWASAPIMode.Exclusion, SoundDelayExclusiveWASAPI, SoundUpdatePeriodExclusiveWASAPI); break; case ESoundDeviceType.SharedWASAPI: SoundDevice = new CSoundDeviceWASAPI(CSoundDeviceWASAPI.EWASAPIMode.Share, SoundDelaySharedWASAPI, SoundUpdatePeriodSharedWASAPI); break; case ESoundDeviceType.ASIO: SoundDevice = new CSoundDeviceASIO(SoundDelayASIO, ASIODevice); break; } PlayTimer = new CSoundTimer(SoundDevice); CSound.tReloadSound(SoundDevice); } // Create and manage sounds public CSound tCreateSound(string filename, ESoundGroup soundGroup) { if (!File.Exists(filename)) return null; return SoundDevice.tCreateSound(filename, soundGroup); } public void AddMixer(CSound cs, double db再生速度) { cs.PlaySpeed = db再生速度; cs.AddBassSoundFromMixer(); } public void RemoveMixer(CSound cs) => cs.tRemoveSoundFromMixer(); public string GetCurrentSoundDeviceType() => SoundDeviceType.ToString(); public long GetSoundDelay() => SoundDevice?.BufferSize ?? -1; } ``` -------------------------------- ### Stage Transition Methods Source: https://context7.com/0aubsq/opentaiko/llms.txt Provides methods for transitioning between game stages, including unmounting the current stage and mounting a new one. Ensure stages are activated and resources are managed. ```csharp // Stage transitions in OpenTaiko main class public void ChangeStage(CStage Stage) { UnmountCurrentStage(); MountStage(Stage); rPreviousStage = rCurrentStage; rCurrentStage = Stage; } public void MountStage(CStage Stage) { Stage.Activate(); if (!ConfigIni.PreAssetsLoading) { Stage.CreateManagedResource(); Stage.CreateUnmanagedResource(); } } ``` -------------------------------- ### CConfigIni Configuration Class Source: https://context7.com/0aubsq/opentaiko/llms.txt Handles game settings, key bindings, and persistent configuration. Includes display, audio, and gameplay settings, as well as key assignment structures. Use LoadFromFile and t書き出し for persistence. ```csharp // OpenTaiko/src/Common/CConfigIni.cs internal class CConfigIni : INotifyPropertyChanged { // Display settings public bool bFullScreen; public bool bEnableVSync; public int nWindowWidth; public int nWindowHeight; public int nBGAlpha; // Audio settings public int nSoundDeviceType; // 0=Bass, 1=ASIO, 2=ExclusiveWASAPI, 3=SharedWASAPI public int nMasterVolume; public int SoundEffectLevel; public int VoiceLevel; public int SongPlaybackLevel; public double TargetLoudness; public bool ApplyLoudnessMetadata; // Gameplay settings public int nSongSpeed; // Playback speed multiplier public ERandomMode[] eRandom; // Random note modifiers public STDGBVALUE bReverse; // Reverse scroll // Key assignments for up to 5 players public CKeyAssign KeyAssign; public class CKeyAssign { public struct STKEYASSIGN { public InputDeviceType InputDevice; public int ID; public int Code; } public CKeyAssignPad Taiko; // Taiko pad bindings public CKeyAssignPad System; // System keys (screenshot, volume) } // Load/Save configuration public void LoadFromFile(string path) { using StreamReader sr = new StreamReader(path, Encoding.UTF8); // Parse INI format... } public void t書き出し(string path) { using StreamWriter sw = new StreamWriter(path, false, Encoding.UTF8); // Write all settings... } } ``` -------------------------------- ### Initialize script data Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420201/en.txt Executed once when the script loads to initialize essential data and images. ```lua function init() Called once when the script is loaded. This is used to initialize important data, including images. ``` -------------------------------- ### Initialization Function Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420201/en.txt Details about the init() function, used for script initialization and data loading. ```APIDOC ## General ### Function: init() #### Description Called once when the script is loaded. This is used to initialize important data, including images. ### Parameters None ### Request Example ```javascript init(); ``` ### Response None ``` -------------------------------- ### Initialize OpenTaiko Databases Source: https://context7.com/0aubsq/opentaiko/llms.txt Initializes various database managers for game data like CDN configuration, encyclopedia entries, and unlockables. This class is fundamental for loading and managing game assets and player progress. ```csharp // OpenTaiko/src/Databases/Databases.cs class Databases { public DBCDN DBCDN; // CDN/network configuration public DBEncyclopediaMenus DBEncyclopediaMenus; // Encyclopedia entries public DBNameplateUnlockables DBNameplateUnlockables; // Nameplate unlocks public DBSongUnlockables DBSongUnlockables; // Song unlock conditions public void tDatabases() { DBCDN = new DBCDN(); DBEncyclopediaMenus = new DBEncyclopediaMenus(); DBNameplateUnlockables = new DBNameplateUnlockables(); DBSongUnlockables = new DBSongUnlockables(); } } ``` -------------------------------- ### Implement FDK Game Core Source: https://context7.com/0aubsq/opentaiko/llms.txt The abstract Game class manages the Silk.NET window lifecycle, OpenGL context initialization, and the main render loop. ```csharp // FDK/src/01.Framework/Core/Game.cs public abstract class Game : IDisposable { public static GL Gl { get; private set; } public static Silk.NET.Core.Contexts.IGLContext Context { get; private set; } public static Matrix4X4 Camera; public static long TimeMs; // Window properties public IWindow Window_; public Vector2D WindowSize { get; set; } public Vector2D WindowPosition { get; set; } public bool FullScreen { get; set; } public bool VSync { get; set; } public int Framerate { get; set; } protected Game(string iconFileName, params string[] args) { Configuration(); WindowOptions options = WindowOptions.Default; options.Size = WindowSize; options.VSync = VSync; options.WindowState = FullScreen ? WindowState.Fullscreen : WindowState.Normal; Window_ = Window.Create(options); Window_.Load += Window_Load; Window_.Update += Window_Update; Window_.Render += Window_Render; } public void Window_Load() { // Initialize OpenGL context (ANGLE or native) Context = new AngleContext(GraphicsDeviceType_, Window_, flags); Context.MakeCurrent(); Gl = GL.GetApi(Context); Gl.Enable(GLEnum.Blend); BlendHelper.SetBlend(BlendType.Normal); CTexture.Init(); Initialize(); LoadContent(); } public void Window_Render(double deltaTime) { Camera = Matrix4X4.Identity; Gl.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit); Draw(); Context.SwapBuffers(); } public void Run() => Window_.Run(); } ``` -------------------------------- ### Modal Lifecycle and Registration Methods Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/System/Open-World Memories/Modules/Modal/README.md Methods for controlling modal animations and registering new assets during gameplay. ```APIDOC ## isAnimationFinished() ### Description Returns if the currently playing modal animation is finished. When returning true, enter is pressable again to move to the next modal or return to the song select screen. ### Response - **(bool)** - Returns true if animation is finished, false otherwise. ## registerNewModal(player, rarity, modal_type, modal_info, modal_visual_ref) ### Description Method called every time a new modal is registered including its related information. ### Parameters - **player** (int) - Required - The player related to the modal (between 1 and 5). - **rarity** (int) - Required - The rarity of the unlocked asset (between 0 (Poor) and 6 (Mythical)), unused for Coins. - **modal_type** (int) - Required - The type of unlocked asset (0: Coins, 1: Character, 2: Puchichara, 3: Title, 4: Song). - **modal_info** (object) - Required - Asset related information, modal_type dependent. - **modal_visual_ref** (object) - Required - Asset related visuals or extra info, modal_type dependent. ## loadAssets() ### Description Method where all resource allocation should be included, called at each skin reload and at launch. ## update() ### Description The regular update loop, for example to increment time counters, plays before draw(). ## draw() ### Description For displayables, played at each result screen Draw() iteration. ``` -------------------------------- ### CLuaScript Class for Lua Scripting Source: https://context7.com/0aubsq/opentaiko/llms.txt Initializes a CLuaScript for Lua-based skin scripting. Requires a directory path and optionally texture/sound directories. Loads Lua environment, sandboxes it, and exposes API functions. ```csharp // OpenTaiko/src/Lua/CLuaScript.cs class CLuaScript : IDisposable { protected Lua LuaScript { get; private set; } public string strDir { get; private set; } public bool bLoadedAssets { get; private set; } public CLuaScript(string dir, string? texturesDir = null, string? soundsDir = null, bool loadAssets = true) { strDir = dir; strTexturesDir = texturesDir ?? $"{dir}/Textures"; strSounsdDir = soundsDir ?? $"{dir}/Sounds"; LuaScript = new Lua(); LuaScript.LoadCLRPackage(); LuaScript.State.Encoding = Encoding.UTF8; LuaSecurity.Secure(LuaScript); // Sandbox for security LuaScript.DoFile($"{strDir}/Script.lua"); // Expose API functions to Lua LuaScript["loadConfig"] = LoadConfig; LuaScript["loadTexture"] = LoadTexture; LuaScript["loadSound"] = LoadSound; LuaScript["loadFontRenderer"] = LoadFontRenderer; LuaScript["getLocalizedString"] = GetLocalizedString; LuaScript["debugLog"] = DebugLog; if (loadAssets) LoadAssets(); } // API exposed to Lua scripts private CTexture LoadTexture(string name) { CTexture texture = new CTexture($"{strTexturesDir}/{name}", false); listDisposables.Add(texture); return texture; } private CSound LoadSound(string name, string soundGroupName) { ESoundGroup soundGroup = soundGroupName switch { "soundeffect" => ESoundGroup.SoundEffect, "voice" => ESoundGroup.Voice, "songplayback" => ESoundGroup.SongPlayback, _ => ESoundGroup.Unknown }; CSound sound = OpenTaiko.SoundManager?.tCreateSound($"{strSounsdDir}/{name}", soundGroup); listDisposables.Add(sound); return sound; } protected object[] RunLuaCode(LuaFunction luaFunction, params object[] args) { try { var ret = luaFunction.Call(args); LuaScript.State.GarbageCollector(KeraLua.LuaGC.Collect, 0); return ret; } catch (Exception e) { Crash(e); } return new object[0]; } } ``` -------------------------------- ### Fetch Player Save Instances Source: https://context7.com/0aubsq/opentaiko/llms.txt Loads player save data from the 'Saves.db3' file. This function is crucial for retrieving and persisting player progress and game state. ```csharp // OpenTaiko/src/Databases/DBSaves.cs - Save file handling public static SaveFile[] FetchSaveInstances() { // Load player saves from Saves.db3 } ``` -------------------------------- ### CSystemSound Class for Skin Audio Source: https://context7.com/0aubsq/opentaiko/llms.txt Manages skin-specific sound playback with features like looping, exclusive playback (stopping other sounds), and double-buffering for gapless audio. Use this for custom sound effects tied to a skin. ```csharp // OpenTaiko/src/Common/CSkin.cs public class CSystemSound : IDisposable { public static CSystemSound r最後に再生した排他システムサウンド; public bool bLoop; public bool bExclusive; // Stop other sounds when playing public string strFileName = ""; private CSound[] rSound = new CSound[2]; // Double-buffer for gapless playback private int nNextPlayingSoundNumber; public CSystemSound(string strFileName, bool bLoop, bool bExclusive, bool bCompact対象, ESoundGroup soundGroup) { this.strFileName = strFileName; this.bLoop = bLoop; this.bExclusive = bExclusive; _soundGroup = soundGroup; } public void tLoading() { if (!File.Exists(CSkin.Path(this.strFileName))) return; for (int i = 0; i < 2; i++) { rSound[i] = OpenTaiko.SoundManager?.tCreateSound(CSkin.Path(strFileName), _soundGroup); } bLoadedSuccessfuly = true; } public void tPlay() { if (bNotLoadedYet) tLoading(); if (bExclusive) { r最後に再生した排他システムサウンド?.tStop(); r最後に再生した排他システムサウンド = this; } rSound[nNextPlayingSoundNumber]?.PlayStart(bLoop); nNextPlayingSoundNumber = 1 - nNextPlayingSoundNumber; // Swap buffer } public void tStop() { rSound[0]?.Stop(); rSound[1]?.Stop(); } } ``` -------------------------------- ### Load Image File Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420102/en.txt Loads an image file to be used for drawing operations. This is mandatory for drawing functions to work. ```go func:AddGraph("filename"); ``` -------------------------------- ### Manage Input Devices with CInputManager Source: https://context7.com/0aubsq/opentaiko/llms.txt Coordinates input from keyboards, mice, gamepads, and MIDI controllers. Uses a polling mechanism to update device states and supports device lookup by type and ID. ```csharp // FDK/src/02.Input/CInputManager.cs public class CInputManager : IDisposable { public List InputDevices { get; private set; } public IInputDevice? Keyboard => InputDevices.FirstOrDefault(d => d.CurrentType == InputDeviceType.Keyboard); public IInputDevice? Mouse => InputDevices.FirstOrDefault(d => d.CurrentType == InputDeviceType.Mouse); public float Deadzone = 0.5f; public CInputManager(IWindow window, bool useBufferedInput, bool bUseMidiIn = true, float gamepad_deadzone = 0.5f) { Context = window.CreateInput(); Context.ConnectionChanged += ConnectionChanged; InputDevices = new List(10); // Add keyboard and mouse InputDevices.Add(new CInputKeyboard(Context.Keyboards[0])); InputDevices.Add(new CInputMouse(Context.Mice[0])); // Add joysticks and gamepads foreach (var joystick in Context.Joysticks) InputDevices.Add(new CInputJoystick(joystick)); foreach (var gamepad in Context.Gamepads) InputDevices.Add(new CInputGamepad(gamepad, Deadzone)); // Add MIDI devices foreach (var (v, i) in MidiAccessManager.Default.Inputs.Select((v, i) => (v, i))) { var midiIn = MidiAccessManager.Default.OpenInputAsync(v.Id).Result; InputDevices.Add(new CInputMIDI(midiIn, i)); } } // Poll all input devices public void Polling() { lock (lockInputDevices) { foreach (IInputDevice device in InputDevices) device.Polling(); } } // Find specific device public IInputDevice? FindDevice(InputDeviceType type, int ID) => InputDevices.FirstOrDefault(d => d.CurrentType == type && d.ID == ID); public IInputDevice? Joystick(int ID) => FindDevice(InputDeviceType.Joystick, ID); public IInputDevice? Gamepad(int ID) => FindDevice(InputDeviceType.Gamepad, ID); public IInputDevice? MidiIn(int ID) => FindDevice(InputDeviceType.MidiIn, ID); } ``` -------------------------------- ### Define Character Animation Beat Settings Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/40303/en.txt Sets the animation beat intervals for normal and GoGo states. ```ini Game_Chara_Beat_Normal=1 Game_Chara_Beat_GoGo=2 ``` -------------------------------- ### Register Modal Parameters Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/System/Open-World Memories/Modules/Modal/README.md Defines the arguments required for the registerNewModal method, including player index, rarity, asset type, and associated metadata. ```text - (int) player: The player related to the modal (between 1 and 5) - (int) rarity: The rarity of the unlocked asset (between 0 (Poor) and 6 (Mythical)), unused for Coins - (int) modal_type: The type of unlocked asset (0: Coins, 1: Character, 2: Puchichara, 3: Title, 4: Song) - (object) modal_info: Asset related information, modal_type dependent: > Coins -> (long) modal_info: The coin value of the play > Character -> (CCharacter) modal_info: The unlocked character information data (never nil) > Puchichara -> (CPuchichara) modal_info: The unlocked puchichara information data (never nil) > Title -> (NameplateUnlockable) modal_info: The unlocked nameplate information data (never nil) > Song -> (SongNode?) modal_info: The unlocked song information data (can be nil) - (object) modal_visual_ref: Asset related visuals (or extra info), modal_type dependent: > Coins -> (long) modal_visual_ref: The total count of coins after the play > Character -> (CTexture?) modal_visual_ref: The character render as displayed in my room (can be nil) > Puchichara -> nil > Title -> (LuaNamePlateScript) modal_visual_ref: A reference to the Nameplate Lua script (never nil except if broken skin) > Song -> (CTexture?) modal_visual_ref: The song preimage, with the size value set to the same value as in the song select menu (can be nil) ``` -------------------------------- ### TJA Extended Commands Reference Source: https://context7.com/0aubsq/opentaiko/llms.txt Lists custom commands for TJA chart files, including extended note types like bombs and ADLIB notes, and metadata for Tower Mode, Dan-i Dojo, and song folder customization. ```markdown # Extended Note Types - `C` : Bomb/Mine - breaks combo, -4% gauge - `F` : ADLIB - hidden bonus note, +1 coin (max 10/game) - `G` : Purple note - requires both Don+Ka simultaneously # Tower Mode Metadata - `LIFE:5` : Starting life count (default: 5) - `TOWERTYPE:0` : Tower skin index # Dan-i Dojo Metadata - `DANTICK:3` : Dan rank display (0-5) - `DANTICKCOLOR:#FF0000` : Dan tick color filter - `EXAM2:a,95,98,m` : Accuracy exam (95% red pass, 98% gold pass) # box.def Song Folder Customization - `BOXCOLOR:#RRGGBB` : Folder box color - `BGCOLOR:#RRGGBB` : Background color - `BGTYPE:3` : Background texture index - `BOXTYPE:2` : Box texture index - `BOXCHARA:1` : Character sprite index ``` -------------------------------- ### update(player) Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420207/en.txt The update function is a core lifecycle method called every frame for each player qualified to run the script. ```APIDOC ## update(player) ### Description Called every frame to calculate and update values. This function is executed for each player ID qualified to run the script and may run multiple times in a single frame. ### Parameters - **player** (object) - Required - The player instance qualified to run the script. ``` -------------------------------- ### draw(player) Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420208/en.txt The draw function is a core hook called every frame to handle custom rendering logic for specific players. ```APIDOC ## draw(player) ### Description Called every frame to manipulate and draw images during the ending animation. This function is executed for each player ID qualified to run the script and may run multiple times in a single frame. ### Parameters #### Arguments - **player** (object) - Required - The player instance associated with the current execution context. ``` -------------------------------- ### Application Performance Properties Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420301/en.txt Endpoints for retrieving current application performance metrics including frame rate and delta time. ```APIDOC ## GET fps ### Description Gets the current frames per second. ### Method GET ### Endpoint fps ## GET deltaTime ### Description Gets the amount of time that has passed since the last frame was drawn. ### Method GET ### Endpoint deltaTime ### Response - **value** (float) - Time in seconds (e.g., 0.0166666...) ``` -------------------------------- ### CTexture Rendering Class Source: https://context7.com/0aubsq/opentaiko/llms.txt Handles GPU-accelerated texture rendering with OpenGL ES shaders, supporting 2D transformations and color manipulation. ```csharp // FDK/src/04.Graphics/CTexture.cs public class CTexture : IDisposable { public Size szTextureSize; public uint Pointer { get; private set; } // Initialize shared rendering resources (called once at startup) public static void Init() { ShaderProgram = ShaderHelper.CreateShaderProgramFromSource( vertexShaderSource, // Handles position, UV, camera matrix fragmentShaderSource // Handles texture sampling, color, effects ); MVPID = Game.Gl.GetUniformLocation(ShaderProgram, "mvp"); ColorID = Game.Gl.GetUniformLocation(ShaderProgram, "color"); CameraID = Game.Gl.GetUniformLocation(ShaderProgram, "camera"); TextureRectID = Game.Gl.GetUniformLocation(ShaderProgram, "textureRect"); } // Create texture from file public CTexture(string fileName, bool transparentBlack = false) { using SKBitmap bitmap = SKBitmap.Decode(fileName); InitializeFromBitmap(bitmap, transparentBlack); } // Create texture from bitmap public CTexture(SKBitmap bitmap, bool transparentBlack = false) { InitializeFromBitmap(bitmap, transparentBlack); } // Basic 2D drawing methods public void t2D描画(int x, int y) { Draw2D(x, y, szTextureSize.Width, szTextureSize.Height); } public void t2D描画(int x, int y, Rectangle rect) { Draw2D(x, y, rect.Width, rect.Height, rect); } // Draw with scaling and rotation public void t2D拡大率考慮描画(float x, float y, float scaleX, float scaleY) { Matrix4X4 mvp = Matrix4X4.CreateScale(scaleX, scaleY, 1.0f) * Matrix4X4.CreateTranslation(x, y, 0); DrawWithMatrix(mvp); } // Draw centered with rotation public void t2D中心回転描画(float x, float y, float rotation) { float centerX = szTextureSize.Width / 2.0f; float centerY = szTextureSize.Height / 2.0f; Matrix4X4 mvp = Matrix4X4.CreateTranslation(-centerX, -centerY, 0) * Matrix4X4.CreateRotationZ(rotation) * Matrix4X4.CreateTranslation(x, y, 0); DrawWithMatrix(mvp); } } ``` -------------------------------- ### Configure Animation Duration Properties Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/40304/en.txt Set the duration in milliseconds for specific character animations using the AnimationDuration suffix. ```ini Chara_Normal_AnimationDuration=500 Chara_Result_Clear_AnimationDuration=1000 ``` -------------------------------- ### Set Image Opacity Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420108/en.txt Adjusts the transparency of an image file. The opacity value must be an integer between 0 and 255. ```text func:SetOpacity(opacity, "filename"); ``` -------------------------------- ### CStage Base Class Definition Source: https://context7.com/0aubsq/opentaiko/llms.txt Defines the base class for game stages, including activation lifecycle methods and enumerations for stage and phase IDs. Use this for managing game flow. ```csharp // OpenTaiko/src/Stages/CStage.cs public class CStage : CActivity { internal EStage eStageID; public enum EStage { None, StartUp, // Loading screen Title, // Main menu Config, // Settings SongSelect, // Song selection DanDojoSelect, // Dan-i dojo selection SongLoading, // Pre-game loading Game, // Gameplay Results, // Score display ChangeSkin, // Skin change transition Heya, // Customization room TaikoTowers, // Tower mode OnlineLounge, // Online features CutScene, // Story cutscenes End // Exit } internal EPhase ePhaseID; public enum EPhase { Common_NORMAL, Common_FADEIN, Common_FADEOUT, Startup_0_CreateSystemSound, Startup_1_InitializeSonglist, SongLoading_LoadDTXFile, SongLoading_LoadWAVFile, Game_STAGE_FAILED, Game_STAGE_CLEAR_FadeOut, // ... } } ``` -------------------------------- ### SetOpacity Function Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420108/en.txt Adjusts the opacity level of a specified image file. ```APIDOC ## SetOpacity ### Description Sets the opacity of a given image. The value must be an integer between 0 and 255. ### Parameters - **opacity** (integer) - Required - The opacity level (0-255). - **filename** (string) - Required - The path or name of the image file to modify. ``` -------------------------------- ### Retrieve Go-Go Time Status Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420308/en.txt Accesses a list of boolean values indicating whether Go-Go Time is active for each player. ```lua local gogo ``` -------------------------------- ### Draw an image at a specific position Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420103/en.txt Renders an image file at the specified x and y coordinates. ```OpenTaiko Script func:DrawGraph(x, y, "filename"); ``` -------------------------------- ### Define the draw function for in-game animations Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420208/en.txt This function executes every frame for each player ID. Use it to handle image manipulation and drawing tasks. ```lua function draw(player) ``` -------------------------------- ### Define the update function for OpenTaiko Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420207/en.txt This function executes every frame for each player ID qualified to run the script. It may execute multiple times within a single frame. ```lua function update(player) ``` -------------------------------- ### playEndAnime Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420209/en.txt Plays the ending animation for a course. This function is intended for in-game use only and is called when a course is finished. The player ID is provided to the function, allowing it to run scripts specific to that player. It can be invoked multiple times within a single frame. ```APIDOC ## playEndAnime ### Description Plays the ending animation for a course. This function is called once when a course is finished. ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - None ### Function Signature `playEndAnime(player)` ### Parameters - **player** (number) - Required - The player ID that is qualified to run this script. ### Notes - This function is intended for in-game use only. - Can be called multiple times in a single frame. ``` -------------------------------- ### DrawText Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420101/en.txt Renders a string of text at specified coordinates using the skin's Console Font. ```APIDOC ## DrawText ### Description Draws text using the skin's Console Font (\Graphics\Console_Font.png). Only Basic Latin unicode characters are supported. ### Method func:DrawText(x, y, text) ### Parameters - **x** (number) - Required - The horizontal coordinate. - **y** (number) - Required - The vertical coordinate. - **text** (string) - Required - The text string to display. ``` -------------------------------- ### playAnime Function Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420211/en.txt This function is triggered when a player switches between Extreme and Extra difficulties on the difficulty select screen. The animation duration is configurable via Skin Config files. ```APIDOC ## playAnime() ### Description Called when a player on the difficulty select screen swaps between Extreme and Extra difficulty. ### Parameters This function does not appear to take any parameters. ### Request Example ```javascript playAnime(); ``` ### Response This function does not appear to return any values. ``` -------------------------------- ### Recolor Image with SetColor Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420109/en.txt Use a Multiply filter to recolor your image. Values must be between 0 and 1. ```OpenTaiko func:SetColor(r, g, b, "filename"); ``` -------------------------------- ### Draw Console Text and Numbers Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420101/en.txt Use these functions to render Basic Latin characters or numeric values using the skin's Console Font. ```text func:DrawText(x, y, text); ``` ```text func:DrawNum(x, y, num); ``` -------------------------------- ### Set Image Blend Mode Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420110/en.txt Configures the blending behavior for an image. Supported modes include Normal, Add, Multi, Sub, and Screen. ```text func:SetBlendMode("mode", "filename"); ``` -------------------------------- ### Draw a centered image at a specific position Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420103/en.txt Renders an image file centered at the specified x and y coordinates. ```OpenTaiko Script func:DrawGraphCenter(x, y, "filename"); ``` -------------------------------- ### AddGraph Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420102/en.txt Loads an image file into the script environment for use in drawing functions. ```APIDOC ## AddGraph ### Description Loads an image file to be used for your script. This is mandatory for drawing functions to work on your image. ### Method Function Call ### Parameters #### Arguments - **filename** (string) - Required - The path or name of the image file to load. ### Request Example AddGraph("my_image.png"); ``` -------------------------------- ### Define playEndAnime function Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420209/en.txt This function is triggered when a course is finished. The player parameter represents the ID of the player qualified to execute the script. ```javascript function playEndAnime(player) ``` -------------------------------- ### SaveFile Data Structure Source: https://context7.com/0aubsq/opentaiko/llms.txt Defines the structure for player save data, including player identification, play statistics, and song performance records. This class holds all essential information for a player's profile. ```csharp // OpenTaiko/src/Common/SaveFile.cs - Player save data public class SaveFile { public int PlayerNumber; public string PlayerName; public int TotalPlayCount; public Dictionary SongRecords; // Character, nameplate, costume selections... } ``` -------------------------------- ### Draw an image region centered at coordinates Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420105/en.txt Renders a specific rectangular portion of an image centered at the provided x and y coordinates. If the rectangle exceeds image boundaries, the texture will repeat. ```C# func:DrawGraphRectCenter(x, y, rect_x, rect_y, rect_width, rect_height, "filename"); ``` -------------------------------- ### DrawNum Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420101/en.txt Renders a numerical value at specified coordinates using the skin's Console Font. ```APIDOC ## DrawNum ### Description Draws a number using the skin's Console Font (\Graphics\Console_Font.png). ### Method func:DrawNum(x, y, num) ### Parameters - **x** (number) - Required - The horizontal coordinate. - **y** (number) - Required - The vertical coordinate. - **num** (number) - Required - The numerical value to display. ``` -------------------------------- ### UnlockCondition Types Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Databases/UnlockablesDocumentation.txt Defines the different types of conditions that can be used to unlock content in OpenTaiko. ```APIDOC ## UnlockCondition Types ### Description These are the various conditions that can be met to unlock content within the game. ### Condition Types - **ch** (Coins here): Coin requirement, payable within the heya menu. Requires 1 value: `[Coin price]`. - **cs** (Coins shop): Coin requirement, payable only within the Medal shop selection screen. - **cm** (Coins menu): Coin requirement, payable only within the song select screen (used only for songs). - **ce** (Coins earned): Coins earned since the creation of the save file. Requires 1 value: `[Total earned coins]`. - **dp** (Difficulty pass): Count of difficulties passed. Unlock check during the results screen. Condition requires 3 values: `[Difficulty int (0~4), Clear status (0~4), Number of performances]`. Input requires 1 value: `[Plays fitting the condition]`. - **lp** (Level pass): Count of level passes. Unlock check during the results screen. Condition requires 3 values: `[Star rating, Clear status (0~4), Number of performances]`. Input requires 1 value: `[Plays fitting the condition]`. - **sp** (Song performance): Count of a specific song pass. Unlock check during the results screen. Condition requires 2 x n values for n songs: `[Difficulty int (0~4, if -1 : Any), Clear status (0~2), ...]`. Input requires 1 value: `[Count of fullfiled songs]`. References n songs by their Song IDs. - **sg** (Song genre performance): Count of any song pass within a specific genre folder. Unlock check during the results screen. Condition requires 2 x n values for n songs: `[Song count, Clear status (0~4), ...]`. Input requires 1 value: `[Count of fullfiled genres]`. References n genres by their names. - **sc** (Song charter performance): Count of any chart pass by a specific charter. Unlock check during the results screen. Condition requires 2 x n values for n songs: `[Song count, Clear status (0~4), ...]`. Input requires 1 value: `[Count of fullfiled charters]`. References n charters by their names. - **tp** (Total plays): Total playcount. Requires 1 value: `[Total playcount]`. - **ap** (AI battle plays): AI battle playcount. Requires 1 value: `[AI battle playcount]`. - **aw** (AI battle wins): AI battle wins count. Requires 1 value: `[AI battle wins count]`. ``` -------------------------------- ### General Update Function Source: https://github.com/0aubsq/opentaiko/blob/main/OpenTaiko/Encyclopedia/Pages/420202/en.txt Details about the general update function used in the OpenTaiko project. ```APIDOC ## General Update Function ### Description This function is called every frame to calculate and update values. It is temporarily paused when the game is in a paused state. ### Method N/A (This describes a game loop function, not an HTTP endpoint) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ```