Skip to main content
Version: v3

Floating Window Developer Guide

This article describes how to add TapTap Floating Window to your game. Using the Floating Window feature relies on TapTap Login and TapTap Moment.

Environmental requirements

  • TapSDK 3.21.0 and above
  • Unity 2019.4 or higher
  • iOS 11 or later, Xcode version 14.1 or later
  • Android 5.0 (API level 21) or later

Pre-integration preparation

  1. Refer to Preparation to create the application and turn on the Floating Window settings accordingly;

SDK Acquisition

Please refer to TapTap Login and embedded-moments to complete the SDK obtaining, and then you can get the TapSDK through download to add the TapConnect module on top of it:

The SDK can be imported either through Unity Package Manager or manually**. Please choose according to your project needs.

Method 1: Use Unity Package Manager

NPMJS Installation

As of version 3.25.0, TapSDK supports NPMJS installation, with the advantage that only the version number needs to be configured and nested dependencies are supported.

Add the following dependencies to your project's Packages/manifest.json file:

"dependencies":{
"com.taptap.tds.connect":"3.29.4",
}

However, it should be noted that scopedRegistries must be declared under the same level of dependencies in Packages/manifest.json:

"scopedRegistries": [
{
"name": "NPMJS",
"url": "https://registry.npmjs.org/",
"scopes": ["com.tapsdk", "com.taptap", "com.leancloud"]
}
]
GitHub Installation

Add the following dependencies to your project's Packages/manifest.json file:

"dependencies":{
"com.taptap.tds.login":"https://github.com/TapTap/TapLogin-Unity.git#3.29.4",
"com.taptap.tds.common":"https://github.com/TapTap/TapCommon-Unity.git#3.29.4",
"com.taptap.tds.connect":"https://github.com/TapTap/TapConnect-Unity.git#3.29.4",
"com.taptap.tds.moment":"https://github.com/TapTap/TapMoment-Unity.git#3.29.4",
"com.leancloud.realtime":"https://github.com/leancloud/csharp-sdk-upm.git#realtime-2.3.0",
"com.taptap.tds.login":"https://github.com/leancloud/csharp-sdk-upm.git#storage-2.3.0",
}

Select Window > Package Manager in the top menu of Unity to see the packages already installed in your project.

Method 2: Import Manually

  1. Find the download addresses of TapSDK Unity and LeanCloud C# SDK on the download page , and download TapSDK-UnityPackage.zip and LeanCloud-SDK-Realtime-Unity.zip respectively.

  2. In the Unity project, go to Assets > Import Packages > Custom Packages, and from the unzipped TapSDK-UnityPackage.zip, select the TapSDK packages that you want to use in the game, and import them:

    • TapTap_Common.unitypackage Required: TapSDK Base Library
    • TapTap_Login.unitypackage TapTap Floating Window Dependent Login Module - Required
    • TapTap_Connect.unitypackage TapTap Floating Window
    • TapTap_Moment.unitypackage TapTap Floating windows rely on inline dynamics - Mandatory
  3. The decompresses LeanCloud-SDK-Realtime-Unity.zip is in the Plugins folder, drag and drop it to Unity.

Initialisation

info

Choose either of the following two initialisation methods.

TapSDK Initialisation

If you have already done the initialisation of built-in account system Tap Login, you only need to introduce the Floating Window module here, no other additional processing is needed.

Separate initialisation of the Floating Window

If the game does not initialise the TapSDK via the TapBootstrap method provided above, the Floating Window can be initialised separately, as the Floating Window relies on pure Tap authentication and inline dynamics.

tip

Initialising the Floating Window alone requires that the only TapTap authentication and inline dynamic initialisation actions are prioritised. For TapTap authentication-only initialisation reference, and for embedded dynamic initialisation reference.

Below is the sample code to initialise the Floating Window separately:

using TapTap.Connect; // namespace

TapConnect.Init("your_client_id", "your_client_token", (bool)isCN);

Parameter description

  • The client_id and client_token information can be viewed at Developer Centre > Your Games > Game Services > Application Configuration, and isCN indicates whether the application is from Mainland China.

Setting the Floating Window portal to show hidden

Sometimes developers want to directly control the display and hiding of the Floating Window entry in some scenarios, e.g. only display the Floating Window entry in some scenarios, then they can call the following interface:

TapConnect.SetEntryVisible(bool visible)

Internalisation

The Floating Window supports setting the language:

TapCommon.SetLanguage(TapLanguage.AUTO);

The following languages are supported:

namespace TapTap.Common
{
public enum TapLanguage
{
AUTO = 0, // Auto
ZH_HANS = 1, // Simplified Chinese
EN = 2, // English
ZH_HANT = 3, // Traditional Chinese
JA = 4, // Japanese
KO = 5, // Korean
TH = 6, // Thai
ID = 7, // Indonesian
}
}

When Auto is selected, the SDK will set the language based on the system language. If the system language is not among the supported languages listed above, the SDK will set the language according to the region configured when the SDK is initialized. If the region is China mainland, the language will be Simplified Chinese. Otherwise, the language will be English.