csharp-sdk-upm/Storage/Storage.Unity/Public/LCApplication.cs

41 lines
1.4 KiB
C#
Raw Normal View History

2021-04-09 14:24:04 +08:00
using LeanCloud.Common;
2021-04-20 11:20:45 +08:00
using LeanCloud.Storage.Internal;
2021-04-09 14:24:04 +08:00
using LeanCloud.Storage.Internal.Persistence;
namespace LeanCloud {
2021-04-19 16:28:31 +08:00
/// <summary>
/// LCApplication contains static functions that handle global configuration
/// for LeanCloud services.
/// </summary>
2021-04-09 14:24:04 +08:00
public class LCApplication {
2021-04-19 16:28:31 +08:00
/// <summary>
/// Whether or not ths SDK using master key.
/// Default is false.
/// </summary>
2021-04-09 14:24:04 +08:00
public static bool UseMasterKey {
get => LCCore.UseMasterKey;
set {
LCCore.UseMasterKey = value;
}
}
2021-04-19 16:28:31 +08:00
/// <summary>
/// Initialize LeanCloud services.
/// </summary>
/// <param name="appId">The application id provided in LeanCloud dashboard.</param>
/// <param name="appKey">The application key provided in LeanCloud dashboard.</param>
/// <param name="server">The server url bound by yourself.</param>
/// <param name="masterKey">The application master key provided in LeanCloud dashboard.</param>
2021-04-09 14:24:04 +08:00
public static void Initialize(string appId,
string appKey,
string server = null,
string masterKey = null) {
LCLogger.Debug("Application Initializes on Unity.");
LCStorage.Initialize(appId, appKey, server, masterKey);
LCCore.PersistenceController = new PersistenceController(new UnityPersistence());
}
}
}