- Trigger API Reference\DCEI Functions\Settings
- Settings.SetSelectedLanguage
- Settings.GetSelectedLanguage
- Settings.GetDisplayLanguage
- Settings.GetSaveDataHistory
- Settings.RestoreSaveDataByIndex
- Settings.UploadSaveData
- Settings.TriggerAddSaveDataBackupStatusChangeEvent
- Settings.GetResolutionLevel
- Settings.SetResolutionLevel
- Settings.IsDynamicShadowEnabled
- Settings.SetDynamicShadowEnabled
- Settings.IsFps30
- Settings.SetFps30Enabled
- Settings.IsFacebookConnected
- Settings.ConnectFacebook
- Settings.DisconnectFacebook
- Settings.RestoreAccountByFacebook
- Settings.IsGoogleConnected
- Settings.ConnectGoogle
- Settings.DisconnectGoogle
- Settings.RestoreAccountByGoogle
- Settings.IsAppleConnected
- Settings.ConnectApple
- Settings.DisconnectApple
- Settings.RestoreAccountByApple
- Settings.SendSupportEmail
Trigger API Reference\DCEI Functions\Settings
Used for letting users be able to fully customize the in-game settings page.
void Settings.SetSelectedLanguage(string language)
void Settings.SetSelectedLanguage(string language)
Description
Set the selected game language. Note: New selected language will be applied after restart.
Supported languages:
- English
- French
- German
- Spanish
- Portuguese
- Russian
- Chinese (Simplified)
- Chinese (Traditional)
- Japanese
- Korean
- Italian
- Thai
- Arabic
Parameters
- string
language
the language to set.
Example Usage
function SettingsMenu.InitializeLanguage(layout, language_args)
layout.language_buttons = {}
-- Load override language options
for k, v in pairs(language_args) do
languages[k] = v
end
-- Load current language
selected_language = DCEI.Settings.GetSelectedLanguage() or DCEI.Settings.GetDisplayLanguage() or "English"
-- Callbacks
DCEI.SetOnClickCallback(layout.SetLanguage.Frame, function()
layout.LanguagePopup:Show()
end)
DCEI.SetOnClickCallback(layout.LanguagePopup.CloseButton, function()
layout.LanguagePopup:Hide()
end)
local function OnLanguageButtonPress(k, v)
layout.language_buttons[selected_language].state.is_selected = false
layout.language_buttons[k].state.is_selected = true
selected_language = k
DCEI.Settings.SetSelectedLanguage(k)
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/general/change_language_need_restart"))
end
for k, v in pairs(languages) do
if v then
layout.language_buttons[k] =
GMUI.Layout.New({ name = "UI/PauseMenu/LanguageButton", parent = layout.LanguagePopup.ContentStack })
layout.language_buttons[k].language = k
DCEI.SetTextFrameText(layout.language_buttons[k].Label, k)
DCEI.SetOnClickCallback(layout.language_buttons[k].Frame, function()
OnLanguageButtonPress(k, v)
end)
if not layout.language_buttons[k].state then
layout.language_buttons[k].state = DCEI.GetFrameState(layout.language_buttons[k].Frame)
end
end
end
layout.language_buttons[selected_language].state.is_selected = true
end
string Settings.GetSelectedLanguage()
string Settings.GetSelectedLanguage()
Description
Get the selected game language. Note: New selected language will be applied after restart, so the language returned by this api may differ from the current display language.
Example Usage
---@class _LanguageArgs table
local languages = {
["English"] = true,
["Chinese (Simplified)"] = true,
["Chinese (Traditional)"] = true,
["Japanese"] = true,
["Korean"] = true,
["Spanish"] = true,
["German"] = true,
["Portuguese"] = true,
["Russian"] = true,
["French"] = true,
["Italian"] = true,
["Thai"] = true,
["Arabic"] = true,
}
local selected_language = DCEI.Settings.GetSelectedLanguage()
string Settings.GetDisplayLanguage()
string Settings.GetDisplayLanguage()
Description
Get the current display game language.
Example Usage
---@private
function SettingsMenu.InitializeLanguage(layout, language_args)
layout.language_buttons = {}
-- Load override language options
for k, v in pairs(language_args) do
languages[k] = v
end
-- Load current language
selected_language = DCEI.Settings.GetSelectedLanguage() or DCEI.Settings.GetDisplayLanguage() or "English"
-- Callbacks
DCEI.SetOnClickCallback(layout.SetLanguage.Frame, function()
layout.LanguagePopup:Show()
end)
DCEI.SetOnClickCallback(layout.LanguagePopup.CloseButton, function()
layout.LanguagePopup:Hide()
end)
local function OnLanguageButtonPress(k, v)
layout.language_buttons[selected_language].state.is_selected = false
layout.language_buttons[k].state.is_selected = true
selected_language = k
DCEI.Settings.SetSelectedLanguage(k)
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/general/change_language_need_restart"))
end
for k, v in pairs(languages) do
if v then
layout.language_buttons[k] =
GMUI.Layout.New({ name = "UI/PauseMenu/LanguageButton", parent = layout.LanguagePopup.ContentStack })
layout.language_buttons[k].language = k
DCEI.SetTextFrameText(layout.language_buttons[k].Label, k)
DCEI.SetOnClickCallback(layout.language_buttons[k].Frame, function()
OnLanguageButtonPress(k, v)
end)
if not layout.language_buttons[k].state then
layout.language_buttons[k].state = DCEI.GetFrameState(layout.language_buttons[k].Frame)
end
end
end
layout.language_buttons[selected_language].state.is_selected = true
end
void Settings.GetSaveDataHistory(int count, TypedCallback<object> callback)
void Settings.GetSaveDataHistory(int count, TypedCallback<object> callback)
Description
Attempts to fetch the player's save history. If successful, the callback will return with the save history as a table as its first parameter.
Parameters
- int
count
the number of save data instances to include in the callback table, with the most recent saves returned first. Max 10. - TypedCallback<object>
callback
the callback function to handle the returned save data instances.
Callback Parameters
- Object
result
Example Usage
local function ResultCallback(result)
if result then
for _, save in ipairs(result.saves) do
DCEI.LogMessage("Save data timestamp:" .. save.time)
end
end
end
DCEI.Settings.GetSaveDataHistory(count, ResultCallback)
void Settings.RestoreSaveDataByIndex(int index)
void Settings.RestoreSaveDataByIndex(int index)
Description
Attempts to resets the saved map data at the given index.
Parameters
- int
index
the saved map data index to reset.
Example Usage
function SettingsMenu.InitializeSaveButtons(layout)
DCEI.SetOnClickCallback(layout.LoadProgress.Frame, function()
local function ResultCallback(result)
if result then
SettingsMenu.ShowAreYouSurePopup({
Title = DCEI.GetTranslationText("ui/profilepage/are_you_sure"),
Content = DCEI.GetTranslationText("ui/profilepage/unsaved_progress_lost"),
YesCallback = function()
DCEI.Settings.RestoreSaveDataByIndex(1)
end,
})
else
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/profilepage/nothing_to_load"))
end
end
DCEI.Settings.GetSaveDataHistory(10, ResultCallback)
end)
DCEI.SetOnClickCallback(layout.SaveProgress.Frame, function()
local pass = DCEI.Settings.UploadSaveData(function()
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/profilepage/save_successful"))
end)
if not pass then
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/homepage/require_internet"))
end
end)
end
void Settings.UploadSaveData(TypedCallback<object> callback)
void Settings.UploadSaveData(TypedCallback<object> callback)
Description
Attempts to upload player's saved map data.
Parameters
- TypedCallback<object>
callback
the callback function that will get called after upload.
Callback Parameters
- Object
result
Example Usage
---@private
function SettingsMenu.InitializeSaveButtons(layout)
DCEI.SetOnClickCallback(layout.LoadProgress.Frame, function()
local function ResultCallback(result)
if result then
SettingsMenu.ShowAreYouSurePopup({
Title = DCEI.GetTranslationText("ui/profilepage/are_you_sure"),
Content = DCEI.GetTranslationText("ui/profilepage/unsaved_progress_lost"),
YesCallback = function()
DCEI.Settings.RestoreSaveDataByIndex(1)
end,
})
else
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/profilepage/nothing_to_load"))
end
end
DCEI.Settings.GetSaveDataHistory(10, ResultCallback)
end)
DCEI.SetOnClickCallback(layout.SaveProgress.Frame, function()
local pass = DCEI.Settings.UploadSaveData(function()
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/profilepage/save_successful"))
end)
if not pass then
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/homepage/require_internet"))
end
end)
end
void Settings.TriggerAddSaveDataBackupStatusChangeEvent(TypedCallback<int> callback)
void Settings.TriggerAddSaveDataBackupStatusChangeEvent(TypedCallback<int> callback)
Description
Parameters
Callback Parameters
- Int32
status
Example Usage
int Settings.GetResolutionLevel()
int Settings.GetResolutionLevel()
Description
Get current game resolution level. 0 -> low, 1 -> medium, 2 -> high. The level will be clamp to (0, max_level), and this max level depends on user's device, 1 for low end, 2 for high end.
Example Usage
function SettingsMenu.InitializeGraphicsPopup(layout)
DCEI.SetOnClickCallback(layout.GraphicSettings.Frame, function()
layout.GraphicsPopup:Show()
end)
DCEI.SetOnClickCallback(layout.GraphicsPopup.CloseButton, function()
layout.GraphicsPopup:Hide()
end)
if not layout.GraphicsPopup.state then
layout.GraphicsPopup.state = DCEI.GetFrameState(layout.GraphicsPopup.Frame)
end
layout.GraphicsPopup.state.fps_60 = not DCEI.Settings.IsFps30()
layout.GraphicsPopup.state.dynamic_shadows = DCEI.Settings.IsDynamicShadowEnabled()
DCEI.SetOnClickCallback(layout.GraphicsPopup.FPS60.Frame, function()
DCEI.Settings.SetFps30Enabled(not DCEI.Settings.IsFps30())
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/settings/graphics_reminder"))
end)
DCEI.SetOnClickCallback(layout.GraphicsPopup.DynamicShadows.Frame, function()
DCEI.Settings.SetDynamicShadowEnabled(not DCEI.Settings.IsDynamicShadowEnabled())
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/settings/graphics_reminder"))
end)
for i = 0, 2 do
if not layout.GraphicsPopup["Quality" .. i].state then
layout.GraphicsPopup["Quality" .. i].state = DCEI.GetFrameState(layout.GraphicsPopup["Quality" .. i].Frame)
end
DCEI.SetOnClickCallback(layout.GraphicsPopup["Quality" .. i].Frame, function()
layout.GraphicsPopup["Quality" .. resolution_level].state.is_selected = false
layout.GraphicsPopup["Quality" .. i].state.is_selected = true
resolution_level = i
DCEI.Settings.SetResolutionLevel(i)
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/settings/graphics_reminder"))
end)
end
resolution_level = DCEI.Settings.GetResolutionLevel()
layout.GraphicsPopup["Quality" .. resolution_level].state.is_selected = true
end
void Settings.SetResolutionLevel(int level)
void Settings.SetResolutionLevel(int level)
Description
Set the game resolution level. Note: New resolution level will be applied after restart.
0 -> low, 1 -> medium, 2 -> high. The level will be clamp to (0, max_level), and this max level depends on user's device, 1 for low end, 2 for high end.
Parameters
- int
level
the resolution level to set.
Example Usage
function SettingsMenu.InitializeGraphicsPopup(layout)
DCEI.SetOnClickCallback(layout.GraphicSettings.Frame, function()
layout.GraphicsPopup:Show()
end)
DCEI.SetOnClickCallback(layout.GraphicsPopup.CloseButton, function()
layout.GraphicsPopup:Hide()
end)
if not layout.GraphicsPopup.state then
layout.GraphicsPopup.state = DCEI.GetFrameState(layout.GraphicsPopup.Frame)
end
layout.GraphicsPopup.state.fps_60 = not DCEI.Settings.IsFps30()
layout.GraphicsPopup.state.dynamic_shadows = DCEI.Settings.IsDynamicShadowEnabled()
DCEI.SetOnClickCallback(layout.GraphicsPopup.FPS60.Frame, function()
DCEI.Settings.SetFps30Enabled(not DCEI.Settings.IsFps30())
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/settings/graphics_reminder"))
end)
DCEI.SetOnClickCallback(layout.GraphicsPopup.DynamicShadows.Frame, function()
DCEI.Settings.SetDynamicShadowEnabled(not DCEI.Settings.IsDynamicShadowEnabled())
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/settings/graphics_reminder"))
end)
for i = 0, 2 do
if not layout.GraphicsPopup["Quality" .. i].state then
layout.GraphicsPopup["Quality" .. i].state = DCEI.GetFrameState(layout.GraphicsPopup["Quality" .. i].Frame)
end
DCEI.SetOnClickCallback(layout.GraphicsPopup["Quality" .. i].Frame, function()
layout.GraphicsPopup["Quality" .. resolution_level].state.is_selected = false
layout.GraphicsPopup["Quality" .. i].state.is_selected = true
resolution_level = i
DCEI.Settings.SetResolutionLevel(i)
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/settings/graphics_reminder"))
end)
end
resolution_level = DCEI.Settings.GetResolutionLevel()
layout.GraphicsPopup["Quality" .. resolution_level].state.is_selected = true
end
bool Settings.IsDynamicShadowEnabled()
bool Settings.IsDynamicShadowEnabled()
Description
Get the Dynamic Shadow enable state.
Example Usage
function SettingsMenu.InitializeGraphicsPopup(layout)
DCEI.SetOnClickCallback(layout.GraphicSettings.Frame, function()
layout.GraphicsPopup:Show()
end)
DCEI.SetOnClickCallback(layout.GraphicsPopup.CloseButton, function()
layout.GraphicsPopup:Hide()
end)
if not layout.GraphicsPopup.state then
layout.GraphicsPopup.state = DCEI.GetFrameState(layout.GraphicsPopup.Frame)
end
layout.GraphicsPopup.state.fps_60 = not DCEI.Settings.IsFps30()
layout.GraphicsPopup.state.dynamic_shadows = DCEI.Settings.IsDynamicShadowEnabled()
DCEI.SetOnClickCallback(layout.GraphicsPopup.FPS60.Frame, function()
DCEI.Settings.SetFps30Enabled(not DCEI.Settings.IsFps30())
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/settings/graphics_reminder"))
end)
DCEI.SetOnClickCallback(layout.GraphicsPopup.DynamicShadows.Frame, function()
DCEI.Settings.SetDynamicShadowEnabled(not DCEI.Settings.IsDynamicShadowEnabled())
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/settings/graphics_reminder"))
end)
for i = 0, 2 do
if not layout.GraphicsPopup["Quality" .. i].state then
layout.GraphicsPopup["Quality" .. i].state = DCEI.GetFrameState(layout.GraphicsPopup["Quality" .. i].Frame)
end
DCEI.SetOnClickCallback(layout.GraphicsPopup["Quality" .. i].Frame, function()
layout.GraphicsPopup["Quality" .. resolution_level].state.is_selected = false
layout.GraphicsPopup["Quality" .. i].state.is_selected = true
resolution_level = i
DCEI.Settings.SetResolutionLevel(i)
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/settings/graphics_reminder"))
end)
end
resolution_level = DCEI.Settings.GetResolutionLevel()
layout.GraphicsPopup["Quality" .. resolution_level].state.is_selected = true
end
void Settings.SetDynamicShadowEnabled(bool enable)
void Settings.SetDynamicShadowEnabled(bool enable)
Description
Enable/Disable Dynamic Shadow. Note: New dynamic shadow setting will be applied after restart.
Parameters
- bool
enable
the state to set
Example Usage
function SettingsMenu.InitializeGraphicsPopup(layout)
DCEI.SetOnClickCallback(layout.GraphicSettings.Frame, function()
layout.GraphicsPopup:Show()
end)
DCEI.SetOnClickCallback(layout.GraphicsPopup.CloseButton, function()
layout.GraphicsPopup:Hide()
end)
if not layout.GraphicsPopup.state then
layout.GraphicsPopup.state = DCEI.GetFrameState(layout.GraphicsPopup.Frame)
end
layout.GraphicsPopup.state.fps_60 = not DCEI.Settings.IsFps30()
layout.GraphicsPopup.state.dynamic_shadows = DCEI.Settings.IsDynamicShadowEnabled()
DCEI.SetOnClickCallback(layout.GraphicsPopup.FPS60.Frame, function()
DCEI.Settings.SetFps30Enabled(not DCEI.Settings.IsFps30())
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/settings/graphics_reminder"))
end)
DCEI.SetOnClickCallback(layout.GraphicsPopup.DynamicShadows.Frame, function()
DCEI.Settings.SetDynamicShadowEnabled(not DCEI.Settings.IsDynamicShadowEnabled())
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/settings/graphics_reminder"))
end)
for i = 0, 2 do
if not layout.GraphicsPopup["Quality" .. i].state then
layout.GraphicsPopup["Quality" .. i].state = DCEI.GetFrameState(layout.GraphicsPopup["Quality" .. i].Frame)
end
DCEI.SetOnClickCallback(layout.GraphicsPopup["Quality" .. i].Frame, function()
layout.GraphicsPopup["Quality" .. resolution_level].state.is_selected = false
layout.GraphicsPopup["Quality" .. i].state.is_selected = true
resolution_level = i
DCEI.Settings.SetResolutionLevel(i)
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/settings/graphics_reminder"))
end)
end
resolution_level = DCEI.Settings.GetResolutionLevel()
layout.GraphicsPopup["Quality" .. resolution_level].state.is_selected = true
end
bool Settings.IsFps30()
bool Settings.IsFps30()
Description
Get if the game is set to 30 FPS.
Example Usage
function SettingsMenu.InitializeGraphicsPopup(layout)
DCEI.SetOnClickCallback(layout.GraphicSettings.Frame, function()
layout.GraphicsPopup:Show()
end)
DCEI.SetOnClickCallback(layout.GraphicsPopup.CloseButton, function()
layout.GraphicsPopup:Hide()
end)
if not layout.GraphicsPopup.state then
layout.GraphicsPopup.state = DCEI.GetFrameState(layout.GraphicsPopup.Frame)
end
layout.GraphicsPopup.state.fps_60 = not DCEI.Settings.IsFps30()
layout.GraphicsPopup.state.dynamic_shadows = DCEI.Settings.IsDynamicShadowEnabled()
DCEI.SetOnClickCallback(layout.GraphicsPopup.FPS60.Frame, function()
DCEI.Settings.SetFps30Enabled(not DCEI.Settings.IsFps30())
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/settings/graphics_reminder"))
end)
DCEI.SetOnClickCallback(layout.GraphicsPopup.DynamicShadows.Frame, function()
DCEI.Settings.SetDynamicShadowEnabled(not DCEI.Settings.IsDynamicShadowEnabled())
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/settings/graphics_reminder"))
end)
for i = 0, 2 do
if not layout.GraphicsPopup["Quality" .. i].state then
layout.GraphicsPopup["Quality" .. i].state = DCEI.GetFrameState(layout.GraphicsPopup["Quality" .. i].Frame)
end
DCEI.SetOnClickCallback(layout.GraphicsPopup["Quality" .. i].Frame, function()
layout.GraphicsPopup["Quality" .. resolution_level].state.is_selected = false
layout.GraphicsPopup["Quality" .. i].state.is_selected = true
resolution_level = i
DCEI.Settings.SetResolutionLevel(i)
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/settings/graphics_reminder"))
end)
end
resolution_level = DCEI.Settings.GetResolutionLevel()
layout.GraphicsPopup["Quality" .. resolution_level].state.is_selected = true
end
void Settings.SetFps30Enabled(bool enable)
void Settings.SetFps30Enabled(bool enable)
Description
Enable/Disable game FPS 30 setting. Note: New fps setting will be applied after restart.
Parameters
- bool
enable
the state to set
Example Usage
function SettingsMenu.InitializeGraphicsPopup(layout)
DCEI.SetOnClickCallback(layout.GraphicSettings.Frame, function()
layout.GraphicsPopup:Show()
end)
DCEI.SetOnClickCallback(layout.GraphicsPopup.CloseButton, function()
layout.GraphicsPopup:Hide()
end)
if not layout.GraphicsPopup.state then
layout.GraphicsPopup.state = DCEI.GetFrameState(layout.GraphicsPopup.Frame)
end
layout.GraphicsPopup.state.fps_60 = not DCEI.Settings.IsFps30()
layout.GraphicsPopup.state.dynamic_shadows = DCEI.Settings.IsDynamicShadowEnabled()
DCEI.SetOnClickCallback(layout.GraphicsPopup.FPS60.Frame, function()
DCEI.Settings.SetFps30Enabled(not DCEI.Settings.IsFps30())
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/settings/graphics_reminder"))
end)
DCEI.SetOnClickCallback(layout.GraphicsPopup.DynamicShadows.Frame, function()
DCEI.Settings.SetDynamicShadowEnabled(not DCEI.Settings.IsDynamicShadowEnabled())
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/settings/graphics_reminder"))
end)
for i = 0, 2 do
if not layout.GraphicsPopup["Quality" .. i].state then
layout.GraphicsPopup["Quality" .. i].state = DCEI.GetFrameState(layout.GraphicsPopup["Quality" .. i].Frame)
end
DCEI.SetOnClickCallback(layout.GraphicsPopup["Quality" .. i].Frame, function()
layout.GraphicsPopup["Quality" .. resolution_level].state.is_selected = false
layout.GraphicsPopup["Quality" .. i].state.is_selected = true
resolution_level = i
DCEI.Settings.SetResolutionLevel(i)
DCEI.ShowFeedbackMessage(DCEI.GetTranslationText("ui/settings/graphics_reminder"))
end)
end
resolution_level = DCEI.Settings.GetResolutionLevel()
layout.GraphicsPopup["Quality" .. resolution_level].state.is_selected = true
end
bool Settings.IsFacebookConnected()
bool Settings.IsFacebookConnected()
Description
Whether player has link the account to Facebook.
Example Usage
function SettingsMenu.InitializePlatformButtons(layout)
-- Set initial state of platform buttons
layout.state.is_apple = DCEI.Platform == "IPhonePlayer"
layout.state.platform_connect = DCEI.Settings.IsGoogleConnected() or DCEI.Settings.IsAppleConnected()
layout.state.facebook_connect = DCEI.Settings.IsFacebookConnected()
local function PlatformConnect() --success, used or failed
if DCEI.Platform == "IPhonePlayer" then
SocialConnect("Apple")
layout.state.platform_connect = DCEI.Settings.IsAppleConnected()
else
SocialConnect("Google")
layout.state.platform_connect = DCEI.Settings.IsGoogleConnected()
end
end
local function FacebookConnect()
SocialConnect("Facebook")
layout.state.facebook_connect = DCEI.Settings.IsFacebookConnected()
end
-- Callbacks
DCEI.SetOnClickCallback(layout.ConnectOsPlatform.Frame, PlatformConnect)
DCEI.SetOnClickCallback(layout.ConnectFacebook.Frame, FacebookConnect)
end
void Settings.ConnectFacebook(TypedCallback<object> callback)
void Settings.ConnectFacebook(TypedCallback<object> callback)
Description
Try connect player's account to a Facebook account.
Parameters
- TypedCallback<object>
callback
the callback function that handles a return.
Callback Parameters
- Object
result
Example Usage
function ClickFacebookConnectCallback()
DCEI.ConnectFacebook(
function(result)
if result == "success" then
-- Handle connect success case
elseif result == "failed" then
-- Handle connect failed case
elseif result == "used" then
-- Handle account used case
end
end
)
end
DCEI.SetOnClickCallback(button_connect_facebook, ClickFacebookConnectCallback)
void Settings.DisconnectFacebook(TypedCallback<object> callback)
void Settings.DisconnectFacebook(TypedCallback<object> callback)
Description
Try disconnect player's account to a Facebook account.
Parameters
- TypedCallback<object>
callback
the callback function that handles a return.
Callback Parameters
- Object
result
Example Usage
function ClickFacebookDisconnectCallback()
DCEI.DisconnectFacebook(
function(result)
if result == "success" then
-- Handle disconnect success case
elseif result == "failed" then
-- Handle disconnect failed case
end
end
)
end
DCEI.SetOnClickCallback(button_disconnect_facebook, ClickFacebookDisconnectCallback)
void Settings.RestoreAccountByFacebook(TypedCallback<object> callback)
void Settings.RestoreAccountByFacebook(TypedCallback<object> callback)
Description
Try restore player's account by facebook. Only call this api when Settings.ConnectFacebook api return "used".
Note: if restore succeed, the game will restart automatically and the callback won't be called.
Parameters
- TypedCallback<object>
callback
the callback function that handles a return.
Callback Parameters
- Object
result
Example Usage
function ClickFacebookRestoreCallback()
DCEI.RestoreAccountByFacebook(
function(result)
if result == "failed" then
-- Handle disconnect failed case
end
end
)
end
DCEI.SetOnClickCallback(button_restore_facebook, ClickFacebookRestoreCallback)
bool Settings.IsGoogleConnected()
bool Settings.IsGoogleConnected()
Description
Whether player has link the account to Google.
Example Usage
function SettingsMenu.InitializePlatformButtons(layout)
-- Set initial state of platform buttons
layout.state.is_apple = DCEI.Platform == "IPhonePlayer"
layout.state.platform_connect = DCEI.Settings.IsGoogleConnected() or DCEI.Settings.IsAppleConnected()
layout.state.facebook_connect = DCEI.Settings.IsFacebookConnected()
local function PlatformConnect() --success, used or failed
if DCEI.Platform == "IPhonePlayer" then
SocialConnect("Apple")
layout.state.platform_connect = DCEI.Settings.IsAppleConnected()
else
SocialConnect("Google")
layout.state.platform_connect = DCEI.Settings.IsGoogleConnected()
end
end
local function FacebookConnect()
SocialConnect("Facebook")
layout.state.facebook_connect = DCEI.Settings.IsFacebookConnected()
end
-- Callbacks
DCEI.SetOnClickCallback(layout.ConnectOsPlatform.Frame, PlatformConnect)
DCEI.SetOnClickCallback(layout.ConnectFacebook.Frame, FacebookConnect)
end
void Settings.ConnectGoogle(TypedCallback<object> callback)
void Settings.ConnectGoogle(TypedCallback<object> callback)
Description
Try connect player's account to a Google account.
Parameters
- TypedCallback<object>
callback
the callback function that handles a return.
Callback Parameters
- Object
result
Example Usage
function ClickGoogleConnectCallback()
DCEI.ConnectGoogle(
function(result)
if result == "success" then
-- Handle connect success case
elseif result == "failed" then
-- Handle connect failed case
elseif result == "used" then
-- Handle account used case
end
end
)
end
DCEI.SetOnClickCallback(button_connect_google, ClickGoogleConnectCallback)
void Settings.DisconnectGoogle(TypedCallback<object> callback)
void Settings.DisconnectGoogle(TypedCallback<object> callback)
Description
Try disconnect player's account to a Google account.
Parameters
- TypedCallback<object>
callback
the callback function that handles a return.
Callback Parameters
- Object
result
Example Usage
function ClickGoogleDisconnectCallback()
DCEI.DisconnectGoogle(
function(result)
if result == "success" then
-- Handle disconnect success case
elseif result == "failed" then
-- Handle disconnect failed case
end
end
)
end
DCEI.SetOnClickCallback(button_disconnect_google, ClickGoogleDisconnectCallback)
void Settings.RestoreAccountByGoogle(TypedCallback<object> callback)
void Settings.RestoreAccountByGoogle(TypedCallback<object> callback)
Description
Try restore player's account by facebook. Only call this api when Settings.ConnectGoogle api return "used".
Note: if restore succeed, the game will restart automatically and the callback won't be called.
Parameters
- TypedCallback<object>
callback
the callback function that handles a return.
Callback Parameters
- Object
result
Example Usage
function ClickGoogleRestoreCallback()
DCEI.RestoreAccountByGoogle(
function(result)
if result == "failed" then
-- Handle disconnect failed case
end
end
)
end
DCEI.SetOnClickCallback(button_restore_google, ClickGoogleRestoreCallback)
bool Settings.IsAppleConnected()
bool Settings.IsAppleConnected()
Description
Whether player has linked the account to Apple.
Example Usage
local is_apple_connect = DCEI.Settings.IsAppleConnected()
if not is_apple_connect then
DCEI.ConnectApple(
function(result)
if result == "success" then
-- Handle connect success case
elseif result == "failed" then
-- Handle connect failed case
elseif result == "used" then
-- Handle account used case
end
end
)
end
void Settings.ConnectApple(TypedCallback<object> callback)
void Settings.ConnectApple(TypedCallback<object> callback)
Description
Try connect player's account to a Apple account.
Parameters
- TypedCallback<object>
callback
the callback function that handles a return.
Callback Parameters
- Object
result
Example Usage
function ClickAppleConnectCallback()
DCEI.ConnectApple(
function(result)
if result == "success" then
-- Handle connect success case
elseif result == "failed" then
-- Handle connect failed case
elseif result == "used" then
-- Handle account used case
end
end
)
end
DCEI.SetOnClickCallback(button_connect_apple, ClickAppleConnectCallback)
void Settings.DisconnectApple(TypedCallback<object> callback)
void Settings.DisconnectApple(TypedCallback<object> callback)
Description
Try disconnect player's account to a Apple account.
Parameters
- TypedCallback<object>
callback
the callback function that handles a return.
Callback Parameters
- Object
result
Example Usage
function ClickAppleDisconnectCallback()
DCEI.DisconnectApple(
function(result)
if result == "success" then
-- Handle disconnect success case
elseif result == "failed" then
-- Handle disconnect failed case
end
end
)
end
DCEI.SetOnClickCallback(button_disconnect_apple, ClickAppleDisconnectCallback)
void Settings.RestoreAccountByApple(TypedCallback<object> callback)
void Settings.RestoreAccountByApple(TypedCallback<object> callback)
Description
Try restore player's account by Apple. Only call this api when Settings.ConnectApple api return "used".
Note: if restore succeed, the game will restart automatically and the callback won't be called.
Parameters
- TypedCallback<object>
callback
the callback function that handles a return.
Callback Parameters
- Object
result
Example Usage
function ClickAppleRestoreCallback()
DCEI.RestoreAccountByApple(
function(result)
if result == "failed" then
-- Handle disconnect failed case
end
end
)
end
DCEI.SetOnClickCallback(button_restore_apple, ClickAppleRestoreCallback)
void Settings.SendSupportEmail(string subject, string content)
void Settings.SendSupportEmail(string subject, string content)
Description
Sends a email to the game's support email address.
Parameters
- string
subject
title of the email. - string
content
body message text of the email.
Example Usage
-- Support
-- The API automatically prefixes the game name and appends the player's id at the end of the subject line
local subject = "Support"
-- The API automatically appends the player ID, version, and platform at the end of the content.
local content = "\n\n\n\n --------------------------- \n" .. "Reply above this line. \n \n"
DCEI.SetOnClickCallback(layout.Support.Frame, function()
DCEI.Settings.SendSupportEmail(subject, content)
end)