API-reference

Unity/C#

Core Loop

Launch MiniTon

This method is overloaded

void MiniTonCrossPlatform.LaunchMiniTon();

Legacy:

void MiniTonCrossPlatform.LaunchMiniTon(MiniTonMatchDelegate matchDelegate);

Parameters

Legacy: matchDelegate A reference to a MiniTonMatchDelegate instance that MiniTon will use


Update Current Score

Call this method every time the player's score changes during a MiniTon match.

This method is overloaded

void MiniTonCrossPlatform.UpdatePlayersCurrentScore(string score);

Parameters

score The player's current score as a string


Submit Score

Call this method when a player finishes a match. This will send the score to MiniTon and conclude the match. This will not send the user back to the MiniTon BOT

This method is overloaded

void MiniTonCrossPlatform.SubmitScore(string score, Action successCallback, Action<string> failureCallback)

Parameters

score Player's final score as a string

successCallback Implementation of the System.Action delegate that handles successful submission

failureCallback Implementation of the System.Action delegate that handles failed submission


End Replay

End the current replay if one exists and returns the status of the score submission. Must be called after score has been submitted. Use to end replay recording at conclusion of the match and before user is presented with personalized progression room metrics.

bool EndReplay()

Returns

Boolean true if end replay was successful, false if the user has not submitted a score for the match


Return to MiniTon

The ReturnToMiniTon method presents the MiniTon BOT. This must be called after the score has been submitted with the SubmitScore method. After the SubmitScore has been called you can present users with relevant statistics such as high score and present content to enhance the game experience.

In all cases, it will return a boolean, indicating whether or not it is able to return the user to MiniTon. For the case of a match in progress, unless a score has been submitted, this method will return false and the user will not be returned to MiniTon. If a score has been submitted, it returns true and returns the user to MiniTon.

bool MiniTonCrossPlatform.ReturnToMiniTon()

Returns

Boolean indicating whether it is able to return the user to MiniTon BOT


Abort Match

Forfeits the current match and returns to the MiniTon BOT.

void MiniTonCrossPlatform.AbortMatch()

Display Tournament Results With Score

The DisplayTournamentResultsWithScore method replaces the deprecated ReportFinalScore method. MiniTon recommends that you try to use the SubmitScore and ReturnToMiniTon methods. However, DisplayTournamentResultsWithScore can be used as a failsafe if the SubmitScore method fails.

This method is overloaded

void MiniTonCrossPlatform.DisplayTournamentResultsWithScore(string score)

Parameters

score Player's final score as a string


Progression API

Progression Namespace Constants

Calls to the progression methods must use one of the three namespace string values. Each namespace return a separate list of key-value pairs for for that namespace:

  • DefaultPlayerData For read-only MiniTon player data and is game-specific.

  • PlayerData For publisher-defined player data and is game-specific.

  • InGameItems For publisher-defined player data and is shared across all games in publisher's portfolio.

ProgressionNamespace.DEFAULT_PLAYER_DATA
ProgressionNamespace.PLAYER_DATA
ProgressionNamespace.IN_GAME_ITEMS

Get Progression User Data

Retrieve data for the current user. This method requires callback methods that allow you to handle success and fail scenarios.

void MiniTonCrossPlatform.GetProgressionUserData(string progressionNamespace, List<string> userDataKeys, Action<Dictionary<string, ProgressionValue>> successCallback, Action<string> failureCallback)

Parameters

progressionNamespace One of the Namespace String Constants

userDataKeys String key list of desired fields.

successCallback Action delegate to handle successful callback. The method must be defined in the implementation.

failureCallback Action delegate to handle failed callback. The method must be defined in the implementation.


Update Progression User Data

Write data for the current user. This method requires callback methods that allow you to handle success and fail scenarios. Can update up to 25 elements per call.

Note

The DefaultPlayerData namespace is read-only, and cannot be used with this method.

void MiniTonCrossPlatform.UpdateProgressionUserData(string progressionNamespace, Dictionary<string, object> userDataUpdates, Action successCallback, Action<string> failureCallback)

Parameters

progressionNamespace One of the Namespace String Constants

userDataUpdates Dictionary of key/value pairs to be updated

successCallback Action delegate to handle successful callback. The method must be defined in the implementation

failureCallback Action delegate to handle failed callback. The method must be defined in the implementation


Random Generator

Random Value

Use the MiniTon random implementation to ensure each competitor receives the exact same random number.

float MiniTonCrossPlatform.Random.Value()

Returns

A generated pseudo random float value


Random Value Ranged

This method is overloaded

int MiniTonCrossPlatform.Random.Range(int min, int max)

Parameters

min The minimum int value for the rangemax The maximum int value for the range

Returns

A generated pseudo random int value within the given range

NOTE

The Random function Range(int min, int max) requires the min and max value range (max-min) to be no larger than Int.MaxValue to prevent overflow


Random Point Inside Unit Sphere

Generate a point inside the unit sphere using Value().

Vector3 MiniTonCrossPlatform.Random.InsideUnitSphere();

Returns

A new Vector3 object


Random Point Inside Unit Circle

Find a point inside the unit circle using Value().

Vector2 MiniTonCrossPlatform.Random.InsideUnitCircle();

Returns

A new Vector2 object


