public async void Init(AVUser user)
{
LeanCloud.Common.Logger.LogDelegate = (level, log) =>
{
switch (level)
{
case LogLevel.Debug:
Debug.LogFormat("[DEBUG] {0}", log);
break;
case LogLevel.Warn:
Debug.LogWarningFormat("[WARN] {0}", log);
break;
case LogLevel.Error:
LogHelper.Error("[ERROR] {0}", log);
break;
}
};
_client = new Client(Config.AppId, Config.AppKey, user.ObjectId);
await Connect();
}
private async Task Connect()
{
try
{
await _client.Connect();
LogHelper.Debug("Connect");
}
catch (PlayException e)
{
// 连接失败
LogHelper.Error("Connect failed, {0}, {1}", e.Code, e.Detail);
}
}