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
- Unity
- Android
- iOS
- UE4
- 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
- TapSDK 3.21.0 and above
- Android 5.0 (API level 21) or later
- TapSDK 3.21.0 and above
- iOS 11 or later, Xcode version 14.1 or later
- TapSDK 3.22.0 and above
- Install UE 4.26 and above
- iOS 12 or higher
- Android 5.0 (API level 21) or higher
- macOS 10.14.0 or later
- Windows 7 or higher
Supported platforms: Android / iOS / Windows / macOS
Pre-integration preparation
- 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:
- Unity
- Android
- iOS
- UE4
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
Find the download addresses of TapSDK Unity and LeanCloud C# SDK on the download page , and download
TapSDK-UnityPackage.zip
andLeanCloud-SDK-Realtime-Unity.zip
respectively.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。
The decompresses
LeanCloud-SDK-Realtime-Unity.zip
is in the Plugins folder, drag and drop it to Unity.
repositories{
flatDir {
dirs 'libs'
}
}
dependencies {
...
implementation (name:'TapConnect_3.29.4', ext:'aar') // TapTap Floating Window
implementation (name:'TapMoment_3.29.4', ext:'aar') // TapTap Floating windows rely on inline dynamics - Mandatory
implementation (name:'TapLogin_3.29.4', ext:'aar') // TapTap Floating Window Dependent Login Module - Required
implementation (name:'TapCommon_3.29.4', ext:'aar') // Required: TapSDK Base Library
implementation (name:'TapBootstrap_3.29.4', ext:'aar') // Optional: TapSDK Base Library
}
// TapTap Hover
TapConnectResource.bundle
TapConnectSDK.framework
// Floating Window relies on inline dynamics and login module - Mandatory
TapMomentResource.bundle
TapMomentSDK.framework
TapLoginSDK.framework
TapLoginResource.bundle
// Basic Module - Mandatory
TapCommonResource.bundle
TapCommonSDK.framework
// Basic Module - Optional
TapBootstrapSDK.framework
PublicDependencyModuleNames.AddRange(new string[] {
//...
"TapConnect" //Mandatory
"TapLogin" //Mandatory-Floating Window relies on the login module
"TapMoment" //Mandatory-Floating Window relies on inline dynamics
"TapCommon" //Mandatory-Basic Module
"TapBootstrap"//Optional-Basic Module
});
Initialisation
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.
Below is the sample code to initialise the Floating Window separately:
- Unity
- Android
- iOS
- UE4
using TapTap.Connect; // namespace
TapConnect.Init("your_client_id", "your_client_token", (bool)isCN);
//activity is the current Activity instance
TapConnect.init(activity, "clientId", "clientToken", isCN);
[TapConnect initWithClientId:@"clientId" clientToken:@"clientToken" isCN:YES];
FTapConnect::Init("clientId", "clientToken", true);
Parameter description
- The
client_id
andclient_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:
- Unity
- Android
- iOS
- UE4
TapConnect.SetEntryVisible(bool visible)
TapConnect.setEntryVisible(boolean visible);
[TapConnect setEntryVisible:YES];
FTapConnect::SetEntryVisible(true);
Internalisation
The Floating Window supports setting the language:
- Unity
- Android
- iOS
- UE4
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
}
}
int auto = 0;
TapBootstrap.setPreferredLanguage(auto);
The following languages are supported:
0 Auto
1 Simplified Chinese
2 English
3 Traditional Chinese
4 Japanese
5 Korean
6 Thai
7 Indonesian
[TapBootstrap setPreferredLanguage:TapLanguageType_Auto];
The following languages are supported:
typedef NS_ENUM (NSInteger, TapLanguageType) {
TapLanguageType_Auto = 0, // Auto
TapLanguageType_zh_Hans, // Simplified Chinese
TapLanguageType_en, // English
TapLanguageType_zh_Hant, // Traditional Chinese
TapLanguageType_ja, // Japanese
TapLanguageType_ko, // Korean
TapLanguageType_th, // Thai
TapLanguageType_id, // Indonesian
};
TapUECommon::SetLanguage(ELanguageType::AUTO);
The following languages are supported:
UENUM(BlueprintType)
enum class ELanguageType : uint8
{
AUTO = 0, // Auto
ZH, // Simplified Chinese
EN, // English
ZHTW, // Traditional Chinese
JA, // Japanese
KO, // Korean
TH, // Thai
ID, // Indonesian
DE, // German
ES, // spanish
FR, // French
PT, // Portuguese
RU, // Russian
TR, // Turkish
VI, // Vietnamese
};
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.