Random Point On Unit Sphere

Hybrid rejection / trig method to generate points on a sphere using Value().

Vector3 MiniTonCrossPlatform.Random.OnUnitSphere();

Returns

A new Vector3 object


Random Quaternion in Rotation

Quaternion random using Value().

Quaternion MiniTonCrossPlatform.Random.Rotation();

Returns

A new Quaternion object


Random Quaternion in Rotation Uniform

Quaternion random using Value().

Quaternion MiniTonCrossPlatform.Random.RotationUniform();

Returns

A new Quaternion object


Helpers

Get Match Info

MiniTonSDK.Match MiniTonCrossPlatform.GetMatchInfo();

Returns

A Match object containing information about the current match in progress


Get Match Rules

Returns the match gameplay parameters that you set up in the MiniTon Developer Console for each tournament type

Hashtable MiniTonCrossPlatform.GetMatchRules();

Returns

Hashtable containing the gameplay parameters of the current match


Get Player

Gets the currently logged-in player info. This will return an empty object if a MiniTon player has not been created yet.

MiniTonSDK.Player MiniTonCrossPlatform.GetPlayer();

Returns

A Player object


Get SDK Version

Gets the version of the MiniTon SDK your game is being run on.

string MiniTonCrossPlatform.SDKVersionShort();

Returns

MiniTon SDK version as a string


Is Match In Progress

Checks if a match is currently in progress.

bool MiniTonCrossPlatform.IsMatchInProgress();

Returns

A boolean indicating if a match if is in progress


Set Metadata for Match In Progress

Updates the meta data for a MiniTon match in progress to track player actions, level types, or other information pertinent to the MiniTon integration. There should be no more than 10 key/value pairs in the supplied collection. Data will only be available to MiniTon to help identify fairness in level-based games.

void MiniTonCrossPlatform.AddMetadataForMatchInProgress(string metadataJson, bool forMatchInProgress)

Parameters

attributes String representing the meta data in a JSON string

forMatchInProgress Boolean to check whether the user is in a MiniTon game



Sync API

Is Match Completed

This will return whether or not another client connected to this match has called either displaySynchronousTournamentResultsWithScore or initiateSynchronousAbortWithCompletion: to end the match.

bool MiniTonCrossPlatform.IsMatchCompleted()

Returns

Boolean indicating whether or not the match has been completed


Send Data

Sends a message to all clients connected to this match. This will trigger MiniTonSyncDelegate::onDidReceiveData: on all clients connected to the current match.

Note:

NSData passed to this function are limited to a certain size based on the game, and this function will assert if over that size. (2048 bytes currently).

void MiniTonCrossPlatform.SendData(byte[] data)

Parameters

data The message to be sent, max 2048 bytes


Objects

Real-Time Server Connection Info

CustomServerConnectionInfo

PropertyData TypeDescription

isBotMatch

bool

Indicates if the match is a sync bot match

MatchId

string

The ID of the real-time match

MatchToken

string

An encrypted token to help validate the session server side

ServerIp

string

The hostname or IP for the match

ServerPort

string

The port for the game server


Match Info

Match​

PropertyData TypeDescription

BracketRound

int

Indicates the round of the bracket tournament if IsBracket is true

CustomServerConnectionInfo

CustomServerConnectionInfo

The connection info to a custom server that coordinates a real-time match

Description

string

The description of this tournament type

EntryToncoin

float

If this tournament is being played for Toncoin, this is the amount of Toncoin required to enter

EntryPoints

int

If this tournament is being played for Points, this is the amount of Points required to enter.

GameParams

Dictionary<string, string>

The custom parameters for this tournament type specified in the developer portal

ID

ulong

The unique ID for the match

IsBracket

bool

Indicates the match is a bracketed tournament

IsToncoin

bool

Indicates the match is for Toncoin prizes or for Points

IsCustomSynchronousMatch

bool

Indicates if the match is a sync match

IsSynchronous

bool

Deprecated. Indicates if this match is Sync. Note: please use the IsCustomSynchronousMatch property

IsTieBreaker

bool

Indicates whether the match is a tie-breaker

Name

string

Name of the match

Players

List<Player>

List of players in the match

MiniTonDifficulty

uint

The difficulty of the game (used with automatic difficulty). Note: only set in production.

TemplateID

int

The unique ID for the tournament template this match is based on


Player Info

Player

PropertyData TypeDescription

AvatarURL

string

A link to the user's avatar image

DisplayName

string

Player name

FlagURL

string

A link to the user's country's flag image

ID

ulong

The Telegram ID unique to this user

IsCurrentPlayer

bool

This Player represents the current user if this is true

TournamentPlayerID

ulong

A Tournament Player ID unique to this user


Progression Metadata

ProgressionMetadata

PropertyData TypeDescription

GameIds

List<string>

List of relevant game IDs for the associated ProgressionValue


Progression Value

ProgressionValue

PropertyData TypeDescription

DataType

string

The data type for the stored value

DisplayName

string

The display name for the stored value

LastUpdatedTime

DateTime

The timestamp of when the data was last updated on MiniTon servers in UTC

Metadata

ProgressionMetadata

The metadata for this progression value

Value

string

The stored value for this progression value

Last updated

Contact us

Telegram

Šī¸MiniTon 2023