Skip to main content

InitLI

AndroidiOSWindows
Deprecated since: LI PASS V1.16.00
If you were looking for the method for use with Unreal Engine, see InitLI for Unreal Engine SDK.

It is recommended to initialize LI PASS when starting the game. For LI PASS V1.16 and above, see InitLIP.

Function definition

public static void InitLI(Font font, bool isTestEnv, string appVersion, string langType = "en");

LI PASS initialization consists of the following steps:

  1. Obtain hotfix information for resource package version
  2. Download resources for new version
  3. Load resources
  4. After loading is complete, trigger the GN_READY event from LIEventObserver
note

The callback timeout for GN_READY in the case of a network exception is 60s*3. Games can call AutoLogin, OpenLoginPanel, or LoginChannelWithLIPass directly after initialization to provide the player with a timely response, without having to wait for the GN_READY event.

Obtain Hotfix Information for Resource Package Version

Request Information

Search gnconfig to locate the request URL:

2023-06-08 09:54:20.948 25151-26800 INTL                    com.intlgame.demo                    I  [INTL][1806][A.I.A][2023-06-08 09:54:20.948][25151, 26800, 539607522480][ (intl_http_manager.cpp:328) OnHTTPClientCallBack] : 
[http] request url : https://test-vas.intlgame.com/v2/gnconfig/acquire_config?area_id=0&channelid=131&gameid=11&openid=FFFFFFFFFFFFFF&os=1&sdk_version=1.3.00&seq=11-7a08fc1d06ea8e62b6ea3e626ed61c8f2398c981bc6d8d0dfa30681a3d05616e-1686189260-717&source=37&token=&ts=1686189260&sig=6dc2bb8968cfe28fab5138e2342f327d ,

Response Information

caution

If LI PASS does not perform according to expectations, verify the version information to confirm that the correct version of resources have been loaded.

If a rule is matched, search rule_id to locate the response information:

response_body : {
"ret":0,
"msg":"",
"rule_id":"1063",
"resource_list":"[{\"dependency\":[],\"file_list\":[{\"md5\":\"968F1A3E16AB6041F504E29DEFB348DD\",\"size\":1747648,\"url\":\"https://sg-gamenative001-1300342648.file.myqcloud.com/gamenative-files/11/LI_107_UE_Android/1686187421509627102/LevelInfinite_Android.pak\"}],\"is_public\":0,\"name\":\"LI_107_UE_Android\"}]",
"sdk_enable":1,
"sdk_debug_enable":1,
"report_log_enable":1,
"log_level":1,
"inner_seq":"ac097e19-772b-4069-948d-78e21821ac15",
"seq":"11-7a08fc1d06ea8e62b6ea3e626ed61c8f2398c981bc6d8d0dfa30681a3d05616e-1686189260-717"
}

If no rules are matched:

response_body : {
"ret":23111202,
"msg":"no matched config error( [match logic]no match )",
"rule_id":"",
"resource_list":"",
"sdk_enable":0,
"sdk_debug_enable":0,
"report_log_enable":0,
"log_level":0,
"inner_seq":"ca3fa94a-0be7-4325-aa90-a5bc36d7c502",
"seq":"11-7a08fc1d06ea8e62b6ea3e626ed61c8f2398c981bc6d8d0dfa30681a3d05616e-1686189018-705"
}

Input parameters

ParameterTypeDescription
fontFontThe font used for LI PASS UI
isTestboolCheck for test environment, passes false for live environment, passes true for test environment
appVersionstringGame app version, space characters cannot be used
langTypestringLI PASS UI display language
note

If you wish to use font that is not included with LI PASS, please send the font to INTLHelper.

Code sample

Font font = GetFont();
LevelInfinite.InitLI(font, true, Application.version, "en");